summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-04-22 20:25:43 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-04-26 17:01:41 +0200
commit9098d5a2e43b156648f187559790547d1b536896 (patch)
tree6c7cef6c05e2fec99c09d4a48e3646bff311f5cc /starmath
parent57087dd1945429d9cfe6ce8bdc329ef315f455d3 (diff)
tdf#125931: Enable sidebar in Math
No panels yet, only one default deck (PropertyDeck). It is needed to have the uniform default deck like in all other modules (see commit c09f59eb6173a4a53a2d40ed80aebed18e3882ac); the panels for formula properties might appear later. Change-Id: If1785dc780111fe496638418f43e7b90a250ffce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133334 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/smdll.cxx3
-rw-r--r--starmath/source/view.cxx36
-rw-r--r--starmath/uiconfig/smath/menubar/menubar.xml1
3 files changed, 40 insertions, 0 deletions
diff --git a/starmath/source/smdll.cxx b/starmath/source/smdll.cxx
index 7ef93bfa0f3c..f10e9d9db3f0 100644
--- a/starmath/source/smdll.cxx
+++ b/starmath/source/smdll.cxx
@@ -25,6 +25,7 @@
#include <svx/zoomsliderctrl.hxx>
#include <sfx2/docfac.hxx>
#include <sfx2/app.hxx>
+#include <sfx2/sidebar/SidebarChildWindow.hxx>
#include <smdll.hxx>
#include <smmod.hxx>
@@ -69,6 +70,8 @@ namespace
SvxModifyControl::RegisterControl(SID_TEXTSTATUS, pModule);
XmlSecStatusBarControl::RegisterControl(SID_SIGNATURE, pModule);
+ sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(false, pModule);
+
SmCmdBoxWrapper::RegisterChildWindow(true);
SmElementsDockingWindowWrapper::RegisterChildWindow(true);
}
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index cea8a3fd8abf..360c96390f95 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -42,6 +42,8 @@
#include <sfx2/objface.hxx>
#include <sfx2/printer.hxx>
#include <sfx2/request.hxx>
+#include <sfx2/sfxbasecontroller.hxx>
+#include <sfx2/sidebar/SidebarChildWindow.hxx>
#include <sfx2/viewfac.hxx>
#include <svl/eitem.hxx>
#include <svl/itemset.hxx>
@@ -50,6 +52,7 @@
#include <vcl/transfer.hxx>
#include <svtools/colorcfg.hxx>
#include <svl/whiter.hxx>
+#include <svx/sidebar/SelectionChangeHandler.hxx>
#include <svx/zoomslideritem.hxx>
#include <editeng/editeng.hxx>
#include <editeng/editview.hxx>
@@ -1079,6 +1082,8 @@ void SmViewShell::InitInterface_Impl()
GetStaticInterface()->RegisterChildWindow(SmCmdBoxWrapper::GetChildWindowId());
GetStaticInterface()->RegisterChildWindow(SmElementsDockingWindowWrapper::GetChildWindowId());
GetStaticInterface()->RegisterChildWindow(SfxInfoBarContainerChild::GetChildWindowId());
+
+ GetStaticInterface()->RegisterChildWindow(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId());
}
SFX_IMPL_NAMED_VIEWFACTORY(SmViewShell, "Default")
@@ -2089,6 +2094,36 @@ void SmViewShell::GetState(SfxItemSet &rSet)
}
}
+namespace
+{
+class SmController : public SfxBaseController
+{
+public:
+ SmController(SfxViewShell& rViewShell)
+ : SfxBaseController(&rViewShell)
+ , mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler(
+ GetContextName, this, vcl::EnumContext::Context::Math))
+ {
+ mpSelectionChangeHandler->Connect();
+ rViewShell.SetContextName(GetContextName());
+ }
+ ~SmController() { mpSelectionChangeHandler->Disconnect(); }
+
+ // css::frame::XController
+ void SAL_CALL attachFrame(const css::uno::Reference<css::frame::XFrame>& xFrame) override
+ {
+ SfxBaseController::attachFrame(xFrame);
+
+ mpSelectionChangeHandler->selectionChanged({}); // Installs the correct context
+ }
+
+private:
+ static OUString GetContextName() { return "Math"; } // Static constant for now
+
+ rtl::Reference<svx::sidebar::SelectionChangeHandler> mpSelectionChangeHandler;
+};
+}
+
SmViewShell::SmViewShell(SfxViewFrame *pFrame_, SfxViewShell *)
: SfxViewShell(pFrame_, SfxViewShellFlags::HAS_PRINTOPTIONS)
, mxGraphicWindow(VclPtr<SmGraphicWindow>::Create(*this))
@@ -2100,6 +2135,7 @@ SmViewShell::SmViewShell(SfxViewFrame *pFrame_, SfxViewShell *)
SetWindow(mxGraphicWindow.get());
SfxShell::SetName("SmView");
SfxShell::SetUndoManager( &GetDoc()->GetEditEngine().GetUndoManager() );
+ SetController(new SmController(*this));
}
SmViewShell::~SmViewShell()
diff --git a/starmath/uiconfig/smath/menubar/menubar.xml b/starmath/uiconfig/smath/menubar/menubar.xml
index 04ca77df844b..434d4deeb970 100644
--- a/starmath/uiconfig/smath/menubar/menubar.xml
+++ b/starmath/uiconfig/smath/menubar/menubar.xml
@@ -87,6 +87,7 @@
<menu:menuitem menu:id=".uno:AvailableToolbars"/>
<menu:menuitem menu:id=".uno:StatusBarVisible"/>
<menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:Sidebar"/>
<menu:menuitem menu:id=".uno:ElementsDockingWindow"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:FullScreen"/>