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


Hi,

See attached.

Regards,
Brad

From 4108bbb38a77b6552582e1972fc77019ff583a8a Mon Sep 17 00:00:00 2001
From: Brad Sowden <code@sowden.org>
Date: Thu, 29 Dec 2011 12:25:26 +1300
Subject: [PATCH 4/8] fdo#38831 convert SvStrings to std::vector unotbl.cxx

---
 sw/source/core/unocore/unotbl.cxx |   19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 5adc781..f6632ea 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -30,6 +30,7 @@
 
 // STL includes
 #include <list>
+#include <vector>
 
 #include <svx/svxids.hrc>
 #include <editeng/memberids.hrc>
@@ -56,8 +57,6 @@
 #include <cellatr.hxx>
 #include <fmtpdsc.hxx>
 #include <pagedesc.hxx>
-#define _SVSTDARR_STRINGS
-#include <svl/svstdarr.hxx>
 #include <viewsh.hxx>
 #include <tabfrm.hxx>
 #include <redline.hxx>
@@ -562,7 +561,7 @@ SwXCell* lcl_CreateXCell(SwFrmFmt* pFmt, sal_Int32 nColumn, sal_Int32 nRow)
     return pXCell;
 }
 
-void lcl_InspectLines(SwTableLines& rLines, SvStrings& rAllNames)
+void lcl_InspectLines(SwTableLines& rLines, std::vector<String*>& rAllNames)
 {
     for( sal_uInt16 i = 0; i < rLines.Count(); i++ )
     {
@@ -572,7 +571,7 @@ void lcl_InspectLines(SwTableLines& rLines, SvStrings& rAllNames)
         {
             SwTableBox* pBox = rBoxes[j];
             if(pBox->GetName().Len() && pBox->getRowSpan() > 0 )
-                rAllNames.Insert(new String(pBox->GetName()), rAllNames.Count());
+                rAllNames.push_back( new String(pBox->GetName()) );
             SwTableLines& rBoxLines = pBox->GetTabLines();
             if(rBoxLines.Count())
             {
@@ -2232,16 +2231,14 @@ uno::Sequence< OUString > SwXTextTable::getCellNames(void) throw( 
uno::RuntimeEx
         SwTable* pTable = SwTable::FindTable( pFmt );
           // gibts an der Tabelle und an allen Boxen
         SwTableLines& rTblLines = pTable->GetTabLines();
-        SvStrings aAllNames;
+        std::vector<String*> aAllNames;
         lcl_InspectLines(rTblLines, aAllNames);
-        uno::Sequence< OUString > aRet(aAllNames.Count());
+        uno::Sequence< OUString > aRet( static_cast<sal_uInt16>(aAllNames.size()) );
         OUString* pArray = aRet.getArray();
-        for(sal_uInt16 i = aAllNames.Count(); i; i--)
+        for( size_t i = 0; i < aAllNames.size(); ++i)
         {
-            String* pObject = aAllNames.GetObject(i-1);
-            pArray[i - 1] = *pObject;
-            aAllNames.Remove(i - 1);
-            delete pObject;
+            pArray[i] = *aAllNames[i];
+            delete aAllNames[i];
         }
         return aRet;
     }
-- 
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.