summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-08-31 10:25:08 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-09-01 09:30:59 +0200
commit0b16224062c0434087c3b904cc57d44e5723394b (patch)
tree77b7d2736dd22d35cf9a4d5ec70ee243d5217225 /sfx2
parent9e0e25c489e0ee170ef4f212efa707734f581347 (diff)
tdf#142458 minimal width not including extra width needed by scrolledwindow
its only including the width of the panels and not the extra space possibly required by the container window. Which is 2x the m_nBorderWidth of 1pixel of VclScrolledWindow in this case. Change-Id: I56775c7183d7a8b87af263ddc8bb17373779e9ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121390 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/sidebar/Deck.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 0fec11ef4e89..2267b222d82e 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -46,6 +46,7 @@ Deck::Deck(const DeckDescriptor& rDeckDescriptor, SidebarDockingWindow* pParentW
: InterimItemWindow(pParentWindow, "sfx/ui/deck.ui", "Deck")
, msId(rDeckDescriptor.msId)
, mnMinimalWidth(0)
+ , mnScrolledWindowExtraWidth(0)
, mnMinimalHeight(0)
, maPanels()
, mxParentWindow(pParentWindow)
@@ -59,6 +60,15 @@ Deck::Deck(const DeckDescriptor& rDeckDescriptor, SidebarDockingWindow* pParentW
mxVerticalScrollBar->vadjustment_set_step_increment(10);
mxVerticalScrollBar->vadjustment_set_page_increment(100);
+
+ // tdf#142458 Measure the preferred width of an empty ScrolledWindow
+ // to add to the width of the union of panel widths when calculating
+ // the minimal width of the deck
+ mxVerticalScrollBar->set_hpolicy(VclPolicyType::NEVER);
+ mxVerticalScrollBar->set_vpolicy(VclPolicyType::NEVER);
+ mnScrolledWindowExtraWidth = mxVerticalScrollBar->get_preferred_size().Width();
+ mxVerticalScrollBar->set_hpolicy(VclPolicyType::AUTOMATIC);
+ mxVerticalScrollBar->set_vpolicy(VclPolicyType::AUTOMATIC);
}
Deck::~Deck()
@@ -192,6 +202,14 @@ void Deck::RequestLayoutInternal()
DeckLayouter::LayoutDeck(mxParentWindow.get(), GetContentArea(),
mnMinimalWidth, mnMinimalHeight, maPanels,
*GetTitleBar(), *mxVerticalScrollBar);
+
+ if (mnMinimalWidth)
+ {
+ // tdf#142458 at this point mnMinimalWidth contains the width required
+ // by the panels, but extra space may be needed by the scrolledwindow
+ // that will contain the panels
+ mnMinimalWidth += mnScrolledWindowExtraWidth;
+ }
}
void Deck::RequestLayout()