svx/source/sidebar/PanelLayout.cxx |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit b137ea11db280dec3e38a306f9daf7209eacf18e
Author: Maxim Monastirsky <momonas...@gmail.com>
Date:   Wed Aug 12 14:52:39 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.
    
    (based on e98cf0c63d6c48ca7c1db87d7413d5c419690c76)
    
    Change-Id: Ia36535637e3585595c673c7fc46a1a7b162b74ba
    Reviewed-on: https://gerrit.libreoffice.org/17667
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/svx/source/sidebar/PanelLayout.cxx 
b/svx/source/sidebar/PanelLayout.cxx
index 591dfe3..90123af 100644
--- a/svx/source/sidebar/PanelLayout.cxx
+++ b/svx/source/sidebar/PanelLayout.cxx
@@ -11,9 +11,12 @@
 #include <com/sun/star/util/URL.hpp>
 #include <com/sun/star/util/URLTransformer.hpp>
 #include <comphelper/processfactory.hxx>
+#include <sfx2/sidebar/Theme.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 +43,14 @@ void PanelLayout::dispose()
 Size PanelLayout::GetOptimalSize() const
 {
     if (isLayoutEnabled(this))
-        return 
VclContainer::getLayoutRequisition(*GetWindow(GetWindowType::FirstChild));
+    {
+        Size aSize = 
VclContainer::getLayoutRequisition(*GetWindow(GetWindowType::FirstChild));
+        sal_Int32 nTabBarWidth = Theme::GetInteger(Theme::Int_TabItemWidth)
+            + Theme::GetInteger(Theme::Int_TabBarLeftPadding)
+            + Theme::GetInteger(Theme::Int_TabBarRightPadding);
+        aSize.Width() = std::min<long>(aSize.Width(), (400 - nTabBarWidth) * 
GetDPIScaleFactor());
+        return aSize;
+    }
 
     return Control::GetOptimalSize();
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to