[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - framework/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Wed May 25 15:37:40 UTC 2016


 framework/source/uielement/toolbarmanager.cxx |   29 +++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

New commits:
commit 80d01c991d8c9a4f4cf6dfd4370238edbfd870f6
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Wed May 25 09:49:08 2016 +0200

    tdf#98753 Find Toolbar does not display "Search key not found"
    
    Revert "Toolbar: Refactor insert toolitem code"
    
    This reverts commit 27bdc70d83d4a4f1ebb89429f61b39084e739aaa.
    
    Change-Id: I1d46cddfd656ab8c809b6cd6308725a8e67fe538
    Reviewed-on: https://gerrit.libreoffice.org/25433
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit 3349594bffc1eda4ee1d258be207b40f2f6f9b12)
    Reviewed-on: https://gerrit.libreoffice.org/25434
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index f10e042..77849d5 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -913,6 +913,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() )
     {
@@ -1028,22 +1030,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
@@ -1059,6 +1069,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 )
                 {


More information about the Libreoffice-commits mailing list