Line data Source code
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/svdglob.hxx"
23 : #include "svx/svdstr.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>
32 : #include <svx/sdr/properties/pageproperties.hxx>
33 : #include <svx/sdr/contact/viewcontactofpageobj.hxx>
34 :
35 :
36 : // BaseProperties section
37 :
38 0 : sdr::properties::BaseProperties* SdrPageObj::CreateObjectSpecificProperties()
39 : {
40 0 : return new sdr::properties::PageProperties(*this);
41 : }
42 :
43 :
44 : // DrawContact section
45 :
46 0 : sdr::contact::ViewContact* SdrPageObj::CreateObjectSpecificViewContact()
47 : {
48 0 : return new sdr::contact::ViewContactOfPageObj(*this);
49 : }
50 :
51 :
52 : // this method is called form 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 form the destructor.
55 0 : void SdrPageObj::PageInDestruction(const SdrPage& rPage)
56 : {
57 0 : 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 0 : mpShownPage = 0L;
64 : }
65 0 : }
66 :
67 :
68 :
69 0 : TYPEINIT1(SdrPageObj,SdrObject);
70 :
71 0 : SdrPageObj::SdrPageObj(SdrPage* pNewPage)
72 0 : : mpShownPage(pNewPage)
73 : {
74 0 : if(mpShownPage)
75 : {
76 0 : mpShownPage->AddPageUser(*this);
77 : }
78 0 : }
79 :
80 0 : SdrPageObj::SdrPageObj(const Rectangle& rRect, SdrPage* pNewPage)
81 0 : : mpShownPage(pNewPage)
82 : {
83 0 : if(mpShownPage)
84 : {
85 0 : mpShownPage->AddPageUser(*this);
86 : }
87 :
88 0 : aOutRect = rRect;
89 0 : }
90 :
91 0 : SdrPageObj::~SdrPageObj()
92 : {
93 0 : if(mpShownPage)
94 : {
95 0 : mpShownPage->RemovePageUser(*this);
96 : }
97 0 : }
98 :
99 0 : SdrPage* SdrPageObj::GetReferencedPage() const
100 : {
101 0 : return mpShownPage;
102 : }
103 :
104 0 : void SdrPageObj::SetReferencedPage(SdrPage* pNewPage)
105 : {
106 0 : if(mpShownPage != pNewPage)
107 : {
108 0 : if(mpShownPage)
109 : {
110 0 : mpShownPage->RemovePageUser(*this);
111 : }
112 :
113 0 : mpShownPage = pNewPage;
114 :
115 0 : if(mpShownPage)
116 : {
117 0 : mpShownPage->AddPageUser(*this);
118 : }
119 :
120 0 : SetChanged();
121 0 : BroadcastObjectChange();
122 : }
123 0 : }
124 :
125 : // #i96598#
126 0 : void SdrPageObj::SetBoundRectDirty()
127 : {
128 : // avoid resetting aOutRect which in case of this object is model data,
129 : // not re-creatable view data
130 0 : }
131 :
132 0 : sal_uInt16 SdrPageObj::GetObjIdentifier() const
133 : {
134 0 : return sal_uInt16(OBJ_PAGE);
135 : }
136 :
137 0 : void SdrPageObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
138 : {
139 0 : rInfo.bRotateFreeAllowed=false;
140 0 : rInfo.bRotate90Allowed =false;
141 0 : rInfo.bMirrorFreeAllowed=false;
142 0 : rInfo.bMirror45Allowed =false;
143 0 : rInfo.bMirror90Allowed =false;
144 0 : rInfo.bTransparenceAllowed = false;
145 0 : rInfo.bGradientAllowed = false;
146 0 : rInfo.bShearAllowed =false;
147 0 : rInfo.bEdgeRadiusAllowed=false;
148 0 : rInfo.bNoOrthoDesired =false;
149 0 : rInfo.bCanConvToPath =false;
150 0 : rInfo.bCanConvToPoly =false;
151 0 : rInfo.bCanConvToPathLineToArea=false;
152 0 : rInfo.bCanConvToPolyLineToArea=false;
153 0 : }
154 :
155 0 : SdrPageObj* SdrPageObj::Clone() const
156 : {
157 0 : return CloneHelper< SdrPageObj >();
158 : }
159 :
160 0 : SdrPageObj& SdrPageObj::operator=(const SdrPageObj& rObj)
161 : {
162 0 : if( this == &rObj )
163 0 : return *this;
164 0 : SdrObject::operator=(rObj);
165 0 : SetReferencedPage( rObj.GetReferencedPage());
166 0 : return *this;
167 : }
168 :
169 0 : OUString SdrPageObj::TakeObjNameSingul() const
170 : {
171 0 : OUStringBuffer sName(ImpGetResStr(STR_ObjNameSingulPAGE));
172 :
173 0 : OUString aName(GetName());
174 0 : if (!aName.isEmpty())
175 : {
176 0 : sName.append(' ');
177 0 : sName.append('\'');
178 0 : sName.append(aName);
179 0 : sName.append('\'');
180 : }
181 :
182 0 : return sName.makeStringAndClear();
183 : }
184 :
185 0 : OUString SdrPageObj::TakeObjNamePlural() const
186 : {
187 0 : return ImpGetResStr(STR_ObjNamePluralPAGE);
188 : }
189 :
190 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|