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 : #include <svx/sdr/contact/viewcontactofsdrpage.hxx>
21 : #include <svx/sdr/contact/viewobjectcontact.hxx>
22 : #include <svx/svdpage.hxx>
23 : #include <svx/sdr/contact/displayinfo.hxx>
24 : #include <svx/sdr/contact/viewobjectcontactofsdrpage.hxx>
25 : #include <basegfx/polygon/b2dpolygontools.hxx>
26 : #include <basegfx/matrix/b2dhommatrix.hxx>
27 : #include <svx/svdpagv.hxx>
28 : #include <svx/svdview.hxx>
29 : #include <vcl/svapp.hxx>
30 : #include <svx/sdr/contact/objectcontact.hxx>
31 : #include <drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx>
32 : #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
33 : #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
34 : #include <basegfx/polygon/b2dpolygon.hxx>
35 : #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
36 : #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
37 : #include <vcl/lazydelete.hxx>
38 : #include <svx/svdstr.hrc>
39 : #include <svx/svdglob.hxx>
40 : #include <drawinglayer/primitive2d/discreteshadowprimitive2d.hxx>
41 : #include <drawinglayer/attribute/sdrfillattribute.hxx>
42 :
43 : //////////////////////////////////////////////////////////////////////////////
44 :
45 : namespace sdr
46 : {
47 : namespace contact
48 : {
49 21901 : ViewContactOfPageSubObject::ViewContactOfPageSubObject(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
50 21901 : : mrParentViewContactOfSdrPage(rParentViewContactOfSdrPage)
51 : {
52 21901 : }
53 :
54 21483 : ViewContactOfPageSubObject::~ViewContactOfPageSubObject()
55 : {
56 21483 : }
57 :
58 0 : ViewContact* ViewContactOfPageSubObject::GetParentContact() const
59 : {
60 0 : return &mrParentViewContactOfSdrPage;
61 : }
62 :
63 55434 : const SdrPage& ViewContactOfPageSubObject::getPage() const
64 : {
65 55434 : return mrParentViewContactOfSdrPage.GetSdrPage();
66 : }
67 : } // end of namespace contact
68 : } // end of namespace sdr
69 :
70 : //////////////////////////////////////////////////////////////////////////////
71 :
72 : namespace sdr
73 : {
74 : namespace contact
75 : {
76 1407 : ViewObjectContact& ViewContactOfPageBackground::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
77 : {
78 1407 : ViewObjectContact* pRetval = new ViewObjectContactOfPageBackground(rObjectContact, *this);
79 : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
80 :
81 1407 : return *pRetval;
82 : }
83 :
84 251 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageBackground::createViewIndependentPrimitive2DSequence() const
85 : {
86 : // We have only the page information, not the view information. Use the
87 : // svtools::DOCCOLOR color for initialisation
88 251 : const svtools::ColorConfig aColorConfig;
89 251 : const Color aInitColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
90 502 : const basegfx::BColor aRGBColor(aInitColor.getBColor());
91 : const drawinglayer::primitive2d::Primitive2DReference xReference(
92 502 : new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor));
93 :
94 502 : return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
95 : }
96 :
97 1991 : ViewContactOfPageBackground::ViewContactOfPageBackground(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
98 1991 : : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
99 : {
100 1991 : }
101 :
102 1953 : ViewContactOfPageBackground::~ViewContactOfPageBackground()
103 : {
104 1953 : }
105 : } // end of namespace contact
106 : } // end of namespace sdr
107 :
108 : //////////////////////////////////////////////////////////////////////////////
109 :
110 : namespace sdr
111 : {
112 : namespace contact
113 : {
114 1407 : ViewObjectContact& ViewContactOfPageShadow::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
115 : {
116 1407 : ViewObjectContact* pRetval = new ViewObjectContactOfPageShadow(rObjectContact, *this);
117 : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
118 :
119 1407 : return *pRetval;
120 : }
121 :
122 1009 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageShadow::createViewIndependentPrimitive2DSequence() const
123 : {
124 : static bool bUseOldPageShadow(false);
125 1009 : const SdrPage& rPage = getPage();
126 1009 : basegfx::B2DHomMatrix aPageMatrix;
127 1009 : aPageMatrix.set(0, 0, (double)rPage.GetWdt());
128 1009 : aPageMatrix.set(1, 1, (double)rPage.GetHgt());
129 :
130 1009 : if(bUseOldPageShadow)
131 : {
132 : // create page shadow polygon
133 0 : const double fPageBorderFactor(1.0 / 256.0);
134 0 : basegfx::B2DPolygon aPageShadowPolygon;
135 0 : aPageShadowPolygon.append(basegfx::B2DPoint(1.0, fPageBorderFactor));
136 0 : aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, fPageBorderFactor));
137 0 : aPageShadowPolygon.append(basegfx::B2DPoint(1.0 + fPageBorderFactor, 1.0 + fPageBorderFactor));
138 0 : aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0 + fPageBorderFactor));
139 0 : aPageShadowPolygon.append(basegfx::B2DPoint(fPageBorderFactor, 1.0));
140 0 : aPageShadowPolygon.append(basegfx::B2DPoint(1.0, 1.0));
141 0 : aPageShadowPolygon.setClosed(true);
142 0 : aPageShadowPolygon.transform(aPageMatrix);
143 :
144 : // We have only the page information, not the view information. Use the
145 : // svtools::FONTCOLOR color for initialisation
146 0 : const svtools::ColorConfig aColorConfig;
147 0 : const Color aShadowColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
148 0 : const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor());
149 : const drawinglayer::primitive2d::Primitive2DReference xReference(
150 : new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
151 : basegfx::B2DPolyPolygon(aPageShadowPolygon),
152 0 : aRGBShadowColor));
153 :
154 0 : return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
155 : }
156 : else
157 : {
158 : static vcl::DeleteOnDeinit< drawinglayer::primitive2d::DiscreteShadow > aDiscreteShadow(
159 : new drawinglayer::primitive2d::DiscreteShadow(
160 : BitmapEx(
161 : ResId(
162 : SIP_SA_PAGESHADOW35X35,
163 1009 : *ImpGetResMgr()))));
164 :
165 1009 : if(aDiscreteShadow.get())
166 : {
167 : const drawinglayer::primitive2d::Primitive2DReference xReference(
168 : new drawinglayer::primitive2d::DiscreteShadowPrimitive2D(
169 : aPageMatrix,
170 1009 : *aDiscreteShadow.get()));
171 :
172 1009 : return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
173 : }
174 :
175 0 : return drawinglayer::primitive2d::Primitive2DSequence();
176 1009 : }
177 : }
178 :
179 1991 : ViewContactOfPageShadow::ViewContactOfPageShadow(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
180 1991 : : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
181 : {
182 1991 : }
183 :
184 1953 : ViewContactOfPageShadow::~ViewContactOfPageShadow()
185 : {
186 1953 : }
187 : } // end of namespace contact
188 : } // end of namespace sdr
189 :
190 : //////////////////////////////////////////////////////////////////////////////
191 :
192 : namespace sdr
193 : {
194 : namespace contact
195 : {
196 1202 : ViewObjectContact& ViewContactOfMasterPage::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
197 : {
198 1202 : ViewObjectContact* pRetval = new ViewObjectContactOfMasterPage(rObjectContact, *this);
199 : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
200 :
201 1202 : return *pRetval;
202 : }
203 :
204 501 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPage::createViewIndependentPrimitive2DSequence() const
205 : {
206 501 : drawinglayer::primitive2d::Primitive2DSequence xRetval;
207 :
208 : // this class is used when the page is a MasterPage and is responsible to
209 : // create a visualisation for the MPBGO, if exists. This needs to be suppressed
210 : // when a SdrPage which uses a MasterPage creates it's output. Suppression
211 : // is done in the corresponding VOC since DisplayInfo data is needed
212 501 : const SdrPage& rPage = getPage();
213 :
214 501 : if(rPage.IsMasterPage())
215 : {
216 155 : if(0 == rPage.GetPageNum())
217 : {
218 : // #i98063#
219 : // filter MasterPage 0 since it's the HandoutPage. Thus, it's a
220 : // MasterPage, but has no MPBGO, so there is nothing to do here.
221 : }
222 : else
223 : {
224 155 : drawinglayer::attribute::SdrFillAttribute aFill;
225 :
226 : // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets,
227 : // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all
228 : // MasterPages should have a StyleSheet excactly for this reason, but historically
229 : // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others).
230 155 : if(rPage.getSdrPageProperties().GetStyleSheet())
231 : {
232 : // create page fill attributes with correct properties
233 310 : aFill = drawinglayer::primitive2d::createNewSdrFillAttribute(
234 310 : rPage.getSdrPageProperties().GetItemSet());
235 : }
236 :
237 155 : if(!aFill.isDefault())
238 : {
239 : // direct model data is the page size, get and use it
240 : const basegfx::B2DRange aInnerRange(
241 0 : rPage.GetLftBorder(), rPage.GetUppBorder(),
242 0 : rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder());
243 0 : const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange));
244 0 : const basegfx::B2DHomMatrix aEmptyTransform;
245 : const drawinglayer::primitive2d::Primitive2DReference xReference(
246 : drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
247 : basegfx::B2DPolyPolygon(aInnerPolgon),
248 : aEmptyTransform,
249 : aFill,
250 0 : drawinglayer::attribute::FillGradientAttribute()));
251 :
252 0 : xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
253 155 : }
254 : }
255 : }
256 :
257 501 : return xRetval;
258 : }
259 :
260 1991 : ViewContactOfMasterPage::ViewContactOfMasterPage(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
261 1991 : : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
262 : {
263 1991 : }
264 :
265 1953 : ViewContactOfMasterPage::~ViewContactOfMasterPage()
266 : {
267 1953 : }
268 : } // end of namespace contact
269 : } // end of namespace sdr
270 :
271 : //////////////////////////////////////////////////////////////////////////////
272 :
273 : namespace sdr
274 : {
275 : namespace contact
276 : {
277 1407 : ViewObjectContact& ViewContactOfPageFill::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
278 : {
279 1407 : ViewObjectContact* pRetval = new ViewObjectContactOfPageFill(rObjectContact, *this);
280 : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
281 :
282 1407 : return *pRetval;
283 : }
284 :
285 251 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageFill::createViewIndependentPrimitive2DSequence() const
286 : {
287 251 : const SdrPage& rPage = getPage();
288 251 : const basegfx::B2DRange aPageFillRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt());
289 251 : const basegfx::B2DPolygon aPageFillPolygon(basegfx::tools::createPolygonFromRect(aPageFillRange));
290 :
291 : // We have only the page information, not the view information. Use the
292 : // svtools::DOCCOLOR color for initialisation
293 502 : const svtools::ColorConfig aColorConfig;
294 251 : const Color aPageFillColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
295 :
296 : // create and add primitive
297 502 : const basegfx::BColor aRGBColor(aPageFillColor.getBColor());
298 502 : const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPageFillPolygon), aRGBColor));
299 :
300 502 : return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
301 : }
302 :
303 1991 : ViewContactOfPageFill::ViewContactOfPageFill(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
304 1991 : : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
305 : {
306 1991 : }
307 :
308 1953 : ViewContactOfPageFill::~ViewContactOfPageFill()
309 : {
310 1953 : }
311 : } // end of namespace contact
312 : } // end of namespace sdr
313 :
314 : //////////////////////////////////////////////////////////////////////////////
315 :
316 : namespace sdr
317 : {
318 : namespace contact
319 : {
320 1407 : ViewObjectContact& ViewContactOfOuterPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
321 : {
322 1407 : ViewObjectContact* pRetval = new ViewObjectContactOfOuterPageBorder(rObjectContact, *this);
323 : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
324 :
325 1407 : return *pRetval;
326 : }
327 :
328 1319 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfOuterPageBorder::createViewIndependentPrimitive2DSequence() const
329 : {
330 1319 : drawinglayer::primitive2d::Primitive2DSequence xRetval;
331 1319 : const SdrPage& rPage = getPage();
332 1319 : const basegfx::B2DRange aPageBorderRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt());
333 :
334 : // Changed to 0x949599 for renaissance, before svtools::FONTCOLOR was used.
335 : // Added old case as fallback for HighContrast.
336 2638 : basegfx::BColor aRGBBorderColor(0x94 / (double)0xff, 0x95 / (double)0xff, 0x99 / (double)0xff);
337 :
338 1319 : if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
339 : {
340 0 : const svtools::ColorConfig aColorConfig;
341 0 : const Color aBorderColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
342 :
343 0 : aRGBBorderColor = aBorderColor.getBColor();
344 : }
345 :
346 1319 : if(rPage.getPageBorderOnlyLeftRight())
347 : {
348 : // #i93597# for Report Designer, the page border shall be only displayed right and left,
349 : // but not top and bottom. Create simplified geometry.
350 0 : basegfx::B2DPolygon aLeft, aRight;
351 :
352 0 : aLeft.append(basegfx::B2DPoint(aPageBorderRange.getMinX(), aPageBorderRange.getMinY()));
353 0 : aLeft.append(basegfx::B2DPoint(aPageBorderRange.getMinX(), aPageBorderRange.getMaxY()));
354 :
355 0 : aRight.append(basegfx::B2DPoint(aPageBorderRange.getMaxX(), aPageBorderRange.getMinY()));
356 0 : aRight.append(basegfx::B2DPoint(aPageBorderRange.getMaxX(), aPageBorderRange.getMaxY()));
357 :
358 0 : xRetval.realloc(2);
359 0 : xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aLeft, aRGBBorderColor));
360 0 : xRetval[1] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aRight, aRGBBorderColor));
361 : }
362 : else
363 : {
364 1319 : xRetval.realloc(1);
365 1319 : const basegfx::B2DPolygon aPageBorderPolygon(basegfx::tools::createPolygonFromRect(aPageBorderRange));
366 1319 : xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor));
367 : }
368 :
369 2638 : return xRetval;
370 : }
371 :
372 1991 : ViewContactOfOuterPageBorder::ViewContactOfOuterPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
373 1991 : : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
374 : {
375 1991 : }
376 :
377 1953 : ViewContactOfOuterPageBorder::~ViewContactOfOuterPageBorder()
378 : {
379 1953 : }
380 : } // end of namespace contact
381 : } // end of namespace sdr
382 :
383 : //////////////////////////////////////////////////////////////////////////////
384 :
385 : namespace sdr
386 : {
387 : namespace contact
388 : {
389 1407 : ViewObjectContact& ViewContactOfInnerPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
390 : {
391 1407 : ViewObjectContact* pRetval = new ViewObjectContactOfInnerPageBorder(rObjectContact, *this);
392 : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
393 :
394 1407 : return *pRetval;
395 : }
396 :
397 928 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfInnerPageBorder::createViewIndependentPrimitive2DSequence() const
398 : {
399 928 : const SdrPage& rPage = getPage();
400 : const basegfx::B2DRange aPageBorderRange(
401 1856 : (double)rPage.GetLftBorder(), (double)rPage.GetUppBorder(),
402 2784 : (double)(rPage.GetWdt() - rPage.GetRgtBorder()), (double)(rPage.GetHgt() - rPage.GetLwrBorder()));
403 928 : const basegfx::B2DPolygon aPageBorderPolygon(basegfx::tools::createPolygonFromRect(aPageBorderRange));
404 :
405 : // We have only the page information, not the view information. Use the
406 : // svtools::FONTCOLOR or svtools::DOCBOUNDARIES color for initialisation
407 1856 : const svtools::ColorConfig aColorConfig;
408 928 : Color aBorderColor;
409 :
410 928 : if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
411 : {
412 0 : aBorderColor = aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor;
413 : }
414 : else
415 : {
416 928 : aBorderColor = aColorConfig.GetColorValue(svtools::DOCBOUNDARIES).nColor;
417 : }
418 :
419 : // create page outer border primitive
420 1856 : const basegfx::BColor aRGBBorderColor(aBorderColor.getBColor());
421 1856 : const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor));
422 :
423 1856 : return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
424 : }
425 :
426 1991 : ViewContactOfInnerPageBorder::ViewContactOfInnerPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
427 1991 : : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
428 : {
429 1991 : }
430 :
431 1953 : ViewContactOfInnerPageBorder::~ViewContactOfInnerPageBorder()
432 : {
433 1953 : }
434 : } // end of namespace contact
435 : } // end of namespace sdr
436 :
437 : //////////////////////////////////////////////////////////////////////////////
438 :
439 : namespace sdr
440 : {
441 : namespace contact
442 : {
443 1407 : ViewObjectContact& ViewContactOfPageHierarchy::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
444 : {
445 1407 : ViewObjectContact* pRetval = new ViewObjectContactOfPageHierarchy(rObjectContact, *this);
446 : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
447 :
448 1407 : return *pRetval;
449 : }
450 :
451 251 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageHierarchy::createViewIndependentPrimitive2DSequence() const
452 : {
453 : // collect sub-hierarchy
454 251 : drawinglayer::primitive2d::Primitive2DSequence xRetval;
455 251 : const sal_uInt32 nObjectCount(GetObjectCount());
456 :
457 : // collect all sub-primitives
458 927 : for(sal_uInt32 a(0); a < nObjectCount; a++)
459 : {
460 676 : const ViewContact& rCandidate(GetViewContact(a));
461 676 : const drawinglayer::primitive2d::Primitive2DSequence aCandSeq(rCandidate.getViewIndependentPrimitive2DSequence());
462 :
463 676 : drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq);
464 676 : }
465 :
466 251 : return xRetval;
467 : }
468 :
469 1991 : ViewContactOfPageHierarchy::ViewContactOfPageHierarchy(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
470 1991 : : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
471 : {
472 1991 : }
473 :
474 1953 : ViewContactOfPageHierarchy::~ViewContactOfPageHierarchy()
475 : {
476 1953 : }
477 :
478 32777 : sal_uInt32 ViewContactOfPageHierarchy::GetObjectCount() const
479 : {
480 32777 : return getPage().GetObjCount();
481 : }
482 :
483 16939 : ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const
484 : {
485 16939 : SdrObject* pObj = getPage().GetObj(nIndex);
486 : DBG_ASSERT(pObj, "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)");
487 16939 : return pObj->GetViewContact();
488 : }
489 : } // end of namespace contact
490 : } // end of namespace sdr
491 :
492 : //////////////////////////////////////////////////////////////////////////////
493 :
494 : namespace sdr
495 : {
496 : namespace contact
497 : {
498 2814 : ViewObjectContact& ViewContactOfGrid::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
499 : {
500 2814 : ViewObjectContact* pRetval = new ViewObjectContactOfPageGrid(rObjectContact, *this);
501 : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
502 :
503 2814 : return *pRetval;
504 : }
505 :
506 0 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGrid::createViewIndependentPrimitive2DSequence() const
507 : {
508 : // We have only the page information, not the view information and thus no grid settings. Create empty
509 : // default. For the view-dependent implementation, see ViewObjectContactOfPageGrid::createPrimitive2DSequence
510 0 : return drawinglayer::primitive2d::Primitive2DSequence();
511 : }
512 :
513 3982 : ViewContactOfGrid::ViewContactOfGrid(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront)
514 : : ViewContactOfPageSubObject(rParentViewContactOfSdrPage),
515 3982 : mbFront(bFront)
516 : {
517 3982 : }
518 :
519 3906 : ViewContactOfGrid::~ViewContactOfGrid()
520 : {
521 3906 : }
522 : } // end of namespace contact
523 : } // end of namespace sdr
524 :
525 : //////////////////////////////////////////////////////////////////////////////
526 :
527 : namespace sdr
528 : {
529 : namespace contact
530 : {
531 2814 : ViewObjectContact& ViewContactOfHelplines::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
532 : {
533 2814 : ViewObjectContact* pRetval = new ViewObjectContactOfPageHelplines(rObjectContact, *this);
534 : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
535 :
536 2814 : return *pRetval;
537 : }
538 :
539 0 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfHelplines::createViewIndependentPrimitive2DSequence() const
540 : {
541 : // We have only the page information, not the view information and thus no helplines. Create empty
542 : // default. For the view-dependent implementation, see ViewObjectContactOfPageHelplines::createPrimitive2DSequence
543 0 : return drawinglayer::primitive2d::Primitive2DSequence();
544 : }
545 :
546 3982 : ViewContactOfHelplines::ViewContactOfHelplines(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront)
547 : : ViewContactOfPageSubObject(rParentViewContactOfSdrPage),
548 3982 : mbFront(bFront)
549 : {
550 3982 : }
551 :
552 3906 : ViewContactOfHelplines::~ViewContactOfHelplines()
553 : {
554 3906 : }
555 : } // end of namespace contact
556 : } // end of namespace sdr
557 :
558 : //////////////////////////////////////////////////////////////////////////////
559 :
560 : namespace sdr
561 : {
562 : namespace contact
563 : {
564 : // Create a Object-Specific ViewObjectContact, set ViewContact and
565 : // ObjectContact. Always needs to return something.
566 1407 : ViewObjectContact& ViewContactOfSdrPage::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
567 : {
568 1407 : ViewObjectContact* pRetval = new ViewObjectContactOfSdrPage(rObjectContact, *this);
569 : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
570 :
571 1407 : return *pRetval;
572 : }
573 :
574 1991 : ViewContactOfSdrPage::ViewContactOfSdrPage(SdrPage& rPage)
575 : : ViewContact(),
576 : mrPage(rPage),
577 : maViewContactOfPageBackground(*this),
578 : maViewContactOfPageShadow(*this),
579 : maViewContactOfPageFill(*this),
580 : maViewContactOfMasterPage(*this),
581 : maViewContactOfOuterPageBorder(*this),
582 : maViewContactOfInnerPageBorder(*this),
583 : maViewContactOfGridBack(*this, false),
584 : maViewContactOfHelplinesBack(*this, false),
585 : maViewContactOfPageHierarchy(*this),
586 : maViewContactOfGridFront(*this, true),
587 1991 : maViewContactOfHelplinesFront(*this, true)
588 : {
589 1991 : }
590 :
591 3906 : ViewContactOfSdrPage::~ViewContactOfSdrPage()
592 : {
593 3906 : }
594 :
595 : // Access to possible sub-hierarchy
596 70953 : sal_uInt32 ViewContactOfSdrPage::GetObjectCount() const
597 : {
598 : // Fixed count of content. It contains PageBackground (Wiese), PageShadow, PageFill,
599 : // then - depending on if the page has a MasterPage - either MasterPage Hierarchy
600 : // or MPBGO. Also OuterPageBorder, InnerPageBorder and two pairs of Grid and Helplines
601 : // (for front and back) which internally are visible or not depending on the current
602 : // front/back setting for those.
603 70953 : return 11;
604 : }
605 :
606 265177 : ViewContact& ViewContactOfSdrPage::GetViewContact(sal_uInt32 nIndex) const
607 : {
608 265177 : switch(nIndex)
609 : {
610 24107 : case 0: return (ViewContact&)maViewContactOfPageBackground;
611 24107 : case 1: return (ViewContact&)maViewContactOfPageShadow;
612 24107 : case 2: return (ViewContact&)maViewContactOfPageFill;
613 : case 3:
614 : {
615 24107 : const SdrPage& rPage = GetSdrPage();
616 :
617 24107 : if(rPage.TRG_HasMasterPage())
618 : {
619 1236 : return rPage.TRG_GetMasterPageDescriptorViewContact();
620 : }
621 : else
622 : {
623 22871 : return (ViewContact&)maViewContactOfMasterPage;
624 : }
625 : }
626 24107 : case 4: return (ViewContact&)maViewContactOfOuterPageBorder;
627 24107 : case 5: return (ViewContact&)maViewContactOfInnerPageBorder;
628 24107 : case 6: return (ViewContact&)maViewContactOfGridBack;
629 24107 : case 7: return (ViewContact&)maViewContactOfHelplinesBack;
630 24107 : case 8: return (ViewContact&)maViewContactOfPageHierarchy;
631 24107 : case 9: return (ViewContact&)maViewContactOfGridFront;
632 24107 : default: return (ViewContact&)maViewContactOfHelplinesFront;
633 : }
634 : }
635 :
636 : // React on changes of the object of this ViewContact
637 5878 : void ViewContactOfSdrPage::ActionChanged()
638 : {
639 : // call parent
640 5878 : ViewContact::ActionChanged();
641 :
642 : // apply to local viewContacts, they all rely on page information. Exception
643 : // is the sub hierarchy; this will not be influenced by the change
644 5878 : maViewContactOfPageBackground.ActionChanged();
645 5878 : maViewContactOfPageShadow.ActionChanged();
646 5878 : maViewContactOfPageFill.ActionChanged();
647 :
648 5878 : const SdrPage& rPage = GetSdrPage();
649 :
650 5878 : if(rPage.TRG_HasMasterPage())
651 : {
652 1389 : rPage.TRG_GetMasterPageDescriptorViewContact().ActionChanged();
653 : }
654 4489 : else if(rPage.IsMasterPage())
655 : {
656 1021 : maViewContactOfMasterPage.ActionChanged();
657 : }
658 :
659 5878 : maViewContactOfOuterPageBorder.ActionChanged();
660 5878 : maViewContactOfInnerPageBorder.ActionChanged();
661 5878 : maViewContactOfGridBack.ActionChanged();
662 5878 : maViewContactOfHelplinesBack.ActionChanged();
663 5878 : maViewContactOfGridFront.ActionChanged();
664 5878 : maViewContactOfHelplinesFront.ActionChanged();
665 5878 : }
666 :
667 : // overload for acessing the SdrPage
668 0 : SdrPage* ViewContactOfSdrPage::TryToGetSdrPage() const
669 : {
670 0 : return &GetSdrPage();
671 : }
672 :
673 251 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPage::createViewIndependentPrimitive2DSequence() const
674 : {
675 251 : drawinglayer::primitive2d::Primitive2DSequence xRetval;
676 :
677 : // collect all sub-sequences including sub hierarchy.
678 251 : drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageBackground.getViewIndependentPrimitive2DSequence());
679 251 : drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageShadow.getViewIndependentPrimitive2DSequence());
680 251 : drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageFill.getViewIndependentPrimitive2DSequence());
681 :
682 251 : const SdrPage& rPage = GetSdrPage();
683 :
684 251 : if(rPage.TRG_HasMasterPage())
685 : {
686 : drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
687 50 : rPage.TRG_GetMasterPageDescriptorViewContact().getViewIndependentPrimitive2DSequence());
688 : }
689 201 : else if(rPage.IsMasterPage())
690 : {
691 : drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
692 60 : maViewContactOfMasterPage.getViewIndependentPrimitive2DSequence());
693 : }
694 :
695 251 : drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfOuterPageBorder.getViewIndependentPrimitive2DSequence());
696 251 : drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfInnerPageBorder.getViewIndependentPrimitive2DSequence());
697 251 : drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageHierarchy.getViewIndependentPrimitive2DSequence());
698 :
699 : // Only add front versions of grid and helplines since no visibility test is done,
700 : // so adding the back incarnations is not necessary. This makes the Front
701 : // visualisation the default when no visibility tests are done.
702 : //
703 : // Since we have no view here, no grid and helpline definitions are available currently. The used
704 : // methods at ViewContactOfHelplines and ViewContactOfGrid return only empty sequences and
705 : // do not need to be called ATM. This may change later if grid or helpline info gets
706 : // model data (it should not). Keeping the lines commented to hold this hint.
707 : //
708 : // drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfGridFront.getViewIndependentPrimitive2DSequence());
709 : // drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfHelplinesFront.getViewIndependentPrimitive2DSequence());
710 :
711 251 : return xRetval;
712 : }
713 : } // end of namespace contact
714 258 : } // end of namespace sdr
715 :
716 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|