Change the bits of the save button dynamically
When the save slot is disabled, we want it to become a dropdown only instead of disabling it. Change-Id: I22fb04c8a0c9afc0a1af8f031a584cdaa99484f9 Reviewed-on: https://gerrit.libreoffice.org/20079 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
committed by
Samuel Mehrbrodt
parent
6c1c9c4a57
commit
4f69d0810e
@@ -302,6 +302,56 @@ ToolBoxItemBits GenericPopupToolbarController::getDropDownStyle() const
|
|||||||
return m_bSplitButton ? ToolBoxItemBits::DROPDOWN : ToolBoxItemBits::DROPDOWNONLY;
|
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
|
class NewToolbarController : public PopupMenuToolbarController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -553,6 +603,14 @@ com_sun_star_comp_framework_GenericPopupToolbarController_get_implementation(
|
|||||||
return cppu::acquire(new GenericPopupToolbarController(context, args));
|
return cppu::acquire(new GenericPopupToolbarController(context, args));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
|
||||||
org_apache_openoffice_comp_framework_NewToolbarController_get_implementation(
|
org_apache_openoffice_comp_framework_NewToolbarController_get_implementation(
|
||||||
css::uno::XComponentContext *context,
|
css::uno::XComponentContext *context,
|
||||||
|
@@ -192,6 +192,10 @@
|
|||||||
constructor="com_sun_star_comp_framework_GenericPopupToolbarController_get_implementation">
|
constructor="com_sun_star_comp_framework_GenericPopupToolbarController_get_implementation">
|
||||||
<service name="com.sun.star.frame.ToolbarController"/>
|
<service name="com.sun.star.frame.ToolbarController"/>
|
||||||
</implementation>
|
</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"
|
<implementation name="org.apache.openoffice.comp.framework.NewToolbarController"
|
||||||
constructor="org_apache_openoffice_comp_framework_NewToolbarController_get_implementation">
|
constructor="org_apache_openoffice_comp_framework_NewToolbarController_get_implementation">
|
||||||
<service name="com.sun.star.frame.ToolbarController"/>
|
<service name="com.sun.star.frame.ToolbarController"/>
|
||||||
|
@@ -942,10 +942,7 @@
|
|||||||
<value/>
|
<value/>
|
||||||
</prop>
|
</prop>
|
||||||
<prop oor:name="Controller">
|
<prop oor:name="Controller">
|
||||||
<value>com.sun.star.comp.framework.GenericPopupToolbarController</value>
|
<value>com.sun.star.comp.framework.SaveToolbarController</value>
|
||||||
</prop>
|
|
||||||
<prop oor:name="Value">
|
|
||||||
<value>.uno:SaveAsMenu</value>
|
|
||||||
</prop>
|
</prop>
|
||||||
</node>
|
</node>
|
||||||
<node oor:name="org.apache.openoffice.comp.framework.NewToolbarController" oor:op="replace">
|
<node oor:name="org.apache.openoffice.comp.framework.NewToolbarController" oor:op="replace">
|
||||||
|
Reference in New Issue
Block a user