Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <svx/sdr/primitive2d/sdrtextprimitive2d.hxx>
30 : : #include <svx/svdotext.hxx>
31 : : #include <basegfx/color/bcolor.hxx>
32 : : #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
33 : : #include <drawinglayer/primitive2d/texthierarchyprimitive2d.hxx>
34 : : #include <editeng/outlobj.hxx>
35 : : #include <editeng/editobj.hxx>
36 : : #include <editeng/flditem.hxx>
37 : : #include <drawinglayer/geometry/viewinformation2d.hxx>
38 : : #include <svx/unoapi.hxx>
39 : : #include <svx/svdpage.hxx>
40 : : #include <svx/svdmodel.hxx>
41 : : #include <svx/svdoutl.hxx>
42 : : #include <com/sun/star/beans/XPropertySet.hpp>
43 : :
44 : : //////////////////////////////////////////////////////////////////////////////
45 : :
46 : : using namespace com::sun::star;
47 : :
48 : : //////////////////////////////////////////////////////////////////////////////
49 : :
50 : : namespace
51 : : {
52 : 184 : sal_Int16 getPageNumber(const uno::Reference< drawing::XDrawPage >& rxDrawPage)
53 : : {
54 : 184 : sal_Int16 nRetval(0);
55 [ + - ]: 184 : uno::Reference< beans::XPropertySet > xSet(rxDrawPage, uno::UNO_QUERY);
56 : :
57 [ + + ]: 184 : if (xSet.is())
58 : : {
59 : : try
60 : : {
61 [ + - ][ + - ]: 8 : const uno::Any aNumber(xSet->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Number"))));
[ + - ][ # # ]
62 : 8 : aNumber >>= nRetval;
63 : : }
64 [ # # ]: 0 : catch(const uno::Exception&)
65 : : {
66 : : OSL_ASSERT(false);
67 : : }
68 : : }
69 : :
70 : 184 : return nRetval;
71 : : }
72 : :
73 : 0 : sal_Int16 getPageCount(const uno::Reference< drawing::XDrawPage >& rxDrawPage)
74 : : {
75 : 0 : sal_Int16 nRetval(0);
76 : 0 : SdrPage* pPage = GetSdrPageFromXDrawPage(rxDrawPage);
77 : :
78 [ # # ][ # # ]: 0 : if(pPage && pPage->GetModel())
[ # # ]
79 : : {
80 [ # # ][ # # ]: 0 : if( (pPage->GetPageNum() == 0) && !pPage->IsMasterPage() )
[ # # ]
81 : : {
82 : : // handout page!
83 : 0 : return pPage->GetModel()->getHandoutPageCount();
84 : : }
85 : : else
86 : : {
87 : 0 : const sal_uInt16 nPageCount(pPage->GetModel()->GetPageCount());
88 : 0 : nRetval = ((sal_Int16)nPageCount - 1) / 2;
89 : : }
90 : : }
91 : :
92 : 0 : return nRetval;
93 : : }
94 : : } // end of anonymous namespace
95 : :
96 : : //////////////////////////////////////////////////////////////////////////////
97 : :
98 : : namespace drawinglayer
99 : : {
100 : : namespace primitive2d
101 : : {
102 : : // support for XTEXT_PAINTSHAPE_BEGIN/XTEXT_PAINTSHAPE_END Metafile comments
103 : : // for slideshow. This uses TextHierarchyBlockPrimitive2D to mark a text block.
104 : : // ATM there is only one text block per SdrObject, this may get more in the future
105 : 13696 : Primitive2DSequence SdrTextPrimitive2D::encapsulateWithTextHierarchyBlockPrimitive2D(const Primitive2DSequence& rCandidate) const
106 : : {
107 [ + - ][ + - ]: 13696 : Primitive2DReference xReference(new TextHierarchyBlockPrimitive2D(rCandidate));
[ + - ]
108 [ + - ]: 13696 : Primitive2DSequence xRetval(&xReference, 1);
109 : :
110 : 13696 : return xRetval;
111 : : }
112 : :
113 : 13498 : SdrTextPrimitive2D::SdrTextPrimitive2D(
114 : : const SdrText* pSdrText,
115 : : const OutlinerParaObject& rOutlinerParaObject)
116 : : : BufferedDecompositionPrimitive2D(),
117 : : mrSdrText(const_cast< SdrText* >(pSdrText)),
118 : : maOutlinerParaObject(rOutlinerParaObject),
119 : : mxLastVisualizingPage(),
120 : : mnLastPageNumber(0),
121 : : mnLastPageCount(0),
122 : : maLastTextBackgroundColor(),
123 : : mbContainsPageField(false),
124 : : mbContainsPageCountField(false),
125 [ + - ][ + - ]: 13498 : mbContainsOtherFields(false)
126 : : {
127 [ + - ]: 13498 : const EditTextObject& rETO = maOutlinerParaObject.GetTextObject();
128 : :
129 [ + - ][ + - ]: 13498 : mbContainsPageField = rETO.HasField(SvxPageField::StaticType());
130 [ + - ][ + - ]: 13498 : mbContainsPageCountField = rETO.HasField(SvxPagesField::StaticType());
131 [ + - ][ + - ]: 13498 : mbContainsOtherFields = rETO.HasField(SvxHeaderField::StaticType())
132 [ + - ][ + - ]: 13380 : || rETO.HasField(SvxFooterField::StaticType())
133 [ + - ][ + - ]: 13159 : || rETO.HasField(SvxDateTimeField::StaticType())
134 [ + + ][ + + ]: 40037 : || rETO.HasField(SvxAuthorField::StaticType());
[ + + ][ + - ]
[ + - ][ - + ]
135 : 13498 : }
136 : :
137 : 0 : bool SdrTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
138 : : {
139 [ # # ]: 0 : if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
140 : : {
141 : 0 : const SdrTextPrimitive2D& rCompare = (SdrTextPrimitive2D&)rPrimitive;
142 : :
143 : : return (
144 : :
145 : : // compare OPO and content, but not WrongList
146 : 0 : getOutlinerParaObject() == rCompare.getOutlinerParaObject()
147 : :
148 : : // also compare WrongList (not-persistent data, but visualized)
149 [ # # ][ # # ]: 0 : && getOutlinerParaObject().isWrongListEqual(rCompare.getOutlinerParaObject()));
150 : : }
151 : :
152 : 0 : return false;
153 : : }
154 : :
155 : 128491 : Primitive2DSequence SdrTextPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const
156 : : {
157 : 128491 : uno::Reference< drawing::XDrawPage > xCurrentlyVisualizingPage;
158 : 128491 : bool bCurrentlyVisualizingPageIsSet(false);
159 : 128491 : Color aNewTextBackgroundColor;
160 : 128491 : bool bNewTextBackgroundColorIsSet(false);
161 : 128491 : sal_Int16 nCurrentlyValidPageNumber(0);
162 : 128491 : sal_Int16 nCurrentlyValidPageCount(0);
163 : :
164 [ + + ]: 128491 : if(getBuffered2DDecomposition().hasElements())
165 : : {
166 : 114993 : bool bDoDelete(false);
167 : :
168 : : // check visualized page
169 [ + + ][ + - ]: 114993 : if(mbContainsPageField || mbContainsPageCountField || mbContainsOtherFields)
[ + + ]
170 : : {
171 : : // get visualized page and remember
172 [ + - ][ + - ]: 1578 : xCurrentlyVisualizingPage = rViewInformation.getVisualizedPage();
173 : 1578 : bCurrentlyVisualizingPageIsSet = true;
174 : :
175 [ + - ][ + + ]: 1578 : if(xCurrentlyVisualizingPage != mxLastVisualizingPage)
176 : : {
177 : 142 : bDoDelete = true;
178 : : }
179 : :
180 : : // #i98870# check visualized PageNumber
181 [ + + ][ + + ]: 1578 : if(!bDoDelete && mbContainsPageField)
182 : : {
183 [ + - ]: 6 : nCurrentlyValidPageNumber = getPageNumber(xCurrentlyVisualizingPage);
184 : :
185 [ - + ]: 6 : if(nCurrentlyValidPageNumber != mnLastPageNumber)
186 : : {
187 : 0 : bDoDelete = true;
188 : : }
189 : : }
190 : :
191 : : // #i98870# check visualized PageCount, too
192 [ + + ][ - + ]: 1578 : if(!bDoDelete && mbContainsPageCountField)
193 : : {
194 [ # # ]: 0 : nCurrentlyValidPageCount = getPageCount(xCurrentlyVisualizingPage);
195 : :
196 [ # # ]: 0 : if(nCurrentlyValidPageCount != mnLastPageCount)
197 : : {
198 : 0 : bDoDelete = true;
199 : : }
200 : : }
201 : : }
202 : :
203 : : // #i101443# check change of TextBackgroundolor
204 [ + + ][ + - ]: 114993 : if(!bDoDelete && getSdrText() && getSdrText()->GetModel())
[ + - ][ + - ]
[ + - ][ + + ]
205 : : {
206 [ + - ][ + - ]: 114851 : SdrOutliner& rDrawOutliner = getSdrText()->GetModel()->GetDrawOutliner(0);
207 [ + - ]: 114851 : aNewTextBackgroundColor = rDrawOutliner.GetBackgroundColor();
208 : 114851 : bNewTextBackgroundColorIsSet = true;
209 : :
210 [ + + ]: 114851 : if(aNewTextBackgroundColor != maLastTextBackgroundColor)
211 : : {
212 : 56 : bDoDelete = true;
213 : : }
214 : : }
215 : :
216 [ + + ]: 114993 : if(bDoDelete)
217 : : {
218 [ + - ][ + - ]: 198 : const_cast< SdrTextPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence());
[ + - ]
219 : : }
220 : : }
221 : :
222 [ + + ]: 128491 : if(!getBuffered2DDecomposition().hasElements())
223 : : {
224 [ + + ][ + + ]: 13696 : if(!bCurrentlyVisualizingPageIsSet && mbContainsPageField)
225 : : {
226 [ + - ][ + - ]: 176 : xCurrentlyVisualizingPage = rViewInformation.getVisualizedPage();
227 : : }
228 : :
229 [ + - ][ + + ]: 13696 : if(!nCurrentlyValidPageNumber && mbContainsPageField)
230 : : {
231 [ + - ]: 178 : nCurrentlyValidPageNumber = getPageNumber(xCurrentlyVisualizingPage);
232 : : }
233 : :
234 [ + - ][ - + ]: 13696 : if(!nCurrentlyValidPageCount && mbContainsPageCountField)
235 : : {
236 [ # # ]: 0 : nCurrentlyValidPageCount = getPageCount(xCurrentlyVisualizingPage);
237 : : }
238 : :
239 [ + + ][ + - ]: 13696 : if(!bNewTextBackgroundColorIsSet && getSdrText() && getSdrText()->GetModel())
[ + - ][ + - ]
[ + - ][ + + ]
240 : : {
241 [ + - ][ + - ]: 13640 : SdrOutliner& rDrawOutliner = getSdrText()->GetModel()->GetDrawOutliner(0);
242 [ + - ]: 13640 : aNewTextBackgroundColor = rDrawOutliner.GetBackgroundColor();
243 : : }
244 : :
245 [ + - ]: 13696 : const_cast< SdrTextPrimitive2D* >(this)->mxLastVisualizingPage = xCurrentlyVisualizingPage;
246 : 13696 : const_cast< SdrTextPrimitive2D* >(this)->mnLastPageNumber = nCurrentlyValidPageNumber;
247 : 13696 : const_cast< SdrTextPrimitive2D* >(this)->mnLastPageCount = nCurrentlyValidPageCount;
248 : 13696 : const_cast< SdrTextPrimitive2D* >(this)->maLastTextBackgroundColor = aNewTextBackgroundColor;
249 : : }
250 : :
251 : : // call parent
252 [ + - ]: 128491 : return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation);
253 : : }
254 : : } // end of namespace primitive2d
255 : : } // end of namespace drawinglayer
256 : :
257 : : //////////////////////////////////////////////////////////////////////////////
258 : :
259 : : namespace drawinglayer
260 : : {
261 : : namespace primitive2d
262 : : {
263 : 0 : Primitive2DSequence SdrContourTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const
264 : : {
265 [ # # ]: 0 : Primitive2DSequence aRetval;
266 [ # # ][ # # ]: 0 : getSdrText()->GetObject().impDecomposeContourTextPrimitive(aRetval, *this, aViewInformation);
267 : :
268 [ # # ][ # # ]: 0 : return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval);
269 : : }
270 : :
271 : 0 : SdrContourTextPrimitive2D::SdrContourTextPrimitive2D(
272 : : const SdrText* pSdrText,
273 : : const OutlinerParaObject& rOutlinerParaObject,
274 : : const basegfx::B2DPolyPolygon& rUnitPolyPolygon,
275 : : const basegfx::B2DHomMatrix& rObjectTransform)
276 : : : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject),
277 : : maUnitPolyPolygon(rUnitPolyPolygon),
278 [ # # ][ # # ]: 0 : maObjectTransform(rObjectTransform)
279 : : {
280 : 0 : }
281 : :
282 : 0 : bool SdrContourTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
283 : : {
284 [ # # ]: 0 : if(SdrTextPrimitive2D::operator==(rPrimitive))
285 : : {
286 : 0 : const SdrContourTextPrimitive2D& rCompare = (SdrContourTextPrimitive2D&)rPrimitive;
287 : :
288 : 0 : return (getUnitPolyPolygon() == rCompare.getUnitPolyPolygon()
289 [ # # ][ # # ]: 0 : && getObjectTransform() == rCompare.getObjectTransform());
290 : : }
291 : :
292 : 0 : return false;
293 : : }
294 : :
295 : 0 : SdrTextPrimitive2D* SdrContourTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const
296 : : {
297 : : return new SdrContourTextPrimitive2D(
298 : 0 : getSdrText(),
299 : 0 : getOutlinerParaObject(),
300 : : getUnitPolyPolygon(),
301 [ # # ]: 0 : rTransform * getObjectTransform());
302 : : }
303 : :
304 : : // provide unique ID
305 : 0 : ImplPrimitrive2DIDBlock(SdrContourTextPrimitive2D, PRIMITIVE2D_ID_SDRCONTOURTEXTPRIMITIVE2D)
306 : :
307 : : } // end of namespace primitive2d
308 : : } // end of namespace drawinglayer
309 : :
310 : : //////////////////////////////////////////////////////////////////////////////
311 : :
312 : : namespace drawinglayer
313 : : {
314 : : namespace primitive2d
315 : : {
316 : 0 : Primitive2DSequence SdrPathTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const
317 : : {
318 [ # # ]: 0 : Primitive2DSequence aRetval;
319 [ # # ][ # # ]: 0 : getSdrText()->GetObject().impDecomposePathTextPrimitive(aRetval, *this, aViewInformation);
320 : :
321 [ # # ][ # # ]: 0 : return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval);
322 : : }
323 : :
324 : 0 : SdrPathTextPrimitive2D::SdrPathTextPrimitive2D(
325 : : const SdrText* pSdrText,
326 : : const OutlinerParaObject& rOutlinerParaObject,
327 : : const basegfx::B2DPolyPolygon& rPathPolyPolygon,
328 : : const attribute::SdrFormTextAttribute& rSdrFormTextAttribute)
329 : : : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject),
330 : : maPathPolyPolygon(rPathPolyPolygon),
331 [ # # ][ # # ]: 0 : maSdrFormTextAttribute(rSdrFormTextAttribute)
332 : : {
333 : 0 : }
334 : :
335 : 0 : bool SdrPathTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
336 : : {
337 [ # # ]: 0 : if(SdrTextPrimitive2D::operator==(rPrimitive))
338 : : {
339 : 0 : const SdrPathTextPrimitive2D& rCompare = (SdrPathTextPrimitive2D&)rPrimitive;
340 : :
341 : 0 : return (getPathPolyPolygon() == rCompare.getPathPolyPolygon()
342 [ # # ][ # # ]: 0 : && getSdrFormTextAttribute() == rCompare.getSdrFormTextAttribute());
343 : : }
344 : :
345 : 0 : return false;
346 : : }
347 : :
348 : 0 : SdrTextPrimitive2D* SdrPathTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const
349 : : {
350 [ # # ]: 0 : basegfx::B2DPolyPolygon aNewPolyPolygon(getPathPolyPolygon());
351 [ # # ]: 0 : aNewPolyPolygon.transform(rTransform);
352 : :
353 : : return new SdrPathTextPrimitive2D(
354 : 0 : getSdrText(),
355 : 0 : getOutlinerParaObject(),
356 : : aNewPolyPolygon,
357 [ # # ][ # # ]: 0 : getSdrFormTextAttribute());
[ # # ]
358 : : }
359 : :
360 : : // provide unique ID
361 : 0 : ImplPrimitrive2DIDBlock(SdrPathTextPrimitive2D, PRIMITIVE2D_ID_SDRPATHTEXTPRIMITIVE2D)
362 : :
363 : : } // end of namespace primitive2d
364 : : } // end of namespace drawinglayer
365 : :
366 : : //////////////////////////////////////////////////////////////////////////////
367 : :
368 : : namespace drawinglayer
369 : : {
370 : : namespace primitive2d
371 : : {
372 : 13665 : Primitive2DSequence SdrBlockTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const
373 : : {
374 [ + - ]: 13665 : Primitive2DSequence aRetval;
375 [ + - ][ + - ]: 13665 : getSdrText()->GetObject().impDecomposeBlockTextPrimitive(aRetval, *this, aViewInformation);
376 : :
377 [ + - ][ + - ]: 13665 : return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval);
378 : : }
379 : :
380 : 13469 : SdrBlockTextPrimitive2D::SdrBlockTextPrimitive2D(
381 : : const SdrText* pSdrText,
382 : : const OutlinerParaObject& rOutlinerParaObject,
383 : : const basegfx::B2DHomMatrix& rTextRangeTransform,
384 : : SdrTextHorzAdjust aSdrTextHorzAdjust,
385 : : SdrTextVertAdjust aSdrTextVertAdjust,
386 : : bool bFixedCellHeight,
387 : : bool bUnlimitedPage,
388 : : bool bCellText,
389 : : bool bWordWrap,
390 : : bool bClipOnBounds)
391 : : : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject),
392 : : maTextRangeTransform(rTextRangeTransform),
393 : : maSdrTextHorzAdjust(aSdrTextHorzAdjust),
394 : : maSdrTextVertAdjust(aSdrTextVertAdjust),
395 : : mbFixedCellHeight(bFixedCellHeight),
396 : : mbUnlimitedPage(bUnlimitedPage),
397 : : mbCellText(bCellText),
398 : : mbWordWrap(bWordWrap),
399 [ + - ]: 13469 : mbClipOnBounds(bClipOnBounds)
400 : : {
401 : 13469 : }
402 : :
403 : 0 : bool SdrBlockTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
404 : : {
405 [ # # ]: 0 : if(SdrTextPrimitive2D::operator==(rPrimitive))
406 : : {
407 : 0 : const SdrBlockTextPrimitive2D& rCompare = (SdrBlockTextPrimitive2D&)rPrimitive;
408 : :
409 : 0 : return (getTextRangeTransform() == rCompare.getTextRangeTransform()
410 : 0 : && getSdrTextHorzAdjust() == rCompare.getSdrTextHorzAdjust()
411 : 0 : && getSdrTextVertAdjust() == rCompare.getSdrTextVertAdjust()
412 : 0 : && isFixedCellHeight() == rCompare.isFixedCellHeight()
413 : 0 : && getUnlimitedPage() == rCompare.getUnlimitedPage()
414 : 0 : && getCellText() == rCompare.getCellText()
415 : 0 : && getWordWrap() == rCompare.getWordWrap()
416 [ # # ][ # # : 0 : && getClipOnBounds() == rCompare.getClipOnBounds());
# # # # #
# # # # #
# # ]
417 : : }
418 : :
419 : 0 : return false;
420 : : }
421 : :
422 : 0 : SdrTextPrimitive2D* SdrBlockTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const
423 : : {
424 : : return new SdrBlockTextPrimitive2D(
425 : 0 : getSdrText(),
426 : 0 : getOutlinerParaObject(),
427 : 0 : rTransform * getTextRangeTransform(),
428 : : getSdrTextHorzAdjust(),
429 : : getSdrTextVertAdjust(),
430 : 0 : isFixedCellHeight(),
431 : 0 : getUnlimitedPage(),
432 : 0 : getCellText(),
433 : 0 : getWordWrap(),
434 [ # # ]: 0 : getClipOnBounds());
435 : : }
436 : :
437 : : // provide unique ID
438 : 25144 : ImplPrimitrive2DIDBlock(SdrBlockTextPrimitive2D, PRIMITIVE2D_ID_SDRBLOCKTEXTPRIMITIVE2D)
439 : :
440 : : } // end of namespace primitive2d
441 : : } // end of namespace drawinglayer
442 : :
443 : : //////////////////////////////////////////////////////////////////////////////
444 : :
445 : : namespace drawinglayer
446 : : {
447 : : namespace primitive2d
448 : : {
449 : 31 : Primitive2DSequence SdrAutoFitTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const
450 : : {
451 [ + - ]: 31 : Primitive2DSequence aRetval;
452 [ + - ][ + - ]: 31 : getSdrText()->GetObject().impDecomposeAutoFitTextPrimitive(aRetval, *this, aViewInformation);
453 : :
454 [ + - ][ + - ]: 31 : return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval);
455 : : }
456 : :
457 : 29 : SdrAutoFitTextPrimitive2D::SdrAutoFitTextPrimitive2D(
458 : : const SdrText* pSdrText,
459 : : const OutlinerParaObject& rParaObj,
460 : : const ::basegfx::B2DHomMatrix& rTextRangeTransform,
461 : : bool bWordWrap)
462 : : : SdrTextPrimitive2D(pSdrText, rParaObj),
463 : : maTextRangeTransform(rTextRangeTransform),
464 [ + - ]: 29 : mbWordWrap(bWordWrap)
465 : : {
466 : 29 : }
467 : :
468 : 0 : bool SdrAutoFitTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
469 : : {
470 [ # # ]: 0 : if(SdrTextPrimitive2D::operator==(rPrimitive))
471 : : {
472 : 0 : const SdrBlockTextPrimitive2D& rCompare = (SdrBlockTextPrimitive2D&)rPrimitive;
473 : :
474 : 0 : return (getTextRangeTransform() == rCompare.getTextRangeTransform()
475 [ # # ][ # # ]: 0 : && getWordWrap() == rCompare.getWordWrap());
476 : : }
477 : :
478 : 0 : return false;
479 : : }
480 : :
481 : 0 : SdrTextPrimitive2D* SdrAutoFitTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const
482 : : {
483 [ # # ]: 0 : return new SdrAutoFitTextPrimitive2D(getSdrText(), getOutlinerParaObject(), rTransform * getTextRangeTransform(), getWordWrap());
484 : : }
485 : :
486 : : // provide unique ID
487 : 2 : ImplPrimitrive2DIDBlock(SdrAutoFitTextPrimitive2D, PRIMITIVE2D_ID_SDRAUTOFITTEXTPRIMITIVE2D)
488 : :
489 : : } // end of namespace primitive2d
490 : : } // end of namespace drawinglayer
491 : :
492 : : //////////////////////////////////////////////////////////////////////////////
493 : :
494 : : namespace drawinglayer
495 : : {
496 : : namespace primitive2d
497 : : {
498 : 0 : Primitive2DSequence SdrStretchTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const
499 : : {
500 [ # # ]: 0 : Primitive2DSequence aRetval;
501 [ # # ][ # # ]: 0 : getSdrText()->GetObject().impDecomposeStretchTextPrimitive(aRetval, *this, aViewInformation);
502 : :
503 [ # # ][ # # ]: 0 : return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval);
504 : : }
505 : :
506 : 0 : SdrStretchTextPrimitive2D::SdrStretchTextPrimitive2D(
507 : : const SdrText* pSdrText,
508 : : const OutlinerParaObject& rOutlinerParaObject,
509 : : const basegfx::B2DHomMatrix& rTextRangeTransform,
510 : : bool bFixedCellHeight)
511 : : : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject),
512 : : maTextRangeTransform(rTextRangeTransform),
513 [ # # ]: 0 : mbFixedCellHeight(bFixedCellHeight)
514 : : {
515 : 0 : }
516 : :
517 : 0 : bool SdrStretchTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
518 : : {
519 [ # # ]: 0 : if(SdrTextPrimitive2D::operator==(rPrimitive))
520 : : {
521 : 0 : const SdrStretchTextPrimitive2D& rCompare = (SdrStretchTextPrimitive2D&)rPrimitive;
522 : :
523 : 0 : return (getTextRangeTransform() == rCompare.getTextRangeTransform()
524 [ # # ][ # # ]: 0 : && isFixedCellHeight() == rCompare.isFixedCellHeight());
525 : : }
526 : :
527 : 0 : return false;
528 : : }
529 : :
530 : 0 : SdrTextPrimitive2D* SdrStretchTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const
531 : : {
532 : : return new SdrStretchTextPrimitive2D(
533 : 0 : getSdrText(),
534 : 0 : getOutlinerParaObject(),
535 : 0 : rTransform * getTextRangeTransform(),
536 [ # # ]: 0 : isFixedCellHeight());
537 : : }
538 : :
539 : : // provide unique ID
540 : 0 : ImplPrimitrive2DIDBlock(SdrStretchTextPrimitive2D, PRIMITIVE2D_ID_SDRSTRETCHTEXTPRIMITIVE2D)
541 : :
542 : : } // end of namespace primitive2d
543 : : } // end of namespace drawinglayer
544 : :
545 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|