Notebookbar: separate .ui files settings for each module

* each module have own list of implementations
* deleted placeholder .ui files from Calc and Impress

Change-Id: Ib7d4cafbb332447e769ca753003d31e9f3025f0a
Reviewed-on: https://gerrit.libreoffice.org/29143
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
Szymon Kłos
2016-09-21 15:28:26 +02:00
committed by Samuel Mehrbrodt
parent d749277ac0
commit af3df5340d
10 changed files with 184 additions and 601 deletions

View File

@@ -84,9 +84,29 @@ void NotebookbarMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >
SolarMutexGuard aSolarMutexGuard; SolarMutexGuard aSolarMutexGuard;
resetPopupMenu( rPopupMenu ); resetPopupMenu( rPopupMenu );
const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( m_xContext );
vcl::EnumContext::Application eApp = vcl::EnumContext::GetApplicationEnum(xModuleManager->identify(m_xFrame));
OUStringBuffer aPath("org.openoffice.Office.UI.Notebookbar/Applications/");
switch ( eApp )
{
case vcl::EnumContext::Application::Application_Writer:
aPath.append("Writer");
break;
case vcl::EnumContext::Application::Application_Calc:
aPath.append("Calc");
break;
case vcl::EnumContext::Application::Application_Impress:
aPath.append("Impress");
break;
default:
break;
}
aPath.append("/Implementations");
const utl::OConfigurationTreeRoot aImplementationsNode( const utl::OConfigurationTreeRoot aImplementationsNode(
m_xContext, m_xContext,
OUString("org.openoffice.Office.UI.Notebookbar/Implementations"), OUString( aPath.makeStringAndClear() ),
false); false);
if ( !aImplementationsNode.isValid() ) if ( !aImplementationsNode.isValid() )
return; return;
@@ -222,7 +242,7 @@ void SAL_CALL NotebookbarMenuController::itemSelected( const css::awt::MenuEvent
void SAL_CALL NotebookbarMenuController::itemActivated( const css::awt::MenuEvent& ) throw (RuntimeException, std::exception) void SAL_CALL NotebookbarMenuController::itemActivated( const css::awt::MenuEvent& ) throw (RuntimeException, std::exception)
{ {
OUString aActive = officecfg::Office::UI::Notebookbar::Active::get( m_xContext ); OUString aActive;
const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( m_xContext ); const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( m_xContext );
vcl::EnumContext::Application eApp = vcl::EnumContext::GetApplicationEnum(xModuleManager->identify(m_xFrame)); vcl::EnumContext::Application eApp = vcl::EnumContext::GetApplicationEnum(xModuleManager->identify(m_xFrame));
@@ -232,15 +252,15 @@ void SAL_CALL NotebookbarMenuController::itemActivated( const css::awt::MenuEven
{ {
case vcl::EnumContext::Application::Application_Writer: case vcl::EnumContext::Application::Application_Writer:
aPath.append("Writer"); aPath.append("Writer");
aActive = officecfg::Office::UI::Notebookbar::ActiveWriter::get( m_xContext );
break; break;
case vcl::EnumContext::Application::Application_Calc: case vcl::EnumContext::Application::Application_Calc:
aPath.append("Calc"); aPath.append("Calc");
aActive = officecfg::Office::UI::Notebookbar::ActiveCalc::get( m_xContext );
break; break;
case vcl::EnumContext::Application::Application_Impress: case vcl::EnumContext::Application::Application_Impress:
aPath.append("Impress"); aPath.append("Impress");
break; aActive = officecfg::Office::UI::Notebookbar::ActiveImpress::get( m_xContext );
case vcl::EnumContext::Application::Application_Draw:
aPath.append("Draw");
break; break;
default: default:
break; break;

View File

@@ -1,42 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE oor:component-data SYSTEM "../../../../../component-update.dtd"> <!DOCTYPE oor:component-data SYSTEM "../../../../../component-update.dtd">
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:install="http://openoffice.org/2004/installation" oor:name="Notebookbar" oor:package="org.openoffice.Office.UI"> <oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:install="http://openoffice.org/2004/installation" oor:name="Notebookbar" oor:package="org.openoffice.Office.UI">
<prop oor:name="Active"> <prop oor:name="ActiveWriter">
<value>notebookbar.ui</value> <value>notebookbar.ui</value>
</prop> </prop>
<node oor:name="Implementations"> <prop oor:name="ActiveCalc">
<node oor:name="Tabbed" oor:op="replace"> <value>notebookbar.ui</value>
<prop oor:name="Label"> </prop>
<value xml:lang="en-US">Tabbed</value> <prop oor:name="ActiveImpress">
</prop> <value>notebookbar.ui</value>
<prop oor:name="File"> </prop>
<value>notebookbar.ui</value> <node oor:name="Applications">
</prop> <node oor:name="Writer" oor:op="replace">
<prop oor:name="HasMenubar"> <node oor:name="Implementations">
<value>false</value> <node oor:name="Tabbed" oor:op="replace">
</prop> <prop oor:name="Label">
<value xml:lang="en-US">Tabbed</value>
</prop>
<prop oor:name="File">
<value>notebookbar.ui</value>
</prop>
<prop oor:name="HasMenubar">
<value>false</value>
</prop>
</node>
<node oor:name="Groups" oor:op="replace">
<prop oor:name="Label">
<value xml:lang="en-US">Contextual groups</value>
</prop>
<prop oor:name="File">
<value>notebookbar_groups.ui</value>
</prop>
<prop oor:name="HasMenubar">
<value>true</value>
</prop>
</node>
<node oor:name="Single" oor:op="replace">
<prop oor:name="Label">
<value xml:lang="en-US">Contextual single</value>
</prop>
<prop oor:name="File">
<value>notebookbar_single.ui</value>
</prop>
<prop oor:name="HasMenubar">
<value>true</value>
</prop>
</node>
</node>
</node> </node>
<node oor:name="Groups" oor:op="replace"> <node oor:name="Calc" oor:op="replace">
<prop oor:name="Label"> <node oor:name="Implementations">
<value xml:lang="en-US">Contextual groups</value> <node oor:name="Tabbed" oor:op="replace">
</prop> <prop oor:name="Label">
<prop oor:name="File"> <value xml:lang="en-US">Tabbed</value>
<value>notebookbar_groups.ui</value> </prop>
</prop> <prop oor:name="File">
<prop oor:name="HasMenubar"> <value>notebookbar.ui</value>
<value>true</value> </prop>
</prop> <prop oor:name="HasMenubar">
<value>false</value>
</prop>
</node>
</node>
</node> </node>
<node oor:name="Single" oor:op="replace"> <node oor:name="Impress" oor:op="replace">
<prop oor:name="Label"> <node oor:name="Implementations">
<value xml:lang="en-US">Contextual single</value> <node oor:name="Tabbed" oor:op="replace">
</prop> <prop oor:name="Label">
<prop oor:name="File"> <value xml:lang="en-US">Tabbed</value>
<value>notebookbar_single.ui</value> </prop>
</prop> <prop oor:name="File">
<prop oor:name="HasMenubar"> <value>notebookbar.ui</value>
<value>true</value> </prop>
</prop> <prop oor:name="HasMenubar">
<value>false</value>
</prop>
</node>
</node>
</node> </node>
</node> </node>
</oor:component-data> </oor:component-data>

View File

@@ -27,29 +27,49 @@
<desc>The implementation description container.</desc> <desc>The implementation description container.</desc>
</info> </info>
<prop oor:name="Label" oor:type="xs:string" oor:nillable="false" oor:localized="true"> <prop oor:name="Label" oor:type="xs:string" oor:nillable="false" oor:localized="true">
<info>
<desc>The implementation name.</desc>
</info>
</prop>
<prop oor:name="File" oor:type="xs:string" oor:nillable="false">
<info>
<desc>The .ui file name.</desc>
</info>
</prop>
<prop oor:name="HasMenubar" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>Determines if menubar is visible.</desc>
</info>
</prop>
</group>
<group oor:name="Application">
<info> <info>
<desc>The implementation name.</desc> <desc>Describes notebookbar settings for one application.</desc>
</info> </info>
</prop> <set oor:name="Implementations" oor:node-type="Implementation">
<prop oor:name="File" oor:type="xs:string" oor:nillable="false"> <info>
<info> <desc>List of implementations.</desc>
<desc>The .ui file name.</desc> </info>
</info> </set>
</prop>
<prop oor:name="HasMenubar" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>Determines if menubar is visible.</desc>
</info>
</prop>
</group> </group>
</templates> </templates>
<component> <component>
<prop oor:name="Active" oor:type="xs:string" oor:nillable="false"> <prop oor:name="ActiveWriter" oor:type="xs:string" oor:nillable="false">
<info> <info>
<desc>Contains name of currently used implementation.</desc> <desc>Contains name of currently used implementation in the Writer module.</desc>
</info> </info>
</prop> </prop>
<set oor:name="Implementations" oor:node-type="Implementation"> <prop oor:name="ActiveCalc" oor:type="xs:string" oor:nillable="false">
<info>
<desc>Contains name of currently used implementation in the Calc module.</desc>
</info>
</prop>
<prop oor:name="ActiveImpress" oor:type="xs:string" oor:nillable="false">
<info>
<desc>Contains name of currently used implementation in the Impress module.</desc>
</info>
</prop>
<set oor:name="Applications" oor:node-type="Application">
<info> <info>
<desc>List of implementations.</desc> <desc>List of implementations.</desc>
</info> </info>

View File

@@ -141,8 +141,6 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/leftheaderdialog \ sc/uiconfig/scalc/ui/leftheaderdialog \
sc/uiconfig/scalc/ui/namerangesdialog \ sc/uiconfig/scalc/ui/namerangesdialog \
sc/uiconfig/scalc/ui/notebookbar \ sc/uiconfig/scalc/ui/notebookbar \
sc/uiconfig/scalc/ui/notebookbar_groups \
sc/uiconfig/scalc/ui/notebookbar_single \
sc/uiconfig/scalc/ui/managenamesdialog \ sc/uiconfig/scalc/ui/managenamesdialog \
sc/uiconfig/scalc/ui/mergecellsdialog \ sc/uiconfig/scalc/ui/mergecellsdialog \
sc/uiconfig/scalc/ui/movecopysheet \ sc/uiconfig/scalc/ui/movecopysheet \

View File

@@ -1,133 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<requires lib="LibreOffice" version="1.0"/>
<!-- interface-local-resource-path ../../../icon-themes/galaxy/cmd/ -->
<object class="GtkGrid" id="NotebookBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="vcllo-NotebookbarTabControl" id="ContextContainer">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="sfxlo-PriorityHBox" id="FileBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="sfxlo-DropdownBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<style>
<class name="priority-1"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">7</property>
</packing>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="FileLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">File</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</interface>

View File

@@ -1,133 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<requires lib="LibreOffice" version="1.0"/>
<!-- interface-local-resource-path ../../../icon-themes/galaxy/cmd/ -->
<object class="GtkGrid" id="NotebookBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="vcllo-NotebookbarTabControl" id="ContextContainer">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="sfxlo-PriorityHBox" id="FileBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="sfxlo-DropdownBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<style>
<class name="priority-1"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">7</property>
</packing>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="FileLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">File</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</interface>

View File

@@ -121,8 +121,6 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/simpress,\
sd/uiconfig/simpress/ui/interactionpage \ sd/uiconfig/simpress/ui/interactionpage \
sd/uiconfig/simpress/ui/masterlayoutdlg \ sd/uiconfig/simpress/ui/masterlayoutdlg \
sd/uiconfig/simpress/ui/notebookbar \ sd/uiconfig/simpress/ui/notebookbar \
sd/uiconfig/simpress/ui/notebookbar_groups \
sd/uiconfig/simpress/ui/notebookbar_single \
sd/uiconfig/simpress/ui/optimpressgeneralpage \ sd/uiconfig/simpress/ui/optimpressgeneralpage \
sd/uiconfig/simpress/ui/photoalbum \ sd/uiconfig/simpress/ui/photoalbum \
sd/uiconfig/simpress/ui/presentationdialog \ sd/uiconfig/simpress/ui/presentationdialog \

View File

@@ -1,133 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<requires lib="LibreOffice" version="1.0"/>
<!-- interface-local-resource-path ../../../icon-themes/galaxy/cmd/ -->
<object class="GtkGrid" id="NotebookBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="vcllo-NotebookbarTabControl" id="ContextContainer">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="sfxlo-PriorityHBox" id="FileBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="sfxlo-DropdownBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<style>
<class name="priority-1"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">7</property>
</packing>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="FileLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">File</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</interface>

View File

@@ -1,133 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<requires lib="LibreOffice" version="1.0"/>
<!-- interface-local-resource-path ../../../icon-themes/galaxy/cmd/ -->
<object class="GtkGrid" id="NotebookBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="vcllo-NotebookbarTabControl" id="ContextContainer">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="sfxlo-PriorityHBox" id="FileBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="sfxlo-DropdownBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<style>
<class name="priority-1"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">7</property>
</packing>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="FileLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">File</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</interface>

View File

@@ -51,16 +51,53 @@ static OUString lcl_getAppName( vcl::EnumContext::Application eApp )
case vcl::EnumContext::Application::Application_Impress: case vcl::EnumContext::Application::Application_Impress:
return OUString( "Impress" ); return OUString( "Impress" );
break; break;
case vcl::EnumContext::Application::Application_Draw:
return OUString( "Draw" );
break;
default: default:
return OUString( "" ); return OUString( "" );
break; break;
} }
} }
static const utl::OConfigurationNode lcl_getCurrentImplConfigNode() static void lcl_setNotebookbarFileName( vcl::EnumContext::Application eApp, const OUString& sFileName )
{
std::shared_ptr<comphelper::ConfigurationChanges> aBatch(
comphelper::ConfigurationChanges::create( ::comphelper::getProcessComponentContext() ) );
switch ( eApp )
{
case vcl::EnumContext::Application::Application_Writer:
officecfg::Office::UI::Notebookbar::ActiveWriter::set( sFileName, aBatch );
break;
case vcl::EnumContext::Application::Application_Calc:
officecfg::Office::UI::Notebookbar::ActiveCalc::set( sFileName, aBatch );
break;
case vcl::EnumContext::Application::Application_Impress:
officecfg::Office::UI::Notebookbar::ActiveImpress::set( sFileName, aBatch );
break;
default:
break;
}
aBatch->commit();
}
static OUString lcl_getNotebookbarFileName( vcl::EnumContext::Application eApp )
{
switch ( eApp )
{
case vcl::EnumContext::Application::Application_Writer:
return officecfg::Office::UI::Notebookbar::ActiveWriter::get();
break;
case vcl::EnumContext::Application::Application_Calc:
return officecfg::Office::UI::Notebookbar::ActiveCalc::get();
break;
case vcl::EnumContext::Application::Application_Impress:
return officecfg::Office::UI::Notebookbar::ActiveImpress::get();
break;
default:
break;
}
return OUString();
}
static const utl::OConfigurationNode lcl_getCurrentImplConfigNode( const Reference<css::frame::XFrame>& xFrame )
{ {
const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( ::comphelper::getProcessComponentContext() ); const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( ::comphelper::getProcessComponentContext() );
@@ -73,9 +110,10 @@ static const utl::OConfigurationNode lcl_getCurrentImplConfigNode()
if ( !aNotebookbarNode.isValid() ) if ( !aNotebookbarNode.isValid() )
return utl::OConfigurationNode(); return utl::OConfigurationNode();
OUString aActive = comphelper::getString( aNotebookbarNode.getNodeValue( "Active" ) ); vcl::EnumContext::Application eApp = vcl::EnumContext::GetApplicationEnum( xModuleManager->identify( xFrame ) );
OUString aActive = lcl_getNotebookbarFileName( eApp );
const utl::OConfigurationNode aImplsNode = aNotebookbarNode.openNode("Implementations"); const utl::OConfigurationNode aImplsNode = aNotebookbarNode.openNode("Applications/" + lcl_getAppName( eApp) + "/Implementations");
const Sequence<OUString> aModeNodeNames( aImplsNode.getNodeNames() ); const Sequence<OUString> aModeNodeNames( aImplsNode.getNodeNames() );
const sal_Int32 nCount( aModeNodeNames.getLength() ); const sal_Int32 nCount( aModeNodeNames.getLength() );
@@ -158,10 +196,9 @@ void SfxNotebookBar::ExecMethod(SfxBindings& rBindings, const OUString& rUIName)
// Save active UI file name // Save active UI file name
if ( !rUIName.isEmpty() ) if ( !rUIName.isEmpty() )
{ {
std::shared_ptr<comphelper::ConfigurationChanges> batch( const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( ::comphelper::getProcessComponentContext() );
comphelper::ConfigurationChanges::create( ::comphelper::getProcessComponentContext() ) ); vcl::EnumContext::Application eApp = vcl::EnumContext::GetApplicationEnum(xModuleManager->identify(m_xFrame));
officecfg::Office::UI::Notebookbar::Active::set( rUIName, batch ); lcl_setNotebookbarFileName( eApp, rUIName );
batch->commit();
} }
// trigger the StateMethod // trigger the StateMethod
@@ -198,7 +235,9 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
{ {
RemoveListeners(pSysWindow); RemoveListeners(pSysWindow);
OUString sFile = officecfg::Office::UI::Notebookbar::Active::get(); const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( ::comphelper::getProcessComponentContext() );
vcl::EnumContext::Application eApp = vcl::EnumContext::GetApplicationEnum(xModuleManager->identify(m_xFrame));
OUString sFile = lcl_getNotebookbarFileName( eApp );
OUString sNewFile = rUIFile + sFile; OUString sNewFile = rUIFile + sFile;
OUString sCurrentFile; OUString sCurrentFile;
if ( pSysWindow->GetNotebookBar() ) if ( pSysWindow->GetNotebookBar() )
@@ -215,7 +254,7 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
bChangedFile = ( sNewFile.compareTo( sCurrentFile ) != 0 ); bChangedFile = ( sNewFile.compareTo( sCurrentFile ) != 0 );
} }
if ( !sFile.isEmpty() && bChangedFile ) if ( ( !sFile.isEmpty() && bChangedFile ) || !pSysWindow->GetNotebookBar()->IsVisible() )
{ {
OUStringBuffer aBuf(rUIFile); OUStringBuffer aBuf(rUIFile);
aBuf.append( sFile ); aBuf.append( sFile );
@@ -225,7 +264,7 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
pSysWindow->GetNotebookBar()->Show(); pSysWindow->GetNotebookBar()->Show();
pSysWindow->GetNotebookBar()->SetIconClickHdl(LINK(nullptr, SfxNotebookBar, OpenNotebookbarPopupMenu)); pSysWindow->GetNotebookBar()->SetIconClickHdl(LINK(nullptr, SfxNotebookBar, OpenNotebookbarPopupMenu));
const utl::OConfigurationNode aModeNode( lcl_getCurrentImplConfigNode() ); const utl::OConfigurationNode aModeNode( lcl_getCurrentImplConfigNode( xFrame ) );
SfxNotebookBar::ShowMenubar( comphelper::getBOOL( aModeNode.getNodeValue( "HasMenubar" ) ) ); SfxNotebookBar::ShowMenubar( comphelper::getBOOL( aModeNode.getNodeValue( "HasMenubar" ) ) );
SfxViewFrame* pView = SfxViewFrame::Current(); SfxViewFrame* pView = SfxViewFrame::Current();