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



From 0ba99ef77cf0d52331a444a3563f984e760d0db2 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Thu, 2 Jun 2011 15:47:04 -0430
Subject: [PATCH 2/5] Replace List with std::vector<XclExpUserBView*>.

Change how we iterate a XclExpUserBViewList to prevent oob access.
---
 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(-)

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..7184b63 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -147,6 +147,7 @@ sal_Size XclExpUserBView::GetLen() const
 //___________________________________________________________________
 
 XclExpUserBViewList::XclExpUserBViewList( const ScChangeTrack& rChangeTrack )
+    : aViews(rChangeTrack.GetUserCollection().GetCount())
 {
     sal_uInt8 aGUID[ 16 ];
     sal_Bool bValidGUID = false;
@@ -156,20 +157,20 @@ XclExpUserBViewList::XclExpUserBViewList( const ScChangeTrack& rChangeTrack )
         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 );
 }
 
 //___________________________________________________________________
-- 
1.7.3.4

From 12c03ae988a406a5332cf932bb1e068e6addde1d Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Thu, 2 Jun 2011 16:10:54 -0430
Subject: [PATCH 3/5] Replace List for std::vector<ExcEScenarioCell>.

---
 sc/source/filter/inc/xcl97rec.hxx   |    7 +++----
 sc/source/filter/xcl97/xcl97rec.cxx |   35 ++++++++++++++++++-----------------
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/sc/source/filter/inc/xcl97rec.hxx b/sc/source/filter/inc/xcl97rec.hxx
index c92557b..b679abe 100644
--- a/sc/source/filter/inc/xcl97rec.hxx
+++ b/sc/source/filter/inc/xcl97rec.hxx
@@ -374,17 +374,16 @@ public:
 
 
 
-class ExcEScenario : public ExcRecord, private List
+class ExcEScenario : public ExcRecord
 {
 private:
     sal_Size                    nRecLen;
     XclExpString                sName;
     XclExpString                sComment;
     XclExpString                sUserName;
-    sal_uInt8                       nProtected;
+    sal_uInt8                   nProtected;
 
-    inline ExcEScenarioCell*   _First()        { return (ExcEScenarioCell*) List::First(); }
-    inline ExcEScenarioCell*   _Next()         { return (ExcEScenarioCell*) List::Next(); }
+    std::vector<ExcEScenarioCell> aCells;
 
     sal_Bool                                           Append( sal_uInt16 nCol, sal_uInt16 nRow, 
const String& rTxt );
 
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 085c378..6e02c1a 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1244,25 +1244,25 @@ ExcEScenario::ExcEScenario( const XclExpRoot& rRoot, SCTAB nTab )
 
 ExcEScenario::~ExcEScenario()
 {
-    for( ExcEScenarioCell* pCell = _First(); pCell; pCell = _Next() )
-        delete pCell;
 }
 
 sal_Bool ExcEScenario::Append( sal_uInt16 nCol, sal_uInt16 nRow, const String& rTxt )
 {
-    if( List::Count() == EXC_SCEN_MAXCELL )
+    if( aCells.size() == EXC_SCEN_MAXCELL )
         return false;
 
-    ExcEScenarioCell* pCell = new ExcEScenarioCell( nCol, nRow, rTxt );
-    List::Insert( pCell, LIST_APPEND );
-    nRecLen += 6 + pCell->GetStringBytes();        // 4 bytes address, 2 bytes ifmt
+    ExcEScenarioCell aCell(nCol, nRow, rTxt);
+    aCells.push_back(aCell);
+    nRecLen += 6 + aCell.GetStringBytes();        // 4 bytes address, 2 bytes ifmt
     return sal_True;
 }
 
 void ExcEScenario::SaveCont( XclExpStream& rStrm )
 {
-    rStrm      << (sal_uInt16) List::Count()           // number of cells
-            << nProtected                          // fProtection
+    sal_uInt16 count = aCells.size();
+
+    rStrm      << (sal_uInt16) count                   // number of cells
+            << nProtected                              // fProtection
             << (sal_uInt8) 0                                   // fHidden
             << (sal_uInt8) sName.Len()          // length of scen name
             << (sal_uInt8) sComment.Len()       // length of comment
@@ -1275,13 +1275,13 @@ void ExcEScenario::SaveCont( XclExpStream& rStrm )
     if( sComment.Len() )
         rStrm << sComment;
 
-    ExcEScenarioCell* pCell;
-    for( pCell = _First(); pCell; pCell = _Next() )
-        pCell->WriteAddress( rStrm );                  // pos of cell
-    for( pCell = _First(); pCell; pCell = _Next() )
-        pCell->WriteText( rStrm );                             // string content
+    std::vector<ExcEScenarioCell>::iterator pIter;
+    for( pIter = aCells.begin(); pIter != aCells.end(); ++pIter )
+        pIter->WriteAddress( rStrm );                  // pos of cell
+    for( pIter = aCells.begin(); pIter != aCells.end(); ++pIter )
+        pIter->WriteText( rStrm );                             // string content
     rStrm.SetSliceSize( 2 );
-    rStrm.WriteZeroBytes( 2 * List::Count() );  // date format
+    rStrm.WriteZeroBytes( 2 * count );  // date format
 }
 
 sal_uInt16 ExcEScenario::GetNum() const
@@ -1301,13 +1301,14 @@ void ExcEScenario::SaveXml( XclExpXmlStream& rStrm )
             XML_name,       XclXmlUtils::ToOString( sName ).getStr(),
             XML_locked,     XclXmlUtils::ToPsz( nProtected ),
             // OOXTODO: XML_hidden,
-            XML_count,      OString::valueOf( (sal_Int32) List::Count() ).getStr(),
+            XML_count,      OString::valueOf( (sal_Int32) aCells.size() ).getStr(),
             XML_user,       XESTRING_TO_PSZ( sUserName ),
             XML_comment,    XESTRING_TO_PSZ( sComment ),
             FSEND );
 
-    for( ExcEScenarioCell* pCell = _First(); pCell; pCell = _Next() )
-        pCell->SaveXml( rStrm );
+    std::vector<ExcEScenarioCell>::iterator pIter;
+    for( pIter = aCells.begin(); pIter != aCells.end(); ++pIter )
+        pIter->SaveXml( rStrm );
 
     rWorkbook->endElement( XML_scenario );
 }
-- 
1.7.3.4

From 0c6c8718edec6d4bd91a32476d0f60821d210340 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Thu, 2 Jun 2011 16:14:15 -0430
Subject: [PATCH 4/5] Make read only functions in ExcEScenarioCell const.

---
 sc/source/filter/inc/xcl97rec.hxx   |    8 ++++----
 sc/source/filter/xcl97/xcl97rec.cxx |    6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/sc/source/filter/inc/xcl97rec.hxx b/sc/source/filter/inc/xcl97rec.hxx
index b679abe..6f768c0 100644
--- a/sc/source/filter/inc/xcl97rec.hxx
+++ b/sc/source/filter/inc/xcl97rec.hxx
@@ -363,13 +363,13 @@ protected:
 public:
                                 ExcEScenarioCell( sal_uInt16 nC, sal_uInt16 nR, const String& rTxt 
);
 
-    inline sal_Size             GetStringBytes()
+    inline sal_Size             GetStringBytes() const
                                     { return sText.GetSize(); }
 
-    void                                               WriteAddress( XclExpStream& rStrm );
-    void                                               WriteText( XclExpStream& rStrm );
+    void                                               WriteAddress( XclExpStream& rStrm ) const ;
+    void                                               WriteText( XclExpStream& rStrm ) const;
 
-    void                        SaveXml( XclExpXmlStream& rStrm );
+    void                        SaveXml( XclExpXmlStream& rStrm ) const;
 };
 
 
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 6e02c1a..7c1c19d 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1164,17 +1164,17 @@ ExcEScenarioCell::ExcEScenarioCell( sal_uInt16 nC, sal_uInt16 nR, const 
String&
 {
 }
 
-void ExcEScenarioCell::WriteAddress( XclExpStream& rStrm )
+void ExcEScenarioCell::WriteAddress( XclExpStream& rStrm ) const
 {
     rStrm << nRow << nCol;
 }
 
-void ExcEScenarioCell::WriteText( XclExpStream& rStrm )
+void ExcEScenarioCell::WriteText( XclExpStream& rStrm ) const
 {
     rStrm << sText;
 }
 
-void ExcEScenarioCell::SaveXml( XclExpXmlStream& rStrm )
+void ExcEScenarioCell::SaveXml( XclExpXmlStream& rStrm ) const
 {
     rStrm.GetCurrentStream()->singleElement( XML_inputCells,
             // OOXTODO: XML_deleted,
-- 
1.7.3.4

From c6431dd64daec1e91841e1df2cb06cf1ce7b4e30 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Thu, 2 Jun 2011 16:30:44 -0430
Subject: [PATCH 5/5] Replace List for std::vector<ExcEScenario*>.

---
 sc/source/filter/inc/xcl97rec.hxx   |    9 ++-------
 sc/source/filter/xcl97/xcl97rec.cxx |   25 ++++++++++++++-----------
 2 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/sc/source/filter/inc/xcl97rec.hxx b/sc/source/filter/inc/xcl97rec.hxx
index 6f768c0..7248bd9 100644
--- a/sc/source/filter/inc/xcl97rec.hxx
+++ b/sc/source/filter/inc/xcl97rec.hxx
@@ -402,16 +402,11 @@ public:
 
 
 
-class ExcEScenarioManager : public ExcRecord, private List
+class ExcEScenarioManager : public ExcRecord
 {
 private:
     sal_uInt16                                         nActive;
-
-    inline ExcEScenario*               _First()        { return (ExcEScenario*) List::First(); }
-    inline ExcEScenario*               _Next()         { return (ExcEScenario*) List::Next(); }
-
-    inline void                                        Append( ExcEScenario* pScen )
-                                    { List::Insert( pScen, LIST_APPEND ); }
+    std::vector<ExcEScenario*> aScenes;
 
     virtual void                               SaveCont( XclExpStream& rStrm );
 
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 7c1c19d..7c8c921 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1328,7 +1328,7 @@ ExcEScenarioManager::ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB nTab 
)
 
     while( rDoc.IsScenario( nNewTab ) )
     {
-        Append( new ExcEScenario( rRoot, nNewTab ) );
+        aScenes.push_back( new ExcEScenario( rRoot, nNewTab ) );
 
         if( rDoc.IsActiveScenario( nNewTab ) )
             nActive = static_cast<sal_uInt16>(nNewTab - nFirstTab);
@@ -1338,30 +1338,32 @@ ExcEScenarioManager::ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB 
nTab )
 
 ExcEScenarioManager::~ExcEScenarioManager()
 {
-    for( ExcEScenario* pScen = _First(); pScen; pScen = _Next() )
-        delete pScen;
+    std::vector<ExcEScenario*>::iterator pIter;
+    for( pIter = aScenes.begin(); pIter != aScenes.end(); ++pIter )
+        delete *pIter;
 }
 
 void ExcEScenarioManager::SaveCont( XclExpStream& rStrm )
 {
-    rStrm      << (sal_uInt16) List::Count()           // number of scenarios
+    rStrm      << (sal_uInt16) aScenes.size()  // number of scenarios
             << nActive                                         // active scen
             << nActive                                         // last displayed
-            << (sal_uInt16) 0;                                 // reference areas
+            << (sal_uInt16) 0;                         // reference areas
 }
 
 void ExcEScenarioManager::Save( XclExpStream& rStrm )
 {
-    if( List::Count() )
+    if( !aScenes.empty() )
         ExcRecord::Save( rStrm );
 
-    for( ExcEScenario* pScen = _First(); pScen; pScen = _Next() )
-        pScen->Save( rStrm );
+    std::vector<ExcEScenario*>::iterator pIter;
+    for( pIter = aScenes.begin(); pIter != aScenes.end(); ++pIter )
+        (*pIter)->Save( rStrm );
 }
 
 void ExcEScenarioManager::SaveXml( XclExpXmlStream& rStrm )
 {
-    if( ! List::Count() )
+    if( aScenes.empty() )
         return;
 
     sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream();
@@ -1371,8 +1373,9 @@ void ExcEScenarioManager::SaveXml( XclExpXmlStream& rStrm )
             // OOXTODO: XML_sqref,
             FSEND );
 
-    for( ExcEScenario* pScen = _First(); pScen; pScen = _Next() )
-        pScen->SaveXml( rStrm );
+    std::vector<ExcEScenario*>::iterator pIter;
+    for( pIter = aScenes.begin(); pIter != aScenes.end(); ++pIter )
+        (*pIter)->SaveXml( rStrm );
 
     rWorkbook->endElement( XML_scenarios );
 }
-- 
1.7.3.4

From 5f63a5c46dea18bb7a05f4fcc479c559c18f1fc9 Mon Sep 17 00:00:00 2001
From: Rafael Dominguez <venccsralph@gmail.com>
Date: Thu, 2 Jun 2011 17:20:50 -0430
Subject: [PATCH] Replace List for std::vector<XclObj*>.

Added extra functions to iterate and delete last element.
---
 sc/source/filter/excel/xeescher.cxx |    6 ++--
 sc/source/filter/inc/xcl97rec.hxx   |   28 ++++++++++++++--
 sc/source/filter/xcl97/xcl97rec.cxx |   60 +++++++++++++++++++++-------------
 3 files changed, 64 insertions(+), 30 deletions(-)

diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx
index c8b6cfc..e466614 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -1605,7 +1605,7 @@ XclExpMsoDrawing* XclExpObjectManager::GetMsodrawingPerSheet()
 
 bool XclExpObjectManager::HasObj() const
 {
-    return mxObjList->Count() > 0;
+    return !mxObjList->empty();
 }
 
 sal_uInt16 XclExpObjectManager::AddObj( XclObj* pObjRec )
@@ -1615,8 +1615,8 @@ sal_uInt16 XclExpObjectManager::AddObj( XclObj* pObjRec )
 
 XclObj* XclExpObjectManager::RemoveLastObj()
 {
-    XclObj* pLastObj = static_cast< XclObj* >( mxObjList->Last() );
-    mxObjList->Remove();    // remove current, which is the Last()
+    XclObj* pLastObj = mxObjList->back();
+    mxObjList->pop_back();
     return pLastObj;
 }
 
diff --git a/sc/source/filter/inc/xcl97rec.hxx b/sc/source/filter/inc/xcl97rec.hxx
index 7248bd9..147c9c9 100644
--- a/sc/source/filter/inc/xcl97rec.hxx
+++ b/sc/source/filter/inc/xcl97rec.hxx
@@ -39,19 +39,37 @@ class XclObj;
 class XclExpMsoDrawing;
 class SdrCaptionObj;
 
-class XclExpObjList : public List, public ExcEmptyRec, protected XclExpRoot
+class XclExpObjList : public ExcEmptyRec, protected XclExpRoot
 {
 public:
+
+    typedef std::vector<XclObj*>::iterator iterator;
+
     explicit            XclExpObjList( const XclExpRoot& rRoot, XclEscherEx& rEscherEx );
     virtual             ~XclExpObjList();
 
-    XclObj*             First() { return (XclObj*) List::First(); }
-    XclObj*             Next() { return (XclObj*) List::Next(); }
-
     /// return: 1-based ObjId
     ///! count>=0xFFFF: Obj will be deleted, return 0
     sal_uInt16              Add( XclObj* );
 
+    XclObj* back () { return maObjs.empty() ? NULL : maObjs.back(); }
+
+    /**
+     *
+     * @brief Remove last element in the list.
+     *
+     */
+
+    void pop_back ();
+
+    inline bool empty () const { return maObjs.empty(); }
+
+    inline sal_uInt16 size () const { return static_cast<sal_uInt16>(maObjs.size()); }
+
+    inline iterator begin () { return maObjs.begin(); }
+
+    inline iterator end () { return maObjs.end(); }
+
     inline XclExpMsoDrawing* GetMsodrawingPerSheet() { return pMsodrawingPerSheet; }
 
                                 /// close groups and DgContainer opened in ctor
@@ -69,6 +87,8 @@ private:
     XclEscherEx&        mrEscherEx;
     XclExpMsoDrawing*   pMsodrawingPerSheet;
     XclExpMsoDrawing*   pSolverContainer;
+
+    std::vector<XclObj*> maObjs;
 };
 
 
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 7c8c921..31c3419 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -118,28 +118,38 @@ XclExpObjList::XclExpObjList( const XclExpRoot& rRoot, XclEscherEx& rEscherEx 
)
 
 XclExpObjList::~XclExpObjList()
 {
-    for ( XclObj* p = First(); p; p = Next() )
-        delete p;
+    std::vector<XclObj*>::iterator pIter;
+    for ( pIter = maObjs.begin(); pIter != maObjs.end(); ++pIter )
+        delete *pIter;
     delete pMsodrawingPerSheet;
     delete pSolverContainer;
 }
 
 sal_uInt16 XclExpObjList::Add( XclObj* pObj )
 {
-    OSL_ENSURE( Count() < 0xFFFF, "XclExpObjList::Add: too much for Xcl" );
-    if ( Count() < 0xFFFF )
+    OSL_ENSURE( maObjs.size() < 0xFFFF, "XclExpObjList::Add: too much for Xcl" );
+
+    sal_uInt16 nSize = maObjs.size();
+
+    if ( nSize < 0xFFFF )
     {
-        Insert( pObj, LIST_APPEND );
-        sal_uInt16 nCnt = (sal_uInt16) Count();
-        pObj->SetId( nCnt );
+        maObjs.push_back(pObj);
+        ++nSize;
+        pObj->SetId( nSize );
         pObj->SetTab( mnScTab );
-        return nCnt;
     }
     else
     {
         delete pObj;
-        return 0;
+        nSize = 0;
     }
+
+    return nSize;
+}
+
+void XclExpObjList::pop_back ()
+{
+    maObjs.pop_back();
 }
 
 void XclExpObjList::EndSheet()
@@ -157,16 +167,17 @@ void XclExpObjList::Save( XclExpStream& rStrm )
     //! Escher must be written, even if there are no objects
     pMsodrawingPerSheet->Save( rStrm );
 
-    for ( XclObj* p = First(); p; p = Next() )
-        p->Save( rStrm );
+    std::vector<XclObj*>::iterator pIter;
+    for ( pIter = maObjs.begin(); pIter != maObjs.end(); ++pIter )
+        (*pIter)->Save( rStrm );
 
     if( pSolverContainer )
         pSolverContainer->Save( rStrm );
 }
 
-static bool IsVmlObject( const XclObj& rObj )
+static bool IsVmlObject( const XclObj *rObj )
 {
-    switch( rObj.GetObjType() )
+    switch( rObj->GetObjType() )
     {
         case EXC_OBJTYPE_NOTE:
             return true;
@@ -180,8 +191,9 @@ static sal_Int32 GetVmlObjectCount( XclExpObjList& rList )
 {
     sal_Int32 nNumVml = 0;
 
-    for ( XclObj* p = rList.First(); p; p = rList.Next() )
-        if( IsVmlObject( *p ) )
+    std::vector<XclObj*>::iterator pIter;
+    for ( pIter = rList.begin(); pIter != rList.end(); ++pIter )
+        if( IsVmlObject( *pIter ) )
             ++nNumVml;
 
     return nNumVml;
@@ -191,7 +203,7 @@ static sal_Int32 GetVmlObjectCount( XclExpObjList& rList )
 static void SaveDrawingMLObjects( XclExpObjList& rList, XclExpXmlStream& rStrm, sal_Int32& 
nDrawingMLCount )
 {
     sal_Int32 nVmlObjects = GetVmlObjectCount( rList );
-    if( (rList.Count() - nVmlObjects) == 0 )
+    if( (rList.size() - nVmlObjects) == 0 )
         return;
 
     sal_Int32 nDrawing = ++nDrawingMLCount;
@@ -215,11 +227,12 @@ static void SaveDrawingMLObjects( XclExpObjList& rList, XclExpXmlStream& 
rStrm,
             FSNS( XML_xmlns, XML_r ),   
"http://schemas.openxmlformats.org/officeDocument/2006/relationships";,
             FSEND );
 
-    for ( XclObj* p = rList.First(); p; p = rList.Next() )
+    std::vector<XclObj*>::iterator pIter;
+    for ( pIter = rList.begin(); pIter != rList.end(); ++pIter )
     {
-        if( IsVmlObject( *p ) )
+        if( IsVmlObject( *pIter ) )
             continue;
-        p->SaveXml( rStrm );
+        (*pIter)->SaveXml( rStrm );
     }
 
     pDrawing->endElement( FSNS( XML_xdr, XML_wsDr ) );
@@ -254,11 +267,12 @@ static void SaveVmlObjects( XclExpObjList& rList, XclExpXmlStream& rStrm, 
sal_In
             FSNS( XML_xmlns, XML_x ),   "urn:schemas-microsoft-com:office:excel",
             FSEND );
 
-    for ( XclObj* p = rList.First(); p; p = rList.Next() )
+    std::vector<XclObj*>::iterator pIter;
+    for ( pIter = rList.begin(); pIter != rList.end(); ++pIter )
     {
-        if( !IsVmlObject( *p ) )
+        if( !IsVmlObject( *pIter ) )
             continue;
-        p->SaveXml( rStrm );
+        (*pIter)->SaveXml( rStrm );
     }
 
     pVmlDrawing->endElement( XML_xml );
@@ -272,7 +286,7 @@ void XclExpObjList::SaveXml( XclExpXmlStream& rStrm )
     if( pSolverContainer )
         pSolverContainer->SaveXml( rStrm );
 
-    if( Count() == 0 )
+    if( maObjs.empty())
         return;
 
     SaveDrawingMLObjects( *this, rStrm, mnDrawingMLCount );
-- 
1.7.3.4


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.