summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/source/uielement/popuptoolbarcontroller.cxx58
-rw-r--r--framework/util/fwk.component4
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu5
3 files changed, 63 insertions, 4 deletions
diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx
index 66c4ef45c587..4055cbcd8944 100644
--- a/framework/source/uielement/popuptoolbarcontroller.cxx
+++ b/framework/source/uielement/popuptoolbarcontroller.cxx
@@ -302,6 +302,56 @@ ToolBoxItemBits GenericPopupToolbarController::getDropDownStyle() const
return m_bSplitButton ? ToolBoxItemBits::DROPDOWN : ToolBoxItemBits::DROPDOWNONLY;
}
+class SaveToolbarController : public PopupMenuToolbarController
+{
+public:
+ SaveToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) throw ( css::uno::RuntimeException, std::exception ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw ( css::uno::RuntimeException ) override;
+ virtual sal_Bool SAL_CALL supportsService( OUString const & rServiceName ) throw ( css::uno::RuntimeException ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw ( css::uno::RuntimeException ) override;
+};
+
+SaveToolbarController::SaveToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext )
+ : PopupMenuToolbarController( rxContext, ".uno:SaveAsMenu" )
+{
+}
+
+void SaveToolbarController::statusChanged( const css::frame::FeatureStateEvent& rEvent )
+ throw ( css::uno::RuntimeException, std::exception )
+{
+ ToolBox* pToolBox = nullptr;
+ sal_uInt16 nId = 0;
+ if ( getToolboxId( nId, &pToolBox ) )
+ {
+ pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) & ~( rEvent.IsEnabled ? ToolBoxItemBits::DROPDOWNONLY : ToolBoxItemBits::DROPDOWN ) );
+ pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ( rEvent.IsEnabled ? ToolBoxItemBits::DROPDOWN : ToolBoxItemBits::DROPDOWNONLY ) );
+ }
+}
+
+OUString SaveToolbarController::getImplementationName()
+ throw ( css::uno::RuntimeException )
+{
+ return OUString("com.sun.star.comp.framework.SaveToolbarController");
+}
+
+sal_Bool SaveToolbarController::supportsService( OUString const & rServiceName )
+ throw ( css::uno::RuntimeException )
+{
+ return cppu::supportsService( this, rServiceName );
+}
+
+css::uno::Sequence< OUString > SaveToolbarController::getSupportedServiceNames()
+ throw ( css::uno::RuntimeException )
+{
+ css::uno::Sequence<OUString> aRet { "com.sun.star.frame.ToolbarController" };
+ return aRet;
+}
+
class NewToolbarController : public PopupMenuToolbarController
{
public:
@@ -554,6 +604,14 @@ com_sun_star_comp_framework_GenericPopupToolbarController_get_implementation(
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_framework_SaveToolbarController_get_implementation(
+ css::uno::XComponentContext *context,
+ css::uno::Sequence<css::uno::Any> const &)
+{
+ return cppu::acquire(new SaveToolbarController(context));
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
org_apache_openoffice_comp_framework_NewToolbarController_get_implementation(
css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
diff --git a/framework/util/fwk.component b/framework/util/fwk.component
index 4f5edfdf2318..418f8159d5f2 100644
--- a/framework/util/fwk.component
+++ b/framework/util/fwk.component
@@ -192,6 +192,10 @@
constructor="com_sun_star_comp_framework_GenericPopupToolbarController_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/>
</implementation>
+ <implementation name="com.sun.star.comp.framework.SaveToolbarController"
+ constructor="com_sun_star_comp_framework_SaveToolbarController_get_implementation">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
<implementation name="org.apache.openoffice.comp.framework.NewToolbarController"
constructor="org_apache_openoffice_comp_framework_NewToolbarController_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index c603356f24e0..23b95fef8d58 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -942,10 +942,7 @@
<value/>
</prop>
<prop oor:name="Controller">
- <value>com.sun.star.comp.framework.GenericPopupToolbarController</value>
- </prop>
- <prop oor:name="Value">
- <value>.uno:SaveAsMenu</value>
+ <value>com.sun.star.comp.framework.SaveToolbarController</value>
</prop>
</node>
<node oor:name="org.apache.openoffice.comp.framework.NewToolbarController" oor:op="replace">