summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-11-10 16:35:45 +0200
committerNoel Grandin <noel@peralex.com>2015-11-11 11:35:40 +0200
commitea2ae023cf0ca44b445aead93a47b8154f0cc818 (patch)
treee2178965e46114e9f67214f87c7ec0e8c3614987 /framework
parent2a2b9920c1ccd9cfb2ec474ceffed7c5d78ecb00 (diff)
framework: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: If9981b141a591f23e03479c90694e6ffa78f2cb8
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/xml/imagesconfiguration.hxx3
-rw-r--r--framework/source/uiconfiguration/imagemanagerimpl.cxx7
-rw-r--r--framework/source/xml/imagesdocumenthandler.cxx8
3 files changed, 8 insertions, 10 deletions
diff --git a/framework/inc/xml/imagesconfiguration.hxx b/framework/inc/xml/imagesconfiguration.hxx
index a79d9c9b8c73..9c672f38126c 100644
--- a/framework/inc/xml/imagesconfiguration.hxx
+++ b/framework/inc/xml/imagesconfiguration.hxx
@@ -29,6 +29,7 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <vector>
+#include <memory>
#include <boost/ptr_container/ptr_vector.hpp>
namespace framework
@@ -54,7 +55,7 @@ struct ExternalImageItemDescriptor
OUString aURL; // a URL to an external bitmap
};
-typedef boost::ptr_vector<ImageItemDescriptor> ImageItemListDescriptor;
+typedef std::vector<std::unique_ptr<ImageItemDescriptor> > ImageItemListDescriptor;
typedef boost::ptr_vector<ExternalImageItemDescriptor> ExternalImageItemListDescriptor;
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index 94fb2ed7fbad..973819430d71 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -446,7 +446,7 @@ bool ImageManagerImpl::implts_loadUserImages(
aUserImagesVector.reserve(nCount);
for ( sal_Int32 i=0; i < nCount; i++ )
{
- const ImageItemDescriptor* pItem = &(*pList->pImageItemList)[i];
+ const ImageItemDescriptor* pItem = (*pList->pImageItemList)[i].get();
aUserImagesVector.push_back( pItem->aCommandURL );
}
@@ -517,11 +517,10 @@ bool ImageManagerImpl::implts_storeUserImages(
pList->pImageItemList = new ImageItemListDescriptor;
for ( sal_uInt16 i=0; i < pImageList->GetImageCount(); i++ )
{
- ImageItemDescriptor* pItem = new ::framework::ImageItemDescriptor;
-
+ ImageItemDescriptor* pItem = new ImageItemDescriptor;
pItem->nIndex = i;
pItem->aCommandURL = pImageList->GetImageName( i );
- pList->pImageItemList->push_back( pItem );
+ pList->pImageItemList->push_back( std::unique_ptr<ImageItemDescriptor>(pItem) );
}
pList->aURL = "Bitmaps/" + OUString::createFromAscii(BITMAP_FILE_NAMES[nImageType]);
diff --git a/framework/source/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx
index d05bf2b84222..667ab853b262 100644
--- a/framework/source/xml/imagesdocumenthandler.cxx
+++ b/framework/source/xml/imagesdocumenthandler.cxx
@@ -309,7 +309,7 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
m_bImageStartFound = true;
// Create new image item descriptor
- ImageItemDescriptor* pItem = new ImageItemDescriptor;
+ std::unique_ptr<ImageItemDescriptor> pItem(new ImageItemDescriptor);
pItem->nIndex = -1;
// Read attributes for this image definition
@@ -341,7 +341,6 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
// Check required attribute "bitmap-index"
if ( pItem->nIndex < 0 )
{
- delete pItem;
delete m_pImages;
m_pImages = nullptr;
@@ -353,7 +352,6 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
// Check required attribute "command"
if ( pItem->aCommandURL.isEmpty() )
{
- delete pItem;
delete m_pImages;
m_pImages = nullptr;
@@ -362,7 +360,7 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- m_pImages->pImageItemList->push_back( pItem );
+ m_pImages->pImageItemList->push_back( std::move(pItem) );
}
break;
@@ -729,7 +727,7 @@ void OWriteImagesDocumentHandler::WriteImageList( const ImageListItemDescriptor*
if ( pImageItemList )
{
for ( size_t i = 0; i < pImageItemList->size(); i++ )
- WriteImage( &(*pImageItemList)[i] );
+ WriteImage( (*pImageItemList)[i].get() );
}
m_xWriteDocumentHandler->endElement( ELEMENT_NS_IMAGES );