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/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>
34 
35 
36 // BaseProperties section
37 
38 std::unique_ptr<sdr::properties::BaseProperties> SdrPageObj::CreateObjectSpecificProperties()
39 {
40  return std::make_unique<sdr::properties::PageProperties>(*this);
41 }
42 
43 
44 // DrawContact section
45 
46 std::unique_ptr<sdr::contact::ViewContact> SdrPageObj::CreateObjectSpecificViewContact()
47 {
48  return std::make_unique<sdr::contact::ViewContactOfPageObj>(*this);
49 }
50 
51 
52 // this method is called from 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 from the destructor.
56 {
57  if(mpShownPage && mpShownPage == &rPage)
58  {
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.
62 
63  mpShownPage = nullptr;
64  }
65 }
66 
68  SdrModel& rSdrModel,
69  SdrPage* pNewPage)
70 : SdrObject(rSdrModel),
71  mpShownPage(pNewPage)
72 {
73  if(mpShownPage)
74  {
75  mpShownPage->AddPageUser(*this);
76  }
77 }
78 
80  SdrModel& rSdrModel,
81  const tools::Rectangle& rRect,
82  SdrPage* pNewPage)
83 : SdrObject(rSdrModel),
84  mpShownPage(pNewPage)
85 {
86  if(mpShownPage)
87  {
88  mpShownPage->AddPageUser(*this);
89  }
90 
91  aOutRect = rRect;
92 }
93 
95 {
96  if(mpShownPage)
97  {
99  }
100 }
101 
102 
104 {
105  if(mpShownPage != pNewPage)
106  {
107  if(mpShownPage)
108  {
109  mpShownPage->RemovePageUser(*this);
110  }
111 
112  mpShownPage = pNewPage;
113 
114  if(mpShownPage)
115  {
116  mpShownPage->AddPageUser(*this);
117  }
118 
119  SetChanged();
121  }
122 }
123 
124 // #i96598#
126 {
127  // avoid resetting aOutRect which in case of this object is model data,
128  // not re-creatable view data
129 }
130 
132 {
133  return sal_uInt16(OBJ_PAGE);
134 }
135 
137 {
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;
151 }
152 
154 {
155  return CloneHelper< SdrPageObj >(rTargetModel);
156 }
157 
159 {
160  if( this == &rObj )
161  return *this;
162  SdrObject::operator=(rObj);
164  return *this;
165 }
166 
168 {
169  OUStringBuffer sName(SvxResId(STR_ObjNameSingulPAGE));
170 
171  OUString aName(GetName());
172  if (!aName.isEmpty())
173  {
174  sName.append(' ');
175  sName.append('\'');
176  sName.append(aName);
177  sName.append('\'');
178  }
179 
180  return sName.makeStringAndClear();
181 }
182 
184 {
185  return SvxResId(STR_ObjNamePluralPAGE);
186 }
187 
188 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void AddPageUser(sdr::PageUser &rNewUser)
Definition: svdpage.cxx:1102
virtual ~SdrPageObj() override
Definition: svdopage.cxx:94
Polyline represented by SdrPathObj.
Definition: svdobj.hxx:142
SdrPageObj & operator=(const SdrPageObj &rObj)
Definition: svdopage.cxx:158
Provides information about various ZObject properties.
Definition: svdobj.hxx:248
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:28
virtual OUString TakeObjNameSingul() const override
Definition: svdopage.cxx:167
void RemovePageUser(sdr::PageUser &rOldUser)
Definition: svdpage.cxx:1107
SdrObject & operator=(const SdrObject &rObj)
Definition: svdobj.cxx:1006
virtual void SetBoundRectDirty() override
Definition: svdopage.cxx:125
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdopage.cxx:46
OUString sName
tools::Rectangle aOutRect
Definition: svdobj.hxx:921
void BroadcastObjectChange() const
Definition: svdobj.cxx:932
virtual sal_uInt16 GetObjIdentifier() const override
Definition: svdopage.cxx:131
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: svdopage.cxx:136
virtual void PageInDestruction(const SdrPage &rPage) override
Definition: svdopage.cxx:55
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdopage.cxx:38
Abstract DrawObject.
Definition: svdobj.hxx:312
virtual OUString TakeObjNamePlural() const override
Definition: svdopage.cxx:183
OUString GetName() const
Definition: svdobj.cxx:725
void SetReferencedPage(SdrPage *pNewPage)
Definition: svdopage.cxx:103
SdrPage * GetReferencedPage() const
Definition: svdopage.hxx:54
OUString aName
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:366
virtual void SetChanged()
Definition: svdobj.cxx:956
virtual SdrPageObj * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: svdopage.cxx:153
SdrPage * mpShownPage
Definition: svdopage.hxx:37
SdrPageObj(SdrModel &rSdrModel, SdrPage *pNewPage=nullptr)
Definition: svdopage.cxx:67