1f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
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
10f6e50924SAndrew Rist  *
11f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12f6e50924SAndrew Rist  *
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.
19f6e50924SAndrew Rist  *
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
97cdf0e10cSrcweir 			// svtools::DOCCOLOR color for initialisation
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(
102cdf0e10cSrcweir                 new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor));
103cdf0e10cSrcweir 
104cdf0e10cSrcweir             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 		{
134cdf0e10cSrcweir             static bool bUseOldPageShadow(false);
135cdf0e10cSrcweir 		    const SdrPage& rPage = getPage();
136cdf0e10cSrcweir 		    basegfx::B2DHomMatrix aPageMatrix;
137cdf0e10cSrcweir 		    aPageMatrix.set(0, 0, (double)rPage.GetWdt());
138cdf0e10cSrcweir 		    aPageMatrix.set(1, 1, (double)rPage.GetHgt());
139cdf0e10cSrcweir 
140cdf0e10cSrcweir             if(bUseOldPageShadow)
141cdf0e10cSrcweir             {
142cdf0e10cSrcweir 			    // create page shadow polygon
143cdf0e10cSrcweir 			    const double fPageBorderFactor(1.0 / 256.0);
144cdf0e10cSrcweir 			    basegfx::B2DPolygon aPageShadowPolygon;
145cdf0e10cSrcweir 			    aPageShadowPolygon.append(basegfx::B2DPoint(1.0, fPageBorderFactor));
146cdf0e10cSrcweir 			    aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, fPageBorderFactor));
147cdf0e10cSrcweir 			    aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, 1.0 + fPageBorderFactor));
148cdf0e10cSrcweir 			    aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0 + fPageBorderFactor));
149cdf0e10cSrcweir 			    aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0));
150cdf0e10cSrcweir 			    aPageShadowPolygon.append(basegfx::B2DPoint(1.0, 1.0));
151cdf0e10cSrcweir 			    aPageShadowPolygon.setClosed(true);
152cdf0e10cSrcweir 			    aPageShadowPolygon.transform(aPageMatrix);
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 			    // We have only the page information, not the view information. Use the
155cdf0e10cSrcweir 			    // svtools::FONTCOLOR color for initialisation
156cdf0e10cSrcweir 			    const svtools::ColorConfig aColorConfig;
157cdf0e10cSrcweir 			    const Color aShadowColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
158cdf0e10cSrcweir 			    const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor());
159cdf0e10cSrcweir 			    const drawinglayer::primitive2d::Primitive2DReference xReference(
160cdf0e10cSrcweir                     new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
161cdf0e10cSrcweir                         basegfx::B2DPolyPolygon(aPageShadowPolygon),
162cdf0e10cSrcweir                         aRGBShadowColor));
163cdf0e10cSrcweir 
164cdf0e10cSrcweir                 return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
165cdf0e10cSrcweir             }
166cdf0e10cSrcweir             else
167cdf0e10cSrcweir             {
168*6de8cae6SArmin Le Grand                 static vcl::DeleteOnDeinit< drawinglayer::primitive2d::DiscreteShadow > aDiscreteShadow(
169*6de8cae6SArmin Le Grand                     new drawinglayer::primitive2d::DiscreteShadow(
170*6de8cae6SArmin Le Grand                         BitmapEx(
171*6de8cae6SArmin Le Grand                             ResId(
172*6de8cae6SArmin Le Grand                                 SIP_SA_PAGESHADOW35X35,
173*6de8cae6SArmin Le Grand                                 *ImpGetResMgr()))));
174*6de8cae6SArmin Le Grand 
175*6de8cae6SArmin Le Grand                 if(aDiscreteShadow.get())
176cdf0e10cSrcweir                 {
177cdf0e10cSrcweir                     const drawinglayer::primitive2d::Primitive2DReference xReference(
178cdf0e10cSrcweir                         new drawinglayer::primitive2d::DiscreteShadowPrimitive2D(
179cdf0e10cSrcweir                             aPageMatrix,
180*6de8cae6SArmin Le Grand                             *aDiscreteShadow.get()));
181*6de8cae6SArmin Le Grand 
182cdf0e10cSrcweir                     return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
183cdf0e10cSrcweir                 }
184*6de8cae6SArmin Le Grand 
185cdf0e10cSrcweir                 return drawinglayer::primitive2d::Primitive2DSequence();
186cdf0e10cSrcweir             }
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
219cdf0e10cSrcweir 			// create a visualisation for the MPBGO, if exists. This needs to be suppressed
220cdf0e10cSrcweir 			// when a SdrPage which uses a MasterPage creates it's 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 			{
226cdf0e10cSrcweir                 if(0 == rPage.GetPageNum())
227cdf0e10cSrcweir                 {
228cdf0e10cSrcweir                     // #i98063#
229cdf0e10cSrcweir                     // filter MasterPage 0 since it's the HandoutPage. Thus, it's a
230cdf0e10cSrcweir                     // MasterPage, but has no MPBGO, so there is nothing to do here.
231cdf0e10cSrcweir                 }
232cdf0e10cSrcweir                 else
233cdf0e10cSrcweir                 {
234cdf0e10cSrcweir                     drawinglayer::attribute::SdrFillAttribute aFill;
235cdf0e10cSrcweir 
236cdf0e10cSrcweir                     // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets,
237cdf0e10cSrcweir                     // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all
238cdf0e10cSrcweir                     // MasterPages should have a StyleSheet excactly for this reason, but historically
239cdf0e10cSrcweir                     // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others).
240cdf0e10cSrcweir                     if(rPage.getSdrPageProperties().GetStyleSheet())
241cdf0e10cSrcweir                     {
242cdf0e10cSrcweir                         // create page fill attributes with correct properties
243cdf0e10cSrcweir 				        aFill = drawinglayer::primitive2d::createNewSdrFillAttribute(
244cdf0e10cSrcweir                             rPage.getSdrPageProperties().GetItemSet());
245cdf0e10cSrcweir                     }
246cdf0e10cSrcweir 
247cdf0e10cSrcweir 				    if(!aFill.isDefault())
248cdf0e10cSrcweir 				    {
249cdf0e10cSrcweir 					    // direct model data is the page size, get and use it
250cdf0e10cSrcweir 					    const basegfx::B2DRange aInnerRange(
251cdf0e10cSrcweir 						    rPage.GetLftBorder(), rPage.GetUppBorder(),
252cdf0e10cSrcweir 						    rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder());
253cdf0e10cSrcweir 					    const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange));
254cdf0e10cSrcweir 					    const basegfx::B2DHomMatrix aEmptyTransform;
255cdf0e10cSrcweir 					    const drawinglayer::primitive2d::Primitive2DReference xReference(
256cdf0e10cSrcweir 							drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
257cdf0e10cSrcweir 								basegfx::B2DPolyPolygon(aInnerPolgon),
258cdf0e10cSrcweir 								aEmptyTransform,
259cdf0e10cSrcweir 								aFill,
260cdf0e10cSrcweir 								drawinglayer::attribute::FillGradientAttribute()));
261cdf0e10cSrcweir 
262cdf0e10cSrcweir 					    xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
263cdf0e10cSrcweir 				    }
264cdf0e10cSrcweir                 }
265cdf0e10cSrcweir 			}
266cdf0e10cSrcweir 
267cdf0e10cSrcweir 			return xRetval;
268cdf0e10cSrcweir 		}
269cdf0e10cSrcweir 
ViewContactOfMasterPage(ViewContactOfSdrPage & rParentViewContactOfSdrPage)270cdf0e10cSrcweir 		ViewContactOfMasterPage::ViewContactOfMasterPage(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
271cdf0e10cSrcweir 		:	ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
272cdf0e10cSrcweir 		{
273cdf0e10cSrcweir 		}
274cdf0e10cSrcweir 
~ViewContactOfMasterPage()275cdf0e10cSrcweir 		ViewContactOfMasterPage::~ViewContactOfMasterPage()
276cdf0e10cSrcweir 		{
277cdf0e10cSrcweir 		}
278cdf0e10cSrcweir 	} // end of namespace contact
279cdf0e10cSrcweir } // end of namespace sdr
280cdf0e10cSrcweir 
281cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
282cdf0e10cSrcweir 
283cdf0e10cSrcweir namespace sdr
284cdf0e10cSrcweir {
285cdf0e10cSrcweir 	namespace contact
286cdf0e10cSrcweir 	{
CreateObjectSpecificViewObjectContact(ObjectContact & rObjectContact)287cdf0e10cSrcweir 		ViewObjectContact& ViewContactOfPageFill::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
288cdf0e10cSrcweir 		{
289cdf0e10cSrcweir 			ViewObjectContact* pRetval = new ViewObjectContactOfPageFill(rObjectContact, *this);
290cdf0e10cSrcweir 			DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
291cdf0e10cSrcweir 
292cdf0e10cSrcweir 			return *pRetval;
293cdf0e10cSrcweir 		}
294cdf0e10cSrcweir 
createViewIndependentPrimitive2DSequence() const295cdf0e10cSrcweir 		drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageFill::createViewIndependentPrimitive2DSequence() const
296cdf0e10cSrcweir 		{
297cdf0e10cSrcweir 			const SdrPage& rPage = getPage();
298cdf0e10cSrcweir 			const basegfx::B2DRange aPageFillRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt());
299cdf0e10cSrcweir 			const basegfx::B2DPolygon aPageFillPolygon(basegfx::tools::createPolygonFromRect(aPageFillRange));
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 			// We have only the page information, not the view information. Use the
302cdf0e10cSrcweir 			// svtools::DOCCOLOR color for initialisation
303cdf0e10cSrcweir 			const svtools::ColorConfig aColorConfig;
304cdf0e10cSrcweir 			const Color aPageFillColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
305cdf0e10cSrcweir 
306cdf0e10cSrcweir 			// create and add primitive
307cdf0e10cSrcweir 			const basegfx::BColor aRGBColor(aPageFillColor.getBColor());
308cdf0e10cSrcweir 			const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPageFillPolygon), aRGBColor));
309cdf0e10cSrcweir 
310cdf0e10cSrcweir             return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
311cdf0e10cSrcweir 		}
312cdf0e10cSrcweir 
ViewContactOfPageFill(ViewContactOfSdrPage & rParentViewContactOfSdrPage)313cdf0e10cSrcweir 		ViewContactOfPageFill::ViewContactOfPageFill(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
314cdf0e10cSrcweir 		:	ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
315cdf0e10cSrcweir 		{
316cdf0e10cSrcweir 		}
317cdf0e10cSrcweir 
~ViewContactOfPageFill()318cdf0e10cSrcweir 		ViewContactOfPageFill::~ViewContactOfPageFill()
319cdf0e10cSrcweir 		{
320cdf0e10cSrcweir 		}
321cdf0e10cSrcweir 	} // end of namespace contact
322cdf0e10cSrcweir } // end of namespace sdr
323cdf0e10cSrcweir 
324cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
325cdf0e10cSrcweir 
326cdf0e10cSrcweir namespace sdr
327cdf0e10cSrcweir {
328cdf0e10cSrcweir 	namespace contact
329cdf0e10cSrcweir 	{
CreateObjectSpecificViewObjectContact(ObjectContact & rObjectContact)330cdf0e10cSrcweir 		ViewObjectContact& ViewContactOfOuterPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
331cdf0e10cSrcweir 		{
332cdf0e10cSrcweir 			ViewObjectContact* pRetval = new ViewObjectContactOfOuterPageBorder(rObjectContact, *this);
333cdf0e10cSrcweir 			DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
334cdf0e10cSrcweir 
335cdf0e10cSrcweir 			return *pRetval;
336cdf0e10cSrcweir 		}
337cdf0e10cSrcweir 
createViewIndependentPrimitive2DSequence() const338cdf0e10cSrcweir 		drawinglayer::primitive2d::Primitive2DSequence ViewContactOfOuterPageBorder::createViewIndependentPrimitive2DSequence() const
339cdf0e10cSrcweir 		{
340cdf0e10cSrcweir             drawinglayer::primitive2d::Primitive2DSequence xRetval;
341cdf0e10cSrcweir 			const SdrPage& rPage = getPage();
342cdf0e10cSrcweir 			const basegfx::B2DRange aPageBorderRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt());
343cdf0e10cSrcweir 
344cdf0e10cSrcweir             // Changed to 0x949599 for renaissance, before svtools::FONTCOLOR was used.
345cdf0e10cSrcweir             // Added old case as fallback for HighContrast.
346cdf0e10cSrcweir 			basegfx::BColor aRGBBorderColor(0x94 / (double)0xff, 0x95 / (double)0xff, 0x99 / (double)0xff);
347cdf0e10cSrcweir 
348cdf0e10cSrcweir 			if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
349cdf0e10cSrcweir 			{
350cdf0e10cSrcweir     			const svtools::ColorConfig aColorConfig;
351cdf0e10cSrcweir 				const Color aBorderColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
352cdf0e10cSrcweir 
353cdf0e10cSrcweir                 aRGBBorderColor = aBorderColor.getBColor();
354cdf0e10cSrcweir 			}
355cdf0e10cSrcweir 
356cdf0e10cSrcweir             if(rPage.getPageBorderOnlyLeftRight())
357cdf0e10cSrcweir             {
358cdf0e10cSrcweir                 // #i93597# for Report Designer, the page border shall be only displayed right and left,
359cdf0e10cSrcweir                 // but not top and bottom. Create simplified geometry.
360cdf0e10cSrcweir                 basegfx::B2DPolygon aLeft, aRight;
361cdf0e10cSrcweir 
362cdf0e10cSrcweir                 aLeft.append(basegfx::B2DPoint(aPageBorderRange.getMinX(), aPageBorderRange.getMinY()));
363cdf0e10cSrcweir                 aLeft.append(basegfx::B2DPoint(aPageBorderRange.getMinX(), aPageBorderRange.getMaxY()));
364cdf0e10cSrcweir 
365cdf0e10cSrcweir                 aRight.append(basegfx::B2DPoint(aPageBorderRange.getMaxX(), aPageBorderRange.getMinY()));
366cdf0e10cSrcweir                 aRight.append(basegfx::B2DPoint(aPageBorderRange.getMaxX(), aPageBorderRange.getMaxY()));
367cdf0e10cSrcweir 
368cdf0e10cSrcweir                 xRetval.realloc(2);
369cdf0e10cSrcweir                 xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aLeft, aRGBBorderColor));
370cdf0e10cSrcweir                 xRetval[1] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aRight, aRGBBorderColor));
371cdf0e10cSrcweir             }
372cdf0e10cSrcweir             else
373cdf0e10cSrcweir             {
374cdf0e10cSrcweir                 xRetval.realloc(1);
375cdf0e10cSrcweir                 const basegfx::B2DPolygon aPageBorderPolygon(basegfx::tools::createPolygonFromRect(aPageBorderRange));
376cdf0e10cSrcweir                 xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor));
377cdf0e10cSrcweir             }
378cdf0e10cSrcweir 
379cdf0e10cSrcweir             return xRetval;
380cdf0e10cSrcweir 		}
381cdf0e10cSrcweir 
ViewContactOfOuterPageBorder(ViewContactOfSdrPage & rParentViewContactOfSdrPage)382cdf0e10cSrcweir 		ViewContactOfOuterPageBorder::ViewContactOfOuterPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
383cdf0e10cSrcweir 		:	ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
384cdf0e10cSrcweir 		{
385cdf0e10cSrcweir 		}
386cdf0e10cSrcweir 
~ViewContactOfOuterPageBorder()387cdf0e10cSrcweir 		ViewContactOfOuterPageBorder::~ViewContactOfOuterPageBorder()
388cdf0e10cSrcweir 		{
389cdf0e10cSrcweir 		}
390cdf0e10cSrcweir 	} // end of namespace contact
391cdf0e10cSrcweir } // end of namespace sdr
392cdf0e10cSrcweir 
393cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
394cdf0e10cSrcweir 
395cdf0e10cSrcweir namespace sdr
396cdf0e10cSrcweir {
397cdf0e10cSrcweir 	namespace contact
398cdf0e10cSrcweir 	{
CreateObjectSpecificViewObjectContact(ObjectContact & rObjectContact)399cdf0e10cSrcweir 		ViewObjectContact& ViewContactOfInnerPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
400cdf0e10cSrcweir 		{
401cdf0e10cSrcweir 			ViewObjectContact* pRetval = new ViewObjectContactOfInnerPageBorder(rObjectContact, *this);
402cdf0e10cSrcweir 			DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
403cdf0e10cSrcweir 
404cdf0e10cSrcweir 			return *pRetval;
405cdf0e10cSrcweir 		}
406cdf0e10cSrcweir 
createViewIndependentPrimitive2DSequence() const407cdf0e10cSrcweir 		drawinglayer::primitive2d::Primitive2DSequence ViewContactOfInnerPageBorder::createViewIndependentPrimitive2DSequence() const
408cdf0e10cSrcweir 		{
409cdf0e10cSrcweir 			const SdrPage& rPage = getPage();
410cdf0e10cSrcweir 			const basegfx::B2DRange aPageBorderRange(
411cdf0e10cSrcweir 				(double)rPage.GetLftBorder(), (double)rPage.GetUppBorder(),
412cdf0e10cSrcweir 				(double)(rPage.GetWdt() - rPage.GetRgtBorder()), (double)(rPage.GetHgt() - rPage.GetLwrBorder()));
413cdf0e10cSrcweir 			const basegfx::B2DPolygon aPageBorderPolygon(basegfx::tools::createPolygonFromRect(aPageBorderRange));
414cdf0e10cSrcweir 
415cdf0e10cSrcweir 			// We have only the page information, not the view information. Use the
416cdf0e10cSrcweir 			// svtools::FONTCOLOR or svtools::DOCBOUNDARIES color for initialisation
417cdf0e10cSrcweir 			const svtools::ColorConfig aColorConfig;
418cdf0e10cSrcweir 			Color aBorderColor;
419cdf0e10cSrcweir 
420cdf0e10cSrcweir 			if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
421cdf0e10cSrcweir 			{
422cdf0e10cSrcweir 				aBorderColor = aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor;
423cdf0e10cSrcweir 			}
424cdf0e10cSrcweir 			else
425cdf0e10cSrcweir 			{
426cdf0e10cSrcweir 				aBorderColor = aColorConfig.GetColorValue(svtools::DOCBOUNDARIES).nColor;
427cdf0e10cSrcweir 			}
428cdf0e10cSrcweir 
429cdf0e10cSrcweir 			// create page outer border primitive
430cdf0e10cSrcweir 			const basegfx::BColor aRGBBorderColor(aBorderColor.getBColor());
431cdf0e10cSrcweir 			const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor));
432cdf0e10cSrcweir 
433cdf0e10cSrcweir             return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
434cdf0e10cSrcweir 		}
435cdf0e10cSrcweir 
ViewContactOfInnerPageBorder(ViewContactOfSdrPage & rParentViewContactOfSdrPage)436cdf0e10cSrcweir 		ViewContactOfInnerPageBorder::ViewContactOfInnerPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
437cdf0e10cSrcweir 		:	ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
438cdf0e10cSrcweir 		{
439cdf0e10cSrcweir 		}
440cdf0e10cSrcweir 
~ViewContactOfInnerPageBorder()441cdf0e10cSrcweir 		ViewContactOfInnerPageBorder::~ViewContactOfInnerPageBorder()
442cdf0e10cSrcweir 		{
443cdf0e10cSrcweir 		}
444cdf0e10cSrcweir 	} // end of namespace contact
445cdf0e10cSrcweir } // end of namespace sdr
446cdf0e10cSrcweir 
447cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
448cdf0e10cSrcweir 
449cdf0e10cSrcweir namespace sdr
450cdf0e10cSrcweir {
451cdf0e10cSrcweir 	namespace contact
452cdf0e10cSrcweir 	{
CreateObjectSpecificViewObjectContact(ObjectContact & rObjectContact)453cdf0e10cSrcweir 		ViewObjectContact& ViewContactOfPageHierarchy::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
454cdf0e10cSrcweir 		{
455cdf0e10cSrcweir 			ViewObjectContact* pRetval = new ViewObjectContactOfPageHierarchy(rObjectContact, *this);
456cdf0e10cSrcweir 			DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
457cdf0e10cSrcweir 
458cdf0e10cSrcweir 			return *pRetval;
459cdf0e10cSrcweir 		}
460cdf0e10cSrcweir 
createViewIndependentPrimitive2DSequence() const461cdf0e10cSrcweir 		drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageHierarchy::createViewIndependentPrimitive2DSequence() const
462cdf0e10cSrcweir 		{
463cdf0e10cSrcweir 			// collect sub-hierarchy
464cdf0e10cSrcweir 			drawinglayer::primitive2d::Primitive2DSequence xRetval;
465cdf0e10cSrcweir 			const sal_uInt32 nObjectCount(GetObjectCount());
466cdf0e10cSrcweir 
467cdf0e10cSrcweir 			// collect all sub-primitives
468cdf0e10cSrcweir 			for(sal_uInt32 a(0); a < nObjectCount; a++)
469cdf0e10cSrcweir 			{
470cdf0e10cSrcweir 				const ViewContact& rCandidate(GetViewContact(a));
471cdf0e10cSrcweir 				const drawinglayer::primitive2d::Primitive2DSequence aCandSeq(rCandidate.getViewIndependentPrimitive2DSequence());
472cdf0e10cSrcweir 
473cdf0e10cSrcweir 				drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq);
474cdf0e10cSrcweir 			}
475cdf0e10cSrcweir 
476cdf0e10cSrcweir 			return xRetval;
477cdf0e10cSrcweir 		}
478cdf0e10cSrcweir 
ViewContactOfPageHierarchy(ViewContactOfSdrPage & rParentViewContactOfSdrPage)479cdf0e10cSrcweir 		ViewContactOfPageHierarchy::ViewContactOfPageHierarchy(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
480cdf0e10cSrcweir 		:	ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
481cdf0e10cSrcweir 		{
482cdf0e10cSrcweir 		}
483cdf0e10cSrcweir 
~ViewContactOfPageHierarchy()484cdf0e10cSrcweir 		ViewContactOfPageHierarchy::~ViewContactOfPageHierarchy()
485cdf0e10cSrcweir 		{
486cdf0e10cSrcweir 		}
487cdf0e10cSrcweir 
GetObjectCount() const488cdf0e10cSrcweir 		sal_uInt32 ViewContactOfPageHierarchy::GetObjectCount() const
489cdf0e10cSrcweir 		{
490cdf0e10cSrcweir 			return getPage().GetObjCount();
491cdf0e10cSrcweir 		}
492cdf0e10cSrcweir 
GetViewContact(sal_uInt32 nIndex) const493cdf0e10cSrcweir 		ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const
494cdf0e10cSrcweir 		{
495cdf0e10cSrcweir 			SdrObject* pObj = getPage().GetObj(nIndex);
496cdf0e10cSrcweir 			DBG_ASSERT(pObj, "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)");
497cdf0e10cSrcweir 			return pObj->GetViewContact();
498cdf0e10cSrcweir 		}
499cdf0e10cSrcweir 	} // end of namespace contact
500cdf0e10cSrcweir } // end of namespace sdr
501cdf0e10cSrcweir 
502cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
503cdf0e10cSrcweir 
504cdf0e10cSrcweir namespace sdr
505cdf0e10cSrcweir {
506cdf0e10cSrcweir 	namespace contact
507cdf0e10cSrcweir 	{
CreateObjectSpecificViewObjectContact(ObjectContact & rObjectContact)508cdf0e10cSrcweir 		ViewObjectContact& ViewContactOfGrid::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
509cdf0e10cSrcweir 		{
510cdf0e10cSrcweir 			ViewObjectContact* pRetval = new ViewObjectContactOfPageGrid(rObjectContact, *this);
511cdf0e10cSrcweir 			DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
512cdf0e10cSrcweir 
513cdf0e10cSrcweir 			return *pRetval;
514cdf0e10cSrcweir 		}
515cdf0e10cSrcweir 
createViewIndependentPrimitive2DSequence() const516cdf0e10cSrcweir 		drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGrid::createViewIndependentPrimitive2DSequence() const
517cdf0e10cSrcweir 		{
518cdf0e10cSrcweir 			// We have only the page information, not the view information and thus no grid settings. Create empty
519cdf0e10cSrcweir 			// default. For the view-dependent implementation, see ViewObjectContactOfPageGrid::createPrimitive2DSequence
520cdf0e10cSrcweir             return drawinglayer::primitive2d::Primitive2DSequence();
521cdf0e10cSrcweir 		}
522cdf0e10cSrcweir 
ViewContactOfGrid(ViewContactOfSdrPage & rParentViewContactOfSdrPage,bool bFront)523cdf0e10cSrcweir 		ViewContactOfGrid::ViewContactOfGrid(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront)
524cdf0e10cSrcweir 		:	ViewContactOfPageSubObject(rParentViewContactOfSdrPage),
525cdf0e10cSrcweir 			mbFront(bFront)
526cdf0e10cSrcweir 		{
527cdf0e10cSrcweir 		}
528cdf0e10cSrcweir 
~ViewContactOfGrid()529cdf0e10cSrcweir 		ViewContactOfGrid::~ViewContactOfGrid()
530cdf0e10cSrcweir 		{
531cdf0e10cSrcweir 		}
532cdf0e10cSrcweir 	} // end of namespace contact
533cdf0e10cSrcweir } // end of namespace sdr
534cdf0e10cSrcweir 
535cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
536cdf0e10cSrcweir 
537cdf0e10cSrcweir namespace sdr
538cdf0e10cSrcweir {
539cdf0e10cSrcweir 	namespace contact
540cdf0e10cSrcweir 	{
CreateObjectSpecificViewObjectContact(ObjectContact & rObjectContact)541cdf0e10cSrcweir 		ViewObjectContact& ViewContactOfHelplines::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
542cdf0e10cSrcweir 		{
543cdf0e10cSrcweir 			ViewObjectContact* pRetval = new ViewObjectContactOfPageHelplines(rObjectContact, *this);
544cdf0e10cSrcweir 			DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
545cdf0e10cSrcweir 
546cdf0e10cSrcweir 			return *pRetval;
547cdf0e10cSrcweir 		}
548cdf0e10cSrcweir 
createViewIndependentPrimitive2DSequence() const549cdf0e10cSrcweir 		drawinglayer::primitive2d::Primitive2DSequence ViewContactOfHelplines::createViewIndependentPrimitive2DSequence() const
550cdf0e10cSrcweir 		{
551cdf0e10cSrcweir 			// We have only the page information, not the view information and thus no helplines. Create empty
552cdf0e10cSrcweir 			// default. For the view-dependent implementation, see ViewObjectContactOfPageHelplines::createPrimitive2DSequence
553cdf0e10cSrcweir             return drawinglayer::primitive2d::Primitive2DSequence();
554cdf0e10cSrcweir 		}
555cdf0e10cSrcweir 
ViewContactOfHelplines(ViewContactOfSdrPage & rParentViewContactOfSdrPage,bool bFront)556cdf0e10cSrcweir 		ViewContactOfHelplines::ViewContactOfHelplines(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront)
557cdf0e10cSrcweir 		:	ViewContactOfPageSubObject(rParentViewContactOfSdrPage),
558cdf0e10cSrcweir 			mbFront(bFront)
559cdf0e10cSrcweir 		{
560cdf0e10cSrcweir 		}
561cdf0e10cSrcweir 
~ViewContactOfHelplines()562cdf0e10cSrcweir 		ViewContactOfHelplines::~ViewContactOfHelplines()
563cdf0e10cSrcweir 		{
564cdf0e10cSrcweir 		}
565cdf0e10cSrcweir 	} // end of namespace contact
566cdf0e10cSrcweir } // end of namespace sdr
567cdf0e10cSrcweir 
568cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
569cdf0e10cSrcweir 
570cdf0e10cSrcweir namespace sdr
571cdf0e10cSrcweir {
572cdf0e10cSrcweir 	namespace contact
573cdf0e10cSrcweir 	{
574cdf0e10cSrcweir 		// Create a Object-Specific ViewObjectContact, set ViewContact and
575cdf0e10cSrcweir 		// ObjectContact. Always needs to return something.
CreateObjectSpecificViewObjectContact(ObjectContact & rObjectContact)576cdf0e10cSrcweir 		ViewObjectContact& ViewContactOfSdrPage::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
577cdf0e10cSrcweir 		{
578cdf0e10cSrcweir 			ViewObjectContact* pRetval = new ViewObjectContactOfSdrPage(rObjectContact, *this);
579cdf0e10cSrcweir 			DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
580cdf0e10cSrcweir 
581cdf0e10cSrcweir 			return *pRetval;
582cdf0e10cSrcweir 		}
583cdf0e10cSrcweir 
ViewContactOfSdrPage(SdrPage & rPage)584cdf0e10cSrcweir 		ViewContactOfSdrPage::ViewContactOfSdrPage(SdrPage& rPage)
585cdf0e10cSrcweir 		:	ViewContact(),
586cdf0e10cSrcweir 			mrPage(rPage),
587cdf0e10cSrcweir 			maViewContactOfPageBackground(*this),
588cdf0e10cSrcweir 			maViewContactOfPageShadow(*this),
589cdf0e10cSrcweir 			maViewContactOfPageFill(*this),
590cdf0e10cSrcweir 			maViewContactOfMasterPage(*this),
591cdf0e10cSrcweir 			maViewContactOfOuterPageBorder(*this),
592cdf0e10cSrcweir 			maViewContactOfInnerPageBorder(*this),
593cdf0e10cSrcweir 			maViewContactOfGridBack(*this, false),
594cdf0e10cSrcweir 			maViewContactOfHelplinesBack(*this, false),
595cdf0e10cSrcweir 			maViewContactOfPageHierarchy(*this),
596cdf0e10cSrcweir 			maViewContactOfGridFront(*this, true),
597cdf0e10cSrcweir 			maViewContactOfHelplinesFront(*this, true)
598cdf0e10cSrcweir 		{
599cdf0e10cSrcweir 		}
600cdf0e10cSrcweir 
~ViewContactOfSdrPage()601cdf0e10cSrcweir 		ViewContactOfSdrPage::~ViewContactOfSdrPage()
602cdf0e10cSrcweir 		{
603cdf0e10cSrcweir 		}
604cdf0e10cSrcweir 
605cdf0e10cSrcweir 		// Access to possible sub-hierarchy
GetObjectCount() const606cdf0e10cSrcweir 		sal_uInt32 ViewContactOfSdrPage::GetObjectCount() const
607cdf0e10cSrcweir 		{
608cdf0e10cSrcweir 			// Fixed count of content. It contains PageBackground (Wiese), PageShadow, PageFill,
609cdf0e10cSrcweir 			// then - depending on if the page has a MasterPage - either MasterPage Hierarchy
610cdf0e10cSrcweir 			// or MPBGO. Also OuterPageBorder, InnerPageBorder and two pairs of Grid and Helplines
611cdf0e10cSrcweir 			// (for front and back) which internally are visible or not depending on the current
612cdf0e10cSrcweir 			// front/back setting for those.
613cdf0e10cSrcweir 			return 11;
614cdf0e10cSrcweir 		}
615cdf0e10cSrcweir 
GetViewContact(sal_uInt32 nIndex) const616cdf0e10cSrcweir 		ViewContact& ViewContactOfSdrPage::GetViewContact(sal_uInt32 nIndex) const
617cdf0e10cSrcweir 		{
618cdf0e10cSrcweir 			switch(nIndex)
619cdf0e10cSrcweir 			{
620cdf0e10cSrcweir 				case 0: return (ViewContact&)maViewContactOfPageBackground;
621cdf0e10cSrcweir 				case 1: return (ViewContact&)maViewContactOfPageShadow;
622cdf0e10cSrcweir 				case 2: return (ViewContact&)maViewContactOfPageFill;
623cdf0e10cSrcweir 				case 3:
624cdf0e10cSrcweir 				{
625cdf0e10cSrcweir 					const SdrPage& rPage = GetSdrPage();
626cdf0e10cSrcweir 
627cdf0e10cSrcweir 					if(rPage.TRG_HasMasterPage())
628cdf0e10cSrcweir 					{
629cdf0e10cSrcweir 						return rPage.TRG_GetMasterPageDescriptorViewContact();
630cdf0e10cSrcweir 					}
631cdf0e10cSrcweir 					else
632cdf0e10cSrcweir 					{
633cdf0e10cSrcweir 						return (ViewContact&)maViewContactOfMasterPage;
634cdf0e10cSrcweir 					}
635cdf0e10cSrcweir 				}
636cdf0e10cSrcweir 				case 4: return (ViewContact&)maViewContactOfOuterPageBorder;
637cdf0e10cSrcweir 				case 5: return (ViewContact&)maViewContactOfInnerPageBorder;
638cdf0e10cSrcweir 				case 6: return (ViewContact&)maViewContactOfGridBack;
639cdf0e10cSrcweir 				case 7: return (ViewContact&)maViewContactOfHelplinesBack;
640cdf0e10cSrcweir 				case 8: return (ViewContact&)maViewContactOfPageHierarchy;
641cdf0e10cSrcweir 				case 9: return (ViewContact&)maViewContactOfGridFront;
642cdf0e10cSrcweir 				default: return (ViewContact&)maViewContactOfHelplinesFront;
643cdf0e10cSrcweir 			}
644cdf0e10cSrcweir 		}
645cdf0e10cSrcweir 
646cdf0e10cSrcweir 		// React on changes of the object of this ViewContact
ActionChanged()647cdf0e10cSrcweir 		void ViewContactOfSdrPage::ActionChanged()
648cdf0e10cSrcweir 		{
649cdf0e10cSrcweir 			// call parent
650cdf0e10cSrcweir 			ViewContact::ActionChanged();
651cdf0e10cSrcweir 
652cdf0e10cSrcweir 			// apply to local viewContacts, they all rely on page information. Exception
653cdf0e10cSrcweir 			// is the sub hierarchy; this will not be influenced by the change
654cdf0e10cSrcweir 			maViewContactOfPageBackground.ActionChanged();
655cdf0e10cSrcweir 			maViewContactOfPageShadow.ActionChanged();
656cdf0e10cSrcweir 			maViewContactOfPageFill.ActionChanged();
657cdf0e10cSrcweir 
658cdf0e10cSrcweir 			const SdrPage& rPage = GetSdrPage();
659cdf0e10cSrcweir 
660cdf0e10cSrcweir 			if(rPage.TRG_HasMasterPage())
661cdf0e10cSrcweir 			{
662cdf0e10cSrcweir 				rPage.TRG_GetMasterPageDescriptorViewContact().ActionChanged();
663cdf0e10cSrcweir 			}
664cdf0e10cSrcweir 			else if(rPage.IsMasterPage())
665cdf0e10cSrcweir 			{
666cdf0e10cSrcweir 				maViewContactOfMasterPage.ActionChanged();
667cdf0e10cSrcweir 			}
668cdf0e10cSrcweir 
669cdf0e10cSrcweir 			maViewContactOfOuterPageBorder.ActionChanged();
670cdf0e10cSrcweir 			maViewContactOfInnerPageBorder.ActionChanged();
671cdf0e10cSrcweir 			maViewContactOfGridBack.ActionChanged();
672cdf0e10cSrcweir 			maViewContactOfHelplinesBack.ActionChanged();
673cdf0e10cSrcweir 			maViewContactOfGridFront.ActionChanged();
674cdf0e10cSrcweir 			maViewContactOfHelplinesFront.ActionChanged();
675cdf0e10cSrcweir 		}
676cdf0e10cSrcweir 
677cdf0e10cSrcweir 		// overload for acessing the SdrPage
TryToGetSdrPage() const678cdf0e10cSrcweir 		SdrPage* ViewContactOfSdrPage::TryToGetSdrPage() const
679cdf0e10cSrcweir 		{
680cdf0e10cSrcweir 			return &GetSdrPage();
681cdf0e10cSrcweir 		}
682cdf0e10cSrcweir 
createViewIndependentPrimitive2DSequence() const683cdf0e10cSrcweir 		drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPage::createViewIndependentPrimitive2DSequence() const
684cdf0e10cSrcweir 		{
685cdf0e10cSrcweir 			drawinglayer::primitive2d::Primitive2DSequence xRetval;
686cdf0e10cSrcweir 
687cdf0e10cSrcweir 			// collect all sub-sequences including sub hierarchy.
688cdf0e10cSrcweir 			drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageBackground.getViewIndependentPrimitive2DSequence());
689cdf0e10cSrcweir 			drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageShadow.getViewIndependentPrimitive2DSequence());
690cdf0e10cSrcweir 			drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageFill.getViewIndependentPrimitive2DSequence());
691cdf0e10cSrcweir 
692cdf0e10cSrcweir 			const SdrPage& rPage = GetSdrPage();
693cdf0e10cSrcweir 
694cdf0e10cSrcweir 			if(rPage.TRG_HasMasterPage())
695cdf0e10cSrcweir 			{
696cdf0e10cSrcweir 				drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
697cdf0e10cSrcweir 					rPage.TRG_GetMasterPageDescriptorViewContact().getViewIndependentPrimitive2DSequence());
698cdf0e10cSrcweir 			}
699cdf0e10cSrcweir 			else if(rPage.IsMasterPage())
700cdf0e10cSrcweir 			{
701cdf0e10cSrcweir 				drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
702cdf0e10cSrcweir 					maViewContactOfMasterPage.getViewIndependentPrimitive2DSequence());
703cdf0e10cSrcweir 			}
704cdf0e10cSrcweir 
705cdf0e10cSrcweir 			drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfOuterPageBorder.getViewIndependentPrimitive2DSequence());
706cdf0e10cSrcweir 			drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfInnerPageBorder.getViewIndependentPrimitive2DSequence());
707cdf0e10cSrcweir 			drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageHierarchy.getViewIndependentPrimitive2DSequence());
708cdf0e10cSrcweir 
709cdf0e10cSrcweir 			// Only add front versions of grid and helplines since no visibility test is done,
710cdf0e10cSrcweir 			// so adding the back incarnations is not necessary. This makes the Front
711cdf0e10cSrcweir 			// visualisation the default when no visibility tests are done.
712cdf0e10cSrcweir 			//
713cdf0e10cSrcweir 			// Since we have no view here, no grid and helpline definitions are available currently. The used
714cdf0e10cSrcweir 			// methods at ViewContactOfHelplines and ViewContactOfGrid return only empty sequences and
715cdf0e10cSrcweir 			// do not need to be called ATM. This may change later if grid or helpline info gets
716cdf0e10cSrcweir 			// model data (it should not). Keeping the lines commented to hold this hint.
717cdf0e10cSrcweir 			//
718cdf0e10cSrcweir 			// drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfGridFront.getViewIndependentPrimitive2DSequence());
719cdf0e10cSrcweir 			// drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfHelplinesFront.getViewIndependentPrimitive2DSequence());
720cdf0e10cSrcweir 
721cdf0e10cSrcweir 			return xRetval;
722cdf0e10cSrcweir 		}
723cdf0e10cSrcweir 	} // end of namespace contact
724cdf0e10cSrcweir } // end of namespace sdr
725cdf0e10cSrcweir 
726cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
727cdf0e10cSrcweir // eof
728