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

August Sodora augsod at kemper.freedesktop.org
Fri Jan 13 19:36:43 PST 2012


 sw/inc/authfld.hxx                 |    3 -
 sw/inc/docstyle.hxx                |    3 -
 sw/inc/editsh.hxx                  |    1 
 sw/inc/fldbas.hxx                  |    5 -
 sw/inc/shellres.hxx                |    9 +--
 sw/inc/swmodule.hxx                |    3 -
 sw/source/core/edit/autofmt.cxx    |    4 -
 sw/source/core/fields/authfld.cxx  |    5 -
 sw/source/core/fields/docufld.cxx  |    4 -
 sw/source/core/fields/fldbas.cxx   |    8 +-
 sw/source/filter/html/htmlform.cxx |   99 +++++++++++++++++--------------------
 sw/source/filter/html/swhtml.hxx   |    5 -
 sw/source/ui/app/docstyle.cxx      |   41 ++++++---------
 sw/source/ui/app/swmodul1.cxx      |   14 ++---
 sw/source/ui/app/swmodule.cxx      |    2 
 sw/source/ui/config/optpage.cxx    |   14 +----
 sw/source/ui/fldui/fldmgr.cxx      |   11 ++--
 sw/source/ui/inc/optpage.hxx       |    3 -
 sw/source/ui/index/swuiidxmrk.cxx  |   12 ++--
 sw/source/ui/utlui/initui.cxx      |    5 -
 20 files changed, 113 insertions(+), 138 deletions(-)

New commits:
commit e4aecbdbe4e12b241da39d8e7b23dbb8db20bd2f
Author: August Sodora <augsod at gmail.com>
Date:   Fri Jan 13 18:48:31 2012 -0500

    SvStringsDtor->std::vector

diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx
index 2cb105b..d12ee91 100644
--- a/sw/source/filter/html/htmlform.cxx
+++ b/sw/source/filter/html/htmlform.cxx
@@ -26,8 +26,6 @@
  *
  ************************************************************************/
 
-
-
 #include <hintids.hxx>
 #include <comphelper/string.hxx>
 #include <vcl/svapp.hxx>
@@ -205,8 +203,8 @@ class SwHTMLForm_Impl
     uno::Reference< drawing::XShape >               xShape;
 
     String                      sText;
-    SvStringsDtor               aStringList;
-    SvStringsDtor               aValueList;
+    std::vector<String>         aStringList;
+    std::vector<String>         aValueList;
     std::vector<sal_uInt16>     aSelectedList;
 
 public:
@@ -256,16 +254,16 @@ public:
     String& GetText() { return sText; }
     void EraseText() { sText = aEmptyStr; }
 
-    SvStringsDtor& GetStringList() { return aStringList; }
+    std::vector<String>& GetStringList() { return aStringList; }
     void EraseStringList()
     {
-        aStringList.DeleteAndDestroy( 0, aStringList.Count() );
+        aStringList.clear();
     }
 
-    SvStringsDtor& GetValueList() { return aValueList; }
+    std::vector<String>& GetValueList() { return aValueList; }
     void EraseValueList()
     {
-        aValueList.DeleteAndDestroy( 0, aValueList.Count() );
+        aValueList.clear();
     }
 
     std::vector<sal_uInt16>& GetSelectedList() { return aSelectedList; }
