xref: /trunk/main/svx/source/svdraw/svdopage.cxx (revision f6e50924)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svx.hxx"
26 
27 #include <svx/svdopage.hxx>
28 #include "svx/svdglob.hxx"  // Stringcache
29 #include "svx/svdstr.hrc"   // Objektname
30 #include <svx/svdtrans.hxx>
31 #include <svx/svdetc.hxx>
32 #include <svx/svdmodel.hxx>
33 #include <svx/svdpage.hxx>
34 #include <svx/svdpagv.hxx>
35 #include <svx/svdoutl.hxx>
36 #include <svtools/colorcfg.hxx>
37 #include <svl/itemset.hxx>
38 #include <svx/sdr/properties/pageproperties.hxx>
39 
40 // #111111#
41 #include <svx/sdr/contact/viewcontactofpageobj.hxx>
42 
43 ////////////////////////////////////////////////////////////////////////////////////////////////////
44 // BaseProperties section
45 
CreateObjectSpecificProperties()46 sdr::properties::BaseProperties* SdrPageObj::CreateObjectSpecificProperties()
47 {
48 	return new sdr::properties::PageProperties(*this);
49 }
50 
51 //////////////////////////////////////////////////////////////////////////////
52 // DrawContact section
53 
CreateObjectSpecificViewContact()54 sdr::contact::ViewContact* SdrPageObj::CreateObjectSpecificViewContact()
55 {
56 	return new sdr::contact::ViewContactOfPageObj(*this);
57 }
58 
59 ////////////////////////////////////////////////////////////////////////////////////////////////////
60 // this method is called form the destructor of the referenced page.
61 // do all necessary action to forget the page. It is not necessary to call
62 // RemovePageUser(), that is done form the destructor.
PageInDestruction(const SdrPage & rPage)63 void SdrPageObj::PageInDestruction(const SdrPage& rPage)
64 {
65 	if(mpShownPage && mpShownPage == &rPage)
66 	{
67         // #i58769# Do not call ActionChanged() here, because that would
68         // lead to the construction of a view contact object for a page that
69         // is being destroyed.
70 
71         mpShownPage = 0L;
72 	}
73 }
74 
75 ////////////////////////////////////////////////////////////////////////////////////////////////////
76 
77 TYPEINIT1(SdrPageObj,SdrObject);
78 
SdrPageObj(SdrPage * pNewPage)79 SdrPageObj::SdrPageObj(SdrPage* pNewPage)
80 :	mpShownPage(pNewPage)
81 {
82 	if(mpShownPage)
83 	{
84 		mpShownPage->AddPageUser(*this);
85 	}
86 }
87 
SdrPageObj(const Rectangle & rRect,SdrPage * pNewPage)88 SdrPageObj::SdrPageObj(const Rectangle& rRect, SdrPage* pNewPage)
89 :	mpShownPage(pNewPage)
90 {
91 	if(mpShownPage)
92 	{
93 		mpShownPage->AddPageUser(*this);
94 	}
95 
96 	aOutRect = rRect;
97 }
98 
~SdrPageObj()99 SdrPageObj::~SdrPageObj()
100 {
101 	// #111111#
102 	if(mpShownPage)
103 	{
104 		mpShownPage->RemovePageUser(*this);
105 	}
106 }
107 
108 // #111111#
GetReferencedPage() const109 SdrPage* SdrPageObj::GetReferencedPage() const
110 {
111 	return mpShownPage;
112 }
113 
114 // #111111#
SetReferencedPage(SdrPage * pNewPage)115 void SdrPageObj::SetReferencedPage(SdrPage* pNewPage)
116 {
117 	if(mpShownPage != pNewPage)
118 	{
119 		if(mpShownPage)
120 		{
121 			mpShownPage->RemovePageUser(*this);
122 		}
123 
124 		mpShownPage = pNewPage;
125 
126 		if(mpShownPage)
127 		{
128 			mpShownPage->AddPageUser(*this);
129 		}
130 
131 		SetChanged();
132 		BroadcastObjectChange();
133 	}
134 }
135 
136 // #i96598#
SetBoundRectDirty()137 void SdrPageObj::SetBoundRectDirty()
138 {
139     // avoid resetting aOutRect which in case of this object is model data,
140     // not re-creatable view data
141 }
142 
GetObjIdentifier() const143 sal_uInt16 SdrPageObj::GetObjIdentifier() const
144 {
145 	return sal_uInt16(OBJ_PAGE);
146 }
147 
TakeObjInfo(SdrObjTransformInfoRec & rInfo) const148 void SdrPageObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
149 {
150 	rInfo.bRotateFreeAllowed=sal_False;
151 	rInfo.bRotate90Allowed  =sal_False;
152 	rInfo.bMirrorFreeAllowed=sal_False;
153 	rInfo.bMirror45Allowed  =sal_False;
154 	rInfo.bMirror90Allowed  =sal_False;
155 	rInfo.bTransparenceAllowed = sal_False;
156 	rInfo.bGradientAllowed = sal_False;
157 	rInfo.bShearAllowed     =sal_False;
158 	rInfo.bEdgeRadiusAllowed=sal_False;
159 	rInfo.bNoOrthoDesired   =sal_False;
160 	rInfo.bCanConvToPath    =sal_False;
161 	rInfo.bCanConvToPoly    =sal_False;
162 	rInfo.bCanConvToPathLineToArea=sal_False;
163 	rInfo.bCanConvToPolyLineToArea=sal_False;
164 }
165 
operator =(const SdrObject & rObj)166 void SdrPageObj::operator=(const SdrObject& rObj)
167 {
168 	SdrObject::operator=(rObj);
169 	SetReferencedPage(((const SdrPageObj&)rObj).GetReferencedPage());
170 }
171 
TakeObjNameSingul(XubString & rName) const172 void SdrPageObj::TakeObjNameSingul(XubString& rName) const
173 {
174 	rName=ImpGetResStr(STR_ObjNameSingulPAGE);
175 
176 	String aName( GetName() );
177 	if(aName.Len())
178 	{
179 		rName += sal_Unicode(' ');
180 		rName += sal_Unicode('\'');
181 		rName += aName;
182 		rName += sal_Unicode('\'');
183 	}
184 }
185 
TakeObjNamePlural(XubString & rName) const186 void SdrPageObj::TakeObjNamePlural(XubString& rName) const
187 {
188 	rName=ImpGetResStr(STR_ObjNamePluralPAGE);
189 }
190 
191 // eof
192