sfx2/source/notebookbar/SfxNotebookBar.cxx | 31 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
New commits: commit e1b6ff7f622383ed4e667118107e144c6e183526 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Jan 14 17:21:01 2017 +0000 avoid OConfigurationTreeRoot copy assignment Change-Id: I768558716d2e6054a85210e982a8bb7a87fe3469 diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx index b404a37..8adf1c0 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -113,24 +113,25 @@ static OUString lcl_getNotebookbarFileName( vcl::EnumContext::Application eApp ) return OUString(); } -static const utl::OConfigurationNode lcl_getCurrentImplConfigNode( const Reference<css::frame::XFrame>& xFrame, - utl::OConfigurationTreeRoot& aNotebookbarNode ) +static utl::OConfigurationTreeRoot lcl_getCurrentImplConfigRoot() { - const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( ::comphelper::getProcessComponentContext() ); - - OUStringBuffer aPath("org.openoffice.Office.UI.Notebookbar/"); + return utl::OConfigurationTreeRoot(::comphelper::getProcessComponentContext(), + "org.openoffice.Office.UI.Notebookbar/", + true); +} - aNotebookbarNode = utl::OConfigurationTreeRoot( - ::comphelper::getProcessComponentContext(), - aPath.makeStringAndClear(), - true); - if ( !aNotebookbarNode.isValid() ) +static const utl::OConfigurationNode lcl_getCurrentImplConfigNode(const Reference<css::frame::XFrame>& xFrame, + utl::OConfigurationTreeRoot& rNotebookbarNode ) +{ + if (!rNotebookbarNode.isValid()) return utl::OConfigurationNode(); + const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( ::comphelper::getProcessComponentContext() ); + vcl::EnumContext::Application eApp = vcl::EnumContext::GetApplicationEnum( xModuleManager->identify( xFrame ) ); OUString aActive = lcl_getNotebookbarFileName( eApp ); - const utl::OConfigurationNode aImplsNode = aNotebookbarNode.openNode("Applications/" + lcl_getAppName( eApp) + "/Implementations"); + const utl::OConfigurationNode aImplsNode = rNotebookbarNode.openNode("Applications/" + lcl_getAppName( eApp) + "/Implementations"); const Sequence<OUString> aModeNodeNames( aImplsNode.getNodeNames() ); const sal_Int32 nCount( aModeNodeNames.getLength() ); @@ -287,8 +288,8 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, pNotebookBar->GetParent()->Resize(); pNotebookBar->SetIconClickHdl( LINK( nullptr, SfxNotebookBar, OpenNotebookbarPopupMenu ) ); - utl::OConfigurationTreeRoot aRoot; - const utl::OConfigurationNode aModeNode( lcl_getCurrentImplConfigNode( xFrame, aRoot ) ); + utl::OConfigurationTreeRoot aRoot(lcl_getCurrentImplConfigRoot()); + const utl::OConfigurationNode aModeNode(lcl_getCurrentImplConfigNode(xFrame, aRoot)); SfxNotebookBar::ShowMenubar( comphelper::getBOOL( aModeNode.getNodeValue( "HasMenubar" ) ) ); SfxViewFrame* pView = SfxViewFrame::Current(); @@ -426,8 +427,8 @@ void SfxNotebookBar::ToggleMenubar() // Save menubar settings if (IsActive()) { - utl::OConfigurationTreeRoot aRoot; - utl::OConfigurationNode aModeNode( lcl_getCurrentImplConfigNode( xFrame, aRoot ) ); + utl::OConfigurationTreeRoot aRoot(lcl_getCurrentImplConfigRoot()); + 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