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 
32 std::unique_ptr<sdr::properties::BaseProperties> SdrPageObj::CreateObjectSpecificProperties()
33 {
34  return std::make_unique<sdr::properties::PageProperties>(*this);
35 }
36 
37 
38 // DrawContact section
39 
40 std::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  {
69  mpShownPage->AddPageUser(*this);
70  }
71 }
72 
74  SdrModel& rSdrModel,
75  const tools::Rectangle& rRect,
76  SdrPage* pNewPage)
77 : SdrObject(rSdrModel),
78  mpShownPage(pNewPage)
79 {
80  if(mpShownPage)
81  {
82  mpShownPage->AddPageUser(*this);
83  }
84 
85  aOutRect = rRect;
86 }
87 
89 {
90  if(mpShownPage)
91  {
93  }
94 }
95 
96 
98 {
99  if(mpShownPage != pNewPage)
100  {
101  if(mpShownPage)
102  {
103  mpShownPage->RemovePageUser(*this);
104  }
105 
106  mpShownPage = pNewPage;
107 
108  if(mpShownPage)
109  {
110  mpShownPage->AddPageUser(*this);
111  }
112 
113  SetChanged();
115  }
116 }
117 
118 // #i96598#
120 {
121  // avoid resetting aOutRect which in case of this object is model data,
122  // not re-creatable view data
123 }
124 
126 {
127  return sal_uInt16(OBJ_PAGE);
128 }
129 
131 {
132  rInfo.bRotateFreeAllowed=false;
133  rInfo.bRotate90Allowed =false;
134  rInfo.bMirrorFreeAllowed=false;
135  rInfo.bMirror45Allowed =false;
136  rInfo.bMirror90Allowed =false;
137  rInfo.bTransparenceAllowed = false;
138  rInfo.bShearAllowed =false;
139  rInfo.bEdgeRadiusAllowed=false;
140  rInfo.bNoOrthoDesired =false;
141  rInfo.bCanConvToPath =false;
142  rInfo.bCanConvToPoly =false;
143  rInfo.bCanConvToPathLineToArea=false;
144  rInfo.bCanConvToPolyLineToArea=false;
145 }
146 
148 {
149  return CloneHelper< SdrPageObj >(rTargetModel);
150 }
151 
153 {
154  if( this == &rObj )
155  return *this;
156  SdrObject::operator=(rObj);
158  return *this;
159 }
160 
162 {
163  OUStringBuffer sName(SvxResId(STR_ObjNameSingulPAGE));
164 
165  OUString aName(GetName());
166  if (!aName.isEmpty())
167  {
168  sName.append(' ');
169  sName.append('\'');
170  sName.append(aName);
171  sName.append('\'');
172  }
173 
174  return sName.makeStringAndClear();
175 }
176 
178 {
179  return SvxResId(STR_ObjNamePluralPAGE);
180 }
181 
182 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void AddPageUser(sdr::PageUser &rNewUser)
Definition: svdpage.cxx:1095
virtual ~SdrPageObj() override
Definition: svdopage.cxx:88
Polyline represented by SdrPathObj.
Definition: svdobj.hxx:142
SdrPageObj & operator=(const SdrPageObj &rObj)
Definition: svdopage.cxx:152
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:161
void RemovePageUser(sdr::PageUser &rOldUser)
Definition: svdpage.cxx:1100
SdrObject & operator=(const SdrObject &rObj)
Definition: svdobj.cxx:978
virtual void SetBoundRectDirty() override
Definition: svdopage.cxx:119
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdopage.cxx:40
OUString sName
tools::Rectangle aOutRect
Definition: svdobj.hxx:921
void BroadcastObjectChange() const
Definition: svdobj.cxx:904
virtual sal_uInt16 GetObjIdentifier() const override
Definition: svdopage.cxx:125
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: svdopage.cxx:130
virtual void PageInDestruction(const SdrPage &rPage) override
Definition: svdopage.cxx:49
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdopage.cxx:32
Abstract DrawObject.
Definition: svdobj.hxx:312
virtual OUString TakeObjNamePlural() const override
Definition: svdopage.cxx:177
OUString GetName() const
Definition: svdobj.cxx:697
void SetReferencedPage(SdrPage *pNewPage)
Definition: svdopage.cxx:97
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:928
virtual SdrPageObj * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: svdopage.cxx:147
SdrPage * mpShownPage
Definition: svdopage.hxx:37
SdrPageObj(SdrModel &rSdrModel, SdrPage *pNewPage=nullptr)
Definition: svdopage.cxx:61