Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/svx/source/svdraw/svdopage.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
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
20
21
#include <svx/svdopage.hxx>
22
#include <svx/dialmgr.hxx>
23
#include <svx/strings.hrc>
24
#include <svx/svdmodel.hxx>
25
#include <svx/svdpage.hxx>
26
#include <sdr/properties/pageproperties.hxx>
27
#include <sdr/contact/viewcontactofpageobj.hxx>
28
29
30
// BaseProperties section
31
32
std::unique_ptr<sdr::properties::BaseProperties> SdrPageObj::CreateObjectSpecificProperties()
33
20.4k
{
34
20.4k
    return std::make_unique<sdr::properties::PageProperties>(*this);
35
20.4k
}
36
37
38
// DrawContact section
39
40
std::unique_ptr<sdr::contact::ViewContact> SdrPageObj::CreateObjectSpecificViewContact()
41
491k
{
42
491k
    return std::make_unique<sdr::contact::ViewContactOfPageObj>(*this);
43
491k
}
44
45
46
// this method is called from the destructor of the referenced page.
47
// do all necessary action to forget the page. It is not necessary to call
48
// RemovePageUser(), that is done from the destructor.
49
void SdrPageObj::PageInDestruction(const SdrPage& rPage)
50
226k
{
51
226k
    if(mpShownPage && mpShownPage == &rPage)
52
226k
    {
53
        // #i58769# Do not call ActionChanged() here, because that would
54
        // lead to the construction of a view contact object for a page that
55
        // is being destroyed.
56
57
226k
        mpShownPage = nullptr;
58
226k
    }
59
226k
}
60
61
SdrPageObj::SdrPageObj(
62
    SdrModel& rSdrModel,
63
    SdrPage* pNewPage)
64
489k
:   SdrObject(rSdrModel),
65
489k
    mpShownPage(pNewPage)
66
489k
{
67
489k
    if(mpShownPage)
68
225k
    {
69
225k
        mpShownPage->AddPageUser(*this);
70
225k
    }
71
489k
}
72
73
SdrPageObj::SdrPageObj(SdrModel& rSdrModel, SdrPageObj const & rSource)
74
0
:   SdrObject(rSdrModel, rSource),
75
0
    mpShownPage(nullptr)
76
0
{
77
0
    SetReferencedPage( rSource.GetReferencedPage());
78
0
}
79
80
SdrPageObj::SdrPageObj(
81
    SdrModel& rSdrModel,
82
    const tools::Rectangle& rRect,
83
    SdrPage* pNewPage)
84
1.32k
:   SdrObject(rSdrModel),
85
1.32k
    mpShownPage(pNewPage)
86
1.32k
{
87
1.32k
    if(mpShownPage)
88
1.30k
    {
89
1.30k
        mpShownPage->AddPageUser(*this);
90
1.30k
    }
91
92
1.32k
    setOutRectangle(rRect);
93
1.32k
}
94
95
SdrPageObj::~SdrPageObj()
96
491k
{
97
491k
    if(mpShownPage)
98
191
    {
99
191
        mpShownPage->RemovePageUser(*this);
100
191
    }
101
491k
}
102
103
104
void SdrPageObj::SetReferencedPage(SdrPage* pNewPage)
105
279k
{
106
279k
    if(mpShownPage == pNewPage)
107
264k
        return;
108
109
14.6k
    if(mpShownPage)
110
14.6k
    {
111
14.6k
        mpShownPage->RemovePageUser(*this);
112
14.6k
    }
113
114
14.6k
    mpShownPage = pNewPage;
115
116
14.6k
    if(mpShownPage)
117
14.6k
    {
118
14.6k
        mpShownPage->AddPageUser(*this);
119
14.6k
    }
120
121
14.6k
    SetChanged();
122
14.6k
    BroadcastObjectChange();
123
14.6k
}
124
125
// #i96598#
126
void SdrPageObj::SetBoundRectDirty()
127
0
{
128
    // avoid resetting aOutRect which in case of this object is model data,
129
    // not re-creatable view data
130
0
}
131
132
SdrObjKind SdrPageObj::GetObjIdentifier() const
133
519k
{
134
519k
    return SdrObjKind::Page;
135
519k
}
136
137
void SdrPageObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
138
0
{
139
0
    rInfo.bRotateFreeAllowed=false;
140
0
    rInfo.bRotate90Allowed  =false;
141
0
    rInfo.bMirrorFreeAllowed=false;
142
0
    rInfo.bMirror45Allowed  =false;
143
0
    rInfo.bMirror90Allowed  =false;
144
0
    rInfo.bTransparenceAllowed = false;
145
0
    rInfo.bShearAllowed     =false;
146
0
    rInfo.bEdgeRadiusAllowed=false;
147
0
    rInfo.bNoOrthoDesired   =false;
148
0
    rInfo.bCanConvToPath    =false;
149
0
    rInfo.bCanConvToPoly    =false;
150
0
    rInfo.bCanConvToPathLineToArea=false;
151
0
    rInfo.bCanConvToPolyLineToArea=false;
152
0
}
153
154
rtl::Reference<SdrObject> SdrPageObj::CloneSdrObject(SdrModel& rTargetModel) const
155
0
{
156
0
    return new SdrPageObj(rTargetModel, *this);
157
0
}
158
159
OUString SdrPageObj::TakeObjNameSingul() const
160
5.16k
{
161
5.16k
    OUString sName(SvxResId(STR_ObjNameSingulPAGE));
162
163
5.16k
    OUString aName(GetName());
164
5.16k
    if (!aName.isEmpty())
165
0
        sName += " '" + aName + "'";
166
167
5.16k
    return sName;
168
5.16k
}
169
170
OUString SdrPageObj::TakeObjNamePlural() const
171
0
{
172
0
    return SvxResId(STR_ObjNamePluralPAGE);
173
0
}
174
175
void SdrPageObj::NbcRotate(const Point& /*rRef*/, Degree100 /*nAngle*/, double /*sinAngle*/, double /*cosAngle*/)
176
0
{
177
    assert(false);
178
0
}
179
180
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */