1f6e50924SAndrew Rist /**************************************************************
2cd1c183bSmseidel  *
3f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f6e50924SAndrew Rist  * distributed with this work for additional information
6f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cd1c183bSmseidel  *
11f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cd1c183bSmseidel  *
13f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17f6e50924SAndrew Rist  * specific language governing permissions and limitations
18f6e50924SAndrew Rist  * under the License.
19cd1c183bSmseidel  *
20f6e50924SAndrew Rist  *************************************************************/
21f6e50924SAndrew Rist 
22f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir #include <svx/sdr/contact/viewcontactofsdrpage.hxx>
27cdf0e10cSrcweir #include <svx/sdr/contact/viewobjectcontact.hxx>
28cdf0e10cSrcweir #include <svx/svdpage.hxx>
29cdf0e10cSrcweir #include <svx/sdr/contact/displayinfo.hxx>
30cdf0e10cSrcweir #include <svx/sdr/contact/viewobjectcontactofsdrpage.hxx>
31cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx>
32cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
33cdf0e10cSrcweir #include <svx/svdpagv.hxx>
34cdf0e10cSrcweir #include <svx/svdview.hxx>
35cdf0e10cSrcweir #include <vcl/svapp.hxx>
36cdf0e10cSrcweir #include <svx/sdr/contact/objectcontact.hxx>
37cdf0e10cSrcweir #include <drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx>
38cdf0e10cSrcweir #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
39cdf0e10cSrcweir #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
40cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
41cdf0e10cSrcweir #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
42cdf0e10cSrcweir #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
43cdf0e10cSrcweir #include <vcl/lazydelete.hxx>
44cdf0e10cSrcweir #include <svx/svdstr.hrc>
45cdf0e10cSrcweir #include <svx/svdglob.hxx>
46cdf0e10cSrcweir #include <drawinglayer/primitive2d/discreteshadowprimitive2d.hxx>
47cdf0e10cSrcweir #include <drawinglayer/attribute/sdrfillattribute.hxx>
48cdf0e10cSrcweir 
49cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
50cdf0e10cSrcweir 
51cdf0e10cSrcweir #define PAPER_SHADOW(SIZE) (SIZE >> 8)
52cdf0e10cSrcweir 
53cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
54cdf0e10cSrcweir 
55cdf0e10cSrcweir namespace sdr
56cdf0e10cSrcweir {
57cdf0e10cSrcweir 	namespace contact
58cdf0e10cSrcweir 	{
ViewContactOfPageSubObject(ViewContactOfSdrPage & rParentViewContactOfSdrPage)59cdf0e10cSrcweir 		ViewContactOfPageSubObject::ViewContactOfPageSubObject(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
60cdf0e10cSrcweir 		:	mrParentViewContactOfSdrPage(rParentViewContactOfSdrPage)
61cdf0e10cSrcweir 		{
62cdf0e10cSrcweir 		}
63cdf0e10cSrcweir 
~ViewContactOfPageSubObject()64cdf0e10cSrcweir 		ViewContactOfPageSubObject::~ViewContactOfPageSubObject()
65cdf0e10cSrcweir 		{
66cdf0e10cSrcweir 		}
67cdf0e10cSrcweir 
GetParentContact() const68cdf0e10cSrcweir 		ViewContact* ViewContactOfPageSubObject::GetParentContact() const
69cdf0e10cSrcweir 		{
70cdf0e10cSrcweir 			return &mrParentViewContactOfSdrPage;
71cdf0e10cSrcweir 		}
72cdf0e10cSrcweir 
getPage() const73cdf0e10cSrcweir 		const SdrPage& ViewContactOfPageSubObject::getPage() const
74cdf0e10cSrcweir 		{
75cdf0e10cSrcweir 			return mrParentViewContactOfSdrPage.GetSdrPage();
76cdf0e10cSrcweir 		}
77cdf0e10cSrcweir 	} // end of namespace contact
78cdf0e10cSrcweir } // end of namespace sdr
79cdf0e10cSrcweir 
80cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
81cdf0e10cSrcweir 
82cdf0e10cSrcweir namespace sdr
83cdf0e10cSrcweir {
84cdf0e10cSrcweir 	namespace contact
85cdf0e10cSrcweir 	{
CreateObjectSpecificViewObjectContact(ObjectContact & rObjectContact)86cdf0e10cSrcweir 		ViewObjectContact& ViewContactOfPageBackground::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
87cdf0e10cSrcweir 		{
88cdf0e10cSrcweir 			ViewObjectContact* pRetval = new ViewObjectContactOfPageBackground(rObjectContact, *this);
89cdf0e10cSrcweir 			DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 			return *pRetval;
92cdf0e10cSrcweir 		}
93cdf0e10cSrcweir 
createViewIndependentPrimitive2DSequence() const94cdf0e10cSrcweir 		drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageBackground::createViewIndependentPrimitive2DSequence() const
95cdf0e10cSrcweir 		{
96cdf0e10cSrcweir 			// We have only the page information, not the view information. Use the
97a70413d2Smseidel 			// svtools::DOCCOLOR color for initialization
98cdf0e10cSrcweir 			const svtools::ColorConfig aColorConfig;
99cdf0e10cSrcweir 			const Color aInitColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
100cdf0e10cSrcweir 			const basegfx::BColor aRGBColor(aInitColor.getBColor());
101cdf0e10cSrcweir 			const drawinglayer::primitive2d::Primitive2DReference xReference(
102cd1c183bSmseidel 				new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor));
103cdf0e10cSrcweir 
104cd1c183bSmseidel 			return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
105cdf0e10cSrcweir 		}
106cdf0e10cSrcweir 
ViewContactOfPageBackground(ViewContactOfSdrPage & rParentViewContactOfSdrPage)107cdf0e10cSrcweir 		ViewContactOfPageBackground::ViewContactOfPageBackground(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
108cdf0e10cSrcweir 		:	ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
109cdf0e10cSrcweir 		{
110cdf0e10cSrcweir 		}
111cdf0e10cSrcweir 
~ViewContactOfPageBackground()112cdf0e10cSrcweir 		ViewContactOfPageBackground::~ViewContactOfPageBackground()
113cdf0e10cSrcweir 		{
114cdf0e10cSrcweir 		}
115cdf0e10cSrcweir 	} // end of namespace contact
116cdf0e10cSrcweir } // end of namespace sdr
117cdf0e10cSrcweir 
118cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
119cdf0e10cSrcweir 
120cdf0e10cSrcweir namespace sdr
121cdf0e10cSrcweir {
122cdf0e10cSrcweir 	namespace contact
123cdf0e10cSrcweir 	{
CreateObjectSpecificViewObjectContact(ObjectContact & rObjectContact)124cdf0e10cSrcweir 		ViewObjectContact& ViewContactOfPageShadow::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
125cdf0e10cSrcweir 		{
126cdf0e10cSrcweir 			ViewObjectContact* pRetval = new ViewObjectContactOfPageShadow(rObjectContact, *this);
127cdf0e10cSrcweir 			DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 			return *pRetval;
130cdf0e10cSrcweir 		}
131cdf0e10cSrcweir 
createViewIndependentPrimitive2DSequence() const132cdf0e10cSrcweir 		drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageShadow::createViewIndependentPrimitive2DSequence() const
133cdf0e10cSrcweir 		{
134*6219a301Smseidel 			static bool bUseOldPageShadow(true);
135cd1c183bSmseidel 			const SdrPage& rPage = getPage();
136cd1c183bSmseidel 			basegfx::B2DHomMatrix aPageMatrix;
137cd1c183bSmseidel 			aPageMatrix.set(0, 0, (double)rPage.GetWdt());
138cd1c183bSmseidel 			aPageMatrix.set(1, 1, (double)rPage.GetHgt());
139cd1c183bSmseidel 
140cd1c183bSmseidel 			if(bUseOldPageShadow)
141cd1c183bSmseidel 			{
142cd1c183bSmseidel 				// create page shadow polygon
143*6219a301Smseidel //				const double fPageBorderFactor(1.0 / 256.0);
144cd1c183bSmseidel 				basegfx::B2DPolygon aPageShadowPolygon;
145*6219a301Smseidel //				aPageShadowPolygon.append(basegfx::B2DPoint(1.0, fPageBorderFactor));
146*6219a301Smseidel //				aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, fPageBorderFactor));
147*6219a301Smseidel //				aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, 1.0 + fPageBorderFactor));
148*6219a301Smseidel //				aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0 + fPageBorderFactor));
149*6219a301Smseidel //				aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0));
150*6219a301Smseidel //				aPageShadowPolygon.append(basegfx::B2DPoint(1.0, 1.0));
151*6219a301Smseidel //				aPageShadowPolygon.setClosed(true);
152*6219a301Smseidel //				aPageShadowPolygon.transform(aPageMatrix);
153cd1c183bSmseidel 
154cd1c183bSmseidel 				// We have only the page information, not the view information. Use the
155cd1c183bSmseidel 				// svtools::FONTCOLOR color for initialization
156cd1c183bSmseidel 				const svtools::ColorConfig aColorConfig;
157cd1c183bSmseidel 				const Color aShadowColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
158cd1c183bSmseidel 				const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor());
159cd1c183bSmseidel 				const drawinglayer::primitive2d::Primitive2DReference xReference(
160cd1c183bSmseidel 					new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
161cd1c183bSmseidel 						basegfx::B2DPolyPolygon(aPageShadowPolygon),
162cd1c183bSmseidel 						aRGBShadowColor));
163cd1c183bSmseidel 
164cd1c183bSmseidel 				return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
165cd1c183bSmseidel 			}
166cd1c183bSmseidel 			else
167cd1c183bSmseidel 			{
168cd1c183bSmseidel 				static vcl::DeleteOnDeinit< drawinglayer::primitive2d::DiscreteShadow > aDiscreteShadow(
169cd1c183bSmseidel 					new drawinglayer::primitive2d::DiscreteShadow(
170cd1c183bSmseidel 						BitmapEx(
171cd1c183bSmseidel 							ResId(
172cd1c183bSmseidel 								SIP_SA_PAGESHADOW35X35,
173cd1c183bSmseidel 								*ImpGetResMgr()))));
174cd1c183bSmseidel 
175cd1c183bSmseidel 				if(aDiscreteShadow.get())
176cd1c183bSmseidel 				{
177cd1c183bSmseidel 					const drawinglayer::primitive2d::Primitive2DReference xReference(
178cd1c183bSmseidel 						new drawinglayer::primitive2d::DiscreteShadowPrimitive2D(
179cd1c183bSmseidel 							aPageMatrix,
180cd1c183bSmseidel 							*aDiscreteShadow.get()));
181cd1c183bSmseidel 
182cd1c183bSmseidel 					return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
183cd1c183bSmseidel 				}
184cd1c183bSmseidel 
185cd1c183bSmseidel 				return drawinglayer::primitive2d::Primitive2DSequence();
186cd1c183bSmseidel 			}
187cdf0e10cSrcweir 		}
188cdf0e10cSrcweir 
ViewContactOfPageShadow(ViewContactOfSdrPage & rParentViewContactOfSdrPage)189cdf0e10cSrcweir 		ViewContactOfPageShadow::ViewContactOfPageShadow(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
190cdf0e10cSrcweir 		:	ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
191cdf0e10cSrcweir 		{
192cdf0e10cSrcweir 		}
193cdf0e10cSrcweir 
~ViewContactOfPageShadow()194cdf0e10cSrcweir 		ViewContactOfPageShadow::~ViewContactOfPageShadow()
195cdf0e10cSrcweir 		{
196cdf0e10cSrcweir 		}
197cdf0e10cSrcweir 	} // end of namespace contact
198cdf0e10cSrcweir } // end of namespace sdr
199cdf0e10cSrcweir 
200cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
201cdf0e10cSrcweir 
202cdf0e10cSrcweir namespace sdr
203cdf0e10cSrcweir {
204cdf0e10cSrcweir 	namespace contact
205cdf0e10cSrcweir 	{
CreateObjectSpecificViewObjectContact(ObjectContact & rObjectContact)206cdf0e10cSrcweir 		ViewObjectContact& ViewContactOfMasterPage::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
207cdf0e10cSrcweir 		{
208cdf0e10cSrcweir 			ViewObjectContact* pRetval = new ViewObjectContactOfMasterPage(rObjectContact, *this);
209cdf0e10cSrcweir 			DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
210cdf0e10cSrcweir 
211cdf0e10cSrcweir 			return *pRetval;
212cdf0e10cSrcweir 		}
213cdf0e10cSrcweir 
createViewIndependentPrimitive2DSequence() const214cdf0e10cSrcweir 		drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPage::createViewIndependentPrimitive2DSequence() const
215cdf0e10cSrcweir 		{
216cdf0e10cSrcweir 			drawinglayer::primitive2d::Primitive2DSequence xRetval;
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 			// this class is used when the page is a MasterPage and is responsible to
219cd1c183bSmseidel 			// create a visualization for the MPBGO, if exists. This needs to be suppressed
220cd1c183bSmseidel 			// when a SdrPage which uses a MasterPage creates its output. Suppression
221cdf0e10cSrcweir 			// is done in the corresponding VOC since DisplayInfo data is needed
222cdf0e10cSrcweir 			const SdrPage& rPage = getPage();
223cdf0e10cSrcweir 
224cdf0e10cSrcweir 			if(rPage.IsMasterPage())
225cdf0e10cSrcweir 			{
226cd1c183bSmseidel 				if(0 == rPage.GetPageNum())
227cd1c183bSmseidel 				{
228cd1c183bSmseidel 					// #i98063#
229cd1c183bSmseidel 					// filter MasterPage 0 since it's the HandoutPage. Thus, it's a
230cd1c183bSmseidel 					// MasterPage, but has no MPBGO, so there is nothing to do here.
231cd1c183bSmseidel 				}
232cd1c183bSmseidel 				else
233cd1c183bSmseidel 				{
234cd1c183bSmseidel 					drawinglayer::attribute::SdrFillAttribute aFill;
235cd1c183bSmseidel 
236cd1c183bSmseidel 					// #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets,
237cd1c183bSmseidel 					// else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all
238cd1c183bSmseidel 					// MasterPages should have a StyleSheet excactly for this reason, but historically
239cd1c183bSmseidel 					// e.g. the Notes MasterPage has no StyleSheet set (and there maybe others).
240cd1c183bSmseidel 					if(rPage.getSdrPageProperties().GetStyleSheet())
241cd1c183bSmseidel 					{
242cd1c183bSmseidel 						// create page fill attributes with correct properties
243cd1c183bSmseidel 						aFill = drawinglayer::primitive2d::createNewSdrFillAttribute(
244cd1c183bSmseidel 							rPage.getSdrPageProperties().GetItemSet());
245cd1c183bSmseidel 					}
246cd1c183bSmseidel 
247cd1c183bSmseidel 					if(!aFill.isDefault())
248cd1c183bSmseidel 					{
249cd1c183bSmseidel 						// direct model data is the page size, get and use it
250cd1c183bSmseidel 						const basegfx::B2DRange aInnerRange(
251cd1c183bSmseidel 							rPage.GetLftBorder(), rPage.GetUppBorder(),
252cd1c183bSmseidel 							rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder());
253cd1c183bSmseidel 						const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange));
254cd1c183bSmseidel 						const drawinglayer::primitive2d::Primitive2DReference xReference(
255cdf0e10cSrcweir 							drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
256cd1c183bSmseidel 								basegfx::B2DPolyPolygon(aInnerPolgon),
257cdf0e10cSrcweir 								aFill,
258cdf0e10cSrcweir 								drawinglayer::attribute::FillGradientAttribute()));
259cd1c183bSmseidel 
260cd1c183bSmseidel 						xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
261cd1c183bSmseidel 					}
262cd1c183bSmseidel 				}
263cdf0e10cSrcweir 			}
264cdf0e10cSrcweir 
265cdf0e10cSrcweir 			return xRetval;
266cdf0e10cSrcweir 		}
267cdf0e10cSrcweir 
ViewContactOfMasterPage(ViewContactOfSdrPage & rParentViewContactOfSdrPage)268cdf0e10cSrcweir 		ViewContactOfMasterPage::ViewContactOfMasterPage(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
269cdf0e10cSrcweir 		:	ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
270cdf0e10cSrcweir 		{
271cdf0e10cSrcweir 		}
272cdf0e10cSrcweir 
~ViewContactOfMasterPage()273cdf0e10cSrcweir 		ViewContactOfMasterPage::~ViewContactOfMasterPage()
274cdf0e10cSrcweir 		{
275cdf0e10cSrcweir 		}
276cdf0e10cSrcweir 	} // end of namespace contact
277cdf0e10cSrcweir } // end of namespace sdr
278cdf0e10cSrcweir 
279cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
280cdf0e10cSrcweir 
281cdf0e10cSrcweir namespace sdr
282cdf0e10cSrcweir {
283cdf0e10cSrcweir 	namespace contact
284cdf0e10cSrcweir 	{
CreateObjectSpecificViewObjectContact(ObjectContact & rObjectContact)285cdf0e10cSrcweir 		ViewObjectContact& ViewContactOfPageFill::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
286cdf0e10cSrcweir 		{
287cdf0e10cSrcweir 			ViewObjectContact* pRetval = new ViewObjectContactOfPageFill(rObjectContact, *this);
288cdf0e10cSrcweir 			DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 			return *pRetval;
291cdf0e10cSrcweir 		}
292cdf0e10cSrcweir 
createViewIndependentPrimitive2DSequence() const293cdf0e10cSrcweir 		drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageFill::createViewIndependentPrimitive2DSequence() const
294cdf0e10cSrcweir 		{
295cdf0e10cSrcweir 			const SdrPage& rPage = getPage();
296cdf0e10cSrcweir 			const basegfx::B2DRange aPageFillRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt());
297cdf0e10cSrcweir 			const basegfx::B2DPolygon aPageFillPolygon(basegfx::tools::createPolygonFromRect(aPageFillRange));
298cdf0e10cSrcweir 
299cdf0e10cSrcweir 			// We have only the page information, not the view information. Use the
300cd1c183bSmseidel 			// svtools::DOCCOLOR color for initialization
301cdf0e10cSrcweir 			const svtools::ColorConfig aColorConfig;
302cdf0e10cSrcweir 			const Color aPageFillColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
303cdf0e10cSrcweir 
304cdf0e10cSrcweir 			// create and add primitive
305cdf0e10cSrcweir 			const basegfx::BColor aRGBColor(aPageFillColor.getBColor());
306cdf0e10cSrcweir 			const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPageFillPolygon), aRGBColor));
307cdf0e10cSrcweir 
308cd1c183bSmseidel 			return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
309cdf0e10cSrcweir 		}
310cdf0e10cSrcweir 
ViewContactOfPageFill(ViewContactOfSdrPage & rParentViewContactOfSdrPage)311cdf0e10cSrcweir 		ViewContactOfPageFill::ViewContactOfPageFill(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
312cdf0e10cSrcweir 		:	ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
313cdf0e10cSrcweir 		{
314cdf0e10cSrcweir 		}
315cdf0e10cSrcweir 
~ViewContactOfPageFill()316cdf0e10cSrcweir 		ViewContactOfPageFill::~ViewContactOfPageFill()
317cdf0e10cSrcweir 		{
318cdf0e10cSrcweir 		}
319cdf0e10cSrcweir 	} // end of namespace contact
320cdf0e10cSrcweir } // end of namespace sdr
321cdf0e10cSrcweir 
322cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
323cdf0e10cSrcweir 
324cdf0e10cSrcweir namespace sdr
325cdf0e10cSrcweir {
326cdf0e10cSrcweir 	namespace contact
327cdf0e10cSrcweir 	{
CreateObjectSpecificViewObjectContact(ObjectContact & rObjectContact)328cdf0e10cSrcweir 		ViewObjectContact& ViewContactOfOuterPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
329cdf0e10cSrcweir 		{
330cdf0e10cSrcweir 			ViewObjectContact* pRetval = new ViewObjectContactOfOuterPageBorder(rObjectContact, *this);
331cdf0e10cSrcweir 			DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
332cdf0e10cSrcweir 
333cdf0e10cSrcweir 			return *pRetval;
334cdf0e10cSrcweir 		}
335cdf0e10cSrcweir 
createViewIndependentPrimitive2DSequence() const336cdf0e10cSrcweir 		drawinglayer::primitive2d::Primitive2DSequence ViewContactOfOuterPageBorder::createViewIndependentPrimitive2DSequence() const
337cdf0e10cSrcweir 		{
338cd1c183bSmseidel 			drawinglayer::primitive2d::Primitive2DSequence xRetval;
339cdf0e10cSrcweir 			const SdrPage& rPage = getPage();
340cdf0e10cSrcweir 			const basegfx::B2DRange aPageBorderRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt());
341cd1c183bSmseidel 
342a70413d2Smseidel 			// Changed to 0x000000 as in Writer, before svtools::FONTCOLOR was used.
343cd1c183bSmseidel 			// Added old case as fallback for HighContrast.
344a70413d2Smseidel 			basegfx::BColor aRGBBorderColor(0x00 / (double)0xff, 0x00 / (double)0xff, 0x00 / (double)0xff);
345cdf0e10cSrcweir 
346cdf0e10cSrcweir 			if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
347cdf0e10cSrcweir 			{
348cd1c183bSmseidel 				const svtools::ColorConfig aColorConfig;
349cdf0e10cSrcweir 				const Color aBorderColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
350cd1c183bSmseidel 
351cd1c183bSmseidel 				aRGBBorderColor = aBorderColor.getBColor();
352cd1c183bSmseidel 			}
353cd1c183bSmseidel 
354cd1c183bSmseidel 			if(rPage.getPageBorderOnlyLeftRight())
355cd1c183bSmseidel 			{
356cd1c183bSmseidel 				// #i93597# for Report Designer, the page border shall be only displayed right and left,
357cd1c183bSmseidel 				// but not top and bottom. Create simplified geometry.
358cd1c183bSmseidel 				basegfx::B2DPolygon aLeft, aRight;
359cd1c183bSmseidel 
360cd1c183bSmseidel 				aLeft.append(basegfx::B2DPoint(aPageBorderRange.getMinX(), aPageBorderRange.getMinY()));
361cd1c183bSmseidel 				aLeft.append(basegfx::B2DPoint(aPageBorderRange.getMinX(), aPageBorderRange.getMaxY()));
362cd1c183bSmseidel 
363cd1c183bSmseidel 				aRight.append(basegfx::B2DPoint(aPageBorderRange.getMaxX(), aPageBorderRange.getMinY()));
364cd1c183bSmseidel 				aRight.append(basegfx::B2DPoint(aPageBorderRange.getMaxX(), aPageBorderRange.getMaxY()));
365cd1c183bSmseidel 
366cd1c183bSmseidel 				xRetval.realloc(2);
367cd1c183bSmseidel 				xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aLeft, aRGBBorderColor));
368cd1c183bSmseidel 				xRetval[1] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aRight, aRGBBorderColor));
369cd1c183bSmseidel 			}
370cd1c183bSmseidel 			else
371cd1c183bSmseidel 			{
372cd1c183bSmseidel 				xRetval.realloc(1);
373cd1c183bSmseidel 				const basegfx::B2DPolygon aPageBorderPolygon(basegfx::tools::createPolygonFromRect(aPageBorderRange));
374cd1c183bSmseidel 				xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor));
375cdf0e10cSrcweir 			}
376cdf0e10cSrcweir 
377cd1c183bSmseidel 			return xRetval;
378cdf0e10cSrcweir 		}
379cdf0e10cSrcweir 
ViewContactOfOuterPageBorder(ViewContactOfSdrPage & rParentViewContactOfSdrPage)380cdf0e10cSrcweir 		ViewContactOfOuterPageBorder::ViewContactOfOuterPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
381cdf0e10cSrcweir 		:	ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
382cdf0e10cSrcweir 		{
383cdf0e10cSrcweir 		}
384cdf0e10cSrcweir 
~ViewContactOfOuterPageBorder()385cdf0e10cSrcweir 		ViewContactOfOuterPageBorder::~ViewContactOfOuterPageBorder()
386cdf0e10cSrcweir 		{
387cdf0e10cSrcweir 		}
388cdf0e10cSrcweir 	} // end of namespace contact
389cdf0e10cSrcweir } // end of namespace sdr
390cdf0e10cSrcweir 
391cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
392cdf0e10cSrcweir 
393cdf0e10cSrcweir namespace sdr
394cdf0e10cSrcweir {
395cdf0e10cSrcweir 	namespace contact
396cdf0e10cSrcweir 	{
CreateObjectSpecificViewObjectContact(ObjectContact & rObjectContact)397cdf0e10cSrcweir 		ViewObjectContact& ViewContactOfInnerPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
398cdf0e10cSrcweir 		{
399cdf0e10cSrcweir 			ViewObjectContact* pRetval = new ViewObjectContactOfInnerPageBorder(rObjectContact, *this);
400cdf0e10cSrcweir 			DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
401cdf0e10cSrcweir 
402cdf0e10cSrcweir 			return *pRetval;
403cdf0e10cSrcweir 		}
404cdf0e10cSrcweir 
createViewIndependentPrimitive2DSequence() const405cdf0e10cSrcweir 		drawinglayer::primitive2d::Primitive2DSequence ViewContactOfInnerPageBorder::createViewIndependentPrimitive2DSequence() const
406cdf0e10cSrcweir 		{
407cdf0e10cSrcweir 			const SdrPage& rPage = getPage();
408cdf0e10cSrcweir 			const basegfx::B2DRange aPageBorderRange(
409cd1c183bSmseidel 				(double)rPage.GetLftBorder(), (double)rPage.GetUppBorder(),
410cdf0e10cSrcweir 				(double)(rPage.GetWdt() - rPage.GetRgtBorder()), (double)(rPage.GetHgt() - rPage.GetLwrBorder()));
411cdf0e10cSrcweir 			const basegfx::B2DPolygon aPageBorderPolygon(basegfx::tools::createPolygonFromRect(aPageBorderRange));
412cdf0e10cSrcweir 
413cdf0e10cSrcweir 			// We have only the page information, not the view information. Use the
414a70413d2Smseidel 			// svtools::FONTCOLOR or svtools::DOCBOUNDARIES color for initialization
415cdf0e10cSrcweir 			const svtools::ColorConfig aColorConfig;
416cdf0e10cSrcweir 			Color aBorderColor;
417cdf0e10cSrcweir 
418cdf0e10cSrcweir 			if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
419cdf0e10cSrcweir 			{
420cdf0e10cSrcweir 				aBorderColor = aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor;
421cdf0e10cSrcweir 			}
422cdf0e10cSrcweir 			else
423cdf0e10cSrcweir 			{
424cdf0e10cSrcweir 				aBorderColor = aColorConfig.GetColorValue(svtools::DOCBOUNDARIES).nColor;
425cdf0e10cSrcweir 			}
426cdf0e10cSrcweir 
427cdf0e10cSrcweir 			// create page outer border primitive
428cdf0e10cSrcweir 			const basegfx::BColor aRGBBorderColor(aBorderColor.getBColor());
429cdf0e10cSrcweir 			const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor));
430cdf0e10cSrcweir 
431cd1c183bSmseidel 			return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
432cdf0e10cSrcweir 		}
433cdf0e10cSrcweir 
ViewContactOfInnerPageBorder(ViewContactOfSdrPage & rParentViewContactOfSdrPage)434cdf0e10cSrcweir 		ViewContactOfInnerPageBorder::ViewContactOfInnerPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
435cdf0e10cSrcweir 		:	ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
436cdf0e10cSrcweir 		{
437cdf0e10cSrcweir 		}
438cdf0e10cSrcweir 
~ViewContactOfInnerPageBorder()439cdf0e10cSrcweir 		ViewContactOfInnerPageBorder::~ViewContactOfInnerPageBorder()
440cdf0e10cSrcweir 		{
441cdf0e10cSrcweir 		}
442cdf0e10cSrcweir 	} // end of namespace contact
443cdf0e10cSrcweir } // end of namespace sdr
444cdf0e10cSrcweir 
445cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
446cdf0e10cSrcweir 
447cdf0e10cSrcweir namespace sdr
448cdf0e10cSrcweir {
449cdf0e10cSrcweir 	namespace contact
450cdf0e10cSrcweir 	{
CreateObjectSpecificViewObjectContact(ObjectContact & rObjectContact)451cdf0e10cSrcweir 		ViewObjectContact& ViewContactOfPageHierarchy::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
452cdf0e10cSrcweir 		{
453cdf0e10cSrcweir 			ViewObjectContact* pRetval = new ViewObjectContactOfPageHierarchy(rObjectContact, *this);
454cdf0e10cSrcweir 			DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
455cdf0e10cSrcweir 
456cdf0e10cSrcweir 			return *pRetval;
457cdf0e10cSrcweir 		}
458cdf0e10cSrcweir 
createViewIndependentPrimitive2DSequence() const459cdf0e10cSrcweir 		drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageHierarchy::createViewIndependentPrimitive2DSequence() const
460cdf0e10cSrcweir 		{
461cdf0e10cSrcweir 			// collect sub-hierarchy
462cdf0e10cSrcweir 			drawinglayer::primitive2d::Primitive2DSequence xRetval;
463cdf0e10cSrcweir 			const sal_uInt32 nObjectCount(GetObjectCount());
464cdf0e10cSrcweir 
465cdf0e10cSrcweir 			// collect all sub-primitives
466cdf0e10cSrcweir 			for(sal_uInt32 a(0); a < nObjectCount; a++)
467cdf0e10cSrcweir 			{
468cdf0e10cSrcweir 				const ViewContact& rCandidate(GetViewContact(a));
469cdf0e10cSrcweir 				const drawinglayer::primitive2d::Primitive2DSequence aCandSeq(rCandidate.getViewIndependentPrimitive2DSequence());
470cd1c183bSmseidel 
471cdf0e10cSrcweir 				drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq);
472cdf0e10cSrcweir 			}
473cdf0e10cSrcweir 
474cdf0e10cSrcweir 			return xRetval;
475cdf0e10cSrcweir 		}
476cdf0e10cSrcweir 
ViewContactOfPageHierarchy(ViewContactOfSdrPage & rParentViewContactOfSdrPage)477cdf0e10cSrcweir 		ViewContactOfPageHierarchy::ViewContactOfPageHierarchy(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
478cdf0e10cSrcweir 		:	ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
479cdf0e10cSrcweir 		{
480cdf0e10cSrcweir 		}
481cdf0e10cSrcweir 
~ViewContactOfPageHierarchy()482cdf0e10cSrcweir 		ViewContactOfPageHierarchy::~ViewContactOfPageHierarchy()
483cdf0e10cSrcweir 		{
484cdf0e10cSrcweir 		}
485cdf0e10cSrcweir 
GetObjectCount() const486cdf0e10cSrcweir 		sal_uInt32 ViewContactOfPageHierarchy::GetObjectCount() const
487cdf0e10cSrcweir 		{
488cdf0e10cSrcweir 			return getPage().GetObjCount();
489cdf0e10cSrcweir 		}
490cdf0e10cSrcweir 
GetViewContact(sal_uInt32 nIndex) const491cdf0e10cSrcweir 		ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const
492cdf0e10cSrcweir 		{
493cdf0e10cSrcweir 			SdrObject* pObj = getPage().GetObj(nIndex);
494cdf0e10cSrcweir 			DBG_ASSERT(pObj, "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)");
495cdf0e10cSrcweir 			return pObj->GetViewContact();
496cdf0e10cSrcweir 		}
497cdf0e10cSrcweir 	} // end of namespace contact
498cdf0e10cSrcweir } // end of namespace sdr
499cdf0e10cSrcweir 
500cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
501cdf0e10cSrcweir 
502cdf0e10cSrcweir namespace sdr
503cdf0e10cSrcweir {
504cdf0e10cSrcweir 	namespace contact
505cdf0e10cSrcweir 	{
CreateObjectSpecificViewObjectContact(ObjectContact & rObjectContact)506cdf0e10cSrcweir 		ViewObjectContact& ViewContactOfGrid::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
507cdf0e10cSrcweir 		{
508cdf0e10cSrcweir 			ViewObjectContact* pRetval = new ViewObjectContactOfPageGrid(rObjectContact, *this);
509cdf0e10cSrcweir 			DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
510cdf0e10cSrcweir 
511cdf0e10cSrcweir 			return *pRetval;
512cdf0e10cSrcweir 		}
513cdf0e10cSrcweir 
createViewIndependentPrimitive2DSequence() const514cdf0e10cSrcweir 		drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGrid::createViewIndependentPrimitive2DSequence() const
515cdf0e10cSrcweir 		{
516cdf0e10cSrcweir 			// We have only the page information, not the view information and thus no grid settings. Create empty
517cdf0e10cSrcweir 			// default. For the view-dependent implementation, see ViewObjectContactOfPageGrid::createPrimitive2DSequence
518cd1c183bSmseidel 			return drawinglayer::primitive2d::Primitive2DSequence();
519cdf0e10cSrcweir 		}
520cdf0e10cSrcweir 
ViewContactOfGrid(ViewContactOfSdrPage & rParentViewContactOfSdrPage,bool bFront)521cdf0e10cSrcweir 		ViewContactOfGrid::ViewContactOfGrid(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront)
522cdf0e10cSrcweir 		:	ViewContactOfPageSubObject(rParentViewContactOfSdrPage),
523cdf0e10cSrcweir 			mbFront(bFront)
524cdf0e10cSrcweir 		{
525cdf0e10cSrcweir 		}
526cdf0e10cSrcweir 
~ViewContactOfGrid()527cdf0e10cSrcweir 		ViewContactOfGrid::~ViewContactOfGrid()
528cdf0e10cSrcweir 		{
529cdf0e10cSrcweir 		}
530cdf0e10cSrcweir 	} // end of namespace contact
531cdf0e10cSrcweir } // end of namespace sdr
532cdf0e10cSrcweir 
533cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
534cdf0e10cSrcweir 
535cdf0e10cSrcweir namespace sdr
536cdf0e10cSrcweir {
537cdf0e10cSrcweir 	namespace contact
538cdf0e10cSrcweir 	{
CreateObjectSpecificViewObjectContact(ObjectContact & rObjectContact)539cdf0e10cSrcweir 		ViewObjectContact& ViewContactOfHelplines::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
540cdf0e10cSrcweir 		{
541cdf0e10cSrcweir 			ViewObjectContact* pRetval = new ViewObjectContactOfPageHelplines(rObjectContact, *this);
542cdf0e10cSrcweir 			DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
543cdf0e10cSrcweir 
544cdf0e10cSrcweir 			return *pRetval;
545cdf0e10cSrcweir 		}
546cdf0e10cSrcweir 
createViewIndependentPrimitive2DSequence() const547cdf0e10cSrcweir 		drawinglayer::primitive2d::Primitive2DSequence ViewContactOfHelplines::createViewIndependentPrimitive2DSequence() const
548cdf0e10cSrcweir 		{
549cdf0e10cSrcweir 			// We have only the page information, not the view information and thus no helplines. Create empty
550cdf0e10cSrcweir 			// default. For the view-dependent implementation, see ViewObjectContactOfPageHelplines::createPrimitive2DSequence
551cd1c183bSmseidel 			return drawinglayer::primitive2d::Primitive2DSequence();
552cdf0e10cSrcweir 		}
553cdf0e10cSrcweir 
ViewContactOfHelplines(ViewContactOfSdrPage & rParentViewContactOfSdrPage,bool bFront)554cdf0e10cSrcweir 		ViewContactOfHelplines::ViewContactOfHelplines(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront)
555cdf0e10cSrcweir 		:	ViewContactOfPageSubObject(rParentViewContactOfSdrPage),
556cdf0e10cSrcweir 			mbFront(bFront)
557cdf0e10cSrcweir 		{
558cdf0e10cSrcweir 		}
559cdf0e10cSrcweir 
~ViewContactOfHelplines()560cdf0e10cSrcweir 		ViewContactOfHelplines::~ViewContactOfHelplines()
561cdf0e10cSrcweir 		{
562cdf0e10cSrcweir 		}
563cdf0e10cSrcweir 	} // end of namespace contact
564cdf0e10cSrcweir } // end of namespace sdr
565cdf0e10cSrcweir 
566cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
567cdf0e10cSrcweir 
568cdf0e10cSrcweir namespace sdr
569cdf0e10cSrcweir {
570cdf0e10cSrcweir 	namespace contact
571cdf0e10cSrcweir 	{
572cdf0e10cSrcweir 		// Create a Object-Specific ViewObjectContact, set ViewContact and
573cdf0e10cSrcweir 		// ObjectContact. Always needs to return something.
CreateObjectSpecificViewObjectContact(ObjectContact & rObjectContact)574cdf0e10cSrcweir 		ViewObjectContact& ViewContactOfSdrPage::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
575cdf0e10cSrcweir 		{
576cdf0e10cSrcweir 			ViewObjectContact* pRetval = new ViewObjectContactOfSdrPage(rObjectContact, *this);
577cdf0e10cSrcweir 			DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
578cdf0e10cSrcweir 
579cdf0e10cSrcweir 			return *pRetval;
580cdf0e10cSrcweir 		}
581cdf0e10cSrcweir 
ViewContactOfSdrPage(SdrPage & rPage)582cdf0e10cSrcweir 		ViewContactOfSdrPage::ViewContactOfSdrPage(SdrPage& rPage)
583cdf0e10cSrcweir 		:	ViewContact(),
584cdf0e10cSrcweir 			mrPage(rPage),
585cdf0e10cSrcweir 			maViewContactOfPageBackground(*this),
586cdf0e10cSrcweir 			maViewContactOfPageShadow(*this),
587cdf0e10cSrcweir 			maViewContactOfPageFill(*this),
588cdf0e10cSrcweir 			maViewContactOfMasterPage(*this),
589cdf0e10cSrcweir 			maViewContactOfOuterPageBorder(*this),
590cdf0e10cSrcweir 			maViewContactOfInnerPageBorder(*this),
591cdf0e10cSrcweir 			maViewContactOfGridBack(*this, false),
592cdf0e10cSrcweir 			maViewContactOfHelplinesBack(*this, false),
593cdf0e10cSrcweir 			maViewContactOfPageHierarchy(*this),
594cdf0e10cSrcweir 			maViewContactOfGridFront(*this, true),
595cdf0e10cSrcweir 			maViewContactOfHelplinesFront(*this, true)
596cdf0e10cSrcweir 		{
597cdf0e10cSrcweir 		}
598cdf0e10cSrcweir 
~ViewContactOfSdrPage()599cdf0e10cSrcweir 		ViewContactOfSdrPage::~ViewContactOfSdrPage()
600cdf0e10cSrcweir 		{
601cdf0e10cSrcweir 		}
602cdf0e10cSrcweir 
603cdf0e10cSrcweir 		// Access to possible sub-hierarchy
GetObjectCount() const604cdf0e10cSrcweir 		sal_uInt32 ViewContactOfSdrPage::GetObjectCount() const
605cdf0e10cSrcweir 		{
606cd1c183bSmseidel 			// Fixed count of content. It contains PageBackground (Wiese), PageShadow, PageFill,
607cdf0e10cSrcweir 			// then - depending on if the page has a MasterPage - either MasterPage Hierarchy
608cd1c183bSmseidel 			// or MPBGO. Also OuterPageBorder, InnerPageBorder and two pairs of Grid and Helplines
609cdf0e10cSrcweir 			// (for front and back) which internally are visible or not depending on the current
610cdf0e10cSrcweir 			// front/back setting for those.
611cdf0e10cSrcweir 			return 11;
612cdf0e10cSrcweir 		}
613cdf0e10cSrcweir 
GetViewContact(sal_uInt32 nIndex) const614cdf0e10cSrcweir 		ViewContact& ViewContactOfSdrPage::GetViewContact(sal_uInt32 nIndex) const
615cdf0e10cSrcweir 		{
616cdf0e10cSrcweir 			switch(nIndex)
617cdf0e10cSrcweir 			{
618cdf0e10cSrcweir 				case 0: return (ViewContact&)maViewContactOfPageBackground;
619cdf0e10cSrcweir 				case 1: return (ViewContact&)maViewContactOfPageShadow;
620cdf0e10cSrcweir 				case 2: return (ViewContact&)maViewContactOfPageFill;
621cd1c183bSmseidel 				case 3:
622cdf0e10cSrcweir 				{
623cdf0e10cSrcweir 					const SdrPage& rPage = GetSdrPage();
624cdf0e10cSrcweir 
625cdf0e10cSrcweir 					if(rPage.TRG_HasMasterPage())
626cdf0e10cSrcweir 					{
627cdf0e10cSrcweir 						return rPage.TRG_GetMasterPageDescriptorViewContact();
628cdf0e10cSrcweir 					}
629cdf0e10cSrcweir 					else
630cdf0e10cSrcweir 					{
631cdf0e10cSrcweir 						return (ViewContact&)maViewContactOfMasterPage;
632cdf0e10cSrcweir 					}
633cdf0e10cSrcweir 				}
634cdf0e10cSrcweir 				case 4: return (ViewContact&)maViewContactOfOuterPageBorder;
635cdf0e10cSrcweir 				case 5: return (ViewContact&)maViewContactOfInnerPageBorder;
636cdf0e10cSrcweir 				case 6: return (ViewContact&)maViewContactOfGridBack;
637cdf0e10cSrcweir 				case 7: return (ViewContact&)maViewContactOfHelplinesBack;
638cdf0e10cSrcweir 				case 8: return (ViewContact&)maViewContactOfPageHierarchy;
639cdf0e10cSrcweir 				case 9: return (ViewContact&)maViewContactOfGridFront;
640cdf0e10cSrcweir 				default: return (ViewContact&)maViewContactOfHelplinesFront;
641cdf0e10cSrcweir 			}
642cdf0e10cSrcweir 		}
643cdf0e10cSrcweir 
644cdf0e10cSrcweir 		// React on changes of the object of this ViewContact
ActionChanged()645cdf0e10cSrcweir 		void ViewContactOfSdrPage::ActionChanged()
646cdf0e10cSrcweir 		{
647cdf0e10cSrcweir 			// call parent
648cdf0e10cSrcweir 			ViewContact::ActionChanged();
649cdf0e10cSrcweir 
650cdf0e10cSrcweir 			// apply to local viewContacts, they all rely on page information. Exception
651cdf0e10cSrcweir 			// is the sub hierarchy; this will not be influenced by the change
652cdf0e10cSrcweir 			maViewContactOfPageBackground.ActionChanged();
653cdf0e10cSrcweir 			maViewContactOfPageShadow.ActionChanged();
654cdf0e10cSrcweir 			maViewContactOfPageFill.ActionChanged();
655cd1c183bSmseidel 
656cdf0e10cSrcweir 			const SdrPage& rPage = GetSdrPage();
657cdf0e10cSrcweir 
658cdf0e10cSrcweir 			if(rPage.TRG_HasMasterPage())
659cdf0e10cSrcweir 			{
660cdf0e10cSrcweir 				rPage.TRG_GetMasterPageDescriptorViewContact().ActionChanged();
661cdf0e10cSrcweir 			}
662cdf0e10cSrcweir 			else if(rPage.IsMasterPage())
663cdf0e10cSrcweir 			{
664cdf0e10cSrcweir 				maViewContactOfMasterPage.ActionChanged();
665cdf0e10cSrcweir 			}
666cd1c183bSmseidel 
667cdf0e10cSrcweir 			maViewContactOfOuterPageBorder.ActionChanged();
668cdf0e10cSrcweir 			maViewContactOfInnerPageBorder.ActionChanged();
669cdf0e10cSrcweir 			maViewContactOfGridBack.ActionChanged();
670cdf0e10cSrcweir 			maViewContactOfHelplinesBack.ActionChanged();
671cdf0e10cSrcweir 			maViewContactOfGridFront.ActionChanged();
672cdf0e10cSrcweir 			maViewContactOfHelplinesFront.ActionChanged();
673cdf0e10cSrcweir 		}
674cdf0e10cSrcweir 
675cd1c183bSmseidel 		// overload for accessing the SdrPage
TryToGetSdrPage() const676cdf0e10cSrcweir 		SdrPage* ViewContactOfSdrPage::TryToGetSdrPage() const
677cdf0e10cSrcweir 		{
678cdf0e10cSrcweir 			return &GetSdrPage();
679cdf0e10cSrcweir 		}
680cdf0e10cSrcweir 
createViewIndependentPrimitive2DSequence() const681cdf0e10cSrcweir 		drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPage::createViewIndependentPrimitive2DSequence() const
682cdf0e10cSrcweir 		{
683cdf0e10cSrcweir 			drawinglayer::primitive2d::Primitive2DSequence xRetval;
684cdf0e10cSrcweir 
685cdf0e10cSrcweir 			// collect all sub-sequences including sub hierarchy.
686cdf0e10cSrcweir 			drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageBackground.getViewIndependentPrimitive2DSequence());
687cdf0e10cSrcweir 			drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageShadow.getViewIndependentPrimitive2DSequence());
688cdf0e10cSrcweir 			drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageFill.getViewIndependentPrimitive2DSequence());
689cd1c183bSmseidel 
690cdf0e10cSrcweir 			const SdrPage& rPage = GetSdrPage();
691cdf0e10cSrcweir 
692cdf0e10cSrcweir 			if(rPage.TRG_HasMasterPage())
693cdf0e10cSrcweir 			{
694cd1c183bSmseidel 				drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
695cdf0e10cSrcweir 					rPage.TRG_GetMasterPageDescriptorViewContact().getViewIndependentPrimitive2DSequence());
696cdf0e10cSrcweir 			}
697cdf0e10cSrcweir 			else if(rPage.IsMasterPage())
698cdf0e10cSrcweir 			{
699cd1c183bSmseidel 				drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
700cdf0e10cSrcweir 					maViewContactOfMasterPage.getViewIndependentPrimitive2DSequence());
701cdf0e10cSrcweir 			}
702cd1c183bSmseidel 
703cdf0e10cSrcweir 			drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfOuterPageBorder.getViewIndependentPrimitive2DSequence());
704cdf0e10cSrcweir 			drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfInnerPageBorder.getViewIndependentPrimitive2DSequence());
705cdf0e10cSrcweir 			drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageHierarchy.getViewIndependentPrimitive2DSequence());
706cdf0e10cSrcweir 
707cdf0e10cSrcweir 			// Only add front versions of grid and helplines since no visibility test is done,
708cd1c183bSmseidel 			// so adding the back incarnations is not necessary. This makes the Front
709cd1c183bSmseidel 			// visualization the default when no visibility tests are done.
710cdf0e10cSrcweir 			//
711cdf0e10cSrcweir 			// Since we have no view here, no grid and helpline definitions are available currently. The used
712cdf0e10cSrcweir 			// methods at ViewContactOfHelplines and ViewContactOfGrid return only empty sequences and
713cdf0e10cSrcweir 			// do not need to be called ATM. This may change later if grid or helpline info gets
714cdf0e10cSrcweir 			// model data (it should not). Keeping the lines commented to hold this hint.
715cdf0e10cSrcweir 			//
716cdf0e10cSrcweir 			// drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfGridFront.getViewIndependentPrimitive2DSequence());
717cdf0e10cSrcweir 			// drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfHelplinesFront.getViewIndependentPrimitive2DSequence());
718cdf0e10cSrcweir 
719cdf0e10cSrcweir 			return xRetval;
720cdf0e10cSrcweir 		}
721cdf0e10cSrcweir 	} // end of namespace contact
722cdf0e10cSrcweir } // end of namespace sdr
723cdf0e10cSrcweir 
724cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
725cdf0e10cSrcweir // eof
726