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

Szymon Kłos eszkadev at gmail.com
Wed Oct 5 14:59:49 UTC 2016


 sfx2/source/notebookbar/SfxNotebookBar.cxx |   23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

New commits:
commit 36ca919da2e360fde7cc28230069eff488a85ac5
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Wed Oct 5 13:56:10 2016 +0200

    tdf#101249 Notebookbar: remember the menubar visibility
    
    Change-Id: Ia4e89bfc97d102b2c548a19e62e262accb54d17d
    Reviewed-on: https://gerrit.libreoffice.org/29539
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Szymon Kłos <eszkadev at gmail.com>

diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index 94f7511..282a168 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -113,16 +113,17 @@ static OUString lcl_getNotebookbarFileName( vcl::EnumContext::Application eApp )
     return OUString();
 }
 
-static const utl::OConfigurationNode lcl_getCurrentImplConfigNode( const Reference<css::frame::XFrame>& xFrame )
+static const utl::OConfigurationNode lcl_getCurrentImplConfigNode( const Reference<css::frame::XFrame>& xFrame,
+                                                                   utl::OConfigurationTreeRoot& aNotebookbarNode )
 {
     const Reference<frame::XModuleManager> xModuleManager  = frame::ModuleManager::create( ::comphelper::getProcessComponentContext() );
 
     OUStringBuffer aPath("org.openoffice.Office.UI.Notebookbar/");
 
-    const utl::OConfigurationTreeRoot aNotebookbarNode(
+    aNotebookbarNode = utl::OConfigurationTreeRoot(
                                         ::comphelper::getProcessComponentContext(),
                                         aPath.makeStringAndClear(),
-                                        false);
+                                        true);
     if ( !aNotebookbarNode.isValid() )
         return utl::OConfigurationNode();
 
@@ -283,7 +284,8 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
             pSysWindow->GetNotebookBar()->Show();
             pSysWindow->GetNotebookBar()->SetIconClickHdl(LINK(nullptr, SfxNotebookBar, OpenNotebookbarPopupMenu));
 
-            const utl::OConfigurationNode aModeNode( lcl_getCurrentImplConfigNode( xFrame ) );
+            utl::OConfigurationTreeRoot aRoot;
+            const utl::OConfigurationNode aModeNode( lcl_getCurrentImplConfigNode( xFrame, aRoot ) );
             SfxNotebookBar::ShowMenubar( comphelper::getBOOL( aModeNode.getNodeValue( "HasMenubar" ) ) );
 
             SfxViewFrame* pView = SfxViewFrame::Current();
@@ -385,13 +387,26 @@ void SfxNotebookBar::ToggleMenubar()
             const Reference<frame::XLayoutManager>& xLayoutManager =
                                                     lcl_getLayoutManager(xFrame);
 
+            bool bShow = true;
             if (xLayoutManager.is() && xLayoutManager->getElement(MENUBAR_STR).is())
             {
                 if (xLayoutManager->isElementVisible(MENUBAR_STR))
+                {
                     SfxNotebookBar::ShowMenubar(false);
+                    bShow = false;
+                }
                 else
                     SfxNotebookBar::ShowMenubar(true);
             }
+
+            // Save menubar settings
+            if (IsActive())
+            {
+                utl::OConfigurationTreeRoot aRoot;
+                utl::OConfigurationNode aModeNode( lcl_getCurrentImplConfigNode( xFrame, aRoot ) );
+                aModeNode.setNodeValue( "HasMenubar", toAny<bool>( bShow ) );
+                aRoot.commit();
+            }
         }
     }
 }


More information about the Libreoffice-commits mailing list