1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/svdtrans.hxx>
25 #include <svx/svdetc.hxx>
26 #include <svx/svdmodel.hxx>
27 #include <svx/svdpage.hxx>
28 #include <svx/svdpagv.hxx>
29 #include <svx/svdoutl.hxx>
30 #include <svtools/colorcfg.hxx>
31 #include <svl/itemset.hxx>
32 #include <sdr/properties/pageproperties.hxx>
33 #include <svx/sdr/contact/viewcontactofpageobj.hxx>
36 // BaseProperties section
38 std::unique_ptr
<sdr::properties::BaseProperties
> SdrPageObj::CreateObjectSpecificProperties()
40 return std::make_unique
<sdr::properties::PageProperties
>(*this);
44 // DrawContact section
46 std::unique_ptr
<sdr::contact::ViewContact
> SdrPageObj::CreateObjectSpecificViewContact()
48 return std::make_unique
<sdr::contact::ViewContactOfPageObj
>(*this);
52 // this method is called form the destructor of the referenced page.
53 // do all necessary action to forget the page. It is not necessary to call
54 // RemovePageUser(), that is done form the destructor.
55 void SdrPageObj::PageInDestruction(const SdrPage
& rPage
)
57 if(mpShownPage
&& mpShownPage
== &rPage
)
59 // #i58769# Do not call ActionChanged() here, because that would
60 // lead to the construction of a view contact object for a page that
61 // is being destroyed.
63 mpShownPage
= nullptr;
67 SdrPageObj::SdrPageObj(
70 : SdrObject(rSdrModel
),
75 mpShownPage
->AddPageUser(*this);
79 SdrPageObj::SdrPageObj(
81 const tools::Rectangle
& rRect
,
83 : SdrObject(rSdrModel
),
88 mpShownPage
->AddPageUser(*this);
94 SdrPageObj::~SdrPageObj()
98 mpShownPage
->RemovePageUser(*this);
103 void SdrPageObj::SetReferencedPage(SdrPage
* pNewPage
)
105 if(mpShownPage
!= pNewPage
)
109 mpShownPage
->RemovePageUser(*this);
112 mpShownPage
= pNewPage
;
116 mpShownPage
->AddPageUser(*this);
120 BroadcastObjectChange();
125 void SdrPageObj::SetBoundRectDirty()
127 // avoid resetting aOutRect which in case of this object is model data,
128 // not re-creatable view data
131 sal_uInt16
SdrPageObj::GetObjIdentifier() const
133 return sal_uInt16(OBJ_PAGE
);
136 void SdrPageObj::TakeObjInfo(SdrObjTransformInfoRec
& rInfo
) const
138 rInfo
.bRotateFreeAllowed
=false;
139 rInfo
.bRotate90Allowed
=false;
140 rInfo
.bMirrorFreeAllowed
=false;
141 rInfo
.bMirror45Allowed
=false;
142 rInfo
.bMirror90Allowed
=false;
143 rInfo
.bTransparenceAllowed
= false;
144 rInfo
.bShearAllowed
=false;
145 rInfo
.bEdgeRadiusAllowed
=false;
146 rInfo
.bNoOrthoDesired
=false;
147 rInfo
.bCanConvToPath
=false;
148 rInfo
.bCanConvToPoly
=false;
149 rInfo
.bCanConvToPathLineToArea
=false;
150 rInfo
.bCanConvToPolyLineToArea
=false;
153 SdrPageObj
* SdrPageObj::CloneSdrObject(SdrModel
& rTargetModel
) const
155 return CloneHelper
< SdrPageObj
>(rTargetModel
);
158 SdrPageObj
& SdrPageObj::operator=(const SdrPageObj
& rObj
)
162 SdrObject::operator=(rObj
);
163 SetReferencedPage( rObj
.GetReferencedPage());
167 OUString
SdrPageObj::TakeObjNameSingul() const
169 OUStringBuffer
sName(SvxResId(STR_ObjNameSingulPAGE
));
171 OUString
aName(GetName());
172 if (!aName
.isEmpty())
180 return sName
.makeStringAndClear();
183 OUString
SdrPageObj::TakeObjNamePlural() const
185 return SvxResId(STR_ObjNamePluralPAGE
);
188 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */