framework/inc/uielement/toolbarmanager.hxx | 2 - framework/source/uielement/toolbarmanager.cxx | 11 +++++---- framework/source/uielement/uicommanddescription.cxx | 12 +++++++++- officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 3 ++ officecfg/registry/schema/org/openoffice/Office/UI/Commands.xcs | 11 ++++++--- 5 files changed, 30 insertions(+), 9 deletions(-)
New commits: commit 25f6ef3d0c55685da8f0f36e7bc6db407720c146 Author: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> Date: Thu Nov 12 17:08:44 2015 +0100 Clone formatting: Usage description should be only in the tooltip Not in the button name Change-Id: I7cf570ce692f33980e0a5d58be0fbccd5ebe0120 diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index cab5cbe..e7297aa 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -3663,6 +3663,9 @@ </node> <node oor:name=".uno:FormatPaintbrush" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Clone Formatting</value> + </prop> + <prop oor:name="TooltipLabel" oor:type="xs:string"> <value xml:lang="en-US">Clone Formatting (double click for multi-selection)</value> </prop> <prop oor:name="Properties" oor:type="xs:int"> commit 9c2f197e8e945f584e718e889938c06fbf644897 Author: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> Date: Thu Nov 12 17:04:36 2015 +0100 Add a new TooltipLabel property for uno commands This allows buttons to have different labels and tooltips. Change-Id: Icbc3fe5f3b4db8a2e6b7177c21341f2df3520f19 diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx index fa62c63..0870d7d 100644 --- a/framework/inc/uielement/toolbarmanager.hxx +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -144,7 +144,7 @@ class ToolBarManager : public ToolbarManager_Base virtual bool MenuItemAllowed( sal_uInt16 ) const; void RemoveControllers(); - OUString RetrieveLabelFromCommand( const OUString& aCmdURL ); + OUString RetrieveFromCommand( const OUString aName, const OUString& aCmdURL ); sal_Int32 RetrievePropertiesFromCommand( const OUString& aCmdURL ); css::uno::Sequence< css::beans::PropertyValue > GetPropsForCommand( const OUString& rCmdURL ); void CreateControllers(); diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 3847e2d..efc6a48 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -809,7 +809,7 @@ uno::Sequence< beans::PropertyValue > ToolBarManager::GetPropsForCommand( const return aPropSeq; } -OUString ToolBarManager::RetrieveLabelFromCommand( const OUString& aCmdURL ) +OUString ToolBarManager::RetrieveFromCommand( const OUString aName, const OUString& aCmdURL ) { OUString aLabel; Sequence< PropertyValue > aPropSeq; @@ -818,7 +818,7 @@ OUString ToolBarManager::RetrieveLabelFromCommand( const OUString& aCmdURL ) aPropSeq = GetPropsForCommand( aCmdURL ); for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) { - if ( aPropSeq[i].Name == "Name" ) + if ( aPropSeq[i].Name == aName ) { aPropSeq[i].Value >>= aLabel; break; @@ -1272,7 +1272,8 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine if (( nType == css::ui::ItemType::DEFAULT ) && !aCommandURL.isEmpty() ) { - OUString aString( RetrieveLabelFromCommand( aCommandURL )); + OUString aString( RetrieveFromCommand( "Label", aCommandURL )); + OUString aTooltipFromCommand( RetrieveFromCommand( "TooltipLabel", aCommandURL )); ToolBoxItemBits nItemBits = ConvertStyleToToolboxItemBits( nStyle ); if ( aMenuDesc.is() ) @@ -1284,8 +1285,10 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine m_pToolBar->SetItemCommand( nId, aCommandURL ); OUString sQuickHelp( aString ); // Use custom tooltip if available - if ( !aTooltip.isEmpty() ) + if ( !aTooltip.isEmpty() ) // Tooltip from menu xml file (toolbar:tooltip) sQuickHelp = aTooltip; + else if ( !aTooltipFromCommand.isEmpty() ) // Tooltip from uno command (TooltipLabel) + sQuickHelp = aTooltipFromCommand; OUString sShortCut; if( RetrieveShortcut( aCommandURL, sShortCut ) ) { diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx index 3f6bc54..926f5c0 100644 --- a/framework/source/uielement/uicommanddescription.cxx +++ b/framework/source/uielement/uicommanddescription.cxx @@ -60,12 +60,14 @@ static const char CONFIGURATION_POP_ELEMENT_ACCESS[] = "/UserInterface/Popups static const char CONFIGURATION_PROPERTY_LABEL[] = "Label"; static const char CONFIGURATION_PROPERTY_CONTEXT_LABEL[] = "ContextLabel"; static const char CONFIGURATION_PROPERTY_POPUP_LABEL[] = "PopupLabel"; +static const char CONFIGURATION_PROPERTY_TOOLTIP_LABEL[] = "TooltipLabel"; // Property names of the resulting Property Set static const char PROPSET_LABEL[] = "Label"; static const char PROPSET_NAME[] = "Name"; static const char PROPSET_POPUP[] = "Popup"; static const char PROPSET_POPUPLABEL[] = "PopupLabel"; +static const char PROPSET_TOOLTIPLABEL[] = "TooltipLabel"; static const char PROPSET_PROPERTIES[] = "Properties"; // Special resource URLs to retrieve additional information @@ -126,6 +128,7 @@ class ConfigurationAccess_UICommand : // Order is necessary for right initializa OUString aContextLabel; OUString aCommandName; OUString aPopupLabel; + OUString aTooltipLabel; bool bPopup : 1, bCommandNameCreated : 1; sal_Int32 nProperties; @@ -155,10 +158,12 @@ class ConfigurationAccess_UICommand : // Order is necessary for right initializa OUString m_aPropUILabel; OUString m_aPropUIContextLabel; OUString m_aPropUIPopupLabel; + OUString m_aPropUITooltipLabel; OUString m_aPropLabel; OUString m_aPropName; OUString m_aPropPopup; OUString m_aPropPopupLabel; + OUString m_aPropTooltipLabel; OUString m_aPropProperties; OUString m_aPrivateResourceURL; Reference< XNameAccess > m_xGenericUICommands; @@ -184,10 +189,12 @@ ConfigurationAccess_UICommand::ConfigurationAccess_UICommand( const OUString& aM m_aPropUILabel( CONFIGURATION_PROPERTY_LABEL ), m_aPropUIContextLabel( CONFIGURATION_PROPERTY_CONTEXT_LABEL ), m_aPropUIPopupLabel( CONFIGURATION_PROPERTY_POPUP_LABEL ), + m_aPropUITooltipLabel( CONFIGURATION_PROPERTY_TOOLTIP_LABEL ), m_aPropLabel( PROPSET_LABEL ), m_aPropName( PROPSET_NAME ), m_aPropPopup( PROPSET_POPUP ), m_aPropPopupLabel( PROPSET_POPUPLABEL ), + m_aPropTooltipLabel( PROPSET_TOOLTIPLABEL ), m_aPropProperties( PROPSET_PROPERTIES ), m_aPrivateResourceURL( PRIVATE_RESOURCE_URL ), m_xGenericUICommands( rGenericUICommands ), @@ -306,7 +313,7 @@ Any ConfigurationAccess_UICommand::getSequenceFromCache( const OUString& aComman if ( !pIter->second.bCommandNameCreated ) fillInfoFromResult( pIter->second, pIter->second.aLabel ); - Sequence< PropertyValue > aPropSeq( 5 ); + Sequence< PropertyValue > aPropSeq( 6 ); aPropSeq[0].Name = m_aPropLabel; aPropSeq[0].Value = !pIter->second.aContextLabel.isEmpty() ? makeAny( pIter->second.aContextLabel ): makeAny( pIter->second.aLabel ); @@ -318,6 +325,8 @@ Any ConfigurationAccess_UICommand::getSequenceFromCache( const OUString& aComman aPropSeq[3].Value <<= pIter->second.nProperties; aPropSeq[4].Name = m_aPropPopupLabel; aPropSeq[4].Value <<= pIter->second.aPopupLabel; + aPropSeq[5].Name = m_aPropTooltipLabel; + aPropSeq[5].Value <<= pIter->second.aTooltipLabel; return makeAny( aPropSeq ); } @@ -345,6 +354,7 @@ void ConfigurationAccess_UICommand::impl_fill(const Reference< XNameAccess >& _x xNameAccess->getByName( m_aPropUILabel ) >>= aCmdToInfo.aLabel; xNameAccess->getByName( m_aPropUIContextLabel ) >>= aCmdToInfo.aContextLabel; xNameAccess->getByName( m_aPropUIPopupLabel ) >>= aCmdToInfo.aPopupLabel; + xNameAccess->getByName( m_aPropUITooltipLabel ) >>= aCmdToInfo.aTooltipLabel; xNameAccess->getByName( m_aPropProperties ) >>= aCmdToInfo.nProperties; m_aCmdInfoCache.insert( CommandToInfoCache::value_type( aNameSeq[i], aCmdToInfo )); diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Commands.xcs b/officecfg/registry/schema/org/openoffice/Office/UI/Commands.xcs index 85460d2..1fec9f7 100644 --- a/officecfg/registry/schema/org/openoffice/Office/UI/Commands.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/UI/Commands.xcs @@ -28,17 +28,22 @@ </info> <prop oor:name="Label" oor:type="xs:string" oor:localized="true"> <info> - <desc>A localized text that describes the command or identifier. Can be used as a label inside a menu or as short tool tip help.</desc> + <desc>A localized text that describes the command. Will be used instead of ContextLabel, PopupLabel and TooltipLabel if those are not specified.</desc> </info> </prop> <prop oor:name="ContextLabel" oor:type="xs:string" oor:localized="true"> <info> - <desc>A localized text that describes the identifier of a command in a structured menu. </desc> + <desc>Used in Menus and also in popup menus if PopupLabel is not specified.</desc> </info> </prop> <prop oor:name="PopupLabel" oor:type="xs:string" oor:localized="true"> <info> - <desc>A localized text that describes the identifier of a command in a popup menu.</desc> + <desc>Used in popup menus to give commands a different label than in the main menu.</desc> + </info> + </prop> + <prop oor:name="TooltipLabel" oor:type="xs:string" oor:localized="true"> + <info> + <desc>Used for Tooltips (Toolbar and Glade Widgets that have their 'action_name' specified.)</desc> </info> </prop> <prop oor:name="Properties" oor:type="xs:int" oor:nillable="false"> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits