diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-04-07 15:20:14 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-04-09 09:53:48 +0900 |
commit | 1b0c1943788f6083b27a1e5a4d6d76373f08459b (patch) | |
tree | 0afd4eae2639eeffd009b653259460d2b2bfe3f7 | |
parent | 7e1d93056be5d43a6307dd75744cd006144f5cb8 (diff) |
some cleanup in treelistbox
Change-Id: I24720adfc7c1c38ba7d804baef3c1e01e01d64cb
-rw-r--r-- | include/svtools/svlbitm.hxx | 173 | ||||
-rw-r--r-- | include/svtools/treelistbox.hxx | 38 | ||||
-rw-r--r-- | svtools/source/contnr/treelistbox.cxx | 10 |
3 files changed, 144 insertions, 77 deletions
diff --git a/include/svtools/svlbitm.hxx b/include/svtools/svlbitm.hxx index 4c49f3b1a084..4e082917e4e9 100644 --- a/include/svtools/svlbitm.hxx +++ b/include/svtools/svlbitm.hxx @@ -108,21 +108,37 @@ class SVT_DLLPUBLIC SvLBoxString : public SvLBoxItem { protected: OUString maText; + public: - SvLBoxString(SvTreeListEntry*, sal_uInt16 nFlags, const OUString& rStr); - SvLBoxString(); - virtual ~SvLBoxString(); - virtual sal_uInt16 GetType() const SAL_OVERRIDE; - virtual void InitViewData(SvTreeListBox*, SvTreeListEntry*, SvViewDataItem*) SAL_OVERRIDE; - OUString GetText() const { return maText; } - OUString GetExtendText() const { return OUString(); } - void SetText( const OUString& rText ) { maText = rText; } + SvLBoxString(SvTreeListEntry*, sal_uInt16 nFlags, const OUString& rText); + SvLBoxString(); + virtual ~SvLBoxString(); - virtual void Paint( - const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual sal_uInt16 GetType() const SAL_OVERRIDE; + virtual void InitViewData(SvTreeListBox* pView, + SvTreeListEntry* pEntry, + SvViewDataItem* pViewData) SAL_OVERRIDE; + + OUString GetText() const + { + return maText; + } + OUString GetExtendText() const + { + return OUString(); + } + void SetText(const OUString& rText) + { + maText = rText; + } + + virtual void Paint(const Point& rPos, + SvTreeListBox& rOutDev, + const SvViewDataEntry* pView, + const SvTreeListEntry* pEntry) SAL_OVERRIDE; virtual SvLBoxItem* Create() const SAL_OVERRIDE; - virtual void Clone( SvLBoxItem* pSource ) SAL_OVERRIDE; + virtual void Clone(SvLBoxItem* pSource) SAL_OVERRIDE; }; class SvLBoxBmp : public SvLBoxItem @@ -149,39 +165,65 @@ class SVT_DLLPUBLIC SvLBoxButton : public SvLBoxItem void ImplAdjustBoxSize( Size& io_rCtrlSize, ControlType i_eType, vcl::Window* pParent ); public: - // An SvLBoxButton can be of three different kinds: an - // enabled checkbox (the normal kind), a disabled checkbox - // (which cannot be modified via UI), or a static image - // (see SV_BMP_STATICIMAGE; nFlags are effectively ignored - // for that kind). - SvLBoxButton( SvTreeListEntry* pEntry, - SvLBoxButtonKind eTheKind, sal_uInt16 nFlags, - SvLBoxButtonData* pBData ); - SvLBoxButton(); - virtual ~SvLBoxButton(); - virtual void InitViewData( SvTreeListBox*,SvTreeListEntry*,SvViewDataItem* ) SAL_OVERRIDE; + // An SvLBoxButton can be of three different kinds: an + // enabled checkbox (the normal kind), a disabled checkbox + // (which cannot be modified via UI), or a static image + // (see SV_BMP_STATICIMAGE; nFlags are effectively ignored + // for that kind). + SvLBoxButton( SvTreeListEntry* pEntry, + SvLBoxButtonKind eTheKind, sal_uInt16 nFlags, + SvLBoxButtonData* pBData ); + SvLBoxButton(); + virtual ~SvLBoxButton(); + virtual void InitViewData(SvTreeListBox* pView, + SvTreeListEntry* pEntry, + SvViewDataItem* pViewData) SAL_OVERRIDE; + virtual sal_uInt16 GetType() const SAL_OVERRIDE; - bool ClickHdl(SvTreeListBox* pView, SvTreeListEntry* ); - virtual void Paint( - const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + bool ClickHdl(SvTreeListBox* pView, SvTreeListEntry* ); + + virtual void Paint(const Point& rPos, + SvTreeListBox& rOutDev, + const SvViewDataEntry* pView, + const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual SvLBoxItem* Create() const SAL_OVERRIDE; - virtual void Clone( SvLBoxItem* pSource ) SAL_OVERRIDE; - SvItemStateFlags GetButtonFlags() const { return nItemFlags; } - bool IsStateChecked() const { return bool(nItemFlags & SvItemStateFlags::CHECKED); } - bool IsStateUnchecked() const { return bool(nItemFlags & SvItemStateFlags::UNCHECKED); } - bool IsStateTristate() const { return bool(nItemFlags & SvItemStateFlags::TRISTATE); } - bool IsStateHilighted() const { return bool(nItemFlags & SvItemStateFlags::HILIGHTED); } - void SetStateChecked(); - void SetStateUnchecked(); - void SetStateTristate(); - void SetStateHilighted( bool bHilight ); - void SetStateInvisible(); + + virtual void Clone(SvLBoxItem* pSource) SAL_OVERRIDE; + SvItemStateFlags GetButtonFlags() const + { + return nItemFlags; + } + bool IsStateChecked() const + { + return bool(nItemFlags & SvItemStateFlags::CHECKED); + } + bool IsStateUnchecked() const + { + return bool(nItemFlags & SvItemStateFlags::UNCHECKED); + } + bool IsStateTristate() const + { + return bool(nItemFlags & SvItemStateFlags::TRISTATE); + } + bool IsStateHilighted() const + { + return bool(nItemFlags & SvItemStateFlags::HILIGHTED); + } + void SetStateChecked(); + void SetStateUnchecked(); + void SetStateTristate(); + void SetStateHilighted(bool bHilight); + void SetStateInvisible(); SvLBoxButtonKind GetKind() const { return eKind; } // Check whether this button can be modified via UI - bool CheckModification() const; - SvLBoxButtonData* GetButtonData() const{ return pData;} + bool CheckModification() const; + SvLBoxButtonData* GetButtonData() const + { + return pData; + } }; inline void SvLBoxButton::SetStateChecked() @@ -189,6 +231,7 @@ inline void SvLBoxButton::SetStateChecked() nItemFlags &= SvItemStateFlags::HILIGHTED; nItemFlags |= SvItemStateFlags::CHECKED; } + inline void SvLBoxButton::SetStateUnchecked() { nItemFlags &= SvItemStateFlags::HILIGHTED; @@ -207,56 +250,64 @@ inline void SvLBoxButton::SetStateHilighted( bool bHilight ) nItemFlags &= ~SvItemStateFlags::HILIGHTED; } - struct SvLBoxContextBmp_Impl; + class SVT_DLLPUBLIC SvLBoxContextBmp : public SvLBoxItem { SvLBoxContextBmp_Impl* m_pImpl; public: - SvLBoxContextBmp( - SvTreeListEntry* pEntry, sal_uInt16 nItemFlags, Image aBmp1, Image aBmp2, bool bExpanded); + SvLBoxContextBmp(SvTreeListEntry* pEntry, + sal_uInt16 nItemFlags, + Image aBmp1, + Image aBmp2, + bool bExpanded); SvLBoxContextBmp(); + virtual ~SvLBoxContextBmp(); - virtual ~SvLBoxContextBmp(); virtual sal_uInt16 GetType() const SAL_OVERRIDE; - virtual void InitViewData( SvTreeListBox*,SvTreeListEntry*,SvViewDataItem* ) SAL_OVERRIDE; - virtual void Paint( - const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual void InitViewData(SvTreeListBox* pView, + SvTreeListEntry* pEntry, + SvViewDataItem* pViewData) SAL_OVERRIDE; + virtual void Paint(const Point& rPos, + SvTreeListBox& rOutDev, + const SvViewDataEntry* pView, + const SvTreeListEntry* pEntry) SAL_OVERRIDE; + virtual SvLBoxItem* Create() const SAL_OVERRIDE; - virtual void Clone( SvLBoxItem* pSource ) SAL_OVERRIDE; + virtual void Clone(SvLBoxItem* pSource) SAL_OVERRIDE; - bool SetModeImages( const Image& _rBitmap1, const Image& _rBitmap2 ); - void GetModeImages( Image& _rBitmap1, Image& _rBitmap2 ) const; + bool SetModeImages(const Image& rBitmap1, const Image& rBitmap2); + void GetModeImages(Image& rBitmap1, Image& rBitmap2) const; - inline void SetBitmap1( const Image& _rImage ); - inline void SetBitmap2( const Image& _rImage ); - inline const Image& GetBitmap1( ) const; - inline const Image& GetBitmap2( ) const; + inline void SetBitmap1(const Image& rImage); + inline void SetBitmap2(const Image& rImage); + inline const Image& GetBitmap1() const; + inline const Image& GetBitmap2() const; private: - Image& implGetImageStore( bool _bFirst ); + Image& implGetImageStore(bool bFirst); }; -inline void SvLBoxContextBmp::SetBitmap1( const Image& _rImage ) +inline void SvLBoxContextBmp::SetBitmap1(const Image& _rImage) { - implGetImageStore( true ) = _rImage; + implGetImageStore(true) = _rImage; } -inline void SvLBoxContextBmp::SetBitmap2( const Image& _rImage ) +inline void SvLBoxContextBmp::SetBitmap2(const Image& _rImage) { - implGetImageStore( false ) = _rImage; + implGetImageStore(false) = _rImage; } -inline const Image& SvLBoxContextBmp::GetBitmap1( ) const +inline const Image& SvLBoxContextBmp::GetBitmap1() const { - Image& rImage = const_cast< SvLBoxContextBmp* >( this )->implGetImageStore( true ); + Image& rImage = const_cast<SvLBoxContextBmp*>(this)->implGetImageStore(true); return rImage; } -inline const Image& SvLBoxContextBmp::GetBitmap2( ) const +inline const Image& SvLBoxContextBmp::GetBitmap2() const { - Image& rImage = const_cast< SvLBoxContextBmp* >( this )->implGetImageStore( false ); + Image& rImage = const_cast<SvLBoxContextBmp*>(this)->implGetImageStore(false); return rImage; } diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx index 43b81fb8c4e8..bdf27d136ae2 100644 --- a/include/svtools/treelistbox.hxx +++ b/include/svtools/treelistbox.hxx @@ -337,19 +337,39 @@ public: SvTreeListBox( vcl::Window* pParent, const ResId& rResId ); virtual ~SvTreeListBox(); - SvTreeList* GetModel() const { return pModel; } + SvTreeList* GetModel() const + { + return pModel; + } + using SvListView::SetModel; + void SetModel(SvTreeList* pNewModel) SAL_OVERRIDE; - sal_uLong GetEntryCount() const {return pModel->GetEntryCount();} - SvTreeListEntry* First() const { return pModel->First(); } - SvTreeListEntry* Next( SvTreeListEntry* pEntry, sal_uInt16* pDepth=0 ) const { return pModel->Next(pEntry,pDepth); } - SvTreeListEntry* Prev( SvTreeListEntry* pEntry, sal_uInt16* pDepth=0 ) const { return pModel->Prev(pEntry,pDepth); } - SvTreeListEntry* Last() const { return pModel->Last(); } + sal_uLong GetEntryCount() const + { + return pModel->GetEntryCount(); + } + SvTreeListEntry* First() const + { + return pModel->First(); + } + SvTreeListEntry* Next( SvTreeListEntry* pEntry, sal_uInt16* pDepth = 0 ) const + { + return pModel->Next(pEntry, pDepth); + } + SvTreeListEntry* Prev( SvTreeListEntry* pEntry, sal_uInt16* pDepth = 0 ) const + { + return pModel->Prev(pEntry, pDepth); + } + SvTreeListEntry* Last() const + { + return pModel->Last(); + } - SvTreeListEntry* FirstChild( SvTreeListEntry* pParent ) const; - SvTreeListEntry* NextSibling( SvTreeListEntry* pEntry ) const; - SvTreeListEntry* PrevSibling( SvTreeListEntry* pEntry ) const; + SvTreeListEntry* FirstChild( SvTreeListEntry* pParent ) const; + SvTreeListEntry* NextSibling( SvTreeListEntry* pEntry ) const; + SvTreeListEntry* PrevSibling( SvTreeListEntry* pEntry ) const; bool CopySelection( SvTreeListBox* pSource, SvTreeListEntry* pTarget ); bool MoveSelection( SvTreeListBox* pSource, SvTreeListEntry* pTarget ); diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index bc58e2d42792..1e31187cfd1b 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -961,8 +961,6 @@ void SvTreeListBox::InitViewData( SvViewDataEntry* pData, SvTreeListEntry* pEntr } } - - void SvTreeListBox::EnableSelectionAsDropTarget( bool bEnable, bool bWithChildren ) { sal_uInt16 nRefDepth; @@ -2566,13 +2564,11 @@ void SvTreeListBox::Paint( const Rectangle& rRect ) if( HasFocus() ) { long tempHeight = GetTextHeight(); - Rectangle tempRect( - Point(0,0),Size(GetSizePixel().Width(),tempHeight) - ); + Rectangle tempRect(Point(0, 0), Size(GetSizePixel().Width(), tempHeight)); ShowFocus(tempRect); } - - else{ + else + { HideFocus(); } } |