Kaydet (Commit) e98cf0c6 authored tarafından Maxim Monastirsky's avatar Maxim Monastirsky

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
üst 066f3132
......@@ -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);
......
......@@ -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:
......
......@@ -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);
}
......
......@@ -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();
}
......
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