sfx2: sidebar: new .uno commands to show and hide sidebars

Change-Id: I9afba5eec855d6de590086736177b543d52d3b20
Reviewed-on: https://gerrit.libreoffice.org/85192
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 81c02c2..ad44965 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3310,12 +3310,12 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin
    }
    else if (aMap.find("id") != aMap.end())
    {
        const OUString sClickAction("CLICK");
        const OUString sSelectAction("SELECT");
        const OUString sClearAction("CLEAR");
        const OUString sTypeAction("TYPE");
        const OUString sUpAction("UP");
        const OUString sDownAction("DOWN");
        static const OUString sClickAction("CLICK");
        static const OUString sSelectAction("SELECT");
        static const OUString sClearAction("CLEAR");
        static const OUString sTypeAction("TYPE");
        static const OUString sUpAction("UP");
        static const OUString sDownAction("DOWN");

        try
        {
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index 9fa90a5f..f7d7725 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -575,6 +575,8 @@ class SvxSearchItem;
#define SID_TABLE_BORDER_TYPE               (SID_SVX_START + 1065)
#define SID_TABLE_BORDER_INDEX              (SID_SVX_START + 1066)
#define SID_TABLE_BORDER_OFFSET             (SID_SVX_START + 1067)
#define SID_SHOW_SIDEBAR                    (SID_SVX_START + 1200)
#define SID_HIDE_SIDEBAR                    (SID_SVX_START + 1201)

#define FID_SVX_START                       (SID_LIB_START + 500)
#define FID_SEARCH_NOW                      (FID_SVX_START + 2)
diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index f12a326..09fa766 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -999,8 +999,11 @@ class SvxSetItem;
#define SID_ULINE_VAL_DOUBLE                            (SID_SVX_START + 1197) /* double underline */
#define SID_ULINE_VAL_DOTTED                            (SID_SVX_START + 1198) /* dotted underline */

// #define SID_SHOW_SIDEBAR                                ( SID_SVX_START + 1200 ) -> sfxsids.hrc
// #define SID_HIDE_SIDEBAR                                ( SID_SVX_START + 1201 ) -> sfxsids.hrc

// IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
#define SID_SVX_FIRSTFREE                               ( SID_SVX_START + 1198 + 1 )
#define SID_SVX_FIRSTFREE                               ( SID_HIDE_SIDEBAR + 1 )

// Overflow check for slot IDs
#if SID_SVX_FIRSTFREE > SID_SVX_END
diff --git a/sfx2/sdi/frmslots.sdi b/sfx2/sdi/frmslots.sdi
index 09aafef..53a13b4 100644
--- a/sfx2/sdi/frmslots.sdi
+++ b/sfx2/sdi/frmslots.sdi
@@ -43,6 +43,16 @@ interface Window
        ExecMethod = ChildWindowExecute ;
        StateMethod = ChildWindowState ;
    ]
    SID_SHOW_SIDEBAR // status(final|play)
    [
        ExecMethod = ChildWindowExecute ;
        StateMethod = ChildWindowState ;
    ]
    SID_HIDE_SIDEBAR // status(final|play)
    [
        ExecMethod = ChildWindowExecute ;
        StateMethod = ChildWindowState ;
    ]
    SID_BROWSER // ole(no) api()
    [
        ExecMethod = ChildWindowExecute ;
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 624abe1..f95610d 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -2594,6 +2594,42 @@ SfxBoolItem Sidebar SID_SIDEBAR
    GroupId = SfxGroupId::View;
]

SfxBoolItem SidebarShow SID_SHOW_SIDEBAR
[
    AutoUpdate = TRUE,
    FastCall = FALSE,
    ReadOnlyDoc = TRUE,
    Toggle = FALSE,
    Container = FALSE,
    RecordAbsolute = FALSE,
    RecordPerSet;
    Asynchron;


    AccelConfig = TRUE,
    MenuConfig = TRUE,
    ToolBoxConfig = TRUE,
    GroupId = SfxGroupId::View;
]

SfxBoolItem SidebarHide SID_HIDE_SIDEBAR
[
    AutoUpdate = TRUE,
    FastCall = FALSE,
    ReadOnlyDoc = TRUE,
    Toggle = FALSE,
    Container = FALSE,
    RecordAbsolute = FALSE,
    RecordPerSet;
    Asynchron;


    AccelConfig = TRUE,
    MenuConfig = TRUE,
    ToolBoxConfig = TRUE,
    GroupId = SfxGroupId::View;
]

SfxBoolItem Menubar SID_MENUBAR
[
    AutoUpdate = TRUE,
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 335b634..8d5e7f1 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -1223,7 +1223,7 @@ void SidebarController::RequestCloseDeck()
            // Mobile.
            std::stringstream aStream;
            boost::property_tree::ptree aTree;
            aTree.put("id", mpParentWindow->get_id()); // TODO could be missing - sort out
            aTree.put("id", mpCurrentDeck->GetLOKWindowId());
            aTree.put("type", "dockingwindow");
            aTree.put("text", mpParentWindow->GetText());
            aTree.put("enabled", false);
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index 0ee2117..5f731f6 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -69,7 +69,9 @@ public:
            {
                // Mobile.
                std::stringstream aStream;
                boost::property_tree::write_json(aStream, m_rSidebarDockingWin.DumpAsPropertyTree());
                boost::property_tree::ptree aTree = m_rSidebarDockingWin.DumpAsPropertyTree();
                aTree.put("id", m_rSidebarDockingWin.GetLOKWindowId());
                boost::property_tree::write_json(aStream, aTree);
                const std::string message = aStream.str();
                if (message != m_LastNotificationMessage)
                {
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 81f9d1f..a19a89a 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -3217,17 +3217,28 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState )
            else if ( KnowsChildWindow(nSID) )
                rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID) ) );
        }
        else if ( nSID == SID_SIDEBAR )
        else if ( nSID == SID_SIDEBAR || nSID == SID_SHOW_SIDEBAR || nSID == SID_HIDE_SIDEBAR )
        {
            if  ( !KnowsChildWindow( nSID ) )
            if  ( !KnowsChildWindow( SID_SIDEBAR ) )
            {
                SAL_WARN("sfx.view", "SID_SIDEBAR state requested, but no task pane child window exists for this ID!");
                rState.DisableItem( nSID );
                rState.DisableItem( SID_SIDEBAR );
            }
            else
            else if ( nSID == SID_SIDEBAR )
            {
                // Toggle.
                rState.Put( SfxBoolItem( nSID, HasChildWindow( nSID ) ) );
            }
            else if ( nSID == SID_SHOW_SIDEBAR )
            {
                // Show.
                rState.Put( SfxBoolItem( nSID, false ) );
            }
            else if ( nSID == SID_HIDE_SIDEBAR )
            {
                // Hide.
                rState.Put( SfxBoolItem( nSID, true ) );
            }
        }
        else if ( KnowsChildWindow(nSID) )
            rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID) ) );