summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2018-03-20 09:54:28 +0100
committerKatarina Behrens <Katarina.Behrens@cib.de>2018-03-27 10:44:10 +0200
commitf7de9714b00dd618544cf561d5ee45354623b947 (patch)
tree1ceb5940ae87ac45199c67ab510ac3626de78378
parent04630f26d06c4d3ec22b2a8b97e6a5e69cc70d5e (diff)
tdf#115786: Fix reopening undocked sidebar
while trying hard to keep tdf#88241 fixed. Had to introduce yet another bool variable as now that previously active sidebar deck is remembered (= it is visible when floating window opens) it's impossible to tell whether sidebar was already opened or not Change-Id: If2c9edfa2f9beb400537b106d3094f256b0cc183 Reviewed-on: https://gerrit.libreoffice.org/51866 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
-rw-r--r--include/sfx2/sidebar/SidebarController.hxx4
-rw-r--r--include/sfx2/sidebar/SidebarDockingWindow.hxx1
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx10
-rw-r--r--sfx2/source/sidebar/SidebarDockingWindow.cxx6
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)