diff options
-rw-r--r-- | include/sfx2/sidebar/SidebarController.hxx | 4 | ||||
-rw-r--r-- | include/sfx2/sidebar/SidebarDockingWindow.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarDockingWindow.cxx | 6 |
4 files changed, 19 insertions, 2 deletions
diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx index 32340fe2c017..50e91097ca67 100644 --- a/include/sfx2/sidebar/SidebarController.hxx +++ b/include/sfx2/sidebar/SidebarController.hxx @@ -146,6 +146,8 @@ public: void SwitchToDeck(const OUString& rsDeckId); void SwitchToDefaultDeck(); + bool WasFloatingDeckClosed() const { return mbFloatingDeckClosed; } + void SetFloatingDeckClosed(bool bWasClosed) { mbFloatingDeckClosed = bWasClosed; } void CreateDeck(const OUString& rDeckId); void CreateDeck(const OUString& rDeckId, const Context& rContext, bool bForceCreate = false); @@ -192,6 +194,8 @@ private: ::boost::optional<bool> mbIsDeckRequestedOpen; ::boost::optional<bool> mbIsDeckOpen; + bool mbFloatingDeckClosed; + /** Before the deck is closed the sidebar width is saved into this variable, so that it can be restored when the deck is reopened. */ diff --git a/include/sfx2/sidebar/SidebarDockingWindow.hxx b/include/sfx2/sidebar/SidebarDockingWindow.hxx index 3467df71c7b3..2bff73a3eb77 100644 --- a/include/sfx2/sidebar/SidebarDockingWindow.hxx +++ b/include/sfx2/sidebar/SidebarDockingWindow.hxx @@ -37,6 +37,7 @@ public: virtual ~SidebarDockingWindow() override; virtual void dispose() override; virtual bool EventNotify(NotifyEvent& rEvent) override; + virtual bool Close() override; using SfxDockingWindow::Close; diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index ebe568093772..c7652bdf9e52 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -104,6 +104,7 @@ SidebarController::SidebarController ( maAsynchronousDeckSwitch(), mbIsDeckRequestedOpen(), mbIsDeckOpen(), + mbFloatingDeckClosed(!pParentWindow->IsFloatingMode()), mnSavedSidebarWidth(pParentWindow->GetSizePixel().Width()), maFocusManager([this](const Panel& rPanel){ return this->ShowPanel(rPanel); }), mxReadOnlyModeDispatch(), @@ -523,12 +524,17 @@ void SidebarController::OpenThenToggleDeck ( else if ( IsDeckVisible( rsDeckId ) ) { if ( pSplitWindow ) + { // tdf#67627 Clicking a second time on a Deck icon will close the Deck RequestCloseDeck(); - else + return; + } + else if( !WasFloatingDeckClosed() ) + { // tdf#88241 Summoning an undocked sidebar a second time should close sidebar mpParentWindow->Close(); - return; + return; + } } RequestOpenDeck(); SwitchToDeck(rsDeckId); diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx index 05e7a3ab41a9..097fd535e6fb 100644 --- a/sfx2/source/sidebar/SidebarDockingWindow.cxx +++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx @@ -77,6 +77,12 @@ void SidebarDockingWindow::GetFocus() SfxDockingWindow::GetFocus(); } +bool SidebarDockingWindow::Close() +{ + mpSidebarController->SetFloatingDeckClosed( true ); + return SfxDockingWindow::Close(); +} + SfxChildAlignment SidebarDockingWindow::CheckAlignment ( SfxChildAlignment eCurrentAlignment, SfxChildAlignment eRequestedAlignment) |