diff options
author | Noel Grandin <noel@peralex.com> | 2012-05-23 14:15:24 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-05-25 00:17:07 +0200 |
commit | 3694f94b7457614e34d6ce039acdfa082071562b (patch) | |
tree | 01d3d814346fc869318bda50b03e8dcf365731cb /sw | |
parent | Convert SV_DECL_PTRARR_DEL(SwDSParamArr) to boost::ptr_vector (diff) | |
download | core-3694f94b7457614e34d6ce039acdfa082071562b.tar.gz core-3694f94b7457614e34d6ce039acdfa082071562b.zip |
Convert SV_DECL_PTRARR_DEL(SwLabRecs) to std::vector
I can't use boost::ptr_vector here because the code removes
entries from the list without free'ing them.
Change-Id: I1640d0bb97443998c02148ed24bbd6ad0d390234
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/envelp/label1.cxx | 16 | ||||
-rw-r--r-- | sw/source/ui/envelp/labelcfg.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/envelp/labimp.hxx | 10 |
3 files changed, 17 insertions, 11 deletions
diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx index 72c2af31ab0d..2c6257ce8e68 100644 --- a/sw/source/ui/envelp/label1.cxx +++ b/sw/source/ui/envelp/label1.cxx @@ -52,8 +52,6 @@ extern SW_DLLPUBLIC String MakeSender(); -SV_IMPL_PTRARR( SwLabRecs, SwLabRec* ); - void SwLabRec::SetFromItem( const SwLabItem& rItem ) { lHDist = rItem.lHDist; @@ -86,7 +84,7 @@ void SwLabRec::FillItem( SwLabItem& rItem ) const void SwLabDlg::_ReplaceGroup( const String &rMake ) { // Remove old entries - pRecs->Remove( 1, pRecs->Count() - 1 ); + pRecs->erase( pRecs->begin() + 1, pRecs->begin() + pRecs->size() - 1 ); aLabelsCfg.FillLabels(rtl::OUString(rMake), *pRecs); aLstGroup = rMake; } @@ -154,10 +152,10 @@ SwLabDlg::SwLabDlg(Window* pParent, const SfxItemSet& rSet, sal_Bool bDouble = sal_False; - for (sal_uInt16 nRecPos = 0; nRecPos < pRecs->Count(); nRecPos++) + for (sal_uInt16 nRecPos = 0; nRecPos < pRecs->size(); nRecPos++) { - if (pRec->aMake == pRecs->GetObject(nRecPos)->aMake && - pRec->aType == pRecs->GetObject(nRecPos)->aType) + if (pRec->aMake == (*pRecs)[nRecPos]->aMake && + pRec->aType == (*pRecs)[nRecPos]->aType) { bDouble = sal_True; break; @@ -165,7 +163,7 @@ SwLabDlg::SwLabDlg(Window* pParent, const SfxItemSet& rSet, } if (!bDouble) - pRecs->C40_INSERT( SwLabRec, pRec, 0 ); + pRecs->insert( pRecs->begin(), pRec ); sal_uInt16 nLstGroup = 0; const ::com::sun::star::uno::Sequence<rtl::OUString>& rMan = aLabelsCfg.GetManufacturers(); @@ -216,7 +214,7 @@ SwLabRec* SwLabDlg::GetRecord(const String &rRecName, sal_Bool bCont) sal_Bool bFound = sal_False; String sCustom(SW_RES(STR_CUSTOM)); - const sal_uInt16 nCount = Recs().Count(); + const sal_uInt16 nCount = Recs().size(); for (sal_uInt16 i = 0; i < nCount; i++) { pRec = Recs()[i]; @@ -418,7 +416,7 @@ IMPL_LINK_NOARG(SwLabPage, MakeHdl) aItem.aLstMake = aMake; const sal_Bool bCont = aContButton.IsChecked(); - const sal_uInt16 nCount = GetParent()->Recs().Count(); + const sal_uInt16 nCount = GetParent()->Recs().size(); sal_uInt16 nLstType = 0; const String sCustom(SW_RES(STR_CUSTOM)); diff --git a/sw/source/ui/envelp/labelcfg.cxx b/sw/source/ui/envelp/labelcfg.cxx index 3ee9fe382070..78f86a2ef19e 100644 --- a/sw/source/ui/envelp/labelcfg.cxx +++ b/sw/source/ui/envelp/labelcfg.cxx @@ -177,7 +177,7 @@ void SwLabelConfig::FillLabels(const OUString& rManufacturer, SwLabRecs& rLab Sequence<OUString> aPropNames = lcl_CreatePropertyNames(sPrefix); Sequence<Any> aValues = GetProperties(aPropNames); SwLabRec* pNewRec = lcl_CreateSwLabRec(aValues, rManufacturer); - rLabArr.C40_INSERT( SwLabRec, pNewRec, rLabArr.Count() ); + rLabArr.push_back( pNewRec ); } } diff --git a/sw/source/ui/envelp/labimp.hxx b/sw/source/ui/envelp/labimp.hxx index a20415ec6c0a..bc004e12b7ea 100644 --- a/sw/source/ui/envelp/labimp.hxx +++ b/sw/source/ui/envelp/labimp.hxx @@ -83,6 +83,7 @@ #include <svtools/svtreebx.hxx> #include <label.hxx> #include <labimg.hxx> +#include <vector> #define GETFLDVAL(rField) (rField).Denormalize((rField).GetValue(FUNIT_TWIP)) #define SETFLDVAL(rField, lValue) (rField).SetValue((rField).Normalize(lValue), FUNIT_TWIP) @@ -113,7 +114,14 @@ public: }; -SV_DECL_PTRARR_DEL( SwLabRecs, SwLabRec*, 110 ) +class SwLabRecs : public std::vector<SwLabRec*> { +public: + ~SwLabRecs() + { + for(const_iterator it = begin(); it != end(); ++it) + delete *it; + } +}; #endif |