Kaydet (Commit) 0e5c0c4b authored tarafından Noel Grandin's avatar Noel Grandin

use o3tl::enumarray for m_aNodeAndEntryImages

Change-Id: I508c77562ec92b078d15d2a557af474a93b940de
Reviewed-on: https://gerrit.libreoffice.org/41294Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Tested-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 70027414
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <vcl/scrbar.hxx> #include <vcl/scrbar.hxx>
#include <vcl/vclevent.hxx> #include <vcl/vclevent.hxx>
#include <unotools/intlwrapper.hxx> #include <unotools/intlwrapper.hxx>
#include <o3tl/enumarray.hxx>
#include <vector> #include <vector>
#include "svtaccessiblefactory.hxx" #include "svtaccessiblefactory.hxx"
...@@ -106,19 +107,19 @@ private: ...@@ -106,19 +107,19 @@ private:
static oslInterlockedCount s_nImageRefCount; /// When 0 all static images will be destroyed static oslInterlockedCount s_nImageRefCount; /// When 0 all static images will be destroyed
// Node Bitmaps // Node Bitmaps
enum ImageType enum class ImageType
{ {
itNodeExpanded = 0, // node is expanded ( usually a bitmap showing a minus ) NodeExpanded = 0, // node is expanded ( usually a bitmap showing a minus )
itNodeCollapsed, // node is collapsed ( usually a bitmap showing a plus ) NodeCollapsed, // node is collapsed ( usually a bitmap showing a plus )
itNodeDontKnow, // don't know the node state NodeDontKnow, // don't know the node state
itEntryDefExpanded, // default for expanded entries EntryDefExpanded, // default for expanded entries
itEntryDefCollapsed, // default for collapsed entries EntryDefCollapsed, // default for collapsed entries
LAST = EntryDefCollapsed
IT_IMAGE_COUNT
}; };
// all our images // all our images
Image m_aNodeAndEntryImages[ IT_IMAGE_COUNT ]; o3tl::enumarray<ImageType, Image>
m_aNodeAndEntryImages;
ImpLBSelEng aFctSet; ImpLBSelEng aFctSet;
Idle aAsyncBeginDragIdle; Idle aAsyncBeginDragIdle;
...@@ -339,58 +340,54 @@ public: ...@@ -339,58 +340,54 @@ public:
inline Image& SvImpLBox::implGetImageLocation( const ImageType _eType ) inline Image& SvImpLBox::implGetImageLocation( const ImageType _eType )
{ {
DBG_ASSERT( ( _eType >= 0 ) && ( _eType < IT_IMAGE_COUNT ), return m_aNodeAndEntryImages[_eType];
"SvImpLBox::implGetImageLocation: invalid image index (will crash)!" );
Image* _pSet = m_aNodeAndEntryImages;
return *( _pSet + (sal_Int32)_eType );
} }
inline void SvImpLBox::SetExpandedNodeBmp( const Image& rImg ) inline void SvImpLBox::SetExpandedNodeBmp( const Image& rImg )
{ {
implGetImageLocation( itNodeExpanded ) = rImg; implGetImageLocation( ImageType::NodeExpanded ) = rImg;
SetNodeBmpYOffset( rImg ); SetNodeBmpYOffset( rImg );
} }
inline void SvImpLBox::SetCollapsedNodeBmp( const Image& rImg ) inline void SvImpLBox::SetCollapsedNodeBmp( const Image& rImg )
{ {
implGetImageLocation( itNodeCollapsed ) = rImg; implGetImageLocation( ImageType::NodeCollapsed ) = rImg;
SetNodeBmpYOffset( rImg ); SetNodeBmpYOffset( rImg );
} }
inline const Image& SvImpLBox::GetDontKnowNodeBmp( ) inline const Image& SvImpLBox::GetDontKnowNodeBmp( )
{ {
return implGetImageLocation( itNodeDontKnow ); return implGetImageLocation( ImageType::NodeDontKnow );
} }
inline const Image& SvImpLBox::GetExpandedNodeBmp( ) inline const Image& SvImpLBox::GetExpandedNodeBmp( )
{ {
return implGetImageLocation( itNodeExpanded ); return implGetImageLocation( ImageType::NodeExpanded );
} }
inline const Image& SvImpLBox::GetCollapsedNodeBmp( ) inline const Image& SvImpLBox::GetCollapsedNodeBmp( )
{ {
return implGetImageLocation( itNodeCollapsed ); return implGetImageLocation( ImageType::NodeCollapsed );
} }
inline void SvImpLBox::SetDefaultEntryExpBmp( const Image& _rImg ) inline void SvImpLBox::SetDefaultEntryExpBmp( const Image& _rImg )
{ {
implGetImageLocation( itEntryDefExpanded ) = _rImg; implGetImageLocation( ImageType::EntryDefExpanded ) = _rImg;
} }
inline void SvImpLBox::SetDefaultEntryColBmp( const Image& _rImg ) inline void SvImpLBox::SetDefaultEntryColBmp( const Image& _rImg )
{ {
implGetImageLocation( itEntryDefCollapsed ) = _rImg; implGetImageLocation( ImageType::EntryDefCollapsed ) = _rImg;
} }
inline const Image& SvImpLBox::GetDefaultEntryExpBmp( ) inline const Image& SvImpLBox::GetDefaultEntryExpBmp( )
{ {
return implGetImageLocation( itEntryDefExpanded ); return implGetImageLocation( ImageType::EntryDefExpanded );
} }
inline const Image& SvImpLBox::GetDefaultEntryColBmp( ) inline const Image& SvImpLBox::GetDefaultEntryColBmp( )
{ {
return implGetImageLocation( itEntryDefCollapsed ); return implGetImageLocation( ImageType::EntryDefCollapsed );
} }
inline Point SvImpLBox::GetEntryPosition( SvTreeListEntry* pEntry ) const inline Point SvImpLBox::GetEntryPosition( SvTreeListEntry* pEntry ) const
......
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