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

Maxim Monastirsky momonasmon at gmail.com
Mon Aug 10 16:29:26 PDT 2015


 include/sfx2/sidebar/SidebarController.hxx |    2 ++
 include/sfx2/sidebar/TabBar.hxx            |    2 +-
 sfx2/source/sidebar/SidebarController.cxx  |    1 -
 svx/source/sidebar/PanelLayout.cxx         |   11 ++++++++++-
 4 files changed, 13 insertions(+), 3 deletions(-)

New commits:
commit e98cf0c63d6c48ca7c1db87d7413d5c419690c76
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Tue Aug 11 02:09:25 2015 +0300

    Related: tdf#78111 Try to guard against too wide panel layouts
    
    The sidebar has width limit, so a panel shouldn't attempt to
    resize more than that. Otherwise we'll get an endless loop.
    
    Change-Id: Ia36535637e3585595c673c7fc46a1a7b162b74ba

diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx
index 00a53b3..d3aabbc 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -122,6 +122,8 @@ public:
     const static sal_Int32 SwitchFlag_ForceNewDeck = 0x02;
     const static sal_Int32 SwitchFlag_ForceNewPanels = 0x02;
 
+    const static sal_Int32 gnMaximumSidebarWidth = 400;
+
     void OpenThenSwitchToDeck (
         const ::rtl::OUString& rsDeckId);
 
diff --git a/include/sfx2/sidebar/TabBar.hxx b/include/sfx2/sidebar/TabBar.hxx
index 2a8d7f9..3dcf791 100644
--- a/include/sfx2/sidebar/TabBar.hxx
+++ b/include/sfx2/sidebar/TabBar.hxx
@@ -46,7 +46,7 @@ class SidebarController;
 
 /** The tab bar is the container for the individual tabs.
 */
-class TabBar
+class SFX2_DLLPUBLIC TabBar
     : public vcl::Window
 {
 public:
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 6482717..aac2906 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -64,7 +64,6 @@ namespace
 {
     const static char gsReadOnlyCommandName[] = ".uno:EditDoc";
     const static char gsHideSidebarCommandName[] = ".uno:Sidebar";
-    const static sal_Int32 gnMaximumSidebarWidth (400);
     const static sal_Int32 gnWidthCloseThreshold (70);
     const static sal_Int32 gnWidthOpenThreshold (40);
 }
diff --git a/svx/source/sidebar/PanelLayout.cxx b/svx/source/sidebar/PanelLayout.cxx
index 591dfe3..1f2b032 100644
--- a/svx/source/sidebar/PanelLayout.cxx
+++ b/svx/source/sidebar/PanelLayout.cxx
@@ -11,9 +11,13 @@
 #include <com/sun/star/util/URL.hpp>
 #include <com/sun/star/util/URLTransformer.hpp>
 #include <comphelper/processfactory.hxx>
+#include <sfx2/sidebar/SidebarController.hxx>
+#include <sfx2/sidebar/TabBar.hxx>
 #include <svx/sidebar/PanelLayout.hxx>
 #include <vcl/layout.hxx>
 
+using namespace sfx2::sidebar;
+
 PanelLayout::PanelLayout(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const com::sun::star::uno::Reference<com::sun::star::frame::XFrame> &rFrame)
     : Control(pParent)
     , m_bInClose(false)
@@ -40,7 +44,12 @@ void PanelLayout::dispose()
 Size PanelLayout::GetOptimalSize() const
 {
     if (isLayoutEnabled(this))
-        return VclContainer::getLayoutRequisition(*GetWindow(GetWindowType::FirstChild));
+    {
+        Size aSize = VclContainer::getLayoutRequisition(*GetWindow(GetWindowType::FirstChild));
+        aSize.Width() = std::min<long>(aSize.Width(),
+            (SidebarController::gnMaximumSidebarWidth - TabBar::GetDefaultWidth()) * GetDPIScaleFactor());
+        return aSize;
+    }
 
     return Control::GetOptimalSize();
 }


More information about the Libreoffice-commits mailing list