diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2015-08-11 02:09:25 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2015-08-11 02:25:27 +0300 |
commit | e98cf0c63d6c48ca7c1db87d7413d5c419690c76 (patch) | |
tree | 9224162c4469e7e1aa3d5eed98cece1ba1da7428 /svx | |
parent | 066f3132effa9017fe9127e9d311d6ae88d0c729 (diff) |
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
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/sidebar/PanelLayout.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/svx/source/sidebar/PanelLayout.cxx b/svx/source/sidebar/PanelLayout.cxx index 591dfe390eea..1f2b032b2dde 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(); } |