diff options
author | Rafael Dominguez <venccsralph@gmail.com> | 2011-03-08 19:53:14 -0800 |
---|---|---|
committer | Joseph Powers <jpowers27@cox.net> | 2011-03-08 19:53:14 -0800 |
commit | 26c6a74395274635d4face26f8b1cb1927b94c98 (patch) | |
tree | 48071d236c9d68a6ee37fb2868cc60feb60be561 | |
parent | f7114f0245a00b10b0a30245729b4100179be08f (diff) |
Remove List in SdrObjListIter.
-rw-r--r-- | svx/inc/svditer.hxx | 31 | ||||
-rw-r--r-- | svx/source/svdraw/svditer.cxx | 34 |
2 files changed, 33 insertions, 32 deletions
diff --git a/svx/inc/svditer.hxx b/svx/inc/svditer.hxx index 97b5459ee92f..85fc4b637570 100644 --- a/svx/inc/svditer.hxx +++ b/svx/inc/svditer.hxx @@ -29,8 +29,9 @@ #ifndef _SVDITER_HXX #define _SVDITER_HXX +#include <vector> + #include <sal/types.h> -#include <tools/list.hxx> #include "svx/svxdllapi.h" class SdrObjList; @@ -45,16 +46,16 @@ enum SdrIterMode { IM_FLAT, IM_DEEPWITHGROUPS, IM_DEEPNOGROUPS}; class SVX_DLLPUBLIC SdrObjListIter { - List maObjList; + std::vector<SdrObject*> maObjList; sal_uInt32 mnIndex; - BOOL mbReverse; + bool mbReverse; - void ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode, BOOL bUseZOrder); + void ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode, bool bUseZOrder); void ImpProcessMarkList(const SdrMarkList& rMarkList, SdrIterMode eMode); - void ImpProcessObj(SdrObject* pObj, SdrIterMode eMode, BOOL bUseZOrder); + void ImpProcessObj(SdrObject* pObj, SdrIterMode eMode, bool bUseZOrder); public: - SdrObjListIter(const SdrObjList& rObjList, SdrIterMode eMode = IM_DEEPNOGROUPS, BOOL bReverse = FALSE); + SdrObjListIter(const SdrObjList& rObjList, SdrIterMode eMode = IM_DEEPNOGROUPS, bool bReverse = false); /** This variant lets the user choose the order in which to travel over the objects. @param bUseZOrder @@ -62,20 +63,24 @@ public: Otherwise the navigation position as returned by SdrObject::GetNavigationPosition() is used. */ - SdrObjListIter(const SdrObjList& rObjList, BOOL bUseZOrder, SdrIterMode eMode = IM_DEEPNOGROUPS, BOOL bReverse = FALSE); + SdrObjListIter(const SdrObjList& rObjList, bool bUseZOrder, SdrIterMode eMode = IM_DEEPNOGROUPS, bool bReverse = false); /* SJ: the following function can now be used with every SdrObject and is no longer limited to group objects */ - SdrObjListIter(const SdrObject& rObj, SdrIterMode eMode = IM_DEEPNOGROUPS, BOOL bReverse = FALSE); + SdrObjListIter(const SdrObject& rObj, SdrIterMode eMode = IM_DEEPNOGROUPS, bool bReverse = false); /** Iterates over a list of marked objects received from the SdrMarkView. */ - SdrObjListIter(const SdrMarkList& rMarkList, SdrIterMode eMode = IM_DEEPNOGROUPS, BOOL bReverse = FALSE); + SdrObjListIter(const SdrMarkList& rMarkList, SdrIterMode eMode = IM_DEEPNOGROUPS, bool bReverse = false); - void Reset() { mnIndex = (mbReverse ? maObjList.Count() : 0L); } - BOOL IsMore() const { return (mbReverse ? mnIndex != 0 : ( mnIndex < maObjList.Count())); } - SdrObject* Next() { return (SdrObject*)maObjList.GetObject(mbReverse ? --mnIndex : mnIndex++); } + void Reset() { mnIndex = (mbReverse ? maObjList.size() : 0L); } + bool IsMore() const { return (mbReverse ? mnIndex != 0 : ( mnIndex < maObjList.size())); } + SdrObject* Next() + { + sal_uInt32 idx = (mbReverse ? --mnIndex : mnIndex++); + return idx < maObjList.size() ? maObjList[idx] : NULL; + } - sal_uInt32 Count() { return maObjList.Count(); } + sal_uInt32 Count() { return maObjList.size(); } }; #endif //_SVDITER_HXX diff --git a/svx/source/svdraw/svditer.cxx b/svx/source/svdraw/svditer.cxx index 2957bb2d079f..d59762b7ae8f 100644 --- a/svx/source/svdraw/svditer.cxx +++ b/svx/source/svdraw/svditer.cxx @@ -37,46 +37,42 @@ // #99190# #include <svx/scene3d.hxx> -SdrObjListIter::SdrObjListIter(const SdrObjList& rObjList, SdrIterMode eMode, BOOL bReverse) -: maObjList(1024, 64, 64), - mnIndex(0L), +SdrObjListIter::SdrObjListIter(const SdrObjList& rObjList, SdrIterMode eMode, bool bReverse) +: mnIndex(0L), mbReverse(bReverse) { - ImpProcessObjectList(rObjList, eMode, TRUE); + ImpProcessObjectList(rObjList, eMode, true); Reset(); } -SdrObjListIter::SdrObjListIter(const SdrObjList& rObjList, BOOL bUseZOrder, SdrIterMode eMode, BOOL bReverse) -: maObjList(1024, 64, 64), - mnIndex(0L), +SdrObjListIter::SdrObjListIter(const SdrObjList& rObjList, bool bUseZOrder, SdrIterMode eMode, bool bReverse) +: mnIndex(0L), mbReverse(bReverse) { ImpProcessObjectList(rObjList, eMode, bUseZOrder); Reset(); } -SdrObjListIter::SdrObjListIter( const SdrObject& rObj, SdrIterMode eMode, BOOL bReverse ) -: maObjList(1024, 64, 64), - mnIndex(0L), +SdrObjListIter::SdrObjListIter( const SdrObject& rObj, SdrIterMode eMode, bool bReverse ) +: mnIndex(0L), mbReverse(bReverse) { if ( rObj.ISA( SdrObjGroup ) ) - ImpProcessObjectList(*rObj.GetSubList(), eMode, TRUE); + ImpProcessObjectList(*rObj.GetSubList(), eMode, true); else - maObjList.Insert( (void*)&rObj, LIST_APPEND ); + maObjList.push_back(const_cast<SdrObject*>(&rObj)); Reset(); } -SdrObjListIter::SdrObjListIter( const SdrMarkList& rMarkList, SdrIterMode eMode, BOOL bReverse ) -: maObjList(1024, 64, 64), - mnIndex(0L), +SdrObjListIter::SdrObjListIter( const SdrMarkList& rMarkList, SdrIterMode eMode, bool bReverse ) +: mnIndex(0L), mbReverse(bReverse) { ImpProcessMarkList(rMarkList, eMode); Reset(); } -void SdrObjListIter::ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode, BOOL bUseZOrder) +void SdrObjListIter::ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode, bool bUseZOrder) { for( ULONG nIdx = 0, nCount = rObjList.GetObjCount(); nIdx < nCount; ++nIdx ) { @@ -92,10 +88,10 @@ void SdrObjListIter::ImpProcessMarkList( const SdrMarkList& rMarkList, SdrIterMo { for( ULONG nIdx = 0, nCount = rMarkList.GetMarkCount(); nIdx < nCount; ++nIdx ) if( SdrObject* pObj = rMarkList.GetMark( nIdx )->GetMarkedSdrObj() ) - ImpProcessObj( pObj, eMode, FALSE ); + ImpProcessObj( pObj, eMode, false ); } -void SdrObjListIter::ImpProcessObj(SdrObject* pObj, SdrIterMode eMode, BOOL bUseZOrder) +void SdrObjListIter::ImpProcessObj(SdrObject* pObj, SdrIterMode eMode, bool bUseZOrder) { bool bIsGroup = pObj->IsGroupObject(); // #99190# 3D objects are no group objects, IsGroupObject() @@ -104,7 +100,7 @@ void SdrObjListIter::ImpProcessObj(SdrObject* pObj, SdrIterMode eMode, BOOL bUse bIsGroup = false; if( !bIsGroup || (eMode != IM_DEEPNOGROUPS) ) - maObjList.Insert( pObj, LIST_APPEND ); + maObjList.push_back(pObj); if( bIsGroup && (eMode != IM_FLAT) ) ImpProcessObjectList( *pObj->GetSubList(), eMode, bUseZOrder ); |