diff options
Diffstat (limited to 'filter/source/graphicfilter/icgm/elements.cxx')
-rw-r--r-- | filter/source/graphicfilter/icgm/elements.cxx | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/filter/source/graphicfilter/icgm/elements.cxx b/filter/source/graphicfilter/icgm/elements.cxx index 609128e11585..4449785988e4 100644 --- a/filter/source/graphicfilter/icgm/elements.cxx +++ b/filter/source/graphicfilter/icgm/elements.cxx @@ -29,11 +29,6 @@ CGMElements::CGMElements() CGMElements::~CGMElements() { - DeleteAllBundles( aLineList ); - DeleteAllBundles( aMarkerList ); - DeleteAllBundles( aEdgeList ); - DeleteAllBundles( aTextList ); - DeleteAllBundles( aFillList ); } @@ -290,23 +285,13 @@ void CGMElements::ImplInsertHatch( sal_Int32 nKey, int nStyle, long nDistance, l } -void CGMElements::DeleteAllBundles( BundleList& rList ) -{ - for (Bundle* i : rList) { - delete i; - } - rList.clear(); -}; - - void CGMElements::CopyAllBundles( const BundleList& rSource, BundleList& rDest ) { - DeleteAllBundles( rDest ); + rDest.clear(); - for (Bundle* pPtr : rSource) + for (auto & pPtr : rSource) { - Bundle* pTempBundle = pPtr->Clone(); - rDest.push_back( pTempBundle ); + rDest.push_back( pPtr->Clone() ); } }; @@ -323,9 +308,9 @@ Bundle* CGMElements::GetBundleIndex( long nIndex, BundleList& rList, Bundle& rBu Bundle* CGMElements::GetBundle( BundleList& rList, long nIndex ) { - for (Bundle* i : rList) { + for (auto const & i : rList) { if ( i->GetIndex() == nIndex ) { - return i; + return i.get(); } } return nullptr; @@ -338,16 +323,14 @@ Bundle* CGMElements::InsertBundle( BundleList& rList, Bundle& rBundle ) if ( pBundle ) { for ( BundleList::iterator it = rList.begin(); it != rList.end(); ++it ) { - if ( *it == pBundle ) { + if ( it->get() == pBundle ) { rList.erase( it ); - delete pBundle; break; } } } - pBundle = rBundle.Clone(); - rList.push_back( pBundle ); - return pBundle; + rList.push_back( rBundle.Clone() ); + return rList.back().get(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |