diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-06-13 11:31:47 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-06-13 11:32:08 +0200 |
commit | fd7759ee8ac2f12b55a3834742ef63b858eda15a (patch) | |
tree | badd68984c42346b8aedf002aa74fff158bf156b /svx | |
parent | 2a73e7d88c19cab69733a4f6433d8576856285ac (diff) |
Use unique_ptr in ItemPoolVector
Change-Id: I0ca2209d2fcbd7a16b67eee546b3ccc5393f2d42
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/unodraw/unomtabl.cxx | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/svx/source/unodraw/unomtabl.cxx b/svx/source/unodraw/unomtabl.cxx index 0796fc768308..ebb05b90733b 100644 --- a/svx/source/unodraw/unomtabl.cxx +++ b/svx/source/unodraw/unomtabl.cxx @@ -17,11 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> +#include <memory> #include <set> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/drawing/PointSequence.hpp> +#include <o3tl/make_unique.hxx> #include <svl/style.hxx> #include <comphelper/sequence.hxx> @@ -48,7 +51,7 @@ using namespace ::com::sun::star; using namespace ::cppu; -typedef std::vector< SfxItemSet* > ItemPoolVector; +typedef std::vector<std::unique_ptr<SfxItemSet>> ItemPoolVector; class SvxUnoMarkerTable : public WeakImplHelper< container::XNameContainer, lang::XServiceInfo >, public SfxListener @@ -109,14 +112,6 @@ SvxUnoMarkerTable::~SvxUnoMarkerTable() throw() void SvxUnoMarkerTable::dispose() { - ItemPoolVector::iterator aIter = maItemSetVector.begin(); - const ItemPoolVector::iterator aEnd = maItemSetVector.end(); - - while( aIter != aEnd ) - { - delete (*aIter++); - } - maItemSetVector.clear(); } @@ -147,8 +142,9 @@ uno::Sequence< OUString > SAL_CALL SvxUnoMarkerTable::getSupportedServiceNames( void SAL_CALL SvxUnoMarkerTable::ImplInsertByName( const OUString& aName, const uno::Any& aElement ) { - SfxItemSet* pInSet = new SfxItemSet( *mpModelPool, XATTR_LINESTART, XATTR_LINEEND ); - maItemSetVector.push_back( pInSet ); + maItemSetVector.push_back( + o3tl::make_unique<SfxItemSet>( *mpModelPool, XATTR_LINESTART, XATTR_LINEEND )); + auto pInSet = maItemSetVector.back().get(); XLineEndItem aEndMarker(XATTR_LINEEND); aEndMarker.SetName( aName ); @@ -198,7 +194,6 @@ void SAL_CALL SvxUnoMarkerTable::removeByName( const OUString& aApiName ) const NameOrIndex *pItem = static_cast<const NameOrIndex *>(&((*aIter)->Get( XATTR_LINEEND ) )); if( pItem->GetName() == aName ) { - delete (*aIter); maItemSetVector.erase( aIter ); return; } |