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