Restore custom tooltip support

This reverts the toolbarmanager.cxx part of
38839ae10c ("Remove the
ability to set tooltips in the toolbar xml files").

It is true that tooltips can't be set in xml files,
but toolbars can also be created/modified via the
UIConfigurationManager and LayoutManager APIs,
e.g. the test doc of i#105626 .

Change-Id: Ida1559e61e7fd9bd6dcdd7b7159bc5efe070c721
This commit is contained in:
Maxim Monastirsky
2017-02-03 13:34:44 +02:00
parent 47e84338e4
commit 1f9b7ccd6e

View File

@@ -984,6 +984,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
Sequence< PropertyValue > aProp;
OUString aCommandURL;
OUString aLabel;
OUString aTooltip;
sal_uInt16 nType( css::ui::ItemType::DEFAULT );
sal_uInt32 nStyle( 0 );
@@ -1035,6 +1036,8 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
}
else if ( aProp[i].Name == "Label" )
aProp[i].Value >>= aLabel;
else if ( aProp[i].Name == "Tooltip" )
aProp[i].Value >>= aTooltip;
else if ( aProp[i].Name == "Type" )
aProp[i].Value >>= nType;
else if ( aProp[i].Name == ITEM_DESCRIPTOR_VISIBLE )
@@ -1061,9 +1064,10 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
}
m_pToolBar->InsertItem( nId, aString, nItemBits );
m_pToolBar->SetItemCommand( nId, aCommandURL );
OUString sTooltip = vcl::CommandInfoProvider::Instance().GetTooltipForCommand(aCommandURL, m_xFrame);
if (!sTooltip.isEmpty())
m_pToolBar->SetQuickHelpText( nId, sTooltip );
if ( !aTooltip.isEmpty() )
m_pToolBar->SetQuickHelpText( nId, aTooltip );
else
m_pToolBar->SetQuickHelpText( nId, vcl::CommandInfoProvider::Instance().GetTooltipForCommand(aCommandURL, m_xFrame) );
if ( !aLabel.isEmpty() )
{