Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hello lo-devs,

I've tested the patch with 'make check', but would like to point out
that the reviewer should take special care of the change in
'sc/source/core/tool/chgtrack.cxx:3140-3160'. From my understanding
of the code the tools Table does not allow multiple entires with the
same key so that this assertion for double keys is not required but
maybe I'm missing something.

regards Marcel Metz

---
 sc/inc/chgtrack.hxx                                |   42 ++++--
 sc/source/core/tool/chgtrack.cxx                   |  138
++++++++++----------
 sc/source/filter/xcl97/XclExpChangeTrack.cxx       |   12 +-
 .../filter/xml/XMLChangeTrackingExportHelper.cxx   |    2 +-
 .../filter/xml/XMLChangeTrackingExportHelper.hxx   |    6 +-
 sc/source/ui/inc/acredlin.hxx                      |    8 +-
 sc/source/ui/miscdlgs/acredlin.cxx                 |   99 +++++++-------
 7 files changed, 167 insertions(+), 140 deletions(-)


diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index 5dc02d8..9dd27ca 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -30,11 +30,11 @@
 #define SC_CHGTRACK_HXX
 
 #include <deque>
+#include <map>
 #include <stack>
 
 #include <tools/string.hxx>
 #include <tools/datetime.hxx>
-#include <tools/table.hxx>
 #include <tools/mempool.hxx>
 #include <tools/link.hxx>
 #include <unotools/options.hxx>
@@ -952,6 +952,7 @@ struct ScChangeTrackMsgInfo
 // MsgQueue for notification via ModifiedLink
 typedef std::deque<ScChangeTrackMsgInfo*> ScChangeTrackMsgQueue;
 typedef std::stack<ScChangeTrackMsgInfo*> ScChangeTrackMsgStack;
+typedef std::map<sal_uLong, ScChangeAction*> ScChangeActionMap;
 
 enum ScChangeTrackMergeState
 {
@@ -962,9 +963,6 @@ enum ScChangeTrackMergeState
     SC_CTMS_OTHER
 };
 
-// Table, additionally to pFirst/pNext/pLast/pPrev, to enable fast access by ActionNumber and by 
list
-DECLARE_TABLE( ScChangeActionTable, ScChangeAction* )
-
 // Internally generated actions start at this value (nearly all bits set)
 // and are decremented, to keep values in a table seperated from "normal" actions.
 #define SC_CHGTRACK_GENERATED_START ((sal_uInt32) 0xfffffff0)
@@ -981,9 +979,9 @@ class ScChangeTrack : public utl::ConfigurationListener
     static  const SCSIZE        nContentSlots;
 
     com::sun::star::uno::Sequence< sal_Int8 >   aProtectPass;
-            ScChangeActionTable aTable;
-            ScChangeActionTable aGeneratedTable;
-            ScChangeActionTable aPasteCutTable;
+    ScChangeActionMap   aMap;
+    ScChangeActionMap   aGeneratedMap;
+    ScChangeActionMap   aPasteCutMap;
         ScChangeTrackMsgQueue   aMsgQueue;
         ScChangeTrackMsgStack   aMsgStackTmp;
         ScChangeTrackMsgStack   aMsgStackFinal;
@@ -1097,7 +1095,7 @@ class ScChangeTrack : public utl::ConfigurationListener
                                 // is NULL otherwise.
                                 // bRecursion == called from reject with table
             sal_Bool                Reject( ScChangeAction*,
-                                    ScChangeActionTable*, sal_Bool bRecursion );
+                                    ScChangeActionMap*, sal_Bool bRecursion );
 
 #endif  // SC_CHGTRACK_CXX
 
@@ -1126,9 +1124,21 @@ public:
             sal_Bool                IsGenerated( sal_uLong nAction ) const
                                     { return nAction >= nGeneratedMin; }
             ScChangeAction*     GetAction( sal_uLong nAction ) const
-                                    { return aTable.Get( nAction ); }
+            {
+                ScChangeActionMap::const_iterator it = aMap.find( nAction );
+                if( it != aMap.end() )
+                    return it->second;
+                else
+                    return NULL;
+            }
             ScChangeAction*     GetGenerated( sal_uLong nGenerated ) const
