bump product version to 7.2.5.1
[LibreOffice.git] / svx / source / sdr / contact / viewcontactofsdrpage.cxx
blob19911ed53440221f04aab1f76b9011a129b112fc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sdr/contact/viewcontactofsdrpage.hxx>
21 #include <svx/sdr/contact/viewobjectcontact.hxx>
22 #include <svx/svdpage.hxx>
23 #include <sdr/contact/viewobjectcontactofsdrpage.hxx>
24 #include <basegfx/polygon/b2dpolygontools.hxx>
25 #include <basegfx/matrix/b2dhommatrix.hxx>
26 #include <svtools/colorcfg.hxx>
27 #include <tools/debug.hxx>
28 #include <vcl/svapp.hxx>
29 #include <svx/sdr/contact/objectcontact.hxx>
30 #include <drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx>
31 #include <drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx>
32 #include <drawinglayer/attribute/fillgradientattribute.hxx>
33 #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
34 #include <basegfx/polygon/b2dpolygon.hxx>
35 #include <sdr/primitive2d/sdrattributecreator.hxx>
36 #include <sdr/primitive2d/sdrdecompositiontools.hxx>
37 #include <vcl/lazydelete.hxx>
38 #include <vcl/settings.hxx>
39 #include <drawinglayer/primitive2d/discreteshadowprimitive2d.hxx>
40 #include <drawinglayer/attribute/sdrfillattribute.hxx>
41 #include <bitmaps.hlst>
43 namespace sdr::contact {
45 ViewContactOfPageSubObject::ViewContactOfPageSubObject(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
46 : mrParentViewContactOfSdrPage(rParentViewContactOfSdrPage)
50 ViewContactOfPageSubObject::~ViewContactOfPageSubObject()
54 ViewContact* ViewContactOfPageSubObject::GetParentContact() const
56 return &mrParentViewContactOfSdrPage;
59 const SdrPage& ViewContactOfPageSubObject::getPage() const
61 return mrParentViewContactOfSdrPage.GetSdrPage();
64 ViewObjectContact& ViewContactOfPageBackground::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
66 ViewObjectContact* pRetval = new ViewObjectContactOfPageBackground(rObjectContact, *this);
67 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
69 return *pRetval;
72 drawinglayer::primitive2d::Primitive2DContainer ViewContactOfPageBackground::createViewIndependentPrimitive2DSequence() const
74 // We have only the page information, not the view information. Use the
75 // svtools::DOCCOLOR color for initialisation
76 const svtools::ColorConfig aColorConfig;
77 const Color aInitColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
78 const basegfx::BColor aRGBColor(aInitColor.getBColor());
79 const drawinglayer::primitive2d::Primitive2DReference xReference(
80 new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor));
82 return drawinglayer::primitive2d::Primitive2DContainer { xReference };
85 ViewContactOfPageBackground::ViewContactOfPageBackground(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
86 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
90 ViewContactOfPageBackground::~ViewContactOfPageBackground()
94 ViewObjectContact& ViewContactOfPageShadow::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
96 ViewObjectContact* pRetval = new ViewObjectContactOfPageShadow(rObjectContact, *this);
97 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
99 return *pRetval;
102 drawinglayer::primitive2d::Primitive2DContainer ViewContactOfPageShadow::createViewIndependentPrimitive2DSequence() const
104 static bool bUseOldPageShadow(false); // loplugin:constvars:ignore
105 const SdrPage& rPage = getPage();
106 basegfx::B2DHomMatrix aPageMatrix;
107 aPageMatrix.set(0, 0, static_cast<double>(rPage.GetWidth()));
108 aPageMatrix.set(1, 1, static_cast<double>(rPage.GetHeight()));
110 if(bUseOldPageShadow)
112 // create page shadow polygon
113 const double fPageBorderFactor(1.0 / 256.0);
114 basegfx::B2DPolygon aPageShadowPolygon;
115 aPageShadowPolygon.append(basegfx::B2DPoint(1.0, fPageBorderFactor));
116 aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, fPageBorderFactor));
117 aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, 1.0 + fPageBorderFactor));
118 aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0 + fPageBorderFactor));
119 aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0));
120 aPageShadowPolygon.append(basegfx::B2DPoint(1.0, 1.0));
121 aPageShadowPolygon.setClosed(true);
122 aPageShadowPolygon.transform(aPageMatrix);
124 // We have only the page information, not the view information. Use the
125 // svtools::FONTCOLOR color for initialisation
126 const svtools::ColorConfig aColorConfig;
127 const Color aShadowColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
128 const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor());
129 const drawinglayer::primitive2d::Primitive2DReference xReference(
130 new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
131 basegfx::B2DPolyPolygon(aPageShadowPolygon),
132 aRGBShadowColor));
134 return drawinglayer::primitive2d::Primitive2DContainer { xReference };
136 else
138 static vcl::DeleteOnDeinit< drawinglayer::primitive2d::DiscreteShadow > aDiscreteShadow(
139 new drawinglayer::primitive2d::DiscreteShadow(
140 BitmapEx(SIP_SA_PAGESHADOW35X35)));
142 if(aDiscreteShadow.get())
144 const drawinglayer::primitive2d::Primitive2DReference xReference(
145 new drawinglayer::primitive2d::DiscreteShadowPrimitive2D(
146 aPageMatrix,
147 *aDiscreteShadow.get()));
149 return drawinglayer::primitive2d::Primitive2DContainer { xReference };
152 return drawinglayer::primitive2d::Primitive2DContainer();
156 ViewContactOfPageShadow::ViewContactOfPageShadow(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
157 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
161 ViewContactOfPageShadow::~ViewContactOfPageShadow()
165 ViewObjectContact& ViewContactOfMasterPage::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
167 ViewObjectContact* pRetval = new ViewObjectContactOfMasterPage(rObjectContact, *this);
168 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
170 return *pRetval;
173 drawinglayer::primitive2d::Primitive2DContainer ViewContactOfMasterPage::createViewIndependentPrimitive2DSequence() const
175 drawinglayer::primitive2d::Primitive2DContainer xRetval;
177 // this class is used when the page is a MasterPage and is responsible to
178 // create a visualisation for the MPBGO, if exists. This needs to be suppressed
179 // when a SdrPage which uses a MasterPage creates it's output. Suppression
180 // is done in the corresponding VOC since DisplayInfo data is needed
181 const SdrPage& rPage = getPage();
183 if(rPage.IsMasterPage())
185 if(0 == rPage.GetPageNum())
187 // #i98063#
188 // filter MasterPage 0 since it's the HandoutPage. Thus, it's a
189 // MasterPage, but has no MPBGO, so there is nothing to do here.
191 else
193 drawinglayer::attribute::SdrFillAttribute aFill;
195 // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets,
196 // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all
197 // MasterPages should have a StyleSheet exactly for this reason, but historically
198 // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others).
199 if(rPage.getSdrPageProperties().GetStyleSheet())
201 // create page fill attributes with correct properties
202 aFill = drawinglayer::primitive2d::createNewSdrFillAttribute(
203 rPage.getSdrPageProperties().GetItemSet());
206 if(!aFill.isDefault())
208 // direct model data is the page size, get and use it
209 const basegfx::B2DRange aOuterRange(
210 0, 0, rPage.GetWidth(), rPage.GetHeight());
211 const basegfx::B2DRange aInnerRange(
212 rPage.GetLeftBorder(), rPage.GetUpperBorder(),
213 rPage.GetWidth() - rPage.GetRightBorder(), rPage.GetHeight() - rPage.GetLowerBorder());
214 bool const isFullSize(rPage.IsBackgroundFullSize());
215 const basegfx::B2DPolygon aFillPolygon(
216 basegfx::utils::createPolygonFromRect(isFullSize ? aOuterRange : aInnerRange));
217 const drawinglayer::primitive2d::Primitive2DReference xReference(
218 drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
219 basegfx::B2DPolyPolygon(aFillPolygon),
220 aFill,
221 drawinglayer::attribute::FillGradientAttribute()));
223 xRetval = drawinglayer::primitive2d::Primitive2DContainer { xReference };
228 return xRetval;
231 ViewContactOfMasterPage::ViewContactOfMasterPage(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
232 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
236 ViewContactOfMasterPage::~ViewContactOfMasterPage()
240 ViewObjectContact& ViewContactOfPageFill::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
242 ViewObjectContact* pRetval = new ViewObjectContactOfPageFill(rObjectContact, *this);
243 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
245 return *pRetval;
248 drawinglayer::primitive2d::Primitive2DContainer ViewContactOfPageFill::createViewIndependentPrimitive2DSequence() const
250 const SdrPage& rPage = getPage();
251 const basegfx::B2DRange aPageFillRange(0.0, 0.0, static_cast<double>(rPage.GetWidth()), static_cast<double>(rPage.GetHeight()));
252 const basegfx::B2DPolygon aPageFillPolygon(basegfx::utils::createPolygonFromRect(aPageFillRange));
254 // We have only the page information, not the view information. Use the
255 // svtools::DOCCOLOR color for initialisation
256 const svtools::ColorConfig aColorConfig;
257 const Color aPageFillColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
259 // create and add primitive
260 const basegfx::BColor aRGBColor(aPageFillColor.getBColor());
261 const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPageFillPolygon), aRGBColor));
263 return drawinglayer::primitive2d::Primitive2DContainer { xReference };
266 ViewContactOfPageFill::ViewContactOfPageFill(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
267 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
271 ViewContactOfPageFill::~ViewContactOfPageFill()
275 ViewObjectContact& ViewContactOfOuterPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
277 ViewObjectContact* pRetval = new ViewObjectContactOfOuterPageBorder(rObjectContact, *this);
278 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
280 return *pRetval;
283 drawinglayer::primitive2d::Primitive2DContainer ViewContactOfOuterPageBorder::createViewIndependentPrimitive2DSequence() const
285 drawinglayer::primitive2d::Primitive2DContainer xRetval;
286 const SdrPage& rPage = getPage();
287 const basegfx::B2DRange aPageBorderRange(0.0, 0.0, static_cast<double>(rPage.GetWidth()), static_cast<double>(rPage.GetHeight()));
289 // Changed to 0x949599 for renaissance, before svtools::FONTCOLOR was used.
290 // Added old case as fallback for HighContrast.
291 basegfx::BColor aRGBBorderColor(0x94 / double(0xff), 0x95 / double(0xff), 0x99 / double(0xff));
293 if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
295 const svtools::ColorConfig aColorConfig;
296 const Color aBorderColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
298 aRGBBorderColor = aBorderColor.getBColor();
301 if(rPage.getPageBorderOnlyLeftRight())
303 // #i93597# for Report Designer, the page border shall be only displayed right and left,
304 // but not top and bottom. Create simplified geometry.
305 basegfx::B2DPolygon aLeft, aRight;
307 aLeft.append(basegfx::B2DPoint(aPageBorderRange.getMinX(), aPageBorderRange.getMinY()));
308 aLeft.append(basegfx::B2DPoint(aPageBorderRange.getMinX(), aPageBorderRange.getMaxY()));
310 aRight.append(basegfx::B2DPoint(aPageBorderRange.getMaxX(), aPageBorderRange.getMinY()));
311 aRight.append(basegfx::B2DPoint(aPageBorderRange.getMaxX(), aPageBorderRange.getMaxY()));
313 xRetval.resize(2);
314 xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aLeft, aRGBBorderColor));
315 xRetval[1] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aRight, aRGBBorderColor));
317 else
319 xRetval.resize(1);
320 const basegfx::B2DPolygon aPageBorderPolygon(basegfx::utils::createPolygonFromRect(aPageBorderRange));
321 xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor));
324 return xRetval;
327 ViewContactOfOuterPageBorder::ViewContactOfOuterPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
328 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
332 ViewContactOfOuterPageBorder::~ViewContactOfOuterPageBorder()
336 ViewObjectContact& ViewContactOfInnerPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
338 ViewObjectContact* pRetval = new ViewObjectContactOfInnerPageBorder(rObjectContact, *this);
339 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
341 return *pRetval;
344 drawinglayer::primitive2d::Primitive2DContainer ViewContactOfInnerPageBorder::createViewIndependentPrimitive2DSequence() const
346 const SdrPage& rPage = getPage();
347 const basegfx::B2DRange aPageBorderRange(
348 static_cast<double>(rPage.GetLeftBorder()), static_cast<double>(rPage.GetUpperBorder()),
349 static_cast<double>(rPage.GetWidth() - rPage.GetRightBorder()), static_cast<double>(rPage.GetHeight() - rPage.GetLowerBorder()));
350 const basegfx::B2DPolygon aPageBorderPolygon(basegfx::utils::createPolygonFromRect(aPageBorderRange));
352 // We have only the page information, not the view information. Use the
353 // svtools::FONTCOLOR or svtools::DOCBOUNDARIES color for initialisation
354 const svtools::ColorConfig aColorConfig;
355 Color aBorderColor;
357 if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
359 aBorderColor = aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor;
361 else
363 svtools::ColorConfigValue aBorderConfig = aColorConfig.GetColorValue(svtools::DOCBOUNDARIES);
364 aBorderColor = aBorderConfig.bIsVisible ? aBorderConfig.nColor :
365 aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor;
368 // create page outer border primitive
369 const basegfx::BColor aRGBBorderColor(aBorderColor.getBColor());
370 const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor));
372 return drawinglayer::primitive2d::Primitive2DContainer { xReference };
375 ViewContactOfInnerPageBorder::ViewContactOfInnerPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
376 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
380 ViewContactOfInnerPageBorder::~ViewContactOfInnerPageBorder()
384 ViewObjectContact& ViewContactOfPageHierarchy::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
386 ViewObjectContact* pRetval = new ViewObjectContactOfPageHierarchy(rObjectContact, *this);
387 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
389 return *pRetval;
392 drawinglayer::primitive2d::Primitive2DContainer ViewContactOfPageHierarchy::createViewIndependentPrimitive2DSequence() const
394 // collect sub-hierarchy
395 drawinglayer::primitive2d::Primitive2DContainer xRetval;
396 const sal_uInt32 nObjectCount(GetObjectCount());
398 // collect all sub-primitives
399 for(sal_uInt32 a(0); a < nObjectCount; a++)
401 const ViewContact& rCandidate(GetViewContact(a));
402 const drawinglayer::primitive2d::Primitive2DContainer& aCandSeq(rCandidate.getViewIndependentPrimitive2DContainer());
404 xRetval.insert(xRetval.end(), aCandSeq.begin(), aCandSeq.end());
407 return xRetval;
410 ViewContactOfPageHierarchy::ViewContactOfPageHierarchy(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
411 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
415 ViewContactOfPageHierarchy::~ViewContactOfPageHierarchy()
419 sal_uInt32 ViewContactOfPageHierarchy::GetObjectCount() const
421 return getPage().GetObjCount();
424 ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const
426 SdrObject* pObj = getPage().GetObj(nIndex);
427 assert(pObj && "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)");
428 return pObj->GetViewContact();
431 ViewObjectContact& ViewContactOfGrid::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
433 ViewObjectContact* pRetval = new ViewObjectContactOfPageGrid(rObjectContact, *this);
434 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
436 return *pRetval;
439 drawinglayer::primitive2d::Primitive2DContainer ViewContactOfGrid::createViewIndependentPrimitive2DSequence() const
441 // We have only the page information, not the view information and thus no grid settings. Create empty
442 // default. For the view-dependent implementation, see ViewObjectContactOfPageGrid::createPrimitive2DSequence
443 return drawinglayer::primitive2d::Primitive2DContainer();
446 ViewContactOfGrid::ViewContactOfGrid(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront)
447 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage),
448 mbFront(bFront)
452 ViewContactOfGrid::~ViewContactOfGrid()
456 ViewObjectContact& ViewContactOfHelplines::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
458 ViewObjectContact* pRetval = new ViewObjectContactOfPageHelplines(rObjectContact, *this);
459 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
461 return *pRetval;
464 drawinglayer::primitive2d::Primitive2DContainer ViewContactOfHelplines::createViewIndependentPrimitive2DSequence() const
466 // We have only the page information, not the view information and thus no helplines. Create empty
467 // default. For the view-dependent implementation, see ViewObjectContactOfPageHelplines::createPrimitive2DSequence
468 return drawinglayer::primitive2d::Primitive2DContainer();
471 ViewContactOfHelplines::ViewContactOfHelplines(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront)
472 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage),
473 mbFront(bFront)
477 ViewContactOfHelplines::~ViewContactOfHelplines()
481 // Create an Object-Specific ViewObjectContact, set ViewContact and
482 // ObjectContact. Always needs to return something.
483 ViewObjectContact& ViewContactOfSdrPage::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
485 ViewObjectContact* pRetval = new ViewObjectContactOfSdrPage(rObjectContact, *this);
486 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
488 return *pRetval;
491 ViewContactOfSdrPage::ViewContactOfSdrPage(SdrPage& rPage)
492 : ViewContact(),
493 mrPage(rPage),
494 maViewContactOfPageBackground(*this),
495 maViewContactOfPageShadow(*this),
496 maViewContactOfPageFill(*this),
497 maViewContactOfMasterPage(*this),
498 maViewContactOfOuterPageBorder(*this),
499 maViewContactOfInnerPageBorder(*this),
500 maViewContactOfGridBack(*this, false),
501 maViewContactOfHelplinesBack(*this, false),
502 maViewContactOfPageHierarchy(*this),
503 maViewContactOfGridFront(*this, true),
504 maViewContactOfHelplinesFront(*this, true)
508 ViewContactOfSdrPage::~ViewContactOfSdrPage()
512 // Access to possible sub-hierarchy
513 sal_uInt32 ViewContactOfSdrPage::GetObjectCount() const
515 // Fixed count of content. It contains PageBackground (Wiese), PageShadow, PageFill,
516 // then - depending on if the page has a MasterPage - either MasterPage Hierarchy
517 // or MPBGO. Also OuterPageBorder, InnerPageBorder and two pairs of Grid and Helplines
518 // (for front and back) which internally are visible or not depending on the current
519 // front/back setting for those.
520 return 11;
523 ViewContact& ViewContactOfSdrPage::GetViewContact(sal_uInt32 nIndex) const
525 switch(nIndex)
527 case 0: return const_cast<ViewContactOfPageBackground&>(maViewContactOfPageBackground);
528 case 1: return const_cast<ViewContactOfPageShadow&>(maViewContactOfPageShadow);
529 case 2: return const_cast<ViewContactOfPageFill&>(maViewContactOfPageFill);
530 case 3:
532 const SdrPage& rPage = GetSdrPage();
534 if(rPage.TRG_HasMasterPage())
536 return rPage.TRG_GetMasterPageDescriptorViewContact();
538 else
540 return const_cast<ViewContactOfMasterPage&>(maViewContactOfMasterPage);
543 case 4: return const_cast<ViewContactOfOuterPageBorder&>(maViewContactOfOuterPageBorder);
544 case 5: return const_cast<ViewContactOfInnerPageBorder&>(maViewContactOfInnerPageBorder);
545 case 6: return const_cast<ViewContactOfGrid&>(maViewContactOfGridBack);
546 case 7: return const_cast<ViewContactOfHelplines&>(maViewContactOfHelplinesBack);
547 case 8: return const_cast<ViewContactOfPageHierarchy&>(maViewContactOfPageHierarchy);
548 case 9: return const_cast<ViewContactOfGrid&>(maViewContactOfGridFront);
549 case 10: case 11: return const_cast<ViewContactOfHelplines&>(maViewContactOfHelplinesFront);
550 default: assert(false);return const_cast<ViewContactOfHelplines&>(maViewContactOfHelplinesFront);
554 // React on changes of the object of this ViewContact
555 void ViewContactOfSdrPage::ActionChanged()
557 // call parent
558 ViewContact::ActionChanged();
560 // apply to local viewContacts, they all rely on page information. Exception
561 // is the sub hierarchy; this will not be influenced by the change
562 maViewContactOfPageBackground.ActionChanged();
563 maViewContactOfPageShadow.ActionChanged();
564 maViewContactOfPageFill.ActionChanged();
566 const SdrPage& rPage = GetSdrPage();
568 if(rPage.TRG_HasMasterPage())
570 rPage.TRG_GetMasterPageDescriptorViewContact().ActionChanged();
572 else if(rPage.IsMasterPage())
574 maViewContactOfMasterPage.ActionChanged();
577 maViewContactOfOuterPageBorder.ActionChanged();
578 maViewContactOfInnerPageBorder.ActionChanged();
579 maViewContactOfGridBack.ActionChanged();
580 maViewContactOfHelplinesBack.ActionChanged();
581 maViewContactOfGridFront.ActionChanged();
582 maViewContactOfHelplinesFront.ActionChanged();
585 drawinglayer::primitive2d::Primitive2DContainer ViewContactOfSdrPage::createViewIndependentPrimitive2DSequence() const
587 drawinglayer::primitive2d::Primitive2DContainer xRetval;
589 // collect all sub-sequences including sub hierarchy.
590 xRetval.append(maViewContactOfPageBackground.getViewIndependentPrimitive2DContainer());
591 xRetval.append(maViewContactOfPageShadow.getViewIndependentPrimitive2DContainer());
592 xRetval.append(maViewContactOfPageFill.getViewIndependentPrimitive2DContainer());
594 const SdrPage& rPage = GetSdrPage();
596 if(rPage.TRG_HasMasterPage())
598 xRetval.append(
599 rPage.TRG_GetMasterPageDescriptorViewContact().getViewIndependentPrimitive2DContainer());
601 else if(rPage.IsMasterPage())
603 xRetval.append(
604 maViewContactOfMasterPage.getViewIndependentPrimitive2DContainer());
607 xRetval.append(maViewContactOfOuterPageBorder.getViewIndependentPrimitive2DContainer());
608 xRetval.append(maViewContactOfInnerPageBorder.getViewIndependentPrimitive2DContainer());
609 xRetval.append(maViewContactOfPageHierarchy.getViewIndependentPrimitive2DContainer());
611 // Only add front versions of grid and helplines since no visibility test is done,
612 // so adding the back incarnations is not necessary. This makes the Front
613 // visualisation the default when no visibility tests are done.
615 // Since we have no view here, no grid and helpline definitions are available currently. The used
616 // methods at ViewContactOfHelplines and ViewContactOfGrid return only empty sequences and
617 // do not need to be called ATM. This may change later if grid or helpline info gets
618 // model data (it should not). Keeping the lines commented to hold this hint.
620 // drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfGridFront.getViewIndependentPrimitive2DContainer());
621 // drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfHelplinesFront.getViewIndependentPrimitive2DContainer());
623 return xRetval;
628 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */