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