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 #include <rtl/ustrbuf.hxx>
29 
30 
31 // BaseProperties section
32 
33 std::unique_ptr<sdr::properties::BaseProperties> SdrPageObj::CreateObjectSpecificProperties()
34 {
35  return std::make_unique<sdr::properties::PageProperties>(*this);
36 }
37 
38 
39 // DrawContact section
40 
41 std::unique_ptr<sdr::contact::ViewContact> SdrPageObj::CreateObjectSpecificViewContact()
42 {
43  return std::make_unique<sdr::contact::ViewContactOfPageObj>(*this);
44 }
45 
46 
47 // this method is called from the destructor of the referenced page.
48 // do all necessary action to forget the page. It is not necessary to call
49 // RemovePageUser(), that is done from the destructor.
51 {
52  if(mpShownPage && mpShownPage == &rPage)
53  {
54  // #i58769# Do not call ActionChanged() here, because that would
55  // lead to the construction of a view contact object for a page that
56  // is being destroyed.
57 
58  mpShownPage = nullptr;
59  }
60 }
61 
63  SdrModel& rSdrModel,
64  SdrPage* pNewPage)
65 : SdrObject(rSdrModel),
66  mpShownPage(pNewPage)
67 {
68  if(mpShownPage)
69  {
70  mpShownPage->AddPageUser(*this);
71  }
72 }
73 
75  SdrModel& rSdrModel,
76  const tools::Rectangle& rRect,
77  SdrPage* pNewPage)
78 : SdrObject(rSdrModel),
79  mpShownPage(pNewPage)
80 {
81  if(mpShownPage)
82  {
83  mpShownPage->AddPageUser(*this);
84  }
85 
86  aOutRect = rRect;
87 }
88 
90 {
91  if(mpShownPage)
92  {
94  }
95 }
96 
97 
99 {
100  if(mpShownPage != pNewPage)
101  {
102  if(mpShownPage)
103  {
104  mpShownPage->RemovePageUser(*this);
105  }
106 
107  mpShownPage = pNewPage;
108 
109  if(mpShownPage)
110  {
111  mpShownPage->AddPageUser(*this);
112  }
113 
114  SetChanged();
116  }
117 }
118 
119 // #i96598#
121 {
122  // avoid resetting aOutRect which in case of this object is model data,
123  // not re-creatable view data
124 }
125 
127 {
128  return sal_uInt16(OBJ_PAGE);
129 }
130 
132 {
133  rInfo.bRotateFreeAllowed=false;
134  rInfo.bRotate90Allowed =false;
135  rInfo.bMirrorFreeAllowed=false;
136  rInfo.bMirror45Allowed =false;
137  rInfo.bMirror90Allowed =false;
138  rInfo.bTransparenceAllowed = false;
139  rInfo.bShearAllowed =false;
140  rInfo.bEdgeRadiusAllowed=false;
141  rInfo.bNoOrthoDesired =false;
142  rInfo.bCanConvToPath =false;
143  rInfo.bCanConvToPoly =false;
144  rInfo.bCanConvToPathLineToArea=false;
145  rInfo.bCanConvToPolyLineToArea=false;
146 }
147 
149 {
150  return CloneHelper< SdrPageObj >(rTargetModel);
151 }
152 
154 {
155  if( this == &rObj )
156  return *this;
157  SdrObject::operator=(rObj);
159  return *this;
160 }
161 
163 {
164  OUStringBuffer sName(SvxResId(STR_ObjNameSingulPAGE));
165 
166  OUString aName(GetName());
167  if (!aName.isEmpty())
168  {
169  sName.append(' ');
170  sName.append('\'');
171  sName.append(aName);
172  sName.append('\'');
173  }
174 
175  return sName.makeStringAndClear();
176 }
177 
179 {
180  return SvxResId(STR_ObjNamePluralPAGE);
181 }
182 
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void AddPageUser(sdr::PageUser &rNewUser)
Definition: svdpage.cxx:1078
virtual ~SdrPageObj() override
Definition: svdopage.cxx:89
Polyline represented by SdrPathObj.
Definition: svdobj.hxx:142
SdrPageObj & operator=(const SdrPageObj &rObj)
Definition: svdopage.cxx:153
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:162
void RemovePageUser(sdr::PageUser &rOldUser)
Definition: svdpage.cxx:1083
SdrObject & operator=(const SdrObject &rObj)
Definition: svdobj.cxx:979
virtual void SetBoundRectDirty() override
Definition: svdopage.cxx:120
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdopage.cxx:41
OUString sName
tools::Rectangle aOutRect
Definition: svdobj.hxx:922
void BroadcastObjectChange() const
Definition: svdobj.cxx:905
virtual sal_uInt16 GetObjIdentifier() const override
Definition: svdopage.cxx:126
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: svdopage.cxx:131
virtual void PageInDestruction(const SdrPage &rPage) override
Definition: svdopage.cxx:50
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdopage.cxx:33
Abstract DrawObject.
Definition: svdobj.hxx:312
virtual OUString TakeObjNamePlural() const override
Definition: svdopage.cxx:178
OUString GetName() const
Definition: svdobj.cxx:698
void SetReferencedPage(SdrPage *pNewPage)
Definition: svdopage.cxx:98
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:365
virtual void SetChanged()
Definition: svdobj.cxx:929
virtual SdrPageObj * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: svdopage.cxx:148
SdrPage * mpShownPage
Definition: svdopage.hxx:37
SdrPageObj(SdrModel &rSdrModel, SdrPage *pNewPage=nullptr)
Definition: svdopage.cxx:62