[Libreoffice-commits] core.git: include/sfx2 sfx2/inc sfx2/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue May 26 15:00:27 UTC 2020


 include/sfx2/sidebar/SidebarToolBox.hxx           |    3 ++-
 include/sfx2/weldutils.hxx                        |    4 +++-
 sfx2/inc/sidebar/ControllerFactory.hxx            |    7 ++++---
 sfx2/source/notebookbar/NotebookbarTabControl.cxx |    1 +
 sfx2/source/sidebar/ControllerFactory.cxx         |   12 ++++++------
 sfx2/source/sidebar/PanelTitleBar.cxx             |    2 +-
 sfx2/source/sidebar/SidebarToolBox.cxx            |   10 ++++++----
 sfx2/source/toolbox/weldutils.cxx                 |    6 ++++--
 8 files changed, 27 insertions(+), 18 deletions(-)

New commits:
commit 2dd7c6a441f48a23dcbff1ebe24bdf21666c4ff0
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon May 25 20:18:56 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue May 26 16:59:50 2020 +0200

    tdf#133094 NotebookbarToolBox is not in the sidebar
    
    though it is inheriting from SidebarToolBox and we're distinguish the sidebar
    case from the non-sidebar case wrt certain color toolbuttons
    
    Change-Id: Ieffe45adfab95d426bb36296ee3428b6bd3dbd3f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94806
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/sfx2/sidebar/SidebarToolBox.hxx b/include/sfx2/sidebar/SidebarToolBox.hxx
index 9eb54744fe5b..bf0fbf60ceba 100644
--- a/include/sfx2/sidebar/SidebarToolBox.hxx
+++ b/include/sfx2/sidebar/SidebarToolBox.hxx
@@ -62,6 +62,7 @@ protected:
     ControllerContainer maControllers;
     bool mbAreHandlersRegistered;
     bool mbUseDefaultButtonSize;
+    bool mbSideBar;
 
     DECL_LINK(DropDownClickHandler, ToolBox*, void);
     DECL_LINK(ClickHandler, ToolBox*, void);
@@ -73,7 +74,7 @@ protected:
 
     void CreateController(const sal_uInt16 nItemId,
                           const css::uno::Reference<css::frame::XFrame>& rxFrame,
-                          const sal_Int32 nItemWidth);
+                          const sal_Int32 nItemWidth, bool bSideBar);
     void RegisterHandlers();
 };
 
diff --git a/include/sfx2/weldutils.hxx b/include/sfx2/weldutils.hxx
index c2e05d54924a..c72a473c4cf9 100644
--- a/include/sfx2/weldutils.hxx
+++ b/include/sfx2/weldutils.hxx
@@ -35,6 +35,7 @@ private:
     SvtMiscOptions m_aToolbarOptions;
     weld::Toolbar* m_pToolbar;
     weld::Builder* m_pBuilder;
+    bool m_bSideBar;
 
     DECL_LINK(SelectHdl, const OString&, void);
     DECL_LINK(ToggleMenuHdl, const OString&, void);
@@ -50,7 +51,8 @@ private:
 public:
     // fill in the label and icons for actions and dispatch the action on item click
     ToolbarUnoDispatcher(weld::Toolbar& rToolbar, weld::Builder& rBuilder,
-                         const css::uno::Reference<css::frame::XFrame>& rFrame);
+                         const css::uno::Reference<css::frame::XFrame>& rFrame,
+                         bool bSideBar = true);
 
     css::uno::Reference<css::frame::XToolbarController>
     GetControllerForCommand(const OUString& rCommand) const;
diff --git a/sfx2/inc/sidebar/ControllerFactory.hxx b/sfx2/inc/sidebar/ControllerFactory.hxx
index 116458443abc..dbf609775a39 100644
--- a/sfx2/inc/sidebar/ControllerFactory.hxx
+++ b/sfx2/inc/sidebar/ControllerFactory.hxx
@@ -47,13 +47,14 @@ public:
         const css::uno::Reference<css::frame::XFrame>& rxFrame,
         const css::uno::Reference<css::frame::XController>& rxController,
         const css::uno::Reference<css::awt::XWindow>& rxParentWindow,
