[Libreoffice-commits] core.git: include/sfx2 include/svx officecfg/registry sfx2/source svx/source

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 22 10:41:49 UTC 2019


 include/sfx2/sidebar/SidebarController.hxx                     |    5 ++-
 include/svx/sidebar/PanelLayout.hxx                            |    1 
 officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs |   11 ++++++++
 sfx2/source/sidebar/SidebarController.cxx                      |    4 ++-
 svx/source/sidebar/PanelLayout.cxx                             |   13 ++++++++--
 5 files changed, 29 insertions(+), 5 deletions(-)

New commits:
commit 2a41c31a0627bf752a625f23a64eaf4d3fe82fb9
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Fri Mar 22 08:06:25 2019 +0100
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Fri Mar 22 11:41:23 2019 +0100

    tdf#124255 Make maximum sidebar width configurable
    
    Also change the default max width to 500px (instead of 400px).
    
    Change-Id: Idece5aadaf4c4165cc873b4605d2c0f026c89c6e
    Reviewed-on: https://gerrit.libreoffice.org/69545
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx
index c81e306736bd..68e97c51cee4 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -118,8 +118,6 @@ public:
     const static sal_Int32 SwitchFlag_ForceNewDeck = 0x02;
     const static sal_Int32 SwitchFlag_ForceNewPanels = 0x02;
 
-    const static sal_Int32 gnMaximumSidebarWidth = 400;
-
     void OpenThenSwitchToDeck(const OUString& rsDeckId);
     void OpenThenToggleDeck(const OUString& rsDeckId);
 
@@ -170,6 +168,8 @@ public:
 
     css::uno::Reference<css::frame::XFrame> getXFrame() {return mxFrame;}
 
+    sal_Int32 getMaximumWidth() { return mnMaximumSidebarWidth; }
+
 private:
     SidebarController(
         SidebarDockingWindow* pParentWindow,
@@ -184,6 +184,7 @@ private:
     css::uno::Reference<css::frame::XController> mxCurrentController;
     /// Use a combination of SwitchFlag_* as value.
     sal_Int32 mnRequestedForceFlags;
+    sal_Int32 mnMaximumSidebarWidth;
     OUString msCurrentDeckId;
     AsynchronousCall maPropertyChangeForwarder;
     AsynchronousCall maContextChangeUpdate;
diff --git a/include/svx/sidebar/PanelLayout.hxx b/include/svx/sidebar/PanelLayout.hxx
index 856785eb8cdf..0932fe459f40 100644
--- a/include/svx/sidebar/PanelLayout.hxx
+++ b/include/svx/sidebar/PanelLayout.hxx
@@ -27,6 +27,7 @@ class SVX_DLLPUBLIC PanelLayout : public Control, public VclBuilderContainer
 private:
     Idle m_aPanelLayoutIdle;
     bool m_bInClose;
+    css::uno::Reference<css::frame::XFrame> mxFrame;
 
     DECL_DLLPRIVATE_LINK(ImplHandlePanelLayoutTimerHdl, Timer*, void);
 
diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
index 3258798d19fc..2eeed4534040 100644
--- a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
@@ -231,6 +231,17 @@
     </group>
   </templates>
   <component>
+    <group oor:name="General">
+      <info>
+        <desc>General Sidebar settings.</desc>
+      </info>
+      <prop oor:name="MaximumWidth" oor:type="xs:int" oor:nillable="false">
+        <info>
+          <desc>Maximum width the sidebar can ever have</desc>
+        </info>
+        <value>500</value>
+      </prop>
+    </group>
     <group oor:name="Content">
       <info>
         <desc>Description of the decks and panels that can be displayed in the content area of the sidebar.</desc>
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 9aa8fc0859ca..82ccd7ca58ef 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -45,6 +45,7 @@
 #include <comphelper/processfactory.hxx>
 #include <comphelper/namedvaluecollection.hxx>
 #include <sal/log.hxx>
+#include <officecfg/Office/UI/Sidebar.hxx>
 
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
@@ -100,6 +101,7 @@ SidebarController::SidebarController (
       maCurrentContext(OUString(), OUString()),
       maRequestedContext(),
       mnRequestedForceFlags(SwitchFlag_NoForce),
+      mnMaximumSidebarWidth(officecfg::Office::UI::Sidebar::General::MaximumWidth::get()),
       msCurrentDeckId(gsDefaultDeckId),
       maPropertyChangeForwarder([this](){ return this->BroadcastPropertyChange(); }),
       maContextChangeUpdate([this](){ return this->UpdateConfigurations(); }),
@@ -1216,7 +1218,7 @@ void SidebarController::RestrictWidth (sal_Int32 nWidth)
         pSplitWindow->SetItemSizeRange(
             nSetId,
             Range(TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor() + nWidth,
-                  gnMaximumSidebarWidth * mpTabBar->GetDPIScaleFactor()));
+                  getMaximumWidth() * mpTabBar->GetDPIScaleFactor()));
     }
 }
 
diff --git a/svx/source/sidebar/PanelLayout.cxx b/svx/source/sidebar/PanelLayout.cxx
index e68ef416724b..a0b1362a341e 100644
--- a/svx/source/sidebar/PanelLayout.cxx
+++ b/svx/source/sidebar/PanelLayout.cxx
@@ -20,6 +20,7 @@ using namespace sfx2::sidebar;
 PanelLayout::PanelLayout(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const css::uno::Reference<css::frame::XFrame> &rFrame)
     : Control(pParent)
     , m_bInClose(false)
+    , mxFrame(rFrame)
 {
     SetStyle(GetStyle() | WB_DIALOGCONTROL);
     m_aPanelLayoutIdle.SetPriority(TaskPriority::RESIZE);
@@ -50,8 +51,16 @@ Size PanelLayout::GetOptimalSize() const
     if (isLayoutEnabled(this))
     {
         Size aSize = VclContainer::getLayoutRequisition(*GetWindow(GetWindowType::FirstChild));
-        aSize.setWidth( std::min<long>(aSize.Width(),
-            (SidebarController::gnMaximumSidebarWidth - TabBar::GetDefaultWidth()) * GetDPIScaleFactor()) );
+        if (mxFrame)
+        {
+            SidebarController* pController
+                = SidebarController::GetSidebarControllerForFrame(mxFrame);
+            if (pController)
+                aSize.setWidth(std::min<long>(
+                    aSize.Width(), (pController->getMaximumWidth() - TabBar::GetDefaultWidth())
+                                       * GetDPIScaleFactor()));
+        }
+
         return aSize;
     }
 


More information about the Libreoffice-commits mailing list