include/vcl/EnumContext.hxx                                    |    1 
 officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs |    4 -
 sfx2/source/sidebar/ResourceManager.cxx                        |    2 
 starmath/source/smdll.cxx                                      |    3 
 starmath/source/view.cxx                                       |   36 
++++++++++
 starmath/uiconfig/smath/menubar/menubar.xml                    |    1 
 vcl/source/window/EnumContext.cxx                              |    1 
 7 files changed, 47 insertions(+), 1 deletion(-)

New commits:
commit 5ebb6747ad577618cb1f9f3632474eaa0d27a7fe
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Apr 22 20:25:43 2022 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sun Jun 5 07:34:41 2022 +0200

    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.kagan...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135398
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/include/vcl/EnumContext.hxx b/include/vcl/EnumContext.hxx
index dec5711b6ba5..9d82e72adc9d 100644
--- a/include/vcl/EnumContext.hxx
+++ b/include/vcl/EnumContext.hxx
@@ -83,6 +83,7 @@ public:
         Grid,
         HandoutPage,
         MasterPage,
+        Math,
         Media,
         MultiObject,
         NotesPage,
diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs 
b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
index 10e57ac4fb64..4b5d13b63c5f 100644
--- a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
@@ -87,6 +87,7 @@
                  com.sun.star.presentation.PresentationDocument
                  com.sun.star.drawing.DrawingDocument
                  com.sun.star.chart2.ChartDocument
+                 com.sun.star.formula.FormulaProperties
 
              Recognized shortcuts:
                  Writer
@@ -94,6 +95,7 @@
                  Impress
                  Draw
                  Chart
+                 Math
 
              Shortcuts for multiple applications:
                  DrawImpress
@@ -109,7 +111,7 @@
           2  Context name
               Know context names are 3DObject, Annotation, Auditing, Axis, 
Cell, Chart, ChartElements, Draw,
               DrawFontwork, DrawLine, DrawPage, DrawText, EditCell, ErrorBar, 
Form, Frame, Graphic, Grid,
-              HandoutPage, MasterPage, Media, MultiObject, NotesPage, OLE, 
OutlineText, Pivot, Printpreview,
+              HandoutPage, MasterPage, Math, Media, MultiObject, NotesPage, 
OLE, OutlineText, Pivot, Printpreview,
               Series, SlidesorterPage, Table, Text, TextObject, Trendline, 
Sparkline
 
              Special values:
diff --git a/sfx2/source/sidebar/ResourceManager.cxx 
b/sfx2/source/sidebar/ResourceManager.cxx
index 664d6c42b479..7bdae537b088 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -556,6 +556,8 @@ void ResourceManager::ReadContextList (
                 
aApplications.push_back(vcl::EnumContext::Application::Impress);
             else if (sApplicationName == "Chart")
                 aApplications.push_back(vcl::EnumContext::Application::Chart);
+            else if (sApplicationName == "Math")
+                
aApplications.push_back(vcl::EnumContext::Application::Formula);
             else if (sApplicationName == "DrawImpress")
             {
                 // A special case among the special names:  it is
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"/>
diff --git a/vcl/source/window/EnumContext.cxx 
b/vcl/source/window/EnumContext.cxx
index 2eb23e591a5a..6ca075eb6943 100644
--- a/vcl/source/window/EnumContext.cxx
+++ b/vcl/source/window/EnumContext.cxx
@@ -171,6 +171,7 @@ void EnumContext::ProvideContextContainers()
     AddEntry("Grid", Context::Grid);
     AddEntry("HandoutPage", Context::HandoutPage);
     AddEntry("MasterPage", Context::MasterPage);
+    AddEntry("Math", Context::Math);
     AddEntry("Media", Context::Media);
     AddEntry("MultiObject", Context::MultiObject);
     AddEntry("NotesPage", Context::NotesPage);

Reply via email to