summaryrefslogtreecommitdiff
path: root/framework/source/uielement/popuptoolbarcontroller.cxx
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2016-03-21 12:35:46 +0200
committerMaxim Monastirsky <momonasmon@gmail.com>2016-03-21 12:39:14 +0200
commitae00a95ea458a0328d7b12d25c231e9f4ac8eed8 (patch)
treee8627899f298afadd69ac64fc00f35bdfdf29684 /framework/source/uielement/popuptoolbarcontroller.cxx
parente4765bdfecf94287aeaf3f27cca185b533761784 (diff)
tdf#98745 Optional save button without the dropdown
Change-Id: I66499a9108dce76e661df9b5b45b249caf9eece8
Diffstat (limited to 'framework/source/uielement/popuptoolbarcontroller.cxx')
-rw-r--r--framework/source/uielement/popuptoolbarcontroller.cxx25
1 files changed, 16 insertions, 9 deletions
diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx
index 28f7affa0487..50f7ec3c882d 100644
--- a/framework/source/uielement/popuptoolbarcontroller.cxx
+++ b/framework/source/uielement/popuptoolbarcontroller.cxx
@@ -354,12 +354,14 @@ public:
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw ( css::uno::RuntimeException ) override;
private:
+ bool m_bSplitButton;
bool m_bModified;
css::uno::Reference< css::util::XModifiable > m_xModifiable;
};
SaveToolbarController::SaveToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext )
: ImplInheritanceHelper( rxContext, ".uno:SaveAsMenu" )
+ , m_bSplitButton( true )
, m_bModified( false )
{
}
@@ -369,16 +371,21 @@ void SaveToolbarController::initialize( const css::uno::Sequence< css::uno::Any
{
PopupMenuToolbarController::initialize( aArguments );
- if ( m_sModuleName.endsWith( "RelationDesign" ) )
+ bool bRelationDesignModule = m_sModuleName.endsWith( "RelationDesign" );
+
+ ToolBox* pToolBox = nullptr;
+ sal_uInt16 nId = 0;
+ if ( getToolboxId( nId, &pToolBox )
+ && ( bRelationDesignModule || pToolBox->GetItemCommand( nId ) != m_aCommandURL ) )
{
- // Should not have the dropdown.
- ToolBox* pToolBox = nullptr;
- sal_uInt16 nId = 0;
- if ( getToolboxId( nId, &pToolBox ) )
- pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) & ~ ToolBoxItemBits::DROPDOWN );
- return;
+ m_bSplitButton = false;
+ pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) & ~ ToolBoxItemBits::DROPDOWN );
}
+ if ( bRelationDesignModule )
+ // No modified icon there, just disable the button if there's nothing to save.
+ return;
+
css::uno::Reference< css::frame::XController > xController( m_xFrame->getController(), css::uno::UNO_QUERY );
if ( xController.is() )
m_xModifiable.set( xController->getModel(), css::uno::UNO_QUERY );
@@ -421,7 +428,7 @@ void SaveToolbarController::updateImage()
css::uno::Reference< css::frame::XStorable > xStorable( m_xModifiable, css::uno::UNO_QUERY );
Image aImage;
- if ( xStorable.is() && xStorable->isReadonly() )
+ if ( m_bSplitButton && xStorable.is() && xStorable->isReadonly() )
{
aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand( ".uno:SaveAs", bLargeIcons, m_xFrame );
}
@@ -446,7 +453,7 @@ void SaveToolbarController::statusChanged( const css::frame::FeatureStateEvent&
// If the model is able to tell us whether we're in read only mode, change the button to save as only mode
// based on that. Otherwise just dumbly disable the button (because there could be other reasons why the
// save slot is disabled, where save as isn't possible as well).
- if ( xStorable.is() )
+ if ( m_bSplitButton && xStorable.is() )
{
ToolBox* pToolBox = nullptr;
sal_uInt16 nId = 0;