diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-10-15 18:30:16 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-10-19 11:45:36 +0200 |
commit | d47508e036fd30f410798f37d25039bb25528f60 (patch) | |
tree | 132fb1a59c3f18b54bdce7f225152266d871b560 /svtools | |
parent | dad00b3cab73575f027406ee0118c74d7fe8645b (diff) |
Move SvListEntry and SvLBoxEntry into own files.
They will be merged later.
Change-Id: I8529f9ee442fce10dc63e44d7cb26bdb2f3b8eb7
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/Library_svt.mk | 1 | ||||
-rw-r--r-- | svtools/Package_inc.mk | 1 | ||||
-rw-r--r-- | svtools/inc/svtools/treelist.hxx | 50 | ||||
-rw-r--r-- | svtools/inc/svtools/treelistbox.hxx | 49 | ||||
-rw-r--r-- | svtools/inc/svtools/treelistentry.hxx | 127 | ||||
-rw-r--r-- | svtools/source/contnr/treelist.cxx | 62 | ||||
-rw-r--r-- | svtools/source/contnr/treelistbox.cxx | 97 | ||||
-rw-r--r-- | svtools/source/contnr/treelistentry.cxx | 196 |
8 files changed, 330 insertions, 253 deletions
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 89d3f184a4f9..ece05ef802bc 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -105,6 +105,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/contnr/templwin \ svtools/source/contnr/treelist \ svtools/source/contnr/treelistbox \ + svtools/source/contnr/treelistentry \ svtools/source/control/asynclink \ svtools/source/control/calendar \ svtools/source/control/collatorres \ diff --git a/svtools/Package_inc.mk b/svtools/Package_inc.mk index c1ed7e1ad6fa..f8b77285b39a 100644 --- a/svtools/Package_inc.mk +++ b/svtools/Package_inc.mk @@ -139,6 +139,7 @@ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/stdmenu.hxx,svtools/st $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/stringtransfer.hxx,svtools/stringtransfer.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/svlbitm.hxx,svtools/svlbitm.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/treelistbox.hxx,svtools/treelistbox.hxx)) +$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/treelistentry.hxx,svtools/treelistentry.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/svmedit.hxx,svtools/svmedit.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/svmedit2.hxx,svtools/svmedit2.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/svparser.hxx,svtools/svparser.hxx)) diff --git a/svtools/inc/svtools/treelist.hxx b/svtools/inc/svtools/treelist.hxx index 2534052a1487..f7d04a95282a 100644 --- a/svtools/inc/svtools/treelist.hxx +++ b/svtools/inc/svtools/treelist.hxx @@ -29,16 +29,17 @@ #ifndef _SVTREELIST_HXX #define _SVTREELIST_HXX -#include <limits.h> #include "svtools/svtdllapi.h" +#include "svtools/treelistentry.hxx" #include <tools/solar.h> -#include <vector> -#include <boost/ptr_container/ptr_map.hpp> - #include <tools/link.hxx> #include <tools/string.hxx> #include <tools/debug.hxx> +#include <limits.h> +#include <vector> +#include <boost/ptr_container/ptr_map.hpp> + #define LISTACTION_INSERTED 1 #define LISTACTION_REMOVING 2 #define LISTACTION_REMOVED 3 @@ -101,47 +102,6 @@ public: SvListEntry* back(); }; -//============================================================================= - -class SVT_DLLPUBLIC SvListEntry -{ -friend class SvTreeList; -friend class SvListView; - -private: - SvListEntry* pParent; - SvTreeEntryList* pChildren; - sal_uLong nAbsPos; - sal_uLong nListPos; - - void SetListPositions(); - void InvalidateChildrensListPositions() - { - nListPos |= 0x80000000; - } - -public: - SvListEntry(); - SvListEntry( const SvListEntry& ); - virtual ~SvListEntry(); - sal_Bool HasChildren() { return (sal_Bool)(pChildren!=0); } - sal_Bool HasChildListPos() const - { - if( pParent && !(pParent->nListPos & 0x80000000) ) - return sal_True; - else return sal_False; - } - - sal_uLong GetChildListPos() const - { - if( pParent && (pParent->nListPos & 0x80000000) ) - pParent->SetListPositions(); - return ( nListPos & 0x7fffffff ); - } - - virtual void Clone( SvListEntry* pSource ); -}; - class SvListView; class SvViewData diff --git a/svtools/inc/svtools/treelistbox.hxx b/svtools/inc/svtools/treelistbox.hxx index a919cd5dded3..bb97ed743965 100644 --- a/svtools/inc/svtools/treelistbox.hxx +++ b/svtools/inc/svtools/treelistbox.hxx @@ -198,55 +198,6 @@ public: virtual void Clone( SvLBoxItem* pSource ) = 0; }; -// Flags, die am Model haengen -#define SV_ENTRYFLAG_CHILDREN_ON_DEMAND 0x0001 -#define SV_ENTRYFLAG_DISABLE_DROP 0x0002 -#define SV_ENTRYFLAG_IN_USE 0x0004 -// wird gesetzt, wenn RequestingChildren keine Children gestzt hat -#define SV_ENTRYFLAG_NO_NODEBMP 0x0008 -// Eintrag hatte oder hat Kinder -#define SV_ENTRYFLAG_HAD_CHILDREN 0x0010 - -#define SV_ENTRYFLAG_USER_FLAGS 0xF000 -#define SV_ENTRYFLAG_SEMITRANSPARENT 0x8000 // draw semi-transparent entry bitmaps - -class SVT_DLLPUBLIC SvLBoxEntry : public SvListEntry -{ - friend class SvTreeListBox; - - std::vector<SvLBoxItem*> aItems; - void* pUserData; - sal_uInt16 nEntryFlags; - SVT_DLLPRIVATE void DeleteItems_Impl(); -public: - - SvLBoxEntry(); - virtual ~SvLBoxEntry(); - - sal_uInt16 ItemCount() const { return (sal_uInt16)aItems.size(); } - // DARF NUR GERUFEN WERDEN, WENN DER EINTRAG NOCH NICHT IM MODEL - // EINGEFUEGT IST, DA SONST FUER DAS ITEM KEINE VIEW-ABHAENGIGEN - // DATEN ALLOZIERT WERDEN! - void AddItem( SvLBoxItem* pItem ); - void ReplaceItem( SvLBoxItem* pNewItem, sal_uInt16 nPos ); - SvLBoxItem* GetItem( sal_uInt16 nPos ) const { return aItems[nPos]; } - SvLBoxItem* GetFirstItem( sal_uInt16 nId ); - sal_uInt16 GetPos( SvLBoxItem* pItem ) const - { - std::vector<SvLBoxItem*>::const_iterator it = std::find( aItems.begin(), aItems.end(), pItem ); - return it == aItems.end() ? USHRT_MAX : it - aItems.begin(); - } - void* GetUserData() const { return pUserData; } - void SetUserData( void* pPtr ) { pUserData = pPtr; } - virtual void Clone( SvListEntry* pSource ); - void EnableChildrenOnDemand( sal_Bool bEnable=sal_True ); - sal_Bool HasChildrenOnDemand() const { return (sal_Bool)((nEntryFlags & SV_ENTRYFLAG_CHILDREN_ON_DEMAND)!=0); } - sal_Bool HasInUseEmphasis() const { return (sal_Bool)((nEntryFlags & SV_ENTRYFLAG_IN_USE)!=0); } - - sal_uInt16 GetFlags() const { return nEntryFlags; } - void SetFlags( sal_uInt16 nFlags ) { nEntryFlags = nFlags; } -}; - class SVT_DLLPUBLIC SvLBoxTreeList : public SvTreeList { public: diff --git a/svtools/inc/svtools/treelistentry.hxx b/svtools/inc/svtools/treelistentry.hxx new file mode 100644 index 000000000000..16876aa811a5 --- /dev/null +++ b/svtools/inc/svtools/treelistentry.hxx @@ -0,0 +1,127 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __SVTOOLS_TREELISTENTRY_HXX__ +#define __SVTOOLS_TREELISTENTRY_HXX__ + +#include "svtdllapi.h" +#include "tools/solar.h" + +#include <vector> + +class SvTreeEntryList; +class SvLBoxItem; + +class SVT_DLLPUBLIC SvListEntry +{ +friend class SvTreeList; +friend class SvListView; + +private: + SvListEntry* pParent; + SvTreeEntryList* pChildren; + sal_uLong nAbsPos; + sal_uLong nListPos; + + void SetListPositions(); + void InvalidateChildrensListPositions() + { + nListPos |= 0x80000000; + } + +public: + SvListEntry(); + SvListEntry( const SvListEntry& ); + virtual ~SvListEntry(); + sal_Bool HasChildren() { return (sal_Bool)(pChildren!=0); } + sal_Bool HasChildListPos() const + { + if( pParent && !(pParent->nListPos & 0x80000000) ) + return sal_True; + else return sal_False; + } + + sal_uLong GetChildListPos() const + { + if( pParent && (pParent->nListPos & 0x80000000) ) + pParent->SetListPositions(); + return ( nListPos & 0x7fffffff ); + } + + virtual void Clone( SvListEntry* pSource ); +}; + + +// Flags, die am Model haengen +#define SV_ENTRYFLAG_CHILDREN_ON_DEMAND 0x0001 +#define SV_ENTRYFLAG_DISABLE_DROP 0x0002 +#define SV_ENTRYFLAG_IN_USE 0x0004 +// wird gesetzt, wenn RequestingChildren keine Children gestzt hat +#define SV_ENTRYFLAG_NO_NODEBMP 0x0008 +// Eintrag hatte oder hat Kinder +#define SV_ENTRYFLAG_HAD_CHILDREN 0x0010 + +#define SV_ENTRYFLAG_USER_FLAGS 0xF000 +#define SV_ENTRYFLAG_SEMITRANSPARENT 0x8000 // draw semi-transparent entry bitmaps + +class SVT_DLLPUBLIC SvLBoxEntry : public SvListEntry +{ + friend class SvTreeListBox; + + std::vector<SvLBoxItem*> aItems; + void* pUserData; + sal_uInt16 nEntryFlags; + SVT_DLLPRIVATE void DeleteItems_Impl(); +public: + + SvLBoxEntry(); + virtual ~SvLBoxEntry(); + + sal_uInt16 ItemCount() const { return (sal_uInt16)aItems.size(); } + // DARF NUR GERUFEN WERDEN, WENN DER EINTRAG NOCH NICHT IM MODEL + // EINGEFUEGT IST, DA SONST FUER DAS ITEM KEINE VIEW-ABHAENGIGEN + // DATEN ALLOZIERT WERDEN! + void AddItem( SvLBoxItem* pItem ); + void ReplaceItem( SvLBoxItem* pNewItem, sal_uInt16 nPos ); + SvLBoxItem* GetItem( sal_uInt16 nPos ) const { return aItems[nPos]; } + SvLBoxItem* GetFirstItem( sal_uInt16 nId ); + sal_uInt16 GetPos( SvLBoxItem* pItem ) const; + void* GetUserData() const { return pUserData; } + void SetUserData( void* pPtr ) { pUserData = pPtr; } + virtual void Clone( SvListEntry* pSource ); + void EnableChildrenOnDemand( sal_Bool bEnable=sal_True ); + sal_Bool HasChildrenOnDemand() const { return (sal_Bool)((nEntryFlags & SV_ENTRYFLAG_CHILDREN_ON_DEMAND)!=0); } + sal_Bool HasInUseEmphasis() const { return (sal_Bool)((nEntryFlags & SV_ENTRYFLAG_IN_USE)!=0); } + + sal_uInt16 GetFlags() const { return nEntryFlags; } + void SetFlags( sal_uInt16 nFlags ) { nEntryFlags = nFlags; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx index 0f930f552ed3..17f56c50a2a9 100644 --- a/svtools/source/contnr/treelist.cxx +++ b/svtools/source/contnr/treelist.cxx @@ -28,9 +28,6 @@ #include <svtools/treelist.hxx> -DBG_NAME(SvListEntry); - - SvTreeEntryList::SvTreeEntryList() {} void SvTreeEntryList::push_back( SvListEntry* pItem ) @@ -158,65 +155,6 @@ SvTreeEntryList::SvTreeEntryList(const SvTreeEntryList& rList) maEntryList.push_back(const_cast<SvListEntry*>(rList[i])); } -SvListEntry::SvListEntry() -{ - DBG_CTOR(SvListEntry,0); - pChildren = 0; - pParent = 0; - nListPos = 0; - nAbsPos = 0; -} - -SvListEntry::SvListEntry( const SvListEntry& rEntry ) -{ - DBG_CTOR(SvListEntry,0); - pChildren = 0; - pParent = 0; - nListPos &= 0x80000000; - nListPos |= ( rEntry.nListPos & 0x7fffffff); - nAbsPos = rEntry.nAbsPos; -} - -SvListEntry::~SvListEntry() -{ - DBG_DTOR(SvListEntry,0); - if ( pChildren ) - { - pChildren->DestroyAll(); - delete pChildren; - } -#ifdef DBG_UTIL - pChildren = 0; - pParent = 0; -#endif -} - -void SvListEntry::Clone( SvListEntry* pSource) -{ - DBG_CHKTHIS(SvListEntry,0); - nListPos &= 0x80000000; - nListPos |= ( pSource->nListPos & 0x7fffffff); - nAbsPos = pSource->nAbsPos; -} - -void SvListEntry::SetListPositions() -{ - if( pChildren ) - { - SvTreeEntryList::iterator it = pChildren->begin(), itEnd = pChildren->end(); - sal_uLong nCur = 0; - for (; it != itEnd; ++it) - { - SvListEntry* pEntry = *it; - pEntry->nListPos &= 0x80000000; - pEntry->nListPos |= nCur; - ++nCur; - } - } - nListPos &= (~0x80000000); -} - - DBG_NAME(SvViewData); SvViewData::SvViewData() diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index 724f6517617e..a16efd6e9e4b 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -385,103 +385,6 @@ SvViewDataItem::~SvViewDataItem() DBG_DTOR(SvViewDataItem,0); } - - -// *************************************************************** -// class SvLBoxEntry -// *************************************************************** - -DBG_NAME(SvLBoxEntry); - -SvLBoxEntry::SvLBoxEntry() : aItems() -{ - DBG_CTOR(SvLBoxEntry,0); - nEntryFlags = 0; - pUserData = 0; -} - -SvLBoxEntry::~SvLBoxEntry() -{ - DBG_DTOR(SvLBoxEntry,0); - DeleteItems_Impl(); -} - -void SvLBoxEntry::DeleteItems_Impl() -{ - DBG_CHKTHIS(SvLBoxEntry,0); - sal_uInt16 nCount = aItems.size(); - while( nCount ) - { - nCount--; - SvLBoxItem* pItem = aItems[ nCount ]; - delete pItem; - } - aItems.clear(); -} - - -void SvLBoxEntry::AddItem( SvLBoxItem* pItem ) -{ - DBG_CHKTHIS(SvLBoxEntry,0); - aItems.push_back( pItem ); -} - -void SvLBoxEntry::Clone( SvListEntry* pSource ) -{ - DBG_CHKTHIS(SvLBoxEntry,0); - SvListEntry::Clone( pSource ); - SvLBoxItem* pNewItem; - DeleteItems_Impl(); - sal_uInt16 nCount = ((SvLBoxEntry*)pSource)->ItemCount(); - sal_uInt16 nCurPos = 0; - while( nCurPos < nCount ) - { - SvLBoxItem* pItem = ((SvLBoxEntry*)pSource)->GetItem( nCurPos ); - pNewItem = pItem->Create(); - pNewItem->Clone( pItem ); - AddItem( pNewItem ); - nCurPos++; - } - pUserData = ((SvLBoxEntry*)pSource)->GetUserData(); - nEntryFlags = ((SvLBoxEntry*)pSource)->nEntryFlags; -} - -void SvLBoxEntry::EnableChildrenOnDemand( sal_Bool bEnable ) -{ - DBG_CHKTHIS(SvLBoxEntry,0); - if ( bEnable ) - nEntryFlags |= SV_ENTRYFLAG_CHILDREN_ON_DEMAND; - else - nEntryFlags &= (~SV_ENTRYFLAG_CHILDREN_ON_DEMAND); -} - -void SvLBoxEntry::ReplaceItem( SvLBoxItem* pNewItem, sal_uInt16 nPos ) -{ - DBG_CHKTHIS(SvLBoxEntry,0); - DBG_ASSERT(pNewItem,"ReplaceItem:No Item"); - SvLBoxItem* pOld = GetItem( nPos ); - if ( pOld ) - { - aItems[ nPos ] = pNewItem; - delete pOld; - } -} - -SvLBoxItem* SvLBoxEntry::GetFirstItem( sal_uInt16 nId ) -{ - sal_uInt16 nCount = aItems.size(); - sal_uInt16 nCur = 0; - SvLBoxItem* pItem; - while( nCur < nCount ) - { - pItem = GetItem( nCur ); - if( pItem->IsA() == nId ) - return pItem; - nCur++; - } - return 0; -} - SvLBoxEntry* SvLBoxTreeList::First() const { return (SvLBoxEntry*)SvTreeList::First(); diff --git a/svtools/source/contnr/treelistentry.cxx b/svtools/source/contnr/treelistentry.cxx new file mode 100644 index 000000000000..cacc12d1980e --- /dev/null +++ b/svtools/source/contnr/treelistentry.cxx @@ -0,0 +1,196 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "svtools/treelistentry.hxx" +#include "svtools/treelist.hxx" +#include "svtools/treelistbox.hxx" + +#include "tools/debug.hxx" + +DBG_NAME(SvListEntry); + +SvListEntry::SvListEntry() +{ + DBG_CTOR(SvListEntry,0); + pChildren = 0; + pParent = 0; + nListPos = 0; + nAbsPos = 0; +} + +SvListEntry::SvListEntry( const SvListEntry& rEntry ) +{ + DBG_CTOR(SvListEntry,0); + pChildren = 0; + pParent = 0; + nListPos &= 0x80000000; + nListPos |= ( rEntry.nListPos & 0x7fffffff); + nAbsPos = rEntry.nAbsPos; +} + +SvListEntry::~SvListEntry() +{ + DBG_DTOR(SvListEntry,0); + if ( pChildren ) + { + pChildren->DestroyAll(); + delete pChildren; + } +#ifdef DBG_UTIL + pChildren = 0; + pParent = 0; +#endif +} + +void SvListEntry::Clone( SvListEntry* pSource) +{ + DBG_CHKTHIS(SvListEntry,0); + nListPos &= 0x80000000; + nListPos |= ( pSource->nListPos & 0x7fffffff); + nAbsPos = pSource->nAbsPos; +} + +void SvListEntry::SetListPositions() +{ + if( pChildren ) + { + SvTreeEntryList::iterator it = pChildren->begin(), itEnd = pChildren->end(); + sal_uLong nCur = 0; + for (; it != itEnd; ++it) + { + SvListEntry* pEntry = *it; + pEntry->nListPos &= 0x80000000; + pEntry->nListPos |= nCur; + ++nCur; + } + } + nListPos &= (~0x80000000); +} + +// *************************************************************** +// class SvLBoxEntry +// *************************************************************** + +DBG_NAME(SvLBoxEntry); + +SvLBoxEntry::SvLBoxEntry() : aItems() +{ + DBG_CTOR(SvLBoxEntry,0); + nEntryFlags = 0; + pUserData = 0; +} + +SvLBoxEntry::~SvLBoxEntry() +{ + DBG_DTOR(SvLBoxEntry,0); + DeleteItems_Impl(); +} + +void SvLBoxEntry::DeleteItems_Impl() +{ + DBG_CHKTHIS(SvLBoxEntry,0); + sal_uInt16 nCount = aItems.size(); + while( nCount ) + { + nCount--; + SvLBoxItem* pItem = aItems[ nCount ]; + delete pItem; + } + aItems.clear(); +} + + +void SvLBoxEntry::AddItem( SvLBoxItem* pItem ) +{ + DBG_CHKTHIS(SvLBoxEntry,0); + aItems.push_back( pItem ); +} + +void SvLBoxEntry::Clone( SvListEntry* pSource ) +{ + DBG_CHKTHIS(SvLBoxEntry,0); + SvListEntry::Clone( pSource ); + SvLBoxItem* pNewItem; + DeleteItems_Impl(); + sal_uInt16 nCount = ((SvLBoxEntry*)pSource)->ItemCount(); + sal_uInt16 nCurPos = 0; + while( nCurPos < nCount ) + { + SvLBoxItem* pItem = ((SvLBoxEntry*)pSource)->GetItem( nCurPos ); + pNewItem = pItem->Create(); + pNewItem->Clone( pItem ); + AddItem( pNewItem ); + nCurPos++; + } + pUserData = ((SvLBoxEntry*)pSource)->GetUserData(); + nEntryFlags = ((SvLBoxEntry*)pSource)->nEntryFlags; +} + +void SvLBoxEntry::EnableChildrenOnDemand( sal_Bool bEnable ) +{ + DBG_CHKTHIS(SvLBoxEntry,0); + if ( bEnable ) + nEntryFlags |= SV_ENTRYFLAG_CHILDREN_ON_DEMAND; + else + nEntryFlags &= (~SV_ENTRYFLAG_CHILDREN_ON_DEMAND); +} + +void SvLBoxEntry::ReplaceItem( SvLBoxItem* pNewItem, sal_uInt16 nPos ) +{ + DBG_CHKTHIS(SvLBoxEntry,0); + DBG_ASSERT(pNewItem,"ReplaceItem:No Item"); + SvLBoxItem* pOld = GetItem( nPos ); + if ( pOld ) + { + aItems[ nPos ] = pNewItem; + delete pOld; + } +} + +SvLBoxItem* SvLBoxEntry::GetFirstItem( sal_uInt16 nId ) +{ + sal_uInt16 nCount = aItems.size(); + sal_uInt16 nCur = 0; + SvLBoxItem* pItem; + while( nCur < nCount ) + { + pItem = GetItem( nCur ); + if( pItem->IsA() == nId ) + return pItem; + nCur++; + } + return 0; +} + +sal_uInt16 SvLBoxEntry::GetPos( SvLBoxItem* pItem ) const +{ + std::vector<SvLBoxItem*>::const_iterator it = std::find( aItems.begin(), aItems.end(), pItem ); + return it == aItems.end() ? USHRT_MAX : it - aItems.begin(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |