1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <svx/sdr/contact/viewcontactofsdrpage.hxx>
21 #include <svx/sdr/contact/viewobjectcontact.hxx>
22 #include <svx/svdpage.hxx>
23 #include <svx/sdr/contact/displayinfo.hxx>
24 #include <svx/sdr/contact/viewobjectcontactofsdrpage.hxx>
25 #include <basegfx/polygon/b2dpolygontools.hxx>
26 #include <basegfx/matrix/b2dhommatrix.hxx>
27 #include <svx/svdpagv.hxx>
28 #include <svx/svdview.hxx>
29 #include <vcl/svapp.hxx>
30 #include <svx/sdr/contact/objectcontact.hxx>
31 #include <drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx>
32 #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
33 #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
34 #include <basegfx/polygon/b2dpolygon.hxx>
35 #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
36 #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
37 #include <vcl/lazydelete.hxx>
38 #include <svx/svdstr.hrc>
39 #include <svx/svdglob.hxx>
40 #include <drawinglayer/primitive2d/discreteshadowprimitive2d.hxx>
41 #include <drawinglayer/attribute/sdrfillattribute.hxx>
43 //////////////////////////////////////////////////////////////////////////////
49 ViewContactOfPageSubObject::ViewContactOfPageSubObject(ViewContactOfSdrPage
& rParentViewContactOfSdrPage
)
50 : mrParentViewContactOfSdrPage(rParentViewContactOfSdrPage
)
54 ViewContactOfPageSubObject::~ViewContactOfPageSubObject()
58 ViewContact
* ViewContactOfPageSubObject::GetParentContact() const
60 return &mrParentViewContactOfSdrPage
;
63 const SdrPage
& ViewContactOfPageSubObject::getPage() const
65 return mrParentViewContactOfSdrPage
.GetSdrPage();
67 } // end of namespace contact
68 } // end of namespace sdr
70 //////////////////////////////////////////////////////////////////////////////
76 ViewObjectContact
& ViewContactOfPageBackground::CreateObjectSpecificViewObjectContact(ObjectContact
& rObjectContact
)
78 ViewObjectContact
* pRetval
= new ViewObjectContactOfPageBackground(rObjectContact
, *this);
79 DBG_ASSERT(pRetval
, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
84 drawinglayer::primitive2d::Primitive2DSequence
ViewContactOfPageBackground::createViewIndependentPrimitive2DSequence() const
86 // We have only the page information, not the view information. Use the
87 // svtools::DOCCOLOR color for initialisation
88 const svtools::ColorConfig aColorConfig
;
89 const Color
aInitColor(aColorConfig
.GetColorValue(svtools::DOCCOLOR
).nColor
);
90 const basegfx::BColor
aRGBColor(aInitColor
.getBColor());
91 const drawinglayer::primitive2d::Primitive2DReference
xReference(
92 new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor
));
94 return drawinglayer::primitive2d::Primitive2DSequence(&xReference
, 1);
97 ViewContactOfPageBackground::ViewContactOfPageBackground(ViewContactOfSdrPage
& rParentViewContactOfSdrPage
)
98 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage
)
102 ViewContactOfPageBackground::~ViewContactOfPageBackground()
105 } // end of namespace contact
106 } // end of namespace sdr
108 //////////////////////////////////////////////////////////////////////////////
114 ViewObjectContact
& ViewContactOfPageShadow::CreateObjectSpecificViewObjectContact(ObjectContact
& rObjectContact
)
116 ViewObjectContact
* pRetval
= new ViewObjectContactOfPageShadow(rObjectContact
, *this);
117 DBG_ASSERT(pRetval
, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
122 drawinglayer::primitive2d::Primitive2DSequence
ViewContactOfPageShadow::createViewIndependentPrimitive2DSequence() const
124 static bool bUseOldPageShadow(false);
125 const SdrPage
& rPage
= getPage();
126 basegfx::B2DHomMatrix aPageMatrix
;
127 aPageMatrix
.set(0, 0, (double)rPage
.GetWdt());
128 aPageMatrix
.set(1, 1, (double)rPage
.GetHgt());
130 if(bUseOldPageShadow
)
132 // create page shadow polygon
133 const double fPageBorderFactor(1.0 / 256.0);
134 basegfx::B2DPolygon aPageShadowPolygon
;
135 aPageShadowPolygon
.append(basegfx::B2DPoint(1.0, fPageBorderFactor
));
136 aPageShadowPolygon
.append(basegfx::B2DPoint(1.0 + fPageBorderFactor
, fPageBorderFactor
));
137 aPageShadowPolygon
.append(basegfx::B2DPoint(1.0 + fPageBorderFactor
, 1.0 + fPageBorderFactor
));
138 aPageShadowPolygon
.append(basegfx::B2DPoint(fPageBorderFactor
, 1.0 + fPageBorderFactor
));
139 aPageShadowPolygon
.append(basegfx::B2DPoint(fPageBorderFactor
, 1.0));
140 aPageShadowPolygon
.append(basegfx::B2DPoint(1.0, 1.0));
141 aPageShadowPolygon
.setClosed(true);
142 aPageShadowPolygon
.transform(aPageMatrix
);
144 // We have only the page information, not the view information. Use the
145 // svtools::FONTCOLOR color for initialisation
146 const svtools::ColorConfig aColorConfig
;
147 const Color
aShadowColor(aColorConfig
.GetColorValue(svtools::FONTCOLOR
).nColor
);
148 const basegfx::BColor
aRGBShadowColor(aShadowColor
.getBColor());
149 const drawinglayer::primitive2d::Primitive2DReference
xReference(
150 new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
151 basegfx::B2DPolyPolygon(aPageShadowPolygon
),
154 return drawinglayer::primitive2d::Primitive2DSequence(&xReference
, 1);
158 static vcl::DeleteOnDeinit
<drawinglayer::primitive2d::DiscreteShadow
>
159 aDiscreteShadow(new drawinglayer::primitive2d::DiscreteShadow(
160 BitmapEx(ResId(SIP_SA_PAGESHADOW35X35
, *ImpGetResMgr()))));
161 if (aDiscreteShadow
.get() != NULL
)
163 const drawinglayer::primitive2d::Primitive2DReference
xReference(
164 new drawinglayer::primitive2d::DiscreteShadowPrimitive2D(
166 *aDiscreteShadow
.get()));
168 return drawinglayer::primitive2d::Primitive2DSequence(&xReference
, 1);
170 return drawinglayer::primitive2d::Primitive2DSequence();
174 ViewContactOfPageShadow::ViewContactOfPageShadow(ViewContactOfSdrPage
& rParentViewContactOfSdrPage
)
175 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage
)
179 ViewContactOfPageShadow::~ViewContactOfPageShadow()
182 } // end of namespace contact
183 } // end of namespace sdr
185 //////////////////////////////////////////////////////////////////////////////
191 ViewObjectContact
& ViewContactOfMasterPage::CreateObjectSpecificViewObjectContact(ObjectContact
& rObjectContact
)
193 ViewObjectContact
* pRetval
= new ViewObjectContactOfMasterPage(rObjectContact
, *this);
194 DBG_ASSERT(pRetval
, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
199 drawinglayer::primitive2d::Primitive2DSequence
ViewContactOfMasterPage::createViewIndependentPrimitive2DSequence() const
201 drawinglayer::primitive2d::Primitive2DSequence xRetval
;
203 // this class is used when the page is a MasterPage and is responsible to
204 // create a visualisation for the MPBGO, if exists. This needs to be suppressed
205 // when a SdrPage which uses a MasterPage creates it's output. Suppression
206 // is done in the corresponding VOC since DisplayInfo data is needed
207 const SdrPage
& rPage
= getPage();
209 if(rPage
.IsMasterPage())
211 if(0 == rPage
.GetPageNum())
214 // filter MasterPage 0 since it's the HandoutPage. Thus, it's a
215 // MasterPage, but has no MPBGO, so there is nothing to do here.
219 drawinglayer::attribute::SdrFillAttribute aFill
;
221 // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets,
222 // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all
223 // MasterPages should have a StyleSheet excactly for this reason, but historically
224 // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others).
225 if(rPage
.getSdrPageProperties().GetStyleSheet())
227 // create page fill attributes with correct properties
228 aFill
= drawinglayer::primitive2d::createNewSdrFillAttribute(
229 rPage
.getSdrPageProperties().GetItemSet());
232 if(!aFill
.isDefault())
234 // direct model data is the page size, get and use it
235 const basegfx::B2DRange
aInnerRange(
236 rPage
.GetLftBorder(), rPage
.GetUppBorder(),
237 rPage
.GetWdt() - rPage
.GetRgtBorder(), rPage
.GetHgt() - rPage
.GetLwrBorder());
238 const basegfx::B2DPolygon
aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange
));
239 const basegfx::B2DHomMatrix aEmptyTransform
;
240 const drawinglayer::primitive2d::Primitive2DReference
xReference(
241 drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
242 basegfx::B2DPolyPolygon(aInnerPolgon
),
245 drawinglayer::attribute::FillGradientAttribute()));
247 xRetval
= drawinglayer::primitive2d::Primitive2DSequence(&xReference
, 1);
255 ViewContactOfMasterPage::ViewContactOfMasterPage(ViewContactOfSdrPage
& rParentViewContactOfSdrPage
)
256 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage
)
260 ViewContactOfMasterPage::~ViewContactOfMasterPage()
263 } // end of namespace contact
264 } // end of namespace sdr
266 //////////////////////////////////////////////////////////////////////////////
272 ViewObjectContact
& ViewContactOfPageFill::CreateObjectSpecificViewObjectContact(ObjectContact
& rObjectContact
)
274 ViewObjectContact
* pRetval
= new ViewObjectContactOfPageFill(rObjectContact
, *this);
275 DBG_ASSERT(pRetval
, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
280 drawinglayer::primitive2d::Primitive2DSequence
ViewContactOfPageFill::createViewIndependentPrimitive2DSequence() const
282 const SdrPage
& rPage
= getPage();
283 const basegfx::B2DRange
aPageFillRange(0.0, 0.0, (double)rPage
.GetWdt(), (double)rPage
.GetHgt());
284 const basegfx::B2DPolygon
aPageFillPolygon(basegfx::tools::createPolygonFromRect(aPageFillRange
));
286 // We have only the page information, not the view information. Use the
287 // svtools::DOCCOLOR color for initialisation
288 const svtools::ColorConfig aColorConfig
;
289 const Color
aPageFillColor(aColorConfig
.GetColorValue(svtools::DOCCOLOR
).nColor
);
291 // create and add primitive
292 const basegfx::BColor
aRGBColor(aPageFillColor
.getBColor());
293 const drawinglayer::primitive2d::Primitive2DReference
xReference(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPageFillPolygon
), aRGBColor
));
295 return drawinglayer::primitive2d::Primitive2DSequence(&xReference
, 1);
298 ViewContactOfPageFill::ViewContactOfPageFill(ViewContactOfSdrPage
& rParentViewContactOfSdrPage
)
299 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage
)
303 ViewContactOfPageFill::~ViewContactOfPageFill()
306 } // end of namespace contact
307 } // end of namespace sdr
309 //////////////////////////////////////////////////////////////////////////////
315 ViewObjectContact
& ViewContactOfOuterPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact
& rObjectContact
)
317 ViewObjectContact
* pRetval
= new ViewObjectContactOfOuterPageBorder(rObjectContact
, *this);
318 DBG_ASSERT(pRetval
, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
323 drawinglayer::primitive2d::Primitive2DSequence
ViewContactOfOuterPageBorder::createViewIndependentPrimitive2DSequence() const
325 drawinglayer::primitive2d::Primitive2DSequence xRetval
;
326 const SdrPage
& rPage
= getPage();
327 const basegfx::B2DRange
aPageBorderRange(0.0, 0.0, (double)rPage
.GetWdt(), (double)rPage
.GetHgt());
329 // Changed to 0x949599 for renaissance, before svtools::FONTCOLOR was used.
330 // Added old case as fallback for HighContrast.
331 basegfx::BColor
aRGBBorderColor(0x94 / (double)0xff, 0x95 / (double)0xff, 0x99 / (double)0xff);
333 if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
335 const svtools::ColorConfig aColorConfig
;
336 const Color
aBorderColor(aColorConfig
.GetColorValue(svtools::FONTCOLOR
).nColor
);
338 aRGBBorderColor
= aBorderColor
.getBColor();
341 if(rPage
.getPageBorderOnlyLeftRight())
343 // #i93597# for Report Designer, the page border shall be only displayed right and left,
344 // but not top and bottom. Create simplified geometry.
345 basegfx::B2DPolygon aLeft
, aRight
;
347 aLeft
.append(basegfx::B2DPoint(aPageBorderRange
.getMinX(), aPageBorderRange
.getMinY()));
348 aLeft
.append(basegfx::B2DPoint(aPageBorderRange
.getMinX(), aPageBorderRange
.getMaxY()));
350 aRight
.append(basegfx::B2DPoint(aPageBorderRange
.getMaxX(), aPageBorderRange
.getMinY()));
351 aRight
.append(basegfx::B2DPoint(aPageBorderRange
.getMaxX(), aPageBorderRange
.getMaxY()));
354 xRetval
[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aLeft
, aRGBBorderColor
));
355 xRetval
[1] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aRight
, aRGBBorderColor
));
360 const basegfx::B2DPolygon
aPageBorderPolygon(basegfx::tools::createPolygonFromRect(aPageBorderRange
));
361 xRetval
[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon
, aRGBBorderColor
));
367 ViewContactOfOuterPageBorder::ViewContactOfOuterPageBorder(ViewContactOfSdrPage
& rParentViewContactOfSdrPage
)
368 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage
)
372 ViewContactOfOuterPageBorder::~ViewContactOfOuterPageBorder()
375 } // end of namespace contact
376 } // end of namespace sdr
378 //////////////////////////////////////////////////////////////////////////////
384 ViewObjectContact
& ViewContactOfInnerPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact
& rObjectContact
)
386 ViewObjectContact
* pRetval
= new ViewObjectContactOfInnerPageBorder(rObjectContact
, *this);
387 DBG_ASSERT(pRetval
, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
392 drawinglayer::primitive2d::Primitive2DSequence
ViewContactOfInnerPageBorder::createViewIndependentPrimitive2DSequence() const
394 const SdrPage
& rPage
= getPage();
395 const basegfx::B2DRange
aPageBorderRange(
396 (double)rPage
.GetLftBorder(), (double)rPage
.GetUppBorder(),
397 (double)(rPage
.GetWdt() - rPage
.GetRgtBorder()), (double)(rPage
.GetHgt() - rPage
.GetLwrBorder()));
398 const basegfx::B2DPolygon
aPageBorderPolygon(basegfx::tools::createPolygonFromRect(aPageBorderRange
));
400 // We have only the page information, not the view information. Use the
401 // svtools::FONTCOLOR or svtools::DOCBOUNDARIES color for initialisation
402 const svtools::ColorConfig aColorConfig
;
405 if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
407 aBorderColor
= aColorConfig
.GetColorValue(svtools::FONTCOLOR
).nColor
;
411 aBorderColor
= aColorConfig
.GetColorValue(svtools::DOCBOUNDARIES
).nColor
;
414 // create page outer border primitive
415 const basegfx::BColor
aRGBBorderColor(aBorderColor
.getBColor());
416 const drawinglayer::primitive2d::Primitive2DReference
xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon
, aRGBBorderColor
));
418 return drawinglayer::primitive2d::Primitive2DSequence(&xReference
, 1);
421 ViewContactOfInnerPageBorder::ViewContactOfInnerPageBorder(ViewContactOfSdrPage
& rParentViewContactOfSdrPage
)
422 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage
)
426 ViewContactOfInnerPageBorder::~ViewContactOfInnerPageBorder()
429 } // end of namespace contact
430 } // end of namespace sdr
432 //////////////////////////////////////////////////////////////////////////////
438 ViewObjectContact
& ViewContactOfPageHierarchy::CreateObjectSpecificViewObjectContact(ObjectContact
& rObjectContact
)
440 ViewObjectContact
* pRetval
= new ViewObjectContactOfPageHierarchy(rObjectContact
, *this);
441 DBG_ASSERT(pRetval
, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
446 drawinglayer::primitive2d::Primitive2DSequence
ViewContactOfPageHierarchy::createViewIndependentPrimitive2DSequence() const
448 // collect sub-hierarchy
449 drawinglayer::primitive2d::Primitive2DSequence xRetval
;
450 const sal_uInt32
nObjectCount(GetObjectCount());
452 // collect all sub-primitives
453 for(sal_uInt32
a(0); a
< nObjectCount
; a
++)
455 const ViewContact
& rCandidate(GetViewContact(a
));
456 const drawinglayer::primitive2d::Primitive2DSequence
aCandSeq(rCandidate
.getViewIndependentPrimitive2DSequence());
458 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval
, aCandSeq
);
464 ViewContactOfPageHierarchy::ViewContactOfPageHierarchy(ViewContactOfSdrPage
& rParentViewContactOfSdrPage
)
465 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage
)
469 ViewContactOfPageHierarchy::~ViewContactOfPageHierarchy()
473 sal_uInt32
ViewContactOfPageHierarchy::GetObjectCount() const
475 return getPage().GetObjCount();
478 ViewContact
& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex
) const
480 SdrObject
* pObj
= getPage().GetObj(nIndex
);
481 DBG_ASSERT(pObj
, "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)");
482 return pObj
->GetViewContact();
484 } // end of namespace contact
485 } // end of namespace sdr
487 //////////////////////////////////////////////////////////////////////////////
493 ViewObjectContact
& ViewContactOfGrid::CreateObjectSpecificViewObjectContact(ObjectContact
& rObjectContact
)
495 ViewObjectContact
* pRetval
= new ViewObjectContactOfPageGrid(rObjectContact
, *this);
496 DBG_ASSERT(pRetval
, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
501 drawinglayer::primitive2d::Primitive2DSequence
ViewContactOfGrid::createViewIndependentPrimitive2DSequence() const
503 // We have only the page information, not the view information and thus no grid settings. Create empty
504 // default. For the view-dependent implementation, see ViewObjectContactOfPageGrid::createPrimitive2DSequence
505 return drawinglayer::primitive2d::Primitive2DSequence();
508 ViewContactOfGrid::ViewContactOfGrid(ViewContactOfSdrPage
& rParentViewContactOfSdrPage
, bool bFront
)
509 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage
),
514 ViewContactOfGrid::~ViewContactOfGrid()
517 } // end of namespace contact
518 } // end of namespace sdr
520 //////////////////////////////////////////////////////////////////////////////
526 ViewObjectContact
& ViewContactOfHelplines::CreateObjectSpecificViewObjectContact(ObjectContact
& rObjectContact
)
528 ViewObjectContact
* pRetval
= new ViewObjectContactOfPageHelplines(rObjectContact
, *this);
529 DBG_ASSERT(pRetval
, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
534 drawinglayer::primitive2d::Primitive2DSequence
ViewContactOfHelplines::createViewIndependentPrimitive2DSequence() const
536 // We have only the page information, not the view information and thus no helplines. Create empty
537 // default. For the view-dependent implementation, see ViewObjectContactOfPageHelplines::createPrimitive2DSequence
538 return drawinglayer::primitive2d::Primitive2DSequence();
541 ViewContactOfHelplines::ViewContactOfHelplines(ViewContactOfSdrPage
& rParentViewContactOfSdrPage
, bool bFront
)
542 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage
),
547 ViewContactOfHelplines::~ViewContactOfHelplines()
550 } // end of namespace contact
551 } // end of namespace sdr
553 //////////////////////////////////////////////////////////////////////////////
559 // Create a Object-Specific ViewObjectContact, set ViewContact and
560 // ObjectContact. Always needs to return something.
561 ViewObjectContact
& ViewContactOfSdrPage::CreateObjectSpecificViewObjectContact(ObjectContact
& rObjectContact
)
563 ViewObjectContact
* pRetval
= new ViewObjectContactOfSdrPage(rObjectContact
, *this);
564 DBG_ASSERT(pRetval
, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
569 ViewContactOfSdrPage::ViewContactOfSdrPage(SdrPage
& rPage
)
572 maViewContactOfPageBackground(*this),
573 maViewContactOfPageShadow(*this),
574 maViewContactOfPageFill(*this),
575 maViewContactOfMasterPage(*this),
576 maViewContactOfOuterPageBorder(*this),
577 maViewContactOfInnerPageBorder(*this),
578 maViewContactOfGridBack(*this, false),
579 maViewContactOfHelplinesBack(*this, false),
580 maViewContactOfPageHierarchy(*this),
581 maViewContactOfGridFront(*this, true),
582 maViewContactOfHelplinesFront(*this, true)
586 ViewContactOfSdrPage::~ViewContactOfSdrPage()
590 // Access to possible sub-hierarchy
591 sal_uInt32
ViewContactOfSdrPage::GetObjectCount() const
593 // Fixed count of content. It contains PageBackground (Wiese), PageShadow, PageFill,
594 // then - depending on if the page has a MasterPage - either MasterPage Hierarchy
595 // or MPBGO. Also OuterPageBorder, InnerPageBorder and two pairs of Grid and Helplines
596 // (for front and back) which internally are visible or not depending on the current
597 // front/back setting for those.
601 ViewContact
& ViewContactOfSdrPage::GetViewContact(sal_uInt32 nIndex
) const
605 case 0: return (ViewContact
&)maViewContactOfPageBackground
;
606 case 1: return (ViewContact
&)maViewContactOfPageShadow
;
607 case 2: return (ViewContact
&)maViewContactOfPageFill
;
610 const SdrPage
& rPage
= GetSdrPage();
612 if(rPage
.TRG_HasMasterPage())
614 return rPage
.TRG_GetMasterPageDescriptorViewContact();
618 return (ViewContact
&)maViewContactOfMasterPage
;
621 case 4: return (ViewContact
&)maViewContactOfOuterPageBorder
;
622 case 5: return (ViewContact
&)maViewContactOfInnerPageBorder
;
623 case 6: return (ViewContact
&)maViewContactOfGridBack
;
624 case 7: return (ViewContact
&)maViewContactOfHelplinesBack
;
625 case 8: return (ViewContact
&)maViewContactOfPageHierarchy
;
626 case 9: return (ViewContact
&)maViewContactOfGridFront
;
627 default: return (ViewContact
&)maViewContactOfHelplinesFront
;
631 // React on changes of the object of this ViewContact
632 void ViewContactOfSdrPage::ActionChanged()
635 ViewContact::ActionChanged();
637 // apply to local viewContacts, they all rely on page information. Exception
638 // is the sub hierarchy; this will not be influenced by the change
639 maViewContactOfPageBackground
.ActionChanged();
640 maViewContactOfPageShadow
.ActionChanged();
641 maViewContactOfPageFill
.ActionChanged();
643 const SdrPage
& rPage
= GetSdrPage();
645 if(rPage
.TRG_HasMasterPage())
647 rPage
.TRG_GetMasterPageDescriptorViewContact().ActionChanged();
649 else if(rPage
.IsMasterPage())
651 maViewContactOfMasterPage
.ActionChanged();
654 maViewContactOfOuterPageBorder
.ActionChanged();
655 maViewContactOfInnerPageBorder
.ActionChanged();
656 maViewContactOfGridBack
.ActionChanged();
657 maViewContactOfHelplinesBack
.ActionChanged();
658 maViewContactOfGridFront
.ActionChanged();
659 maViewContactOfHelplinesFront
.ActionChanged();
662 // overload for acessing the SdrPage
663 SdrPage
* ViewContactOfSdrPage::TryToGetSdrPage() const
665 return &GetSdrPage();
668 drawinglayer::primitive2d::Primitive2DSequence
ViewContactOfSdrPage::createViewIndependentPrimitive2DSequence() const
670 drawinglayer::primitive2d::Primitive2DSequence xRetval
;
672 // collect all sub-sequences including sub hierarchy.
673 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval
, maViewContactOfPageBackground
.getViewIndependentPrimitive2DSequence());
674 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval
, maViewContactOfPageShadow
.getViewIndependentPrimitive2DSequence());
675 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval
, maViewContactOfPageFill
.getViewIndependentPrimitive2DSequence());
677 const SdrPage
& rPage
= GetSdrPage();
679 if(rPage
.TRG_HasMasterPage())
681 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval
,
682 rPage
.TRG_GetMasterPageDescriptorViewContact().getViewIndependentPrimitive2DSequence());
684 else if(rPage
.IsMasterPage())
686 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval
,
687 maViewContactOfMasterPage
.getViewIndependentPrimitive2DSequence());
690 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval
, maViewContactOfOuterPageBorder
.getViewIndependentPrimitive2DSequence());
691 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval
, maViewContactOfInnerPageBorder
.getViewIndependentPrimitive2DSequence());
692 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval
, maViewContactOfPageHierarchy
.getViewIndependentPrimitive2DSequence());
694 // Only add front versions of grid and helplines since no visibility test is done,
695 // so adding the back incarnations is not necessary. This makes the Front
696 // visualisation the default when no visibility tests are done.
698 // Since we have no view here, no grid and helpline definitions are available currently. The used
699 // methods at ViewContactOfHelplines and ViewContactOfGrid return only empty sequences and
700 // do not need to be called ATM. This may change later if grid or helpline info gets
701 // model data (it should not). Keeping the lines commented to hold this hint.
703 // drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfGridFront.getViewIndependentPrimitive2DSequence());
704 // drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfHelplinesFront.getViewIndependentPrimitive2DSequence());
708 } // end of namespace contact
709 } // end of namespace sdr
711 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */