Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi,

See attached.

Regards,
Brad


From 664e8e28dfb3eec445a679ca36aa61c0b1582104 Mon Sep 17 00:00:00 2001
From: Brad Sowden <code@sowden.org>
Date: Thu, 29 Dec 2011 10:54:13 +1300
Subject: [PATCH 3/8] fdo#38831 convert SvStrings to std::vector unofield.cxx

---
 sw/source/core/unocore/unofield.cxx |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 6b0ddc7..51d6fe7 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -85,7 +85,6 @@
 #include <tools/datetime.hxx>
 #include <tools/urlobj.hxx>
 #include <svx/dataaccessdescriptor.hxx>
-#define _SVSTDARR_STRINGS
 #include <svl/svstdarr.hxx>
 #include <osl/mutex.hxx>
 #include <vcl/svapp.hxx>
@@ -95,6 +94,7 @@
 #include <fmtmeta.hxx> // MetaFieldManager
 #include <switerator.hxx>
 #include <rtl/strbuf.hxx>
+#include <vector>
 
 using ::rtl::OUString;
 using namespace ::com::sun::star;
@@ -2539,7 +2539,7 @@ uno::Sequence< OUString > SwXTextFieldMasters::getElementNames(void)
     const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes();
     sal_uInt16 nCount = pFldTypes->Count();
 
-    SvStrings aFldNames;
+    std::vector<String*> aFldNames;
     String* pString = new String();
     sal_uInt16 i;
 
@@ -2549,22 +2549,21 @@ uno::Sequence< OUString > SwXTextFieldMasters::getElementNames(void)
 
         if (SwXTextFieldMasters::getInstanceName(rFldType, *pString))
         {
-            aFldNames.Insert(pString, aFldNames.Count());
+            aFldNames.push_back(pString);
             pString = new String();
         }
     }
     delete pString;
 
-    uno::Sequence< OUString > aSeq(aFldNames.Count());
+    uno::Sequence< OUString > aSeq( static_cast<sal_uInt16>(aFldNames.size()) );
     OUString* pArray = aSeq.getArray();
-    for(i = 0; i < aFldNames.Count();i++)
+    for(std::vector<String*>::const_iterator it(aFldNames.begin()); it != aFldNames.end(); ++it)
     {
-        pArray[i] = *aFldNames.GetObject(i);
+        pArray[i] = **it;
+        delete *it;
     }
-    aFldNames.DeleteAndDestroy(0, aFldNames.Count());
 
     return aSeq;
-
 }
 
 sal_Bool SwXTextFieldMasters::hasByName(const OUString& rName) throw( uno::RuntimeException )
-- 
1.7.7.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.