tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / svx / source / svdraw / svdopage.cxx
blob448758646afeff9ce808562bc10eed215a6601d0
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>
30 // BaseProperties section
32 std::unique_ptr<sdr::properties::BaseProperties> SdrPageObj::CreateObjectSpecificProperties()
34 return std::make_unique<sdr::properties::PageProperties>(*this);
38 // DrawContact section
40 std::unique_ptr<sdr::contact::ViewContact> SdrPageObj::CreateObjectSpecificViewContact()
42 return std::make_unique<sdr::contact::ViewContactOfPageObj>(*this);
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)
51 if(mpShownPage && mpShownPage == &rPage)
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.
57 mpShownPage = nullptr;
61 SdrPageObj::SdrPageObj(
62 SdrModel& rSdrModel,
63 SdrPage* pNewPage)
64 : SdrObject(rSdrModel),
65 mpShownPage(pNewPage)
67 if(mpShownPage)
69 mpShownPage->AddPageUser(*this);
73 SdrPageObj::SdrPageObj(SdrModel& rSdrModel, SdrPageObj const & rSource)
74 : SdrObject(rSdrModel, rSource),
75 mpShownPage(nullptr)
77 SetReferencedPage( rSource.GetReferencedPage());
80 SdrPageObj::SdrPageObj(
81 SdrModel& rSdrModel,
82 const tools::Rectangle& rRect,
83 SdrPage* pNewPage)
84 : SdrObject(rSdrModel),
85 mpShownPage(pNewPage)
87 if(mpShownPage)
89 mpShownPage->AddPageUser(*this);
92 setOutRectangle(rRect);
95 SdrPageObj::~SdrPageObj()
97 if(mpShownPage)
99 mpShownPage->RemovePageUser(*this);
104 void SdrPageObj::SetReferencedPage(SdrPage* pNewPage)
106 if(mpShownPage == pNewPage)
107 return;
109 if(mpShownPage)
111 mpShownPage->RemovePageUser(*this);
114 mpShownPage = pNewPage;
116 if(mpShownPage)
118 mpShownPage->AddPageUser(*this);
121 SetChanged();
122 BroadcastObjectChange();
125 // #i96598#
126 void SdrPageObj::SetBoundRectDirty()
128 // avoid resetting aOutRect which in case of this object is model data,
129 // not re-creatable view data
132 SdrObjKind SdrPageObj::GetObjIdentifier() const
134 return SdrObjKind::Page;
137 void SdrPageObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
139 rInfo.bRotateFreeAllowed=false;
140 rInfo.bRotate90Allowed =false;
141 rInfo.bMirrorFreeAllowed=false;
142 rInfo.bMirror45Allowed =false;
143 rInfo.bMirror90Allowed =false;
144 rInfo.bTransparenceAllowed = false;
145 rInfo.bShearAllowed =false;
146 rInfo.bEdgeRadiusAllowed=false;
147 rInfo.bNoOrthoDesired =false;
148 rInfo.bCanConvToPath =false;
149 rInfo.bCanConvToPoly =false;
150 rInfo.bCanConvToPathLineToArea=false;
151 rInfo.bCanConvToPolyLineToArea=false;
154 rtl::Reference<SdrObject> SdrPageObj::CloneSdrObject(SdrModel& rTargetModel) const
156 return new SdrPageObj(rTargetModel, *this);
159 OUString SdrPageObj::TakeObjNameSingul() const
161 OUString sName(SvxResId(STR_ObjNameSingulPAGE));
163 OUString aName(GetName());
164 if (!aName.isEmpty())
165 sName += " '" + aName + "'";
167 return sName;
170 OUString SdrPageObj::TakeObjNamePlural() const
172 return SvxResId(STR_ObjNamePluralPAGE);
175 void SdrPageObj::NbcRotate(const Point& /*rRef*/, Degree100 /*nAngle*/, double /*sinAngle*/, double /*cosAngle*/)
177 assert(false);
180 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */