LibreOffice Module svx (master) 1
svdopage.cxx
Go to the documentation of this file.
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>
28
29
30// BaseProperties section
31
32std::unique_ptr<sdr::properties::BaseProperties> SdrPageObj::CreateObjectSpecificProperties()
33{
34 return std::make_unique<sdr::properties::PageProperties>(*this);
35}
36
37
38// DrawContact section
39
40std::unique_ptr<sdr::contact::ViewContact> SdrPageObj::CreateObjectSpecificViewContact()
41{
42 return std::make_unique<sdr::contact::ViewContactOfPageObj>(*this);
43}
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.
50{
51 if(mpShownPage && mpShownPage == &rPage)
52 {
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 mpShownPage = nullptr;
58 }
59}
60
62 SdrModel& rSdrModel,
63 SdrPage* pNewPage)
64: SdrObject(rSdrModel),
65 mpShownPage(pNewPage)
66{
67 if(mpShownPage)
68 {
70 }
71}
72
73SdrPageObj::SdrPageObj(SdrModel& rSdrModel, SdrPageObj const & rSource)
74: SdrObject(rSdrModel, rSource),
75 mpShownPage(nullptr)
76{
78}
79
81 SdrModel& rSdrModel,
82 const tools::Rectangle& rRect,
83 SdrPage* pNewPage)
84: SdrObject(rSdrModel),
85 mpShownPage(pNewPage)
86{
87 if(mpShownPage)
88 {
90 }
91
92 setOutRectangle(rRect);
93}
94
96{
97 if(mpShownPage)
98 {
100 }
101}
102
103
105{
106 if(mpShownPage == pNewPage)
107 return;
108
109 if(mpShownPage)
110 {
112 }
113
114 mpShownPage = pNewPage;
115
116 if(mpShownPage)
117 {
118 mpShownPage->AddPageUser(*this);
119 }
120
121 SetChanged();
123}
124
125// #i96598#
127{
128 // avoid resetting aOutRect which in case of this object is model data,
129 // not re-creatable view data
130}
131
133{
134 return SdrObjKind::Page;
135}
136
138{
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;
152}
153
155{
156 return new SdrPageObj(rTargetModel, *this);
157}
158
160{
161 OUString sName(SvxResId(STR_ObjNameSingulPAGE));
162
163 OUString aName(GetName());
164 if (!aName.isEmpty())
165 sName += " '" + aName + "'";
166
167 return sName;
168}
169
171{
172 return SvxResId(STR_ObjNamePluralPAGE);
173}
174
175void SdrPageObj::NbcRotate(const Point& /*rRef*/, Degree100 /*nAngle*/, double /*sinAngle*/, double /*cosAngle*/)
176{
177 assert(false);
178}
179
180/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Provides information about various ZObject properties.
Definition: svdobj.hxx:196
Abstract DrawObject.
Definition: svdobj.hxx:260
void BroadcastObjectChange() const
Definition: svdobj.cxx:1018
virtual const OUString & GetName() const
Definition: svdobj.cxx:771
virtual void SetChanged()
Definition: svdobj.cxx:1042
void setOutRectangle(tools::Rectangle const &rRectangle)
Definition: svdobj.cxx:3183
void SetReferencedPage(SdrPage *pNewPage)
Definition: svdopage.cxx:104
virtual SdrObjKind GetObjIdentifier() const override
Definition: svdopage.cxx:132
SdrPage * mpShownPage
Definition: svdopage.hxx:36
void NbcRotate(const Point &rRef, Degree100 nAngle, double sinAngle, double cosAngle) override
Definition: svdopage.cxx:175
virtual ~SdrPageObj() override
Definition: svdopage.cxx:95
SdrPage * GetReferencedPage() const
Definition: svdopage.hxx:55
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdopage.cxx:40
virtual rtl::Reference< SdrObject > CloneSdrObject(SdrModel &rTargetModel) const override
Definition: svdopage.cxx:154
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: svdopage.cxx:137
virtual void SetBoundRectDirty() override
Definition: svdopage.cxx:126
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdopage.cxx:32
virtual void PageInDestruction(const SdrPage &rPage) override
Definition: svdopage.cxx:49
virtual OUString TakeObjNamePlural() const override
Definition: svdopage.cxx:170
virtual OUString TakeObjNameSingul() const override
Definition: svdopage.cxx:159
SdrPageObj(SdrModel &rSdrModel, SdrPage *pNewPage=nullptr)
Definition: svdopage.cxx:61
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:379
void RemovePageUser(sdr::PageUser &rOldUser)
Definition: svdpage.cxx:1122
void AddPageUser(sdr::PageUser &rNewUser)
Definition: svdpage.cxx:1117
OUString SvxResId(TranslateId aId)
Definition: dialmgr.cxx:24
OUString sName
OUString aName
SdrObjKind
Definition: svdobjkind.hxx:25
@ Page
Polyline represented by SdrPathObj.