Coverage Report

Created: 2026-02-14 09:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/svx/source/svdraw/svdobjplusdata.cxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
* This file is part of the LibreOffice project.
4
*
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
*/
9
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>
16
17
SdrObjPlusData::SdrObjPlusData()
18
1.53M
{
19
1.53M
}
20
21
SdrObjPlusData::~SdrObjPlusData()
22
1.53M
{
23
1.53M
    o3tl::reset_preserve_ptr_during(pBroadcast);
24
1.53M
    pUserDataList.reset();
25
1.53M
    pGluePoints.reset();
26
1.53M
}
27
28
SdrObjPlusData* SdrObjPlusData::Clone(SdrObject* pObj1) const
29
17.8k
{
30
17.8k
    SdrObjPlusData* pNewPlusData=new SdrObjPlusData;
31
17.8k
    if (pUserDataList!=nullptr) {
32
5.56k
        sal_uInt16 nCount=pUserDataList->GetUserDataCount();
33
5.56k
        if (nCount!=0) {
34
5.56k
            pNewPlusData->pUserDataList.reset(new SdrObjUserDataList);
35
11.1k
            for (sal_uInt16 i=0; i<nCount; i++) {
36
5.56k
                std::unique_ptr<SdrObjUserData> pNewUserData=pUserDataList->GetUserData(i).Clone(pObj1);
37
5.56k
                if (pNewUserData!=nullptr) {
38
5.56k
                    pNewPlusData->pUserDataList->AppendUserData(std::move(pNewUserData));
39
5.56k
                } else {
40
0
                    OSL_FAIL("SdrObjPlusData::Clone(): UserData.Clone() returns NULL.");
41
0
                }
42
5.56k
            }
43
5.56k
        }
44
5.56k
    }
45
17.8k
    if (pGluePoints!=nullptr) pNewPlusData->pGluePoints.reset(new SdrGluePointList(*pGluePoints));
46
    // MtfAnimator isn't copied either
47
48
    // #i68101#
49
    // copy object name, title and description
50
17.8k
    pNewPlusData->aObjName = aObjName;
51
17.8k
    pNewPlusData->aObjTitle = aObjTitle;
52
17.8k
    pNewPlusData->aObjDescription = aObjDescription;
53
17.8k
    pNewPlusData->isDecorative = isDecorative;
54
55
17.8k
    return pNewPlusData;
56
17.8k
}
57
58
void SdrObjPlusData::SetGluePoints(const SdrGluePointList& rPts)
59
40.3k
{
60
40.3k
    *pGluePoints = rPts;
61
40.3k
}
62
63
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */