diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-11-29 17:58:01 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-11-29 19:13:18 -0500 |
commit | d99a7f66f42fb007ed625222812247a1f4650ffe (patch) | |
tree | fc2244a48524d8dab0f4a467f1f156fec594577a /svtools | |
parent | Avoid direct use of flag value. (diff) | |
download | core-d99a7f66f42fb007ed625222812247a1f4650ffe.tar.gz core-d99a7f66f42fb007ed625222812247a1f4650ffe.zip |
More on removing direct access to tree entry's view flags.
It turns out that this flag value was used only to check for expanded/
collapsed status, in which case, substituting it with one boolean should
suffice.
Change-Id: I2071ec83613d2206643db8681bebcfab7d1213a3
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/svtools/svlbitm.hxx | 7 | ||||
-rw-r--r-- | svtools/inc/svtools/treelistbox.hxx | 5 | ||||
-rw-r--r-- | svtools/source/contnr/svlbitm.cxx | 17 | ||||
-rw-r--r-- | svtools/source/contnr/treelistbox.cxx | 8 | ||||
-rw-r--r-- | svtools/source/uno/treecontrolpeer.cxx | 6 |
5 files changed, 22 insertions, 21 deletions
diff --git a/svtools/inc/svtools/svlbitm.hxx b/svtools/inc/svtools/svlbitm.hxx index c65d87ebd7b1..21a7fc3b5449 100644 --- a/svtools/inc/svtools/svlbitm.hxx +++ b/svtools/inc/svtools/svlbitm.hxx @@ -221,9 +221,10 @@ class SVT_DLLPUBLIC SvLBoxContextBmp : public SvLBoxItem { SvLBoxContextBmp_Impl* m_pImpl; public: - SvLBoxContextBmp( SvTreeListEntry*,sal_uInt16 nFlags,Image,Image, - sal_uInt16 nEntryFlagsBmp1); - SvLBoxContextBmp(); + SvLBoxContextBmp( + SvTreeListEntry* pEntry, sal_uInt16 nItemFlags, Image aBmp1, Image aBmp2, bool bExpanded); + SvLBoxContextBmp(); + virtual ~SvLBoxContextBmp(); virtual sal_uInt16 GetType() const; virtual void InitViewData( SvTreeListBox*,SvTreeListEntry*,SvViewDataItem* ); diff --git a/svtools/inc/svtools/treelistbox.hxx b/svtools/inc/svtools/treelistbox.hxx index 26476f4a0741..3aa876918500 100644 --- a/svtools/inc/svtools/treelistbox.hxx +++ b/svtools/inc/svtools/treelistbox.hxx @@ -234,9 +234,8 @@ class SVT_DLLPUBLIC SvTreeListBox short nFocusWidth; sal_uInt16 nFirstSelTab; sal_uInt16 nLastSelTab; - sal_uInt16 aContextBmpMode; - long mnCheckboxItemWidth; + bool mbContextBmpExpanded; SvTreeListEntry* pHdlEntry; SvLBoxItem* pHdlItem; @@ -638,8 +637,6 @@ public: void SetCheckButtonState( SvTreeListEntry*, SvButtonState ); SvButtonState GetCheckButtonState( SvTreeListEntry* ) const; - sal_Bool IsExpandBitmapOnCursor() const { return (sal_Bool)(aContextBmpMode & SVLISTENTRYFLAG_FOCUSED)!=0; } - void SetEntryText(SvTreeListEntry*, const XubString& ); void SetExpandedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage ); void SetCollapsedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage ); diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx index 31ba9fe4a043..e0f4b25f69ef 100644 --- a/svtools/source/contnr/svlbitm.cxx +++ b/svtools/source/contnr/svlbitm.cxx @@ -467,20 +467,21 @@ struct SvLBoxContextBmp_Impl Image m_aImage1; Image m_aImage2; - sal_uInt16 m_nB2IndicatorFlags; + bool m_bExpanded; }; // *************************************************************** DBG_NAME(SvLBoxContextBmp) -SvLBoxContextBmp::SvLBoxContextBmp( SvTreeListEntry* pEntry, sal_uInt16 nItemFlags, - Image aBmp1, Image aBmp2, sal_uInt16 nEntryFlags ) +SvLBoxContextBmp::SvLBoxContextBmp( + SvTreeListEntry* pEntry, sal_uInt16 nItemFlags, Image aBmp1, Image aBmp2, + bool bExpanded) :SvLBoxItem( pEntry, nItemFlags ) ,m_pImpl( new SvLBoxContextBmp_Impl ) { DBG_CTOR(SvLBoxContextBmp,0); - m_pImpl->m_nB2IndicatorFlags = nEntryFlags; + m_pImpl->m_bExpanded = bExpanded; SetModeImages( aBmp1, aBmp2 ); } @@ -488,7 +489,7 @@ SvLBoxContextBmp::SvLBoxContextBmp() :SvLBoxItem( ) ,m_pImpl( new SvLBoxContextBmp_Impl ) { - m_pImpl->m_nB2IndicatorFlags = 0; + m_pImpl->m_bExpanded = false; DBG_CTOR(SvLBoxContextBmp,0); } @@ -537,8 +538,8 @@ void SvLBoxContextBmp::Paint( { DBG_CHKTHIS(SvLBoxContextBmp,0); - // get the image (TODO: Avoid directly referencing the flags). - const Image& rImage = implGetImageStore( 0 == (pView->GetFlags() & m_pImpl->m_nB2IndicatorFlags ) ); + // get the image. + const Image& rImage = implGetImageStore(pView->IsExpanded() != m_pImpl->m_bExpanded); sal_Bool _bSemiTransparent = pEntry && ( 0 != ( SV_ENTRYFLAG_SEMITRANSPARENT & pEntry->GetFlags( ) ) ); // draw @@ -559,7 +560,7 @@ void SvLBoxContextBmp::Clone( SvLBoxItem* pSource ) DBG_CHKTHIS(SvLBoxContextBmp,0); m_pImpl->m_aImage1 = static_cast< SvLBoxContextBmp* >( pSource )->m_pImpl->m_aImage1; m_pImpl->m_aImage2 = static_cast< SvLBoxContextBmp* >( pSource )->m_pImpl->m_aImage2; - m_pImpl->m_nB2IndicatorFlags = static_cast< SvLBoxContextBmp* >( pSource )->m_pImpl->m_nB2IndicatorFlags; + m_pImpl->m_bExpanded = static_cast<SvLBoxContextBmp*>(pSource)->m_pImpl->m_bExpanded; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index c1d80f1f94a3..802ec45b928a 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -393,6 +393,7 @@ SvTreeListBox::SvTreeListBox(Window* pParent, WinBits nWinStyle) : DropTargetHelper(this), DragSourceHelper(this), mpImpl(new SvTreeListBoxImpl(*this)), + mbContextBmpExpanded(false), eSelMode(NO_SELECTION) { DBG_CTOR(SvTreeListBox,0); @@ -421,6 +422,7 @@ SvTreeListBox::SvTreeListBox(Window* pParent, const ResId& rResId) : DropTargetHelper(this), DragSourceHelper(this), mpImpl(new SvTreeListBoxImpl(*this)), + mbContextBmpExpanded(false), eSelMode(NO_SELECTION) { DBG_CTOR(SvTreeListBox,0); @@ -1499,7 +1501,7 @@ void SvTreeListBox::InitTreeView() nEntryHeightOffs = SV_ENTRYHEIGHTOFFS_PIXEL; pImp = new SvImpLBox( this, GetModel(), GetStyle() ); - aContextBmpMode = SVLISTENTRYFLAG_EXPANDED; + mbContextBmpExpanded = true; nContextBmpWidthMax = 0; SetFont( GetFont() ); SetSpaceBetweenEntries( 0 ); @@ -1744,8 +1746,8 @@ void SvTreeListBox::InitEntry(SvTreeListEntry* pEntry, pEntry->AddItem( pButton ); } - pContextBmp= new SvLBoxContextBmp( pEntry,0, aCollEntryBmp,aExpEntryBmp, - aContextBmpMode ); + pContextBmp= new SvLBoxContextBmp( + pEntry,0, aCollEntryBmp,aExpEntryBmp, mbContextBmpExpanded); pEntry->AddItem( pContextBmp ); pString = new SvLBoxString( pEntry, 0, aStr ); diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index 15cdf99f56f6..f15a223f78c6 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -72,8 +72,8 @@ public: class ImplContextGraphicItem : public SvLBoxContextBmp { public: - ImplContextGraphicItem( SvTreeListEntry* pEntry,sal_uInt16 nFlags,Image& rI1,Image& rI2, sal_uInt16 nEntryFlagsBmp1) - : SvLBoxContextBmp( pEntry, nFlags, rI1, rI2, nEntryFlagsBmp1 ) {} + ImplContextGraphicItem( SvTreeListEntry* pEntry,sal_uInt16 nFlags,Image& rI1,Image& rI2, bool bExpanded) + : SvLBoxContextBmp(pEntry, nFlags, rI1, rI2, bExpanded) {} OUString msExpandedGraphicURL; OUString msCollapsedGraphicURL; @@ -236,7 +236,7 @@ UnoTreeListEntry* TreeControlPeer::createEntry( const Reference< XTreeNode >& xN { Image aImage; pEntry = new UnoTreeListEntry( xNode, this ); - ImplContextGraphicItem* pContextBmp= new ImplContextGraphicItem( pEntry,0, aImage, aImage, SVLISTENTRYFLAG_EXPANDED ); + ImplContextGraphicItem* pContextBmp= new ImplContextGraphicItem(pEntry, 0, aImage, aImage, true); pEntry->AddItem( pContextBmp ); |