Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / svx / source / svdraw / svdobjplusdata.cxx
blob8318b3df963f4f3cc7d871e089d18fa7f237c2ce
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <svdobjplusdata.hxx>
11 #include <svdobjuserdatalist.hxx>
12 #include <o3tl/deleter.hxx>
13 #include <svx/svdglue.hxx>
14 #include <svl/SfxBroadcaster.hxx>
15 #include <osl/diagnose.h>
17 SdrObjPlusData::SdrObjPlusData()
21 SdrObjPlusData::~SdrObjPlusData()
23 o3tl::reset_preserve_ptr_during(pBroadcast);
24 pUserDataList.reset();
25 pGluePoints.reset();
28 SdrObjPlusData* SdrObjPlusData::Clone(SdrObject* pObj1) const
30 SdrObjPlusData* pNewPlusData=new SdrObjPlusData;
31 if (pUserDataList!=nullptr) {
32 sal_uInt16 nCount=pUserDataList->GetUserDataCount();
33 if (nCount!=0) {
34 pNewPlusData->pUserDataList.reset(new SdrObjUserDataList);
35 for (sal_uInt16 i=0; i<nCount; i++) {
36 std::unique_ptr<SdrObjUserData> pNewUserData=pUserDataList->GetUserData(i).Clone(pObj1);
37 if (pNewUserData!=nullptr) {
38 pNewPlusData->pUserDataList->AppendUserData(std::move(pNewUserData));
39 } else {
40 OSL_FAIL("SdrObjPlusData::Clone(): UserData.Clone() returns NULL.");
45 if (pGluePoints!=nullptr) pNewPlusData->pGluePoints.reset(new SdrGluePointList(*pGluePoints));
46 // MtfAnimator isn't copied either
48 // #i68101#
49 // copy object name, title and description
50 pNewPlusData->aObjName = aObjName;
51 pNewPlusData->aObjTitle = aObjTitle;
52 pNewPlusData->aObjDescription = aObjDescription;
53 pNewPlusData->isDecorative = isDecorative;
55 return pNewPlusData;
58 void SdrObjPlusData::SetGluePoints(const SdrGluePointList& rPts)
60 *pGluePoints = rPts;
63 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */