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