summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2016-10-05 13:56:10 +0200
committerSzymon Kłos <eszkadev@gmail.com>2016-10-05 14:57:22 +0000
commit36ca919da2e360fde7cc28230069eff488a85ac5 (patch)
treedf313f00b3fc55853967b1625f5c585425a225f8
parent5eb4e551f88e4d12daeabe020aefd405578844c8 (diff)
tdf#101249 Notebookbar: remember the menubar visibility
Change-Id: Ia4e89bfc97d102b2c548a19e62e262accb54d17d Reviewed-on: https://gerrit.libreoffice.org/29539 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Szymon Kłos <eszkadev@gmail.com>
-rw-r--r--sfx2/source/notebookbar/SfxNotebookBar.cxx23
1 files changed, 19 insertions, 4 deletions
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index 94f75116278b..282a168a3256 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();
+ }
}
}
}