diff options
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 8f09d3f38af6..aa328608ffe3 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -32,6 +32,7 @@ #include <sfx2/sidebar/ContextList.hxx> +#include <sfx2/lokhelper.hxx> #include <sfx2/sfxresid.hxx> #include <sfx2/sfxsids.hrc> #include <sfx2/titledockwin.hxx> @@ -524,16 +525,16 @@ void SidebarController::OpenThenToggleDeck ( pSplitWindow->FadeIn(); else if ( IsDeckVisible( rsDeckId ) ) { - if ( pSplitWindow ) + if( !WasFloatingDeckClosed() ) { - // tdf#67627 Clicking a second time on a Deck icon will close the Deck - RequestCloseDeck(); + // tdf#88241 Summoning an undocked sidebar a second time should close sidebar + mpParentWindow->Close(); return; } - else if( !WasFloatingDeckClosed() ) + else { - // tdf#88241 Summoning an undocked sidebar a second time should close sidebar - mpParentWindow->Close(); + // tdf#67627 Clicking a second time on a Deck icon will close the Deck + RequestCloseDeck(); return; } } @@ -1134,7 +1135,7 @@ void SidebarController::UpdateDeckOpenState() // No state requested. return; - sal_Int32 nTabBarDefaultWidth = TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor(); + const sal_Int32 nTabBarDefaultWidth = TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor(); // Update (change) the open state when it either has not yet been initialized // or when its value differs from the requested state. @@ -1143,15 +1144,42 @@ void SidebarController::UpdateDeckOpenState() if (mbIsDeckRequestedOpen.get()) { - if (mnSavedSidebarWidth <= nTabBarDefaultWidth) - SetChildWindowWidth(SidebarChildWindow::GetDefaultWidth(mpParentWindow)); + if (!mpParentWindow->IsFloatingMode()) + { + if (mnSavedSidebarWidth <= nTabBarDefaultWidth) + SetChildWindowWidth(SidebarChildWindow::GetDefaultWidth(mpParentWindow)); + else + SetChildWindowWidth(mnSavedSidebarWidth); + } else - SetChildWindowWidth(mnSavedSidebarWidth); + { + // Show the Deck by resizing back to the original size (before hiding). + Size aNewSize(mpParentWindow->GetFloatingWindow()->GetSizePixel()); + Point aNewPos(mpParentWindow->GetFloatingWindow()->GetPosPixel()); + + aNewPos.setX(aNewPos.X() - mnSavedSidebarWidth + nTabBarDefaultWidth); + aNewSize.setWidth(mnSavedSidebarWidth); + + mpParentWindow->GetFloatingWindow()->SetPosSizePixel(aNewPos, aNewSize); + } } else { if ( ! mpParentWindow->IsFloatingMode()) mnSavedSidebarWidth = SetChildWindowWidth(nTabBarDefaultWidth); + else + { + // Hide the Deck by resizing to the width of the TabBar. + Size aNewSize(mpParentWindow->GetFloatingWindow()->GetSizePixel()); + Point aNewPos(mpParentWindow->GetFloatingWindow()->GetPosPixel()); + mnSavedSidebarWidth = aNewSize.Width(); // Save the current width to restore. + + aNewPos.setX(aNewPos.X() + mnSavedSidebarWidth - nTabBarDefaultWidth); + aNewSize.setWidth(nTabBarDefaultWidth); + + mpParentWindow->GetFloatingWindow()->SetPosSizePixel(aNewPos, aNewSize); + } + if (mnWidthOnSplitterButtonDown > nTabBarDefaultWidth) mnSavedSidebarWidth = mnWidthOnSplitterButtonDown; mpParentWindow->SetStyle(mpParentWindow->GetStyle() & ~WB_SIZEABLE); |