summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/sidebar/Sidebar.cxx46
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx10
2 files changed, 55 insertions, 1 deletions
diff --git a/sfx2/source/sidebar/Sidebar.cxx b/sfx2/source/sidebar/Sidebar.cxx
index e56a259c5e7c..19f7c4f9ce78 100644
--- a/sfx2/source/sidebar/Sidebar.cxx
+++ b/sfx2/source/sidebar/Sidebar.cxx
@@ -20,11 +20,13 @@
#include <sfx2/sidebar/Sidebar.hxx>
#include <sfx2/sidebar/SidebarController.hxx>
#include <sfx2/sidebar/ResourceManager.hxx>
+#include <sfx2/sidebar/SidebarDockingWindow.hxx>
#include <sidebar/PanelDescriptor.hxx>
#include <sidebar/Tools.hxx>
#include <sfx2/sidebar/FocusManager.hxx>
#include <sfx2/childwin.hxx>
#include <sfx2/sfxsids.hrc>
+#include <sfx2/viewsh.hxx>
#include <com/sun/star/frame/XDispatch.hpp>
using namespace css;
@@ -123,6 +125,50 @@ bool Sidebar::IsPanelVisible(
return pController->IsDeckVisible(xPanelDescriptor->msDeckId);
}
+bool Sidebar::Setup(std::u16string_view sidebarDeckId)
+{
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ SfxViewFrame* pViewFrame = pViewShell ? &pViewShell->GetViewFrame() : nullptr;
+ if (pViewFrame)
+ {
+ if (!pViewFrame->GetChildWindow(SID_SIDEBAR))
+ pViewFrame->SetChildWindow(SID_SIDEBAR, false /* create it */, true /* focus */);
+
+ pViewFrame->ShowChildWindow(SID_SIDEBAR, true);
+
+ // Force synchronous population of panels
+ SfxChildWindow *pChild = pViewFrame->GetChildWindow(SID_SIDEBAR);
+ if (!pChild)
+ return false;
+
+ auto pDockingWin = dynamic_cast<sfx2::sidebar::SidebarDockingWindow *>(pChild->GetWindow());
+ if (!pDockingWin)
+ return false;
+
+ pViewFrame->ShowChildWindow( SID_SIDEBAR );
+
+ const rtl::Reference<sfx2::sidebar::SidebarController>& xController
+ = pDockingWin->GetOrCreateSidebarController();
+
+ xController->FadeIn();
+ xController->RequestOpenDeck();
+
+ if (!sidebarDeckId.empty())
+ {
+ xController->SwitchToDeck(sidebarDeckId);
+ }
+ else
+ {
+ xController->SwitchToDefaultDeck();
+ }
+
+ pDockingWin->SyncUpdate();
+ return true;
+ }
+ else
+ return false;
+}
+
} // end of namespace sfx2::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index ba627e4d586d..a9ec224cfe7d 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -229,8 +229,16 @@ void SidebarController::disposeDecks()
{
const std::string hide = UnoNameFromDeckId(msCurrentDeckId, GetCurrentContext());
if (!hide.empty())
+ {
+ // Be consistent with SwitchToDeck(), so both places emit JSON.
+ boost::property_tree::ptree aTree;
+ aTree.put("commandName", hide);
+ aTree.put("state", "false");
+ std::stringstream aStream;
+ boost::property_tree::write_json(aStream, aTree);
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
- OString(hide + "=false"));
+ OString(aStream.str()));
+ }
}
if (mpParentWindow)