Kaydet (Commit) 3349594b authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt

tdf#98753 Find Toolbar does not display "Search key not found"

Revert "Toolbar: Refactor insert toolitem code"

This reverts commit 27bdc70d.

Change-Id: I1d46cddfd656ab8c809b6cd6308725a8e67fe538
Reviewed-on: https://gerrit.libreoffice.org/25433Reviewed-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst 7ffe20be
......@@ -910,6 +910,8 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
if ( m_bDisposed )
return;
sal_uInt16 nId( 1 );
Reference< XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext );
if ( !m_xDocImageManager.is() )
{
......@@ -1025,22 +1027,30 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
if (( nType == css::ui::ItemType::DEFAULT ) && !aCommandURL.isEmpty() )
{
ToolBoxItemBits nItemBits = ConvertStyleToToolboxItemBits( nStyle );
m_pToolBar->InsertItem(aCommandURL, m_xFrame, nItemBits);
sal_Int16 nId = m_pToolBar->GetItemId(aCommandURL);
OUString aString(vcl::CommandInfoProvider::Instance().GetLabelForCommand(aCommandURL, m_xFrame));
ToolBoxItemBits nItemBits = ConvertStyleToToolboxItemBits( nStyle );
if ( aMenuDesc.is() )
{
m_aMenuMap[ nId ] = aMenuDesc;
nItemBits |= ToolBoxItemBits::DROPDOWNONLY;
}
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 ( !aLabel.isEmpty() )
{
m_pToolBar->SetItemText( nId, aLabel );
if ( !bIsVisible )
m_pToolBar->HideItem( nId );
}
else
{
m_pToolBar->SetItemText( nId, aString );
}
m_pToolBar->EnableItem( nId );
m_pToolBar->SetItemState( nId, TRISTATE_FALSE );
// Fill command map. It stores all our commands and from what
// image manager we got our image. So we can decide if we have to use an
......@@ -1056,6 +1066,11 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
{
pIter->second.aIds.push_back( nId );
}
if ( !bIsVisible )
m_pToolBar->HideItem( nId );
++nId;
}
else if ( nType == css::ui::ItemType::SEPARATOR_LINE )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment