diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-12 15:07:39 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-13 09:17:34 +0200 |
commit | 0fdcfedd898afcc03332a432ef21052eee6b3a3a (patch) | |
tree | 46ed1c968570414ffa0917d2324863234cc504fe /svx/source | |
parent | d0d4a3647692883b17a1acd96a01a1857c5872b1 (diff) |
make SdrObjUserData::Clone return std::unique_ptr
Change-Id: Iffe047b081fde0bb582d8730a8e96d2597c7567a
Reviewed-on: https://gerrit.libreoffice.org/52780
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/dialog/imapwnd.cxx | 8 | ||||
-rw-r--r-- | svx/source/dialog/imapwnd.hxx | 2 | ||||
-rw-r--r-- | svx/source/gallery2/galtheme.cxx | 2 | ||||
-rw-r--r-- | svx/source/inc/svdobjuserdatalist.hxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdobj.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdobjplusdata.cxx | 6 | ||||
-rw-r--r-- | svx/source/svdraw/svdobjuserdatalist.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdotxln.cxx | 6 |
8 files changed, 17 insertions, 17 deletions
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx index 557bbb005a95..b53f32d3fa59 100644 --- a/svx/source/dialog/imapwnd.cxx +++ b/svx/source/dialog/imapwnd.cxx @@ -290,7 +290,7 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj ) pSdrObj->SetMergedItemSetAndBroadcast(aSet); - pSdrObj->AppendUserData( new IMapUserData( pCloneIMapObj ) ); + pSdrObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new IMapUserData( pCloneIMapObj )) ); pSdrObj->SetUserCall( GetSdrUserCall() ); } @@ -318,7 +318,7 @@ void IMapWindow::SdrObjCreated( const SdrObject& rObj ) SdrRectObj* pRectObj = const_cast<SdrRectObj*>(static_cast<const SdrRectObj*>(&rObj)); IMapRectangleObject* pObj = new IMapRectangleObject( pRectObj->GetLogicRect(), "", "", "", "", "", true, false ); - pRectObj->AppendUserData( new IMapUserData( IMapObjectPtr(pObj) ) ); + pRectObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new IMapUserData( IMapObjectPtr(pObj) )) ); } break; @@ -331,7 +331,7 @@ void IMapWindow::SdrObjCreated( const SdrObject& rObj ) IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, "", "", "", "", "", true, false ); pObj->SetExtraEllipse( aPoly.GetBoundRect() ); - pCircObj->AppendUserData( new IMapUserData( IMapObjectPtr(pObj) ) ); + pCircObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new IMapUserData( IMapObjectPtr(pObj) )) ); } break; @@ -347,7 +347,7 @@ void IMapWindow::SdrObjCreated( const SdrObject& rObj ) { tools::Polygon aPoly(rXPolyPoly.getB2DPolygon(0)); IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, "", "", "", "", "", true, false ); - pPathObj->AppendUserData( new IMapUserData( IMapObjectPtr(pObj) ) ); + pPathObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new IMapUserData( IMapObjectPtr(pObj) )) ); } } break; diff --git a/svx/source/dialog/imapwnd.hxx b/svx/source/dialog/imapwnd.hxx index f97fd4b60ffa..4ee734ace6a4 100644 --- a/svx/source/dialog/imapwnd.hxx +++ b/svx/source/dialog/imapwnd.hxx @@ -63,7 +63,7 @@ public: SdrObjUserData ( SdrInventor::IMap, SVD_IMAP_USERDATA ), mpObj ( rIMapUserData.mpObj ) {} - virtual SdrObjUserData* Clone( SdrObject * ) const override { return new IMapUserData( *this ); } + virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject * ) const override { return std::unique_ptr<SdrObjUserData>(new IMapUserData( *this )); } const IMapObjectPtr& GetObject() const { return mpObj; } void ReplaceObject( const IMapObjectPtr& pNewIMapObject ) { mpObj = pNewIMapObject; } diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 835b0c0039e6..2bd3be8f315e 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -1246,7 +1246,7 @@ bool GalleryTheme::InsertTransferable(const uno::Reference< datatransfer::XTrans SdrPage* pPage = aModel.GetModel()->GetPage(0); SdrGrafObj* pGrafObj = new SdrGrafObj(*aModel.GetModel(), *pGraphic ); - pGrafObj->AppendUserData( new SgaIMapInfo( aImageMap ) ); + pGrafObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new SgaIMapInfo( aImageMap )) ); pPage->InsertObject( pGrafObj ); bRet = InsertModel( *aModel.GetModel(), nInsertPos ); } diff --git a/svx/source/inc/svdobjuserdatalist.hxx b/svx/source/inc/svdobjuserdatalist.hxx index 09b792c8e985..19d25e175d0a 100644 --- a/svx/source/inc/svdobjuserdatalist.hxx +++ b/svx/source/inc/svdobjuserdatalist.hxx @@ -28,7 +28,7 @@ public: size_t GetUserDataCount() const; SdrObjUserData& GetUserData(size_t nNum); - void AppendUserData(SdrObjUserData* pData); + void AppendUserData(std::unique_ptr<SdrObjUserData> pData); void DeleteUserData(size_t nNum); }; diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 9351a676a5c7..4157679c1089 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -2614,7 +2614,7 @@ SdrObjUserData* SdrObject::GetUserData(sal_uInt16 nNum) const return &pPlusData->pUserDataList->GetUserData(nNum); } -void SdrObject::AppendUserData(SdrObjUserData* pData) +void SdrObject::AppendUserData(std::unique_ptr<SdrObjUserData> pData) { if (!pData) { @@ -2626,7 +2626,7 @@ void SdrObject::AppendUserData(SdrObjUserData* pData) if (!pPlusData->pUserDataList) pPlusData->pUserDataList.reset( new SdrObjUserDataList ); - pPlusData->pUserDataList->AppendUserData(pData); + pPlusData->pUserDataList->AppendUserData(std::move(pData)); } void SdrObject::DeleteUserData(sal_uInt16 nNum) diff --git a/svx/source/svdraw/svdobjplusdata.cxx b/svx/source/svdraw/svdobjplusdata.cxx index ee7a801cd8e4..45d8bf97c487 100644 --- a/svx/source/svdraw/svdobjplusdata.cxx +++ b/svx/source/svdraw/svdobjplusdata.cxx @@ -36,9 +36,9 @@ SdrObjPlusData* SdrObjPlusData::Clone(SdrObject* pObj1) const if (nCount!=0) { pNeuPlusData->pUserDataList.reset(new SdrObjUserDataList); for (sal_uInt16 i=0; i<nCount; i++) { - SdrObjUserData* pNeuUserData=pUserDataList->GetUserData(i).Clone(pObj1); - if (pNeuUserData!=nullptr) { - pNeuPlusData->pUserDataList->AppendUserData(pNeuUserData); + std::unique_ptr<SdrObjUserData> pNewUserData=pUserDataList->GetUserData(i).Clone(pObj1); + if (pNewUserData!=nullptr) { + pNeuPlusData->pUserDataList->AppendUserData(std::move(pNewUserData)); } else { OSL_FAIL("SdrObjPlusData::Clone(): UserData.Clone() returns NULL."); } diff --git a/svx/source/svdraw/svdobjuserdatalist.cxx b/svx/source/svdraw/svdobjuserdatalist.cxx index 679af34fa785..2595b799bd74 100644 --- a/svx/source/svdraw/svdobjuserdatalist.cxx +++ b/svx/source/svdraw/svdobjuserdatalist.cxx @@ -24,9 +24,9 @@ SdrObjUserData& SdrObjUserDataList::GetUserData(size_t nNum) return *maList.at(nNum).get(); } -void SdrObjUserDataList::AppendUserData(SdrObjUserData* pData) +void SdrObjUserDataList::AppendUserData(std::unique_ptr<SdrObjUserData> pData) { - maList.push_back(std::unique_ptr<SdrObjUserData>(pData)); + maList.push_back(std::move(pData)); } void SdrObjUserDataList::DeleteUserData(size_t nNum) diff --git a/svx/source/svdraw/svdotxln.cxx b/svx/source/svdraw/svdotxln.cxx index 27d4b9679da8..3145fa4b5cb3 100644 --- a/svx/source/svdraw/svdotxln.cxx +++ b/svx/source/svdraw/svdotxln.cxx @@ -108,7 +108,7 @@ ImpSdrObjTextLinkUserData::~ImpSdrObjTextLinkUserData() { } -SdrObjUserData* ImpSdrObjTextLinkUserData::Clone(SdrObject* ) const +std::unique_ptr<SdrObjUserData> ImpSdrObjTextLinkUserData::Clone(SdrObject* ) const { ImpSdrObjTextLinkUserData* pData=new ImpSdrObjTextLinkUserData; pData->aFileName =aFileName; @@ -116,7 +116,7 @@ SdrObjUserData* ImpSdrObjTextLinkUserData::Clone(SdrObject* ) const pData->aFileDate0 =aFileDate0; pData->eCharSet =eCharSet; pData->pLink=nullptr; - return pData; + return std::unique_ptr<SdrObjUserData>(pData); } @@ -132,7 +132,7 @@ void SdrTextObj::SetTextLink(const OUString& rFileName, const OUString& rFilterN pData->aFileName=rFileName; pData->aFilterName=rFilterName; pData->eCharSet=eCharSet; - AppendUserData(pData); + AppendUserData(std::unique_ptr<SdrObjUserData>(pData)); ImpRegisterLink(); } |