[Libreoffice-commits] .: filter/inc filter/source

Joseph Powers jpowers at kemper.freedesktop.org
Sun Jun 12 11:49:30 PDT 2011


 filter/inc/filter/msfilter/svdfppt.hxx |    4 +++-
 filter/source/msfilter/svdfppt.cxx     |   31 +++++++++++++++++--------------
 2 files changed, 20 insertions(+), 15 deletions(-)

New commits:
commit a8e08a44e64fe524d5b09a5587849e4105d11f39
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Sun Jun 12 11:33:21 2011 -0700

    Replace List with std::vector< PPTBuGraEntry* >

diff --git a/filter/inc/filter/msfilter/svdfppt.hxx b/filter/inc/filter/msfilter/svdfppt.hxx
index e9984e2..0a2c90b 100644
--- a/filter/inc/filter/msfilter/svdfppt.hxx
+++ b/filter/inc/filter/msfilter/svdfppt.hxx
@@ -724,9 +724,11 @@ struct PPTBuGraEntry
                 PPTBuGraEntry( Graphic& rGraphic, sal_uInt32 nInstance );
 };
 
+typedef ::std::vector< PPTBuGraEntry* > PPTBuGraEntryList;
+
 class PPTExtParaProv
 {
-    List                aBuGraList;
+    PPTBuGraEntryList   aBuGraList;
 
 public :
     sal_Bool            bStyles;
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 8b8d306..9b91b87 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -3223,18 +3223,17 @@ sal_Bool PPTExtParaProv::GetGraphic( sal_uInt32 nInstance, Graphic& rGraph ) con
 {
     sal_Bool bRetValue = sal_False;
     PPTBuGraEntry* pPtr = NULL;
-    if ( nInstance < aBuGraList.Count() )
+    if ( nInstance < aBuGraList.size() )
     {
-        pPtr = (PPTBuGraEntry*)aBuGraList.GetObject( nInstance );
+        pPtr = aBuGraList[ nInstance ];
         if ( pPtr->nInstance == nInstance )
             bRetValue = sal_True;
     }
     if ( !bRetValue )
     {
-        sal_uInt32 i;
-        for ( i = 0; i < aBuGraList.Count(); i++ )
+        for (size_t i = 0; i < aBuGraList.size(); i++ )
         {
-            pPtr = (PPTBuGraEntry*)aBuGraList.GetObject( i );
+            pPtr = aBuGraList[ i ];
             if ( pPtr->nInstance == nInstance )
             {
                 bRetValue = sal_True;
@@ -3284,22 +3283,26 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const
                             {
                                 sal_uInt32 nInstance = aBuGraAtomHd.nRecInstance;
                                 PPTBuGraEntry* pBuGra = new PPTBuGraEntry( aGraphic, nInstance );
-                                sal_uInt32 n = 0;
-                                sal_uInt32 nBuGraCount = aBuGraList.Count();
+                                size_t n = 0;
+                                size_t nBuGraCount = aBuGraList.size();
                                 if ( nBuGraCount )
                                 {
-                                    if ( ( (PPTBuGraEntry*)aBuGraList.GetObject( nBuGraCount - 1 ) )->nInstance < nInstance )
+                                    if ( aBuGraList[ nBuGraCount - 1 ]->nInstance < nInstance )
                                         n = nBuGraCount;
                                     else
                                     {   // maybe the instances are not sorted, we sort it
                                         for ( n = 0; n < nBuGraCount; n++ )
                                         {   // sorting fields ( hi >> lo )
-                                            if ( ( (PPTBuGraEntry*)aBuGraList.GetObject( n ) )->nInstance < nInstance )
+                                            if ( aBuGraList[ n ]->nInstance < nInstance )
                                                 break;
                                         }
                                     }
                                 }
-                                aBuGraList.Insert( pBuGra, (sal_uInt32)n );
+                                if ( n < nBuGraCount ) {
+                                    aBuGraList.insert( aBuGraList.begin() + n, pBuGra );
+                                } else {
+                                    aBuGraList.push_back( pBuGra );
+                                }
                             }
 #ifdef DBG_UTIL
                             else OSL_FAIL( "PPTExParaProv::PPTExParaProv - bullet graphic is not valid (SJ)" );
@@ -3310,7 +3313,7 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const
 #endif
                         aBuGraAtomHd.SeekToEndOfRecord( rSt );
                     }
-                    if ( aBuGraList.Count() )
+                    if ( !aBuGraList.empty() )
                         bGraphics = sal_True;
                 }
                 break;
@@ -3392,9 +3395,9 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const
 
 PPTExtParaProv::~PPTExtParaProv()
 {
-    void* pPtr;
-    for ( pPtr = aBuGraList.First(); pPtr; pPtr = aBuGraList.Next() )
-        delete (PPTBuGraEntry*)pPtr;
+    for ( size_t i = 0, n = aBuGraList.size(); i < n; ++i )
+        delete aBuGraList[ i ];
+    aBuGraList.clear();
 }
 
 PPTNumberFormatCreator::PPTNumberFormatCreator( PPTExtParaProv* pParaProv ) :


More information about the Libreoffice-commits mailing list