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