[Libreoffice-commits] .: sd/source

Katarina Machalkova bubli at kemper.freedesktop.org
Wed Apr 27 09:15:49 PDT 2011


 sd/source/filter/eppt/epptbase.hxx  |   37 ++++++++++++++++++++++++------------
 sd/source/filter/eppt/pptx-text.cxx |    8 ++-----
 2 files changed, 28 insertions(+), 17 deletions(-)

New commits:
commit 5ab760685923c994f167ccc3b493e78570343537
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Fri Mar 25 17:16:44 2011 -0430

    Remove deprecated List container in FontCollection.

diff --git a/sd/source/filter/eppt/epptbase.hxx b/sd/source/filter/eppt/epptbase.hxx
index 77b6aa6..5eb7a25 100644
--- a/sd/source/filter/eppt/epptbase.hxx
+++ b/sd/source/filter/eppt/epptbase.hxx
@@ -29,8 +29,9 @@
 #ifndef EPPT_EPPTBASE_HXX
 #define EPPT_EPPTBASE_HXX
 
-#include "grouptable.hxx"
 #include <vector>
+#include <boost/ptr_container/ptr_vector.hpp>
+
 #include <vcl/mapmod.hxx>
 #include <tools/list.hxx>
 #include <tools/string.hxx>
@@ -45,6 +46,8 @@
 #include <com/sun/star/presentation/FadeEffect.hpp>
 #include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
 
+#include "grouptable.hxx"
+
 // PLACEMENT_ID
 #define EPP_LAYOUT_TITLESLIDE             0 /* The slide is a title slide                                                             */
 #define EPP_LAYOUT_TITLEANDBODYSLIDE      1 /* Title and body slide                                                                   */
@@ -180,18 +183,28 @@ struct FontCollectionEntry
 };
 
 class VirtualDevice;
-class FontCollection : private List
+class FontCollection
 {
-        VirtualDevice* pVDev;
-    public :
-                    FontCollection();
-                    ~FontCollection();
-
-        short       GetScriptDirection( const String& rText ) const;
-        sal_uInt32  GetId( FontCollectionEntry& rFontDescriptor );
-    sal_uInt32  GetCount() const { return List::Count(); };
-        const FontCollectionEntry*                      GetById( sal_uInt32 nId );
-        FontCollectionEntry&    GetLast() { return *(FontCollectionEntry*)List::Last(); };
+public :
+
+    FontCollection();
+
+    ~FontCollection();
+
+    short GetScriptDirection( const String& rText ) const;
+
+    sal_uInt32  GetId( FontCollectionEntry& rFontDescriptor );
+
+    inline sal_uInt32  GetCount() const { return maFonts.size(); };
+
+    const FontCollectionEntry* GetById( sal_uInt32 nId );
+
+    FontCollectionEntry& GetLast() { return *(maFonts.rbegin()); };
+
+private:
+
+    VirtualDevice* pVDev;
+    boost::ptr_vector<FontCollectionEntry> maFonts;
 };
 
 // ------------------------------------------------------------------------
diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx
index abc9755..bfdf5d1 100644
--- a/sd/source/filter/eppt/pptx-text.cxx
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -1352,8 +1352,6 @@ void FontCollectionEntry::ImplInit( const String& rName )
 
 FontCollection::~FontCollection()
 {
-    for( void* pStr = List::First(); pStr; pStr = List::Next() )
-        delete (FontCollectionEntry*)pStr;
     delete pVDev;
     xPPTBreakIter = NULL;
     xScriptTypeDetector = NULL;
@@ -1391,7 +1389,7 @@ sal_uInt32 FontCollection::GetId( FontCollectionEntry& rEntry )
 {
     if( rEntry.Name.Len() )
     {
-        const sal_uInt32 nFonts = GetCount();
+        const sal_uInt32 nFonts = maFonts.size();
 
         for( sal_uInt32 i = 0; i < nFonts; i++ )
         {
@@ -1419,7 +1417,7 @@ sal_uInt32 FontCollection::GetId( FontCollectionEntry& rEntry )
                 rEntry.Scaling = fScaling;
         }
 
-        List::Insert( new FontCollectionEntry( rEntry ), LIST_APPEND );
+        maFonts.push_back(new FontCollectionEntry(rEntry));
         return nFonts;
     }
     return 0;
@@ -1427,7 +1425,7 @@ sal_uInt32 FontCollection::GetId( FontCollectionEntry& rEntry )
 
 const FontCollectionEntry* FontCollection::GetById( sal_uInt32 nId )
 {
-    return (FontCollectionEntry*)List::GetObject( nId );
+    return nId < maFonts.size() ? &maFonts[nId] : NULL;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list