1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_svx.hxx"
30 
31 #include <svx/sdr/contact/viewobjectcontactofsdrpage.hxx>
32 #include <svx/sdr/contact/displayinfo.hxx>
33 #include <svx/sdr/contact/viewcontactofsdrpage.hxx>
34 #include <svx/svdview.hxx>
35 #include <svx/svdpage.hxx>
36 #include <svx/sdr/contact/objectcontact.hxx>
37 #include <drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx>
38 #include <basegfx/polygon/b2dpolygontools.hxx>
39 #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
40 #include <drawinglayer/primitive2d/gridprimitive2d.hxx>
41 #include <drawinglayer/primitive2d/helplineprimitive2d.hxx>
42 #include <basegfx/polygon/b2dpolygon.hxx>
43 #include <svx/sdr/primitive2d/sdrprimitivetools.hxx>
44 
45 //////////////////////////////////////////////////////////////////////////////
46 
47 using namespace com::sun::star;
48 
49 //////////////////////////////////////////////////////////////////////////////
50 
51 namespace sdr
52 {
53 	namespace contact
54 	{
55 		const SdrPage& ViewObjectContactOfPageSubObject::getPage() const
56 		{
57 			return static_cast< ViewContactOfPageSubObject& >(GetViewContact()).getPage();
58 		}
59 
60 		ViewObjectContactOfPageSubObject::ViewObjectContactOfPageSubObject(ObjectContact& rObjectContact, ViewContact& rViewContact)
61 		:	ViewObjectContact(rObjectContact, rViewContact)
62 		{
63 		}
64 
65 		ViewObjectContactOfPageSubObject::~ViewObjectContactOfPageSubObject()
66 		{
67 		}
68 
69 		bool ViewObjectContactOfPageSubObject::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
70 		{
71             if(rDisplayInfo.GetSubContentActive())
72             {
73                 return false;
74             }
75 
76             if(rDisplayInfo.GetControlLayerProcessingActive())
77             {
78                 return false;
79             }
80 
81             if(!rDisplayInfo.GetPageProcessingActive())
82             {
83                 return false;
84             }
85 
86             if(GetObjectContact().isOutputToPrinter())
87             {
88                 return false;
89             }
90 
91             if(!GetObjectContact().TryToGetSdrPageView())
92             {
93                 return false;
94             }
95 
96             return true;
97 		}
98 
99 		bool ViewObjectContactOfPageSubObject::isPrimitiveGhosted(const DisplayInfo& /*rDisplayInfo*/) const
100 		{
101 			// suppress ghosted for page parts
102 			return false;
103 		}
104 	} // end of namespace contact
105 } // end of namespace sdr
106 
107 //////////////////////////////////////////////////////////////////////////////
108 
109 namespace sdr
110 {
111 	namespace contact
112 	{
113 		ViewObjectContactOfPageBackground::ViewObjectContactOfPageBackground(ObjectContact& rObjectContact, ViewContact& rViewContact)
114 		:	ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
115 		{
116 		}
117 
118 		ViewObjectContactOfPageBackground::~ViewObjectContactOfPageBackground()
119 		{
120 		}
121 
122 		bool ViewObjectContactOfPageBackground::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
123 		{
124 			if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
125 			{
126 				return false;
127 			}
128 
129 			// no page background for preview renderers
130 			if(GetObjectContact().IsPreviewRenderer())
131 			{
132 				return false;
133 			}
134 
135 			return true;
136 		}
137 
138 		drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageBackground::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const
139 		{
140 			// Initialize background. Dependent of IsPageVisible, use ApplicationBackgroundColor or ApplicationDocumentColor. Most
141 			// old renderers for export (html, pdf, gallery, ...) set the page to not visible (SetPageVisible(false)). They expect the
142 			// given OutputDevice to be initialized with the ApplicationDocumentColor then.
143 			const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
144             drawinglayer::primitive2d::Primitive2DSequence xRetval;
145 
146             if(pPageView)
147             {
148 			    const SdrView& rView = pPageView->GetView();
149 			    Color aInitColor;
150 
151 			    if(rView.IsPageVisible())
152 			    {
153 				    aInitColor = pPageView->GetApplicationBackgroundColor();
154 			    }
155 			    else
156 			    {
157 				    aInitColor = pPageView->GetApplicationDocumentColor();
158 
159 				    if(Color(COL_AUTO) == aInitColor)
160 				    {
161 						const svtools::ColorConfig aColorConfig;
162 					    aInitColor = aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor;
163 				    }
164 			    }
165 
166 			    // init background with InitColor
167                 xRetval.realloc(1);
168 			    const basegfx::BColor aRGBColor(aInitColor.getBColor());
169 			    xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor));
170             }
171 
172             return xRetval;
173 		}
174 	} // end of namespace contact
175 } // end of namespace sdr
176 
177 //////////////////////////////////////////////////////////////////////////////
178 
179 namespace sdr
180 {
181 	namespace contact
182 	{
183 		ViewObjectContactOfMasterPage::ViewObjectContactOfMasterPage(ObjectContact& rObjectContact, ViewContact& rViewContact)
184 		:	ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
185 		{
186 		}
187 
188 		ViewObjectContactOfMasterPage::~ViewObjectContactOfMasterPage()
189 		{
190 		}
191 
192 		bool ViewObjectContactOfMasterPage::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
193 		{
194 			if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
195 			{
196 				return false;
197 			}
198 
199 			// this object is only used for MasterPages. When not the MasterPage is
200 			// displayed as a page, but another page is using it as sub-object, the
201 			// geometry needs to be hidden
202 			if(rDisplayInfo.GetSubContentActive())
203 			{
204 				return false;
205 			}
206 
207 			return true;
208 		}
209 	} // end of namespace contact
210 } // end of namespace sdr
211 
212 //////////////////////////////////////////////////////////////////////////////
213 
214 namespace sdr
215 {
216 	namespace contact
217 	{
218 		ViewObjectContactOfPageFill::ViewObjectContactOfPageFill(ObjectContact& rObjectContact, ViewContact& rViewContact)
219 		:	ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
220 		{
221 		}
222 
223 		ViewObjectContactOfPageFill::~ViewObjectContactOfPageFill()
224 		{
225 		}
226 
227 		bool ViewObjectContactOfPageFill::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
228 		{
229 			if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
230 			{
231 				return false;
232 			}
233 
234             SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
235 
236             if(!pSdrPageView)
237             {
238                 return false;
239             }
240 
241 			if(!pSdrPageView->GetView().IsPageVisible())
242 			{
243 				return false;
244 			}
245 
246 			return true;
247 		}
248 
249 		drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageFill::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const
250 		{
251 			const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
252             drawinglayer::primitive2d::Primitive2DSequence xRetval;
253 
254             if(pPageView)
255             {
256 			    const SdrPage& rPage = getPage();
257 
258 			    const basegfx::B2DRange aPageFillRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt());
259 			    const basegfx::B2DPolygon aPageFillPolygon(basegfx::tools::createPolygonFromRect(aPageFillRange));
260 			    Color aPageFillColor;
261 
262 			    if(pPageView->GetApplicationDocumentColor() != COL_AUTO)
263 			    {
264 				    aPageFillColor = pPageView->GetApplicationDocumentColor();
265 			    }
266 			    else
267 			    {
268 					const svtools::ColorConfig aColorConfig;
269 				    aPageFillColor = aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor;
270 			    }
271 
272 			    // create and add primitive
273                 xRetval.realloc(1);
274 			    const basegfx::BColor aRGBColor(aPageFillColor.getBColor());
275 			    xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPageFillPolygon), aRGBColor));
276             }
277 
278             return xRetval;
279 		}
280 	} // end of namespace contact
281 } // end of namespace sdr
282 
283 //////////////////////////////////////////////////////////////////////////////
284 
285 namespace sdr
286 {
287 	namespace contact
288 	{
289 		ViewObjectContactOfPageShadow::ViewObjectContactOfPageShadow(ObjectContact& rObjectContact, ViewContact& rViewContact)
290 		:	ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
291 		{
292 		}
293 
294 		ViewObjectContactOfPageShadow::~ViewObjectContactOfPageShadow()
295 		{
296 		}
297 
298 		bool ViewObjectContactOfPageShadow::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
299 		{
300 			if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
301 			{
302 				return false;
303 			}
304 
305             SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
306 
307             if(!pSdrPageView)
308             {
309                 return false;
310             }
311 
312 			if(!pSdrPageView->GetView().IsPageVisible())
313 			{
314 				return false;
315 			}
316 
317 			// no page shadow for preview renderers
318 			if(GetObjectContact().IsPreviewRenderer())
319 			{
320 				return false;
321 			}
322 
323 			// no page shadow for high contrast mode
324 			if(GetObjectContact().isDrawModeHighContrast())
325 			{
326 				return false;
327 			}
328 
329 			return true;
330 		}
331 	} // end of namespace contact
332 } // end of namespace sdr
333 
334 //////////////////////////////////////////////////////////////////////////////
335 
336 namespace sdr
337 {
338 	namespace contact
339 	{
340 		ViewObjectContactOfOuterPageBorder::ViewObjectContactOfOuterPageBorder(ObjectContact& rObjectContact, ViewContact& rViewContact)
341 		:	ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
342 		{
343 		}
344 
345 		ViewObjectContactOfOuterPageBorder::~ViewObjectContactOfOuterPageBorder()
346 		{
347 		}
348 
349 		bool ViewObjectContactOfOuterPageBorder::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
350 		{
351 			if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
352 			{
353 				return false;
354 			}
355 
356             SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
357 
358             if(!pSdrPageView)
359             {
360                 return false;
361             }
362 
363             const SdrView& rView = pSdrPageView->GetView();
364 
365             if(!rView.IsPageVisible() && rView.IsPageBorderVisible())
366 			{
367 				return false;
368 			}
369 
370 			return true;
371 		}
372 	} // end of namespace contact
373 } // end of namespace sdr
374 
375 //////////////////////////////////////////////////////////////////////////////
376 
377 namespace sdr
378 {
379 	namespace contact
380 	{
381 		ViewObjectContactOfInnerPageBorder::ViewObjectContactOfInnerPageBorder(ObjectContact& rObjectContact, ViewContact& rViewContact)
382 		:	ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
383 		{
384 		}
385 
386 		ViewObjectContactOfInnerPageBorder::~ViewObjectContactOfInnerPageBorder()
387 		{
388 		}
389 
390 		bool ViewObjectContactOfInnerPageBorder::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
391 		{
392 			if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
393 			{
394 				return false;
395 			}
396 
397             SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
398 
399             if(!pSdrPageView)
400             {
401                 return false;
402             }
403 
404             if(!pSdrPageView->GetView().IsBordVisible())
405 			{
406 				return false;
407 			}
408 
409 			const SdrPage& rPage = getPage();
410 
411             if(!rPage.GetLftBorder() && !rPage.GetUppBorder() && !rPage.GetRgtBorder() && !rPage.GetLwrBorder())
412 			{
413 				return false;
414 			}
415 
416 			// no inner page border for preview renderers
417 			if(GetObjectContact().IsPreviewRenderer())
418 			{
419 				return false;
420 			}
421 
422 			return true;
423 		}
424 	} // end of namespace contact
425 } // end of namespace sdr
426 
427 //////////////////////////////////////////////////////////////////////////////
428 
429 namespace sdr
430 {
431 	namespace contact
432 	{
433 		ViewObjectContactOfPageHierarchy::ViewObjectContactOfPageHierarchy(ObjectContact& rObjectContact, ViewContact& rViewContact)
434 		:	ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
435 		{
436 		}
437 
438 		ViewObjectContactOfPageHierarchy::~ViewObjectContactOfPageHierarchy()
439 		{
440 		}
441 
442 		drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageHierarchy::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const
443 		{
444 			drawinglayer::primitive2d::Primitive2DSequence xRetval;
445 
446 			// process local sub-hierarchy
447 			const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
448 
449 			if(nSubHierarchyCount)
450 			{
451 				xRetval = getPrimitive2DSequenceSubHierarchy(rDisplayInfo);
452 
453 				if(xRetval.hasElements())
454 				{
455 					// get ranges
456 					const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
457 					const basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D));
458 					const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
459 
460 					// check geometrical visibility
461 					if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange))
462 					{
463 						// not visible, release
464 						xRetval.realloc(0);
465 					}
466 				}
467 			}
468 
469 			return xRetval;
470 		}
471 	} // end of namespace contact
472 } // end of namespace sdr
473 
474 //////////////////////////////////////////////////////////////////////////////
475 
476 namespace sdr
477 {
478 	namespace contact
479 	{
480 		ViewObjectContactOfPageGrid::ViewObjectContactOfPageGrid(ObjectContact& rObjectContact, ViewContact& rViewContact)
481 		:	ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
482 		{
483 		}
484 
485 		ViewObjectContactOfPageGrid::~ViewObjectContactOfPageGrid()
486 		{
487 		}
488 
489 		bool ViewObjectContactOfPageGrid::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
490 		{
491 			if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
492 			{
493 				return false;
494 			}
495 
496             SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
497 
498             if(!pSdrPageView)
499             {
500                 return false;
501             }
502 
503 			const SdrView& rView = pSdrPageView->GetView();
504 
505             if(!rView.IsGridVisible())
506 			{
507 				return false;
508 			}
509 
510 			// no page grid for preview renderers
511 			if(GetObjectContact().IsPreviewRenderer())
512 			{
513 				return false;
514 			}
515 
516 			if(static_cast< ViewContactOfGrid& >(GetViewContact()).getFront() != (bool)rView.IsGridFront())
517 			{
518 				return false;
519 			}
520 
521 			return true;
522 		}
523 
524 		drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageGrid::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const
525 		{
526 			const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
527             drawinglayer::primitive2d::Primitive2DSequence xRetval;
528 
529             if(pPageView)
530             {
531 			    const SdrView& rView = pPageView->GetView();
532 			    const SdrPage& rPage = getPage();
533 			    const Color aGridColor(rView.GetGridColor());
534 			    const basegfx::BColor aRGBGridColor(aGridColor.getBColor());
535 
536 			    basegfx::B2DHomMatrix aGridMatrix;
537 			    aGridMatrix.set(0, 0, (double)(rPage.GetWdt() - (rPage.GetRgtBorder() + rPage.GetLftBorder())));
538 			    aGridMatrix.set(1, 1, (double)(rPage.GetHgt() - (rPage.GetLwrBorder() + rPage.GetUppBorder())));
539 			    aGridMatrix.set(0, 2, (double)rPage.GetLftBorder());
540 			    aGridMatrix.set(1, 2, (double)rPage.GetUppBorder());
541 
542 			    const Size aRaw(rView.GetGridCoarse());
543 			    const Size aFine(rView.GetGridFine());
544 			    const double fWidthX(aRaw.getWidth());
545 			    const double fWidthY(aRaw.getHeight());
546 			    const sal_uInt32 nSubdivisionsX(aFine.getWidth() ? aRaw.getWidth() / aFine.getWidth() : 0L);
547 			    const sal_uInt32 nSubdivisionsY(aFine.getHeight() ? aRaw.getHeight() / aFine.getHeight() : 0L);
548 
549                 xRetval.realloc(1);
550 			    xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::GridPrimitive2D(
551 					aGridMatrix, fWidthX, fWidthY, 10.0, 3.0, nSubdivisionsX, nSubdivisionsY, aRGBGridColor,
552 					drawinglayer::primitive2d::createDefaultCross_3x3(aRGBGridColor)));
553             }
554 
555             return xRetval;
556 		}
557 	} // end of namespace contact
558 } // end of namespace sdr
559 
560 //////////////////////////////////////////////////////////////////////////////
561 
562 namespace sdr
563 {
564 	namespace contact
565 	{
566 		ViewObjectContactOfPageHelplines::ViewObjectContactOfPageHelplines(ObjectContact& rObjectContact, ViewContact& rViewContact)
567 		:	ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
568 		{
569 		}
570 
571 		ViewObjectContactOfPageHelplines::~ViewObjectContactOfPageHelplines()
572 		{
573 		}
574 
575 		bool ViewObjectContactOfPageHelplines::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const
576 		{
577 			if(!ViewObjectContactOfPageSubObject::isPrimitiveVisible(rDisplayInfo))
578 			{
579 				return false;
580 			}
581 
582             SdrPageView* pSdrPageView = GetObjectContact().TryToGetSdrPageView();
583 
584             if(!pSdrPageView)
585             {
586                 return false;
587             }
588 
589 			const SdrView& rView = pSdrPageView->GetView();
590 
591             if(!rView.IsHlplVisible())
592 			{
593 				return false;
594 			}
595 
596 			// no helplines for preview renderers
597 			if(GetObjectContact().IsPreviewRenderer())
598 			{
599 				return false;
600 			}
601 
602 			if(static_cast< ViewContactOfHelplines& >(GetViewContact()).getFront() != (bool)rView.IsHlplFront())
603 			{
604 				return false;
605 			}
606 
607 			return true;
608 		}
609 
610 		drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfPageHelplines::createPrimitive2DSequence(const DisplayInfo& /*rDisplayInfo*/) const
611 		{
612 			drawinglayer::primitive2d::Primitive2DSequence xRetval;
613 			const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
614 
615             if(pPageView)
616             {
617 			    const SdrHelpLineList& rHelpLineList = pPageView->GetHelpLines();
618 			    const sal_uInt32 nCount(rHelpLineList.GetCount());
619 
620 			    if(nCount)
621 			    {
622 				    const basegfx::BColor aRGBColorA(1.0, 1.0, 1.0);
623 				    const basegfx::BColor aRGBColorB(0.0, 0.0, 0.0);
624                     xRetval.realloc(nCount);
625 
626 				    for(sal_uInt32 a(0L); a < nCount; a++)
627 				    {
628 					    const SdrHelpLine& rHelpLine = rHelpLineList[(sal_uInt16)a];
629 					    const basegfx::B2DPoint aPosition((double)rHelpLine.GetPos().X(), (double)rHelpLine.GetPos().Y());
630                         const double fDiscreteDashLength(4.0);
631 
632 					    switch(rHelpLine.GetKind())
633 					    {
634 						    default : // SDRHELPLINE_POINT
635 						    {
636 							    xRetval[a] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::HelplinePrimitive2D(
637 								    aPosition, basegfx::B2DVector(1.0, 0.0), drawinglayer::primitive2d::HELPLINESTYLE2D_POINT,
638 								    aRGBColorA, aRGBColorB, fDiscreteDashLength));
639 							    break;
640 						    }
641 						    case SDRHELPLINE_VERTICAL :
642 						    {
643 							    xRetval[a] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::HelplinePrimitive2D(
644 								    aPosition, basegfx::B2DVector(0.0, 1.0), drawinglayer::primitive2d::HELPLINESTYLE2D_LINE,
645 								    aRGBColorA, aRGBColorB, fDiscreteDashLength));
646 							    break;
647 						    }
648 						    case SDRHELPLINE_HORIZONTAL :
649 						    {
650 							    xRetval[a] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::HelplinePrimitive2D(
651 								    aPosition, basegfx::B2DVector(1.0, 0.0), drawinglayer::primitive2d::HELPLINESTYLE2D_LINE,
652 								    aRGBColorA, aRGBColorB, fDiscreteDashLength));
653 							    break;
654 						    }
655 					    }
656 				    }
657 			    }
658             }
659 
660 			return xRetval;
661 		}
662 	} // end of namespace contact
663 } // end of namespace sdr
664 
665 //////////////////////////////////////////////////////////////////////////////
666 
667 namespace sdr
668 {
669 	namespace contact
670 	{
671 		ViewObjectContactOfSdrPage::ViewObjectContactOfSdrPage(ObjectContact& rObjectContact, ViewContact& rViewContact)
672 		:	ViewObjectContact(rObjectContact, rViewContact)
673 		{
674 		}
675 
676 		ViewObjectContactOfSdrPage::~ViewObjectContactOfSdrPage()
677 		{
678 		}
679 
680 		drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfSdrPage::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const
681 		{
682 			drawinglayer::primitive2d::Primitive2DSequence xRetval;
683 
684 			// process local sub-hierarchy
685 			const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
686 
687 			if(nSubHierarchyCount)
688 			{
689 				const sal_Bool bDoGhostedDisplaying(
690 					GetObjectContact().DoVisualizeEnteredGroup()
691 					&& !GetObjectContact().isOutputToPrinter()
692 					&& GetObjectContact().getActiveViewContact() == &GetViewContact());
693 
694 				if(bDoGhostedDisplaying)
695 				{
696 					rDisplayInfo.ClearGhostedDrawMode();
697 				}
698 
699 				// create object hierarchy
700 				xRetval = getPrimitive2DSequenceSubHierarchy(rDisplayInfo);
701 
702 				if(xRetval.hasElements())
703 				{
704 					// get ranges
705 					const drawinglayer::geometry::ViewInformation2D& rViewInformation2D(GetObjectContact().getViewInformation2D());
706 					const basegfx::B2DRange aObjectRange(drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(xRetval, rViewInformation2D));
707 					const basegfx::B2DRange aViewRange(rViewInformation2D.getViewport());
708 
709 					// check geometrical visibility
710 					if(!aViewRange.isEmpty() && !aViewRange.overlaps(aObjectRange))
711 					{
712 						// not visible, release
713 						xRetval.realloc(0);
714 					}
715 				}
716 
717 				if(bDoGhostedDisplaying)
718 				{
719 					rDisplayInfo.SetGhostedDrawMode();
720 				}
721 			}
722 
723 			return xRetval;
724 		}
725 	} // end of namespace contact
726 } // end of namespace sdr
727 
728 //////////////////////////////////////////////////////////////////////////////
729 // eof
730