Kaydet (Commit) 3694f94b authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Michael Stahl

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
üst 04377915
......@@ -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));
......
......@@ -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 );
}
}
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment