[Libreoffice-commits] .: 2 commits - sw/inc sw/source

August Sodora augsod at kemper.freedesktop.org
Thu Jan 12 20:16:01 PST 2012


 sw/inc/doc.hxx                     |    2 +-
 sw/inc/editsh.hxx                  |    2 +-
 sw/source/core/doc/doc.cxx         |    6 +++---
 sw/source/core/edit/editsh.cxx     |    2 +-
 sw/source/core/unocore/unocoll.cxx |    4 ++--
 sw/source/ui/fldui/flddinf.cxx     |    6 +++---
 sw/source/ui/fldui/flddok.cxx      |   18 +++++++++---------
 sw/source/ui/fldui/fldfunc.cxx     |    8 ++++----
 sw/source/ui/fldui/fldmgr.cxx      |   19 +++++++++----------
 sw/source/ui/fldui/fldref.cxx      |    6 +++---
 sw/source/ui/fldui/fldvar.cxx      |   24 ++++++++++++------------
 sw/source/ui/inc/fldmgr.hxx        |    3 ++-
 sw/source/ui/utlui/content.cxx     |    7 +++----
 sw/source/ui/utlui/gloslst.cxx     |   12 +++++-------
 14 files changed, 58 insertions(+), 61 deletions(-)

New commits:
commit c1400c98ce137dddb252f9759ca9a89ab3452764
Author: August Sodora <augsod at gmail.com>
Date:   Thu Jan 12 23:15:09 2012 -0500

    SvStringsDtor->std::vector

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 11f8cd8..e85ba27 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1704,7 +1704,7 @@ public:
 
     // Return names of all references that are set in document.
     // If array pointer is 0 return only whether a RefMark is set in document.
-    sal_uInt16 GetRefMarks( SvStringsDtor* = 0 ) const;
+    sal_uInt16 GetRefMarks( std::vector<String>* = 0 ) const;
 
     // Insert label. If a FlyFormat is created, return it.
     SwFlyFrmFmt* InsertLabel( const SwLabelType eType, const String &rTxt, const String& rSeparator,
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 70af368..11e3376 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -741,7 +741,7 @@ public:
 
     //  Return names of all references set in document.
     //  If ArrayPointer == 0 then return only whether a RefMark is set in document.
-    sal_uInt16 GetRefMarks( SvStringsDtor* = 0 ) const;
+    sal_uInt16 GetRefMarks( std::vector<String>* = 0 ) const;
 
     // Call AutoCorrect
     void AutoCorrect( SvxAutoCorrect& rACorr, sal_Bool bInsertMode = sal_True,
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 8be6aa7..8c61466 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1822,7 +1822,7 @@ const SwFmtRefMark* SwDoc::GetRefMark( sal_uInt16 nIndex ) const
 // Return the names of all set references in the Doc
 //JP 24.06.96: If the array pointer is 0, then just return whether a RefMark is set in the Doc
 // OS 25.06.96: From now on we always return the reference count
-sal_uInt16 SwDoc::GetRefMarks( SvStringsDtor* pNames ) const
+sal_uInt16 SwDoc::GetRefMarks( std::vector<String>* pNames ) const
 {
     const SfxPoolItem* pItem;
     const SwTxtRefMark* pTxtRef;
@@ -1836,8 +1836,8 @@ sal_uInt16 SwDoc::GetRefMarks( SvStringsDtor* pNames ) const
         {
             if( pNames )
             {
-                String* pTmp = new String( ((SwFmtRefMark*)pItem)->GetRefName() );
-                pNames->Insert( pTmp, nCount );
+                String pTmp(((SwFmtRefMark*)pItem)->GetRefName());
+                pNames->insert(pNames->begin() + nCount, pTmp);
             }
             nCount ++;
         }
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index d984598..41d113a 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -519,7 +519,7 @@ const SwFmtRefMark* SwEditShell::GetRefMark( const String& rName ) const
 }
 
     // returne die Namen aller im Doc gesetzten Referenzen
-sal_uInt16 SwEditShell::GetRefMarks( SvStringsDtor* pStrings ) const
+sal_uInt16 SwEditShell::GetRefMarks( std::vector<String>* pStrings ) const
 {
     return GetDoc()->GetRefMarks( pStrings );
 }
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index 36de7ef..4996bd3 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -1948,12 +1948,12 @@ uno::Sequence< OUString > SwXReferenceMarks::getElementNames(void) throw( uno::R
     uno::Sequence<OUString> aRet;
     if(IsValid())
     {
-        SvStringsDtor aStrings;
+        std::vector<String> aStrings;
         sal_uInt16 nCount = GetDoc()->GetRefMarks( &aStrings );
         aRet.realloc(nCount);
         OUString* pNames = aRet.getArray();
         for(sal_uInt16 i = 0; i < nCount; i++)
-            pNames[i] = *aStrings.GetObject(i);
+            pNames[i] = aStrings[i];
     }
     else
         throw uno::RuntimeException();
diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx
index f89b64b..7160fc2 100644
--- a/sw/source/ui/fldui/flddinf.cxx
+++ b/sw/source/ui/fldui/flddinf.cxx
@@ -139,9 +139,9 @@ void SwFldDokInfPage::Reset(const SfxItemSet& )
         nSelEntryData = static_cast< sal_uInt16 >(sVal.ToInt32());
     }
 
-    SvStringsDtor aLst;
+    std::vector<String> aLst;
     GetFldMgr().GetSubTypes(nTypeId, aLst);
-    for (sal_uInt16 i = 0; i < aLst.Count(); ++i)
+    for(size_t i = 0; i < aLst.size(); ++i)
     {
         if (!IsFldEdit() || nSubType == i)
         {
@@ -175,7 +175,7 @@ void SwFldDokInfPage::Reset(const SfxItemSet& )
             {
                 if (!(IsFldDlgHtmlMode() && (i == DI_EDIT || i == DI_THEMA || i == DI_PRINT)))
                 {
-                    pEntry = aTypeTLB.InsertEntry(*aLst[i]);
+                    pEntry = aTypeTLB.InsertEntry(aLst[i]);
                     pEntry->SetUserData(reinterpret_cast<void*>(i));
                 }
             }
diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx
index eaaa77f..5b68531 100644
--- a/sw/source/ui/fldui/flddok.cxx
+++ b/sw/source/ui/fldui/flddok.cxx
@@ -215,22 +215,22 @@ IMPL_LINK( SwFldDokPage, TypeHdl, ListBox *, EMPTYARG )
 
         if (nTypeId != USHRT_MAX)
         {
-            SvStringsDtor aLst;
+            std::vector<String> aLst;
             GetFldMgr().GetSubTypes(nTypeId, aLst);
 
             if (nTypeId != TYP_AUTHORFLD)
-                nCount = aLst.Count();
+                nCount = aLst.size();
             else
                 nCount = GetFldMgr().GetFormatCount(nTypeId, sal_False, IsFldDlgHtmlMode());
 
-            sal_uInt16 nPos;
+            size_t nPos;
 
-            for (sal_uInt16 i = 0; i < nCount; ++i)
+            for(size_t i = 0; i < nCount; ++i)
             {
                 if (!IsFldEdit())
                 {
                     if (nTypeId != TYP_AUTHORFLD)
-                        nPos = aSelectionLB.InsertEntry(*aLst[i]);
+                        nPos = aSelectionLB.InsertEntry(aLst[i]);
                     else
                         nPos = aSelectionLB.InsertEntry(GetFldMgr().GetFormatStr(nTypeId, i));
 
@@ -244,7 +244,7 @@ IMPL_LINK( SwFldDokPage, TypeHdl, ListBox *, EMPTYARG )
                     {
                         case TYP_DATEFLD:
                         case TYP_TIMEFLD:
-                            nPos = aSelectionLB.InsertEntry(*aLst[i]);
+                            nPos = aSelectionLB.InsertEntry(aLst[i]);
                             aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
                             if (((SwDateTimeField*)GetCurField())->IsFixed() && !i)
                                 aSelectionLB.SelectEntryPos(nPos);
@@ -254,7 +254,7 @@ IMPL_LINK( SwFldDokPage, TypeHdl, ListBox *, EMPTYARG )
 
                         case TYP_EXTUSERFLD:
                         case TYP_DOCSTATFLD:
-                            nPos = aSelectionLB.InsertEntry(*aLst[i]);
+                            nPos = aSelectionLB.InsertEntry(aLst[i]);
                             aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
                             if (GetCurField()->GetSubType() == i)
                                 aSelectionLB.SelectEntryPos(nPos);
@@ -270,13 +270,13 @@ IMPL_LINK( SwFldDokPage, TypeHdl, ListBox *, EMPTYARG )
                         }
 
                         default:
-                            if (*aLst[i] == GetCurField()->GetPar1())
+                            if (aLst[i] == GetCurField()->GetPar1())
                                 bInsert = sal_True;
                             break;
                     }
                     if (bInsert)
                     {
-                        nPos = aSelectionLB.InsertEntry(*aLst[i]);
+                        nPos = aSelectionLB.InsertEntry(aLst[i]);
                         aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
                         break;
                     }
diff --git a/sw/source/ui/fldui/fldfunc.cxx b/sw/source/ui/fldui/fldfunc.cxx
index 15d6ac9..a8fab06 100644
--- a/sw/source/ui/fldui/fldfunc.cxx
+++ b/sw/source/ui/fldui/fldfunc.cxx
@@ -500,13 +500,13 @@ void SwFldFuncPage::UpdateSubType()
     aSelectionLB.SetUpdateMode(sal_False);
     aSelectionLB.Clear();
 
-    SvStringsDtor aLst;
+    std::vector<String> aLst;
     GetFldMgr().GetSubTypes(nTypeId, aLst);
-    sal_uInt16 nCount = aLst.Count();
+    size_t nCount = aLst.size();
 
-    for (sal_uInt16 i = 0; i < nCount; ++i)
+    for(size_t i = 0; i < nCount; ++i)
     {
-        sal_uInt16 nPos = aSelectionLB.InsertEntry(*aLst[i]);
+        size_t nPos = aSelectionLB.InsertEntry(aLst[i]);
         aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
     }
 
diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx
index 789598b..2b71c83 100644
--- a/sw/source/ui/fldui/fldmgr.cxx
+++ b/sw/source/ui/fldui/fldmgr.cxx
@@ -498,7 +498,7 @@ sal_uInt16 SwFldMgr::GetPos(sal_uInt16 nTypeId)
     Description: localise subtypes of a field
  --------------------------------------------------------------------*/
 
-sal_Bool SwFldMgr::GetSubTypes(sal_uInt16 nTypeId, SvStringsDtor& rToFill)
+sal_Bool SwFldMgr::GetSubTypes(sal_uInt16 nTypeId, std::vector<String>& rToFill)
 {
     sal_Bool bRet = sal_False;
     SwWrtShell *pSh = pWrtShell ? pWrtShell : lcl_GetShell();
@@ -521,8 +521,8 @@ sal_Bool SwFldMgr::GetSubTypes(sal_uInt16 nTypeId, SvStringsDtor& rToFill)
                 break;
             }
             case TYP_INPUTFLD:
-            {   String* pNew = new SW_RESSTR(aSwFlds[nPos].nSubTypeStart);
-                rToFill.Insert(pNew, rToFill.Count());
+            {
+                rToFill.push_back(String(SW_RESSTR(aSwFlds[nPos].nSubTypeStart)));
                 // move on at generic types
             }
             case TYP_DDEFLD:
@@ -557,8 +557,7 @@ sal_Bool SwFldMgr::GetSubTypes(sal_uInt16 nTypeId, SvStringsDtor& rToFill)
                           (nWhich == RES_SETEXPFLD &&
                           !(((SwSetExpFieldType*)pFldType)->GetType() & nsSwGetSetExpType::GSE_SEQ))) ) )
                     {
-                        String* pNew = new String(pFldType->GetName());
-                        rToFill.Insert(pNew, rToFill.Count());
+                        rToFill.push_back(pFldType->GetName());
                     }
                 }
                 break;
@@ -582,18 +581,18 @@ sal_Bool SwFldMgr::GetSubTypes(sal_uInt16 nTypeId, SvStringsDtor& rToFill)
 
                     for(sal_uInt16 i = 0; i < nCount; ++i)
                     {
-                        String* pNew;
+                        String pNew;
                         if (nTypeId == TYP_DOCINFOFLD)
                         {
                             if ( i == DI_CUSTOM )
-                                pNew = new String( String(SW_RES( STR_CUSTOM )) );
+                                pNew = String(SW_RES( STR_CUSTOM ));
                             else
-                                pNew = new String(*ViewShell::GetShellRes()->aDocInfoLst[i]);
+                                pNew = *ViewShell::GetShellRes()->aDocInfoLst[i];
                         }
                         else
-                            pNew = new SW_RESSTR(aSwFlds[nPos].nSubTypeStart + i);
+                            pNew = SW_RESSTR(aSwFlds[nPos].nSubTypeStart + i);
 
-                        rToFill.Insert(pNew, rToFill.Count());
+                        rToFill.push_back(pNew);
                     }
                 }
             }
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index 817c9f2..948380f 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -629,10 +629,10 @@ void SwFldRefPage::UpdateSubType()
     }
     else
     {
-        SvStringsDtor aLst;
+        std::vector<String> aLst;
         GetFldMgr().GetSubTypes(nTypeId, aLst);
-        for (sal_uInt16 i = 0; i < aLst.Count(); ++i)
-            aSelectionLB.InsertEntry(*aLst[i]);
+        for(size_t i = 0; i < aLst.size(); ++i)
+            aSelectionLB.InsertEntry(aLst[i]);
 
         if (IsFldEdit())
             sOldSel = pRefFld->GetSetRefName();
diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx
index 61333b1..64fb7e1 100644
--- a/sw/source/ui/fldui/fldvar.cxx
+++ b/sw/source/ui/fldui/fldvar.cxx
@@ -602,18 +602,18 @@ void SwFldVarPage::UpdateSubType()
     aSelectionLB.SetUpdateMode(sal_False);
     aSelectionLB.Clear();
 
-    SvStringsDtor aList;
+    std::vector<String> aList;
     GetFldMgr().GetSubTypes(nTypeId, aList);
-    sal_uInt16 nCount = aList.Count();
-    sal_uInt16 nPos;
+    size_t nCount = aList.size();
+    size_t nPos;
 
-    for (sal_uInt16 i = 0; i < nCount; ++i)
+    for(size_t i = 0; i < nCount; ++i)
     {
         if (nTypeId != TYP_INPUTFLD || i)
         {
             if (!IsFldEdit())
             {
-                nPos = aSelectionLB.InsertEntry(*aList[i]);
+                nPos = aSelectionLB.InsertEntry(aList[i]);
                 aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
             }
             else
@@ -623,7 +623,7 @@ void SwFldVarPage::UpdateSubType()
                 switch (nTypeId)
                 {
                     case TYP_INPUTFLD:
-                        if (*aList[i] == GetCurField()->GetPar1())
+                        if (aList[i] == GetCurField()->GetPar1())
                             bInsert = sal_True;
                         break;
 
@@ -632,13 +632,13 @@ void SwFldVarPage::UpdateSubType()
                         break;
 
                     case TYP_GETFLD:
-                        if (*aList[i] == ((SwFormulaField*)GetCurField())->GetFormula())
+                        if (aList[i] == ((SwFormulaField*)GetCurField())->GetFormula())
                             bInsert = sal_True;
                         break;
 
                     case TYP_SETFLD:
                     case TYP_USERFLD:
-                        if (*aList[i] == GetCurField()->GetTyp()->GetName())
+                        if (aList[i] == GetCurField()->GetTyp()->GetName())
                         {
                             bInsert = sal_True;
                             if (GetCurField()->GetSubType() & nsSwExtendedSubType::SUB_INVISIBLE)
@@ -649,21 +649,21 @@ void SwFldVarPage::UpdateSubType()
                     case TYP_SETREFPAGEFLD:
                         if ((((SwRefPageSetField*)GetCurField())->IsOn() && i) ||
                             (!((SwRefPageSetField*)GetCurField())->IsOn() && !i))
-                            sOldSel = *aList[i];
+                            sOldSel = aList[i];
 
                         // allow all entries for selection:
-                        nPos = aSelectionLB.InsertEntry(*aList[i]);
+                        nPos = aSelectionLB.InsertEntry(aList[i]);
                         aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
                         break;
 
                     default:
-                        if (*aList[i] == GetCurField()->GetPar1())
+                        if (aList[i] == GetCurField()->GetPar1())
                             bInsert = sal_True;
                         break;
                 }
                 if (bInsert)
                 {
-                    nPos = aSelectionLB.InsertEntry(*aList[i]);
+                    nPos = aSelectionLB.InsertEntry(aList[i]);
                     aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
                     if (nTypeId != TYP_FORMELFLD)
                         break;
diff --git a/sw/source/ui/inc/fldmgr.hxx b/sw/source/ui/inc/fldmgr.hxx
index 0e20036..0ed1990 100644
--- a/sw/source/ui/inc/fldmgr.hxx
+++ b/sw/source/ui/inc/fldmgr.hxx
@@ -34,6 +34,7 @@
 #include "swtypes.hxx"
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/uno/Any.h>
+#include <vector>
 
 namespace com{namespace sun{namespace star{
     namespace container{
@@ -201,7 +202,7 @@ public:
     static sal_uInt16   GetPos(sal_uInt16 nTypeId);
 
     // subtypes to a type
-    sal_Bool            GetSubTypes(sal_uInt16 nId, SvStringsDtor& rToFill);
+    sal_Bool            GetSubTypes(sal_uInt16 nId, std::vector<String>& rToFill);
 
     // format to a type
     sal_uInt16          GetFormatCount(sal_uInt16 nTypeId, sal_Bool bIsText, sal_Bool bHtmlMode = sal_False) const;
diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx
index f2c9657..1fd421c 100644
--- a/sw/source/ui/utlui/content.cxx
+++ b/sw/source/ui/utlui/content.cxx
@@ -658,14 +658,13 @@ void    SwContentType::FillMemberList(sal_Bool* pbLevelOrVisibiblityChanged)
         break;
         case CONTENT_TYPE_REFERENCE:
         {
-            SvStringsDtor aRefMarks;
+            std::vector<String> aRefMarks;
             nMemberCount = pWrtShell->GetRefMarks( &aRefMarks );
 
-            for(sal_uInt16 i=0; i<nMemberCount; i++)
+            for(std::vector<String>::const_iterator i = aRefMarks.begin(); i != aRefMarks.end(); ++i)
             {
                 //Referenzen nach Alphabet sortiert
-                SwContent* pCnt = new SwContent(
-                            this, *aRefMarks.GetObject(i), 0);
+                SwContent* pCnt = new SwContent(this, *i, 0);
                 pMember->Insert(pCnt);
             }
         }
commit cc651ffb0b0a2e2c9b07e5043c4474c026082445
Author: August Sodora <augsod at gmail.com>
Date:   Thu Jan 12 22:25:49 2012 -0500

    SvStringsDtor->std::vector

diff --git a/sw/source/ui/utlui/gloslst.cxx b/sw/source/ui/utlui/gloslst.cxx
index cd9b0b4..9e507d8 100644
--- a/sw/source/ui/utlui/gloslst.cxx
+++ b/sw/source/ui/utlui/gloslst.cxx
@@ -320,7 +320,7 @@ void SwGlossaryList::Update()
     {
         for( size_t nPath = 0; nPath < pPathArr->size(); nPath++ )
         {
-            SvStringsDtor aFoundGroupNames;
+            std::vector<String> aFoundGroupNames;
             std::vector<String*> aFiles;
             SvPtrarr aDateTimeArr( 16, 16 );
 
@@ -333,8 +333,7 @@ void SwGlossaryList::Update()
 
                 String sName( pTitle->Copy( 0, pTitle->Len() - sExt.Len() ));
 
-                aFoundGroupNames.Insert( new String(sName),
-                                            aFoundGroupNames.Count());
+                aFoundGroupNames.push_back(sName);
                 sName += GLOS_DELIM;
                 sName += String::CreateFromInt32( static_cast<sal_uInt16>(nPath) );
                 AutoTextGroup* pFound = FindGroup( sName );
@@ -371,10 +370,9 @@ void SwGlossaryList::Update()
                 {
                     sal_Bool bFound = sal_False;
                     String sCompareGroup = pGroup->sName.GetToken(0, GLOS_DELIM);
-                    for( sal_uInt16 j = 0; j < aFoundGroupNames.Count() && !bFound; ++j)
-                    {
-                        bFound = sCompareGroup == *aFoundGroupNames[j];
-                    }
+                    for(std::vector<String>::const_iterator j = aFoundGroupNames.begin(); j != aFoundGroupNames.end() && !bFound; ++j)
+                        bFound = (sCompareGroup == *j);
+
                     if(!bFound)
                     {
                         aGroupArr.Remove(i - 1);


More information about the Libreoffice-commits mailing list