From 4a6c72e3b1007e713b3797d23df60b3477a47072 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 12 Feb 2013 14:15:51 +0100 Subject: Clean up EXTENSION_LISTBOX_ENTRY_NOTFOUND Change-Id: Ie491835b854bf59694a20c4f94e2333b72142d08 --- desktop/source/deployment/gui/dp_gui_dialog2.cxx | 17 +++++++++-------- desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 2 +- desktop/source/deployment/gui/dp_gui_extlistbox.hxx | 2 +- svtools/inc/svtools/extensionlistbox.hxx | 6 +++--- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 643e8512deb4..63154e7931f1 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -219,7 +219,7 @@ void ExtBoxWithBtns_Impl::RecalcAll() { const sal_Int32 nActive = getSelIndex(); - if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) + if ( nActive != svt::IExtensionListBox::ENTRY_NOTFOUND ) { SetButtonStatus( GetEntryData( nActive) ); } @@ -232,7 +232,7 @@ void ExtBoxWithBtns_Impl::RecalcAll() ExtensionBox_Impl::RecalcAll(); - if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) + if ( nActive != svt::IExtensionListBox::ENTRY_NOTFOUND ) SetButtonPos( GetEntryRect( nActive ) ); } @@ -313,7 +313,7 @@ bool ExtBoxWithBtns_Impl::HandleTabKey( bool bReverse ) { sal_Int32 nIndex = getSelIndex(); - if ( nIndex == EXTENSION_LISTBOX_ENTRY_NOTFOUND ) + if ( nIndex == svt::IExtensionListBox::ENTRY_NOTFOUND ) return false; PushButton *pNext = NULL; @@ -417,7 +417,8 @@ void ExtBoxWithBtns_Impl::MouseButtonDown( const MouseEvent& rMEvt ) { const SolarMutexGuard aGuard; if ( rMEvt.IsMod1() && HasActive() ) - selectEntry( EXTENSION_LISTBOX_ENTRY_NOTFOUND ); // Selecting an not existing entry will deselect the current one + selectEntry( svt::IExtensionListBox::ENTRY_NOTFOUND ); + // selecting a not existing entry will deselect the current one else selectEntry( nPos ); } @@ -452,7 +453,7 @@ void ExtBoxWithBtns_Impl::enableButtons( bool bEnable ) if ( bEnable ) { sal_Int32 nIndex = getSelIndex(); - if ( nIndex != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) + if ( nIndex != svt::IExtensionListBox::ENTRY_NOTFOUND ) SetButtonStatus( GetEntryData( nIndex ) ); } else @@ -486,7 +487,7 @@ IMPL_LINK_NOARG(ExtBoxWithBtns_Impl, HandleOptionsBtn) { const sal_Int32 nActive = getSelIndex(); - if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) + if ( nActive != svt::IExtensionListBox::ENTRY_NOTFOUND ) { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); @@ -509,7 +510,7 @@ IMPL_LINK_NOARG(ExtBoxWithBtns_Impl, HandleEnableBtn) { const sal_Int32 nActive = getSelIndex(); - if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) + if ( nActive != svt::IExtensionListBox::ENTRY_NOTFOUND ) { TEntry_Impl pEntry = GetEntryData( nActive ); @@ -530,7 +531,7 @@ IMPL_LINK_NOARG(ExtBoxWithBtns_Impl, HandleRemoveBtn) { const sal_Int32 nActive = getSelIndex(); - if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) + if ( nActive != svt::IExtensionListBox::ENTRY_NOTFOUND ) { TEntry_Impl pEntry = GetEntryData( nActive ); m_pParent->removePackage( pEntry->m_xPackage ); diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index b050c06ceecc..01fea3e3b3d7 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -304,7 +304,7 @@ sal_Int32 ExtensionBox_Impl::getSelIndex() const return static_cast< sal_Int32 >( m_nActive ); } else - return static_cast< sal_Int32 >( EXTENSION_LISTBOX_ENTRY_NOTFOUND ); + return ENTRY_NOTFOUND; } //------------------------------------------------------------------------------ diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx index bd16bae937bb..b0fda41add21 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx @@ -222,7 +222,7 @@ public: /** @return The index of the first selected entry in the list box. When nothing is selected, which is the case when getItemCount returns '0', - then this function returns EXTENSION_LISTBOX_ENTRY_NOTFOUND */ + then this function returns ENTRY_NOTFOUND */ virtual sal_Int32 getSelIndex() const; /** @return The item name of the entry with the given index diff --git a/svtools/inc/svtools/extensionlistbox.hxx b/svtools/inc/svtools/extensionlistbox.hxx index 950aca2c77d3..0202312145de 100644 --- a/svtools/inc/svtools/extensionlistbox.hxx +++ b/svtools/inc/svtools/extensionlistbox.hxx @@ -28,8 +28,6 @@ namespace svt { -#define EXTENSION_LISTBOX_ENTRY_NOTFOUND (sal_Int32) 0xFFFFFFFF - // ============================================================================ /** This abstract class provides methods to implement an extension list box. @@ -38,6 +36,8 @@ namespace svt class IExtensionListBox: public Control { public: + enum { ENTRY_NOTFOUND = -1 }; + IExtensionListBox( Window* pParent, WinBits nWinStyle = 0 ): Control( pParent, nWinStyle ){} /** @return The count of the entries in the list box. */ @@ -45,7 +45,7 @@ public: /** @return The index of the first selected entry in the list box. When nothing is selected, which is the case when getItemCount returns '0', - then this function returns EXTENSION_LISTBOX_ENTRY_NOTFOUND */ + then this function returns ENTRY_NOTFOUND */ virtual sal_Int32 getSelIndex() const = 0; /** @return The item name of the entry with the given index -- cgit