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