-        const sal_Int32 nItemWidth);
+        const sal_Int32 nItemWidth, bool bSideBar);
 
     static css::uno::Reference<css::frame::XToolbarController> CreateToolBoxController(
         weld::Toolbar& rToolbar,
         weld::Builder& rBuilder,
         const OUString& rsCommandName,
-        const css::uno::Reference<css::frame::XFrame>& rxFrame);
+        const css::uno::Reference<css::frame::XFrame>& rxFrame,
+        bool bSideBar);
 
 private:
     static css::uno::Reference<css::frame::XToolbarController> CreateToolBarController(
@@ -61,7 +62,7 @@ private:
         const OUString& rsCommandName,
         const css::uno::Reference<css::frame::XFrame>& rxFrame,
         const css::uno::Reference<css::frame::XController>& rxController,
-        const sal_Int32 nWidth);
+        const sal_Int32 nWidth, bool bSideBar);
 };
 
 
diff --git a/sfx2/source/notebookbar/NotebookbarTabControl.cxx b/sfx2/source/notebookbar/NotebookbarTabControl.cxx
index 9199106de58b..79f0cd7ef67c 100644
--- a/sfx2/source/notebookbar/NotebookbarTabControl.cxx
+++ b/sfx2/source/notebookbar/NotebookbarTabControl.cxx
@@ -126,6 +126,7 @@ public:
     : sfx2::sidebar::SidebarToolBox( pParent )
     {
         mbUseDefaultButtonSize = false;
+        mbSideBar = false;
         SetToolboxButtonSize(ToolBoxButtonSize::Small);
     }
 
diff --git a/sfx2/source/sidebar/ControllerFactory.cxx b/sfx2/source/sidebar/ControllerFactory.cxx
index 71d5a3649007..50ba57a00b1f 100644
--- a/sfx2/source/sidebar/ControllerFactory.cxx
+++ b/sfx2/source/sidebar/ControllerFactory.cxx
@@ -44,14 +44,14 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController(
     const Reference<frame::XFrame>& rxFrame,
     const Reference<frame::XController>& rxController,
     const Reference<awt::XWindow>& rxParentWindow,
-    const sal_Int32 nWidth)
+    const sal_Int32 nWidth, bool bSideBar)
 {
     Reference<frame::XToolbarController> xController (
         CreateToolBarController(
             VCLUnoHelper::GetInterface(pToolBox),
             rsCommandName,
             rxFrame, rxController,
-            nWidth));
+            nWidth, bSideBar));
 
     bool bFactoryHasController( xController.is() );
 
@@ -141,7 +141,7 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController(
 Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController(
     weld::Toolbar& rToolbar, weld::Builder& rBuilder,
     const OUString& rsCommandName,
-    const Reference<frame::XFrame>& rxFrame)
+    const Reference<frame::XFrame>& rxFrame, bool bSideBar)
 {
     css::uno::Reference<css::awt::XWindow> xWidget(new weld::TransportAsXWindow(&rToolbar, &rBuilder));
 
@@ -150,7 +150,7 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController(
             xWidget,
             rsCommandName,
             rxFrame, rxFrame->getController(),
-            -1));
+            -1, bSideBar));
 
     if (!xController.is())
     {
@@ -204,7 +204,7 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBarController(
     const OUString& rsCommandName,
     const Reference<frame::XFrame>& rxFrame,
     const Reference<frame::XController>& rxController,
-    const sal_Int32 nWidth)
+    const sal_Int32 nWidth, bool bSideBar)
 {
     try
     {
@@ -234,7 +234,7 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBarController(
             aPropertyVector.push_back( makeAny( aPropValue ));
 
             aPropValue.Name = "IsSidebar";
-            aPropValue.Value <<= true;
+            aPropValue.Value <<= bSideBar;
             aPropertyVector.push_back( makeAny( aPropValue ));
 
             if (nWidth > 0)
diff --git a/sfx2/source/sidebar/PanelTitleBar.cxx b/sfx2/source/sidebar/PanelTitleBar.cxx
index 21c423fcc34e..e8613f6f93d3 100644
--- a/sfx2/source/sidebar/PanelTitleBar.cxx
+++ b/sfx2/source/sidebar/PanelTitleBar.cxx
@@ -93,7 +93,7 @@ void PanelTitleBar::SetMoreOptionsCommand(const OUString& rsCommandName,
             msMoreOptionsCommand,
             rxFrame, rxController,
             VCLUnoHelper::GetInterface(maToolBox.get()),
-            0));
+            0, true));
     maToolBox->SetController(mnMenuItemIndex, xController);
     maToolBox->SetOutStyle(TOOLBOX_STYLE_FLAT);
     maToolBox->SetQuickHelpText(
diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx
index ca3d076fb414..f77e6d5ff260 100644
--- a/sfx2/source/sidebar/SidebarToolBox.cxx
+++ b/sfx2/source/sidebar/SidebarToolBox.cxx
@@ -58,7 +58,8 @@ namespace sfx2::sidebar {
 SidebarToolBox::SidebarToolBox (vcl::Window* pParentWindow)
     : ToolBox(pParentWindow, 0),
       mbAreHandlersRegistered(false),
-      mbUseDefaultButtonSize(true)
+      mbUseDefaultButtonSize(true),
+      mbSideBar(true)
 {
     SetBackground(Wallpaper());
     SetPaintTransparent(true);
@@ -121,7 +122,7 @@ void SidebarToolBox::InsertItem(const OUString& rCommand,
 
     ToolBox::InsertItem(aCommand, rFrame, nBits, rRequestedSize, nPos);
 
-    CreateController(GetItemId(aCommand), rFrame, std::max(rRequestedSize.Width(), 0L));
+    CreateController(GetItemId(aCommand), rFrame, std::max(rRequestedSize.Width(), 0L), mbSideBar);
     RegisterHandlers();
 }
 
@@ -149,13 +150,13 @@ void SidebarToolBox::KeyInput(const KeyEvent& rKEvt)
 void SidebarToolBox::CreateController (
     const sal_uInt16 nItemId,
     const css::uno::Reference<css::frame::XFrame>& rxFrame,
-    const sal_Int32 nItemWidth)
+    const sal_Int32 nItemWidth, bool bSideBar)
 {
     const OUString sCommandName (GetItemCommand(nItemId));
 
     uno::Reference<frame::XToolbarController> xController(sfx2::sidebar::ControllerFactory::CreateToolBoxController(
             this, nItemId, sCommandName, rxFrame, rxFrame->getController(),
-            VCLUnoHelper::GetInterface(this), nItemWidth));
+            VCLUnoHelper::GetInterface(this), nItemWidth, bSideBar));
 
     if (xController.is())
         maControllers.insert(std::make_pair(nItemId, xController));
@@ -315,6 +316,7 @@ public:
     explicit NotebookbarToolBox(vcl::Window* pParentWindow)
     : SidebarToolBox(pParentWindow)
     {
+        mbSideBar = false;
         SetToolboxButtonSize(GetDefaultButtonSize());
     }
 
diff --git a/sfx2/source/toolbox/weldutils.cxx b/sfx2/source/toolbox/weldutils.cxx
index c35f9047cf20..fc97aefa404a 100644
--- a/sfx2/source/toolbox/weldutils.cxx
+++ b/sfx2/source/toolbox/weldutils.cxx
@@ -72,10 +72,12 @@ vcl::ImageType ToolbarUnoDispatcher::GetIconSize() const
 }
 
 ToolbarUnoDispatcher::ToolbarUnoDispatcher(weld::Toolbar& rToolbar, weld::Builder& rBuilder,
-                                           const css::uno::Reference<css::frame::XFrame>& rFrame)
+                                           const css::uno::Reference<css::frame::XFrame>& rFrame,
+                                           bool bSideBar)
     : m_xFrame(rFrame)
     , m_pToolbar(&rToolbar)
     , m_pBuilder(&rBuilder)
+    , m_bSideBar(bSideBar)
 {
     rToolbar.connect_clicked(LINK(this, ToolbarUnoDispatcher, SelectHdl));
     rToolbar.connect_menu_toggled(LINK(this, ToolbarUnoDispatcher, ToggleMenuHdl));
@@ -114,7 +116,7 @@ void ToolbarUnoDispatcher::CreateController(const OUString& rCommand)
 {
     css::uno::Reference<css::frame::XToolbarController> xController(
         sfx2::sidebar::ControllerFactory::CreateToolBoxController(*m_pToolbar, *m_pBuilder,
-                                                                  rCommand, m_xFrame));
+                                                                  rCommand, m_xFrame, m_bSideBar));
 
     if (xController.is())
         maControllers.insert(std::make_pair(rCommand, xController));


More information about the Libreoffice-commits mailing list