-                                    { return aGeneratedTable.Get( nGenerated ); }
+            {
+                ScChangeActionMap::const_iterator it = aGeneratedMap.find( nGenerated );
+                if( it != aGeneratedMap.end() )
+                    return it->second;
+                else
+                    return NULL;
+            }
             ScChangeAction*     GetActionOrGenerated( sal_uLong nAction ) const
                                     {
                                         return IsGenerated( nAction ) ?
@@ -1140,7 +1150,13 @@ public:
             void                SetLastSavedActionNumber(sal_uLong nNew)
                                     { nMarkLastSaved = nNew; }
             ScChangeAction*     GetLastSaved() const
-                                    { return aTable.Get( nMarkLastSaved ); }
+            {
+                ScChangeActionMap::const_iterator it = aMap.find( nMarkLastSaved );
+                if( it != aMap.end() )
+                    return it->second;
+                else
+                    return NULL;
+            }
         ScChangeActionContent** GetContentSlots() const { return ppContentSlots; }
 
             sal_Bool                IsLoadSave() const { return bLoadSave; }
@@ -1278,8 +1294,8 @@ public:
                                 // With bAllFlat (==TRUE ?) all dependents of dependents
                                 // will be inserted flatly.
 
-    SC_DLLPUBLIC        void                GetDependents( ScChangeAction*,
-                                    ScChangeActionTable&,
+    SC_DLLPUBLIC        void    GetDependents( ScChangeAction*,
+                                    ScChangeActionMap&,
                                     sal_Bool bListMasterDelete = false,
                                     sal_Bool bAllFlat = false ) const;
 
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 7a85014..ef5ec99 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -454,12 +454,12 @@ void ScChangeAction::GetDescription( String& rStr, ScDocument* /* pDoc */,
                     }
                     else if (pReject->HasDependent())
                     {
-                        ScChangeActionTable aTable;
-                        pCT->GetDependents( pReject, aTable, false, sal_True );
-                        for ( const ScChangeAction* p = aTable.First(); p;
-                                p = aTable.Next() )
+                        ScChangeActionMap aMap;
+                        pCT->GetDependents( pReject, aMap, false, sal_True );
+                        ScChangeActionMap::iterator itChangeAction;
+                        for( itChangeAction = aMap.begin(); itChangeAction != aMap.end(); 
++itChangeAction )
                         {
-                            if (p->GetType() == SC_CAT_MOVE)
+                            if( itChangeAction->second->GetType() == SC_CAT_MOVE)
                             {
                                 rStr += ScGlobal::GetRscString(
                                         STR_CHANGED_MOVE_REJECTION_WARNING);
@@ -2116,6 +2116,7 @@ void ScChangeTrack::DtorClear()
 {
     ScChangeAction* p;
     ScChangeAction* pNext;
+    ScChangeActionMap::iterator itChangeAction;
     for ( p = GetFirst(); p; p = pNext )
     {
         pNext = p->GetNext();
@@ -2126,9 +2127,9 @@ void ScChangeTrack::DtorClear()
         pNext = p->GetNext();
         delete p;
     }
-    for ( p = aPasteCutTable.First(); p; p = aPasteCutTable.Next() )
+    for( itChangeAction = aPasteCutMap.begin(); itChangeAction != aPasteCutMap.end(); 
++itChangeAction )
     {
-        delete p;
+        delete itChangeAction->second;
     }
     delete pLastCutMove;
     ClearMsgQueue();
@@ -2164,9 +2165,9 @@ void ScChangeTrack::ClearMsgQueue()
 void ScChangeTrack::Clear()
 {
     DtorClear();
-    aTable.Clear();
-    aGeneratedTable.Clear();
-    aPasteCutTable.Clear();
+    aMap.clear();
+    aGeneratedMap.clear();
+    aPasteCutMap.clear();
     aUserCollection.FreeAll();
     aUser.Erase();
     Init();
@@ -2339,7 +2340,7 @@ void ScChangeTrack::MasterLinks( ScChangeAction* pAppend )
 
 void ScChangeTrack::AppendLoaded( ScChangeAction* pAppend )
 {
-    aTable.Insert( pAppend->GetActionNumber(), pAppend );
+    aMap.insert( ::std::make_pair( pAppend->GetActionNumber(), pAppend ) );
     if ( !pLast )
         pFirst = pLast = pAppend;
     else
@@ -2360,7 +2361,7 @@ void ScChangeTrack::Append( ScChangeAction* pAppend, sal_uLong nAction )
     if ( bUseFixDateTime )
         pAppend->SetDateTimeUTC( aFixDateTime );
     pAppend->SetActionNumber( nAction );
-    aTable.Insert( nAction, pAppend );
+    aMap.insert( ::std::make_pair( nAction, pAppend ) );
     // UpdateReference Inserts vor Dependencies.
     // Delete rejectendes Insert hatte UpdateReference mit Delete-Undo.
     // UpdateReference auch wenn pLast==NULL, weil pAppend ein Delete sein
@@ -2831,7 +2832,7 @@ ScChangeActionContent* ScChangeTrack::GenerateDelContent(
         pContent->pNext = pFirstGeneratedDelContent;
     }
     pFirstGeneratedDelContent = pContent;
-    aGeneratedTable.Insert( nGeneratedMin, pContent );
+    aGeneratedMap.insert( std::make_pair( nGeneratedMin, pContent ) );
     NotifyModified( SC_CTM_APPEND, nGeneratedMin, nGeneratedMin );
     return pContent;
 }
@@ -2840,7 +2841,7 @@ ScChangeActionContent* ScChangeTrack::GenerateDelContent(
 void ScChangeTrack::DeleteGeneratedDelContent( ScChangeActionContent* pContent )
 {
     sal_uLong nAct = pContent->GetActionNumber();
-    aGeneratedTable.Remove( nAct );
+    aGeneratedMap.erase( nAct );
     if ( pFirstGeneratedDelContent == pContent )
         pFirstGeneratedDelContent = (ScChangeActionContent*) pContent->pNext;
     if ( pContent->pNext )
@@ -3038,7 +3039,7 @@ void ScChangeTrack::Remove( ScChangeAction* pRemove )
 {
     // aus Track ausklinken
     sal_uLong nAct = pRemove->GetActionNumber();
-    aTable.Remove( nAct );
+    aMap.erase( nAct );
     if ( nAct == nActionMax )
         --nActionMax;
     if ( pRemove == pLast )
@@ -3125,7 +3126,7 @@ void ScChangeTrack::Undo( sal_uLong nStartAction, sal_uLong nEndAction, bool 
bMe
                 SetInDeleteTop( false );
                 Remove( pAct );
                 if ( IsInPasteCut() )
-                    aPasteCutTable.Insert( pAct->GetActionNumber(), pAct );
+                    aPasteCutMap.insert( ::std::make_pair( pAct->GetActionNumber(), pAct ) );
                 else
                 {
                     if ( j == nStartAction && pAct->GetType() == SC_CAT_MOVE )
@@ -3140,16 +3141,15 @@ void ScChangeTrack::Undo( sal_uLong nStartAction, sal_uLong nEndAction, 
bool bMe
                             StartBlockModify( SC_CTM_APPEND, nStart );
                             for ( sal_uLong nCut = nStart; nCut <= nEnd; nCut++ )
                             {
-                                ScChangeAction* pCut = aPasteCutTable.Remove( nCut );
-                                if ( pCut )
-                                {
-                                    OSL_ENSURE( !aTable.Get( nCut ), "ScChangeTrack::Undo: nCut 
dup" );
-                                    Append( pCut, nCut );
-                                }
-                                else
+                                ScChangeActionMap::iterator itCut = aPasteCutMap.find( nCut );
+
+                                if ( itCut == aMap.end() )
                                 {
                                     OSL_FAIL( "ScChangeTrack::Undo: nCut not found" );
                                 }
+
+                                Append( itCut->second, nCut );
+                                aPasteCutMap.erase( nCut );
                             }
                             EndBlockModify( nEnd );
                             ResetLastCut();
@@ -3848,7 +3848,7 @@ void ScChangeTrack::UpdateReference( ScChangeAction** ppFirstAction,
 
 
 void ScChangeTrack::GetDependents( ScChangeAction* pAct,
-        ScChangeActionTable& rTable, sal_Bool bListMasterDelete, sal_Bool bAllFlat ) const
+        ScChangeActionMap& rMap, sal_Bool bListMasterDelete, sal_Bool bAllFlat ) const
 {
     //! bAllFlat==TRUE: intern aus Accept oder Reject gerufen,
     //! => Generated werden nicht aufgenommen
@@ -3876,7 +3876,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
                     if ( bAllFlat )
                     {
                         sal_uLong n = p->GetActionNumber();
-                        if ( !IsGenerated( n ) && rTable.Insert( n, p ) )
+                        if ( !IsGenerated( n ) && rMap.insert( ::std::make_pair( n, p ) ).second )
                             if ( p->HasDependent() )
                                 cStack.push( p );
                     }
@@ -3885,10 +3885,10 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
                         if ( p->GetType() == SC_CAT_CONTENT )
                         {
                             if ( ((ScChangeActionContent*)p)->IsTopContent() )
-                                rTable.Insert( p->GetActionNumber(), p );
+                                rMap.insert( ::std::make_pair( p->GetActionNumber(), p ) );
                         }
                         else
-                            rTable.Insert( p->GetActionNumber(), p );
+                            rMap.insert( ::std::make_pair( p->GetActionNumber(), p ) );
                     }
                 }
                 pL = pL->GetNext();
@@ -3907,9 +3907,9 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
                     ScChangeAction* p = pDel;
                     while ( (p = p->GetPrev()) != NULL && p->GetType() == eType &&
                             !((ScChangeActionDel*)p)->IsTopDelete() )
-                        rTable.Insert( p->GetActionNumber(), p );
-                    // dieses Delete auch in Table!
-                    rTable.Insert( pAct->GetActionNumber(), pAct );
+                        rMap.insert( ::std::make_pair( p->GetActionNumber(), p ) );
+                    // delete this in the map too
+                    rMap.insert( ::std::make_pair( pAct->GetActionNumber(), pAct ) );
                 }
                 else
                 {
@@ -3923,7 +3923,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
                             {
                                 // nur ein TopContent einer Kette ist in LinkDeleted
                                 sal_uLong n = p->GetActionNumber();
-                                if ( !IsGenerated( n ) && rTable.Insert( n, p ) )
+                                if ( !IsGenerated( n ) && rMap.insert( ::std::make_pair( n, p ) 
).second )
                                     if ( p->HasDeleted() ||
                                             p->GetType() == SC_CAT_CONTENT )
                                         cStack.push( p );
@@ -3934,10 +3934,10 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
                                 {   // weiteres TopDelete in gleiche Ebene,
                                     // es ist nicht rejectable
                                     if ( ((ScChangeActionDel*)p)->IsTopDelete() )
-                                        rTable.Insert( p->GetActionNumber(), p );
+                                        rMap.insert( ::std::make_pair( p->GetActionNumber(), p ) );
                                 }
                                 else
-                                    rTable.Insert( p->GetActionNumber(), p );
+                                    rMap.insert( ::std::make_pair( p->GetActionNumber(), p ) );
                             }
                         }
                         pL = pL->GetNext();
@@ -3952,7 +3952,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
             while ( pL )
             {
                 ScChangeAction* p = (ScChangeAction*) pL->GetAction();
-                if ( p != pAct && rTable.Insert( p->GetActionNumber(), p ) )
+                if ( p != pAct && rMap.insert( ::std::make_pair( p->GetActionNumber(), p ) 
).second )
                 {
                     // nur ein TopContent einer Kette ist in LinkDeleted
                     if ( bAllFlat && (p->HasDeleted() ||
@@ -3972,7 +3972,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
                     if ( bAllFlat )
                     {
                         sal_uLong n = p->GetActionNumber();
-                        if ( !IsGenerated( n ) && rTable.Insert( n, p ) )
+                        if ( !IsGenerated( n ) && rMap.insert( ::std::make_pair( n, p ) ).second )
                             if ( p->HasDependent() || p->HasDeleted() )
                                 cStack.push( p );
                     }
@@ -3981,10 +3981,10 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
                         if ( p->GetType() == SC_CAT_CONTENT )
                         {
                             if ( ((ScChangeActionContent*)p)->IsTopContent() )
-                                rTable.Insert( p->GetActionNumber(), p );
+                                rMap.insert( ::std::make_pair( p->GetActionNumber(), p ) );
                         }
                         else
-                            rTable.Insert( p->GetActionNumber(), p );
+                            rMap.insert( ::std::make_pair( p->GetActionNumber(), p ) );
                     }
                 }
                 pL = pL->GetNext();
@@ -3997,14 +3997,14 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
             while ( ( pContent = pContent->GetPrevContent() ) != NULL )
             {
                 if ( !pContent->IsRejected() )
-                    rTable.Insert( pContent->GetActionNumber(), pContent );
+                    rMap.insert( ::std::make_pair( pContent->GetActionNumber(), pContent ) );
             }
             pContent = (ScChangeActionContent*) pCur;
             // alle nachfolgenden
             while ( ( pContent = pContent->GetNextContent() ) != NULL )
             {
                 if ( !pContent->IsRejected() )
-                    rTable.Insert( pContent->GetActionNumber(), pContent );
+                    rMap.insert( ::std::make_pair( pContent->GetActionNumber(), pContent ) );
             }
             // all MatrixReferences of a MatrixOrigin
             const ScChangeActionLinkEntry* pL = pCur->GetFirstDependentEntry();
@@ -4016,12 +4016,12 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
                     if ( bAllFlat )
                     {
                         sal_uLong n = p->GetActionNumber();
-                        if ( !IsGenerated( n ) && rTable.Insert( n, p ) )
+                        if ( !IsGenerated( n ) && rMap.insert( ::std::make_pair( n, p ) ).second )
                             if ( p->HasDependent() )
                                 cStack.push( p );
                     }
                     else
-                        rTable.Insert( p->GetActionNumber(), p );
+                        rMap.insert( ::std::make_pair( p->GetActionNumber(), p ) );
                 }
                 pL = pL->GetNext();
             }
@@ -4032,7 +4032,7 @@ void ScChangeTrack::GetDependents( ScChangeAction* pAct,
             {
                 ScChangeAction* p = GetAction(
                         ((ScChangeActionReject*)pCur)->GetRejectAction() );
-                if ( p != pAct && !rTable.Get( p->GetActionNumber() ) )
+                if ( p != pAct && rMap.find( p->GetActionNumber() ) != rMap.end() )
                     cStack.push( p );
             }
         }
@@ -4137,11 +4137,14 @@ sal_Bool ScChangeTrack::Accept( ScChangeAction* pAct )
 
     if ( pAct->IsDeleteType() || pAct->GetType() == SC_CAT_CONTENT )
     {
-        ScChangeActionTable aActionTable;
-        GetDependents( pAct, aActionTable, false, sal_True );
-        for ( ScChangeAction* p = aActionTable.First(); p; p = aActionTable.Next() )
+        ScChangeActionMap aActionMap;
+        ScChangeActionMap::iterator itChangeAction;
+
+        GetDependents( pAct, aActionMap, false, sal_True );
+
+        for( itChangeAction = aActionMap.begin(); itChangeAction != aActionMap.end(); 
++itChangeAction )
         {
-            p->Accept();
+            itChangeAction->second->Accept();
         }
     }
     pAct->Accept();
@@ -4171,20 +4174,20 @@ sal_Bool ScChangeTrack::Reject( ScChangeAction* pAct, bool bShared )
     if ( !pAct->IsRejectable() )
         return false;
 
-    ScChangeActionTable* pTable = NULL;
+    ScChangeActionMap* pMap = NULL;
     if ( pAct->HasDependent() )
     {
-        pTable = new ScChangeActionTable;
-        GetDependents( pAct, *pTable, false, sal_True );
+        pMap = new ScChangeActionMap;
+        GetDependents( pAct, *pMap, false, sal_True );
     }
-    sal_Bool bRejected = Reject( pAct, pTable, false );
-    if ( pTable )
-        delete pTable;
+    sal_Bool bRejected = Reject( pAct, pMap, false );
+    if ( pMap )
+        delete pMap;
     return bRejected;
 }
 
 
-sal_Bool ScChangeTrack::Reject( ScChangeAction* pAct, ScChangeActionTable* pTable,
+sal_Bool ScChangeTrack::Reject( ScChangeAction* pAct, ScChangeActionMap* pMap,
         sal_Bool bRecursion )
 {
     if ( !pAct->IsInternalRejectable() )
@@ -4196,16 +4199,17 @@ sal_Bool ScChangeTrack::Reject( ScChangeAction* pAct, ScChangeActionTable* 
pTabl
     {
         if ( pAct->HasDependent() && !bRecursion )
         {
-            OSL_ENSURE( pTable, "ScChangeTrack::Reject: Insert ohne Table" );
-            for ( ScChangeAction* p = pTable->Last(); p && bOk; p = pTable->Prev() )
+            OSL_ENSURE( pMap, "ScChangeTrack::Reject: Insert ohne map" );
+            ScChangeActionMap::iterator itChangeAction;
+            for( itChangeAction = pMap->begin(); itChangeAction != pMap->end() && bOk; 
++itChangeAction )
             {
                 // keine Contents restoren, die eh geloescht werden wuerden
-                if ( p->GetType() == SC_CAT_CONTENT )
-                    p->SetRejected();
-                else if ( p->IsDeleteType() )
-                    p->Accept();        // geloeschtes ins Nirvana
+                if ( itChangeAction->second->GetType() == SC_CAT_CONTENT )
+                    itChangeAction->second->SetRejected();
+                else if ( itChangeAction->second->IsDeleteType() )
+                    itChangeAction->second->Accept();        // geloeschtes ins Nirvana
                 else
-                    bOk = Reject( p, NULL, sal_True );      //! rekursiv
+                    bOk = Reject( itChangeAction->second, NULL, sal_True );      //! rekursiv
             }
         }
         if ( bOk && (bRejected = pAct->Reject( pDoc )) != false )
@@ -4217,7 +4221,7 @@ sal_Bool ScChangeTrack::Reject( ScChangeAction* pAct, ScChangeActionTable* 
pTabl
     }
     else if ( pAct->IsDeleteType() )
     {
-        OSL_ENSURE( !pTable, "ScChangeTrack::Reject: Delete mit Table" );
+        OSL_ENSURE( !pMap, "ScChangeTrack::Reject: Delete mit map" );
         ScBigRange aDelRange;
         sal_uLong nRejectAction = pAct->GetActionNumber();
         sal_Bool bTabDel, bTabDelOk;
@@ -4312,10 +4316,12 @@ sal_Bool ScChangeTrack::Reject( ScChangeAction* pAct, ScChangeActionTable* 
pTabl
     {
         if ( pAct->HasDependent() && !bRecursion )
         {
-            OSL_ENSURE( pTable, "ScChangeTrack::Reject: Move ohne Table" );
-            for ( ScChangeAction* p = pTable->Last(); p && bOk; p = pTable->Prev() )
+            OSL_ENSURE( pMap, "ScChangeTrack::Reject: Move ohne Map" );
+            ScChangeActionMap::reverse_iterator itChangeAction;
+
+            for( itChangeAction = pMap->rbegin(); itChangeAction != pMap->rend() && bOk; 
++itChangeAction )
             {
-                bOk = Reject( p, NULL, sal_True );      //! rekursiv
+                bOk = Reject( itChangeAction->second, NULL, sal_True );      //! rekursiv
             }
         }
         if ( bOk && (bRejected = pAct->Reject( pDoc )) != false )
@@ -4368,7 +4374,7 @@ sal_uLong ScChangeTrack::AddLoadedGenerated(ScBaseCell* pNewCell, const 
ScBigRan
             pFirstGeneratedDelContent->pPrev = pAct;
         pAct->pNext = pFirstGeneratedDelContent;
         pFirstGeneratedDelContent = pAct;
-        aGeneratedTable.Insert( pAct->GetActionNumber(), pAct );
+        aGeneratedMap.insert( ::std::make_pair( pAct->GetActionNumber(), pAct ) );
         return pAct->GetActionNumber();
     }
     return 0;
@@ -4376,7 +4382,7 @@ sal_uLong ScChangeTrack::AddLoadedGenerated(ScBaseCell* pNewCell, const 
ScBigRan
 
 void ScChangeTrack::AppendCloned( ScChangeAction* pAppend )
 {
-    aTable.Insert( pAppend->GetActionNumber(), pAppend );
+    aMap.insert( ::std::make_pair( pAppend->GetActionNumber(), pAppend ) );
     if ( !pLast )
         pFirst = pLast = pAppend;
     else
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx 
b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index 13c279f..e27ca39 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -657,12 +657,14 @@ void XclExpChTrAction::AddDependentContents(
         const XclExpRoot& rRoot,
         ScChangeTrack& rChangeTrack )
 {
-    ScChangeActionTable aActionTable;
-    rChangeTrack.GetDependents( (ScChangeAction*)(&rAction), aActionTable );
-    for( const ScChangeAction* pDepAction = aActionTable.First(); pDepAction; pDepAction = 
aActionTable.Next() )
-        if( pDepAction->GetType() == SC_CAT_CONTENT )
+    ScChangeActionMap aActionMap;
+    ScChangeActionMap::iterator itChangeAction;
+
+    rChangeTrack.GetDependents( (ScChangeAction*)(&rAction), aActionMap );
+    for( itChangeAction = aActionMap.begin(); itChangeAction != aActionMap.end(); ++itChangeAction 
)
+        if( itChangeAction->second->GetType() == SC_CAT_CONTENT )
             SetAddAction( new XclExpChTrCellContent(
-                *((const ScChangeActionContent*) pDepAction), rRoot, rIdBuffer ) );
+                *((const ScChangeActionContent*) itChangeAction->second), rRoot, rIdBuffer ) );
 }
 
 void XclExpChTrAction::SetIndex( sal_uInt32& rIndex )
diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx 
b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
index b39ad75..b2c8d1c 100644
--- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
@@ -56,7 +56,7 @@ ScChangeTrackingExportHelper::ScChangeTrackingExportHelper(ScXMLExport& rTempExp
     sChangeIDPrefix(RTL_CONSTASCII_USTRINGPARAM(SC_CHANGE_ID_PREFIX))
 {
     pChangeTrack = rExport.GetDocument() ? rExport.GetDocument()->GetChangeTrack() : NULL;
-    pDependings = new ScChangeActionTable();
+    pDependings = new ScChangeActionMap();
 }
 
 ScChangeTrackingExportHelper::~ScChangeTrackingExportHelper()
diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.hxx 
b/sc/source/filter/xml/XMLChangeTrackingExportHelper.hxx
index cfb518e..8e59ee6 100644
--- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.hxx
+++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.hxx
@@ -31,6 +31,8 @@
 
 #include <xmloff/xmltoken.hxx>
 #include <list>
+#include <map>
+#include <tools/solar.h>
 #include <com/sun/star/text/XText.hpp>
 #include <rtl/ustrbuf.hxx>
 
@@ -41,11 +43,11 @@ class ScBaseCell;
 class ScChangeActionDel;
 class ScBigRange;
 class ScEditEngineTextObj;
-class ScChangeActionTable;
 class String;
 class DateTime;
 
 typedef std::list<ScChangeActionDel*> ScMyDeletionsList;
+typedef std::map<sal_uLong, ScChangeAction*> ScChangeActionMap;
 
 class ScChangeTrackingExportHelper
 {
@@ -53,7 +55,7 @@ class ScChangeTrackingExportHelper
 
     ScChangeTrack*  pChangeTrack;
     ScEditEngineTextObj* pEditTextObj;
-    ScChangeActionTable* pDependings;
+    ScChangeActionMap* pDependings;
     rtl::OUString   sChangeIDPrefix;
     com::sun::star::uno::Reference<com::sun::star::text::XText> xText;
 
diff --git a/sc/source/ui/inc/acredlin.hxx b/sc/source/ui/inc/acredlin.hxx
index 2f9c066..417ed14 100644
--- a/sc/source/ui/inc/acredlin.hxx
+++ b/sc/source/ui/inc/acredlin.hxx
@@ -212,17 +212,17 @@ protected:
                                               SvLBoxEntry* pParent,sal_uLong nSpecial);
 
     void            GetDependents( const ScChangeAction* pScChangeAction,
-                                ScChangeActionTable& aActionTable,
+                                ScChangeActionMap& aActionMap,
                                 SvLBoxEntry* pEntry);
 
-    bool            InsertContentChildren(ScChangeActionTable* pActionTable,SvLBoxEntry* pParent);
+    bool            InsertContentChildren( ScChangeActionMap* pActionMap, SvLBoxEntry* pParent );
 
     bool            InsertAcceptedORejected(SvLBoxEntry* pParent);
 
-    bool            InsertDeletedChildren(const ScChangeAction *pChangeAction, 
ScChangeActionTable* pActionTable,
+    bool            InsertDeletedChildren( const ScChangeAction* pChangeAction, ScChangeActionMap* 
pActionMap,
                                         SvLBoxEntry* pParent);
 
-    bool            InsertChildren(ScChangeActionTable* pActionTable,SvLBoxEntry* pParent);
+    bool            InsertChildren( ScChangeActionMap* pActionMap, SvLBoxEntry* pParent );
 
     void            AppendChanges(ScChangeTrack* pChanges,sal_uLong nStartAction, sal_uLong 
nEndAction,
                                     sal_uLong nPos=LIST_APPEND);
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index b3deaea..a35f556 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -813,7 +813,6 @@ void ScAcceptChgDlg::UpdateView()
         if(pChanges!=NULL)
             pScChangeAction=pChanges->GetFirst();
     }
-    ScChangeActionTable ActionTable;
     bool bTheFlag = false;
 
     while(pScChangeAction!=NULL)
@@ -1168,7 +1167,7 @@ IMPL_LINK( ScAcceptChgDlg, SelectHandle, SvxRedlinTable*, EMPTYARG )
 }
 
 void ScAcceptChgDlg::GetDependents(  const ScChangeAction* pScChangeAction,
-                                    ScChangeActionTable& aActionTable,
+                                    ScChangeActionMap& aActionMap,
                                     SvLBoxEntry* pEntry)
 {
     ScChangeTrack* pChanges=pDoc->GetChangeTrack();
@@ -1181,17 +1180,17 @@ void ScAcceptChgDlg::GetDependents(  const ScChangeAction* pScChangeAction,
 
         if(pParentAction!=pScChangeAction)
             pChanges->GetDependents((ScChangeAction*) pScChangeAction,
-                        aActionTable,pScChangeAction->IsMasterDelete());
+                        aActionMap,pScChangeAction->IsMasterDelete());
         else
-            pChanges->GetDependents((ScChangeAction*) pScChangeAction,
-                        aActionTable);
+            pChanges->GetDependents( (ScChangeAction*) pScChangeAction,
+                        aActionMap );
     }
     else
         pChanges->GetDependents((ScChangeAction*) pScChangeAction,
-                    aActionTable,pScChangeAction->IsMasterDelete());
+                    aActionMap, pScChangeAction->IsMasterDelete() );
 }
 
-bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionTable* pActionTable,SvLBoxEntry* pParent)
+bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap,SvLBoxEntry* pParent)
 {
     bool bTheTestFlag = true;
     ScRedlinData *pEntryData=(ScRedlinData *)(pParent->GetUserData());
@@ -1205,23 +1204,27 @@ bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionTable* 
pActionTable,SvL
     if ( pScChangeAction->GetType() == SC_CAT_CONTENT &&
             ((const ScChangeActionContent*)pScChangeAction)->IsMatrixOrigin() )
     {
-        pActionTable->Insert( pScChangeAction->GetActionNumber(),
-            (ScChangeAction*) pScChangeAction );
+        pActionMap->insert( ::std::make_pair( pScChangeAction->GetActionNumber(),
+            const_cast<ScChangeAction*>( pScChangeAction ) ) );
         bParentInserted = true;
     }
     SvLBoxEntry* pEntry=NULL;
 
-    const ScChangeActionContent* pCChild=(const ScChangeActionContent*)pActionTable->First();
-    while(pCChild!=NULL)
+    ScChangeActionMap::iterator itChangeAction = pActionMap->begin();
+    while( itChangeAction != pActionMap->end() )
     {
-        if( pCChild->GetState()==SC_CAS_VIRGIN )
+        if( itChangeAction->second->GetState()==SC_CAS_VIRGIN )
             break;
-        pCChild=(const ScChangeActionContent*)pActionTable->Next();
+        ++itChangeAction;
     }
 
-    if(pCChild==NULL) return true;
+    if( itChangeAction != pActionMap->end() )
+        return true;
+
+    SvLBoxEntry* pOriginal = InsertChangeActionContent(
+        dynamic_cast<const ScChangeActionContent*>( itChangeAction->second ),
+        pParent, RD_SPECIAL_CONTENT );
 
-    SvLBoxEntry* pOriginal=InsertChangeActionContent(pCChild,pParent,RD_SPECIAL_CONTENT);
     if(pOriginal!=NULL)
     {
         bTheTestFlag=false;
@@ -1232,16 +1235,17 @@ bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionTable* 
pActionTable,SvL
         pParentData->bIsRejectable=false;
         pParentData->bDisabled=false;
     }
-    while(pCChild!=NULL)
+    while( itChangeAction != pActionMap->end() )
     {
-        if(pCChild->GetState()==SC_CAS_VIRGIN)
+        if( itChangeAction->second->GetState() == SC_CAS_VIRGIN )
         {
-            pEntry=InsertChangeActionContent(pCChild,pParent,RD_SPECIAL_NONE);
+            pEntry = InsertChangeActionContent( dynamic_cast<const ScChangeActionContent*>( 
itChangeAction->second ),
+                pParent, RD_SPECIAL_NONE );
 
             if(pEntry!=NULL)
                 bTheTestFlag=false;
         }
-        pCChild=(const ScChangeActionContent*)pActionTable->Next();
+        ++itChangeAction;
     }
 
     if ( !bParentInserted )
@@ -1293,15 +1297,16 @@ bool ScAcceptChgDlg::InsertAcceptedORejected(SvLBoxEntry* pParent)
     return bTheTestFlag;
 }
 
-bool ScAcceptChgDlg::InsertChildren(ScChangeActionTable* pActionTable,SvLBoxEntry* pParent)
+bool ScAcceptChgDlg::InsertChildren(ScChangeActionMap* pActionMap,SvLBoxEntry* pParent)
 {
     ScChangeTrack* pChanges=pDoc->GetChangeTrack();
     bool bTheTestFlag = true;
     SvLBoxEntry* pEntry=NULL;
-    const ScChangeAction* pChild=(const ScChangeAction*)pActionTable->First();
-    while(pChild!=NULL)
+    ScChangeActionMap::iterator itChangeAction;
+
+    for( itChangeAction = pActionMap->begin(); itChangeAction != pActionMap->end(); 
++itChangeAction )
     {
-        pEntry=InsertChangeAction(pChild,SC_CAS_VIRGIN,pParent,false,true);
+        pEntry=InsertChangeAction( itChangeAction->second, SC_CAS_VIRGIN, pParent, false, true );
 
         if(pEntry!=NULL)
         {
@@ -1312,30 +1317,28 @@ bool ScAcceptChgDlg::InsertChildren(ScChangeActionTable* 
pActionTable,SvLBoxEntr
             pEntryData->bIsAcceptable=false;
             pEntryData->bDisabled=true;
 
-            if(pChild->IsDialogParent())
-                Expand(pChanges,pChild,pEntry);
+            if( itChangeAction->second->IsDialogParent() )
+                Expand( pChanges, itChangeAction->second, pEntry );
         }
-        pChild=pActionTable->Next();
     }
     return bTheTestFlag;
 }
 
 bool ScAcceptChgDlg::InsertDeletedChildren(const ScChangeAction* pScChangeAction,
-                                         ScChangeActionTable* pActionTable,SvLBoxEntry* pParent)
+                                         ScChangeActionMap* pActionMap,SvLBoxEntry* pParent)
 {
     ScChangeTrack* pChanges=pDoc->GetChangeTrack();
     bool bTheTestFlag = true;
     SvLBoxEntry* pEntry=NULL;
-    ScChangeActionTable aDelActionTable;
-    const ScChangeAction* pChild=(const ScChangeAction*)pActionTable->First();
+    ScChangeActionMap::iterator itChangeAction;
 
-    while(pChild!=NULL)
+    for( itChangeAction = pActionMap->begin(); itChangeAction != pActionMap->end(); 
++itChangeAction )
     {
 
-        if(pScChangeAction!=pChild)
-            pEntry=InsertChangeAction(pChild,SC_CAS_VIRGIN,pParent,false,true);
+        if( pScChangeAction != itChangeAction->second )
+            pEntry = InsertChangeAction( itChangeAction->second, SC_CAS_VIRGIN, pParent, false, 
true );
         else
-            pEntry=InsertChangeAction(pChild,SC_CAS_VIRGIN,pParent,true,true);
+            pEntry = InsertChangeAction( itChangeAction->second, SC_CAS_VIRGIN, pParent, true, 
true );
 
         if(pEntry!=NULL)
         {
@@ -1346,10 +1349,9 @@ bool ScAcceptChgDlg::InsertDeletedChildren(const ScChangeAction* 
pScChangeAction
 
             bTheTestFlag=false;
 
-            if ( pChild->IsDialogParent() )
-                Expand(pChanges,pChild,pEntry);
+            if( itChangeAction->second->IsDialogParent() )
+                Expand( pChanges, itChangeAction->second, pEntry );
         }
-        pChild=pActionTable->Next();
     }
     return bTheTestFlag;
 }
@@ -1362,15 +1364,15 @@ bool ScAcceptChgDlg::Expand(
 
     if(pChanges!=NULL &&pEntry!=NULL &&pScChangeAction!=NULL)
     {
-        ScChangeActionTable aActionTable;
+        ScChangeActionMap aActionMap;
 
-        GetDependents( pScChangeAction,aActionTable,pEntry);
+        GetDependents( pScChangeAction, aActionMap, pEntry );
 
         switch(pScChangeAction->GetType())
         {
             case SC_CAT_CONTENT:
             {
-                InsertContentChildren(&aActionTable,pEntry);
+                InsertContentChildren( &aActionMap, pEntry );
                 bTheTestFlag=!bHasFilterEntry;
                 break;
             }
@@ -1378,18 +1380,18 @@ bool ScAcceptChgDlg::Expand(
             case SC_CAT_DELETE_ROWS:
             case SC_CAT_DELETE_TABS:
             {
-                InsertDeletedChildren(pScChangeAction,&aActionTable,pEntry);
+                InsertDeletedChildren( pScChangeAction, &aActionMap, pEntry );
                 bTheTestFlag=!bHasFilterEntry;
                 break;
             }
             default:
             {
                 if(!bFilter)
-                    bTheTestFlag=InsertChildren(&aActionTable,pEntry);
+                    bTheTestFlag = InsertChildren( &aActionMap, pEntry );
                 break;
             }
         }
-        aActionTable.Clear();
+        aActionMap.clear();
     }
     return bTheTestFlag;
 }
@@ -1401,7 +1403,7 @@ IMPL_LINK( ScAcceptChgDlg, ExpandingHandle, SvxRedlinTable*, pTable )
     SetPointer(Pointer(POINTER_WAIT));
     if(pTable!=NULL && pChanges!=NULL)
     {
-        ScChangeActionTable aActionTable;
+        ScChangeActionMap aActionMap;
         SvLBoxEntry* pEntry=pTheView->GetHdlEntry();
         if(pEntry!=NULL)
         {
@@ -1419,29 +1421,29 @@ IMPL_LINK( ScAcceptChgDlg, ExpandingHandle, SvxRedlinTable*, pTable )
                 {
                     pScChangeAction=(ScChangeAction*) pEntryData->pData;
 
-                    GetDependents( pScChangeAction,aActionTable,pEntry);
+                    GetDependents( pScChangeAction, aActionMap, pEntry );
 
                     switch(pScChangeAction->GetType())
                     {
                         case SC_CAT_CONTENT:
                         {
-                            bTheTestFlag=InsertContentChildren(&aActionTable,pEntry);
+                            bTheTestFlag = InsertContentChildren( &aActionMap, pEntry );
                             break;
                         }
                         case SC_CAT_DELETE_COLS:
                         case SC_CAT_DELETE_ROWS:
                         case SC_CAT_DELETE_TABS:
                         {
-                            
bTheTestFlag=InsertDeletedChildren(pScChangeAction,&aActionTable,pEntry);
+                            bTheTestFlag = InsertDeletedChildren( pScChangeAction, &aActionMap, 
pEntry );
                             break;
                         }
                         default:
                         {
-                            bTheTestFlag=InsertChildren(&aActionTable,pEntry);
+                            bTheTestFlag = InsertChildren( &aActionMap, pEntry );
                             break;
                         }
                     }
-                    aActionTable.Clear();
+                    aActionMap.clear();
 
                 }
                 else
@@ -1470,7 +1472,6 @@ void ScAcceptChgDlg::AppendChanges(ScChangeTrack* pChanges,sal_uLong 
nStartActio
         SetPointer(Pointer(POINTER_WAIT));
         pTheView->SetUpdateMode(false);
 
-        ScChangeActionTable ActionTable;
         bool bTheFlag = false;
 
         bool bFilterFlag = pTPFilter->IsDate() || pTPFilter->IsRange() ||


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.