[Libreoffice-commits] core.git: sfx2/source

Noel Grandin noel at peralex.com
Tue Apr 16 12:11:52 PDT 2013


 sfx2/source/doc/docfac.cxx |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 9b9f1c4b6f21eb30eb365da3cca4ca4a1d2d0069
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Apr 12 16:35:25 2013 +0200

    Convert SfxViewFactoryArr_Impl from SfxPtrArray to std::vector
    
    Change-Id: I25c8edc51f97af9de2563a8dba7387a2be9f4fd5
    Reviewed-on: https://gerrit.libreoffice.org/3360
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx
index 25254aa..574bc54 100644
--- a/sfx2/source/doc/docfac.cxx
+++ b/sfx2/source/doc/docfac.cxx
@@ -57,7 +57,7 @@ using namespace ::com::sun::star;
 
 //========================================================================
 
-DECL_PTRARRAY( SfxViewFactoryArr_Impl, SfxViewFactory*, 2, 2 )
+typedef std::vector<SfxViewFactory*> SfxViewFactoryArr_Impl;
 
 //========================================================================
 
@@ -147,9 +147,9 @@ void SfxObjectFactory::RegisterViewFactory
 #if OSL_DEBUG_LEVEL > 0
     {
         const String sViewName( rFactory.GetAPIViewName() );
-        for ( sal_uInt16 i = 0; i < pImpl->aViewFactoryArr.Count(); ++i )
+        for ( SfxViewFactoryArr_Impl::const_iterator it = pImpl->aViewFactoryArr.begin(); it != pImpl->aViewFactoryArr.end(); ++it )
         {
-            if ( !pImpl->aViewFactoryArr[i]->GetAPIViewName().Equals( sViewName ) )
+            if ( !(*it)->GetAPIViewName().Equals( sViewName ) )
                 continue;
             OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM(
                 "SfxObjectFactory::RegisterViewFactory: duplicate view name '"));
@@ -160,20 +160,19 @@ void SfxObjectFactory::RegisterViewFactory
         }
     }
 #endif
-    sal_uInt16 nPos;
-    for ( nPos = 0;
-          nPos < pImpl->aViewFactoryArr.Count() &&
-          pImpl->aViewFactoryArr[nPos]->GetOrdinal() <= rFactory.GetOrdinal();
-          ++nPos )
+    SfxViewFactoryArr_Impl::iterator it = pImpl->aViewFactoryArr.begin();
+    for ( ; it != pImpl->aViewFactoryArr.end() &&
+          (*it)->GetOrdinal() <= rFactory.GetOrdinal();
+          ++it )
     /* empty loop */;
-    pImpl->aViewFactoryArr.Insert(nPos, &rFactory);
+    pImpl->aViewFactoryArr.insert(it, &rFactory);
 }
 
 //--------------------------------------------------------------------
 
 sal_uInt16 SfxObjectFactory::GetViewFactoryCount() const
 {
-    return pImpl->aViewFactoryArr.Count();
+    return pImpl->aViewFactoryArr.size();
 }
 
 //--------------------------------------------------------------------


More information about the Libreoffice-commits mailing list