diff options
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 8 | ||||
-rw-r--r-- | dbaccess/source/ui/control/dbtreelistbox.cxx | 2 | ||||
-rw-r--r-- | include/svtools/treelistentry.hxx | 32 | ||||
-rw-r--r-- | sd/source/ui/dlg/sdtreelb.cxx | 2 | ||||
-rw-r--r-- | svtools/source/contnr/svimpbox.cxx | 2 | ||||
-rw-r--r-- | svtools/source/contnr/svlbitm.cxx | 2 | ||||
-rw-r--r-- | svtools/source/contnr/treelistbox.cxx | 28 | ||||
-rw-r--r-- | svtools/source/contnr/treelistentry.cxx | 12 | ||||
-rw-r--r-- | svx/source/form/navigatortree.cxx | 4 |
9 files changed, 49 insertions, 43 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 117a4f47ee64..46796215108f 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -2415,14 +2415,12 @@ void implEnableChildren( SvTreeListEntry* pEntry, bool bEnable ) if( bEnable ) { pEntry->SetFlags( - (pEntry->GetFlags() & - ~(SV_ENTRYFLAG_NO_NODEBMP | SV_ENTRYFLAG_HAD_CHILDREN)) - | SV_ENTRYFLAG_CHILDREN_ON_DEMAND ); + (pEntry->GetFlags() & ~SvTLEntryFlags(SvTLEntryFlags::NO_NODEBMP | SvTLEntryFlags::HAD_CHILDREN)) + | SvTLEntryFlags::CHILDREN_ON_DEMAND ); } else { - pEntry->SetFlags( - (pEntry->GetFlags() & ~(SV_ENTRYFLAG_CHILDREN_ON_DEMAND)) ); + pEntry->SetFlags( pEntry->GetFlags() & ~SvTLEntryFlags::CHILDREN_ON_DEMAND ); } } diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx index e0cb02c94b2a..2d4e0cea22aa 100644 --- a/dbaccess/source/ui/control/dbtreelistbox.cxx +++ b/dbaccess/source/ui/control/dbtreelistbox.cxx @@ -178,7 +178,7 @@ void DBTreeListBox::MouseButtonDown( const MouseEvent& rMEvt ) IMPL_LINK(DBTreeListBox, OnResetEntry, SvTreeListEntry*, pEntry) { // set the flag which allows if the entry can be expanded - pEntry->SetFlags( (pEntry->GetFlags() & ~(SV_ENTRYFLAG_NO_NODEBMP | SV_ENTRYFLAG_HAD_CHILDREN)) | SV_ENTRYFLAG_CHILDREN_ON_DEMAND ); + pEntry->SetFlags( (pEntry->GetFlags() & ~SvTLEntryFlags(SvTLEntryFlags::NO_NODEBMP | SvTLEntryFlags::HAD_CHILDREN)) | SvTLEntryFlags::CHILDREN_ON_DEMAND ); // redraw the entry GetModel()->InvalidateEntry( pEntry ); return 0L; diff --git a/include/svtools/treelistentry.hxx b/include/svtools/treelistentry.hxx index f7e633f9bfc9..11478173bbce 100644 --- a/include/svtools/treelistentry.hxx +++ b/include/svtools/treelistentry.hxx @@ -24,19 +24,27 @@ #include <tools/solar.h> #include <svtools/treelistbox.hxx> #include <svtools/treelistentries.hxx> +#include <o3tl/typed_flags_set.hxx> #include <boost/ptr_container/ptr_vector.hpp> // flags related to the model -#define SV_ENTRYFLAG_CHILDREN_ON_DEMAND 0x0001 -#define SV_ENTRYFLAG_DISABLE_DROP 0x0002 -#define SV_ENTRYFLAG_IN_USE 0x0004 -// is set if RequestingChildren has not set any children -#define SV_ENTRYFLAG_NO_NODEBMP 0x0008 -// entry had or has children -#define SV_ENTRYFLAG_HAD_CHILDREN 0x0010 - -#define SV_ENTRYFLAG_SEMITRANSPARENT 0x8000 // draw semi-transparent entry bitmaps +enum class SvTLEntryFlags +{ + NONE = 0x0000, + CHILDREN_ON_DEMAND = 0x0001, + DISABLE_DROP = 0x0002, + IN_USE = 0x0004, + // is set if RequestingChildren has not set any children + NO_NODEBMP = 0x0008, + // entry had or has children + HAD_CHILDREN = 0x0010, + SEMITRANSPARENT = 0x8000, // draw semi-transparent entry bitmaps +}; +namespace o3tl +{ + template<> struct typed_flags<SvTLEntryFlags> : is_typed_flags<SvTLEntryFlags, 0x801f> {}; +} class SVT_DLLPUBLIC SvTreeListEntry @@ -54,7 +62,7 @@ class SVT_DLLPUBLIC SvTreeListEntry ItemsType maItems; bool bIsMarked; void* pUserData; - sal_uInt16 nEntryFlags; + SvTLEntryFlags nEntryFlags; Color maBackColor; private: @@ -96,8 +104,8 @@ public: bool HasChildrenOnDemand() const; bool HasInUseEmphasis() const; - sal_uInt16 GetFlags() const { return nEntryFlags;} - void SetFlags( sal_uInt16 nFlags ); + SvTLEntryFlags GetFlags() const { return nEntryFlags;} + void SetFlags( SvTLEntryFlags nFlags ); bool GetIsMarked() const { return bIsMarked; } void SetMarked( bool IsMarked ) { bIsMarked = IsMarked; } diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 1e43cc07e6bd..0a96dd736de3 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -1492,7 +1492,7 @@ bool SdPageObjsTLB::IsDropAllowed (SvTreeListEntry* pEntry) if ( ! IsDropFormatSupported(SdPageObjsTransferable::GetListBoxDropFormatId())) return false; - if ((pEntry->GetFlags() & SV_ENTRYFLAG_DISABLE_DROP) != 0) + if (pEntry->GetFlags() & SvTLEntryFlags::DISABLE_DROP) return false; return true; diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index 19789560e797..f1aa6facf8a6 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -1673,7 +1673,7 @@ void SvImpLBox::RemovingEntry( SvTreeListEntry* pEntry ) if (pParent && pView->GetModel()->GetChildList(pParent).size() == 1) { DBG_ASSERT( pView->IsExpanded( pParent ), "Parent not expanded"); - pParent->SetFlags( pParent->GetFlags() | SV_ENTRYFLAG_NO_NODEBMP); + pParent->SetFlags( pParent->GetFlags() | SvTLEntryFlags::NO_NODEBMP); InvalidateEntry( pParent ); } diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx index 5da446e15e1e..9aa97f00ed79 100644 --- a/svtools/source/contnr/svlbitm.cxx +++ b/svtools/source/contnr/svlbitm.cxx @@ -515,7 +515,7 @@ void SvLBoxContextBmp::Paint( // get the image. const Image& rImage = implGetImageStore(pView->IsExpanded() != m_pImpl->m_bExpanded); - bool _bSemiTransparent = pEntry && ( 0 != ( SV_ENTRYFLAG_SEMITRANSPARENT & pEntry->GetFlags( ) ) ); + bool _bSemiTransparent = pEntry && bool( SvTLEntryFlags::SEMITRANSPARENT & pEntry->GetFlags( ) ); // draw sal_uInt16 nStyle = _rDev.IsEnabled() ? 0 : IMAGE_DRAW_DISABLE; if ( _bSemiTransparent ) diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index 8a8b8799f153..3f7ab3f7fa00 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -971,28 +971,28 @@ void SvTreeListBox::EnableSelectionAsDropTarget( bool bEnable, bool bWithChildre { if ( !bEnable ) { - pSelEntry->nEntryFlags |= SV_ENTRYFLAG_DISABLE_DROP; + pSelEntry->nEntryFlags |= SvTLEntryFlags::DISABLE_DROP; if ( bWithChildren ) { nRefDepth = pModel->GetDepth( pSelEntry ); pTemp = Next( pSelEntry ); while( pTemp && pModel->GetDepth( pTemp ) > nRefDepth ) { - pTemp->nEntryFlags |= SV_ENTRYFLAG_DISABLE_DROP; + pTemp->nEntryFlags |= SvTLEntryFlags::DISABLE_DROP; pTemp = Next( pTemp ); } } } else { - pSelEntry->nEntryFlags &= (~SV_ENTRYFLAG_DISABLE_DROP); + pSelEntry->nEntryFlags &= (~SvTLEntryFlags::DISABLE_DROP); if ( bWithChildren ) { nRefDepth = pModel->GetDepth( pSelEntry ); pTemp = Next( pSelEntry ); while( pTemp && pModel->GetDepth( pTemp ) > nRefDepth ) { - pTemp->nEntryFlags &= (~SV_ENTRYFLAG_DISABLE_DROP); + pTemp->nEntryFlags &= (~SvTLEntryFlags::DISABLE_DROP); pTemp = Next( pTemp ); } } @@ -1213,7 +1213,7 @@ sal_Int8 SvTreeListBox::AcceptDrop( const AcceptDropEvent& rEvt ) DBG_ASSERT( pDDSource, "SvTreeListBox::QueryDrop(): SourceBox == 0" ); if( !( pEntry && pDDSource->GetModel() == this->GetModel() && DND_ACTION_MOVE == rEvt.mnAction - && ( pEntry->nEntryFlags & SV_ENTRYFLAG_DISABLE_DROP ) )) + && ( pEntry->nEntryFlags & SvTLEntryFlags::DISABLE_DROP ) )) { if( NotifyAcceptDrop( pEntry )) nRet = rEvt.mnAction; @@ -1918,8 +1918,8 @@ void SvTreeListBox::ImpEntryInserted( SvTreeListEntry* pEntry ) SvTreeListEntry* pParent = (SvTreeListEntry*)pModel->GetParent( pEntry ); if( pParent ) { - sal_uInt16 nFlags = pParent->GetFlags(); - nFlags &= ~SV_ENTRYFLAG_NO_NODEBMP; + SvTLEntryFlags nFlags = pParent->GetFlags(); + nFlags &= ~SvTLEntryFlags::NO_NODEBMP; pParent->SetFlags( nFlags ); } @@ -2359,7 +2359,7 @@ bool SvTreeListBox::Expand( SvTreeListEntry* pParent ) { pHdlEntry = pParent; bool bExpanded = false; - sal_uInt16 nFlags; + SvTLEntryFlags nFlags; if( pParent->HasChildrenOnDemand() ) RequestingChildren( pParent ); @@ -2375,14 +2375,14 @@ bool SvTreeListBox::Expand( SvTreeListEntry* pParent ) ExpandedHdl(); } nFlags = pParent->GetFlags(); - nFlags &= ~SV_ENTRYFLAG_NO_NODEBMP; - nFlags |= SV_ENTRYFLAG_HAD_CHILDREN; + nFlags &= ~SvTLEntryFlags::NO_NODEBMP; + nFlags |= SvTLEntryFlags::HAD_CHILDREN; pParent->SetFlags( nFlags ); } else { nFlags = pParent->GetFlags(); - nFlags |= SV_ENTRYFLAG_NO_NODEBMP; + nFlags |= SvTLEntryFlags::NO_NODEBMP; pParent->SetFlags( nFlags ); GetModel()->InvalidateEntry( pParent ); // repaint } @@ -3089,7 +3089,7 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, SvLBoxTabFl nDynTabPos += 4; // 4 pixels of buffer, so the node bitmap is not too close // to the next tab - if( (!(pEntry->GetFlags() & SV_ENTRYFLAG_NO_NODEBMP)) && + if( (!(pEntry->GetFlags() & SvTLEntryFlags::NO_NODEBMP)) && (nWindowStyle & WB_HASBUTTONS) && pFirstDynamicTab && ( pEntry->HasChildren() || pEntry->HasChildrenOnDemand() ) ) { @@ -3116,7 +3116,7 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, SvLBoxTabFl else { if( (!pEntry->HasChildren()) && pEntry->HasChildrenOnDemand() && - (!(pEntry->GetFlags() & SV_ENTRYFLAG_HAD_CHILDREN)) && + (!(pEntry->GetFlags() & SvTLEntryFlags::HAD_CHILDREN)) && pImp->GetDontKnowNodeBmp().GetSizePixel().Width() ) pImg = &pImp->GetDontKnowNodeBmp( ); else @@ -3144,7 +3144,7 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, SvLBoxTabFl { if( (!pEntry->HasChildren() ) && pEntry->HasChildrenOnDemand() && - (!(pEntry->GetFlags() & SV_ENTRYFLAG_HAD_CHILDREN)) && + (!(pEntry->GetFlags() & SvTLEntryFlags::HAD_CHILDREN)) && pImp->GetDontKnowNodeBmp().GetSizePixel().Width() ) aControlValue.setTristateVal( BUTTONVALUE_DONTKNOW ); //dont know diff --git a/svtools/source/contnr/treelistentry.cxx b/svtools/source/contnr/treelistentry.cxx index c56d4d95d2de..3b33cf788068 100644 --- a/svtools/source/contnr/treelistentry.cxx +++ b/svtools/source/contnr/treelistentry.cxx @@ -56,7 +56,7 @@ SvTreeListEntry::SvTreeListEntry() , nListPos(0) , bIsMarked(false) , pUserData(NULL) - , nEntryFlags(0) + , nEntryFlags(SvTLEntryFlags::NONE) , maBackColor(Application::GetSettings().GetStyleSettings().GetWindowColor()) { } @@ -139,9 +139,9 @@ void SvTreeListEntry::AddItem( SvLBoxItem* pItem ) void SvTreeListEntry::EnableChildrenOnDemand( bool bEnable ) { if ( bEnable ) - nEntryFlags |= SV_ENTRYFLAG_CHILDREN_ON_DEMAND; + nEntryFlags |= SvTLEntryFlags::CHILDREN_ON_DEMAND; else - nEntryFlags &= (~SV_ENTRYFLAG_CHILDREN_ON_DEMAND); + nEntryFlags &= (~SvTLEntryFlags::CHILDREN_ON_DEMAND); } void SvTreeListEntry::ReplaceItem( SvLBoxItem* pNewItem, size_t nPos ) @@ -220,16 +220,16 @@ void SvTreeListEntry::SetUserData( void* pPtr ) bool SvTreeListEntry::HasChildrenOnDemand() const { - return (bool)((nEntryFlags & SV_ENTRYFLAG_CHILDREN_ON_DEMAND)!=0); + return (bool)(nEntryFlags & SvTLEntryFlags::CHILDREN_ON_DEMAND); } bool SvTreeListEntry::HasInUseEmphasis() const { - return (bool)((nEntryFlags & SV_ENTRYFLAG_IN_USE)!=0); + return (bool)(nEntryFlags & SvTLEntryFlags::IN_USE); } -void SvTreeListEntry::SetFlags( sal_uInt16 nFlags ) +void SvTreeListEntry::SetFlags( SvTLEntryFlags nFlags ) { nEntryFlags = nFlags; } diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index e2b9247aa7bd..4b4a7972bf9b 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -1260,7 +1260,7 @@ namespace svxform if ( pEntry ) { m_aCutEntries.insert( pEntry ); - pEntry->SetFlags( pEntry->GetFlags() | SV_ENTRYFLAG_SEMITRANSPARENT ); + pEntry->SetFlags( pEntry->GetFlags() | SvTLEntryFlags::SEMITRANSPARENT ); InvalidateEntry( pEntry ); } } @@ -1564,7 +1564,7 @@ namespace svxform if ( !pEntry ) continue; - pEntry->SetFlags( pEntry->GetFlags() & ~SV_ENTRYFLAG_SEMITRANSPARENT ); + pEntry->SetFlags( pEntry->GetFlags() & ~SvTLEntryFlags::SEMITRANSPARENT ); InvalidateEntry( pEntry ); } ListBoxEntrySet aEmpty; |