Kaydet (Commit) b137ea11 authored tarafından Maxim Monastirsky's avatar Maxim Monastirsky Kaydeden (comit) Caolán McNamara

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 e98cf0c6)

Change-Id: Ia36535637e3585595c673c7fc46a1a7b162b74ba
Reviewed-on: https://gerrit.libreoffice.org/17667Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst ce51de70
...@@ -11,9 +11,12 @@ ...@@ -11,9 +11,12 @@
#include <com/sun/star/util/URL.hpp> #include <com/sun/star/util/URL.hpp>
#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/URLTransformer.hpp>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <sfx2/sidebar/Theme.hxx>
#include <svx/sidebar/PanelLayout.hxx> #include <svx/sidebar/PanelLayout.hxx>
#include <vcl/layout.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) 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) : Control(pParent)
, m_bInClose(false) , m_bInClose(false)
...@@ -40,7 +43,14 @@ void PanelLayout::dispose() ...@@ -40,7 +43,14 @@ void PanelLayout::dispose()
Size PanelLayout::GetOptimalSize() const Size PanelLayout::GetOptimalSize() const
{ {
if (isLayoutEnabled(this)) 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(); return Control::GetOptimalSize();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment