[Libreoffice-commits] .: sc/source

Petr Mladek pmladek at kemper.freedesktop.org
Wed Jun 8 03:31:47 PDT 2011


 sc/source/filter/excel/excdoc.cxx            |   10 ++++++----
 sc/source/filter/inc/XclExpChangeTrack.hxx   |   18 +++++++++++++-----
 sc/source/filter/xcl97/XclExpChangeTrack.cxx |   11 ++++++-----
 3 files changed, 25 insertions(+), 14 deletions(-)

New commits:
commit b5feae757d14279216b68ae3a11e483c4841218f
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Tue Jun 7 20:29:41 2011 -0430

    Replace List with std::vector<XclExpUserBView*>.

diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index 180d57d..8dbc680 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -530,9 +530,10 @@ void ExcTable::FillAsTable( SCTAB nCodeNameIdx )
     // change tracking
     if( rR.pUserBViewList )
     {
-        for( const XclExpUserBView* pBView = rR.pUserBViewList->First(); pBView; pBView = rR.pUserBViewList->Next() )
+        XclExpUserBViewList::const_iterator iter;
+        for ( iter = rR.pUserBViewList->begin(); iter != rR.pUserBViewList->end(); ++iter)
         {
-            Add( new XclExpUsersViewBegin( pBView->GetGUID(), nExcTab ) );
+            Add( new XclExpUsersViewBegin( (*iter)->GetGUID(), nExcTab ) );
             Add( new XclExpUsersViewEnd );
         }
     }
@@ -619,9 +620,10 @@ void ExcTable::FillAsXmlTable( SCTAB nCodeNameIdx )
     // change tracking
     if( rR.pUserBViewList )
     {
-        for( const XclExpUserBView* pBView = rR.pUserBViewList->First(); pBView; pBView = rR.pUserBViewList->Next() )
+        XclExpUserBViewList::const_iterator iter;
+        for ( iter = rR.pUserBViewList->begin(); iter != rR.pUserBViewList->end(); ++iter )
         {
-            Add( new XclExpUsersViewBegin( pBView->GetGUID(), nExcTab ) );
+            Add( new XclExpUsersViewBegin( (*iter)->GetGUID(), nExcTab ) );
             Add( new XclExpUsersViewEnd );
         }
     }
diff --git a/sc/source/filter/inc/XclExpChangeTrack.hxx b/sc/source/filter/inc/XclExpChangeTrack.hxx
index ef98f77..2c71432 100644
--- a/sc/source/filter/inc/XclExpChangeTrack.hxx
+++ b/sc/source/filter/inc/XclExpChangeTrack.hxx
@@ -64,18 +64,26 @@ public:
 //___________________________________________________________________
 // XclExpUserBViewList - list of UserBView records
 
-class XclExpUserBViewList : public ExcEmptyRec, private List
+class XclExpUserBViewList : public ExcEmptyRec
 {
 private:
-    inline XclExpUserBView*		_First()	{ return (XclExpUserBView*) List::First(); }
-    inline XclExpUserBView*		_Next()		{ return (XclExpUserBView*) List::Next(); }
+    std::vector<XclExpUserBView*> aViews;
 
 public:
+
+    typedef std::vector<XclExpUserBView*>::iterator iterator;
+    typedef std::vector<XclExpUserBView*>::const_iterator const_iterator;
+
                                 XclExpUserBViewList( const ScChangeTrack& rChangeTrack );
     virtual						~XclExpUserBViewList();
 
-    inline const XclExpUserBView* First()	{ return (const XclExpUserBView*) List::First(); }
-    inline const XclExpUserBView* Next()	{ return (const XclExpUserBView*) List::Next(); }
+    inline iterator begin () { return aViews.begin(); }
+
+    inline iterator end () { return aViews.end(); }
+
+    inline const_iterator begin () const { return aViews.begin(); }
+
+    inline const_iterator end () const { return aViews.end(); }
 
     virtual void				Save( XclExpStream& rStrm );
 };
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index cd78aba..d28fc21 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -151,25 +151,26 @@ XclExpUserBViewList::XclExpUserBViewList( const ScChangeTrack& rChangeTrack )
     sal_uInt8 aGUID[ 16 ];
     sal_Bool bValidGUID = false;
     const ScStrCollection& rStrColl = rChangeTrack.GetUserCollection();
+    aViews.reserve(rChangeTrack.GetUserCollection().GetCount());
     for( sal_uInt16 nIndex = 0; nIndex < rStrColl.GetCount(); nIndex++ )
     {
         const StrData* pStrData = (const StrData*) rStrColl.At( nIndex );
         lcl_GenerateGUID( aGUID, bValidGUID );
         if( pStrData )
-            List::Insert( new XclExpUserBView( pStrData->GetString(), aGUID ), LIST_APPEND );
+            aViews.push_back( new XclExpUserBView( pStrData->GetString(), aGUID ) );
     }
 }
 
 XclExpUserBViewList::~XclExpUserBViewList()
 {
-    for( XclExpUserBView* pRec = _First(); pRec; pRec = _Next() )
-        delete pRec;
+    for( iterator iter = aViews.begin(); iter != aViews.end(); ++iter )
+        delete *iter;
 }
 
 void XclExpUserBViewList::Save( XclExpStream& rStrm )
 {
-    for( XclExpUserBView* pRec = _First(); pRec; pRec = _Next() )
-        pRec->Save( rStrm );
+   for( iterator iter = aViews.begin(); iter != aViews.end(); ++iter )
+        (*iter)->Save( rStrm );
 }
 
 //___________________________________________________________________


More information about the Libreoffice-commits mailing list