diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2022-04-22 20:25:43 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-06-05 07:34:41 +0200 |
commit | 5ebb6747ad577618cb1f9f3632474eaa0d27a7fe (patch) | |
tree | f8bd460dadede3ff0943739b7127214081c9b3cd /starmath | |
parent | 7cb4ca195baff69be13154ef042498ab7f51d2cb (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>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135398
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/source/smdll.cxx | 3 | ||||
-rw-r--r-- | starmath/source/view.cxx | 36 | ||||
-rw-r--r-- | starmath/uiconfig/smath/menubar/menubar.xml | 1 |
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 62e8b01d5348..002a2321c1d1 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -41,6 +41,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> @@ -49,6 +51,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> @@ -1024,6 +1027,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") @@ -2044,6 +2049,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)) @@ -2055,6 +2090,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 f1dbdf8745a9..ebe9eccc774c 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"/> |