From 2bc3bda3a9d0abc7435e5dc9004c74304330a121 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Tue, 21 Aug 2018 23:23:14 +0200 Subject: tdf#119364: fix by reverting some previous commits about notebookbar Revert: - dcbb65f2a4a3ee70ccd4896d7a5e975dbd9e6509 which was to avoid Avoid com.sun.star.container.NoSuchElementException "Active" when opening embedded form - 6c89f41b02fcd8918e535460994daac4ecd5d37e which was to fix previous commit and fix tdf#119330 Just fix Avoid com.sun.star.container.NoSuchElementException "Active" by testing if OUString returned by lcl_getAppName is empty or not. If empty, just return false Change-Id: I51ec7cba457bafdd161e02f16e3e09fddcd04408 Reviewed-on: https://gerrit.libreoffice.org/59417 Tested-by: Jenkins Reviewed-by: Julien Nabet --- sfx2/source/notebookbar/SfxNotebookBar.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx index c5ba5d5b7809..ee19f6f2bcc4 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -60,7 +60,6 @@ static OUString lcl_getAppName( vcl::EnumContext::Application eApp ) switch ( eApp ) { case vcl::EnumContext::Application::Writer: - case vcl::EnumContext::Application::WriterForm: return OUString( "Writer" ); break; case vcl::EnumContext::Application::Calc: @@ -88,7 +87,6 @@ static void lcl_setNotebookbarFileName( vcl::EnumContext::Application eApp, cons switch ( eApp ) { case vcl::EnumContext::Application::Writer: - case vcl::EnumContext::Application::WriterForm: officecfg::Office::UI::ToolbarMode::ActiveWriter::set( sFileName, aBatch ); break; case vcl::EnumContext::Application::Calc: @@ -111,7 +109,6 @@ static OUString lcl_getNotebookbarFileName( vcl::EnumContext::Application eApp ) switch ( eApp ) { case vcl::EnumContext::Application::Writer: - case vcl::EnumContext::Application::WriterForm: return officecfg::Office::UI::ToolbarMode::ActiveWriter::get(); break; case vcl::EnumContext::Application::Calc: @@ -215,8 +212,14 @@ bool SfxNotebookBar::IsActive() else return false; + OUString appName(lcl_getAppName( eApp )); + + if (appName.isEmpty()) + return false; + + OUStringBuffer aPath("org.openoffice.Office.UI.ToolbarMode/Applications/"); - aPath.append( lcl_getAppName( eApp ) ); + aPath.append( appName ); const utl::OConfigurationTreeRoot aAppNode( ::comphelper::getProcessComponentContext(), -- cgit