LibreOffice Module svx (master) 1
viewobjectcontactofsdrpage.cxx
Go to the documentation of this file.
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
24#include <svx/svdview.hxx>
25#include <svx/svdpage.hxx>
26#include <svx/svdpagv.hxx>
35
36using namespace com::sun::star;
37
38namespace sdr::contact {
39
41{
42 return static_cast< ViewContactOfPageSubObject& >(GetViewContact()).getPage();
43}
44
46: ViewObjectContact(rObjectContact, rViewContact)
47{
48}
49
51{
52}
53
55{
56 if(rDisplayInfo.GetSubContentActive())
57 {
58 return false;
59 }
60
61 if(rDisplayInfo.GetControlLayerProcessingActive())
62 {
63 return false;
64 }
65
66 if(!GetObjectContact().isPageDecorationActive())
67 {
68 return false;
69 }
70
71 if(GetObjectContact().isOutputToPrinter())
72 {
73 return false;
74 }
75
76 if(!GetObjectContact().TryToGetSdrPageView())
77 {
78 return false;
79 }
80
81 return true;
82}
83
85{
86 // suppress ghosted for page parts
87 return false;
88}
89
91: ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
92{
93}
94
96{
97}
98
100{
102 {
103 return false;
104 }
105
106 // no page background for preview renderers
107 if(GetObjectContact().IsPreviewRenderer())
108 {
109 return false;
110 }
111
112 return true;
113}
114
116{
117 // Initialize background. Dependent of IsPageVisible, use ApplicationBackgroundColor or ApplicationDocumentColor. Most
118 // old renderers for export (html, pdf, gallery, ...) set the page to not visible (SetPageVisible(false)). They expect the
119 // given OutputDevice to be initialized with the ApplicationDocumentColor then.
120 const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
121
122 if(pPageView)
123 {
124 const SdrView& rView = pPageView->GetView();
125 Color aInitColor;
126
127 if(rView.IsPageVisible())
128 {
129 aInitColor = pPageView->GetApplicationBackgroundColor();
130 }
131 else
132 {
133 aInitColor = pPageView->GetApplicationDocumentColor();
134
135 if(COL_AUTO == aInitColor)
136 {
137 const svtools::ColorConfig aColorConfig;
138 aInitColor = aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor;
139 }
140 }
141
142 // init background with InitColor
143 const basegfx::BColor aRGBColor(aInitColor.getBColor());
144 rVisitor.visit(new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor, (255 - aInitColor.GetAlpha()) / 255.0));
145 }
146}
147
149: ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
150{
151}
152
154{
155}
156
158{
160 {
161 return false;
162 }
163
164 // this object is only used for MasterPages. When not the MasterPage is
165 // displayed as a page, but another page is using it as sub-object, the
166 // geometry needs to be hidden
167 if(rDisplayInfo.GetSubContentActive())
168 {
169 return false;
170 }
171
172 return true;
173}
174
176: ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
177{
178}
179
181{
182}
183
185{
187 {
188 return false;
189 }
190
192
193 if(!pSdrPageView)
194 {
195 return false;
196 }
197
198 if(!pSdrPageView->GetView().IsPageVisible())
199 {
200 return false;
201 }
202
203 return true;
204}
205
207{
208 const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
209
210 if(pPageView)
211 {
212 const SdrPage& rPage = getPage();
213
214 const basegfx::B2DRange aPageFillRange(0.0, 0.0, static_cast<double>(rPage.GetWidth()), static_cast<double>(rPage.GetHeight()));
215 const basegfx::B2DPolygon aPageFillPolygon(basegfx::utils::createPolygonFromRect(aPageFillRange));
216 Color aPageFillColor;
217
218 if(pPageView->GetApplicationDocumentColor() != COL_AUTO)
219 {
220 aPageFillColor = pPageView->GetApplicationDocumentColor();
221 }
222 else
223 {
224 const svtools::ColorConfig aColorConfig;
225 aPageFillColor = aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor;
226 }
227
228 // create and add primitive
229 const basegfx::BColor aRGBColor(aPageFillColor.getBColor());
231 }
232}
233
235: ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
236{
237}
238
240{
241}
242
244{
246 {
247 return false;
248 }
249
251
252 if(!pSdrPageView)
253 {
254 return false;
255 }
256
257 if(!pSdrPageView->GetView().IsPageVisible())
258 {
259 return false;
260 }
261
262 if(!pSdrPageView->GetView().IsPageShadowVisible())
263 {
264 return false;
265 }
266
267 // no page shadow for preview renderers
268 if(GetObjectContact().IsPreviewRenderer())
269 {
270 return false;
271 }
272
273 // no page shadow for high contrast mode
274 if(GetObjectContact().isDrawModeHighContrast())
275 {
276 return false;
277 }
278
279 return true;
280}
281
283: ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
284{
285}
286
288{
289}
290
292{
294 {
295 return false;
296 }
297
299
300 if(!pSdrPageView)
301 {
302 return false;
303 }
304
305 const SdrView& rView = pSdrPageView->GetView();
306
307 return rView.IsPageVisible() || !rView.IsPageBorderVisible();
308}
309
311: ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
312{
313}
314
316{
317}
318
320{
322 {
323 return false;
324 }
325
327
328 if(!pSdrPageView)
329 {
330 return false;
331 }
332
333 if(!pSdrPageView->GetView().IsBordVisible())
334 {
335 return false;
336 }
337
338 const SdrPage& rPage = getPage();
339
340 if(!rPage.GetLeftBorder() && !rPage.GetUpperBorder() && !rPage.GetRightBorder() && !rPage.GetLowerBorder())
341 {
342 return false;
343 }
344
345 // no inner page border for preview renderers
346 if(GetObjectContact().IsPreviewRenderer())
347 {
348 return false;
349 }
350
351 return true;
352}
353
355: ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
356{
357}
358
360{
361}
362
364{
365 // process local sub-hierarchy
366 const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
367
368 if(!nSubHierarchyCount)
369 return;
370
371 getPrimitive2DSequenceSubHierarchy(rDisplayInfo, rVisitor);
372}
373
375: ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
376{
377}
378
380{
381}
382
384{
386 {
387 return false;
388 }
389
391
392 if(!pSdrPageView)
393 {
394 return false;
395 }
396
397 const SdrView& rView = pSdrPageView->GetView();
398
399 if(!rView.IsGridVisible())
400 {
401 return false;
402 }
403
404 // no page grid for preview renderers
405 if(GetObjectContact().IsPreviewRenderer())
406 {
407 return false;
408 }
409
410 if(static_cast< ViewContactOfGrid& >(GetViewContact()).getFront() != rView.IsGridFront())
411 {
412 return false;
413 }
414
415 return true;
416}
417
419{
420 const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
421
422 if(pPageView)
423 {
424 const SdrView& rView = pPageView->GetView();
425 const SdrPage& rPage = getPage();
426 const Color aGridColor(rView.GetGridColor());
427 const basegfx::BColor aRGBGridColor(aGridColor.getBColor());
428
429 basegfx::B2DHomMatrix aGridMatrix;
430 aGridMatrix.set(0, 0, static_cast<double>(rPage.GetWidth() - (rPage.GetRightBorder() + rPage.GetLeftBorder())));
431 aGridMatrix.set(1, 1, static_cast<double>(rPage.GetHeight() - (rPage.GetLowerBorder() + rPage.GetUpperBorder())));
432 aGridMatrix.set(0, 2, static_cast<double>(rPage.GetLeftBorder()));
433 aGridMatrix.set(1, 2, static_cast<double>(rPage.GetUpperBorder()));
434
435 const Size aRaw(rView.GetGridCoarse());
436 const Size aFine(rView.GetGridFine());
437 const double fWidthX(aRaw.getWidth());
438 const double fWidthY(aRaw.getHeight());
439 const sal_uInt32 nSubdivisionsX(aFine.getWidth() ? aRaw.getWidth() / aFine.getWidth() : 0);
440 const sal_uInt32 nSubdivisionsY(aFine.getHeight() ? aRaw.getHeight() / aFine.getHeight() : 0);
441
443 aGridMatrix, fWidthX, fWidthY, 10.0, 3.0, nSubdivisionsX, nSubdivisionsY, aRGBGridColor,
445 }
446}
447
449: ViewObjectContactOfPageSubObject(rObjectContact, rViewContact)
450{
451}
452
454{
455}
456
458{
460 {
461 return false;
462 }
463
465
466 if(!pSdrPageView)
467 {
468 return false;
469 }
470
471 const SdrView& rView = pSdrPageView->GetView();
472
473 if(!rView.IsHlplVisible())
474 {
475 return false;
476 }
477
478 // no helplines for preview renderers
479 if(GetObjectContact().IsPreviewRenderer())
480 {
481 return false;
482 }
483
484 if(static_cast< ViewContactOfHelplines& >(GetViewContact()).getFront() != rView.IsHlplFront())
485 {
486 return false;
487 }
488
489 return true;
490}
491
493{
494 const SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
495
496 if(pPageView)
497 {
498 const SdrHelpLineList& rHelpLineList = pPageView->GetHelpLines();
499 const sal_uInt32 nCount(rHelpLineList.GetCount());
500
501 if(nCount)
502 {
503 const basegfx::BColor aRGBColorA(1.0, 1.0, 1.0);
504 const basegfx::BColor aRGBColorB(0.0, 0.0, 0.0);
505
506 for(sal_uInt32 a(0); a < nCount; a++)
507 {
508 const SdrHelpLine& rHelpLine = rHelpLineList[static_cast<sal_uInt16>(a)];
509 const basegfx::B2DPoint aPosition(static_cast<double>(rHelpLine.GetPos().X()), static_cast<double>(rHelpLine.GetPos().Y()));
510 const double fDiscreteDashLength(4.0);
511
512 switch(rHelpLine.GetKind())
513 {
514 default : // SdrHelpLineKind::Point
515 {
518 aRGBColorA, aRGBColorB, fDiscreteDashLength));
519 break;
520 }
522 {
525 aRGBColorA, aRGBColorB, fDiscreteDashLength));
526 break;
527 }
529 {
532 aRGBColorA, aRGBColorB, fDiscreteDashLength));
533 break;
534 }
535 }
536 }
537 }
538 }
539}
540
542: ViewObjectContact(rObjectContact, rViewContact)
543{
544}
545
547{
548}
549
551{
552 // process local sub-hierarchy
553 const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount());
554
555 if(!nSubHierarchyCount)
556 return;
557
558 const bool bDoGhostedDisplaying(
559 GetObjectContact().DoVisualizeEnteredGroup()
560 && !GetObjectContact().isOutputToPrinter()
561 && GetObjectContact().getActiveViewContact() == &GetViewContact());
562
563 if(bDoGhostedDisplaying)
564 {
565 rDisplayInfo.ClearGhostedDrawMode();
566 }
567
568 // visit object hierarchy
569 getPrimitive2DSequenceSubHierarchy(rDisplayInfo, rVisitor);
570
571 if(bDoGhostedDisplaying)
572 {
573 rDisplayInfo.SetGhostedDrawMode();
574 }
575}
576
577}
578
579/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
basegfx::BColor getBColor() const
sal_uInt8 GetAlpha() const
constexpr tools::Long Y() const
constexpr tools::Long X() const
sal_uInt16 GetCount() const
Definition: svdhlpln.hxx:70
const Point & GetPos() const
Definition: svdhlpln.hxx:51
SdrHelpLineKind GetKind() const
Definition: svdhlpln.hxx:49
SdrView & GetView()
Definition: svdpagv.hxx:130
const SdrHelpLineList & GetHelpLines() const
Definition: svdpagv.hxx:216
const Color & GetApplicationBackgroundColor() const
Definition: svdpagv.hxx:247
const Color & GetApplicationDocumentColor() const
Definition: svdpagv.hxx:251
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:379
sal_Int32 GetUpperBorder() const
Definition: svdpage.cxx:1561
sal_Int32 GetRightBorder() const
Definition: svdpage.cxx:1566
sal_Int32 GetLeftBorder() const
Definition: svdpage.cxx:1556
sal_Int32 GetLowerBorder() const
Definition: svdpage.cxx:1571
tools::Long GetHeight() const
Definition: svdpage.cxx:1481
tools::Long GetWidth() const
Definition: svdpage.cxx:1455
bool IsBordVisible() const
Draw Border line or not.
Definition: svdpntv.hxx:387
bool IsGridFront() const
Draw Grid in front of objects or behind them.
Definition: svdpntv.hxx:393
bool IsPageVisible() const
Draw Page as a white area or not.
Definition: svdpntv.hxx:378
const Size & GetGridFine() const
Definition: svdpntv.hxx:432
bool IsPageBorderVisible() const
Draw Page as a white area or not.
Definition: svdpntv.hxx:384
const Size & GetGridCoarse() const
Definition: svdpntv.hxx:431
const Color & GetGridColor() const
Definition: svdpntv.hxx:401
bool IsPageShadowVisible() const
Draw Page shadow or not.
Definition: svdpntv.hxx:381
bool IsHlplVisible() const
Draw Help line of the Page or not.
Definition: svdpntv.hxx:396
bool IsHlplFront() const
Draw Help line in front of the objects or behind them.
Definition: svdpntv.hxx:399
bool IsGridVisible() const
Draw Grid or not.
Definition: svdpntv.hxx:390
constexpr tools::Long getHeight() const
constexpr tools::Long getWidth() const
void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue)
virtual void visit(const Primitive2DReference &)=0
bool GetSubContentActive() const
Definition: displayinfo.hxx:85
bool GetControlLayerProcessingActive() const
Definition: displayinfo.hxx:77
virtual SdrPageView * TryToGetSdrPageView() const
access to SdrPageView. May return 0L like the default implementations do. Override as needed.
virtual bool isPrimitiveVisible(const DisplayInfo &rDisplayInfo) const override
ViewObjectContactOfInnerPageBorder(ObjectContact &rObjectContact, ViewContact &rViewContact)
ViewObjectContactOfMasterPage(ObjectContact &rObjectContact, ViewContact &rViewContact)
virtual bool isPrimitiveVisible(const DisplayInfo &rDisplayInfo) const override
ViewObjectContactOfOuterPageBorder(ObjectContact &rObjectContact, ViewContact &rViewContact)
virtual bool isPrimitiveVisible(const DisplayInfo &rDisplayInfo) const override
ViewObjectContactOfPageBackground(ObjectContact &rObjectContact, ViewContact &rViewContact)
virtual bool isPrimitiveVisible(const DisplayInfo &rDisplayInfo) const override
virtual void createPrimitive2DSequence(const DisplayInfo &rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor &rVisitor) const override
virtual void createPrimitive2DSequence(const DisplayInfo &rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor &rVisitor) const override
virtual bool isPrimitiveVisible(const DisplayInfo &rDisplayInfo) const override
ViewObjectContactOfPageFill(ObjectContact &rObjectContact, ViewContact &rViewContact)
ViewObjectContactOfPageGrid(ObjectContact &rObjectContact, ViewContact &rViewContact)
virtual bool isPrimitiveVisible(const DisplayInfo &rDisplayInfo) const override
virtual void createPrimitive2DSequence(const DisplayInfo &rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor &rVisitor) const override
ViewObjectContactOfPageHelplines(ObjectContact &rObjectContact, ViewContact &rViewContact)
virtual void createPrimitive2DSequence(const DisplayInfo &rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor &rVisitor) const override
virtual bool isPrimitiveVisible(const DisplayInfo &rDisplayInfo) const override
virtual void getPrimitive2DSequenceHierarchy(DisplayInfo &rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor &rVisitor) const override
ViewObjectContactOfPageHierarchy(ObjectContact &rObjectContact, ViewContact &rViewContact)
ViewObjectContactOfPageShadow(ObjectContact &rObjectContact, ViewContact &rViewContact)
virtual bool isPrimitiveVisible(const DisplayInfo &rDisplayInfo) const override
virtual bool isPrimitiveGhosted(const DisplayInfo &rDisplayInfo) const override
virtual bool isPrimitiveVisible(const DisplayInfo &rDisplayInfo) const override
ViewObjectContactOfPageSubObject(ObjectContact &rObjectContact, ViewContact &rViewContact)
ViewObjectContactOfSdrPage(ObjectContact &rObjectContact, ViewContact &rViewContact)
virtual void getPrimitive2DSequenceHierarchy(DisplayInfo &rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor &rVisitor) const override
ViewContact & GetViewContact() const
ObjectContact & GetObjectContact() const
void getPrimitive2DSequenceSubHierarchy(DisplayInfo &rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor &rVisitor) const
ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart=true) const
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
int nCount
uno_Any a
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
BitmapEx createDefaultCross_3x3(const basegfx::BColor &rBColor)