diff options
author | xuenhua <xuenhua2008@sina.com> | 2022-06-01 15:29:49 +0800 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-06-17 20:52:05 +0200 |
commit | 0ec2b93c28093c80572c43f7be261630bd85f232 (patch) | |
tree | e3558cd65d5e387039a456cc70a5141af9094f0a /sfx2 | |
parent | 80d801cf07b6583e824ad89c3c750b076118f41d (diff) |
tdf#149431 Fix the sidebar's width
When click the wider sidebar and then go back to the narrow one in Writer,
the narrow one becomes the same width as wider one, it's not suitable
and doesn't look good. Fix the width to smallest width unless you drag
the splitter. Take the maximum width from the smallest width and
mnWidthOnSplitterButtonDown.
Change-Id: I60aaab84593d59ac28b96c2d3c3bd62a4bbddbbe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135220
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index cff76a95850b..088384641efd 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -506,6 +506,8 @@ void SidebarController::ProcessNewWidth (const sal_Int32 nNewWidth) { // Deck became large enough to be shown. Show it. mnSavedSidebarWidth = nNewWidth; + // Store nNewWidth to mnWidthOnSplitterButtonDown when dragging sidebar Splitter + mnWidthOnSplitterButtonDown = nNewWidth; if (!*mbIsDeckOpen) RequestOpenDeck(); } @@ -653,8 +655,12 @@ void SidebarController::OpenThenToggleDeck ( if (mpCurrentDeck && mpTabBar) { sal_Int32 nRequestedWidth = mpCurrentDeck->GetMinimalWidth() + TabBar::GetDefaultWidth(); - if (mnSavedSidebarWidth < nRequestedWidth) + // if sidebar was dragged + if(mnWidthOnSplitterButtonDown > 0 && mnWidthOnSplitterButtonDown > nRequestedWidth){ + SetChildWindowWidth(mnWidthOnSplitterButtonDown); + }else{ SetChildWindowWidth(nRequestedWidth); + } } } @@ -1060,7 +1066,6 @@ IMPL_LINK(SidebarController, WindowEventHandler, VclWindowEvent&, rEvent, void) case VclEventId::WindowMouseButtonUp: { ProcessNewWidth(mpParentWindow->GetSizePixel().Width()); - mnWidthOnSplitterButtonDown = 0; break; } |