@@ -818,8 +816,8 @@ void SwHTMLParser::SetControlSize( const uno::Reference< drawing::XShape >& rSha
 static void lcl_html_setEvents(
         const uno::Reference< script::XEventAttacherManager > & rEvtMn,
         sal_uInt32 nPos, const SvxMacroTableDtor& rMacroTbl,
-        const SvStringsDtor& rUnoMacroTbl,
-        const SvStringsDtor& rUnoMacroParamTbl,
+        const std::vector<String>& rUnoMacroTbl,
+        const std::vector<String>& rUnoMacroParamTbl,
         const String& rType )
 {
     // Erstmal muss die Anzahl der Events ermittelt werden ...
@@ -834,9 +832,9 @@ static void lcl_html_setEvents(
         if( pMacro && aEventListenerTable[i] )
             nEvents++;
     }
-    for( i=0; i< rUnoMacroTbl.Count(); i++ )
+    for( i=0; i< rUnoMacroTbl.size(); i++ )
     {
-        const String& rStr = *rUnoMacroTbl[i];
+        const String& rStr(rUnoMacroTbl[i]);
         xub_StrLen nIndex = 0;
         if( !rStr.GetToken( 0, '-', nIndex ).Len() || STRING_NOTFOUND == nIndex )
             continue;
@@ -867,9 +865,9 @@ static void lcl_html_setEvents(
         }
     }
 
-    for( i=0; i< rUnoMacroTbl.Count(); i++ )
+    for( i=0; i< rUnoMacroTbl.size(); ++i )
     {
-        const String& rStr = *rUnoMacroTbl[i];
+        const String& rStr = rUnoMacroTbl[i];
         xub_StrLen nIndex = 0;
         String sListener( rStr.GetToken( 0, '-', nIndex ) );
         if( !sListener.Len() || STRING_NOTFOUND == nIndex )
@@ -890,16 +888,16 @@ static void lcl_html_setEvents(
         rDesc.ScriptCode = sCode;
         rDesc.AddListenerParam = OUString();
 
-        if( rUnoMacroParamTbl.Count() )
+        if(!rUnoMacroParamTbl.empty())
         {
             String sSearch( sListener );
             sSearch += '-';
             sSearch += sMethod;
             sSearch += '-';
             xub_StrLen nLen = sSearch.Len();
-            for( sal_uInt16 j=0; j < rUnoMacroParamTbl.Count(); j++ )
+            for(size_t j = 0; j < rUnoMacroParamTbl.size(); ++j)
             {
-                const String& rParam = *rUnoMacroParamTbl[j];
+                const String& rParam = rUnoMacroParamTbl[j];
                 if( rParam.CompareTo( sSearch, nLen ) == COMPARE_EQUAL &&
                     rParam.Len() > nLen )
                 {
@@ -913,25 +911,24 @@ static void lcl_html_setEvents(
 }
 
 static void lcl_html_getEvents( const String& rOption, const String& rValue,
-                                SvStringsDtor& rUnoMacroTbl,
-                                SvStringsDtor& rUnoMacroParamTbl )
+                                std::vector<String>& rUnoMacroTbl,
+                                std::vector<String>& rUnoMacroParamTbl )
 {
     if( rOption.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_O_sdevent,
                             sizeof(OOO_STRING_SVTOOLS_HTML_O_sdevent)-1 ) == COMPARE_EQUAL )
     {
-        String *pEvent = new String( rOption.Copy(sizeof(OOO_STRING_SVTOOLS_HTML_O_sdevent)-1) );
-        *pEvent += '-';
-        *pEvent += rValue;
-        rUnoMacroTbl.Insert( pEvent, rUnoMacroTbl.Count() );
+        String aEvent(rOption.Copy(sizeof(OOO_STRING_SVTOOLS_HTML_O_sdevent)-1));
+        aEvent += '-';
+        aEvent += rValue;
+        rUnoMacroTbl.push_back(aEvent);
     }
     else if( rOption.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_O_sdaddparam,
                             sizeof(OOO_STRING_SVTOOLS_HTML_O_sdaddparam)-1 ) == COMPARE_EQUAL )
     {
-        String *pParam =
-                    new String( rOption.Copy( sizeof(OOO_STRING_SVTOOLS_HTML_O_sdaddparam)-1 ) );
-        *pParam += '-';
-        *pParam += rValue;
-        rUnoMacroParamTbl.Insert( pParam, rUnoMacroParamTbl.Count() );
+        String aParam(rOption.Copy( sizeof(OOO_STRING_SVTOOLS_HTML_O_sdaddparam)-1 ) );
+        aParam += '-';
+        aParam += rValue;
+        rUnoMacroParamTbl.push_back(aParam);
     }
 }
 
@@ -940,8 +937,8 @@ uno::Reference< drawing::XShape > SwHTMLParser::InsertControl(
         const uno::Reference< beans::XPropertySet > & rFCompPropSet,
         const Size& rSize, sal_Int16 eVertOri, sal_Int16 eHoriOri,
         SfxItemSet& rCSS1ItemSet, SvxCSS1PropertyInfo& rCSS1PropInfo,
-        const SvxMacroTableDtor& rMacroTbl, const SvStringsDtor& rUnoMacroTbl,
-        const SvStringsDtor& rUnoMacroParamTbl, sal_Bool bSetFCompPropSet,
+        const SvxMacroTableDtor& rMacroTbl, const std::vector<String>& rUnoMacroTbl,
+        const std::vector<String>& rUnoMacroParamTbl, sal_Bool bSetFCompPropSet,
         sal_Bool bHidden )
 {
     uno::Reference< drawing::XShape >  xShape;
@@ -1296,7 +1293,7 @@ uno::Reference< drawing::XShape > SwHTMLParser::InsertControl(
     // auch schon Fokus-Events verschickt. Damit die nicht evtl. schon
     // vorhendene JavaSCript-Eents rufen, werden die Events nachtraeglich
     // gesetzt.
-    if( rMacroTbl.Count() || rUnoMacroTbl.Count() )
+    if( rMacroTbl.Count() || !rUnoMacroTbl.empty() )
     {
         lcl_html_setEvents( pFormImpl->GetControlEventManager(),
                             rFormComps->getCount() - 1,
@@ -1334,8 +1331,8 @@ void SwHTMLParser::NewForm( sal_Bool bAppend )
     sal_uInt16 nEncType = FormSubmitEncoding_URL;
     sal_uInt16 nMethod = FormSubmitMethod_GET;
     SvxMacroTableDtor aMacroTbl;
-    SvStringsDtor aUnoMacroTbl;
-    SvStringsDtor aUnoMacroParamTbl;
+    std::vector<String> aUnoMacroTbl;
+    std::vector<String> aUnoMacroParamTbl;
     SvKeyValueIterator *pHeaderAttrs = pFormImpl->GetHeaderAttrs();
     ScriptType eDfltScriptType = GetScriptType( pHeaderAttrs );
     const String& rDfltScriptType = GetScriptTypeString( pHeaderAttrs );
@@ -1496,8 +1493,8 @@ void SwHTMLParser::InsertInput()
     String sImgSrc, aId, aClass, aStyle, sText;
     String sName;
     SvxMacroTableDtor aMacroTbl;
-    SvStringsDtor aUnoMacroTbl;
-    SvStringsDtor aUnoMacroParamTbl;
+    std::vector<String> aUnoMacroTbl;
+    std::vector<String> aUnoMacroParamTbl;
     sal_uInt16 nSize = 0;
     sal_Int16 nMaxLen = 0;
     sal_Int16 nChecked = STATE_NOCHECK;
@@ -1996,8 +1993,8 @@ void SwHTMLParser::NewTextArea()
     String sName;
     sal_Int32 nTabIndex = TABINDEX_MAX + 1;
     SvxMacroTableDtor aMacroTbl;
-    SvStringsDtor aUnoMacroTbl;
-    SvStringsDtor aUnoMacroParamTbl;
+    std::vector<String> aUnoMacroTbl;
+    std::vector<String> aUnoMacroParamTbl;
     sal_uInt16 nRows = 0, nCols = 0;
     sal_uInt16 nWrap = HTML_WM_OFF;
     sal_Bool bDisabled = sal_False;
@@ -2286,8 +2283,8 @@ void SwHTMLParser::NewSelect()
     String sName;
     sal_Int32 nTabIndex = TABINDEX_MAX + 1;
     SvxMacroTableDtor aMacroTbl;
-    SvStringsDtor aUnoMacroTbl;
-    SvStringsDtor aUnoMacroParamTbl;
+    std::vector<String> aUnoMacroTbl;
+    std::vector<String> aUnoMacroParamTbl;
     sal_Bool bMultiple = sal_False;
     sal_Bool bDisabled = sal_False;
     nSelectEntryCnt = 1;
@@ -2510,22 +2507,21 @@ void SwHTMLParser::EndSelect()
     // die Groesse anpassen
     Size aNewSz( MINFLY, MINFLY );
 
-    sal_uInt16 nEntryCnt = pFormImpl->GetStringList().Count();
-    if( nEntryCnt )
+    size_t nEntryCnt = pFormImpl->GetStringList().size();
+    if(!pFormImpl->GetStringList().empty())
     {
         Sequence<OUString> aList( (sal_Int32)nEntryCnt );
         Sequence<OUString> aValueList( (sal_Int32)nEntryCnt );
         OUString *pStrings = aList.getArray();
         OUString *pValues = aValueList.getArray();
-        sal_uInt16 i;
 
-        for( i = 0; i < nEntryCnt; i++ )
+        for(size_t i = 0; i < nEntryCnt; ++i)
         {
-            rtl::OUString sText( *pFormImpl->GetStringList()[i] );
+            rtl::OUString sText(pFormImpl->GetStringList()[i]);
             sText = comphelper::string::stripEnd(sText, ' ');
             pStrings[i] = sText;
 
-            sText = *pFormImpl->GetValueList()[i];
+            sText = pFormImpl->GetValueList()[i];
             pValues[i] = sText;
         }
 
@@ -2553,7 +2549,7 @@ void SwHTMLParser::EndSelect()
         }
         Sequence<sal_Int16> aSelList( (sal_Int32)nSelCnt );
         sal_Int16 *pSels = aSelList.getArray();
-        for( i=0; i<nSelCnt; i++ )
+        for(size_t i = 0; i < nSelCnt; ++i)
         {
             pSels[i] = (sal_Int16)pFormImpl->GetSelectedList()[i];
         }
@@ -2619,9 +2615,9 @@ void SwHTMLParser::InsertSelectOption()
         }
     }
 
-    sal_uInt16 nEntryCnt = pFormImpl->GetStringList().Count();
-    pFormImpl->GetStringList().Insert( new String( aEmptyStr ), nEntryCnt );
-    pFormImpl->GetValueList().Insert( new String( aValue ), nEntryCnt );
+    sal_uInt16 nEntryCnt = pFormImpl->GetStringList().size();
+    pFormImpl->GetStringList().push_back(aEmptyStr);
+    pFormImpl->GetValueList().push_back(aValue);
     if( bLBEntrySelected )
     {
         pFormImpl->GetSelectedList().push_back( nEntryCnt );
@@ -2634,10 +2630,9 @@ void SwHTMLParser::InsertSelectText()
     OSL_ENSURE( pFormImpl && pFormImpl->GetFCompPropSet().is(),
             "kein Select-Control" );
 
-    sal_uInt16 nEntryCnt = pFormImpl->GetStringList().Count();
-    if( nEntryCnt )
+    if(!pFormImpl->GetStringList().empty())
     {
-        String& rText = *pFormImpl->GetStringList()[nEntryCnt-1];
+        String& rText = pFormImpl->GetStringList().back();
 
         if( aToken.Len() && ' '==aToken.GetChar( 0 ) )
         {
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index 2343257..f751719 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -44,7 +44,6 @@ class SfxMedium;
 class SfxViewFrame;
 class SdrObject;
 class SvxMacroTableDtor;
-class SvStringsDtor;
 class SwDoc;
 class SwPaM;
 class ViewShell;
@@ -800,8 +799,8 @@ private:
                         SfxItemSet& rCSS1ItemSet,
                         SvxCSS1PropertyInfo& rCSS1PropInfo,
                         const SvxMacroTableDtor& rMacroTbl,
-                        const SvStringsDtor& rUnoMacroTbl,
-                        const SvStringsDtor& rUnoMacroParamTbl,
+                        const std::vector<String>& rUnoMacroTbl,
+                        const std::vector<String>& rUnoMacroParamTbl,
                         sal_Bool bSetPropSet = sal_True,
                         sal_Bool bHidden = sal_False );
     void SetControlSize( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rShape, const Size& rTextSz,
commit 166053646aff23f93ad3704cde05b9bda20e171c
Author: August Sodora <augsod at gmail.com>
Date:   Fri Jan 13 18:27:59 2012 -0500

    SvStringsDtor->std::vector

diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index e41c79f..3952f40 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -504,11 +504,11 @@ IMPL_LINK_INLINE_START( SwAddPrinterTabPage, AutoClickHdl, CheckBox *, EMPTYARG
 }
 IMPL_LINK_INLINE_END( SwAddPrinterTabPage, AutoClickHdl, CheckBox *, EMPTYARG )
 
-void  SwAddPrinterTabPage::SetFax( const SvStringsDtor& rFaxLst )
+void  SwAddPrinterTabPage::SetFax( const std::vector<String>& rFaxLst )
 {
     aFaxLB.InsertEntry(sNone);
-    for ( sal_uInt16 i = 0; i < rFaxLst.Count(); ++i )
-        aFaxLB.InsertEntry( *rFaxLst.GetObject(i) );
+    for(size_t i = 0; i < rFaxLst.size(); ++i)
+        aFaxLB.InsertEntry(rFaxLst[0]);
     aFaxLB.SelectEntryPos(0);
 }
 
@@ -530,14 +530,10 @@ void SwAddPrinterTabPage::PageCreated (SfxAllItemSet aSet)
     }
     if (pListItem && pListItem->GetValue())
     {
-        SvStringsDtor aFaxList;
+        std::vector<String> aFaxList;
         const std::vector<rtl::OUString>& rPrinters = Printer::GetPrinterQueues();
         for (unsigned int i = 0; i < rPrinters.size(); ++i)
-        {
-            String* pString = new String( rPrinters[i] );
-            String* &rpString = pString;
-            aFaxList.Insert(rpString, 0);
-        }
+            aFaxList.insert(aFaxList.begin(), rPrinters[i]);
         SetFax( aFaxList );
     }
 }
diff --git a/sw/source/ui/inc/optpage.hxx b/sw/source/ui/inc/optpage.hxx
index fd66d03..010fe00 100644
--- a/sw/source/ui/inc/optpage.hxx
+++ b/sw/source/ui/inc/optpage.hxx
@@ -41,7 +41,6 @@
 #include <svtools/ctrlbox.hxx>
 #include <svx/fntctrl.hxx>
 #include <fontcfg.hxx>
-class SvStringsDtor;
 class SfxPrinter;
 class SwWrtShell;
 class FontList;
@@ -148,7 +147,7 @@ public:
 
     virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
     virtual void        Reset( const SfxItemSet& rSet );
-    void                SetFax( const SvStringsDtor& );
+    void                SetFax( const std::vector<String>& );
     void                SelectFax( const String& );
     void                SetPreview(sal_Bool bPrev);
     virtual void        PageCreated (SfxAllItemSet aSet);
commit 16b7354f9f89127f5746266fc77fcb844b9309ca
Author: August Sodora <augsod at gmail.com>
Date:   Fri Jan 13 18:23:08 2012 -0500

    SvStringsDtor->std::vector

diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 2f667e8..fa1ab08 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -107,7 +107,7 @@ public:
 
     const SwAuthEntry*  GetEntryByHandle(long nHandle) const;
 
-    void                GetAllEntryIdentifiers( SvStringsDtor& rToFill )const;
+    void                GetAllEntryIdentifiers( std::vector<String>& rToFill )const;
     const SwAuthEntry*  GetEntryByIdentifier(const String& rIdentifier)const;
 
     bool                ChangeEntryContent(const SwAuthEntry* pNewEntry);
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 718e963..2a4d66d 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -218,13 +218,12 @@ const SwAuthEntry*  SwAuthorityFieldType::GetEntryByHandle(long nHandle) const
 }
 
 void SwAuthorityFieldType::GetAllEntryIdentifiers(
-                SvStringsDtor& rToFill )const
+    std::vector<String>& rToFill )const
 {
     for(sal_uInt16 j = 0; j < m_pDataArr->Count(); j++)
     {
         SwAuthEntry* pTemp = m_pDataArr->GetObject(j);
-        rToFill.Insert( new String( pTemp->GetAuthorField(
-                    AUTH_FIELD_IDENTIFIER )), rToFill.Count() );
+        rToFill.push_back(pTemp->GetAuthorField(AUTH_FIELD_IDENTIFIER));
     }
 }
 
diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index 8ae8043..72b2639 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -1477,10 +1477,10 @@ IMPL_LINK(SwAuthMarkDlg, ChangeSourceHdl, RadioButton*, pButton)
                                     pSh->GetFldType(RES_AUTHORITY, aEmptyStr);
         if(pFType)
         {
-            SvStringsDtor aIds;
+            std::vector<String> aIds;
             pFType->GetAllEntryIdentifiers( aIds );
-            for(sal_uInt16 n = 0; n < aIds.Count(); n++)
-                aEntryLB.InsertEntry(*aIds.GetObject(n));
+            for(size_t n = 0; n < aIds.size(); ++n)
+                aEntryLB.InsertEntry(aIds[n]);
         }
         if(m_sCreatedEntry[AUTH_FIELD_IDENTIFIER].Len())
             aEntryLB.InsertEntry(m_sCreatedEntry[AUTH_FIELD_IDENTIFIER]);
@@ -1656,10 +1656,10 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(Window* pParent,
                                         rSh.GetFldType(RES_AUTHORITY, aEmptyStr);
             if(pFType)
             {
-                SvStringsDtor aIds;
+                std::vector<String> aIds;
                 pFType->GetAllEntryIdentifiers( aIds );
-                for(sal_uInt16 n = 0; n < aIds.Count(); n++)
-                    pIdentifierBox->InsertEntry(*aIds.GetObject(n));
+                for(size_t n = 0; n < aIds.size(); ++n)
+                    pIdentifierBox->InsertEntry(aIds[n]);
             }
             pIdentifierBox->SetText(pFields[aCurInfo.nToxField]);
             Size aTmp(aEditSize);
commit f1de38b5441e082d80f663923a9ac713c8db172d
Author: August Sodora <augsod at gmail.com>
Date:   Fri Jan 13 18:14:36 2012 -0500

    SvStringsDtor->std::vector

diff --git a/sw/inc/shellres.hxx b/sw/inc/shellres.hxx
index 2c7ccc2..688fe08 100644
--- a/sw/inc/shellres.hxx
+++ b/sw/inc/shellres.hxx
@@ -74,10 +74,10 @@ struct SW_DLLPUBLIC ShellResource : public Resource
 
     String          aHyperlinkClick;
 
-    SvStringsDtor   aDocInfoLst;
+    std::vector<String> aDocInfoLst;
 
     // The autoFormat-Redline comments.
-    inline const SvStringsDtor& GetAutoFmtNameLst() const;
+    inline const std::vector<String>& GetAutoFmtNameLst() const;
 
     enum PageNameMode
     {
@@ -95,20 +95,19 @@ struct SW_DLLPUBLIC ShellResource : public Resource
 
 private:
     void _GetAutoFmtNameLst() const;
-    SvStringsDtor   *pAutoFmtNameLst;
+    std::vector<String> *pAutoFmtNameLst;
     String          sPageDescFirstName;
     String          sPageDescFollowName;
     String          sPageDescName;
 };
 
-inline const SvStringsDtor& ShellResource::GetAutoFmtNameLst() const
+inline const std::vector<String>& ShellResource::GetAutoFmtNameLst() const
 {
     if( !pAutoFmtNameLst )
         _GetAutoFmtNameLst();
     return *pAutoFmtNameLst;
 }
 
-
 #endif //_SHELLRES_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 8cb70ce..34951a3 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -290,7 +290,7 @@ void SwAutoFormat::_SetRedlineTxt( sal_uInt16 nActionId )
     sal_uInt16 nSeqNo = 0;
     if( STR_AUTOFMTREDL_END > nActionId )
     {
-        sTxt = *ViewShell::GetShellRes()->GetAutoFmtNameLst()[ nActionId ];
+        sTxt = ViewShell::GetShellRes()->GetAutoFmtNameLst()[ nActionId ];
         switch( nActionId )
         {
         case STR_AUTOFMTREDL_SET_NUMBULET:
@@ -1829,7 +1829,7 @@ void SwAutoFormat::BuildHeadLine( sal_uInt16 nLvl )
 {
     if( aFlags.bWithRedlining )
     {
-        String sTxt( *ViewShell::GetShellRes()->GetAutoFmtNameLst()[
+        String sTxt(ViewShell::GetShellRes()->GetAutoFmtNameLst()[
                                     STR_AUTOFMTREDL_SET_TMPL_HEADLINE ] );
         sTxt.SearchAndReplace( String::CreateFromAscii(
                                     RTL_CONSTASCII_STRINGPARAM( "$(ARG1)" )),
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index ce8a06d..8b0ecf0 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -1167,8 +1167,8 @@ String SwDocInfoField::GetFieldName() const
             break;
 
         default:
-            aStr += *ViewShell::GetShellRes()
-                        ->aDocInfoLst[ nSub - DI_SUBTYPE_BEGIN ];
+            aStr += ViewShell::GetShellRes()
+                     ->aDocInfoLst[ nSub - DI_SUBTYPE_BEGIN ];
             break;
     }
     if (IsFixed())
diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx
index 7c27a50..54ec652 100644
--- a/sw/source/ui/fldui/fldmgr.cxx
+++ b/sw/source/ui/fldui/fldmgr.cxx
@@ -587,7 +587,7 @@ sal_Bool SwFldMgr::GetSubTypes(sal_uInt16 nTypeId, std::vector<String>& rToFill)
                             if ( i == DI_CUSTOM )
                                 pNew = String(SW_RES( STR_CUSTOM ));
                             else
-                                pNew = *ViewShell::GetShellRes()->aDocInfoLst[i];
+                                pNew = ViewShell::GetShellRes()->aDocInfoLst[i];
                         }
                         else
                             pNew = SW_RESSTR(aSwFlds[nPos].nSubTypeStart + i);
diff --git a/sw/source/ui/utlui/initui.cxx b/sw/source/ui/utlui/initui.cxx
index 8f64d8a..dacbb6e 100644
--- a/sw/source/ui/utlui/initui.cxx
+++ b/sw/source/ui/utlui/initui.cxx
@@ -179,10 +179,7 @@ ShellResource::ShellResource()
     aHyperlinkClick.SearchAndReplaceAllAscii( "%s", aModStr );
 
     for(sal_uInt16 i = 0; i < nCount; ++i)
-    {
-        String* pNew = new SW_RESSTR(FLD_DOCINFO_BEGIN + i);
-        aDocInfoLst.Insert(pNew, aDocInfoLst.Count());
-    }
+        aDocInfoLst.push_back(String(SW_RESSTR(FLD_DOCINFO_BEGIN + i)));
 
     FreeResource();
 }
commit 5b12914f96ef0891c7e20f6edc63d58dc6cc1e17
Author: August Sodora <augsod at gmail.com>
Date:   Fri Jan 13 18:05:49 2012 -0500

    SvStringsDtor->std::vector

diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx
index df7f34b..70cae0f 100644
--- a/sw/inc/swmodule.hxx
+++ b/sw/inc/swmodule.hxx
@@ -41,7 +41,6 @@
 #include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
 #include <editeng/svxenum.hxx>
 
-class SvStringsDtor;
 class Color;
 class SfxItemSet;
 class SfxRequest;
@@ -107,7 +106,7 @@ class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener, public utl::C
     SwView*             pView;
 
     // List of all Redline-authors.
-    SvStringsDtor*      pAuthorNames;
+    std::vector<String>*      pAuthorNames;
 
     // DictionaryList listener to trigger spellchecking or hyphenation
     ::com::sun::star::uno::Reference<
diff --git a/sw/source/ui/app/swmodul1.cxx b/sw/source/ui/app/swmodul1.cxx
index ccd38e1..3998e42 100644
--- a/sw/source/ui/app/swmodul1.cxx
+++ b/sw/source/ui/app/swmodul1.cxx
@@ -434,23 +434,23 @@ void SwModule::SetRedlineAuthor(const String &rAuthor)
 
 const String& SwModule::GetRedlineAuthor(sal_uInt16 nPos)
 {
-    OSL_ENSURE(nPos<pAuthorNames->Count(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash
-    while (!(nPos<pAuthorNames->Count()))
+    OSL_ENSURE(nPos < pAuthorNames->size(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash
+    while(!(nPos < pAuthorNames->size()))
     {
         InsertRedlineAuthor(String(RTL_CONSTASCII_USTRINGPARAM("nn")));
     };
-    return *pAuthorNames->GetObject(nPos);
+    return (*pAuthorNames)[nPos];
 }
 
 sal_uInt16 SwModule::InsertRedlineAuthor(const String& rAuthor)
 {
     sal_uInt16 nPos = 0;
 
-    while (nPos < pAuthorNames->Count() && *pAuthorNames->GetObject(nPos) != rAuthor)
-        nPos++;
+    while(nPos < pAuthorNames->size() && (*pAuthorNames)[nPos] != rAuthor)
+        ++nPos;
 
-    if (nPos == pAuthorNames->Count())
-        pAuthorNames->Insert(new String(rAuthor), nPos);
+    if (nPos == pAuthorNames->size())
+        pAuthorNames->push_back(rAuthor);
 
     return nPos;
 }
diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx
index 5881215..bbaff8f 100644
--- a/sw/source/ui/app/swmodule.cxx
+++ b/sw/source/ui/app/swmodule.cxx
@@ -200,7 +200,7 @@ SwModule::SwModule( SfxObjectFactory* pWebFact,
 
     pStdFontConfig = new SwStdFontConfig;
 
-    pAuthorNames = new SvStringsDtor(5, 1);    // All Redlining-Authors
+    pAuthorNames = new std::vector<String>;    // All Redlining-Authors
 
     // replace SvxAutocorrect with SwAutocorrect
     SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();
commit c0d93b267f56d06cd464f3e49af368164e6cd164
Author: August Sodora <augsod at gmail.com>
Date:   Fri Jan 13 17:51:41 2012 -0500

    SvStringsDtor->std::vector

diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 8e98585..2f667e8 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -31,6 +31,7 @@
 #include "swdllapi.h"
 #include <fldbas.hxx>
 #include <toxe.hxx>
+#include <svl/svstdarr.hxx>
 #include <vector>
 
 class SwAuthDataArr;
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index f865175..583f286 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -33,12 +33,11 @@
 #include "swdllapi.h"
 #include <calbck.hxx>
 #include <com/sun/star/uno/Any.hxx>
+#include <vector>
 
 class SwDoc;
-class SvStringsDtor;
 class SvNumberFormatter;
 
-
 enum RES_FIELDS
 {
 // For old documents the Field-Which IDs must be preserved !!!
@@ -242,7 +241,7 @@ class SW_DLLPUBLIC SwFieldType : public SwModify
     sal_uInt16 nWhich;
 
     friend void _FinitUI();     // In order to delete pointer!
-    static  SvStringsDtor*  pFldNames;
+    static  std::vector<String>* pFldNames;
 
     static void _GetFldName();  // Sets up FldNames; fldmgr.cxx!
 
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index 04c5b14..144191c 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -79,8 +79,7 @@ sal_uInt16 lcl_GetLanguageOfFormat( sal_uInt16 nLng, sal_uLong nFmt,
  --------------------------------------------------------------------*/
 // Array der Feldname
 
-SvStringsDtor* SwFieldType::pFldNames = 0;
-
+std::vector<String>* SwFieldType::pFldNames = 0;
 
     sal_uInt16 aTypeTab[] = {
     /* RES_DBFLD            */      TYP_DBFLD,
@@ -133,13 +132,12 @@ const String& SwFieldType::GetTypeStr(sal_uInt16 nTypeId)
     if( !pFldNames )
         _GetFldName();
 
-    if( nTypeId < SwFieldType::pFldNames->Count() )
-        return *SwFieldType::pFldNames->GetObject( nTypeId );
+    if( nTypeId < SwFieldType::pFldNames->size() )
+        return (*SwFieldType::pFldNames)[nTypeId];
     else
         return aEmptyStr;
 }
 
-
 /*---------------------------------------------------
  Jedes Feld referenziert einen Feldtypen, der fuer
  jedes Dokument einmalig ist.
diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx
index 2b71c83..7c27a50 100644
--- a/sw/source/ui/fldui/fldmgr.cxx
+++ b/sw/source/ui/fldui/fldmgr.cxx
@@ -1653,12 +1653,13 @@ void SwFieldType::_GetFldName()
     };
 
     // insert infos for fields
-    SwFieldType::pFldNames = new SvStringsDtor( (sal_uInt8)coFldCnt, 2 );
+    SwFieldType::pFldNames = new std::vector<String>;
+    SwFieldType::pFldNames->reserve(coFldCnt);
     for( sal_uInt16 nIdx = 0; nIdx < coFldCnt; ++nIdx )
     {
-        String* pTmp = new SW_RESSTR( coFldNms[ nIdx ] );
-        pTmp->Assign( MnemonicGenerator::EraseAllMnemonicChars( *pTmp ) );
-        SwFieldType::pFldNames->Insert(pTmp, nIdx );
+        String aTmp(SW_RESSTR( coFldNms[ nIdx ] ));
+        aTmp.Assign( MnemonicGenerator::EraseAllMnemonicChars( aTmp ) );
+        SwFieldType::pFldNames->push_back(aTmp);
     }
 }
 
commit 08443f12858bc4ff902d8d8400b8696161ced7cf
Author: August Sodora <augsod at gmail.com>
Date:   Fri Jan 13 17:28:49 2012 -0500

    Remove unnecessary forward declaration

diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 173de37..f374987 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -65,7 +65,6 @@ class SwDDEFieldType;
 class SwNewDBMgr;
 
 struct SwDocStat;
-class SvStringsDtor;
 class SwAutoCompleteWord;
 
 class SwFmtRefMark;
commit 445fc29e35fab58a59c6fa17ce06601eb131d440
Author: August Sodora <augsod at gmail.com>
Date:   Fri Jan 13 17:17:39 2012 -0500

    SvStringsDtor->std::vector

diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx
index 4c64bb6..dea7fbf 100644
--- a/sw/inc/docstyle.hxx
+++ b/sw/inc/docstyle.hxx
@@ -46,7 +46,7 @@ class SwNumRule;
 /*--------------------------------------------------------------------
     Local helper class.
  --------------------------------------------------------------------*/
-class SwPoolFmtList : public SvStringsDtor
+class SwPoolFmtList : public std::vector<String>
 {
 public:
     SwPoolFmtList() {}
@@ -54,7 +54,6 @@ public:
     void Erase();
 };
 
-
 /*--------------------------------------------------------------------
     Temporary StyleSheet.
  --------------------------------------------------------------------*/
diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
index f4d3010..5da6519 100644
--- a/sw/source/ui/app/docstyle.cxx
+++ b/sw/source/ui/app/docstyle.cxx
@@ -314,7 +314,7 @@ const SwNumRule* lcl_FindNumRule(   SwDoc&  rDoc,
 sal_uInt16 lcl_FindName( const SwPoolFmtList& rLst, SfxStyleFamily eFam,
                         const String& rName )
 {
-    if( rLst.Count() )
+    if(!rLst.empty())
     {
         String sSrch( ' ' );
         switch( eFam )
@@ -327,8 +327,8 @@ sal_uInt16 lcl_FindName( const SwPoolFmtList& rLst, SfxStyleFamily eFam,
         default:; //prevent warning
         }
         sSrch += rName;
-        for( sal_uInt16 i=0; i < rLst.Count(); ++i )
-            if( *rLst[i] == sSrch )
+        for(size_t i = 0; i < rLst.size(); ++i)
+            if(rLst[i] == sSrch)
                 return i;
     }
     return USHRT_MAX;
@@ -361,17 +361,12 @@ sal_Bool FindPhyStyle( SwDoc& rDoc, const String& rName, SfxStyleFamily eFam )
 
 void SwPoolFmtList::Append( char cChar, const String& rStr )
 {
-    String* pStr = new String( cChar );
-    *pStr += rStr;
-    for ( sal_uInt16 i=0; i < Count(); ++i )
-    {
-        if( *operator[](i) == *pStr )
-        {
-            delete pStr;
+    String aStr(cChar);
+    aStr += rStr;
+    for(std::vector<String>::const_iterator i = begin(); i != end(); ++i)
+        if(*i == aStr)
             return;
-        }
-    }
-    Insert( pStr, Count() );
+    push_back(aStr);
 }
 
 /*--------------------------------------------------------------------
@@ -381,7 +376,7 @@ void SwPoolFmtList::Append( char cChar, const String& rStr )
 
 void SwPoolFmtList::Erase()
 {
-    DeleteAndDestroy( 0, Count() );
+    clear();
 }
 
 /*--------------------------------------------------------------------
@@ -2401,7 +2396,7 @@ sal_uInt16  SwStyleSheetIterator::Count()
     // let the list fill correctly!!
     if( !bFirstCalled )
         First();
-    return aLst.Count();
+    return aLst.size();
 }
 
 SfxStyleSheetBase*  SwStyleSheetIterator::operator[]( sal_uInt16 nIdx )
@@ -2409,7 +2404,7 @@ SfxStyleSheetBase*  SwStyleSheetIterator::operator[]( sal_uInt16 nIdx )
     // found
     if( !bFirstCalled )
         First();
-    mxStyleSheet->PresetNameAndFamily( *aLst[ nIdx ] );
+    mxStyleSheet->PresetNameAndFamily( aLst[ nIdx ] );
     mxStyleSheet->SetPhysical( sal_False );
     mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
 
@@ -2740,7 +2735,7 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
                             bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, cNUMRULE);
     }
 
-    if(aLst.Count() > 0)
+    if(!aLst.empty())
     {
         nLastPos = USHRT_MAX;
         return Next();
@@ -2750,10 +2745,10 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
 
 SfxStyleSheetBase*  SwStyleSheetIterator::Next()
 {
-    nLastPos++;
-    if(aLst.Count() > 0 && nLastPos < aLst.Count())
+    ++nLastPos;
+    if(!aLst.empty() && nLastPos < aLst.size())
     {
-        mxIterSheet->PresetNameAndFamily(*aLst[nLastPos]);
+        mxIterSheet->PresetNameAndFamily(aLst[nLastPos]);
         mxIterSheet->SetPhysical( sal_False );
         mxIterSheet->SetMask( nMask );
         if(mxIterSheet->pSet)
@@ -2776,7 +2771,7 @@ SfxStyleSheetBase*  SwStyleSheetIterator::Find( const UniString& rName )
     if( USHRT_MAX != nLastPos )
     {
         // found
-        mxStyleSheet->PresetNameAndFamily(*aLst[nLastPos]);
+        mxStyleSheet->PresetNameAndFamily(aLst[nLastPos]);
         // new name is set, so determine its Data
         mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
         if( !mxStyleSheet->IsPhysical() )
@@ -2835,8 +2830,8 @@ void  SwStyleSheetIterator::Notify( SfxBroadcaster&, const SfxHint& rHint )
         {
             sal_uInt16 nTmpPos = lcl_FindName( aLst, pStyle->GetFamily(),
                                            pStyle->GetName() );
-            if( nTmpPos < aLst.Count() )
-                aLst.DeleteAndDestroy( nTmpPos );
+            if( nTmpPos < aLst.size() )
+                aLst.erase(aLst.begin() + nTmpPos);
         }
     }
 }


More information about the Libreoffice-commits mailing list