diff options
-rw-r--r-- | svx/source/sidebar/PanelLayout.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/svx/source/sidebar/PanelLayout.cxx b/svx/source/sidebar/PanelLayout.cxx index 591dfe390eea..90123aff7536 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(); } |