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

Joseph Powers jpowers at kemper.freedesktop.org
Sat Feb 5 07:26:04 PST 2011


 svtools/inc/ctrlbox.hxx            |    7 ++++---
 svtools/source/control/ctrlbox.cxx |   20 +++++++++++---------
 2 files changed, 15 insertions(+), 12 deletions(-)

New commits:
commit 4a94538e9ba45ce65148d85ffa2dee52c5275ef8
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Sat Feb 5 07:25:59 2011 -0800

    Remove DECLARE_LIST( ImplFontList, ImplFontNameListData* )

diff --git a/svtools/inc/ctrlbox.hxx b/svtools/inc/ctrlbox.hxx
index 9c20a22..03a7fdd 100644
--- a/svtools/inc/ctrlbox.hxx
+++ b/svtools/inc/ctrlbox.hxx
@@ -38,13 +38,14 @@
 #include <vcl/metric.hxx>
 #include <vcl/field.hxx>
 
-class ImplFontList;
 class FontList;
 class ImplColorListData;
 class ImpLineListData;
+class ImplFontNameListData;
 
-typedef ::std::vector< ImplColorListData* > ImpColorList;
-typedef ::std::vector< ImpLineListData* > ImpLineList;
+typedef ::std::vector< ImplColorListData*    > ImpColorList;
+typedef ::std::vector< ImpLineListData*      > ImpLineList;
+typedef ::std::vector< ImplFontNameListData* > ImplFontList;
 
 #define STYLE_SOLID     ( ( USHORT ) 0 )
 #define STYLE_DOTTED    ( ( USHORT ) 1 )
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 9ff3b1f..37bb9d0 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -745,8 +745,6 @@ struct ImplFontNameListData
                 {}
 };
 
-DECLARE_LIST( ImplFontList, ImplFontNameListData* )
-
 // -------------------------------------------------------------------
 
 FontNameBox::FontNameBox( Window* pParent, WinBits nWinStyle ) :
@@ -801,12 +799,10 @@ void FontNameBox::ImplDestroyFontList()
 {
     if ( mpFontList )
     {
-        ImplFontNameListData* pInfo = mpFontList->First();
-        while ( pInfo )
-        {
-            delete pInfo;
-            pInfo = mpFontList->Next();
+        for ( size_t i = 0, n = mpFontList->size(); i < n; ++i ) {
+            delete (*mpFontList)[ i ];
         }
+        mpFontList->clear();
         delete mpFontList;
     }
 }
@@ -832,7 +828,13 @@ void FontNameBox::Fill( const FontList* pList )
         {
             USHORT nType = pList->GetFontNameType( i );
             ImplFontNameListData* pData = new ImplFontNameListData( rFontInfo, nType );
-            mpFontList->Insert( pData, nIndex );
+            if ( nIndex < mpFontList->size() ) {
+                ImplFontList::iterator it = mpFontList->begin();
+                ::std::advance( it, nIndex );
+                mpFontList->insert( it, pData );
+            } else {
+                mpFontList->push_back( pData );
+            }
         }
     }
 
@@ -975,7 +977,7 @@ namespace
 
 void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt )
 {
-    ImplFontNameListData*   pData = mpFontList->GetObject( rUDEvt.GetItemId() );
+    ImplFontNameListData*   pData = (*mpFontList)[ rUDEvt.GetItemId() ];
     const FontInfo&         rInfo = pData->maInfo;
     USHORT                  nType = pData->mnType;
     Point                   aTopLeft = rUDEvt.GetRect().TopLeft();


More information about the Libreoffice-commits mailing list