LibreOffice Module svx (master) 1
svdotextpathdecomposition.cxx
Go to the documentation of this file.
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 <sal/config.h>
21
22#include <o3tl/safeint.hxx>
23#include <svx/svdotext.hxx>
24#include <svx/svdoutl.hxx>
29#include <algorithm>
30#include <com/sun/star/i18n/BreakIterator.hpp>
32#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
36
37// primitive decomposition helpers
41#include <svx/unoapi.hxx>
44#include <utility>
45
46using namespace com::sun::star;
47
48// PathTextPortion helper
49
50namespace
51{
52 class impPathTextPortion
53 {
54 basegfx::B2DVector maOffset;
55 OUString maText;
56 sal_Int32 mnTextStart;
57 sal_Int32 mnTextLength;
58 sal_Int32 mnParagraph;
59 SvxFont maFont;
60 ::std::vector< double > maDblDXArray; // double DXArray, font size independent -> unit coordinate system
61 ::std::vector< sal_Bool > maKashidaArray;
62 lang::Locale maLocale;
63
64 bool mbRTL : 1;
65
66 public:
67 explicit impPathTextPortion(const DrawPortionInfo& rInfo)
68 : maOffset(rInfo.mrStartPos.X(), rInfo.mrStartPos.Y()),
69 maText(rInfo.maText),
70 mnTextStart(rInfo.mnTextStart),
71 mnTextLength(rInfo.mnTextLen),
72 mnParagraph(rInfo.mnPara),
73 maFont(rInfo.mrFont),
74 maKashidaArray(rInfo.mpKashidaArray.begin(), rInfo.mpKashidaArray.end()),
75 maLocale(rInfo.mpLocale ? *rInfo.mpLocale : lang::Locale()),
76 mbRTL(!rInfo.mrFont.IsVertical() && rInfo.IsRTL())
77 {
78 if(mnTextLength && !rInfo.mpDXArray.empty())
79 {
80 maDblDXArray.reserve(mnTextLength);
81
82 for(sal_Int32 a=0; a < mnTextLength; a++)
83 {
84 maDblDXArray.push_back(static_cast<double>(rInfo.mpDXArray[a]));
85 }
86 }
87 }
88
89 // for ::std::sort
90 bool operator<(const impPathTextPortion& rComp) const
91 {
92 if(mnParagraph < rComp.mnParagraph)
93 {
94 return true;
95 }
96
97 if(maOffset.getX() < rComp.maOffset.getX())
98 {
99 return true;
100 }
101
102 return (maOffset.getY() < rComp.maOffset.getY());
103 }
104
105 const OUString& getText() const { return maText; }
106 sal_Int32 getTextStart() const { return mnTextStart; }
107 sal_Int32 getTextLength() const { return mnTextLength; }
108 sal_Int32 getParagraph() const { return mnParagraph; }
109 const SvxFont& getFont() const { return maFont; }
110 bool isRTL() const { return mbRTL; }
111 const ::std::vector< double >& getDoubleDXArray() const { return maDblDXArray; }
112 const ::std::vector< sal_Bool >& getKashidaArray() const { return maKashidaArray; }
113 const lang::Locale& getLocale() const { return maLocale; }
114
115 sal_Int32 getPortionIndex(sal_Int32 nIndex, sal_Int32 nLength) const
116 {
117 if(mbRTL)
118 {
119 return (mnTextStart + (mnTextLength - (nIndex + nLength)));
120 }
121 else
122 {
123 return (mnTextStart + nIndex);
124 }
125 }
126
127 double getDisplayLength(sal_Int32 nIndex, sal_Int32 nLength) const
128 {
130 double fRetval(0.0);
131
132 if(maFont.IsVertical())
133 {
134 fRetval = aTextLayouter.getTextHeight() * static_cast<double>(nLength);
135 }
136 else
137 {
138 fRetval = aTextLayouter.getTextWidth(maText, getPortionIndex(nIndex, nLength), nLength);
139 }
140
141 return fRetval;
142 }
143 };
144} // end of anonymous namespace
145
146
147// TextBreakup helper
148
149namespace
150{
151 class impTextBreakupHandler
152 {
153 SdrOutliner& mrOutliner;
154 ::std::vector< impPathTextPortion > maPathTextPortions;
155
156 DECL_LINK(decompositionPathTextPrimitive, DrawPortionInfo*, void );
157
158 public:
159 explicit impTextBreakupHandler(SdrOutliner& rOutliner)
160 : mrOutliner(rOutliner)
161 {
162 }
163
164 const ::std::vector< impPathTextPortion >& decompositionPathTextPrimitive()
165 {
166 // strip portions to maPathTextPortions
167 mrOutliner.SetDrawPortionHdl(LINK(this, impTextBreakupHandler, decompositionPathTextPrimitive));
168 mrOutliner.StripPortions();
169
170 if(!maPathTextPortions.empty())
171 {
172 // sort portions by paragraph, x and y
173 ::std::sort(maPathTextPortions.begin(), maPathTextPortions.end());
174 }
175
176 return maPathTextPortions;
177 }
178 };
179
180 IMPL_LINK(impTextBreakupHandler, decompositionPathTextPrimitive, DrawPortionInfo*, pInfo, void)
181 {
182 maPathTextPortions.emplace_back(*pInfo);
183 }
184} // end of anonymous namespace
185
186
187// TextBreakup one poly and one paragraph helper
188
189namespace
190{
191 class impPolygonParagraphHandler
192 {
193 const drawinglayer::attribute::SdrFormTextAttribute maSdrFormTextAttribute; // FormText parameters
194 drawinglayer::primitive2d::Primitive2DContainer& mrDecomposition; // destination primitive list
195 drawinglayer::primitive2d::Primitive2DContainer& mrShadowDecomposition; // destination primitive list for shadow
196 uno::Reference<i18n::XBreakIterator> mxBreak; // break iterator
197
198 static double getParagraphTextLength(const ::std::vector< const impPathTextPortion* >& rTextPortions)
199 {
201 double fRetval(0.0);
202
203 for(const impPathTextPortion* pCandidate : rTextPortions)
204 {
205 if(pCandidate && pCandidate->getTextLength())
206 {
207 aTextLayouter.setFont(pCandidate->getFont());
208 fRetval += pCandidate->getDisplayLength(0, pCandidate->getTextLength());
209 }
210 }
211
212 return fRetval;
213 }
214
215 sal_Int32 getNextGlyphLen(const impPathTextPortion* pCandidate, sal_Int32 nPosition, const lang::Locale& rFontLocale)
216 {
217 sal_Int32 nNextGlyphLen(1);
218
219 if(mxBreak.is())
220 {
221 sal_Int32 nDone(0);
222 nNextGlyphLen = mxBreak->nextCharacters(pCandidate->getText(), nPosition,
223 rFontLocale, i18n::CharacterIteratorMode::SKIPCELL, 1, nDone) - nPosition;
224 }
225
226 return nNextGlyphLen;
227 }
228
229 public:
230 impPolygonParagraphHandler(
234 : maSdrFormTextAttribute(std::move(aSdrFormTextAttribute)),
235 mrDecomposition(rDecomposition),
236 mrShadowDecomposition(rShadowDecomposition)
237 {
238 // prepare BreakIterator
239 uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
240 mxBreak = i18n::BreakIterator::create(xContext);
241 }
242
243 void HandlePair(const basegfx::B2DPolygon& rPolygonCandidate, const ::std::vector< const impPathTextPortion* >& rTextPortions)
244 {
245 // prepare polygon geometry, take into account as many parameters as possible
246 basegfx::B2DPolygon aPolygonCandidate(rPolygonCandidate);
247 const double fPolyLength(basegfx::utils::getLength(aPolygonCandidate));
248 double fPolyEnd(fPolyLength);
249 double fPolyStart(0.0);
250 double fAutosizeScaleFactor(1.0);
251 bool bAutosizeScale(false);
252
253 if(maSdrFormTextAttribute.getFormTextMirror())
254 {
255 aPolygonCandidate.flip();
256 }
257
258 if(maSdrFormTextAttribute.getFormTextStart()
259 && (XFormTextAdjust::Left == maSdrFormTextAttribute.getFormTextAdjust()
260 || XFormTextAdjust::Right == maSdrFormTextAttribute.getFormTextAdjust()))
261 {
262 if(XFormTextAdjust::Left == maSdrFormTextAttribute.getFormTextAdjust())
263 {
264 fPolyStart += maSdrFormTextAttribute.getFormTextStart();
265
266 if(fPolyStart > fPolyEnd)
267 {
268 fPolyStart = fPolyEnd;
269 }
270 }
271 else
272 {
273 fPolyEnd -= maSdrFormTextAttribute.getFormTextStart();
274
275 if(fPolyEnd < fPolyStart)
276 {
277 fPolyEnd = fPolyStart;
278 }
279 }
280 }
281
282 if(XFormTextAdjust::Left != maSdrFormTextAttribute.getFormTextAdjust())
283 {
284 // calculate total text length of this paragraph, some layout needs to be done
285 const double fParagraphTextLength(getParagraphTextLength(rTextPortions));
286
287 // check if text is too long for paragraph. If yes, handle as if left aligned (default),
288 // but still take care of XFormTextAdjust::AutoSize in that case
289 const bool bTextTooLong(fParagraphTextLength > (fPolyEnd - fPolyStart));
290
291 if(XFormTextAdjust::Right == maSdrFormTextAttribute.getFormTextAdjust())
292 {
293 if(!bTextTooLong)
294 {
295 // if right aligned, add difference to polygon start
296 fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength);
297 }
298 }
299 else if(XFormTextAdjust::Center == maSdrFormTextAttribute.getFormTextAdjust())
300 {
301 if(!bTextTooLong)
302 {
303 // if centered, add half of difference to polygon start
304 fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength) / 2.0;
305 }
306 }
307 else if(XFormTextAdjust::AutoSize == maSdrFormTextAttribute.getFormTextAdjust())
308 {
309 // if scale, prepare scale factor between curve length and text length
310 if(0.0 != fParagraphTextLength)
311 {
312 fAutosizeScaleFactor = (fPolyEnd - fPolyStart) / fParagraphTextLength;
313 bAutosizeScale = true;
314 }
315 }
316 }
317
318 // handle text portions for this paragraph
319 for(auto a = rTextPortions.begin(); a != rTextPortions.end() && fPolyStart < fPolyEnd; ++a)
320 {
321 const impPathTextPortion* pCandidate = *a;
322 basegfx::B2DVector aFontScaling;
323
324 if(pCandidate && pCandidate->getTextLength())
325 {
326 const drawinglayer::attribute::FontAttribute aCandidateFontAttribute(
328 aFontScaling,
329 pCandidate->getFont(),
330 pCandidate->isRTL(),
331 false));
332
334 aTextLayouter.setFont(pCandidate->getFont());
335 sal_Int32 nUsedTextLength(0);
336
337 while(nUsedTextLength < pCandidate->getTextLength() && fPolyStart < fPolyEnd)
338 {
339 sal_Int32 nNextGlyphLen(getNextGlyphLen(pCandidate, pCandidate->getTextStart() + nUsedTextLength, pCandidate->getLocale()));
340
341 // prepare portion length. Takes RTL sections into account.
342 double fPortionLength(pCandidate->getDisplayLength(nUsedTextLength, nNextGlyphLen));
343
344 if(bAutosizeScale)
345 {
346 // when autosize scaling, expand portion length
347 fPortionLength *= fAutosizeScaleFactor;
348 }
349
350 // create transformation
351 basegfx::B2DHomMatrix aNewTransformA, aNewTransformB, aNewShadowTransform;
352 basegfx::B2DPoint aStartPos(basegfx::utils::getPositionAbsolute(aPolygonCandidate, fPolyStart, fPolyLength));
353 basegfx::B2DPoint aEndPos(aStartPos);
354
355 // add font scaling
356 aNewTransformA.scale(aFontScaling.getX(), aFontScaling.getY());
357
358 // prepare scaling of text primitive
359 if(bAutosizeScale)
360 {
361 // when autosize scaling, expand text primitive scaling to it
362 aNewTransformA.scale(fAutosizeScaleFactor, fAutosizeScaleFactor);
363 }
364
365 // eventually create shadow primitives from aDecomposition and add to rDecomposition
366 const bool bShadow(XFormTextShadow::NONE != maSdrFormTextAttribute.getFormTextShadow());
367
368 if(bShadow)
369 {
370 if(XFormTextShadow::Normal == maSdrFormTextAttribute.getFormTextShadow())
371 {
372 aNewShadowTransform.translate(
373 maSdrFormTextAttribute.getFormTextShdwXVal(),
374 -maSdrFormTextAttribute.getFormTextShdwYVal());
375 }
376 else // XFormTextShadow::Slant
377 {
378 double fScaleValue(maSdrFormTextAttribute.getFormTextShdwYVal() / 100.0);
379 double fShearValue(-basegfx::deg2rad<10>(maSdrFormTextAttribute.getFormTextShdwXVal()));
380
381 aNewShadowTransform.scale(1.0, fScaleValue);
382 aNewShadowTransform.shearX(sin(fShearValue));
383 aNewShadowTransform.scale(1.0, cos(fShearValue));
384 }
385 }
386
387 switch(maSdrFormTextAttribute.getFormTextStyle())
388 {
390 {
391 aEndPos = basegfx::utils::getPositionAbsolute(aPolygonCandidate, fPolyStart + fPortionLength, fPolyLength);
392 const basegfx::B2DVector aDirection(aEndPos - aStartPos);
393 aNewTransformB.rotate(atan2(aDirection.getY(), aDirection.getX()));
394 aNewTransformB.translate(aStartPos.getX(), aStartPos.getY());
395
396 break;
397 }
399 {
400 aNewTransformB.translate(aStartPos.getX() - (fPortionLength / 2.0), aStartPos.getY());
401
402 break;
403 }
405 {
406 aEndPos = basegfx::utils::getPositionAbsolute(aPolygonCandidate, fPolyStart + fPortionLength, fPolyLength);
407 const basegfx::B2DVector aDirection(aEndPos - aStartPos);
408 const double fShearValue(atan2(aDirection.getY(), aDirection.getX()));
409 const double fSin(sin(fShearValue));
410 const double fCos(cos(fShearValue));
411
412 aNewTransformB.shearX(-fSin);
413
414 // Scale may lead to objects without height since fCos == 0.0 is possible.
415 // Renderers need to handle that, it's not a forbidden value and does not
416 // need to be avoided
417 aNewTransformB.scale(1.0, fCos);
418 aNewTransformB.translate(aStartPos.getX() - (fPortionLength / 2.0), aStartPos.getY());
419
420 break;
421 }
423 {
424 aEndPos = basegfx::utils::getPositionAbsolute(aPolygonCandidate, fPolyStart + fPortionLength, fPolyLength);
425 const basegfx::B2DVector aDirection(aEndPos - aStartPos);
426 const double fShearValue(atan2(aDirection.getY(), aDirection.getX()));
427 const double fCos(cos(fShearValue));
428 const double fTan(tan(fShearValue));
429
430 // shear to 'stand' on the curve
431 aNewTransformB.shearY(fTan);
432
433 // scale in X to make as tight as needed. As with XFT_SLANT_X, this may
434 // lead to primitives without width which the renderers will handle
435 aNewTransformA.scale(fCos, 1.0);
436
437 aNewTransformB.translate(aStartPos.getX(), aStartPos.getY());
438
439 break;
440 }
441 default : break; // XFormTextStyle::NONE
442 }
443
444 // distance from path?
445 if(maSdrFormTextAttribute.getFormTextDistance())
446 {
447 if(aEndPos.equal(aStartPos))
448 {
449 aEndPos = basegfx::utils::getPositionAbsolute(aPolygonCandidate, fPolyStart + fPortionLength, fPolyLength);
450 }
451
452 // use back vector (aStartPos - aEndPos) here to get mirrored perpendicular as in old stuff
453 const basegfx::B2DVector aPerpendicular(
454 basegfx::getNormalizedPerpendicular(aStartPos - aEndPos) *
455 maSdrFormTextAttribute.getFormTextDistance());
456 aNewTransformB.translate(aPerpendicular.getX(), aPerpendicular.getY());
457 }
458
459 if(!pCandidate->getText().isEmpty() && nNextGlyphLen)
460 {
461 const sal_Int32 nPortionIndex(pCandidate->getPortionIndex(nUsedTextLength, nNextGlyphLen));
462 ::std::vector< double > aNewDXArray;
463
464 if(nNextGlyphLen > 1 && !pCandidate->getDoubleDXArray().empty())
465 {
466 // copy DXArray for portion
467 aNewDXArray.insert(
468 aNewDXArray.begin(),
469 pCandidate->getDoubleDXArray().begin() + nPortionIndex,
470 pCandidate->getDoubleDXArray().begin() + (nPortionIndex + nNextGlyphLen));
471
472 if(nPortionIndex > 0)
473 {
474 // adapt to portion start
475 double fDXOffset= *(pCandidate->getDoubleDXArray().begin() + (nPortionIndex - 1));
476 ::std::transform(
477 aNewDXArray.begin(), aNewDXArray.end(),
478 aNewDXArray.begin(), [fDXOffset](double x) { return x - fDXOffset; });
479 }
480
481 if(bAutosizeScale)
482 {
483 // when autosize scaling, adapt to DXArray, too
484 ::std::transform(
485 aNewDXArray.begin(), aNewDXArray.end(),
486 aNewDXArray.begin(), [fAutosizeScaleFactor](double x) { return x * fAutosizeScaleFactor; });
487 }
488 }
489
490 if(bShadow)
491 {
492 // shadow primitive creation
493 const Color aShadowColor(maSdrFormTextAttribute.getFormTextShdwColor());
494 const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor());
495
496 mrShadowDecomposition.push_back(
498 aNewTransformB * aNewShadowTransform * aNewTransformA,
499 pCandidate->getText(),
500 nPortionIndex,
501 nNextGlyphLen,
502 std::vector(aNewDXArray),
503 std::vector(pCandidate->getKashidaArray()),
504 aCandidateFontAttribute,
505 pCandidate->getLocale(),
506 aRGBShadowColor) );
507 }
508
509 {
510 // primitive creation
511 const Color aColor(pCandidate->getFont().GetColor());
512 const basegfx::BColor aRGBColor(aColor.getBColor());
513
514 mrDecomposition.push_back(
516 aNewTransformB * aNewTransformA,
517 pCandidate->getText(),
518 nPortionIndex,
519 nNextGlyphLen,
520 std::move(aNewDXArray),
521 std::vector(pCandidate->getKashidaArray()),
522 aCandidateFontAttribute,
523 pCandidate->getLocale(),
524 aRGBColor) );
525 }
526 }
527
528 // consume from portion
529 nUsedTextLength += nNextGlyphLen;
530
531 // consume from polygon
532 fPolyStart += fPortionLength;
533 }
534 }
535 }
536 }
537 };
538} // end of anonymous namespace
539
540
541// primitive decomposition helpers
542
543namespace
544{
545 void impAddPolygonStrokePrimitives(
546 const basegfx::B2DPolyPolygonVector& rB2DPolyPolyVector,
547 const basegfx::B2DHomMatrix& rTransform,
548 const drawinglayer::attribute::LineAttribute& rLineAttribute,
549 const drawinglayer::attribute::StrokeAttribute& rStrokeAttribute,
551 {
552 for(const auto& rB2DPolyPolygon : rB2DPolyPolyVector)
553 {
554 // prepare PolyPolygons
555 basegfx::B2DPolyPolygon aB2DPolyPolygon = rB2DPolyPolygon;
556 aB2DPolyPolygon.transform(rTransform);
557
558 for(auto const& rPolygon : std::as_const(aB2DPolyPolygon))
559 {
560 // create one primitive per polygon
561 rTarget.push_back(
563 rPolygon, rLineAttribute, rStrokeAttribute) );
564 }
565 }
566 }
567
571 {
573
575 {
577
578 if(pTextCandidate)
579 {
580 basegfx::B2DPolyPolygonVector aB2DPolyPolyVector;
581 basegfx::B2DHomMatrix aPolygonTransform;
582
583 // get text outlines and their object transformation
584 pTextCandidate->getTextOutlinesAndTransformation(aB2DPolyPolyVector, aPolygonTransform);
585
586 if(!aB2DPolyPolyVector.empty())
587 {
588 // create stroke primitives
590 impAddPolygonStrokePrimitives(
591 aB2DPolyPolyVector,
592 aPolygonTransform,
593 rOutlineAttribute.getLineAttribute(),
594 rOutlineAttribute.getStrokeAttribute(),
595 aStrokePrimitives);
596 const sal_uInt32 nStrokeCount(aStrokePrimitives.size());
597
598 if(nStrokeCount)
599 {
600 if(rOutlineAttribute.getTransparence())
601 {
602 // create UnifiedTransparencePrimitive2D
603 aNewPrimitives.push_back(
605 std::move(aStrokePrimitives),
606 static_cast<double>(rOutlineAttribute.getTransparence()) / 100.0) );
607 }
608 else
609 {
610 // add polygons to rDecomposition as polygonStrokePrimitives
611 aNewPrimitives.append( std::move(aStrokePrimitives) );
612 }
613 }
614 }
615 }
616 }
617
618 return aNewPrimitives;
619 }
620} // end of anonymous namespace
621
622
623// primitive decomposition
624
627 const drawinglayer::primitive2d::SdrPathTextPrimitive2D& rSdrPathTextPrimitive,
628 const drawinglayer::geometry::ViewInformation2D& aViewInformation) const
629{
632
633 // prepare outliner
634 SdrOutliner& rOutliner = ImpGetDrawOutliner();
635 rOutliner.SetUpdateLayout(true);
636 rOutliner.Clear();
638 rOutliner.SetText(rSdrPathTextPrimitive.getOutlinerParaObject());
639
640 // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition
641 rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage()));
642
643 // now break up to text portions
644 impTextBreakupHandler aConverter(rOutliner);
645 const ::std::vector< impPathTextPortion > rPathTextPortions = aConverter.decompositionPathTextPrimitive();
646
647 if(!rPathTextPortions.empty())
648 {
649 // get FormText and polygon values
650 const drawinglayer::attribute::SdrFormTextAttribute& rFormTextAttribute = rSdrPathTextPrimitive.getSdrFormTextAttribute();
651 const basegfx::B2DPolyPolygon& rPathPolyPolygon(rSdrPathTextPrimitive.getPathPolyPolygon());
652
653 // get loop count
654 sal_uInt32 nLoopCount(rPathPolyPolygon.count());
655
656 if(o3tl::make_unsigned(rOutliner.GetParagraphCount()) < nLoopCount)
657 {
658 nLoopCount = rOutliner.GetParagraphCount();
659 }
660
661 if(nLoopCount)
662 {
663 // prepare common decomposition stuff
666 impPolygonParagraphHandler aPolygonParagraphHandler(
667 rFormTextAttribute,
668 aRegularDecomposition,
669 aShadowDecomposition);
670 sal_uInt32 a;
671
672 for(a = 0; a < nLoopCount; a++)
673 {
674 // filter text portions for this paragraph
675 ::std::vector< const impPathTextPortion* > aParagraphTextPortions;
676
677 for(const auto & rCandidate : rPathTextPortions)
678 {
679 if(static_cast<sal_uInt32>(rCandidate.getParagraph()) == a)
680 {
681 aParagraphTextPortions.push_back(&rCandidate);
682 }
683 }
684
685 // handle data pair polygon/ParagraphTextPortions
686 if(!aParagraphTextPortions.empty())
687 {
688 aPolygonParagraphHandler.HandlePair(rPathPolyPolygon.getB2DPolygon(a), aParagraphTextPortions);
689 }
690 }
691
692 const sal_uInt32 nShadowCount(aShadowDecomposition.size());
693 const sal_uInt32 nRegularCount(aRegularDecomposition.size());
694
695 if(nShadowCount)
696 {
697 // add shadow primitives to decomposition
698
699 // if necessary, add shadow outlines
700 if(rFormTextAttribute.getFormTextOutline()
701 && !rFormTextAttribute.getShadowOutline().isDefault())
702 {
703 aRetvalA = aShadowDecomposition;
705 impAddPathTextOutlines(
706 aShadowDecomposition,
707 rFormTextAttribute.getShadowOutline()));
708
709 aRetvalA.append(aOutlines);
710 }
711 else
712 aRetvalA = std::move(aShadowDecomposition);
713 }
714
715 if(nRegularCount)
716 {
717 // add normal primitives to decomposition
718
719 // if necessary, add outlines
720 if(rFormTextAttribute.getFormTextOutline()
721 && !rFormTextAttribute.getOutline().isDefault())
722 {
723 aRetvalB = aRegularDecomposition;
725 impAddPathTextOutlines(
726 aRegularDecomposition,
727 rFormTextAttribute.getOutline()));
728
729 aRetvalB.append(aOutlines);
730 }
731 else
732 aRetvalB = std::move(aRegularDecomposition);
733 }
734 }
735 }
736
737 // clean up outliner
739 rOutliner.Clear();
740 rOutliner.setVisualizedPage(nullptr);
741
742 // concatenate all results
743 rTarget.append(std::move(aRetvalA));
744 rTarget.append(std::move(aRetvalB));
745}
746
747
748/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Text maText
IMPL_LINK(MaskData, PipetteHdl, const OUString &, rId, void)
Definition: _bmpmask.cxx:192
o3tl::span< const sal_Int32 > mpDXArray
void SetText(const OutlinerParaObject &)
void SetDrawPortionHdl(const Link< DrawPortionInfo *, void > &rLink)
void SetPaperSize(const Size &rSize)
void Clear()
bool SetUpdateLayout(bool bUpdate)
void StripPortions()
sal_Int32 GetParagraphCount() const
void setVisualizedPage(const SdrPage *pPage)
Definition: svdoutl.hxx:44
SdrOutliner & ImpGetDrawOutliner() const
Definition: svdotext.cxx:1194
void impDecomposePathTextPrimitive(drawinglayer::primitive2d::Primitive2DContainer &rTarget, const drawinglayer::primitive2d::SdrPathTextPrimitive2D &rSdrPathTextPrimitive, const drawinglayer::geometry::ViewInformation2D &aViewInformation) const
void shearX(double fSx)
void rotate(double fRadiant)
void translate(double fX, double fY)
void scale(double fX, double fY)
void shearY(double fSy)
B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const
void transform(const basegfx::B2DHomMatrix &rMatrix)
sal_uInt32 count() const
TYPE getX() const
TYPE getY() const
const SdrFormTextOutlineAttribute & getShadowOutline() const
const SdrFormTextOutlineAttribute & getOutline() const
const css::uno::Reference< css::drawing::XDrawPage > & getVisualizedPage() const
void append(const Primitive2DReference &)
const basegfx::B2DPolyPolygon & getPathPolyPolygon() const
const attribute::SdrFormTextAttribute & getSdrFormTextAttribute() const
const OutlinerParaObject & getOutlinerParaObject() const
double getTextWidth(const OUString &rText, sal_uInt32 nIndex, sal_uInt32 nLength) const
void setFont(const vcl::Font &rFont)
void getTextOutlinesAndTransformation(basegfx::B2DPolyPolygonVector &rTarget, basegfx::B2DHomMatrix &rTransformation) const
constexpr bool empty() const noexcept
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
FilterGroup & rTarget
uno_Any a
const long LONG_MAX
double getLength(const B2DPolygon &rCandidate)
B2DPoint getPositionAbsolute(const B2DPolygon &rCandidate, double fDistance, double fLength)
B2DVector getNormalizedPerpendicular(const B2DVector &rVec)
::std::vector< B2DPolyPolygon > B2DPolyPolygonVector
const LanguageTag & getLocale()
attribute::FontAttribute getFontAttributeFromVclFont(basegfx::B2DVector &o_rSize, const vcl::Font &rFont, bool bRTL, bool bBiDiStrong)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
enumrange< T >::Iterator begin(enumrange< T >)
end
#define Y
css::drawing::Direction3D aDirection
bool operator<(const Subset &rLHS, const Subset &rRHS)
Definition: ucsubset.hxx:50
SdrPage * GetSdrPageFromXDrawPage(const uno::Reference< drawing::XDrawPage > &xDrawPage) noexcept
returns the SdrObject from the given StarOffice API wrapper
Definition: unopage.cxx:886
sal_Int32 nLength