xref: /aoo41x/main/svx/source/svdraw/svdopage.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_svx.hxx"
30 
31 #include <svx/svdopage.hxx>
32 #include "svx/svdglob.hxx"  // Stringcache
33 #include "svx/svdstr.hrc"   // Objektname
34 #include <svx/svdtrans.hxx>
35 #include <svx/svdetc.hxx>
36 #include <svx/svdmodel.hxx>
37 #include <svx/svdpage.hxx>
38 #include <svx/svdpagv.hxx>
39 #include <svx/svdoutl.hxx>
40 #include <svtools/colorcfg.hxx>
41 #include <svl/itemset.hxx>
42 #include <svx/sdr/properties/pageproperties.hxx>
43 
44 // #111111#
45 #include <svx/sdr/contact/viewcontactofpageobj.hxx>
46 
47 ////////////////////////////////////////////////////////////////////////////////////////////////////
48 // BaseProperties section
49 
50 sdr::properties::BaseProperties* SdrPageObj::CreateObjectSpecificProperties()
51 {
52 	return new sdr::properties::PageProperties(*this);
53 }
54 
55 //////////////////////////////////////////////////////////////////////////////
56 // DrawContact section
57 
58 sdr::contact::ViewContact* SdrPageObj::CreateObjectSpecificViewContact()
59 {
60 	return new sdr::contact::ViewContactOfPageObj(*this);
61 }
62 
63 ////////////////////////////////////////////////////////////////////////////////////////////////////
64 // this method is called form the destructor of the referenced page.
65 // do all necessary action to forget the page. It is not necessary to call
66 // RemovePageUser(), that is done form the destructor.
67 void SdrPageObj::PageInDestruction(const SdrPage& rPage)
68 {
69 	if(mpShownPage && mpShownPage == &rPage)
70 	{
71         // #i58769# Do not call ActionChanged() here, because that would
72         // lead to the construction of a view contact object for a page that
73         // is being destroyed.
74 
75         mpShownPage = 0L;
76 	}
77 }
78 
79 ////////////////////////////////////////////////////////////////////////////////////////////////////
80 
81 TYPEINIT1(SdrPageObj,SdrObject);
82 
83 SdrPageObj::SdrPageObj(SdrPage* pNewPage)
84 :	mpShownPage(pNewPage)
85 {
86 	if(mpShownPage)
87 	{
88 		mpShownPage->AddPageUser(*this);
89 	}
90 }
91 
92 SdrPageObj::SdrPageObj(const Rectangle& rRect, SdrPage* pNewPage)
93 :	mpShownPage(pNewPage)
94 {
95 	if(mpShownPage)
96 	{
97 		mpShownPage->AddPageUser(*this);
98 	}
99 
100 	aOutRect = rRect;
101 }
102 
103 SdrPageObj::~SdrPageObj()
104 {
105 	// #111111#
106 	if(mpShownPage)
107 	{
108 		mpShownPage->RemovePageUser(*this);
109 	}
110 }
111 
112 // #111111#
113 SdrPage* SdrPageObj::GetReferencedPage() const
114 {
115 	return mpShownPage;
116 }
117 
118 // #111111#
119 void SdrPageObj::SetReferencedPage(SdrPage* pNewPage)
120 {
121 	if(mpShownPage != pNewPage)
122 	{
123 		if(mpShownPage)
124 		{
125 			mpShownPage->RemovePageUser(*this);
126 		}
127 
128 		mpShownPage = pNewPage;
129 
130 		if(mpShownPage)
131 		{
132 			mpShownPage->AddPageUser(*this);
133 		}
134 
135 		SetChanged();
136 		BroadcastObjectChange();
137 	}
138 }
139 
140 // #i96598#
141 void SdrPageObj::SetBoundRectDirty()
142 {
143     // avoid resetting aOutRect which in case of this object is model data,
144     // not re-creatable view data
145 }
146 
147 sal_uInt16 SdrPageObj::GetObjIdentifier() const
148 {
149 	return sal_uInt16(OBJ_PAGE);
150 }
151 
152 void SdrPageObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
153 {
154 	rInfo.bRotateFreeAllowed=sal_False;
155 	rInfo.bRotate90Allowed  =sal_False;
156 	rInfo.bMirrorFreeAllowed=sal_False;
157 	rInfo.bMirror45Allowed  =sal_False;
158 	rInfo.bMirror90Allowed  =sal_False;
159 	rInfo.bTransparenceAllowed = sal_False;
160 	rInfo.bGradientAllowed = sal_False;
161 	rInfo.bShearAllowed     =sal_False;
162 	rInfo.bEdgeRadiusAllowed=sal_False;
163 	rInfo.bNoOrthoDesired   =sal_False;
164 	rInfo.bCanConvToPath    =sal_False;
165 	rInfo.bCanConvToPoly    =sal_False;
166 	rInfo.bCanConvToPathLineToArea=sal_False;
167 	rInfo.bCanConvToPolyLineToArea=sal_False;
168 }
169 
170 void SdrPageObj::operator=(const SdrObject& rObj)
171 {
172 	SdrObject::operator=(rObj);
173 	SetReferencedPage(((const SdrPageObj&)rObj).GetReferencedPage());
174 }
175 
176 void SdrPageObj::TakeObjNameSingul(XubString& rName) const
177 {
178 	rName=ImpGetResStr(STR_ObjNameSingulPAGE);
179 
180 	String aName( GetName() );
181 	if(aName.Len())
182 	{
183 		rName += sal_Unicode(' ');
184 		rName += sal_Unicode('\'');
185 		rName += aName;
186 		rName += sal_Unicode('\'');
187 	}
188 }
189 
190 void SdrPageObj::TakeObjNamePlural(XubString& rName) const
191 {
192 	rName=ImpGetResStr(STR_ObjNamePluralPAGE);
193 }
194 
195 // eof
196