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

Joseph Powers jpowers at kemper.freedesktop.org
Tue May 17 22:44:38 PDT 2011


 svtools/inc/svtools/insdlg.hxx    |   20 +++++++++++++++++---
 svtools/source/dialogs/insdlg.cxx |   32 ++++++++++++++++----------------
 2 files changed, 33 insertions(+), 19 deletions(-)

New commits:
commit 121f35582ea5acacf786919fbbea069a8008f84c
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Tue May 17 22:22:12 2011 -0700

    Convert OwnList SvObjectServer into a vector<>

diff --git a/svtools/inc/svtools/insdlg.hxx b/svtools/inc/svtools/insdlg.hxx
index 3e26d0f..485d31f 100644
--- a/svtools/inc/svtools/insdlg.hxx
+++ b/svtools/inc/svtools/insdlg.hxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -35,7 +35,7 @@
 #include <tools/globname.hxx>
 #include <sot/formats.hxx>
 
-#include <svl/ownlist.hxx>
+#include <vector>
 #include <svtools/transfer.hxx>
 
 class SvObjectServer
@@ -53,13 +53,27 @@ public:
     const String &          GetHumanName() const { return aHumanName; }
 };
 
+typedef ::std::vector< SvObjectServer > SvObjectServerList_impl;
+
 class SVT_DLLPUBLIC SvObjectServerList
 {
-    PRV_SV_DECL_OWNER_LIST(SvObjectServerList,SvObjectServer)
+private:
+    SvObjectServerList_impl aObjectServerList;
+
+public:
     const SvObjectServer *  Get( const String & rHumanName ) const;
     const SvObjectServer *  Get( const SvGlobalName & ) const;
     void                    Remove( const SvGlobalName & );
     void					FillInsertObjects();
+    size_t                  Count() const
+                            {
+                                return aObjectServerList.size();
+                            }
+
+    const SvObjectServer    operator[]( size_t n ) const
+                            {
+                                return aObjectServerList[ n ];
+                            }
 };
 
 class SVT_DLLPUBLIC SvPasteObjectHelper
diff --git a/svtools/source/dialogs/insdlg.cxx b/svtools/source/dialogs/insdlg.cxx
index de59d60..dd97562 100644
--- a/svtools/source/dialogs/insdlg.cxx
+++ b/svtools/source/dialogs/insdlg.cxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -70,7 +70,6 @@ struct OleObjectDescriptor
 
 /********************** SvObjectServerList ********************************
 **************************************************************************/
-PRV_SV_IMPL_OWNER_LIST( SvObjectServerList, SvObjectServer )
 
 /*************************************************************************
 |*    SvObjectServerList::SvObjectServerList()
@@ -79,10 +78,10 @@ PRV_SV_IMPL_OWNER_LIST( SvObjectServerList, SvObjectServer )
 *************************************************************************/
 const SvObjectServer * SvObjectServerList::Get( const String & rHumanName ) const
 {
-    for( sal_uLong i = 0; i < Count(); i++ )
+    for( size_t i = 0; i < aObjectServerList.size(); i++ )
     {
-        if( rHumanName == GetObject( i ).GetHumanName() )
-            return &GetObject( i );
+        if( rHumanName == aObjectServerList[ i ].GetHumanName() )
+            return &aObjectServerList[ i ];
     }
     return NULL;
 }
@@ -94,26 +93,27 @@ const SvObjectServer * SvObjectServerList::Get( const String & rHumanName ) cons
 *************************************************************************/
 const SvObjectServer * SvObjectServerList::Get( const SvGlobalName & rName ) const
 {
-    for( sal_uLong i = 0; i < Count(); i++ )
+    for( size_t i = 0; i < aObjectServerList.size(); i++ )
     {
-        if( rName == GetObject( i ).GetClassName() )
-            return &GetObject( i );
+        if( rName == aObjectServerList[ i ].GetClassName() )
+            return &aObjectServerList[ i ];
     }
     return NULL;
 }
 
 void SvObjectServerList::Remove( const SvGlobalName & rName )
 {
-    SvObjectServer * pS = (SvObjectServer *)aTypes.First();
-    while( pS )
+    for( size_t i = 0; i < aObjectServerList.size(); )
     {
-        if( rName == pS->GetClassName() )
+        if( aObjectServerList[ i ].GetClassName() == rName )
         {
-            Remove();
-            pS = (SvObjectServer *)aTypes.GetCurObject();
+            SvObjectServerList_impl::iterator it = aObjectServerList.begin() + i;
+            aObjectServerList.erase( it );
         }
         else
-            pS = (SvObjectServer *)aTypes.Next();
+        {
+            ++i;
+        }
     }
 }
 
@@ -208,7 +208,7 @@ void SvObjectServerList::FillInsertObjects()
                         {
                             if( !Get( aClassName ) )
                                 // noch nicht eingetragen
-                                Append( SvObjectServer( aClassName, String( aUIName.getStr() ) ) );
+                                aObjectServerList.push_back( SvObjectServer( aClassName, String( aUIName.getStr() ) ) );
                         }
                     }
                 }
@@ -220,7 +220,7 @@ void SvObjectServerList::FillInsertObjects()
 #ifdef WNT
     SvGlobalName aOleFact( SO3_OUT_CLASSID );
     String aOleObj( SvtResId( STR_FURTHER_OBJECT ) );
-    Append( SvObjectServer( aOleFact, aOleObj ) );
+    aObjectServerList.push_back( SvObjectServer( aOleFact, aOleObj ) );
 #endif
 
     }catch( container::NoSuchElementException)


More information about the Libreoffice-commits mailing list