summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-12 15:07:39 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-13 09:17:34 +0200
commit0fdcfedd898afcc03332a432ef21052eee6b3a3a (patch)
tree46ed1c968570414ffa0917d2324863234cc504fe
parentd0d4a3647692883b17a1acd96a01a1857c5872b1 (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>
-rw-r--r--include/svx/galmisc.hxx4
-rw-r--r--include/svx/svdobj.hxx4
-rw-r--r--include/svx/svdotext.hxx2
-rw-r--r--sc/inc/userdat.hxx6
-rw-r--r--sc/source/core/data/drwlayer.cxx6
-rw-r--r--sc/source/core/data/userdat.cxx12
-rw-r--r--sc/source/ui/unoobj/shapeuno.cxx2
-rw-r--r--sc/source/ui/view/tabvwsh9.cxx2
-rw-r--r--sd/inc/anminfo.hxx2
-rw-r--r--sd/inc/imapinfo.hxx2
-rw-r--r--sd/source/core/anminfo.cxx4
-rw-r--r--sd/source/core/drawdoc2.cxx2
-rw-r--r--sd/source/ui/unoidl/unoobj.cxx2
-rw-r--r--sd/source/ui/view/drviewsg.cxx2
-rw-r--r--sd/source/ui/view/sdview3.cxx4
-rw-r--r--sd/source/ui/view/sdview4.cxx6
-rw-r--r--svx/source/dialog/imapwnd.cxx8
-rw-r--r--svx/source/dialog/imapwnd.hxx2
-rw-r--r--svx/source/gallery2/galtheme.cxx2
-rw-r--r--svx/source/inc/svdobjuserdatalist.hxx2
-rw-r--r--svx/source/svdraw/svdobj.cxx4
-rw-r--r--svx/source/svdraw/svdobjplusdata.cxx6
-rw-r--r--svx/source/svdraw/svdobjuserdatalist.cxx4
-rw-r--r--svx/source/svdraw/svdotxln.cxx6
-rw-r--r--sw/source/filter/ww8/ww8par.cxx6
-rw-r--r--sw/source/filter/ww8/ww8par.hxx2
26 files changed, 52 insertions, 52 deletions
diff --git a/include/svx/galmisc.hxx b/include/svx/galmisc.hxx
index dd2aea3c5a16..5605c8a093f0 100644
--- a/include/svx/galmisc.hxx
+++ b/include/svx/galmisc.hxx
@@ -105,11 +105,11 @@ public:
SdrObjUserData( SdrInventor::SgaImap, ID_IMAPINFO ),
aImageMap( rImageMap ) {};
- virtual SdrObjUserData* Clone( SdrObject* ) const override
+ virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject* ) const override
{
SgaIMapInfo* pInfo = new SgaIMapInfo;
pInfo->aImageMap = aImageMap;
- return pInfo;
+ return std::unique_ptr<SdrObjUserData>(pInfo);
}
const ImageMap& GetImageMap() const { return aImageMap; }
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index 7d033605933a..6cf9336ea014 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -213,7 +213,7 @@ public:
SdrObjUserData(const SdrObjUserData& rData);
virtual ~SdrObjUserData();
- virtual SdrObjUserData* Clone(SdrObject* pObj1) const = 0; // #i71039# NULL -> 0
+ virtual std::unique_ptr<SdrObjUserData> Clone(SdrObject* pObj1) const = 0; // #i71039# NULL -> 0
SdrInventor GetInventor() const { return nInventor;}
sal_uInt16 GetId() const { return nIdentifier;}
};
@@ -803,7 +803,7 @@ public:
sal_uInt16 GetUserDataCount() const;
SdrObjUserData* GetUserData(sal_uInt16 nNum) const;
- void AppendUserData(SdrObjUserData* pData);
+ void AppendUserData(std::unique_ptr<SdrObjUserData> pData);
// removes the record from the list and performs delete (FreeMem+Dtor).
void DeleteUserData(sal_uInt16 nNum);
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 13ff8940d0c1..b285d8bece72 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -116,7 +116,7 @@ public:
ImpSdrObjTextLinkUserData();
virtual ~ImpSdrObjTextLinkUserData() override;
- virtual SdrObjUserData* Clone(SdrObject* pObj1) const override;
+ virtual std::unique_ptr<SdrObjUserData> Clone(SdrObject* pObj1) const override;
};
namespace sdr
diff --git a/sc/inc/userdat.hxx b/sc/inc/userdat.hxx
index 04c6893faded..655d869b0d84 100644
--- a/sc/inc/userdat.hxx
+++ b/sc/inc/userdat.hxx
@@ -60,7 +60,7 @@ public:
};
private:
- virtual ScDrawObjData* Clone( SdrObject* pObj ) const override;
+ virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject* pObj ) const override;
// Stores the last cell rect this shape was anchored to.
// Needed when the cell is resized to resize the image accordingly.
@@ -78,7 +78,7 @@ public:
ScIMapInfo( const ScIMapInfo& rIMapInfo );
virtual ~ScIMapInfo() override;
- virtual SdrObjUserData* Clone( SdrObject* pObj ) const override;
+ virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject* pObj ) const override;
void SetImageMap( const ImageMap& rIMap ) { aImageMap = rIMap; }
const ImageMap& GetImageMap() const { return aImageMap; }
@@ -90,7 +90,7 @@ public:
ScMacroInfo();
virtual ~ScMacroInfo() override;
- virtual SdrObjUserData* Clone( SdrObject* pObj ) const override;
+ virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject* pObj ) const override;
void SetMacro( const OUString& rMacro ) { maMacro = rMacro; }
const OUString& GetMacro() const { return maMacro; }
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 0665e0942188..8f8983a4c553 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -2211,7 +2211,7 @@ ScDrawObjData* ScDrawLayer::GetNonRotatedObjData( SdrObject* pObj, bool bCreate
if( pObj && bCreate )
{
ScDrawObjData* pData = new ScDrawObjData;
- pObj->AppendUserData(pData);
+ pObj->AppendUserData(std::unique_ptr<SdrObjUserData>(pData));
return pData;
}
return nullptr;
@@ -2225,7 +2225,7 @@ ScDrawObjData* ScDrawLayer::GetObjData( SdrObject* pObj, bool bCreate )
if( pObj && bCreate )
{
ScDrawObjData* pData = new ScDrawObjData;
- pObj->AppendUserData(pData);
+ pObj->AppendUserData(std::unique_ptr<SdrObjUserData>(pData));
return pData;
}
return nullptr;
@@ -2332,7 +2332,7 @@ ScMacroInfo* ScDrawLayer::GetMacroInfo( SdrObject* pObj, bool bCreate )
if ( bCreate )
{
ScMacroInfo* pData = new ScMacroInfo;
- pObj->AppendUserData(pData);
+ pObj->AppendUserData(std::unique_ptr<SdrObjUserData>(pData));
return pData;
}
return nullptr;
diff --git a/sc/source/core/data/userdat.cxx b/sc/source/core/data/userdat.cxx
index 53dd575dd4ca..ebf7f6dc70b6 100644
--- a/sc/source/core/data/userdat.cxx
+++ b/sc/source/core/data/userdat.cxx
@@ -31,9 +31,9 @@ ScDrawObjData::ScDrawObjData() :
{
}
-ScDrawObjData* ScDrawObjData::Clone( SdrObject* ) const
+std::unique_ptr<SdrObjUserData> ScDrawObjData::Clone( SdrObject* ) const
{
- return new ScDrawObjData( *this );
+ return std::unique_ptr<SdrObjUserData>(new ScDrawObjData( *this ));
}
ScIMapInfo::ScIMapInfo( const ImageMap& rImageMap ) :
@@ -52,9 +52,9 @@ ScIMapInfo::~ScIMapInfo()
{
}
-SdrObjUserData* ScIMapInfo::Clone( SdrObject* ) const
+std::unique_ptr<SdrObjUserData> ScIMapInfo::Clone( SdrObject* ) const
{
- return new ScIMapInfo( *this );
+ return std::unique_ptr<SdrObjUserData>(new ScIMapInfo( *this ));
}
ScMacroInfo::ScMacroInfo() :
@@ -66,9 +66,9 @@ ScMacroInfo::~ScMacroInfo()
{
}
-SdrObjUserData* ScMacroInfo::Clone( SdrObject* /*pObj*/ ) const
+std::unique_ptr<SdrObjUserData> ScMacroInfo::Clone( SdrObject* /*pObj*/ ) const
{
- return new ScMacroInfo( *this );
+ return std::unique_ptr<SdrObjUserData>(new ScMacroInfo( *this ));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index 8c590d64a90e..2279a2f2b4c0 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -453,7 +453,7 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const
else
{
// insert new user data with image map
- pObj->AppendUserData(new ScIMapInfo(aImageMap) );
+ pObj->AppendUserData(std::unique_ptr<SdrObjUserData>(new ScIMapInfo(aImageMap) ));
}
}
}
diff --git a/sc/source/ui/view/tabvwsh9.cxx b/sc/source/ui/view/tabvwsh9.cxx
index 43508fb93981..9c1f1b0f2f5b 100644
--- a/sc/source/ui/view/tabvwsh9.cxx
+++ b/sc/source/ui/view/tabvwsh9.cxx
@@ -135,7 +135,7 @@ void ScTabViewShell::ExecImageMap( SfxRequest& rReq )
ScIMapInfo* pIMapInfo = ScDrawLayer::GetIMapInfo( pSdrObj );
if ( !pIMapInfo )
- pSdrObj->AppendUserData( new ScIMapInfo( rImageMap ) );
+ pSdrObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new ScIMapInfo( rImageMap )) );
else
pIMapInfo->SetImageMap( rImageMap );
diff --git a/sd/inc/anminfo.hxx b/sd/inc/anminfo.hxx
index 444ee80e57b9..0fe0f2993f7d 100644
--- a/sd/inc/anminfo.hxx
+++ b/sd/inc/anminfo.hxx
@@ -65,7 +65,7 @@ public:
SAL_DLLPRIVATE SdAnimationInfo(const SdAnimationInfo& rAnmInfo, SdrObject& rObject);
SAL_DLLPRIVATE virtual ~SdAnimationInfo() override;
- SAL_DLLPRIVATE virtual SdrObjUserData* Clone(SdrObject* pObject) const override;
+ SAL_DLLPRIVATE virtual std::unique_ptr<SdrObjUserData> Clone(SdrObject* pObject) const override;
};
#endif // INCLUDED_SD_INC_ANMINFO_HXX
diff --git a/sd/inc/imapinfo.hxx b/sd/inc/imapinfo.hxx
index 3beaaa9b8aff..77c6c203b43f 100644
--- a/sd/inc/imapinfo.hxx
+++ b/sd/inc/imapinfo.hxx
@@ -40,7 +40,7 @@ public:
SfxListener(),
aImageMap( rIMapInfo.aImageMap ) {};
- virtual SdrObjUserData* Clone( SdrObject* ) const override { return new SdIMapInfo( *this ); }
+ virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject* ) const override { return std::unique_ptr<SdrObjUserData>(new SdIMapInfo( *this )); }
void SetImageMap( const ImageMap& rIMap ) { aImageMap = rIMap; }
const ImageMap& GetImageMap() const { return aImageMap; }
diff --git a/sd/source/core/anminfo.cxx b/sd/source/core/anminfo.cxx
index b3192a2e97cf..9979181b45fd 100644
--- a/sd/source/core/anminfo.cxx
+++ b/sd/source/core/anminfo.cxx
@@ -89,13 +89,13 @@ SdAnimationInfo::~SdAnimationInfo()
{
}
-SdrObjUserData* SdAnimationInfo::Clone(SdrObject* pObject) const
+std::unique_ptr<SdrObjUserData> SdAnimationInfo::Clone(SdrObject* pObject) const
{
DBG_ASSERT( pObject, "SdAnimationInfo::Clone(), pObject must not be null!" );
if( pObject == nullptr )
pObject = &mrObject;
- return new SdAnimationInfo(*this, *pObject );
+ return std::unique_ptr<SdrObjUserData>(new SdAnimationInfo(*this, *pObject ));
}
void SdAnimationInfo::SetBookmark( const OUString& rBookmark )
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 0652a9aa812d..3a0cc03e341c 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -1004,7 +1004,7 @@ SdAnimationInfo* SdDrawDocument::GetShapeUserData(SdrObject& rObject, bool bCrea
if( (pRet == nullptr) && bCreate )
{
pRet = new SdAnimationInfo( rObject );
- rObject.AppendUserData( pRet);
+ rObject.AppendUserData( std::unique_ptr<SdrObjUserData>(pRet) );
}
return pRet;
diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx
index d87831dc5702..588f4449c8a3 100644
--- a/sd/source/ui/unoidl/unoobj.cxx
+++ b/sd/source/ui/unoidl/unoobj.cxx
@@ -645,7 +645,7 @@ void SAL_CALL SdXShape::setPropertyValue( const OUString& aPropertyName, const c
else
{
// insert new user data with image map
- pObj->AppendUserData(new SdIMapInfo(aImageMap) );
+ pObj->AppendUserData(std::unique_ptr<SdrObjUserData>(new SdIMapInfo(aImageMap) ));
}
}
}
diff --git a/sd/source/ui/view/drviewsg.cxx b/sd/source/ui/view/drviewsg.cxx
index f4f9933792cd..b989b84105c7 100644
--- a/sd/source/ui/view/drviewsg.cxx
+++ b/sd/source/ui/view/drviewsg.cxx
@@ -62,7 +62,7 @@ void DrawViewShell::ExecIMap( SfxRequest const & rReq )
SdIMapInfo* pIMapInfo = SdDrawDocument::GetIMapInfo( pSdrObj );
if ( !pIMapInfo )
- pSdrObj->AppendUserData( new SdIMapInfo( rImageMap ) );
+ pSdrObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new SdIMapInfo( rImageMap )) );
else
pIMapInfo->SetImageMap( rImageMap );
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index cf6f72870045..73f06ae8f975 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -1019,7 +1019,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
InsertObjectAtView( pObj, *pPV, nOptions );
if( pImageMap )
- pObj->AppendUserData( new SdIMapInfo( *pImageMap ) );
+ pObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new SdIMapInfo( *pImageMap )) );
if (pObj->IsChart())
{
@@ -1193,7 +1193,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
InsertObjectAtView( pObj, *pPV, nOptions );
if( pImageMap )
- pObj->AppendUserData( new SdIMapInfo( *pImageMap ) );
+ pObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new SdIMapInfo( *pImageMap )) );
// let the object stay in loaded state after insertion
pObj->Unload();
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index fb17fcc2df24..0a8792cd8538 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -139,7 +139,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
}
if (pImageMap)
- pNewGrafObj->AppendUserData(new SdIMapInfo(*pImageMap));
+ pNewGrafObj->AppendUserData(std::unique_ptr<SdrObjUserData>(new SdIMapInfo(*pImageMap)));
ReplaceObjectAtView(pPickObj, *pPV, pNewGrafObj); // maybe ReplaceObjectAtView
@@ -224,7 +224,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
{
// replace object
if (pImageMap)
- pNewGrafObj->AppendUserData(new SdIMapInfo(*pImageMap));
+ pNewGrafObj->AppendUserData(std::unique_ptr<SdrObjUserData>(new SdIMapInfo(*pImageMap)));
::tools::Rectangle aPickObjRect(pPickObj->GetCurrentBoundRect());
Size aPickObjSize(aPickObjRect.GetSize());
@@ -267,7 +267,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
InsertObjectAtView(pNewGrafObj, *pPV, nOptions);
if( pImageMap )
- pNewGrafObj->AppendUserData(new SdIMapInfo(*pImageMap));
+ pNewGrafObj->AppendUserData(std::unique_ptr<SdrObjUserData>(new SdIMapInfo(*pImageMap)));
}
}
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();
}
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 81df04a638c7..de8ffa467829 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -168,7 +168,7 @@ static SwMacroInfo* GetMacroInfo( SdrObject* pObj )
}
}
SwMacroInfo* pData = new SwMacroInfo;
- pObj->AppendUserData(pData);
+ pObj->AppendUserData(std::unique_ptr<SdrObjUserData>(pData));
return pData;
}
@@ -6519,9 +6519,9 @@ SwMacroInfo::~SwMacroInfo()
{
}
-SdrObjUserData* SwMacroInfo::Clone( SdrObject* /*pObj*/ ) const
+std::unique_ptr<SdrObjUserData> SwMacroInfo::Clone( SdrObject* /*pObj*/ ) const
{
- return new SwMacroInfo( *this );
+ return std::unique_ptr<SdrObjUserData>(new SwMacroInfo( *this ));
}
std::unique_ptr<SfxItemSet> SwWW8ImplReader::SetCurrentItemSet(SfxItemSet* pItemSet)
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 036841791673..7092131a87ea 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -505,7 +505,7 @@ public:
SwMacroInfo();
virtual ~SwMacroInfo() override;
- virtual SdrObjUserData* Clone( SdrObject* pObj ) const override;
+ virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject* pObj ) const override;
void SetHlink( const OUString& rHlink ) { maHlink = rHlink; }
const OUString& GetHlink() const { return maHlink; }