svtools/inc/svtools/svlbitm.hxx | 7 ++++--- svtools/inc/svtools/treelistbox.hxx | 5 +---- svtools/inc/svtools/viewdataentry.hxx | 8 +------- svtools/source/contnr/svlbitm.cxx | 17 +++++++++-------- svtools/source/contnr/treelist.cxx | 12 ++++++------ svtools/source/contnr/treelistbox.cxx | 8 +++++--- svtools/source/contnr/viewdataentry.cxx | 15 +++++++++++++++ svtools/source/uno/treecontrolpeer.cxx | 6 +++--- svx/source/dialog/ctredlin.cxx | 3 +-- svx/source/dialog/fontlb.cxx | 2 +- svx/workben/msview/msview.cxx | 4 ++-- 11 files changed, 48 insertions(+), 39 deletions(-)
New commits: commit 469a202f5c387b71f698bf09ce0daefbcfd65dd3 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Thu Nov 29 19:02:37 2012 -0500 Get it to build. Change-Id: Ie239d3d0f8f4ec81a4c5dbed3a1a132117875c7c diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx index 54d4307..dec1a03 100644 --- a/svx/source/dialog/ctredlin.cxx +++ b/svx/source/dialog/ctredlin.cxx @@ -445,8 +445,7 @@ void SvxRedlinTable::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr, pEntry->AddItem( pButton ); } - pContextBmp= new SvLBoxContextBmp( pEntry,0, rColl,rExp, - SVLISTENTRYFLAG_EXPANDED); + pContextBmp= new SvLBoxContextBmp(pEntry,0, rColl,rExp, true); pEntry->AddItem( pContextBmp ); pString = new SvLBoxColorString( pEntry, 0, rStr ,aEntryColor); diff --git a/svx/source/dialog/fontlb.cxx b/svx/source/dialog/fontlb.cxx index e3247de..199a289 100644 --- a/svx/source/dialog/fontlb.cxx +++ b/svx/source/dialog/fontlb.cxx @@ -140,7 +140,7 @@ void SvxFontListBox::InitEntry( if( nTreeFlags & TREEFLAG_CHKBTN ) pEntry->AddItem( new SvLBoxButton( pEntry, eButtonKind, 0, pCheckButtonData ) ); - pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, rCollImg, rExpImg, SVLISTENTRYFLAG_EXPANDED ) ); + pEntry->AddItem( new SvLBoxContextBmp(pEntry, 0, rCollImg, rExpImg, true) ); pEntry->AddItem( new SvLBoxFontString( pEntry, 0, rEntryText, maEntryFont, mpEntryColor ) ); } else diff --git a/svx/workben/msview/msview.cxx b/svx/workben/msview/msview.cxx index 9760d2a..bb0ce74 100644 --- a/svx/workben/msview/msview.cxx +++ b/svx/workben/msview/msview.cxx @@ -586,8 +586,8 @@ void AtomContainerTreeListBox::SetTabs() void AtomContainerTreeListBox::InitEntry(SvTreeListEntry* pEntry, const OUString& aStr, const Image& aCollEntryBmp, const Image& aExpEntryBmp) { - pEntry->AddItem( new SvLBoxContextBmp( pEntry,0, aCollEntryBmp,aExpEntryBmp, SVLISTENTRYFLAG_EXPANDED ) ); - pEntry->AddItem( new SvLBoxContextBmp( pEntry,0, maImgAtom, maImgAtom, SVLISTENTRYFLAG_EXPANDED ) ); + pEntry->AddItem( new SvLBoxContextBmp(pEntry,0, aCollEntryBmp,aExpEntryBmp, true) ); + pEntry->AddItem( new SvLBoxContextBmp(pEntry,0, maImgAtom, maImgAtom, true) ); pEntry->AddItem( new AtomBoxString( pEntry, aStr ) ); } commit 5388cd54ac145fb42ef81b5b166520958c21da52 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Thu Nov 29 18:01:00 2012 -0500 Now we can officially hide these flag values. Change-Id: Ia203700da59e6962112889404f12041ea8648e19 diff --git a/svtools/inc/svtools/viewdataentry.hxx b/svtools/inc/svtools/viewdataentry.hxx index 8f1c21f..65a3db9 100644 --- a/svtools/inc/svtools/viewdataentry.hxx +++ b/svtools/inc/svtools/viewdataentry.hxx @@ -26,13 +26,6 @@ #include <vector> -// Entryflags that are attached to the View -#define SVLISTENTRYFLAG_SELECTED 0x0001 -#define SVLISTENTRYFLAG_EXPANDED 0x0002 -#define SVLISTENTRYFLAG_FOCUSED 0x0004 -#define SVLISTENTRYFLAG_CURSORED 0x0008 -#define SVLISTENTRYFLAG_NOT_SELECTABLE 0x0010 - struct SvViewDataItem { Size maSize; diff --git a/svtools/source/contnr/viewdataentry.cxx b/svtools/source/contnr/viewdataentry.cxx index 99aeaa4..1d3bfaf 100644 --- a/svtools/source/contnr/viewdataentry.cxx +++ b/svtools/source/contnr/viewdataentry.cxx @@ -21,6 +21,13 @@ #include "tools/debug.hxx" +// Entryflags that are attached to the View +#define SVLISTENTRYFLAG_SELECTED 0x0001 +#define SVLISTENTRYFLAG_EXPANDED 0x0002 +#define SVLISTENTRYFLAG_FOCUSED 0x0004 +#define SVLISTENTRYFLAG_CURSORED 0x0008 +#define SVLISTENTRYFLAG_NOT_SELECTABLE 0x0010 + DBG_NAME(SvViewDataEntry); SvViewDataEntry::SvViewDataEntry() : commit d99a7f66f42fb007ed625222812247a1f4650ffe Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Thu Nov 29 17:58:01 2012 -0500 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 diff --git a/svtools/inc/svtools/svlbitm.hxx b/svtools/inc/svtools/svlbitm.hxx index c65d87e..21a7fc3 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 26476f4..3aa8769 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 31ba9fe..e0f4b25 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 c1d80f1..802ec45 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 15cdf99..f15a223 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 ); commit 74a16a90ff3befd7fc336cf203a9b797df9fc5b6 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Thu Nov 29 17:44:52 2012 -0500 Avoid direct use of flag value. Change-Id: I4279c352a990b2ffda482e9c69b63b18b3c13dc9 diff --git a/svtools/inc/svtools/viewdataentry.hxx b/svtools/inc/svtools/viewdataentry.hxx index 7f49f63..8f1c21f 100644 --- a/svtools/inc/svtools/viewdataentry.hxx +++ b/svtools/inc/svtools/viewdataentry.hxx @@ -65,6 +65,7 @@ public: void SetFocus( bool bFocus ); void SetCursored( bool bCursored ); void SetSelected( bool bSelected ); + void SetExpanded( bool bExpanded ); sal_uInt16 GetFlags() const; void SetSelectable( bool bSelectable ); diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx index 9d4b6f9..70b410c 100644 --- a/svtools/source/contnr/treelist.cxx +++ b/svtools/source/contnr/treelist.cxx @@ -940,7 +940,7 @@ void SvTreeList::Expand( SvListView* pView, SvTreeListEntry* pEntry ) DBG_ASSERT(!pEntry->maChildren.empty(), "SvTreeList::Expand: We expected to have child entries."); SvViewDataEntry* pViewData = pView->GetViewData(pEntry); - pViewData->nFlags |= SVLISTENTRYFLAG_EXPANDED; + pViewData->SetExpanded(true); SvTreeListEntry* pParent = pEntry->pParent; // if parent is visible, invalidate status data if ( pView->IsExpanded( pParent ) ) @@ -959,7 +959,7 @@ void SvTreeList::Collapse( SvListView* pView, SvTreeListEntry* pEntry ) DBG_ASSERT(!pEntry->maChildren.empty(), "SvTreeList::Collapse: We expected have child entries."); SvViewDataEntry* pViewData = pView->GetViewData( pEntry ); - pViewData->nFlags &=(~SVLISTENTRYFLAG_EXPANDED); + pViewData->SetExpanded(false); SvTreeListEntry* pParent = pEntry->pParent; if ( pView->IsExpanded(pParent) ) @@ -1198,7 +1198,7 @@ void SvListView::InitTable() // insert root entry pEntry = pModel->pRootItem; pViewData = new SvViewDataEntry; - pViewData->nFlags = SVLISTENTRYFLAG_EXPANDED; + pViewData->SetExpanded(true); maDataTable.insert( pEntry, pViewData ); // now all the other entries pEntry = pModel->First(); @@ -1229,7 +1229,7 @@ void SvListView::Clear() // insert root entry SvTreeListEntry* pEntry = pModel->pRootItem; SvViewDataEntry* pViewData = new SvViewDataEntry; - pViewData->nFlags = SVLISTENTRYFLAG_EXPANDED; + pViewData->SetExpanded(true); maDataTable.insert( pEntry, pViewData ); } } @@ -1304,7 +1304,7 @@ void SvListView::ActionMoving( SvTreeListEntry* pEntry,SvTreeListEntry*,sal_uLon if (pParent != pModel->pRootItem && pParent->maChildren.size() == 1) { SvViewDataEntry* pViewData = maDataTable.find( pParent )->second; - pViewData->nFlags &= (~SVLISTENTRYFLAG_EXPANDED); + pViewData->SetExpanded(false); } // vorlaeufig nVisibleCount = 0; @@ -1408,7 +1408,7 @@ void SvListView::ActionRemoving( SvTreeListEntry* pEntry ) if (pCurEntry && pCurEntry != pModel->pRootItem && pCurEntry->maChildren.size() == 1) { pViewData = maDataTable.find(pCurEntry)->second; - pViewData->nFlags &= (~SVLISTENTRYFLAG_EXPANDED); + pViewData->SetExpanded(false); } } diff --git a/svtools/source/contnr/viewdataentry.cxx b/svtools/source/contnr/viewdataentry.cxx index 9c3d2d3..99aeaa4 100644 --- a/svtools/source/contnr/viewdataentry.cxx +++ b/svtools/source/contnr/viewdataentry.cxx @@ -94,6 +94,14 @@ void SvViewDataEntry::SetSelected( bool bSelected ) nFlags |= SVLISTENTRYFLAG_SELECTED; } +void SvViewDataEntry::SetExpanded( bool bExpanded ) +{ + if ( !bExpanded ) + nFlags &= (~SVLISTENTRYFLAG_EXPANDED); + else + nFlags |= SVLISTENTRYFLAG_EXPANDED; +} + sal_uInt16 SvViewDataEntry::GetFlags() const { return nFlags; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits