From 1f9b7ccd6e988b330e5d16305c27c7d6844c938b Mon Sep 17 00:00:00 2001 From: Maxim Monastirsky Date: Fri, 3 Feb 2017 13:34:44 +0200 Subject: Restore custom tooltip support This reverts the toolbarmanager.cxx part of 38839ae10cb565ff1977b1839de1c8278eac657b ("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 --- framework/source/uielement/toolbarmanager.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'framework') diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 9542b49212b2..2ddc5f852804 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -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() ) { -- cgit