summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2015-08-11 02:09:25 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2015-08-11 02:25:27 +0300
commite98cf0c63d6c48ca7c1db87d7413d5c419690c76 (patch)
tree9224162c4469e7e1aa3d5eed98cece1ba1da7428
parent066f3132effa9017fe9127e9d311d6ae88d0c729 (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
-rw-r--r--include/sfx2/sidebar/SidebarController.hxx2
-rw-r--r--include/sfx2/sidebar/TabBar.hxx2
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx1
-rw-r--r--svx/source/sidebar/PanelLayout.cxx11
4 files changed, 13 insertions, 3 deletions
diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx
index 00a53b350457..d3aabbc8c2ba 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -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);
diff --git a/include/sfx2/sidebar/TabBar.hxx b/include/sfx2/sidebar/TabBar.hxx
index 2a8d7f9b3fff..3dcf7910e464 100644
--- a/include/sfx2/sidebar/TabBar.hxx
+++ b/include/sfx2/sidebar/TabBar.hxx
@@ -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:
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 6482717b00cc..aac2906bead4 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -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);
}
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();
}