[Libreoffice-commits] core.git: svx/source

Stephan Bergmann sbergman at redhat.com
Mon Mar 13 12:26:43 UTC 2017


 svx/source/tbxctrls/tbunosearchcontrollers.cxx |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

New commits:
commit 4842f402c68397edcb960f8e83f43028af8eb3db
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sun Mar 12 17:35:04 2017 +0100

    ToolBox::GetItemCommand/GetItemWindow/EnableItem take IDs
    
    ...not positions in the [0..GetItemCount()) range, so what's probably missing
    here is to map from positions to IDs.  Code was originally introduced with
    8a429819aab795e131bb2567f08cc0c2d1784624 "findbar01: enhancements for findbar".
    
    Change-Id: Ia95b65e14bb81dac940269b167434f83cefbd4d8
    Reviewed-on: https://gerrit.libreoffice.org/35102
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index e293e42..430fa8c 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -92,20 +92,21 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext
         sal_uInt16 nItemCount = pToolBox->GetItemCount();
         for ( sal_uInt16 i=0; i<nItemCount; ++i )
         {
-            OUString sItemCommand = pToolBox->GetItemCommand(i);
+            sal_uInt16 id = pToolBox->GetItemId(i);
+            OUString sItemCommand = pToolBox->GetItemCommand(id);
             if ( sItemCommand == COMMAND_FINDTEXT )
             {
-                vcl::Window* pItemWin = pToolBox->GetItemWindow(i);
+                vcl::Window* pItemWin = pToolBox->GetItemWindow(id);
                 if (pItemWin)
                     sFindText = pItemWin->GetText();
             } else if ( sItemCommand == COMMAND_MATCHCASE )
             {
-                CheckBox* pItemWin = static_cast<CheckBox*>( pToolBox->GetItemWindow(i) );
+                CheckBox* pItemWin = static_cast<CheckBox*>( pToolBox->GetItemWindow(id) );
                 if (pItemWin)
                     aMatchCase = pItemWin->IsChecked();
             } else if ( sItemCommand == COMMAND_SEARCHFORMATTED )
             {
-                CheckBox* pItemWin = static_cast<CheckBox*>( pToolBox->GetItemWindow(i) );
+                CheckBox* pItemWin = static_cast<CheckBox*>( pToolBox->GetItemWindow(id) );
                 if (pItemWin)
                     bSearchFormatted = pItemWin->IsChecked();
             }
@@ -529,10 +530,11 @@ void SAL_CALL FindTextToolbarController::initialize( const css::uno::Sequence< c
         for ( sal_uInt16 i=0; i<nItemCount; ++i )
         {
             OUString sItemCommand = pToolBox->GetItemCommand(i);
+            sal_uInt16 id = pToolBox->GetItemId(i);
             if ( sItemCommand == COMMAND_DOWNSEARCH )
-                m_nDownSearchId = i;
+                m_nDownSearchId = id;
             else if ( sItemCommand == COMMAND_UPSEARCH )
-                m_nUpSearchId = i;
+                m_nUpSearchId = id;
         }
     }
 
@@ -1436,10 +1438,11 @@ void SAL_CALL FindbarDispatcher::dispatch( const css::util::URL& aURL, const css
             sal_uInt16 nItemCount = pToolBox->GetItemCount();
             for ( sal_uInt16 i=0; i<nItemCount; ++i )
             {
-                OUString sItemCommand = pToolBox->GetItemCommand(i);
+                sal_uInt16 id = pToolBox->GetItemId(i);
+                OUString sItemCommand = pToolBox->GetItemCommand(id);
                 if ( sItemCommand == COMMAND_FINDTEXT )
                 {
-                    vcl::Window* pItemWin = pToolBox->GetItemWindow( i );
+                    vcl::Window* pItemWin = pToolBox->GetItemWindow( id );
                     if ( pItemWin )
                     {
                         SolarMutexGuard aSolarMutexGuard;


More information about the Libreoffice-commits mailing list