update dev300-m58
[ooovba.git] / svx / source / sdr / contact / viewcontactofsdrpage.cxx
blobc150681efb7b7fff2f91a51a08a409a7930e3e4e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: viewcontactofsdrpage.cxx,v $
10 * $Revision: 1.24 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
33 #include <svx/sdr/contact/viewcontactofsdrpage.hxx>
34 #include <svx/sdr/contact/viewobjectcontact.hxx>
35 #include <svx/svdpage.hxx>
36 #include <svx/sdr/contact/displayinfo.hxx>
37 #include <svx/sdr/contact/viewobjectcontactofsdrpage.hxx>
38 #include <basegfx/polygon/b2dpolygontools.hxx>
39 #include <basegfx/matrix/b2dhommatrix.hxx>
40 #include <svx/svdpagv.hxx>
41 #include <svx/svdview.hxx>
42 #include <vcl/svapp.hxx>
43 #include <svx/sdr/contact/objectcontact.hxx>
44 #include <drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx>
45 #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
46 #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
47 #include <basegfx/polygon/b2dpolygon.hxx>
48 #include <drawinglayer/attribute/sdrattribute.hxx>
49 #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
50 #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
52 //////////////////////////////////////////////////////////////////////////////
54 #define PAPER_SHADOW(SIZE) (SIZE >> 8)
56 //////////////////////////////////////////////////////////////////////////////
58 namespace sdr
60 namespace contact
62 ViewContactOfPageSubObject::ViewContactOfPageSubObject(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
63 : mrParentViewContactOfSdrPage(rParentViewContactOfSdrPage)
67 ViewContactOfPageSubObject::~ViewContactOfPageSubObject()
71 ViewContact* ViewContactOfPageSubObject::GetParentContact() const
73 return &mrParentViewContactOfSdrPage;
76 const SdrPage& ViewContactOfPageSubObject::getPage() const
78 return mrParentViewContactOfSdrPage.GetSdrPage();
80 } // end of namespace contact
81 } // end of namespace sdr
83 //////////////////////////////////////////////////////////////////////////////
85 namespace sdr
87 namespace contact
89 ViewObjectContact& ViewContactOfPageBackground::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
91 ViewObjectContact* pRetval = new ViewObjectContactOfPageBackground(rObjectContact, *this);
92 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
94 return *pRetval;
97 drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageBackground::createViewIndependentPrimitive2DSequence() const
99 // We have only the page information, not the view information. Use the
100 // svtools::DOCCOLOR color for initialisation
101 const svtools::ColorConfig aColorConfig;
102 const Color aInitColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
103 const basegfx::BColor aRGBColor(aInitColor.getBColor());
104 const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor));
106 return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
109 ViewContactOfPageBackground::ViewContactOfPageBackground(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
110 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
114 ViewContactOfPageBackground::~ViewContactOfPageBackground()
117 } // end of namespace contact
118 } // end of namespace sdr
120 //////////////////////////////////////////////////////////////////////////////
122 namespace sdr
124 namespace contact
126 ViewObjectContact& ViewContactOfPageShadow::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
128 ViewObjectContact* pRetval = new ViewObjectContactOfPageShadow(rObjectContact, *this);
129 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
131 return *pRetval;
134 drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageShadow::createViewIndependentPrimitive2DSequence() const
136 const SdrPage& rPage = getPage();
137 basegfx::B2DHomMatrix aPageMatrix;
138 aPageMatrix.set(0, 0, (double)rPage.GetWdt());
139 aPageMatrix.set(1, 1, (double)rPage.GetHgt());
141 // create page shadow polygon
142 const double fPageBorderFactor(1.0 / 256.0);
143 basegfx::B2DPolygon aPageShadowPolygon;
144 aPageShadowPolygon.append(basegfx::B2DPoint(1.0, fPageBorderFactor));
145 aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, fPageBorderFactor));
146 aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, 1.0 + fPageBorderFactor));
147 aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0 + fPageBorderFactor));
148 aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0));
149 aPageShadowPolygon.append(basegfx::B2DPoint(1.0, 1.0));
150 aPageShadowPolygon.setClosed(true);
151 aPageShadowPolygon.transform(aPageMatrix);
153 // We have only the page information, not the view information. Use the
154 // svtools::FONTCOLOR color for initialisation
155 const svtools::ColorConfig aColorConfig;
156 const Color aShadowColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
157 const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor());
158 const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPageShadowPolygon), aRGBShadowColor));
160 return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
163 ViewContactOfPageShadow::ViewContactOfPageShadow(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
164 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
168 ViewContactOfPageShadow::~ViewContactOfPageShadow()
171 } // end of namespace contact
172 } // end of namespace sdr
174 //////////////////////////////////////////////////////////////////////////////
176 namespace sdr
178 namespace contact
180 ViewObjectContact& ViewContactOfMasterPage::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
182 ViewObjectContact* pRetval = new ViewObjectContactOfMasterPage(rObjectContact, *this);
183 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
185 return *pRetval;
188 drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPage::createViewIndependentPrimitive2DSequence() const
190 drawinglayer::primitive2d::Primitive2DSequence xRetval;
192 // this class is used when the page is a MasterPage and is responsible to
193 // create a visualisation for the MPBGO, if exists. This needs to be suppressed
194 // when a SdrPage which uses a MasterPage creates it's output. Suppression
195 // is done in the corresponding VOC since DisplayInfo data is needed
196 const SdrPage& rPage = getPage();
198 if(rPage.IsMasterPage())
200 if(0 == rPage.GetPageNum())
202 // #i98063#
203 // filter MasterPage 0 since it's the HandoutPage. Thus, it's a
204 // MasterPage, but has no MPBGO, so there is nothing to do here.
206 else
208 OSL_ENSURE(0 != rPage.GetObjCount(), "MasterPage without MPBGO detected (!)");
210 if(rPage.GetObjCount())
212 SdrObject* pObject = rPage.GetObj(0);
213 OSL_ENSURE(pObject && pObject->IsMasterPageBackgroundObject(), "MasterPage with wrong MPBGO detected (!)");
215 if(pObject && pObject->IsMasterPageBackgroundObject())
217 // build primitive from pObject's attributes
218 const SfxItemSet& rFillProperties = pObject->GetMergedItemSet();
219 drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties);
221 if(pFill)
223 if(pFill->isVisible())
225 // direct model data is the page size, get and use it
226 const basegfx::B2DRange aInnerRange(
227 rPage.GetLftBorder(), rPage.GetUppBorder(),
228 rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder());
229 const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange));
230 const basegfx::B2DHomMatrix aEmptyTransform;
231 const drawinglayer::primitive2d::Primitive2DReference xReference(drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
232 basegfx::B2DPolyPolygon(aInnerPolgon), aEmptyTransform, *pFill));
234 xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
237 delete pFill;
244 return xRetval;
247 ViewContactOfMasterPage::ViewContactOfMasterPage(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
248 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
252 ViewContactOfMasterPage::~ViewContactOfMasterPage()
255 } // end of namespace contact
256 } // end of namespace sdr
258 //////////////////////////////////////////////////////////////////////////////
260 namespace sdr
262 namespace contact
264 ViewObjectContact& ViewContactOfPageFill::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
266 ViewObjectContact* pRetval = new ViewObjectContactOfPageFill(rObjectContact, *this);
267 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
269 return *pRetval;
272 drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageFill::createViewIndependentPrimitive2DSequence() const
274 const SdrPage& rPage = getPage();
275 const basegfx::B2DRange aPageFillRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt());
276 const basegfx::B2DPolygon aPageFillPolygon(basegfx::tools::createPolygonFromRect(aPageFillRange));
278 // We have only the page information, not the view information. Use the
279 // svtools::DOCCOLOR color for initialisation
280 const svtools::ColorConfig aColorConfig;
281 const Color aPageFillColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
283 // create and add primitive
284 const basegfx::BColor aRGBColor(aPageFillColor.getBColor());
285 const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPageFillPolygon), aRGBColor));
287 return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
290 ViewContactOfPageFill::ViewContactOfPageFill(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
291 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
295 ViewContactOfPageFill::~ViewContactOfPageFill()
298 } // end of namespace contact
299 } // end of namespace sdr
301 //////////////////////////////////////////////////////////////////////////////
303 namespace sdr
305 namespace contact
307 ViewObjectContact& ViewContactOfOuterPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
309 ViewObjectContact* pRetval = new ViewObjectContactOfOuterPageBorder(rObjectContact, *this);
310 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
312 return *pRetval;
315 drawinglayer::primitive2d::Primitive2DSequence ViewContactOfOuterPageBorder::createViewIndependentPrimitive2DSequence() const
317 drawinglayer::primitive2d::Primitive2DSequence xRetval;
318 const SdrPage& rPage = getPage();
319 const basegfx::B2DRange aPageBorderRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt());
321 // We have only the page information, not the view information. Use the
322 // svtools::FONTCOLOR color for initialisation
323 const svtools::ColorConfig aColorConfig;
324 const Color aBorderColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
325 const basegfx::BColor aRGBBorderColor(aBorderColor.getBColor());
327 if(rPage.getPageBorderOnlyLeftRight())
329 // #i93597# for Report Designer, the page border shall be only displayed right and left,
330 // but not top and bottom. Create simplified geometry.
331 basegfx::B2DPolygon aLeft, aRight;
333 aLeft.append(basegfx::B2DPoint(aPageBorderRange.getMinX(), aPageBorderRange.getMinY()));
334 aLeft.append(basegfx::B2DPoint(aPageBorderRange.getMinX(), aPageBorderRange.getMaxY()));
336 aRight.append(basegfx::B2DPoint(aPageBorderRange.getMaxX(), aPageBorderRange.getMinY()));
337 aRight.append(basegfx::B2DPoint(aPageBorderRange.getMaxX(), aPageBorderRange.getMaxY()));
339 xRetval.realloc(2);
340 xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aLeft, aRGBBorderColor));
341 xRetval[1] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aRight, aRGBBorderColor));
343 else
345 xRetval.realloc(1);
346 const basegfx::B2DPolygon aPageBorderPolygon(basegfx::tools::createPolygonFromRect(aPageBorderRange));
347 xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor));
350 return xRetval;
353 ViewContactOfOuterPageBorder::ViewContactOfOuterPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
354 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
358 ViewContactOfOuterPageBorder::~ViewContactOfOuterPageBorder()
361 } // end of namespace contact
362 } // end of namespace sdr
364 //////////////////////////////////////////////////////////////////////////////
366 namespace sdr
368 namespace contact
370 ViewObjectContact& ViewContactOfInnerPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
372 ViewObjectContact* pRetval = new ViewObjectContactOfInnerPageBorder(rObjectContact, *this);
373 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
375 return *pRetval;
378 drawinglayer::primitive2d::Primitive2DSequence ViewContactOfInnerPageBorder::createViewIndependentPrimitive2DSequence() const
380 const SdrPage& rPage = getPage();
381 const basegfx::B2DRange aPageBorderRange(
382 (double)rPage.GetLftBorder(), (double)rPage.GetUppBorder(),
383 (double)(rPage.GetWdt() - rPage.GetRgtBorder()), (double)(rPage.GetHgt() - rPage.GetLwrBorder()));
384 const basegfx::B2DPolygon aPageBorderPolygon(basegfx::tools::createPolygonFromRect(aPageBorderRange));
386 // We have only the page information, not the view information. Use the
387 // svtools::FONTCOLOR or svtools::DOCBOUNDARIES color for initialisation
388 const svtools::ColorConfig aColorConfig;
389 Color aBorderColor;
391 if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
393 aBorderColor = aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor;
395 else
397 aBorderColor = aColorConfig.GetColorValue(svtools::DOCBOUNDARIES).nColor;
400 // create page outer border primitive
401 const basegfx::BColor aRGBBorderColor(aBorderColor.getBColor());
402 const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor));
404 return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
407 ViewContactOfInnerPageBorder::ViewContactOfInnerPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
408 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
412 ViewContactOfInnerPageBorder::~ViewContactOfInnerPageBorder()
415 } // end of namespace contact
416 } // end of namespace sdr
418 //////////////////////////////////////////////////////////////////////////////
420 namespace sdr
422 namespace contact
424 ViewObjectContact& ViewContactOfPageHierarchy::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
426 ViewObjectContact* pRetval = new ViewObjectContactOfPageHierarchy(rObjectContact, *this);
427 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
429 return *pRetval;
432 drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageHierarchy::createViewIndependentPrimitive2DSequence() const
434 // collect sub-hierarchy
435 drawinglayer::primitive2d::Primitive2DSequence xRetval;
436 const sal_uInt32 nObjectCount(GetObjectCount());
438 // collect all sub-primitives
439 for(sal_uInt32 a(0); a < nObjectCount; a++)
441 const ViewContact& rCandidate(GetViewContact(a));
442 const drawinglayer::primitive2d::Primitive2DSequence aCandSeq(rCandidate.getViewIndependentPrimitive2DSequence());
444 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq);
447 return xRetval;
450 ViewContactOfPageHierarchy::ViewContactOfPageHierarchy(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
451 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
455 ViewContactOfPageHierarchy::~ViewContactOfPageHierarchy()
459 sal_uInt32 ViewContactOfPageHierarchy::GetObjectCount() const
461 sal_uInt32 nSubObjectCount(getPage().GetObjCount());
463 if(nSubObjectCount && getPage().GetObj(0L)->IsMasterPageBackgroundObject())
465 nSubObjectCount--;
468 return nSubObjectCount;
471 ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const
473 if(getPage().GetObjCount() && getPage().GetObj(0L)->IsMasterPageBackgroundObject())
475 nIndex++;
478 SdrObject* pObj = getPage().GetObj(nIndex);
479 DBG_ASSERT(pObj, "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)");
480 return pObj->GetViewContact();
482 } // end of namespace contact
483 } // end of namespace sdr
485 //////////////////////////////////////////////////////////////////////////////
487 namespace sdr
489 namespace contact
491 ViewObjectContact& ViewContactOfGrid::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
493 ViewObjectContact* pRetval = new ViewObjectContactOfPageGrid(rObjectContact, *this);
494 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
496 return *pRetval;
499 drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGrid::createViewIndependentPrimitive2DSequence() const
501 // We have only the page information, not the view information and thus no grid settings. Create empty
502 // default. For the view-dependent implementation, see ViewObjectContactOfPageGrid::createPrimitive2DSequence
503 return drawinglayer::primitive2d::Primitive2DSequence();
506 ViewContactOfGrid::ViewContactOfGrid(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront)
507 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage),
508 mbFront(bFront)
512 ViewContactOfGrid::~ViewContactOfGrid()
515 } // end of namespace contact
516 } // end of namespace sdr
518 //////////////////////////////////////////////////////////////////////////////
520 namespace sdr
522 namespace contact
524 ViewObjectContact& ViewContactOfHelplines::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
526 ViewObjectContact* pRetval = new ViewObjectContactOfPageHelplines(rObjectContact, *this);
527 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
529 return *pRetval;
532 drawinglayer::primitive2d::Primitive2DSequence ViewContactOfHelplines::createViewIndependentPrimitive2DSequence() const
534 // We have only the page information, not the view information and thus no helplines. Create empty
535 // default. For the view-dependent implementation, see ViewObjectContactOfPageHelplines::createPrimitive2DSequence
536 return drawinglayer::primitive2d::Primitive2DSequence();
539 ViewContactOfHelplines::ViewContactOfHelplines(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront)
540 : ViewContactOfPageSubObject(rParentViewContactOfSdrPage),
541 mbFront(bFront)
545 ViewContactOfHelplines::~ViewContactOfHelplines()
548 } // end of namespace contact
549 } // end of namespace sdr
551 //////////////////////////////////////////////////////////////////////////////
553 namespace sdr
555 namespace contact
557 // Create a Object-Specific ViewObjectContact, set ViewContact and
558 // ObjectContact. Always needs to return something.
559 ViewObjectContact& ViewContactOfSdrPage::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
561 ViewObjectContact* pRetval = new ViewObjectContactOfSdrPage(rObjectContact, *this);
562 DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
564 return *pRetval;
567 ViewContactOfSdrPage::ViewContactOfSdrPage(SdrPage& rPage)
568 : ViewContact(),
569 mrPage(rPage),
570 maViewContactOfPageBackground(*this),
571 maViewContactOfPageShadow(*this),
572 maViewContactOfPageFill(*this),
573 maViewContactOfMasterPage(*this),
574 maViewContactOfOuterPageBorder(*this),
575 maViewContactOfInnerPageBorder(*this),
576 maViewContactOfGridBack(*this, false),
577 maViewContactOfHelplinesBack(*this, false),
578 maViewContactOfPageHierarchy(*this),
579 maViewContactOfGridFront(*this, true),
580 maViewContactOfHelplinesFront(*this, true)
584 ViewContactOfSdrPage::~ViewContactOfSdrPage()
588 // Access to possible sub-hierarchy
589 sal_uInt32 ViewContactOfSdrPage::GetObjectCount() const
591 // Fixed count of content. It contains PageBackground (Wiese), PageShadow, PageFill,
592 // then - depending on if the page has a MasterPage - either MasterPage Hierarchy
593 // or MPBGO. Also OuterPageBorder, InnerPageBorder and two pairs of Grid and Helplines
594 // (for front and back) which internally are visible or not depending on the current
595 // front/back setting for those.
596 return 11;
599 ViewContact& ViewContactOfSdrPage::GetViewContact(sal_uInt32 nIndex) const
601 switch(nIndex)
603 case 0: return (ViewContact&)maViewContactOfPageBackground;
604 case 1: return (ViewContact&)maViewContactOfPageShadow;
605 case 2: return (ViewContact&)maViewContactOfPageFill;
606 case 3:
608 const SdrPage& rPage = GetSdrPage();
610 if(rPage.TRG_HasMasterPage())
612 return rPage.TRG_GetMasterPageDescriptorViewContact();
614 else
616 return (ViewContact&)maViewContactOfMasterPage;
619 case 4: return (ViewContact&)maViewContactOfOuterPageBorder;
620 case 5: return (ViewContact&)maViewContactOfInnerPageBorder;
621 case 6: return (ViewContact&)maViewContactOfGridBack;
622 case 7: return (ViewContact&)maViewContactOfHelplinesBack;
623 case 8: return (ViewContact&)maViewContactOfPageHierarchy;
624 case 9: return (ViewContact&)maViewContactOfGridFront;
625 default: return (ViewContact&)maViewContactOfHelplinesFront;
629 // React on changes of the object of this ViewContact
630 void ViewContactOfSdrPage::ActionChanged()
632 // call parent
633 ViewContact::ActionChanged();
635 // apply to local viewContacts, they all rely on page information. Exception
636 // is the sub hierarchy; this will not be influenced by the change
637 maViewContactOfPageBackground.ActionChanged();
638 maViewContactOfPageShadow.ActionChanged();
639 maViewContactOfPageFill.ActionChanged();
641 const SdrPage& rPage = GetSdrPage();
643 if(rPage.TRG_HasMasterPage())
645 rPage.TRG_GetMasterPageDescriptorViewContact().ActionChanged();
647 else if(rPage.IsMasterPage())
649 maViewContactOfMasterPage.ActionChanged();
652 maViewContactOfOuterPageBorder.ActionChanged();
653 maViewContactOfInnerPageBorder.ActionChanged();
654 maViewContactOfGridBack.ActionChanged();
655 maViewContactOfHelplinesBack.ActionChanged();
656 maViewContactOfGridFront.ActionChanged();
657 maViewContactOfHelplinesFront.ActionChanged();
660 // overload for acessing the SdrPage
661 SdrPage* ViewContactOfSdrPage::TryToGetSdrPage() const
663 return &GetSdrPage();
666 drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPage::createViewIndependentPrimitive2DSequence() const
668 drawinglayer::primitive2d::Primitive2DSequence xRetval;
670 // collect all sub-sequences including sub hierarchy.
671 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageBackground.getViewIndependentPrimitive2DSequence());
672 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageShadow.getViewIndependentPrimitive2DSequence());
673 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageFill.getViewIndependentPrimitive2DSequence());
675 const SdrPage& rPage = GetSdrPage();
677 if(rPage.TRG_HasMasterPage())
679 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
680 rPage.TRG_GetMasterPageDescriptorViewContact().getViewIndependentPrimitive2DSequence());
682 else if(rPage.IsMasterPage())
684 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
685 maViewContactOfMasterPage.getViewIndependentPrimitive2DSequence());
688 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfOuterPageBorder.getViewIndependentPrimitive2DSequence());
689 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfInnerPageBorder.getViewIndependentPrimitive2DSequence());
690 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageHierarchy.getViewIndependentPrimitive2DSequence());
692 // Only add front versions of grid and helplines since no visibility test is done,
693 // so adding the back incarnations is not necessary. This makes the Front
694 // visualisation the default when no visibility tests are done.
696 // Since we have no view here, no grid and helpline definitions are available currently. The used
697 // methods at ViewContactOfHelplines and ViewContactOfGrid return only empty sequences and
698 // do not need to be called ATM. This may change later if grid or helpline info gets
699 // model data (it should not). Keeping the lines commented to hold this hint.
701 // drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfGridFront.getViewIndependentPrimitive2DSequence());
702 // drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfHelplinesFront.getViewIndependentPrimitive2DSequence());
704 return xRetval;
706 } // end of namespace contact
707 } // end of namespace sdr
709 //////////////////////////////////////////////////////////////////////////////
710 // eof