diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-03-12 17:35:04 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-03-13 12:25:58 +0000 |
commit | 4842f402c68397edcb960f8e83f43028af8eb3db (patch) | |
tree | c1a8f42fbb4cd010f4e2053c9e167255807b2006 /svx/source | |
parent | 867f1e5404536fd2f2ffd57fb4510f1eb7ed4561 (diff) |
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@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/tbxctrls/tbunosearchcontrollers.cxx | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index e293e42fc4fe..430fa8cc2f12 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; |