/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 | 15.6k | { |
34 | 15.6k | return std::make_unique<sdr::properties::PageProperties>(*this); |
35 | 15.6k | } |
36 | | |
37 | | |
38 | | // DrawContact section |
39 | | |
40 | | std::unique_ptr<sdr::contact::ViewContact> SdrPageObj::CreateObjectSpecificViewContact() |
41 | 428k | { |
42 | 428k | return std::make_unique<sdr::contact::ViewContactOfPageObj>(*this); |
43 | 428k | } |
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 | 208k | { |
51 | 208k | if(mpShownPage && mpShownPage == &rPage) |
52 | 208k | { |
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 | 208k | mpShownPage = nullptr; |
58 | 208k | } |
59 | 208k | } |
60 | | |
61 | | SdrPageObj::SdrPageObj( |
62 | | SdrModel& rSdrModel, |
63 | | SdrPage* pNewPage) |
64 | 427k | : SdrObject(rSdrModel), |
65 | 427k | mpShownPage(pNewPage) |
66 | 427k | { |
67 | 427k | if(mpShownPage) |
68 | 208k | { |
69 | 208k | mpShownPage->AddPageUser(*this); |
70 | 208k | } |
71 | 427k | } |
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.04k | : SdrObject(rSdrModel), |
85 | 1.04k | mpShownPage(pNewPage) |
86 | 1.04k | { |
87 | 1.04k | if(mpShownPage) |
88 | 1.03k | { |
89 | 1.03k | mpShownPage->AddPageUser(*this); |
90 | 1.03k | } |
91 | | |
92 | 1.04k | setOutRectangle(rRect); |
93 | 1.04k | } |
94 | | |
95 | | SdrPageObj::~SdrPageObj() |
96 | 428k | { |
97 | 428k | if(mpShownPage) |
98 | 156 | { |
99 | 156 | mpShownPage->RemovePageUser(*this); |
100 | 156 | } |
101 | 428k | } |
102 | | |
103 | | |
104 | | void SdrPageObj::SetReferencedPage(SdrPage* pNewPage) |
105 | 229k | { |
106 | 229k | if(mpShownPage == pNewPage) |
107 | 219k | return; |
108 | | |
109 | 10.6k | if(mpShownPage) |
110 | 10.6k | { |
111 | 10.6k | mpShownPage->RemovePageUser(*this); |
112 | 10.6k | } |
113 | | |
114 | 10.6k | mpShownPage = pNewPage; |
115 | | |
116 | 10.6k | if(mpShownPage) |
117 | 10.6k | { |
118 | 10.6k | mpShownPage->AddPageUser(*this); |
119 | 10.6k | } |
120 | | |
121 | 10.6k | SetChanged(); |
122 | 10.6k | BroadcastObjectChange(); |
123 | 10.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 | 406k | { |
134 | 406k | return SdrObjKind::Page; |
135 | 406k | } |
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 | 4.06k | { |
161 | 4.06k | OUString sName(SvxResId(STR_ObjNameSingulPAGE)); |
162 | | |
163 | 4.06k | OUString aName(GetName()); |
164 | 4.06k | if (!aName.isEmpty()) |
165 | 0 | sName += " '" + aName + "'"; |
166 | | |
167 | 4.06k | return sName; |
168 | 4.06k | } |
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: */ |