diff options
author | Szymon Kłos <eszkadev@gmail.com> | 2016-09-21 15:28:26 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2016-09-22 09:02:48 +0000 |
commit | af3df5340d5d1a26b0d031b03c85cf715ef6ad57 (patch) | |
tree | bb44ed5e13fe5a75b3377e1fe83d15193387feeb | |
parent | d749277ac0e035a9e34351faa28fcb4201ccfb81 (diff) |
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>
-rw-r--r-- | framework/source/uielement/notebookbarmenucontroller.cxx | 30 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/Notebookbar.xcu | 104 | ||||
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/UI/Notebookbar.xcs | 44 | ||||
-rw-r--r-- | sc/UIConfig_scalc.mk | 2 | ||||
-rw-r--r-- | sc/uiconfig/scalc/ui/notebookbar_groups.ui | 133 | ||||
-rw-r--r-- | sc/uiconfig/scalc/ui/notebookbar_single.ui | 133 | ||||
-rw-r--r-- | sd/UIConfig_simpress.mk | 2 | ||||
-rw-r--r-- | sd/uiconfig/simpress/ui/notebookbar_groups.ui | 133 | ||||
-rw-r--r-- | sd/uiconfig/simpress/ui/notebookbar_single.ui | 133 | ||||
-rw-r--r-- | sfx2/source/notebookbar/SfxNotebookBar.cxx | 65 |
10 files changed, 181 insertions, 598 deletions
diff --git a/framework/source/uielement/notebookbarmenucontroller.cxx b/framework/source/uielement/notebookbarmenucontroller.cxx index c5de77f306b5..7173356fe92b 100644 --- a/framework/source/uielement/notebookbarmenucontroller.cxx +++ b/framework/source/uielement/notebookbarmenucontroller.cxx @@ -84,9 +84,29 @@ void NotebookbarMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > SolarMutexGuard aSolarMutexGuard; 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( m_xContext, - OUString("org.openoffice.Office.UI.Notebookbar/Implementations"), + OUString( aPath.makeStringAndClear() ), false); if ( !aImplementationsNode.isValid() ) 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) { - OUString aActive = officecfg::Office::UI::Notebookbar::Active::get( m_xContext ); + OUString aActive; const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( m_xContext ); 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: aPath.append("Writer"); + aActive = officecfg::Office::UI::Notebookbar::ActiveWriter::get( m_xContext ); break; case vcl::EnumContext::Application::Application_Calc: aPath.append("Calc"); + aActive = officecfg::Office::UI::Notebookbar::ActiveCalc::get( m_xContext ); break; case vcl::EnumContext::Application::Application_Impress: aPath.append("Impress"); - break; - case vcl::EnumContext::Application::Application_Draw: - aPath.append("Draw"); + aActive = officecfg::Office::UI::Notebookbar::ActiveImpress::get( m_xContext ); break; default: break; diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Notebookbar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Notebookbar.xcu index 4b3c45ace659..e339abb4fcd1 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Notebookbar.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Notebookbar.xcu @@ -1,42 +1,82 @@ <?xml version="1.0" encoding="UTF-8"?> <!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"> - <prop oor:name="Active"> + <prop oor:name="ActiveWriter"> <value>notebookbar.ui</value> </prop> - <node oor:name="Implementations"> - <node oor:name="Tabbed" oor:op="replace"> - <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> + <prop oor:name="ActiveCalc"> + <value>notebookbar.ui</value> + </prop> + <prop oor:name="ActiveImpress"> + <value>notebookbar.ui</value> + </prop> + <node oor:name="Applications"> + <node oor:name="Writer" oor:op="replace"> + <node oor:name="Implementations"> + <node oor:name="Tabbed" oor:op="replace"> + <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 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 oor:name="Calc" oor:op="replace"> + <node oor:name="Implementations"> + <node oor:name="Tabbed" oor:op="replace"> + <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> </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 oor:name="Impress" oor:op="replace"> + <node oor:name="Implementations"> + <node oor:name="Tabbed" oor:op="replace"> + <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> </node> </node> </oor:component-data> diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Notebookbar.xcs b/officecfg/registry/schema/org/openoffice/Office/UI/Notebookbar.xcs index ace1d508aefb..658df995b3de 100644 --- a/officecfg/registry/schema/org/openoffice/Office/UI/Notebookbar.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/UI/Notebookbar.xcs @@ -27,29 +27,49 @@ <desc>The implementation description container.</desc> </info> <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> - <desc>The implementation name.</desc> + <desc>Describes notebookbar settings for one application.</desc> </info> - </prop> - <prop oor:name="File" oor:type="xs:string" oor:nillable="false"> + <set oor:name="Implementations" oor:node-type="Implementation"> + <info> + <desc>List of implementations.</desc> + </info> + </set> + </group> + </templates> + <component> + <prop oor:name="ActiveWriter" oor:type="xs:string" oor:nillable="false"> <info> - <desc>The .ui file name.</desc> + <desc>Contains name of currently used implementation in the Writer module.</desc> </info> </prop> - <prop oor:name="HasMenubar" oor:type="xs:boolean" oor:nillable="false"> + <prop oor:name="ActiveCalc" oor:type="xs:string" oor:nillable="false"> <info> - <desc>Determines if menubar is visible.</desc> + <desc>Contains name of currently used implementation in the Calc module.</desc> </info> </prop> - </group> - </templates> - <component> - <prop oor:name="Active" oor:type="xs:string" oor:nillable="false"> + <prop oor:name="ActiveImpress" oor:type="xs:string" oor:nillable="false"> <info> - <desc>Contains name of currently used implementation.</desc> + <desc>Contains name of currently used implementation in the Impress module.</desc> </info> </prop> - <set oor:name="Implementations" oor:node-type="Implementation"> + <set oor:name="Applications" oor:node-type="Application"> <info> <desc>List of implementations.</desc> </info> diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk index 8ddcccf89a28..707936d01cfb 100644 --- a/sc/UIConfig_scalc.mk +++ b/sc/UIConfig_scalc.mk @@ -141,8 +141,6 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\ sc/uiconfig/scalc/ui/leftheaderdialog \ sc/uiconfig/scalc/ui/namerangesdialog \ 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/mergecellsdialog \ sc/uiconfig/scalc/ui/movecopysheet \ diff --git a/sc/uiconfig/scalc/ui/notebookbar_groups.ui b/sc/uiconfig/scalc/ui/notebookbar_groups.ui deleted file mode 100644 index 9b5e4b484543..000000000000 --- a/sc/uiconfig/scalc/ui/notebookbar_groups.ui +++ /dev/null @@ -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> diff --git a/sc/uiconfig/scalc/ui/notebookbar_single.ui b/sc/uiconfig/scalc/ui/notebookbar_single.ui deleted file mode 100644 index 9b5e4b484543..000000000000 --- a/sc/uiconfig/scalc/ui/notebookbar_single.ui +++ /dev/null @@ -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> diff --git a/sd/UIConfig_simpress.mk b/sd/UIConfig_simpress.mk index 7e1e3c39472b..6232d5fb59c6 100644 --- a/sd/UIConfig_simpress.mk +++ b/sd/UIConfig_simpress.mk @@ -121,8 +121,6 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/simpress,\ sd/uiconfig/simpress/ui/interactionpage \ sd/uiconfig/simpress/ui/masterlayoutdlg \ 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/photoalbum \ sd/uiconfig/simpress/ui/presentationdialog \ diff --git a/sd/uiconfig/simpress/ui/notebookbar_groups.ui b/sd/uiconfig/simpress/ui/notebookbar_groups.ui deleted file mode 100644 index 9b5e4b484543..000000000000 --- a/sd/uiconfig/simpress/ui/notebookbar_groups.ui +++ /dev/null @@ -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> diff --git a/sd/uiconfig/simpress/ui/notebookbar_single.ui b/sd/uiconfig/simpress/ui/notebookbar_single.ui deleted file mode 100644 index 9b5e4b484543..000000000000 --- a/sd/uiconfig/simpress/ui/notebookbar_single.ui +++ /dev/null @@ -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> diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx index e103d69073b3..49956d5ada4d 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -51,16 +51,53 @@ static OUString lcl_getAppName( vcl::EnumContext::Application eApp ) case vcl::EnumContext::Application::Application_Impress: return OUString( "Impress" ); break; - case vcl::EnumContext::Application::Application_Draw: - return OUString( "Draw" ); - break; default: return OUString( "" ); 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() ); @@ -73,9 +110,10 @@ static const utl::OConfigurationNode lcl_getCurrentImplConfigNode() if ( !aNotebookbarNode.isValid() ) 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 sal_Int32 nCount( aModeNodeNames.getLength() ); @@ -158,10 +196,9 @@ void SfxNotebookBar::ExecMethod(SfxBindings& rBindings, const OUString& rUIName) // Save active UI file name if ( !rUIName.isEmpty() ) { - std::shared_ptr<comphelper::ConfigurationChanges> batch( - comphelper::ConfigurationChanges::create( ::comphelper::getProcessComponentContext() ) ); - officecfg::Office::UI::Notebookbar::Active::set( rUIName, batch ); - batch->commit(); + const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( ::comphelper::getProcessComponentContext() ); + vcl::EnumContext::Application eApp = vcl::EnumContext::GetApplicationEnum(xModuleManager->identify(m_xFrame)); + lcl_setNotebookbarFileName( eApp, rUIName ); } // trigger the StateMethod @@ -198,7 +235,9 @@ bool SfxNotebookBar::StateMethod(SystemWindow* 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 sCurrentFile; if ( pSysWindow->GetNotebookBar() ) @@ -215,7 +254,7 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, bChangedFile = ( sNewFile.compareTo( sCurrentFile ) != 0 ); } - if ( !sFile.isEmpty() && bChangedFile ) + if ( ( !sFile.isEmpty() && bChangedFile ) || !pSysWindow->GetNotebookBar()->IsVisible() ) { OUStringBuffer aBuf(rUIFile); aBuf.append( sFile ); @@ -225,7 +264,7 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, pSysWindow->GetNotebookBar()->Show(); 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" ) ) ); SfxViewFrame* pView = SfxViewFrame::Current(); |