[Libreoffice-commits] core.git: include/sfx2 sfx2/source

Katarina Behrens Katarina.Behrens at cib.de
Tue Mar 27 08:44:36 UTC 2018


 include/sfx2/sidebar/SidebarController.hxx    |    4 ++++
 include/sfx2/sidebar/SidebarDockingWindow.hxx |    1 +
 sfx2/source/sidebar/SidebarController.cxx     |   10 ++++++++--
 sfx2/source/sidebar/SidebarDockingWindow.cxx  |    6 ++++++
 4 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit f7de9714b00dd618544cf561d5ee45354623b947
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Tue Mar 20 09:54:28 2018 +0100

    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 at libreoffice.org>
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>

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)


More information about the Libreoffice-commits mailing list