sfx2/source/notebookbar/SfxNotebookBar.cxx | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
New commits: commit 36ca919da2e360fde7cc28230069eff488a85ac5 Author: Szymon KÅos <eszka...@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 <c...@libreoffice.org> Reviewed-by: Szymon KÅos <eszka...@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(); + } } } }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits