summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svl/stylepool.hxx2
-rw-r--r--svl/source/items/stylepool.cxx9
-rw-r--r--sw/source/core/doc/swstylemanager.cxx6
3 files changed, 8 insertions, 9 deletions
diff --git a/include/svl/stylepool.hxx b/include/svl/stylepool.hxx
index 497ae845a36b..5fe2f2197186 100644
--- a/include/svl/stylepool.hxx
+++ b/include/svl/stylepool.hxx
@@ -62,7 +62,7 @@ public:
@postcond the iterator "points before the first" SfxItemSet of the pool.
The first StylePoolIterator::getNext() call will deliver the first SfxItemSet.
*/
- IStylePoolIteratorAccess* createIterator( const bool bSkipUnusedItemSets = false,
+ std::unique_ptr<IStylePoolIteratorAccess> createIterator( const bool bSkipUnusedItemSets = false,
const bool bSkipIgnorableItems = false );
~StylePool();
diff --git a/svl/source/items/stylepool.cxx b/svl/source/items/stylepool.cxx
index f1ddc7e0ab7b..6192adee6650 100644
--- a/svl/source/items/stylepool.cxx
+++ b/svl/source/items/stylepool.cxx
@@ -20,6 +20,7 @@
#include <svl/stylepool.hxx>
#include <svl/itemiter.hxx>
#include <svl/itempool.hxx>
+#include <o3tl/make_unique.hxx>
#include <algorithm>
#include <map>
#include <memory>
@@ -357,7 +358,7 @@ public:
std::shared_ptr<SfxItemSet> insertItemSet( const SfxItemSet& rSet );
// #i86923#
- IStylePoolIteratorAccess* createIterator( bool bSkipUnusedItemSets,
+ std::unique_ptr<IStylePoolIteratorAccess> createIterator( bool bSkipUnusedItemSets,
bool bSkipIgnorableItems );
};
@@ -432,10 +433,10 @@ std::shared_ptr<SfxItemSet> StylePoolImpl::insertItemSet( const SfxItemSet& rSet
}
// #i86923#
-IStylePoolIteratorAccess* StylePoolImpl::createIterator( bool bSkipUnusedItemSets,
+std::unique_ptr<IStylePoolIteratorAccess> StylePoolImpl::createIterator( bool bSkipUnusedItemSets,
bool bSkipIgnorableItems )
{
- return new Iterator( maRoot, bSkipUnusedItemSets, bSkipIgnorableItems );
+ return o3tl::make_unique<Iterator>( maRoot, bSkipUnusedItemSets, bSkipIgnorableItems );
}
// Ctor, Dtor and redirected methods of class StylePool, nearly inline ;-)
@@ -448,7 +449,7 @@ std::shared_ptr<SfxItemSet> StylePool::insertItemSet( const SfxItemSet& rSet )
{ return pImpl->insertItemSet( rSet ); }
// #i86923#
-IStylePoolIteratorAccess* StylePool::createIterator( const bool bSkipUnusedItemSets,
+std::unique_ptr<IStylePoolIteratorAccess> StylePool::createIterator( const bool bSkipUnusedItemSets,
const bool bSkipIgnorableItems )
{
return pImpl->createIterator( bSkipUnusedItemSets, bSkipIgnorableItems );
diff --git a/sw/source/core/doc/swstylemanager.cxx b/sw/source/core/doc/swstylemanager.cxx
index 40ca237164b8..0bef02b0ae08 100644
--- a/sw/source/core/doc/swstylemanager.cxx
+++ b/sw/source/core/doc/swstylemanager.cxx
@@ -43,7 +43,7 @@ public:
void SwStyleCache::addCompletePool( StylePool& rPool )
{
- IStylePoolIteratorAccess *pIter = rPool.createIterator();
+ std::unique_ptr<IStylePoolIteratorAccess> pIter = rPool.createIterator();
std::shared_ptr<SfxItemSet> pStyle = pIter->getNext();
while( pStyle.get() )
{
@@ -51,7 +51,6 @@ void SwStyleCache::addCompletePool( StylePool& rPool )
mMap[ aName ] = pStyle;
pStyle = pIter->getNext();
}
- delete pIter;
}
class SwStyleManager : public IStyleAccess
@@ -140,7 +139,7 @@ void SwStyleManager::getAllStyles( std::vector<std::shared_ptr<SfxItemSet>> &rSt
{
StylePool& rAutoPool = eFamily == IStyleAccess::AUTO_STYLE_CHAR ? aAutoCharPool : aAutoParaPool;
// setup <StylePool> iterator, which skips unused styles and ignorable items
- IStylePoolIteratorAccess *pIter = rAutoPool.createIterator( true, true );
+ std::unique_ptr<IStylePoolIteratorAccess> pIter = rAutoPool.createIterator( true, true );
std::shared_ptr<SfxItemSet> pStyle = pIter->getNext();
while( pStyle.get() )
{
@@ -148,7 +147,6 @@ void SwStyleManager::getAllStyles( std::vector<std::shared_ptr<SfxItemSet>> &rSt
pStyle = pIter->getNext();
}
- delete pIter;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */