summaryrefslogtreecommitdiff
path: root/svtools/source/contnr/treelist.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svtools/source/contnr/treelist.cxx')
-rw-r--r--svtools/source/contnr/treelist.cxx349
1 files changed, 104 insertions, 245 deletions
diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx
index c4ec516a735b..13b8fb553ee5 100644
--- a/svtools/source/contnr/treelist.cxx
+++ b/svtools/source/contnr/treelist.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,16 +31,8 @@
#define _TREELIST_CXX
-#ifndef GCC
-#endif
-
#include <svtools/treelist.hxx>
-#ifdef DBG_UTIL
-// Prueft Integritaet der Liste nach jeder Operation
-//#define CHECK_INTEGRITY
-#endif
-
DBG_NAME(SvListEntry);
@@ -128,6 +121,10 @@ SvViewData::~SvViewData()
#endif
}
+//=============================================================================
+// SvTreeEntryList
+//=============================================================================
+
void SvTreeEntryList::DestroyAll()
{
SvListEntry* pPtr = (SvListEntry*)First();
@@ -138,15 +135,19 @@ void SvTreeEntryList::DestroyAll()
}
}
+SvTreeEntryList::SvTreeEntryList(SvTreeEntryList& rList)
+{
+ maEntryList.clear();
+ maCurrent = 0;
+ for ( size_t i = 0, n = rList.size(); i < n; ++i ) {
+ maEntryList.push_back( rList[ i ] );
+ }
+}
/*************************************************************************
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
SvTreeList::SvTreeList()
@@ -163,10 +164,6 @@ SvTreeList::SvTreeList()
|*
|* SvTreeList::~SvTreeList
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
SvTreeList::~SvTreeList()
@@ -182,41 +179,42 @@ SvTreeList::~SvTreeList()
|*
|* SvTreeList::Broadcast
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
-void SvTreeList::Broadcast( sal_uInt16 nActionId, SvListEntry* pEntry1,
- SvListEntry* pEntry2, sal_uLong nPos )
-{
- sal_uLong nViewCount = aViewList.Count();
+void SvTreeList::Broadcast(
+ sal_uInt16 nActionId,
+ SvListEntry* pEntry1,
+ SvListEntry* pEntry2,
+ sal_uLong nPos
+) {
+ sal_uLong nViewCount = aViewList.size();
for( sal_uLong nCurView = 0; nCurView < nViewCount; nCurView++ )
{
- SvListView* pView = (SvListView*)aViewList.GetObject( nCurView );
+ SvListView* pView = aViewList[ nCurView ];
if( pView )
pView->ModelNotification( nActionId, pEntry1, pEntry2, nPos );
}
}
-void SvTreeList::InsertView( SvListView* pView)
+void SvTreeList::InsertView( SvListView* pView )
{
- sal_uLong nPos = aViewList.GetPos( pView );
- if ( nPos == LIST_ENTRY_NOTFOUND )
- {
- aViewList.Insert( pView, LIST_APPEND );
- nRefCount++;
+ for ( sal_uLong i = 0, n = aViewList.size(); i < n; ++i ) {
+ if ( aViewList[ i ] == pView ) {
+ return;
+ }
}
+ aViewList.push_back( pView );
+ nRefCount++;
}
void SvTreeList::RemoveView( SvListView* pView )
{
- sal_uLong nPos = aViewList.GetPos( pView );
- if ( nPos != LIST_ENTRY_NOTFOUND )
- {
- aViewList.Remove( pView );
- nRefCount--;
+ for ( SvListView_impl::iterator it = aViewList.begin(); it < aViewList.end(); ++it ) {
+ if ( *it == pView ) {
+ aViewList.erase( it );
+ nRefCount--;
+ break;
+ }
}
}
@@ -254,10 +252,6 @@ sal_uInt16 SvTreeList::GetDepth( SvListEntry* pEntry ) const
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
void SvTreeList::Clear()
@@ -284,10 +278,6 @@ void SvTreeList::Clear()
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
sal_Bool SvTreeList::IsChild( SvListEntry* pParent, SvListEntry* pChild ) const
@@ -336,12 +326,13 @@ sal_uLong SvTreeList::Move(SvListEntry* pSrcEntry,SvListEntry* pTargetParent,sal
// Dummy-Ptr einfuegen, weil nListPos durch das
// folgende Remove ungueltig werden koennte
- SvListEntry* pDummy = 0; pDstList->Insert( pDummy, nListPos );
+ SvListEntry* pDummy = 0;
+ pDstList->insert( pDummy, nListPos );
// loeschen
- pSrcList->Remove( pSrcEntry );
+ pSrcList->remove( pSrcEntry );
// Hat Parent noch Childs ?
- if ( pSrcList->Count() == 0 )
+ if ( pSrcList->empty() )
{
// Keine Childs, deshalb Child-List loeschen
SvListEntry* pParent = pSrcEntry->pParent;
@@ -354,7 +345,7 @@ sal_uLong SvTreeList::Move(SvListEntry* pSrcEntry,SvListEntry* pTargetParent,sal
// der ChildList den alten Parent noch benoetigen!)
pSrcEntry->pParent = pTargetParent;
- pDstList->Replace( pSrcEntry, pDummy );
+ pDstList->replace( pSrcEntry, pDummy );
// Listenpositionen in Zielliste korrigieren
SetListPositions( pDstList );
@@ -362,7 +353,7 @@ sal_uLong SvTreeList::Move(SvListEntry* pSrcEntry,SvListEntry* pTargetParent,sal
SetListPositions( pSrcList );
#ifdef CHECK_INTEGRITY
-CheckIntegrity();
+ CheckIntegrity();
#endif
sal_uLong nRetVal = pDstList->GetPos( pSrcEntry );
@@ -388,11 +379,11 @@ sal_uLong SvTreeList::Copy(SvListEntry* pSrcEntry,SvListEntry* pTargetParent,sal
SvTreeEntryList* pDstList = pTargetParent->pChilds;
pClonedEntry->pParent = pTargetParent; // Parent umsetzen
- pDstList->Insert( pClonedEntry, nListPos ); // Einfuegen
+ pDstList->insert( pClonedEntry, nListPos ); // Einfuegen
SetListPositions( pDstList ); // Listenpositionen in Zielliste korrigieren
#ifdef CHECK_INTEGRITY
-CheckIntegrity();
+ CheckIntegrity();
#endif
Broadcast( LISTACTION_INSERTED_TREE, pClonedEntry );
sal_uLong nRetVal = pDstList->GetPos( pClonedEntry );
@@ -405,10 +396,6 @@ CheckIntegrity();
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
void SvTreeList::Move( SvListEntry* pSrcEntry, SvListEntry* pDstEntry )
@@ -434,10 +421,6 @@ void SvTreeList::Move( SvListEntry* pSrcEntry, SvListEntry* pDstEntry )
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
void SvTreeList::Copy( SvListEntry* pSrcEntry, SvListEntry* pDstEntry )
@@ -462,10 +445,6 @@ void SvTreeList::Copy( SvListEntry* pSrcEntry, SvListEntry* pDstEntry )
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
void SvTreeList::InsertTree( SvListEntry* pSrcEntry, SvListEntry* pDstEntry)
{
@@ -505,7 +484,7 @@ void SvTreeList::InsertTree(SvListEntry* pSrcEntry,
pSrcEntry->pParent = pTargetParent; // Parent umsetzen
SvTreeEntryList* pDstList = pTargetParent->pChilds;
- pDstList->Insert( pSrcEntry, nListPos ); // einfuegen
+ pDstList->insert( pSrcEntry, nListPos ); // einfuegen
SetListPositions(pDstList); // Listenpositionen in Zielliste korrigieren
nEntryCount += GetChildCount( pSrcEntry );
nEntryCount++; // der Parent ist ja auch neu
@@ -534,10 +513,6 @@ SvListEntry* SvTreeList::CreateEntry() const
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
SvListEntry* SvTreeList::Clone( SvListEntry* pEntry, sal_uLong& nCloneCount ) const
@@ -554,17 +529,13 @@ SvListEntry* SvTreeList::Clone( SvListEntry* pEntry, sal_uLong& nCloneCount ) co
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
SvTreeEntryList* SvTreeList::CloneChilds( SvTreeEntryList* pChilds,
SvListEntry* pNewParent,
sal_uLong& nCloneCount ) const
{
- DBG_ASSERT(pChilds->Count(),"Childs?");
+ DBG_ASSERT(!pChilds->empty(),"Childs?");
SvTreeEntryList* pClonedChilds = new SvTreeEntryList;
SvListEntry* pChild = (SvListEntry*)pChilds->First();
while ( pChild )
@@ -579,7 +550,7 @@ SvTreeEntryList* SvTreeList::CloneChilds( SvTreeEntryList* pChilds,
pNewChild->pChilds = pSubChilds;
}
- pClonedChilds->Insert( pNewChild, LIST_APPEND );
+ pClonedChilds->push_back( pNewChild );
pChild = (SvListEntry*)pChilds->Next();
}
return pClonedChilds;
@@ -590,10 +561,6 @@ SvTreeEntryList* SvTreeList::CloneChilds( SvTreeEntryList* pChilds,
|*
|* SvTreeList::GetChildCount
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
sal_uLong SvTreeList::GetChildCount( SvListEntry* pParent ) const
@@ -619,10 +586,6 @@ sal_uLong SvTreeList::GetChildCount( SvListEntry* pParent ) const
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
sal_uLong SvTreeList::GetVisibleChildCount(const SvListView* pView, SvListEntry* pParent) const
@@ -669,16 +632,12 @@ sal_uLong SvTreeList::GetChildSelectionCount(const SvListView* pView,SvListEntry
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
SvListEntry* SvTreeList::First() const
{
if ( nEntryCount )
- return (SvListEntry*)(pRootItem->pChilds->GetObject(0));
+ return (SvListEntry*)(*pRootItem->pChilds)[ 0 ];
else
return 0;
}
@@ -687,10 +646,6 @@ SvListEntry* SvTreeList::First() const
|*
|* SvTreeList::Next
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
SvListEntry* SvTreeList::Next( SvListEntry* pActEntry, sal_uInt16* pDepth ) const
{
@@ -712,15 +667,15 @@ SvListEntry* SvTreeList::Next( SvListEntry* pActEntry, sal_uInt16* pDepth ) cons
if ( pActEntry->pChilds /* && pActEntry->pChilds->Count() */ )
{
nDepth++;
- pActEntry = (SvListEntry*)(pActEntry->pChilds->GetObject(0));
+ pActEntry = (SvListEntry*)(*pActEntry->pChilds)[ 0 ];
if ( bWithDepth )
*pDepth = nDepth;
return pActEntry;
}
- if ( pActualList->Count() > ( nActualPos + 1 ) )
+ if ( pActualList->size() > ( nActualPos + 1 ) )
{
- pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos + 1 ));
+ pActEntry = (SvListEntry*)(*pActualList)[ nActualPos + 1 ];
if ( bWithDepth )
*pDepth = nDepth;
return pActEntry;
@@ -734,9 +689,9 @@ SvListEntry* SvTreeList::Next( SvListEntry* pActEntry, sal_uInt16* pDepth ) cons
pActualList = pParent->pParent->pChilds;
DBG_ASSERT(pActualList,"TreeData corrupt!");
nActualPos = pParent->GetChildListPos();
- if ( pActualList->Count() > ( nActualPos + 1 ) )
+ if ( pActualList->size() > ( nActualPos + 1 ) )
{
- pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos + 1 ));
+ pActEntry = (SvListEntry*)(*pActualList)[ nActualPos + 1 ];
if ( bWithDepth )
*pDepth = nDepth;
return pActEntry;
@@ -751,10 +706,6 @@ SvListEntry* SvTreeList::Next( SvListEntry* pActEntry, sal_uInt16* pDepth ) cons
|*
|* SvTreeList::Prev
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
SvListEntry* SvTreeList::Prev( SvListEntry* pActEntry, sal_uInt16* pDepth ) const
{
@@ -773,12 +724,12 @@ SvListEntry* SvTreeList::Prev( SvListEntry* pActEntry, sal_uInt16* pDepth ) cons
if ( nActualPos > 0 )
{
- pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos - 1 ));
- while( pActEntry->pChilds /* && pActEntry->pChilds->Count() */ )
+ pActEntry = (SvListEntry*)(*pActualList)[ nActualPos - 1 ];
+ while( pActEntry->pChilds )
{
pActualList = pActEntry->pChilds;
nDepth++;
- pActEntry = (SvListEntry*)(pActualList->Last());
+ pActEntry = (SvListEntry*)(pActualList->last());
}
if ( bWithDepth )
*pDepth = nDepth;
@@ -803,13 +754,9 @@ SvListEntry* SvTreeList::Prev( SvListEntry* pActEntry, sal_uInt16* pDepth ) cons
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
-SvListEntry* SvTreeList::Last( sal_uInt16* /* nDepth */ ) const
+SvListEntry* SvTreeList::Last() const
{
SvTreeEntryList* pActList = pRootItem->pChilds;
// if ( pActList->Count() == 0 )
@@ -817,7 +764,7 @@ SvListEntry* SvTreeList::Last( sal_uInt16* /* nDepth */ ) const
SvListEntry* pEntry = 0;
while( pActList )
{
- pEntry = (SvListEntry*)(pActList->Last());
+ pEntry = (SvListEntry*)(pActList->last());
pActList = pEntry->pChilds;
// if ( pActList->Count() == 0 )
// pActList = 0;
@@ -829,10 +776,6 @@ SvListEntry* SvTreeList::Last( sal_uInt16* /* nDepth */ ) const
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
sal_uLong SvTreeList::GetVisiblePos( const SvListView* pView, SvListEntry* pEntry ) const
@@ -853,10 +796,6 @@ sal_uLong SvTreeList::GetVisiblePos( const SvListView* pView, SvListEntry* pEntr
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
sal_uLong SvTreeList::GetVisibleCount( const SvListView* pView ) const
@@ -879,7 +818,7 @@ sal_uLong SvTreeList::GetVisibleCount( const SvListView* pView ) const
#ifdef DBG_UTIL
if( nPos > 10000000 )
{
- DBG_ERROR("nVisibleCount bad");
+ OSL_FAIL("nVisibleCount bad");
}
#endif
((SvListView*)pView)->nVisibleCount = nPos;
@@ -892,10 +831,6 @@ sal_uLong SvTreeList::GetVisibleCount( const SvListView* pView ) const
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
// Funktion geht aus Geschwindigkeitsgruenden davon aus,
@@ -922,16 +857,16 @@ SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pActEn
{
DBG_ASSERT(pActEntry->pChilds,"Childs?");
nDepth++;
- pActEntry = (SvListEntry*)(pActEntry->pChilds->GetObject(0));
+ pActEntry = (SvListEntry*)(*pActEntry->pChilds)[ 0 ];
if ( bWithDepth )
*pActDepth = nDepth;
return pActEntry;
}
nActualPos++;
- if ( pActualList->Count() > nActualPos )
+ if ( pActualList->size() > nActualPos )
{
- pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos ));
+ pActEntry = (SvListEntry*)(*pActualList)[ nActualPos ];
if ( bWithDepth )
*pActDepth = nDepth;
return pActEntry;
@@ -944,9 +879,9 @@ SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pActEn
pActualList = pParent->pParent->pChilds;
nActualPos = pParent->GetChildListPos();
nActualPos++;
- if ( pActualList->Count() > nActualPos )
+ if ( pActualList->size() > nActualPos )
{
- pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos ));
+ pActEntry = (SvListEntry*)(*pActualList)[ nActualPos ];
if ( bWithDepth )
*pActDepth = nDepth;
return pActEntry;
@@ -962,10 +897,6 @@ SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pActEn
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
// Funktion geht aus Geschwindigkeitsgruenden davon aus,
@@ -988,12 +919,12 @@ SvListEntry* SvTreeList::PrevVisible(const SvListView* pView, SvListEntry* pActE
if ( nActualPos > 0 )
{
- pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos - 1 ));
+ pActEntry = (SvListEntry*)(*pActualList)[ nActualPos - 1 ];
while( pView->IsExpanded(pActEntry) )
{
pActualList = pActEntry->pChilds;
nDepth++;
- pActEntry = (SvListEntry*)(pActualList->Last());
+ pActEntry = (SvListEntry*)(pActualList->last());
}
if ( bWithDepth )
*pActDepth = nDepth;
@@ -1018,10 +949,6 @@ SvListEntry* SvTreeList::PrevVisible(const SvListView* pView, SvListEntry* pActE
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
SvListEntry* SvTreeList::LastVisible( const SvListView* pView, sal_uInt16* pDepth) const
@@ -1039,10 +966,6 @@ SvListEntry* SvTreeList::LastVisible( const SvListView* pView, sal_uInt16* pDept
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pEntry,sal_uInt16& nDelta) const
@@ -1072,10 +995,6 @@ SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pEntry
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
SvListEntry* SvTreeList::PrevVisible( const SvListView* pView, SvListEntry* pEntry, sal_uInt16& nDelta ) const
@@ -1102,10 +1021,6 @@ SvListEntry* SvTreeList::PrevVisible( const SvListView* pView, SvListEntry* pEnt
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
SvListEntry* SvTreeList::FirstSelected( const SvListView* pView) const
@@ -1126,7 +1041,7 @@ SvListEntry* SvTreeList::FirstChild( SvListEntry* pParent ) const
pParent = pRootItem;
SvListEntry* pResult;
if ( pParent->pChilds )
- pResult = (SvListEntry*)(pParent->pChilds->GetObject( 0 ));
+ pResult = (SvListEntry*)(*pParent->pChilds)[ 0 ];
else
pResult = 0;
return pResult;
@@ -1138,10 +1053,9 @@ SvListEntry* SvTreeList::NextSibling( SvListEntry* pEntry ) const
if( !pEntry )
return 0;
SvTreeEntryList* pList = pEntry->pParent->pChilds;
-// sal_uLong nPos = pList->GetPos( pEntry );
sal_uLong nPos = pEntry->GetChildListPos();
nPos++;
- pEntry = (SvListEntry*)(pList->GetObject( nPos ));
+ pEntry = (SvListEntry*)(*pList)[ nPos ];
return pEntry;
}
@@ -1152,12 +1066,11 @@ SvListEntry* SvTreeList::PrevSibling( SvListEntry* pEntry ) const
return 0;
SvTreeEntryList* pList = pEntry->pParent->pChilds;
- // sal_uLong nPos = pList->GetPos( pEntry );
sal_uLong nPos = pEntry->GetChildListPos();
if ( nPos == 0 )
return 0;
nPos--;
- pEntry = (SvListEntry*)(pList->GetObject( nPos ));
+ pEntry = (SvListEntry*)(*pList)[ nPos ];
return pEntry;
}
@@ -1170,20 +1083,15 @@ SvListEntry* SvTreeList::LastSibling( SvListEntry* pEntry ) const
SvListEntry* pSib = 0;
SvTreeEntryList* pSibs = pEntry->pParent->pChilds;
if ( pSibs )
- pSib = (SvListEntry*)(pSibs->Last());
+ pSib = (SvListEntry*)(pSibs->last());
return pSib;
}
-
/*************************************************************************
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
SvListEntry* SvTreeList::NextSelected( const SvListView* pView, SvListEntry* pEntry ) const
@@ -1199,10 +1107,6 @@ SvListEntry* SvTreeList::NextSelected( const SvListView* pView, SvListEntry* pEn
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
SvListEntry* SvTreeList::PrevSelected( const SvListView* pView, SvListEntry* pEntry) const
@@ -1219,10 +1123,6 @@ SvListEntry* SvTreeList::PrevSelected( const SvListView* pView, SvListEntry* pEn
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
SvListEntry* SvTreeList::LastSelected( const SvListView* pView ) const
@@ -1238,10 +1138,6 @@ SvListEntry* SvTreeList::LastSelected( const SvListView* pView ) const
|*
|* SvTreeList::Insert
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
sal_uLong SvTreeList::Insert( SvListEntry* pEntry,SvListEntry* pParent,sal_uLong nPos )
{
@@ -1265,15 +1161,15 @@ sal_uLong SvTreeList::Insert( SvListEntry* pEntry,SvListEntry* pParent,sal_uLong
bAbsPositionsValid = sal_False;
pEntry->pParent = pParent;
- pList->Insert( pEntry, nPos );
+ pList->insert( pEntry, nPos );
nEntryCount++;
- if( nPos != LIST_APPEND && (nPos != (pList->Count()-1)) )
+ if( nPos != ULONG_MAX && (nPos != (pList->size()-1)) )
SetListPositions( pList );
else
- pEntry->nListPos = pList->Count()-1;
+ pEntry->nListPos = pList->size()-1;
#ifdef CHECK_INTEGRITY
-CheckIntegrity();
+ CheckIntegrity();
#endif
Broadcast( LISTACTION_INSERTED, pEntry );
return nPos; // pEntry->nListPos;
@@ -1283,10 +1179,6 @@ CheckIntegrity();
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
sal_uLong SvTreeList::GetAbsPos( SvListEntry* pEntry) const
@@ -1300,10 +1192,6 @@ sal_uLong SvTreeList::GetAbsPos( SvListEntry* pEntry) const
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
void SvTreeList::SetAbsolutePositions()
@@ -1327,10 +1215,6 @@ CheckIntegrity();
|*
|* SvTreeList::Expand
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
void SvTreeList::Expand( SvListView* pView, SvListEntry* pEntry )
@@ -1359,10 +1243,6 @@ CheckIntegrity();
|*
|* SvTreeList::Collapse
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
void SvTreeList::Collapse( SvListView* pView, SvListEntry* pEntry )
@@ -1392,10 +1272,6 @@ CheckIntegrity();
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
sal_Bool SvTreeList::Select( SvListView* pView, SvListEntry* pEntry, sal_Bool bSelect )
@@ -1423,7 +1299,7 @@ sal_Bool SvTreeList::Select( SvListView* pView, SvListEntry* pEntry, sal_Bool bS
}
}
#ifdef CHECK_INTEGRITY
-CheckIntegrity();
+ CheckIntegrity();
#endif
return sal_True;
}
@@ -1432,10 +1308,6 @@ CheckIntegrity();
|*
|* SvTreeList::Remove
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 05.04.01
-|*
*************************************************************************/
sal_Bool SvTreeList::Remove( SvListEntry* pEntry )
{
@@ -1443,7 +1315,7 @@ sal_Bool SvTreeList::Remove( SvListEntry* pEntry )
if( !pEntry->pParent )
{
- DBG_ERROR("Removing entry not in model!");
+ OSL_FAIL("Removing entry not in model!");
// unter gewissen Umstaenden (welche?) loescht der
// Explorer aus der View Eintraege, die er nicht in die View
// eingefuegt hat. Da sich der Kunde fuer ein platzendes
@@ -1462,20 +1334,20 @@ sal_Bool SvTreeList::Remove( SvListEntry* pEntry )
if ( pEntry->HasChildListPos() )
{
- sal_uLong nListPos = pEntry->GetChildListPos();
- bLastEntry = (nListPos == (pList->Count()-1) ) ? sal_True : sal_False;
- pList->Remove( nListPos );
+ size_t nListPos = pEntry->GetChildListPos();
+ bLastEntry = (nListPos == (pList->size()-1) ) ? sal_True : sal_False;
+ pList->remove( nListPos );
}
else
{
- pList->Remove( (void*) pEntry );
+ pList->remove( pEntry );
}
// moved to end of method because it is used later with Broadcast
// delete pEntry; // loescht auch alle Childs
- if ( pList->Count() == 0 )
+ if ( pList->empty() )
{
pParent->pChilds = 0;
delete pList;
@@ -1488,7 +1360,7 @@ sal_Bool SvTreeList::Remove( SvListEntry* pEntry )
nEntryCount -= nRemoved;
#ifdef CHECK_INTEGRITY
-CheckIntegrity();
+ CheckIntegrity();
#endif
Broadcast( LISTACTION_REMOVED, pEntry );
@@ -1500,10 +1372,6 @@ CheckIntegrity();
|*
|* SvTreeList::
|*
-|* Beschreibung
-|* Ersterstellung 17.08.94
-|* Letzte Aenderung 17.08.94
-|*
*************************************************************************/
sal_uLong SvTreeList::SelectChilds(SvListView* pView, SvListEntry* pParent,sal_Bool bSelect )
@@ -1511,7 +1379,7 @@ sal_uLong SvTreeList::SelectChilds(SvListView* pView, SvListEntry* pParent,sal_B
DBG_ASSERT(pView&&pParent,"SelChilds:View/Parent?");
if ( !pParent->pChilds )
return 0;
- if ( pParent->pChilds->Count() == 0 )
+ if ( pParent->pChilds->empty() )
return 0;
sal_uInt16 nRefDepth = GetDepth( pParent );
@@ -1526,7 +1394,7 @@ sal_uLong SvTreeList::SelectChilds(SvListView* pView, SvListEntry* pParent,sal_B
}
while( pParent && nDepth > nRefDepth );
#ifdef CHECK_INTEGRITY
-CheckIntegrity();
+ CheckIntegrity();
#endif
return nCount;
}
@@ -1580,22 +1448,12 @@ SvListEntry* SvTreeList::GetEntryAtVisPos( const SvListView* pView, sal_uLong nV
void SvTreeList::SetListPositions( SvTreeEntryList* pList )
{
- if( pList->Count() )
+ if( !pList->empty() )
{
- SvListEntry* pEntry = (SvListEntry*)(pList->GetObject(0));
+ SvListEntry* pEntry = (SvListEntry*)(*pList)[ 0 ];
if( pEntry->pParent )
pEntry->pParent->InvalidateChildrensListPositions();
}
- /*
- sal_uLong nListPos = 0;
- SvListEntry* pEntry = (SvListEntry*)(pList->First());
- while( pEntry )
- {
- pEntry->nListPos = nListPos;
- nListPos++;
- pEntry = (SvListEntry*)(pList->Next());
- }
- */
}
@@ -1610,7 +1468,7 @@ sal_Bool SvTreeList::IsInChildList( SvListEntry* pParent, SvListEntry* pChild) c
pParent = pRootItem;
sal_Bool bIsChild = sal_False;
if ( pParent->pChilds )
- bIsChild = (sal_Bool)(pParent->pChilds->GetPos(pChild) != LIST_ENTRY_NOTFOUND);
+ bIsChild = (sal_Bool)(pParent->pChilds->GetPos(pChild) != ULONG_MAX);
return bIsChild;
}
@@ -1838,7 +1696,7 @@ void SvListView::ActionMoving( SvListEntry* pEntry,SvListEntry*,sal_uLong)
DBG_CHKTHIS(SvListView,0);
SvListEntry* pParent = pEntry->pParent;
DBG_ASSERT(pParent,"Model not consistent");
- if( pParent != pModel->pRootItem && pParent->pChilds->Count() == 1 )
+ if( pParent != pModel->pRootItem && pParent->pChilds->size() == 1 )
{
SvViewData* pViewData = (SvViewData*)aDataTable.Get( (sal_uLong)pParent );
pViewData->nFlags &= (~SVLISTENTRYFLAG_EXPANDED);
@@ -1937,7 +1795,7 @@ void SvListView::ActionRemoving( SvListEntry* pEntry )
#ifdef DBG_UTIL
if( nVisibleCount < nVisibleRemoved )
{
- DBG_ERROR("nVisibleRemoved bad");
+ OSL_FAIL("nVisibleRemoved bad");
}
#endif
nVisibleCount -= nVisibleRemoved;
@@ -1951,7 +1809,7 @@ void SvListView::ActionRemoving( SvListEntry* pEntry )
SvListEntry* pCurEntry = pEntry->pParent;
if ( pCurEntry && pCurEntry != pModel->pRootItem &&
- pCurEntry->pChilds->Count() == 1 )
+ pCurEntry->pChilds->size() == 1 )
{
pViewData = (SvViewData*)aDataTable.Get((sal_uLong)pCurEntry);
pViewData->nFlags &= (~SVLISTENTRYFLAG_EXPANDED);
@@ -2015,7 +1873,7 @@ void SvListView::ModelNotification( sal_uInt16 nActionId, SvListEntry* pEntry1,
case LISTACTION_RESORTING:
break;
default:
- DBG_ERROR("unknown ActionId");
+ OSL_FAIL("unknown ActionId");
}
}
@@ -2046,19 +1904,19 @@ void SvTreeList::Resort()
void SvTreeList::ResortChilds( SvListEntry* pParent )
{
DBG_ASSERT(pParent,"Parent not set");
- List* pChildList = pParent->pChilds;
+ SvTreeEntryList* pChildList = pParent->pChilds;
if( !pChildList )
return;
- List aList( *pChildList );
- pChildList->Clear();
+ SvTreeEntryList aList( *pChildList );
+ pChildList->clear();
- sal_uLong nCount = aList.Count();
- for( sal_uLong nCur = 0; nCur < nCount; nCur++ )
+ size_t nCount = aList.size();
+ for( size_t nCur = 0; nCur < nCount; nCur++ )
{
- SvListEntry* pCurEntry = (SvListEntry*)aList.GetObject( nCur );
- sal_uLong nListPos = LIST_APPEND;
+ SvListEntry* pCurEntry = (SvListEntry*)aList[ nCur ];
+ sal_uLong nListPos = ULONG_MAX;
GetInsertionPos( pCurEntry, pParent, nListPos );
- pChildList->Insert( pCurEntry, nListPos );
+ pChildList->insert( pCurEntry, nListPos );
if( pCurEntry->pChilds )
ResortChilds( pCurEntry );
}
@@ -2073,20 +1931,20 @@ void SvTreeList::GetInsertionPos( SvListEntry* pEntry, SvListEntry* pParent,
if( eSortMode == SortNone )
return;
- rPos = LIST_APPEND;
+ rPos = ULONG_MAX;
SvTreeEntryList* pChildList = GetChildList( pParent );
- if( pChildList && pChildList->Count() )
+ if( pChildList && !pChildList->empty() )
{
long i = 0;
- long j = pChildList->Count()-1;
+ long j = pChildList->size()-1;
long k;
StringCompare eCompare = COMPARE_GREATER;
do
{
k = (i+j)/2;
- SvListEntry* pTempEntry = (SvListEntry*)(pChildList->GetObject(k));
+ SvListEntry* pTempEntry = (SvListEntry*)(*pChildList)[ k ];
eCompare = Compare( pEntry, pTempEntry );
if( eSortMode == SortDescending && eCompare != COMPARE_EQUAL )
{
@@ -2103,8 +1961,8 @@ void SvTreeList::GetInsertionPos( SvListEntry* pEntry, SvListEntry* pParent,
if( eCompare != COMPARE_EQUAL )
{
- if(i > ((long)pChildList->Count() - 1)) // nicht gefunden, Ende der Liste
- rPos = LIST_APPEND;
+ if(i > ((long)pChildList->size() - 1)) // nicht gefunden, Ende der Liste
+ rPos = ULONG_MAX;
else
rPos = i; // nicht gefunden, Mitte
}
@@ -2114,3 +1972,4 @@ void SvTreeList::GetInsertionPos( SvListEntry* pEntry, SvListEntry* pParent,
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */