summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--framework/inc/uielement/toolbarmanager.hxx2
-rw-r--r--framework/source/uielement/toolbarmanager.cxx11
-rw-r--r--framework/source/uielement/uicommanddescription.cxx12
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/UI/Commands.xcs11
4 files changed, 27 insertions, 9 deletions
diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx
index fa62c634f618..0870d7dc6b0c 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 3847e2d68c70..efc6a489456b 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 3f6bc545f83a..926f5c094be1 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 85460d2cbc37..1fec9f765777 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">