/src/libreoffice/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
Line | Count | Source |
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 <sdr/primitive2d/sdrtextprimitive2d.hxx> |
21 | | #include <svx/svdotext.hxx> |
22 | | #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> |
23 | | #include <drawinglayer/primitive2d/texthierarchyprimitive2d.hxx> |
24 | | #include <editeng/outlobj.hxx> |
25 | | #include <editeng/editobj.hxx> |
26 | | #include <editeng/flditem.hxx> |
27 | | #include <drawinglayer/geometry/viewinformation2d.hxx> |
28 | | #include <svx/unoapi.hxx> |
29 | | #include <svx/svdpage.hxx> |
30 | | #include <svx/svdmodel.hxx> |
31 | | #include <svx/svdoutl.hxx> |
32 | | #include <com/sun/star/beans/XPropertySet.hpp> |
33 | | #include <utility> |
34 | | #include <osl/diagnose.h> |
35 | | |
36 | | |
37 | | using namespace com::sun::star; |
38 | | |
39 | | |
40 | | namespace |
41 | | { |
42 | | sal_Int16 getPageNumber(const uno::Reference< drawing::XDrawPage >& rxDrawPage) |
43 | 0 | { |
44 | 0 | sal_Int16 nRetval(0); |
45 | 0 | uno::Reference< beans::XPropertySet > xSet(rxDrawPage, uno::UNO_QUERY); |
46 | |
|
47 | 0 | if (xSet.is()) |
48 | 0 | { |
49 | 0 | try |
50 | 0 | { |
51 | 0 | const uno::Any aNumber(xSet->getPropertyValue(u"Number"_ustr)); |
52 | 0 | aNumber >>= nRetval; |
53 | 0 | } |
54 | 0 | catch(const uno::Exception&) |
55 | 0 | { |
56 | 0 | OSL_ASSERT(false); |
57 | 0 | } |
58 | 0 | } |
59 | |
|
60 | 0 | return nRetval; |
61 | 0 | } |
62 | | |
63 | | sal_Int16 getPageCount(const uno::Reference< drawing::XDrawPage >& rxDrawPage) |
64 | 0 | { |
65 | 0 | sal_Int16 nRetval(0); |
66 | 0 | SdrPage* pPage = GetSdrPageFromXDrawPage(rxDrawPage); |
67 | |
|
68 | 0 | if(pPage) |
69 | 0 | { |
70 | 0 | if( (pPage->GetPageNum() == 0) && !pPage->IsMasterPage() ) |
71 | 0 | { |
72 | | // handout page! |
73 | 0 | return pPage->getSdrModelFromSdrPage().getHandoutPageCount(); |
74 | 0 | } |
75 | 0 | else |
76 | 0 | { |
77 | 0 | const sal_uInt16 nPageCount(pPage->getSdrModelFromSdrPage().GetPageCount()); |
78 | 0 | nRetval = (static_cast<sal_Int16>(nPageCount) - 1) / 2; |
79 | 0 | } |
80 | 0 | } |
81 | | |
82 | 0 | return nRetval; |
83 | 0 | } |
84 | | } // end of anonymous namespace |
85 | | |
86 | | |
87 | | namespace drawinglayer::primitive2d |
88 | | { |
89 | | // support for XTEXT_PAINTSHAPE_BEGIN/XTEXT_PAINTSHAPE_END Metafile comments |
90 | | // for slideshow. This uses TextHierarchyBlockPrimitive2D to mark a text block. |
91 | | // ATM there is only one text block per SdrObject, this may get more in the future |
92 | | Primitive2DReference SdrTextPrimitive2D::encapsulateWithTextHierarchyBlockPrimitive2D(Primitive2DContainer&& aCandidate) |
93 | 483 | { |
94 | 483 | return new TextHierarchyBlockPrimitive2D(std::move(aCandidate)); |
95 | 483 | } |
96 | | |
97 | | SdrTextPrimitive2D::SdrTextPrimitive2D( |
98 | | const SdrText* pSdrText, |
99 | | OutlinerParaObject aOutlinerParaObject) |
100 | 483 | : mxSdrText(const_cast< SdrText* >(pSdrText)), |
101 | 483 | maOutlinerParaObject(std::move(aOutlinerParaObject)), |
102 | 483 | mnLastPageNumber(0), |
103 | 483 | mnLastPageCount(0), |
104 | 483 | mbContainsPageField(false), |
105 | 483 | mbContainsPageCountField(false), |
106 | 483 | mbContainsOtherFields(false) |
107 | 483 | { |
108 | 483 | const EditTextObject& rETO = maOutlinerParaObject.GetTextObject(); |
109 | | |
110 | 483 | mbContainsPageField = rETO.HasField(SvxPageField::CLASS_ID); |
111 | 483 | mbContainsPageCountField = rETO.HasField(SvxPagesField::CLASS_ID); |
112 | 483 | mbContainsOtherFields = rETO.HasField(SvxHeaderField::CLASS_ID) |
113 | 483 | || rETO.HasField(SvxFooterField::CLASS_ID) |
114 | 483 | || rETO.HasField(SvxDateTimeField::CLASS_ID) |
115 | 483 | || rETO.HasField(SvxAuthorField::CLASS_ID); |
116 | 483 | } |
117 | | |
118 | 3.70k | const SdrText* SdrTextPrimitive2D::getSdrText() const { return mxSdrText.get().get(); } |
119 | | |
120 | | bool SdrTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const |
121 | 0 | { |
122 | 0 | if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) |
123 | 0 | { |
124 | 0 | const SdrTextPrimitive2D& rCompare = static_cast<const SdrTextPrimitive2D&>(rPrimitive); |
125 | |
|
126 | 0 | return ( |
127 | | |
128 | | // compare OPO and content, but not WrongList |
129 | 0 | getOutlinerParaObject() == rCompare.getOutlinerParaObject() |
130 | | |
131 | | // also compare WrongList (not-persistent data, but visualized) |
132 | 0 | && getOutlinerParaObject().isWrongListEqual(rCompare.getOutlinerParaObject())); |
133 | 0 | } |
134 | | |
135 | 0 | return false; |
136 | 0 | } |
137 | | |
138 | | void SdrTextPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const |
139 | 1.53k | { |
140 | 1.53k | uno::Reference< drawing::XDrawPage > xCurrentlyVisualizingPage; |
141 | 1.53k | bool bCurrentlyVisualizingPageIsSet(false); |
142 | 1.53k | Color aNewTextBackgroundColor; |
143 | 1.53k | bool bNewTextBackgroundColorIsSet(false); |
144 | 1.53k | sal_Int16 nCurrentlyValidPageNumber(0); |
145 | 1.53k | sal_Int16 nCurrentlyValidPageCount(0); |
146 | | |
147 | 1.53k | if(hasBuffered2DDecomposition()) |
148 | 1.05k | { |
149 | 1.05k | bool bDoDelete(false); |
150 | | |
151 | | // check visualized page |
152 | 1.05k | if(mbContainsPageField || mbContainsPageCountField || mbContainsOtherFields) |
153 | 0 | { |
154 | | // get visualized page and remember |
155 | 0 | xCurrentlyVisualizingPage = rViewInformation.getVisualizedPage(); |
156 | 0 | bCurrentlyVisualizingPageIsSet = true; |
157 | |
|
158 | 0 | if(xCurrentlyVisualizingPage != mxLastVisualizingPage) |
159 | 0 | { |
160 | 0 | bDoDelete = true; |
161 | 0 | } |
162 | | |
163 | | // #i98870# check visualized PageNumber |
164 | 0 | if(!bDoDelete && mbContainsPageField) |
165 | 0 | { |
166 | 0 | nCurrentlyValidPageNumber = getPageNumber(xCurrentlyVisualizingPage); |
167 | |
|
168 | 0 | if(nCurrentlyValidPageNumber != mnLastPageNumber) |
169 | 0 | { |
170 | 0 | bDoDelete = true; |
171 | 0 | } |
172 | 0 | } |
173 | | |
174 | | // #i98870# check visualized PageCount, too |
175 | 0 | if(!bDoDelete && mbContainsPageCountField) |
176 | 0 | { |
177 | 0 | nCurrentlyValidPageCount = getPageCount(xCurrentlyVisualizingPage); |
178 | |
|
179 | 0 | if(nCurrentlyValidPageCount != mnLastPageCount) |
180 | 0 | { |
181 | 0 | bDoDelete = true; |
182 | 0 | } |
183 | 0 | } |
184 | 0 | } |
185 | | |
186 | | // #i101443# check change of TextBackgroundolor |
187 | 1.05k | if(!bDoDelete && getSdrText()) |
188 | 1.05k | { |
189 | 1.05k | SdrOutliner& rDrawOutliner = getSdrText()->GetObject().getSdrModelFromSdrObject().GetDrawOutliner(); |
190 | 1.05k | aNewTextBackgroundColor = rDrawOutliner.GetBackgroundColor(); |
191 | 1.05k | bNewTextBackgroundColorIsSet = true; |
192 | | |
193 | 1.05k | if(aNewTextBackgroundColor != maLastTextBackgroundColor) |
194 | 0 | { |
195 | 0 | bDoDelete = true; |
196 | 0 | } |
197 | 1.05k | } |
198 | | |
199 | 1.05k | if(bDoDelete) |
200 | 0 | { |
201 | 0 | const_cast< SdrTextPrimitive2D* >(this)->setBuffered2DDecomposition(nullptr); |
202 | 0 | } |
203 | 1.05k | } |
204 | | |
205 | 1.53k | if(!hasBuffered2DDecomposition()) |
206 | 483 | { |
207 | 483 | if(!bCurrentlyVisualizingPageIsSet && mbContainsPageField) |
208 | 0 | { |
209 | 0 | xCurrentlyVisualizingPage = rViewInformation.getVisualizedPage(); |
210 | 0 | } |
211 | | |
212 | 483 | if(!nCurrentlyValidPageNumber && mbContainsPageField) |
213 | 0 | { |
214 | 0 | nCurrentlyValidPageNumber = getPageNumber(xCurrentlyVisualizingPage); |
215 | 0 | } |
216 | | |
217 | 483 | if(!nCurrentlyValidPageCount && mbContainsPageCountField) |
218 | 0 | { |
219 | 0 | nCurrentlyValidPageCount = getPageCount(xCurrentlyVisualizingPage); |
220 | 0 | } |
221 | | |
222 | 483 | if(!bNewTextBackgroundColorIsSet && getSdrText()) |
223 | 483 | { |
224 | 483 | SdrOutliner& rDrawOutliner = getSdrText()->GetObject().getSdrModelFromSdrObject().GetDrawOutliner(); |
225 | 483 | aNewTextBackgroundColor = rDrawOutliner.GetBackgroundColor(); |
226 | 483 | } |
227 | | |
228 | 483 | const_cast< SdrTextPrimitive2D* >(this)->mxLastVisualizingPage = std::move(xCurrentlyVisualizingPage); |
229 | 483 | const_cast< SdrTextPrimitive2D* >(this)->mnLastPageNumber = nCurrentlyValidPageNumber; |
230 | 483 | const_cast< SdrTextPrimitive2D* >(this)->mnLastPageCount = nCurrentlyValidPageCount; |
231 | 483 | const_cast< SdrTextPrimitive2D* >(this)->maLastTextBackgroundColor = aNewTextBackgroundColor; |
232 | 483 | } |
233 | | |
234 | | // call parent |
235 | 1.53k | BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation); |
236 | 1.53k | } |
237 | | |
238 | | |
239 | | |
240 | | |
241 | | Primitive2DReference SdrContourTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const |
242 | 0 | { |
243 | 0 | Primitive2DContainer aRetval; |
244 | 0 | getSdrText()->GetObject().impDecomposeContourTextPrimitive(aRetval, *this, aViewInformation); |
245 | |
|
246 | 0 | return encapsulateWithTextHierarchyBlockPrimitive2D(std::move(aRetval)); |
247 | 0 | } |
248 | | |
249 | | SdrContourTextPrimitive2D::SdrContourTextPrimitive2D( |
250 | | const SdrText* pSdrText, |
251 | | const OutlinerParaObject& rOutlinerParaObject, |
252 | | basegfx::B2DPolyPolygon aUnitPolyPolygon, |
253 | | basegfx::B2DHomMatrix aObjectTransform) |
254 | 0 | : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject), |
255 | 0 | maUnitPolyPolygon(std::move(aUnitPolyPolygon)), |
256 | 0 | maObjectTransform(std::move(aObjectTransform)) |
257 | 0 | { |
258 | 0 | } |
259 | | |
260 | | bool SdrContourTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const |
261 | 0 | { |
262 | 0 | if(SdrTextPrimitive2D::operator==(rPrimitive)) |
263 | 0 | { |
264 | 0 | const SdrContourTextPrimitive2D& rCompare = static_cast<const SdrContourTextPrimitive2D&>(rPrimitive); |
265 | |
|
266 | 0 | return (getUnitPolyPolygon() == rCompare.getUnitPolyPolygon() |
267 | 0 | && getObjectTransform() == rCompare.getObjectTransform()); |
268 | 0 | } |
269 | | |
270 | 0 | return false; |
271 | 0 | } |
272 | | |
273 | | rtl::Reference<SdrTextPrimitive2D> SdrContourTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const |
274 | 0 | { |
275 | 0 | return new SdrContourTextPrimitive2D( |
276 | 0 | getSdrText(), |
277 | 0 | getOutlinerParaObject(), |
278 | 0 | getUnitPolyPolygon(), |
279 | 0 | rTransform * getObjectTransform()); |
280 | 0 | } |
281 | | |
282 | | // provide unique ID |
283 | | sal_uInt32 SdrContourTextPrimitive2D::getPrimitive2DID() const |
284 | 0 | { |
285 | 0 | return PRIMITIVE2D_ID_SDRCONTOURTEXTPRIMITIVE2D; |
286 | 0 | } |
287 | | |
288 | | |
289 | | |
290 | | Primitive2DReference SdrPathTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const |
291 | 0 | { |
292 | 0 | Primitive2DContainer aRetval; |
293 | 0 | getSdrText()->GetObject().impDecomposePathTextPrimitive(aRetval, *this, aViewInformation); |
294 | |
|
295 | 0 | return encapsulateWithTextHierarchyBlockPrimitive2D(std::move(aRetval)); |
296 | 0 | } |
297 | | |
298 | | SdrPathTextPrimitive2D::SdrPathTextPrimitive2D( |
299 | | const SdrText* pSdrText, |
300 | | const OutlinerParaObject& rOutlinerParaObject, |
301 | | basegfx::B2DPolyPolygon aPathPolyPolygon, |
302 | | attribute::SdrFormTextAttribute aSdrFormTextAttribute) |
303 | 0 | : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject), |
304 | 0 | maPathPolyPolygon(std::move(aPathPolyPolygon)), |
305 | 0 | maSdrFormTextAttribute(std::move(aSdrFormTextAttribute)) |
306 | 0 | { |
307 | 0 | } |
308 | | |
309 | | bool SdrPathTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const |
310 | 0 | { |
311 | 0 | if(SdrTextPrimitive2D::operator==(rPrimitive)) |
312 | 0 | { |
313 | 0 | const SdrPathTextPrimitive2D& rCompare = static_cast<const SdrPathTextPrimitive2D&>(rPrimitive); |
314 | |
|
315 | 0 | return (getPathPolyPolygon() == rCompare.getPathPolyPolygon() |
316 | 0 | && getSdrFormTextAttribute() == rCompare.getSdrFormTextAttribute()); |
317 | 0 | } |
318 | | |
319 | 0 | return false; |
320 | 0 | } |
321 | | |
322 | | rtl::Reference<SdrTextPrimitive2D> SdrPathTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const |
323 | 0 | { |
324 | 0 | basegfx::B2DPolyPolygon aNewPolyPolygon(getPathPolyPolygon()); |
325 | 0 | aNewPolyPolygon.transform(rTransform); |
326 | |
|
327 | 0 | return new SdrPathTextPrimitive2D( |
328 | 0 | getSdrText(), |
329 | 0 | getOutlinerParaObject(), |
330 | 0 | std::move(aNewPolyPolygon), |
331 | 0 | getSdrFormTextAttribute()); |
332 | 0 | } |
333 | | |
334 | | // provide unique ID |
335 | | sal_uInt32 SdrPathTextPrimitive2D::getPrimitive2DID() const |
336 | 0 | { |
337 | 0 | return PRIMITIVE2D_ID_SDRPATHTEXTPRIMITIVE2D; |
338 | 0 | } |
339 | | |
340 | | |
341 | | |
342 | | Primitive2DReference SdrBlockTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const |
343 | 336 | { |
344 | 336 | Primitive2DContainer aRetval; |
345 | 336 | getSdrText()->GetObject().impDecomposeBlockTextPrimitive(aRetval, *this, aViewInformation); |
346 | | |
347 | 336 | return encapsulateWithTextHierarchyBlockPrimitive2D(std::move(aRetval)); |
348 | 336 | } |
349 | | |
350 | | SdrBlockTextPrimitive2D::SdrBlockTextPrimitive2D( |
351 | | const SdrText* pSdrText, |
352 | | const OutlinerParaObject& rOutlinerParaObject, |
353 | | basegfx::B2DHomMatrix aTextRangeTransform, |
354 | | SdrTextHorzAdjust aSdrTextHorzAdjust, |
355 | | SdrTextVertAdjust aSdrTextVertAdjust, |
356 | | bool bFixedCellHeight, |
357 | | bool bUnlimitedPage, |
358 | | bool bCellText, |
359 | | bool bWordWrap) |
360 | 336 | : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject), |
361 | 336 | maTextRangeTransform(std::move(aTextRangeTransform)), |
362 | 336 | maSdrTextHorzAdjust(aSdrTextHorzAdjust), |
363 | 336 | maSdrTextVertAdjust(aSdrTextVertAdjust), |
364 | 336 | mbFixedCellHeight(bFixedCellHeight), |
365 | 336 | mbUnlimitedPage(bUnlimitedPage), |
366 | 336 | mbCellText(bCellText), |
367 | 336 | mbWordWrap(bWordWrap) |
368 | 336 | { |
369 | 336 | } |
370 | | |
371 | | bool SdrBlockTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const |
372 | 0 | { |
373 | 0 | if(SdrTextPrimitive2D::operator==(rPrimitive)) |
374 | 0 | { |
375 | 0 | const SdrBlockTextPrimitive2D& rCompare = static_cast<const SdrBlockTextPrimitive2D&>(rPrimitive); |
376 | |
|
377 | 0 | return (getTextRangeTransform() == rCompare.getTextRangeTransform() |
378 | 0 | && getSdrTextHorzAdjust() == rCompare.getSdrTextHorzAdjust() |
379 | 0 | && getSdrTextVertAdjust() == rCompare.getSdrTextVertAdjust() |
380 | 0 | && isFixedCellHeight() == rCompare.isFixedCellHeight() |
381 | 0 | && getUnlimitedPage() == rCompare.getUnlimitedPage() |
382 | 0 | && getCellText() == rCompare.getCellText() |
383 | 0 | && getWordWrap() == rCompare.getWordWrap()); |
384 | 0 | } |
385 | | |
386 | 0 | return false; |
387 | 0 | } |
388 | | |
389 | | rtl::Reference<SdrTextPrimitive2D> SdrBlockTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const |
390 | 0 | { |
391 | 0 | return new SdrBlockTextPrimitive2D( |
392 | 0 | getSdrText(), |
393 | 0 | getOutlinerParaObject(), |
394 | 0 | rTransform * getTextRangeTransform(), |
395 | 0 | getSdrTextHorzAdjust(), |
396 | 0 | getSdrTextVertAdjust(), |
397 | 0 | isFixedCellHeight(), |
398 | 0 | getUnlimitedPage(), |
399 | 0 | getCellText(), |
400 | 0 | getWordWrap()); |
401 | 0 | } |
402 | | |
403 | | // provide unique ID |
404 | | sal_uInt32 SdrBlockTextPrimitive2D::getPrimitive2DID() const |
405 | 408 | { |
406 | 408 | return PRIMITIVE2D_ID_SDRBLOCKTEXTPRIMITIVE2D; |
407 | 408 | } |
408 | | |
409 | | |
410 | | |
411 | | Primitive2DReference SdrAutoFitTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const |
412 | 147 | { |
413 | 147 | Primitive2DContainer aRetval; |
414 | 147 | getSdrText()->GetObject().impDecomposeAutoFitTextPrimitive(aRetval, *this, aViewInformation); |
415 | | |
416 | 147 | return encapsulateWithTextHierarchyBlockPrimitive2D(std::move(aRetval)); |
417 | 147 | } |
418 | | |
419 | | SdrAutoFitTextPrimitive2D::SdrAutoFitTextPrimitive2D( |
420 | | const SdrText* pSdrText, |
421 | | const OutlinerParaObject& rParaObj, |
422 | | ::basegfx::B2DHomMatrix aTextRangeTransform, |
423 | | bool bWordWrap, |
424 | | bool bFixedCellHeight) |
425 | 147 | : SdrTextPrimitive2D(pSdrText, rParaObj), |
426 | 147 | maTextRangeTransform(std::move(aTextRangeTransform)), |
427 | 147 | mbWordWrap(bWordWrap), |
428 | 147 | mbFixedCellHeight(bFixedCellHeight) |
429 | 147 | { |
430 | 147 | } |
431 | | |
432 | | bool SdrAutoFitTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const |
433 | 0 | { |
434 | 0 | if(SdrTextPrimitive2D::operator==(rPrimitive)) |
435 | 0 | { |
436 | 0 | const SdrBlockTextPrimitive2D& rCompare = static_cast<const SdrBlockTextPrimitive2D&>(rPrimitive); |
437 | |
|
438 | 0 | return (getTextRangeTransform() == rCompare.getTextRangeTransform() |
439 | 0 | && getWordWrap() == rCompare.getWordWrap() |
440 | 0 | && isFixedCellHeight() == rCompare.isFixedCellHeight()); |
441 | 0 | } |
442 | | |
443 | 0 | return false; |
444 | 0 | } |
445 | | |
446 | | rtl::Reference<SdrTextPrimitive2D> SdrAutoFitTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const |
447 | 0 | { |
448 | 0 | return new SdrAutoFitTextPrimitive2D( |
449 | 0 | getSdrText(), |
450 | 0 | getOutlinerParaObject(), |
451 | 0 | rTransform * getTextRangeTransform(), |
452 | 0 | getWordWrap(), |
453 | 0 | isFixedCellHeight()); |
454 | 0 | } |
455 | | |
456 | | // provide unique ID |
457 | | sal_uInt32 SdrAutoFitTextPrimitive2D::getPrimitive2DID() const |
458 | 294 | { |
459 | 294 | return PRIMITIVE2D_ID_SDRAUTOFITTEXTPRIMITIVE2D; |
460 | 294 | } |
461 | | |
462 | | |
463 | | |
464 | | |
465 | | SdrChainedTextPrimitive2D::SdrChainedTextPrimitive2D( |
466 | | const SdrText* pSdrText, |
467 | | const OutlinerParaObject& rOutlinerParaObject, |
468 | | basegfx::B2DHomMatrix aTextRangeTransform) |
469 | 0 | : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject), |
470 | 0 | maTextRangeTransform(std::move(aTextRangeTransform)) |
471 | 0 | { } |
472 | | |
473 | | Primitive2DReference SdrChainedTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const |
474 | 0 | { |
475 | 0 | Primitive2DContainer aRetval; |
476 | 0 | getSdrText()->GetObject().impDecomposeChainedTextPrimitive(aRetval, *this, aViewInformation); |
477 | |
|
478 | 0 | return encapsulateWithTextHierarchyBlockPrimitive2D(std::move(aRetval)); |
479 | 0 | } |
480 | | |
481 | | bool SdrChainedTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const |
482 | 0 | { |
483 | 0 | if(SdrTextPrimitive2D::operator==(rPrimitive)) |
484 | 0 | { |
485 | 0 | const SdrBlockTextPrimitive2D& rCompare = static_cast<const SdrBlockTextPrimitive2D&>(rPrimitive); |
486 | |
|
487 | 0 | return (getTextRangeTransform() == rCompare.getTextRangeTransform()); |
488 | 0 | } |
489 | | |
490 | 0 | return false; |
491 | 0 | } |
492 | | |
493 | | rtl::Reference<SdrTextPrimitive2D> SdrChainedTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const |
494 | 0 | { |
495 | 0 | return new SdrChainedTextPrimitive2D(getSdrText(), getOutlinerParaObject(), rTransform * getTextRangeTransform()); |
496 | 0 | } |
497 | | |
498 | | // provide unique ID |
499 | | sal_uInt32 SdrChainedTextPrimitive2D::getPrimitive2DID() const |
500 | 0 | { |
501 | 0 | return PRIMITIVE2D_ID_SDRCHAINEDTEXTPRIMITIVE2D; |
502 | 0 | } |
503 | | |
504 | | |
505 | | Primitive2DReference SdrStretchTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const |
506 | 0 | { |
507 | 0 | Primitive2DContainer aRetval; |
508 | 0 | getSdrText()->GetObject().impDecomposeStretchTextPrimitive(aRetval, *this, aViewInformation); |
509 | |
|
510 | 0 | return encapsulateWithTextHierarchyBlockPrimitive2D(std::move(aRetval)); |
511 | 0 | } |
512 | | |
513 | | SdrStretchTextPrimitive2D::SdrStretchTextPrimitive2D( |
514 | | const SdrText* pSdrText, |
515 | | const OutlinerParaObject& rOutlinerParaObject, |
516 | | basegfx::B2DHomMatrix aTextRangeTransform, |
517 | | bool bFixedCellHeight) |
518 | 0 | : SdrTextPrimitive2D(pSdrText, rOutlinerParaObject), |
519 | 0 | maTextRangeTransform(std::move(aTextRangeTransform)), |
520 | 0 | mbFixedCellHeight(bFixedCellHeight) |
521 | 0 | { |
522 | 0 | } |
523 | | |
524 | | bool SdrStretchTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const |
525 | 0 | { |
526 | 0 | if(SdrTextPrimitive2D::operator==(rPrimitive)) |
527 | 0 | { |
528 | 0 | const SdrStretchTextPrimitive2D& rCompare = static_cast<const SdrStretchTextPrimitive2D&>(rPrimitive); |
529 | |
|
530 | 0 | return (getTextRangeTransform() == rCompare.getTextRangeTransform() |
531 | 0 | && isFixedCellHeight() == rCompare.isFixedCellHeight()); |
532 | 0 | } |
533 | | |
534 | 0 | return false; |
535 | 0 | } |
536 | | |
537 | | rtl::Reference<SdrTextPrimitive2D> SdrStretchTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const |
538 | 0 | { |
539 | 0 | return new SdrStretchTextPrimitive2D( |
540 | 0 | getSdrText(), |
541 | 0 | getOutlinerParaObject(), |
542 | 0 | rTransform * getTextRangeTransform(), |
543 | 0 | isFixedCellHeight()); |
544 | 0 | } |
545 | | |
546 | | // provide unique ID |
547 | | sal_uInt32 SdrStretchTextPrimitive2D::getPrimitive2DID() const |
548 | 0 | { |
549 | 0 | return PRIMITIVE2D_ID_SDRSTRETCHTEXTPRIMITIVE2D; |
550 | 0 | } |
551 | | |
552 | | } // end of namespace |
553 | | |
554 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |