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 : : #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 : 33000 : ViewContactOfPageSubObject::ViewContactOfPageSubObject(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
50 : 33000 : : mrParentViewContactOfSdrPage(rParentViewContactOfSdrPage)
51 : : {
52 : 33000 : }
53 : :
54 : 31526 : ViewContactOfPageSubObject::~ViewContactOfPageSubObject()
55 : : {
56 [ - + ]: 31526 : }
57 : :
58 : 0 : ViewContact* ViewContactOfPageSubObject::GetParentContact() const
59 : : {
60 : 0 : return &mrParentViewContactOfSdrPage;
61 : : }
62 : :
63 : 110212 : const SdrPage& ViewContactOfPageSubObject::getPage() const
64 : : {
65 : 110212 : 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 : 2786 : ViewObjectContact& ViewContactOfPageBackground::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
77 : : {
78 [ + - ]: 2786 : ViewObjectContact* pRetval = new ViewObjectContactOfPageBackground(rObjectContact, *this);
79 : : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
80 : :
81 : 2786 : return *pRetval;
82 : : }
83 : :
84 : 513 : 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 [ + - ]: 513 : const svtools::ColorConfig aColorConfig;
89 [ + - ]: 513 : const Color aInitColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
90 : 513 : const basegfx::BColor aRGBColor(aInitColor.getBColor());
91 : : const drawinglayer::primitive2d::Primitive2DReference xReference(
92 [ + - ][ + - ]: 513 : new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor));
[ + - ]
93 : :
94 [ + - ][ + - ]: 513 : return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
95 : : }
96 : :
97 : 3000 : ViewContactOfPageBackground::ViewContactOfPageBackground(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
98 : 3000 : : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
99 : : {
100 : 3000 : }
101 : :
102 : 2866 : ViewContactOfPageBackground::~ViewContactOfPageBackground()
103 : : {
104 [ - + ]: 2866 : }
105 : : } // end of namespace contact
106 : : } // end of namespace sdr
107 : :
108 : : //////////////////////////////////////////////////////////////////////////////
109 : :
110 : : namespace sdr
111 : : {
112 : : namespace contact
113 : : {
114 : 2786 : ViewObjectContact& ViewContactOfPageShadow::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
115 : : {
116 [ + - ]: 2786 : ViewObjectContact* pRetval = new ViewObjectContactOfPageShadow(rObjectContact, *this);
117 : : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
118 : :
119 : 2786 : return *pRetval;
120 : : }
121 : :
122 : 1976 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageShadow::createViewIndependentPrimitive2DSequence() const
123 : : {
124 : : static bool bUseOldPageShadow(false);
125 : 1976 : const SdrPage& rPage = getPage();
126 [ + - ]: 1976 : basegfx::B2DHomMatrix aPageMatrix;
127 [ + - ][ + - ]: 1976 : aPageMatrix.set(0, 0, (double)rPage.GetWdt());
128 [ + - ][ + - ]: 1976 : aPageMatrix.set(1, 1, (double)rPage.GetHgt());
129 : :
130 [ - + ]: 1976 : 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 [ + + ][ + - ]: 1976 : BitmapEx(ResId(SIP_SA_PAGESHADOW35X35, *ImpGetResMgr()))));
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ # # ]
161 [ + - ]: 1976 : if (aDiscreteShadow.get() != NULL)
162 : : {
163 : : const drawinglayer::primitive2d::Primitive2DReference xReference(
164 : : new drawinglayer::primitive2d::DiscreteShadowPrimitive2D(
165 : : aPageMatrix,
166 [ + - ][ + - ]: 1976 : *aDiscreteShadow.get()));
[ + - ]
167 : :
168 [ + - ]: 1976 : return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
169 : : }
170 [ # # ]: 0 : return drawinglayer::primitive2d::Primitive2DSequence();
171 [ + - ]: 1976 : }
172 : : }
173 : :
174 : 3000 : ViewContactOfPageShadow::ViewContactOfPageShadow(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
175 : 3000 : : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
176 : : {
177 : 3000 : }
178 : :
179 : 2866 : ViewContactOfPageShadow::~ViewContactOfPageShadow()
180 : : {
181 [ - + ]: 2866 : }
182 : : } // end of namespace contact
183 : : } // end of namespace sdr
184 : :
185 : : //////////////////////////////////////////////////////////////////////////////
186 : :
187 : : namespace sdr
188 : : {
189 : : namespace contact
190 : : {
191 : 2383 : ViewObjectContact& ViewContactOfMasterPage::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
192 : : {
193 [ + - ]: 2383 : ViewObjectContact* pRetval = new ViewObjectContactOfMasterPage(rObjectContact, *this);
194 : : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
195 : :
196 : 2383 : return *pRetval;
197 : : }
198 : :
199 : 1249 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPage::createViewIndependentPrimitive2DSequence() const
200 : : {
201 : 1249 : 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 : 1249 : const SdrPage& rPage = getPage();
208 : :
209 [ + + ]: 1249 : if(rPage.IsMasterPage())
210 : : {
211 [ + - ][ + - ]: 277 : 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 [ + - ]: 277 : 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 [ + - ][ + - ]: 277 : if(rPage.getSdrPageProperties().GetStyleSheet())
226 : : {
227 : : // create page fill attributes with correct properties
228 : : aFill = drawinglayer::primitive2d::createNewSdrFillAttribute(
229 [ + - ][ + - ]: 277 : rPage.getSdrPageProperties().GetItemSet());
[ + - ][ + - ]
230 : : }
231 : :
232 [ + - ][ - + ]: 277 : 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 [ + - ]: 277 : }
249 : : }
250 : : }
251 : :
252 : 1249 : return xRetval;
253 : : }
254 : :
255 : 3000 : ViewContactOfMasterPage::ViewContactOfMasterPage(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
256 : 3000 : : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
257 : : {
258 : 3000 : }
259 : :
260 : 2866 : ViewContactOfMasterPage::~ViewContactOfMasterPage()
261 : : {
262 [ - + ]: 2866 : }
263 : : } // end of namespace contact
264 : : } // end of namespace sdr
265 : :
266 : : //////////////////////////////////////////////////////////////////////////////
267 : :
268 : : namespace sdr
269 : : {
270 : : namespace contact
271 : : {
272 : 2786 : ViewObjectContact& ViewContactOfPageFill::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
273 : : {
274 [ + - ]: 2786 : ViewObjectContact* pRetval = new ViewObjectContactOfPageFill(rObjectContact, *this);
275 : : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
276 : :
277 : 2786 : return *pRetval;
278 : : }
279 : :
280 : 513 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageFill::createViewIndependentPrimitive2DSequence() const
281 : : {
282 : 513 : const SdrPage& rPage = getPage();
283 [ + - ][ + - ]: 513 : const basegfx::B2DRange aPageFillRange(0.0, 0.0, (double)rPage.GetWdt(), (double)rPage.GetHgt());
[ + - ]
284 [ + - ]: 513 : 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 [ + - ]: 513 : const svtools::ColorConfig aColorConfig;
289 [ + - ]: 513 : const Color aPageFillColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor);
290 : :
291 : : // create and add primitive
292 : 513 : const basegfx::BColor aRGBColor(aPageFillColor.getBColor());
293 [ + - ][ + - ]: 513 : const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPageFillPolygon), aRGBColor));
[ + - ][ + - ]
[ + - ]
294 : :
295 [ + - ][ + - ]: 513 : return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
[ + - ]
296 : : }
297 : :
298 : 3000 : ViewContactOfPageFill::ViewContactOfPageFill(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
299 : 3000 : : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
300 : : {
301 : 3000 : }
302 : :
303 : 2866 : ViewContactOfPageFill::~ViewContactOfPageFill()
304 : : {
305 [ - + ]: 2866 : }
306 : : } // end of namespace contact
307 : : } // end of namespace sdr
308 : :
309 : : //////////////////////////////////////////////////////////////////////////////
310 : :
311 : : namespace sdr
312 : : {
313 : : namespace contact
314 : : {
315 : 2786 : ViewObjectContact& ViewContactOfOuterPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
316 : : {
317 [ + - ]: 2786 : ViewObjectContact* pRetval = new ViewObjectContactOfOuterPageBorder(rObjectContact, *this);
318 : : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
319 : :
320 : 2786 : return *pRetval;
321 : : }
322 : :
323 : 2858 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfOuterPageBorder::createViewIndependentPrimitive2DSequence() const
324 : : {
325 [ + - ]: 2858 : drawinglayer::primitive2d::Primitive2DSequence xRetval;
326 : 2858 : const SdrPage& rPage = getPage();
327 [ + - ][ + - ]: 2858 : 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 : 2858 : basegfx::BColor aRGBBorderColor(0x94 / (double)0xff, 0x95 / (double)0xff, 0x99 / (double)0xff);
332 : :
333 [ - + ][ + - ]: 2858 : 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 [ - + ]: 2858 : 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 [ + - ]: 2858 : xRetval.realloc(1);
360 [ + - ]: 2858 : const basegfx::B2DPolygon aPageBorderPolygon(basegfx::tools::createPolygonFromRect(aPageBorderRange));
361 [ + - ][ + - ]: 2858 : xRetval[0] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor));
[ + - ][ + - ]
[ + - ][ + - ]
362 : : }
363 : :
364 : 2858 : return xRetval;
365 : : }
366 : :
367 : 3000 : ViewContactOfOuterPageBorder::ViewContactOfOuterPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
368 : 3000 : : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
369 : : {
370 : 3000 : }
371 : :
372 : 2866 : ViewContactOfOuterPageBorder::~ViewContactOfOuterPageBorder()
373 : : {
374 [ - + ]: 2866 : }
375 : : } // end of namespace contact
376 : : } // end of namespace sdr
377 : :
378 : : //////////////////////////////////////////////////////////////////////////////
379 : :
380 : : namespace sdr
381 : : {
382 : : namespace contact
383 : : {
384 : 2786 : ViewObjectContact& ViewContactOfInnerPageBorder::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
385 : : {
386 [ + - ]: 2786 : ViewObjectContact* pRetval = new ViewObjectContactOfInnerPageBorder(rObjectContact, *this);
387 : : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
388 : :
389 : 2786 : return *pRetval;
390 : : }
391 : :
392 : 1879 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfInnerPageBorder::createViewIndependentPrimitive2DSequence() const
393 : : {
394 : 1879 : const SdrPage& rPage = getPage();
395 : : const basegfx::B2DRange aPageBorderRange(
396 [ + - ][ + - ]: 1879 : (double)rPage.GetLftBorder(), (double)rPage.GetUppBorder(),
397 [ + - ][ + - ]: 3758 : (double)(rPage.GetWdt() - rPage.GetRgtBorder()), (double)(rPage.GetHgt() - rPage.GetLwrBorder()));
[ + - ][ + - ]
[ + - ]
398 [ + - ]: 1879 : 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 [ + - ]: 1879 : const svtools::ColorConfig aColorConfig;
403 : 1879 : Color aBorderColor;
404 : :
405 [ - + ][ + - ]: 1879 : if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
406 : : {
407 [ # # ]: 0 : aBorderColor = aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor;
408 : : }
409 : : else
410 : : {
411 [ + - ]: 1879 : aBorderColor = aColorConfig.GetColorValue(svtools::DOCBOUNDARIES).nColor;
412 : : }
413 : :
414 : : // create page outer border primitive
415 : 1879 : const basegfx::BColor aRGBBorderColor(aBorderColor.getBColor());
416 [ + - ][ + - ]: 1879 : const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPageBorderPolygon, aRGBBorderColor));
[ + - ]
417 : :
418 [ + - ][ + - ]: 1879 : return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
[ + - ]
419 : : }
420 : :
421 : 3000 : ViewContactOfInnerPageBorder::ViewContactOfInnerPageBorder(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
422 : 3000 : : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
423 : : {
424 : 3000 : }
425 : :
426 : 2866 : ViewContactOfInnerPageBorder::~ViewContactOfInnerPageBorder()
427 : : {
428 [ - + ]: 2866 : }
429 : : } // end of namespace contact
430 : : } // end of namespace sdr
431 : :
432 : : //////////////////////////////////////////////////////////////////////////////
433 : :
434 : : namespace sdr
435 : : {
436 : : namespace contact
437 : : {
438 : 2786 : ViewObjectContact& ViewContactOfPageHierarchy::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
439 : : {
440 [ + - ]: 2786 : ViewObjectContact* pRetval = new ViewObjectContactOfPageHierarchy(rObjectContact, *this);
441 : : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
442 : :
443 : 2786 : return *pRetval;
444 : : }
445 : :
446 : 513 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfPageHierarchy::createViewIndependentPrimitive2DSequence() const
447 : : {
448 : : // collect sub-hierarchy
449 : 513 : drawinglayer::primitive2d::Primitive2DSequence xRetval;
450 [ + - ]: 513 : const sal_uInt32 nObjectCount(GetObjectCount());
451 : :
452 : : // collect all sub-primitives
453 [ + + ]: 1761 : for(sal_uInt32 a(0); a < nObjectCount; a++)
454 : : {
455 [ + - ]: 1248 : const ViewContact& rCandidate(GetViewContact(a));
456 [ + - ]: 1248 : const drawinglayer::primitive2d::Primitive2DSequence aCandSeq(rCandidate.getViewIndependentPrimitive2DSequence());
457 : :
458 [ + - ]: 1248 : drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq);
459 [ + - ]: 1248 : }
460 : :
461 : 513 : return xRetval;
462 : : }
463 : :
464 : 3000 : ViewContactOfPageHierarchy::ViewContactOfPageHierarchy(ViewContactOfSdrPage& rParentViewContactOfSdrPage)
465 : 3000 : : ViewContactOfPageSubObject(rParentViewContactOfSdrPage)
466 : : {
467 : 3000 : }
468 : :
469 : 2866 : ViewContactOfPageHierarchy::~ViewContactOfPageHierarchy()
470 : : {
471 [ - + ]: 2866 : }
472 : :
473 : 64931 : sal_uInt32 ViewContactOfPageHierarchy::GetObjectCount() const
474 : : {
475 : 64931 : return getPage().GetObjCount();
476 : : }
477 : :
478 : 33251 : ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const
479 : : {
480 : 33251 : SdrObject* pObj = getPage().GetObj(nIndex);
481 : : DBG_ASSERT(pObj, "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)");
482 : 33251 : 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 : 5572 : ViewObjectContact& ViewContactOfGrid::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
494 : : {
495 [ + - ]: 5572 : ViewObjectContact* pRetval = new ViewObjectContactOfPageGrid(rObjectContact, *this);
496 : : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
497 : :
498 : 5572 : 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 : 6000 : ViewContactOfGrid::ViewContactOfGrid(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront)
509 : : : ViewContactOfPageSubObject(rParentViewContactOfSdrPage),
510 : 6000 : mbFront(bFront)
511 : : {
512 : 6000 : }
513 : :
514 : 5732 : ViewContactOfGrid::~ViewContactOfGrid()
515 : : {
516 [ - + ]: 5732 : }
517 : : } // end of namespace contact
518 : : } // end of namespace sdr
519 : :
520 : : //////////////////////////////////////////////////////////////////////////////
521 : :
522 : : namespace sdr
523 : : {
524 : : namespace contact
525 : : {
526 : 5572 : ViewObjectContact& ViewContactOfHelplines::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
527 : : {
528 [ + - ]: 5572 : ViewObjectContact* pRetval = new ViewObjectContactOfPageHelplines(rObjectContact, *this);
529 : : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
530 : :
531 : 5572 : 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 : 6000 : ViewContactOfHelplines::ViewContactOfHelplines(ViewContactOfSdrPage& rParentViewContactOfSdrPage, bool bFront)
542 : : : ViewContactOfPageSubObject(rParentViewContactOfSdrPage),
543 : 6000 : mbFront(bFront)
544 : : {
545 : 6000 : }
546 : :
547 : 5732 : ViewContactOfHelplines::~ViewContactOfHelplines()
548 : : {
549 [ - + ]: 5732 : }
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 : 2786 : ViewObjectContact& ViewContactOfSdrPage::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
562 : : {
563 [ + - ]: 2786 : ViewObjectContact* pRetval = new ViewObjectContactOfSdrPage(rObjectContact, *this);
564 : : DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
565 : :
566 : 2786 : return *pRetval;
567 : : }
568 : :
569 : 3000 : 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 [ + - ][ + - ]: 3000 : maViewContactOfHelplinesFront(*this, true)
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ]
583 : : {
584 : 3000 : }
585 : :
586 [ + - ][ + - ]: 2866 : ViewContactOfSdrPage::~ViewContactOfSdrPage()
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ]
587 : : {
588 [ - + ]: 5732 : }
589 : :
590 : : // Access to possible sub-hierarchy
591 : 140305 : 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 : 140305 : return 11;
599 : : }
600 : :
601 : 523556 : ViewContact& ViewContactOfSdrPage::GetViewContact(sal_uInt32 nIndex) const
602 : : {
603 [ + + + + : 523556 : switch(nIndex)
+ + + + +
+ + ]
604 : : {
605 : 47596 : case 0: return (ViewContact&)maViewContactOfPageBackground;
606 : 47596 : case 1: return (ViewContact&)maViewContactOfPageShadow;
607 : 47596 : case 2: return (ViewContact&)maViewContactOfPageFill;
608 : : case 3:
609 : : {
610 : 47596 : const SdrPage& rPage = GetSdrPage();
611 : :
612 [ + + ]: 47596 : if(rPage.TRG_HasMasterPage())
613 : : {
614 : 2482 : return rPage.TRG_GetMasterPageDescriptorViewContact();
615 : : }
616 : : else
617 : : {
618 : 45114 : return (ViewContact&)maViewContactOfMasterPage;
619 : : }
620 : : }
621 : 47596 : case 4: return (ViewContact&)maViewContactOfOuterPageBorder;
622 : 47596 : case 5: return (ViewContact&)maViewContactOfInnerPageBorder;
623 : 47596 : case 6: return (ViewContact&)maViewContactOfGridBack;
624 : 47596 : case 7: return (ViewContact&)maViewContactOfHelplinesBack;
625 : 47596 : case 8: return (ViewContact&)maViewContactOfPageHierarchy;
626 : 47596 : case 9: return (ViewContact&)maViewContactOfGridFront;
627 : 523556 : default: return (ViewContact&)maViewContactOfHelplinesFront;
628 : : }
629 : : }
630 : :
631 : : // React on changes of the object of this ViewContact
632 : 71949 : void ViewContactOfSdrPage::ActionChanged()
633 : : {
634 : : // call parent
635 : 71949 : 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 : 71949 : maViewContactOfPageBackground.ActionChanged();
640 : 71949 : maViewContactOfPageShadow.ActionChanged();
641 : 71949 : maViewContactOfPageFill.ActionChanged();
642 : :
643 : 71949 : const SdrPage& rPage = GetSdrPage();
644 : :
645 [ + + ]: 71949 : if(rPage.TRG_HasMasterPage())
646 : : {
647 : 1789 : rPage.TRG_GetMasterPageDescriptorViewContact().ActionChanged();
648 : : }
649 [ + + ]: 70160 : else if(rPage.IsMasterPage())
650 : : {
651 : 1739 : maViewContactOfMasterPage.ActionChanged();
652 : : }
653 : :
654 : 71949 : maViewContactOfOuterPageBorder.ActionChanged();
655 : 71949 : maViewContactOfInnerPageBorder.ActionChanged();
656 : 71949 : maViewContactOfGridBack.ActionChanged();
657 : 71949 : maViewContactOfHelplinesBack.ActionChanged();
658 : 71949 : maViewContactOfGridFront.ActionChanged();
659 : 71949 : maViewContactOfHelplinesFront.ActionChanged();
660 : 71949 : }
661 : :
662 : : // overload for acessing the SdrPage
663 : 0 : SdrPage* ViewContactOfSdrPage::TryToGetSdrPage() const
664 : : {
665 : 0 : return &GetSdrPage();
666 : : }
667 : :
668 : 513 : drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPage::createViewIndependentPrimitive2DSequence() const
669 : : {
670 : 513 : drawinglayer::primitive2d::Primitive2DSequence xRetval;
671 : :
672 : : // collect all sub-sequences including sub hierarchy.
673 [ + - ][ + - ]: 513 : drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageBackground.getViewIndependentPrimitive2DSequence());
[ + - ]
674 [ + - ][ + - ]: 513 : drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageShadow.getViewIndependentPrimitive2DSequence());
[ + - ]
675 [ + - ][ + - ]: 513 : drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfPageFill.getViewIndependentPrimitive2DSequence());
[ + - ]
676 : :
677 : 513 : const SdrPage& rPage = GetSdrPage();
678 : :
679 [ + + ]: 513 : if(rPage.TRG_HasMasterPage())
680 : : {
681 : : drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
682 [ + - ][ + - ]: 94 : rPage.TRG_GetMasterPageDescriptorViewContact().getViewIndependentPrimitive2DSequence());
[ + - ][ + - ]
683 : : }
684 [ + + ]: 419 : else if(rPage.IsMasterPage())
685 : : {
686 : : drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval,
687 [ + - ][ + - ]: 108 : maViewContactOfMasterPage.getViewIndependentPrimitive2DSequence());
[ + - ]
688 : : }
689 : :
690 [ + - ][ + - ]: 513 : drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfOuterPageBorder.getViewIndependentPrimitive2DSequence());
[ + - ]
691 [ + - ][ + - ]: 513 : drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, maViewContactOfInnerPageBorder.getViewIndependentPrimitive2DSequence());
[ + - ]
692 [ + - ][ + - ]: 513 : 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 : 513 : return xRetval;
707 : : }
708 : : } // end of namespace contact
709 : : } // end of namespace sdr
710 : :
711 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|