diff options
author | August Sodora <augsod@gmail.com> | 2012-01-12 23:15:09 -0500 |
---|---|---|
committer | August Sodora <augsod@gmail.com> | 2012-01-12 23:15:09 -0500 |
commit | c1400c98ce137dddb252f9759ca9a89ab3452764 (patch) | |
tree | 5f2e129f338002acf9f4a5a22e492f0f3c22a188 /sw | |
parent | cc651ffb0b0a2e2c9b07e5043c4474c026082445 (diff) |
SvStringsDtor->std::vector
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/doc.hxx | 2 | ||||
-rw-r--r-- | sw/inc/editsh.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/edit/editsh.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unocoll.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/fldui/flddinf.cxx | 6 | ||||
-rw-r--r-- | sw/source/ui/fldui/flddok.cxx | 18 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldfunc.cxx | 8 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldmgr.cxx | 19 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldref.cxx | 6 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldvar.cxx | 24 | ||||
-rw-r--r-- | sw/source/ui/inc/fldmgr.hxx | 3 | ||||
-rw-r--r-- | sw/source/ui/utlui/content.cxx | 7 |
13 files changed, 53 insertions, 54 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 11f8cd8f0b2b..e85ba272a646 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 70af368d9fa4..11e337644f08 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 8be6aa72ab5b..8c61466eb9f9 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 d98459809b70..41d113aa2ffa 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 36de7ef19a30..4996bd3114a5 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 f89b64bb1270..7160fc2f0b69 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 eaaa77f4d0e9..5b685316ad9f 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 15d6ac9612d8..a8fab0674490 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 789598b78b19..2b71c83a6936 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 817c9f2f0073..948380f87732 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 61333b1d9e8d..64fb7e1cb495 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 0e200362ed27..0ed199082087 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 f2c9657ea8af..1fd421c1a105 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); } } |