summaryrefslogtreecommitdiff
path: root/svtools/source
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-11-29 17:58:01 -0500
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-11-29 19:13:18 -0500
commitd99a7f66f42fb007ed625222812247a1f4650ffe (patch)
treefc2244a48524d8dab0f4a467f1f156fec594577a /svtools/source
parent74a16a90ff3befd7fc336cf203a9b797df9fc5b6 (diff)
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/source')
-rw-r--r--svtools/source/contnr/svlbitm.cxx17
-rw-r--r--svtools/source/contnr/treelistbox.cxx8
-rw-r--r--svtools/source/uno/treecontrolpeer.cxx6
3 files changed, 17 insertions, 14 deletions
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 );