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

Joseph Powers jpowers at kemper.freedesktop.org
Fri Mar 4 21:19:04 PST 2011


 sd/inc/stlpool.hxx         |    2 -
 sd/source/core/stlpool.cxx |   73 ++++++++++++++++++++-------------------------
 2 files changed, 34 insertions(+), 41 deletions(-)

New commits:
commit fa68c93225ba357c677592f0a59a7100ed141dd7
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Fri Mar 4 21:18:25 2011 -0800

    Remove usage of List container.

diff --git a/sd/inc/stlpool.hxx b/sd/inc/stlpool.hxx
index 212892c..b1eb448 100644
--- a/sd/inc/stlpool.hxx
+++ b/sd/inc/stlpool.hxx
@@ -82,7 +82,7 @@ public:
                             when styles are missing.
     */
     SD_DLLPUBLIC void                CreateLayoutStyleSheets(const String& rLayoutName, sal_Bool bCheck = sal_False );
-    List*               CreateLayoutSheetNames(const String& rLayoutName) const;
+    void                CreateLayoutSheetNames(const String& rLayoutName, std::vector<String> &aNameList) const;
     void				CreateLayoutSheetList(const String& rLayoutName, SdStyleSheetVector& rLayoutSheets);
     void                CopyLayoutSheets(const String& rLayoutName, SdStyleSheetPool& rSourcePool, SdStyleSheetVector& rCreatedSheets );
     void                CopyGraphicSheets(SdStyleSheetPool& rSourcePool);
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index 4b9eb83..77654bc 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.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
@@ -96,12 +96,12 @@ SdStyleSheetPool::SdStyleSheetPool(SfxItemPool const& _rPool, SdDrawDocument* pD
         // create graphics family
         mxGraphicFamily = new SdStyleFamily( xPool, SD_STYLE_FAMILY_GRAPHICS );
         mxCellFamily = new SdStyleFamily( xPool, SD_STYLE_FAMILY_CELL );
-        
+
         mxTableFamily = sdr::table::CreateTableDesignFamily();
         Reference< XNamed > xNamed( mxTableFamily, UNO_QUERY );
         if( xNamed.is() )
             msTableFamilyName = xNamed->getName();
-        
+
         // create presentation families, one for each master page
         const sal_uInt16 nCount = mpDoc->GetMasterSdPageCount(PK_STANDARD);
         for( sal_uInt16 nPage = 0; nPage < nCount; ++nPage )
@@ -545,7 +545,7 @@ void SdStyleSheetPool::CopyTableStyles(SdStyleSheetPool& rSourcePool)
     if( xSource.is() && xFactory.is() && mxTableFamily.is() )
     {
         for( sal_Int32 nIndex = 0; nIndex < xSource->getCount(); nIndex++ ) try
-        {	
+        {
             Reference< XStyle > xSourceTableStyle( xSource->getByIndex( nIndex ), UNO_QUERY );
             if( xSourceTableStyle.is() )
             {
@@ -654,30 +654,27 @@ void SdStyleSheetPool::CopyLayoutSheets(const String& rLayoutName, SdStyleSheetP
 
     String aOutlineTag(SdResId(STR_LAYOUT_OUTLINE));
 
-    List* pNameList = CreateLayoutSheetNames(rLayoutName);
+    std::vector<String> aNameList;
+    CreateLayoutSheetNames(rLayoutName,aNameList);
 
     String sEmpty;
-    String* pName = (String*)pNameList->First();
-    while (pName)
+    for (std::vector<String>::const_iterator it = aNameList.begin(); it != aNameList.end(); ++it)
     {
-        pSheet = Find(*pName, SD_STYLE_FAMILY_MASTERPAGE);
+        pSheet = Find(*it, SD_STYLE_FAMILY_MASTERPAGE);
         if (!pSheet)
         {
-            SfxStyleSheetBase* pSourceSheet = rSourcePool.Find(*pName, SD_STYLE_FAMILY_MASTERPAGE);
+            SfxStyleSheetBase* pSourceSheet = rSourcePool.Find(*it, SD_STYLE_FAMILY_MASTERPAGE);
             DBG_ASSERT(pSourceSheet, "CopyLayoutSheets: Quellvorlage nicht gefunden");
             if (pSourceSheet)
             {
                 // falls einer mit Methusalem-Doks. ankommt
-                SfxStyleSheetBase& rNewSheet = Make(*pName, SD_STYLE_FAMILY_MASTERPAGE);
+                SfxStyleSheetBase& rNewSheet = Make(*it, SD_STYLE_FAMILY_MASTERPAGE);
                 rNewSheet.SetHelpId( sEmpty, pSourceSheet->GetHelpId( sEmpty ) );
                 rNewSheet.GetItemSet().Put(pSourceSheet->GetItemSet());
                 rCreatedSheets.push_back( SdStyleSheetRef( static_cast< SdStyleSheet* >( &rNewSheet ) ) );
             }
         }
-        delete pName;
-        pName = (String*)pNameList->Next();
     }
-    delete pNameList;
 
     // Sonderbehandlung fuer Gliederungsvorlagen: Parentbeziehungen aufbauen
     List* pOutlineSheets = CreateOutlineSheetList(rLayoutName);
@@ -701,47 +698,43 @@ void SdStyleSheetPool::CopyLayoutSheets(const String& rLayoutName, SdStyleSheetP
 |*
 \************************************************************************/
 
-List* SdStyleSheetPool::CreateLayoutSheetNames(const String& rLayoutName) const
+void SdStyleSheetPool::CreateLayoutSheetNames(const String& rLayoutName, std::vector<String> &aNameList) const
 {
     String aPrefix(rLayoutName);
     String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
     aPrefix.Insert(aSep);
 
-    List* pNameList = new List;
-
     String aName(SdResId(STR_LAYOUT_OUTLINE));
-    String* pName = NULL;
+    String aStr;
 
     for (USHORT nLevel = 1; nLevel < 10; nLevel++)
     {
-        pName = new String(aName);
-        pName->Append( sal_Unicode( ' ' ));
-        pName->Append( String::CreateFromInt32( sal_Int32( nLevel )));
-        pName->Insert(aPrefix, 0);
-        pNameList->Insert(pName, LIST_APPEND);
+        aStr = String( aPrefix );
+        aStr.Append(aName);
+        aStr.Append( sal_Unicode( ' ' ));
+        aStr.Append( String::CreateFromInt32( sal_Int32( nLevel )));
+        aNameList.push_back(aStr);
     }
 
-    pName = new String(SdResId(STR_LAYOUT_TITLE));
-    pName->Insert(aPrefix, 0);
-    pNameList->Insert(pName, LIST_APPEND);
-
-    pName = new String(SdResId(STR_LAYOUT_SUBTITLE));
-    pName->Insert(aPrefix, 0);
-    pNameList->Insert(pName, LIST_APPEND);
+    aStr = String(SdResId(STR_LAYOUT_TITLE));
+    aStr.Insert(aPrefix, 0);
+    aNameList.push_back(aStr);
 
-    pName = new String(SdResId(STR_LAYOUT_NOTES));
-    pName->Insert(aPrefix, 0);
-    pNameList->Insert(pName, LIST_APPEND);
+    aStr = String(SdResId(STR_LAYOUT_SUBTITLE));
+    aStr.Insert(aPrefix, 0);
+    aNameList.push_back(aStr);
 
-    pName = new String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS));
-    pName->Insert(aPrefix, 0);
-    pNameList->Insert(pName, LIST_APPEND);
+    aStr = String(SdResId(STR_LAYOUT_NOTES));
+    aStr.Insert(aPrefix, 0);
+    aNameList.push_back(aStr);
 
-    pName = new String(SdResId(STR_LAYOUT_BACKGROUND));
-    pName->Insert(aPrefix, 0);
-    pNameList->Insert(pName, LIST_APPEND);
+    aStr = String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS));
+    aStr.Insert(aPrefix, 0);
+    aNameList.push_back(aStr);
 
-    return pNameList;
+    aStr = String(SdResId(STR_LAYOUT_BACKGROUND));
+    aStr.Insert(aPrefix, 0);
+    aNameList.push_back(aStr);
 }
 
 /*************************************************************************
@@ -1227,7 +1220,7 @@ Any SAL_CALL SdStyleSheetPool::getByName( const OUString& aName ) throw(NoSuchEl
 Sequence< OUString > SAL_CALL SdStyleSheetPool::getElementNames() throw(RuntimeException)
 {
     throwIfDisposed();
-    
+
     Sequence< OUString > aNames( maStyleFamilyMap.size() + 3 );
     OUString* pNames = aNames.getArray();
 


More information about the Libreoffice-commits mailing list