Version 7.1.7.1, tag libreoffice-7.1.7.1
[LibreOffice.git] / svx / source / svdraw / svdopage.cxx
blobf57dd7dd5e4d7380e004e01971424f40b509df48
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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 #include <rtl/ustrbuf.hxx>
31 // BaseProperties section
33 std::unique_ptr<sdr::properties::BaseProperties> SdrPageObj::CreateObjectSpecificProperties()
35 return std::make_unique<sdr::properties::PageProperties>(*this);
39 // DrawContact section
41 std::unique_ptr<sdr::contact::ViewContact> SdrPageObj::CreateObjectSpecificViewContact()
43 return std::make_unique<sdr::contact::ViewContactOfPageObj>(*this);
47 // this method is called from the destructor of the referenced page.
48 // do all necessary action to forget the page. It is not necessary to call
49 // RemovePageUser(), that is done from the destructor.
50 void SdrPageObj::PageInDestruction(const SdrPage& rPage)
52 if(mpShownPage && mpShownPage == &rPage)
54 // #i58769# Do not call ActionChanged() here, because that would
55 // lead to the construction of a view contact object for a page that
56 // is being destroyed.
58 mpShownPage = nullptr;
62 SdrPageObj::SdrPageObj(
63 SdrModel& rSdrModel,
64 SdrPage* pNewPage)
65 : SdrObject(rSdrModel),
66 mpShownPage(pNewPage)
68 if(mpShownPage)
70 mpShownPage->AddPageUser(*this);
74 SdrPageObj::SdrPageObj(
75 SdrModel& rSdrModel,
76 const tools::Rectangle& rRect,
77 SdrPage* pNewPage)
78 : SdrObject(rSdrModel),
79 mpShownPage(pNewPage)
81 if(mpShownPage)
83 mpShownPage->AddPageUser(*this);
86 aOutRect = rRect;
89 SdrPageObj::~SdrPageObj()
91 if(mpShownPage)
93 mpShownPage->RemovePageUser(*this);
98 void SdrPageObj::SetReferencedPage(SdrPage* pNewPage)
100 if(mpShownPage == pNewPage)
101 return;
103 if(mpShownPage)
105 mpShownPage->RemovePageUser(*this);
108 mpShownPage = pNewPage;
110 if(mpShownPage)
112 mpShownPage->AddPageUser(*this);
115 SetChanged();
116 BroadcastObjectChange();
119 // #i96598#
120 void SdrPageObj::SetBoundRectDirty()
122 // avoid resetting aOutRect which in case of this object is model data,
123 // not re-creatable view data
126 SdrObjKind SdrPageObj::GetObjIdentifier() const
128 return OBJ_PAGE;
131 void SdrPageObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
133 rInfo.bRotateFreeAllowed=false;
134 rInfo.bRotate90Allowed =false;
135 rInfo.bMirrorFreeAllowed=false;
136 rInfo.bMirror45Allowed =false;
137 rInfo.bMirror90Allowed =false;
138 rInfo.bTransparenceAllowed = false;
139 rInfo.bShearAllowed =false;
140 rInfo.bEdgeRadiusAllowed=false;
141 rInfo.bNoOrthoDesired =false;
142 rInfo.bCanConvToPath =false;
143 rInfo.bCanConvToPoly =false;
144 rInfo.bCanConvToPathLineToArea=false;
145 rInfo.bCanConvToPolyLineToArea=false;
148 SdrPageObj* SdrPageObj::CloneSdrObject(SdrModel& rTargetModel) const
150 return CloneHelper< SdrPageObj >(rTargetModel);
153 SdrPageObj& SdrPageObj::operator=(const SdrPageObj& rObj)
155 if( this == &rObj )
156 return *this;
157 SdrObject::operator=(rObj);
158 SetReferencedPage( rObj.GetReferencedPage());
159 return *this;
162 OUString SdrPageObj::TakeObjNameSingul() const
164 OUStringBuffer sName(SvxResId(STR_ObjNameSingulPAGE));
166 OUString aName(GetName());
167 if (!aName.isEmpty())
169 sName.append(' ');
170 sName.append('\'');
171 sName.append(aName);
172 sName.append('\'');
175 return sName.makeStringAndClear();
178 OUString SdrPageObj::TakeObjNamePlural() const
180 return SvxResId(STR_ObjNamePluralPAGE);
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */