LibreOffice Module svx (master) 1
EnhancedCustomShapeFontWork.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
21#include <svl/itemset.hxx>
22#include <svx/svddef.hxx>
23#include <svx/svdopath.hxx>
24#include <vcl/kernarray.hxx>
25#include <vcl/metric.hxx>
26#include <svx/sdasitm.hxx>
27#include <svx/sdtfsitm.hxx>
28#include <vcl/virdev.hxx>
29#include <svx/svditer.hxx>
30#include <editeng/eeitem.hxx>
32#include <editeng/fontitem.hxx>
33#include <editeng/postitem.hxx>
34#include <editeng/wghtitem.hxx>
35#include <editeng/fhgtitem.hxx>
37#include <svx/svdoashp.hxx>
38#include <svx/sdshitm.hxx>
39#include <svx/svdmodel.hxx>
40#include <editeng/outlobj.hxx>
41#include <editeng/editobj.hxx>
42#include <o3tl/numeric.hxx>
43#include <vector>
44#include <numeric>
45#include <algorithm>
47#include <com/sun/star/i18n/BreakIterator.hpp>
48#include <com/sun/star/i18n/ScriptType.hpp>
51#include <sal/log.hxx>
52#include <rtl/math.hxx>
54#include <comphelper/string.hxx>
55
56using namespace com::sun::star;
57using namespace com::sun::star::uno;
58
59namespace {
60
61struct FWCharacterData // representing a single character
62{
63 std::vector< tools::PolyPolygon > vOutlines;
64 tools::Rectangle aBoundRect;
65};
66struct FWParagraphData // representing a single paragraph
67{
68 OUString aString;
69 std::vector< FWCharacterData > vCharacters;
70 tools::Rectangle aBoundRect;
71 SvxFrameDirection nFrameDirection;
72};
73struct FWTextArea // representing multiple concluding paragraphs
74{
75 std::vector< FWParagraphData > vParagraphs;
76 tools::Rectangle aBoundRect;
77};
78struct FWData // representing the whole text
79{
80 std::vector< FWTextArea > vTextAreas;
81 double fHorizontalTextScaling;
82 double fVerticalTextScaling;
83 sal_uInt32 nMaxParagraphsPerTextArea;
84 sal_Int32 nSingleLineHeight;
85 bool bSingleLineMode;
86 bool bScaleX;
87};
88
89}
90
92 const SdrObjCustomShape& rSdrObjCustomShape,
93 const sal_uInt16 nOutlinesCount2d,
94 FWData& rFWData)
95{
96 bool bNoErr = false;
97 bool bSingleLineMode = false;
98 sal_uInt16 nTextAreaCount = nOutlinesCount2d;
99 if ( nOutlinesCount2d & 1 )
100 bSingleLineMode = true;
101 else
102 nTextAreaCount >>= 1;
103
104 const SdrCustomShapeGeometryItem& rGeometryItem( rSdrObjCustomShape.GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
105 const css::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( "TextPath", "ScaleX" );
106 if (pAny)
107 *pAny >>= rFWData.bScaleX;
108 else
109 rFWData.bScaleX = false;
110
111 if ( nTextAreaCount )
112 {
113 rFWData.bSingleLineMode = bSingleLineMode;
114
115 // setting the strings
116 OutlinerParaObject* pParaObj(rSdrObjCustomShape.GetOutlinerParaObject());
117
118 if ( pParaObj )
119 {
120 const EditTextObject& rTextObj = pParaObj->GetTextObject();
121 sal_Int32 nParagraphsCount = rTextObj.GetParagraphCount();
122
123 // Collect all the lines from all paragraphs
124 std::vector<int> aLineParaID; // which para this line is in
125 std::vector<int> aLineStart; // where this line start in that para
126 std::vector<int> aLineLength;
127 std::vector<OUString> aParaText;
128 for (sal_Int32 nPara = 0; nPara < nParagraphsCount; ++nPara)
129 {
130 aParaText.push_back(rTextObj.GetText(nPara));
131 sal_Int32 nPos = 0;
132 sal_Int32 nPrevPos = 0;
133 do
134 {
135 // search line break.
136 if (!rSdrObjCustomShape.getSdrModelFromSdrObject().IsLegacySingleLineFontwork())
137 nPos = aParaText[nPara].indexOf(sal_Unicode(u'\1'), nPrevPos);
138 else
139 nPos = -1; // tdf#148000: ignore line breaks in legacy fontworks
140
141 aLineParaID.push_back(nPara);
142 aLineStart.push_back(nPrevPos);
143 aLineLength.push_back((nPos >= 0 ? nPos : aParaText[nPara].getLength())
144 - nPrevPos);
145 nPrevPos = nPos + 1;
146 } while (nPos >= 0);
147 }
148
149 sal_Int32 nLinesLeft = aLineParaID.size();
150
151 rFWData.nMaxParagraphsPerTextArea = ((nLinesLeft - 1) / nTextAreaCount) + 1;
152 sal_Int32 nLine = 0;
153 while (nLinesLeft && nTextAreaCount)
154 {
155 FWTextArea aTextArea;
156 sal_Int32 nLinesInPara = ((nLinesLeft - 1) / nTextAreaCount) + 1;
157 for (sal_Int32 i = 0; i < nLinesInPara; ++i, ++nLine)
158 {
159 FWParagraphData aParagraphData;
160 aParagraphData.aString = aParaText[aLineParaID[nLine]].subView(
161 aLineStart[nLine], aLineLength[nLine]);
162
163 // retrieving some paragraph attributes
164 const SfxItemSet& rParaSet = rTextObj.GetParaAttribs(aLineParaID[nLine]);
165 aParagraphData.nFrameDirection = rParaSet.Get(EE_PARA_WRITINGDIR).GetValue();
166 aTextArea.vParagraphs.push_back(aParagraphData);
167 }
168 rFWData.vTextAreas.push_back(aTextArea);
169 nLinesLeft -= nLinesInPara;
170 nTextAreaCount--;
171 }
172
173 bNoErr = true;
174 }
175 }
176 return bNoErr;
177}
178
179static double GetLength( const tools::Polygon& rPolygon )
180{
181 double fLength = 0;
182 if ( rPolygon.GetSize() > 1 )
183 {
184 sal_uInt16 nCount = rPolygon.GetSize();
185 while( --nCount )
186 fLength += rPolygon.CalcDistance( nCount, nCount - 1 );
187 }
188 return fLength;
189}
190
191
192/* CalculateHorizontalScalingFactor returns the horizontal scaling factor for
193the whole text object, so that each text will match its corresponding 2d Outline */
195 const SdrObjCustomShape& rSdrObjCustomShape,
196 FWData& rFWData,
197 const tools::PolyPolygon& rOutline2d)
198{
199 double fScalingFactor = 1.0;
200 rFWData.fVerticalTextScaling = 1.0;
201
202 sal_uInt16 i = 0;
203 bool bSingleLineMode = false;
204 sal_uInt16 nOutlinesCount2d = rOutline2d.Count();
205
206 vcl::Font aFont;
207 const SvxFontItem& rFontItem( rSdrObjCustomShape.GetMergedItem( EE_CHAR_FONTINFO ) );
208 const SvxFontHeightItem& rFontHeight( rSdrObjCustomShape.GetMergedItem( EE_CHAR_FONTHEIGHT ) );
209 sal_Int32 nFontSize = rFontHeight.GetHeight();
210
211 if (rFWData.bScaleX)
212 aFont.SetFontHeight( nFontSize );
213 else
214 aFont.SetFontHeight( rSdrObjCustomShape.GetLogicRect().GetHeight() / rFWData.nMaxParagraphsPerTextArea );
215
216 aFont.SetAlignment( ALIGN_TOP );
217 aFont.SetFamilyName( rFontItem.GetFamilyName() );
218 aFont.SetFamily( rFontItem.GetFamily() );
219 aFont.SetStyleName( rFontItem.GetStyleName() );
220 const SvxPostureItem& rPostureItem = rSdrObjCustomShape.GetMergedItem( EE_CHAR_ITALIC );
221 aFont.SetItalic( rPostureItem.GetPosture() );
222
223 const SvxWeightItem& rWeightItem = rSdrObjCustomShape.GetMergedItem( EE_CHAR_WEIGHT );
224 aFont.SetWeight( rWeightItem.GetWeight() );
225 aFont.SetOrientation( 0_deg10 );
226 // initializing virtual device
227
228 ScopedVclPtrInstance< VirtualDevice > pVirDev(DeviceFormat::DEFAULT);
229 pVirDev->SetMapMode(MapMode(MapUnit::Map100thMM));
230 pVirDev->SetFont( aFont );
231
232 if ( nOutlinesCount2d & 1 )
233 bSingleLineMode = true;
234
235 // In case of rFWData.bScaleX == true it loops with reduced font size until the current run
236 // results in a fScalingFactor >=1.0. The fact, that case rFWData.bScaleX == true keeps font
237 // size if possible, is not done here with scaling factor 1 but is done in method
238 // FitTextOutlinesToShapeOutlines()
239 do
240 {
241 i = 0;
242 bool bScalingFactorDefined = false; // New calculation for each font size
243 for( const auto& rTextArea : rFWData.vTextAreas )
244 {
245 // calculating the width of the corresponding 2d text area
246 double fWidth = GetLength( rOutline2d.GetObject( i++ ) );
247 if ( !bSingleLineMode )
248 {
249 fWidth += GetLength( rOutline2d.GetObject( i++ ) );
250 fWidth /= 2.0;
251 }
252
253 for( const auto& rParagraph : rTextArea.vParagraphs )
254 {
255 double fTextWidth = pVirDev->GetTextWidth( rParagraph.aString );
256 if ( fTextWidth > 0.0 )
257 {
258 double fScale = fWidth / fTextWidth;
259 if ( !bScalingFactorDefined )
260 {
261 fScalingFactor = fScale;
262 bScalingFactorDefined = true;
263 }
264 else if (fScale < fScalingFactor)
265 {
266 fScalingFactor = fScale;
267 }
268 }
269 }
270 }
271
272 if (fScalingFactor < 1.0)
273 {
274 nFontSize--;
275 aFont.SetFontHeight( nFontSize );
276 pVirDev->SetFont( aFont );
277 }
278 }
279 while (rFWData.bScaleX && fScalingFactor < 1.0 && nFontSize > 1 );
280
281 if (nFontSize > 1)
282 rFWData.fVerticalTextScaling = static_cast<double>(nFontSize) / rFontHeight.GetHeight();
283
284 rFWData.fHorizontalTextScaling = fScalingFactor;
285}
286
288 const FWData& rFWData,
289 const SdrObjCustomShape& rSdrObjCustomShape,
290 FWTextArea& rTextArea,
291 bool bSameLetterHeights)
292{
293 bool bIsVertical(rSdrObjCustomShape.IsVerticalWriting());
294 sal_Int32 nVerticalOffset = rFWData.nMaxParagraphsPerTextArea > rTextArea.vParagraphs.size()
295 ? rFWData.nSingleLineHeight / 2 : 0;
296
297 for( auto& rParagraph : rTextArea.vParagraphs )
298 {
299 const OUString& rText = rParagraph.aString;
300 if ( !rText.isEmpty() )
301 {
302 // generating vcl/font
303 sal_uInt16 nScriptType = i18n::ScriptType::LATIN;
305 if ( xBI.is() )
306 {
307 nScriptType = xBI->getScriptType( rText, 0 );
308 if( i18n::ScriptType::WEAK == nScriptType )
309 {
310 sal_Int32 nChg = xBI->endOfScript( rText, 0, nScriptType );
311 if (nChg < rText.getLength() && nChg >= 0)
312 nScriptType = xBI->getScriptType( rText, nChg );
313 else
314 nScriptType = i18n::ScriptType::LATIN;
315 }
316 }
317 sal_uInt16 nFntItm = EE_CHAR_FONTINFO;
318 if ( nScriptType == i18n::ScriptType::COMPLEX )
319 nFntItm = EE_CHAR_FONTINFO_CTL;
320 else if ( nScriptType == i18n::ScriptType::ASIAN )
321 nFntItm = EE_CHAR_FONTINFO_CJK;
322 const SvxFontItem& rFontItem = static_cast<const SvxFontItem&>(rSdrObjCustomShape.GetMergedItem( nFntItm ));
323 vcl::Font aFont;
324
325 aFont.SetFontHeight( rFWData.nSingleLineHeight );
326
327 aFont.SetAlignment( ALIGN_TOP );
328
329 aFont.SetFamilyName( rFontItem.GetFamilyName() );
330 aFont.SetFamily( rFontItem.GetFamily() );
331 aFont.SetStyleName( rFontItem.GetStyleName() );
332 aFont.SetOrientation( 0_deg10 );
333
334 const SvxPostureItem& rPostureItem = rSdrObjCustomShape.GetMergedItem( EE_CHAR_ITALIC );
335 aFont.SetItalic( rPostureItem.GetPosture() );
336
337 const SvxWeightItem& rWeightItem = rSdrObjCustomShape.GetMergedItem( EE_CHAR_WEIGHT );
338 aFont.SetWeight( rWeightItem.GetWeight() );
339
340 // initializing virtual device
341 ScopedVclPtrInstance< VirtualDevice > pVirDev(DeviceFormat::DEFAULT);
342 pVirDev->SetMapMode(MapMode(MapUnit::Map100thMM));
343 pVirDev->SetFont( aFont );
344 pVirDev->EnableRTL();
345 if ( rParagraph.nFrameDirection == SvxFrameDirection::Horizontal_RL_TB )
346 pVirDev->SetLayoutMode( vcl::text::ComplexTextLayoutFlags::BiDiRtl );
347
348 const SvxCharScaleWidthItem& rCharScaleWidthItem = rSdrObjCustomShape.GetMergedItem( EE_CHAR_FONTWIDTH );
349 sal_uInt16 nCharScaleWidth = rCharScaleWidthItem.GetValue();
350 sal_Int32 nWidth = 0;
351
352 // VERTICAL
353 if ( bIsVertical )
354 {
355 // vertical _> each single character needs to be rotated by 90
356 sal_Int32 i;
357 sal_Int32 nHeight = 0;
358 tools::Rectangle aSingleCharacterUnion;
359 for ( i = 0; i < rText.getLength(); i++ )
360 {
361 FWCharacterData aCharacterData;
362 OUString aCharText( rText[ i ] );
363 if ( pVirDev->GetTextOutlines( aCharacterData.vOutlines, aCharText, 0, 0, -1, nWidth, {} ) )
364 {
365 sal_Int32 nTextWidth = pVirDev->GetTextWidth( aCharText);
366 if ( aCharacterData.vOutlines.empty() )
367 {
368 nHeight += rFWData.nSingleLineHeight;
369 }
370 else
371 {
372 for ( auto& rOutline : aCharacterData.vOutlines )
373 {
374 // rotating
375 rOutline.Rotate( Point( nTextWidth / 2, rFWData.nSingleLineHeight / 2 ), 900_deg10 );
376 aCharacterData.aBoundRect.Union( rOutline.GetBoundRect() );
377 }
378 for ( auto& rOutline : aCharacterData.vOutlines )
379 {
380 sal_Int32 nM = - aCharacterData.aBoundRect.Left() + nHeight;
381 rOutline.Move( nM, 0 );
382 aCharacterData.aBoundRect.Move( nM, 0 );
383 }
384 nHeight += aCharacterData.aBoundRect.GetWidth() + ( rFWData.nSingleLineHeight / 5 );
385 aSingleCharacterUnion.Union( aCharacterData.aBoundRect );
386 }
387 }
388 rParagraph.vCharacters.push_back( aCharacterData );
389 }
390 for ( auto& rCharacter : rParagraph.vCharacters )
391 {
392 for ( auto& rOutline : rCharacter.vOutlines )
393 {
394 rOutline.Move( ( aSingleCharacterUnion.GetWidth() - rCharacter.aBoundRect.GetWidth() ) / 2, 0 );
395 }
396 }
397 }
398 else
399 {
400 KernArray aDXArry;
401 if ( ( nCharScaleWidth != 100 ) && nCharScaleWidth )
402 { // applying character spacing
403 pVirDev->GetTextArray( rText, &aDXArry);
404 FontMetric aFontMetric( pVirDev->GetFontMetric() );
405 aFont.SetAverageFontWidth( static_cast<sal_Int32>( static_cast<double>(aFontMetric.GetAverageFontWidth()) * ( double(100) / static_cast<double>(nCharScaleWidth) ) ) );
406 pVirDev->SetFont( aFont );
407 }
408 FWCharacterData aCharacterData;
409 if ( pVirDev->GetTextOutlines( aCharacterData.vOutlines, rText, 0, 0, -1, nWidth, aDXArry ) )
410 {
411 rParagraph.vCharacters.push_back( aCharacterData );
412 }
413 else
414 {
415 // GetTextOutlines failed what usually means that it is
416 // not implemented. To make FontWork not fail (it is
417 // dependent of graphic content to get a Range) create
418 // a rectangle substitution for now
419 pVirDev->GetTextArray( rText, &aDXArry);
420 aCharacterData.vOutlines.clear();
421
422 if(aDXArry.size())
423 {
424 for(size_t a(0); a < aDXArry.size(); a++)
425 {
426 const basegfx::B2DPolygon aPolygon(
429 0 == a ? 0 : aDXArry[a - 1],
430 0,
431 aDXArry[a],
432 aFont.GetFontHeight()
433 )));
434 aCharacterData.vOutlines.push_back(tools::PolyPolygon(tools::Polygon(aPolygon)));
435 }
436 }
437 else
438 {
439 const basegfx::B2DPolygon aPolygon(
442 0,
443 0,
444 aDXArry.empty() ? 10 : aDXArry.back(),
445 aFont.GetFontHeight()
446 )));
447 aCharacterData.vOutlines.push_back(tools::PolyPolygon(tools::Polygon(aPolygon)));
448 }
449
450
451 rParagraph.vCharacters.push_back( aCharacterData );
452 }
453 }
454
455 // vertical alignment
456 for ( auto& rCharacter : rParagraph.vCharacters )
457 {
458 for( tools::PolyPolygon& rPolyPoly : rCharacter.vOutlines )
459 {
460 if ( nVerticalOffset )
461 rPolyPoly.Move( 0, nVerticalOffset );
462
463 // retrieving the boundrect for the paragraph
464 tools::Rectangle aBoundRect( rPolyPoly.GetBoundRect() );
465 rParagraph.aBoundRect.Union( aBoundRect );
466 }
467 }
468 }
469 // updating the boundrect for the text area by merging the current paragraph boundrect
470 if ( rParagraph.aBoundRect.IsEmpty() )
471 {
472 if ( rTextArea.aBoundRect.IsEmpty() )
473 rTextArea.aBoundRect = tools::Rectangle( Point( 0, 0 ), Size( 1, rFWData.nSingleLineHeight ) );
474 else
475 rTextArea.aBoundRect.AdjustBottom(rFWData.nSingleLineHeight );
476 }
477 else
478 {
479 tools::Rectangle& rParagraphBoundRect = rParagraph.aBoundRect;
480 rTextArea.aBoundRect.Union( rParagraphBoundRect );
481
482 if ( bSameLetterHeights )
483 {
484 for ( auto& rCharacter : rParagraph.vCharacters )
485 {
486 for( auto& rOutline : rCharacter.vOutlines )
487 {
488 tools::Rectangle aPolyPolyBoundRect( rOutline.GetBoundRect() );
489 if (aPolyPolyBoundRect.GetHeight() != rParagraphBoundRect.GetHeight() && aPolyPolyBoundRect.GetHeight())
490 rOutline.Scale( 1.0, static_cast<double>(rParagraphBoundRect.GetHeight()) / aPolyPolyBoundRect.GetHeight() );
491 aPolyPolyBoundRect = rOutline.GetBoundRect();
492 sal_Int32 nMove = aPolyPolyBoundRect.Top() - rParagraphBoundRect.Top();
493 if ( nMove )
494 rOutline.Move( 0, -nMove );
495 }
496 }
497 }
498 }
499 if ( bIsVertical )
500 nVerticalOffset -= rFWData.nSingleLineHeight;
501 else
502 nVerticalOffset += rFWData.nSingleLineHeight;
503 }
504}
505
507 FWData& rFWData,
508 const SdrObjCustomShape& rSdrObjCustomShape)
509{
510 SdrTextHorzAdjust eHorzAdjust(rSdrObjCustomShape.GetMergedItem( SDRATTR_TEXT_HORZADJUST ).GetValue());
511 drawing::TextFitToSizeType const eFTS(rSdrObjCustomShape.GetMergedItem( SDRATTR_TEXT_FITTOSIZE ).GetValue());
512
513 bool bSameLetterHeights = false;
514 const SdrCustomShapeGeometryItem& rGeometryItem(rSdrObjCustomShape.GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ));
515 const css::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( "TextPath", "SameLetterHeights" );
516 if ( pAny )
517 *pAny >>= bSameLetterHeights;
518
519 const SvxFontHeightItem& rFontHeight( rSdrObjCustomShape.GetMergedItem( EE_CHAR_FONTHEIGHT ) );
520 if (rFWData.bScaleX)
521 rFWData.nSingleLineHeight = rFWData.fVerticalTextScaling * rFontHeight.GetHeight();
522 else
523 rFWData.nSingleLineHeight = static_cast<sal_Int32>( ( static_cast<double>( rSdrObjCustomShape.GetLogicRect().GetHeight() )
524 / rFWData.nMaxParagraphsPerTextArea ) * rFWData.fHorizontalTextScaling );
525
526 if (rFWData.nSingleLineHeight == SAL_MIN_INT32)
527 return false;
528
529 for ( auto& rTextArea : rFWData.vTextAreas )
530 {
532 rFWData,
533 rSdrObjCustomShape,
534 rTextArea,
535 bSameLetterHeights);
536
537 if (eFTS == drawing::TextFitToSizeType_ALLLINES ||
538 // tdf#97630 interpret PROPORTIONAL same as ALLLINES so we don't
539 // need another ODF attribute!
540 eFTS == drawing::TextFitToSizeType_PROPORTIONAL)
541 {
542 for ( auto& rParagraph : rTextArea.vParagraphs )
543 {
544 sal_Int32 nParaWidth = rParagraph.aBoundRect.GetWidth();
545 if ( nParaWidth )
546 {
547 double fScale = static_cast<double>(rTextArea.aBoundRect.GetWidth()) / nParaWidth;
548
549 for ( auto& rCharacter : rParagraph.vCharacters )
550 {
551 for( auto& rOutline : rCharacter.vOutlines )
552 {
553 rOutline.Scale( fScale, 1.0 );
554 }
555 }
556 }
557 }
558 }
559 else if (rFWData.bScaleX)
560 {
561 const SdrTextVertAdjust nVertJustify = rSdrObjCustomShape.GetMergedItem( SDRATTR_TEXT_VERTADJUST ).GetValue();
562 double fFactor = nVertJustify == SdrTextVertAdjust::SDRTEXTVERTADJUST_BOTTOM ? -0.5 : ( nVertJustify == SdrTextVertAdjust::SDRTEXTVERTADJUST_TOP ? 0.5 : 0 );
563
564 for ( auto& rParagraph : rTextArea.vParagraphs )
565 {
566 sal_Int32 nHorzDiff = 0;
567 sal_Int32 nVertDiff = static_cast<double>( rFWData.nSingleLineHeight ) * fFactor * ( rTextArea.vParagraphs.size() - 1 );
568
569 if ( eHorzAdjust == SDRTEXTHORZADJUST_CENTER )
570 nHorzDiff = ( rFWData.fHorizontalTextScaling * rTextArea.aBoundRect.GetWidth() - rParagraph.aBoundRect.GetWidth() ) / 2;
571 else if ( eHorzAdjust == SDRTEXTHORZADJUST_RIGHT )
572 nHorzDiff = ( rFWData.fHorizontalTextScaling * rTextArea.aBoundRect.GetWidth() - rParagraph.aBoundRect.GetWidth() );
573
574 if (nHorzDiff || nVertDiff)
575 {
576 for ( auto& rCharacter : rParagraph.vCharacters )
577 {
578 for( auto& rOutline : rCharacter.vOutlines )
579 {
580 rOutline.Move( nHorzDiff, nVertDiff );
581 }
582 }
583 }
584 }
585 }
586 else
587 {
588 switch( eHorzAdjust )
589 {
592 {
593 for ( auto& rParagraph : rTextArea.vParagraphs )
594 {
595 sal_Int32 nHorzDiff = 0;
596 if ( eHorzAdjust == SDRTEXTHORZADJUST_CENTER )
597 nHorzDiff = ( rTextArea.aBoundRect.GetWidth() - rParagraph.aBoundRect.GetWidth() ) / 2;
598 else if ( eHorzAdjust == SDRTEXTHORZADJUST_RIGHT )
599 nHorzDiff = ( rTextArea.aBoundRect.GetWidth() - rParagraph.aBoundRect.GetWidth() );
600 if ( nHorzDiff )
601 {
602 for ( auto& rCharacter : rParagraph.vCharacters )
603 {
604 for( auto& rOutline : rCharacter.vOutlines )
605 {
606 rOutline.Move( nHorzDiff, 0 );
607 }
608 }
609 }
610 }
611 }
612 break;
613 default:
614 case SDRTEXTHORZADJUST_BLOCK : break; // don't know
615 case SDRTEXTHORZADJUST_LEFT : break; // already left aligned -> nothing to do
616 }
617 }
618 }
619
620 return true;
621}
622
624{
625 basegfx::B2DPolyPolygon aOutlines2d;
626
627 SdrObjListIter aObjListIter( *pShape2d, SdrIterMode::DeepWithGroups );
628 while( aObjListIter.IsMore() )
629 {
630 SdrObject* pPartObj = aObjListIter.Next();
631 if ( auto pPathObj = dynamic_cast<const SdrPathObj*>( pPartObj))
632 {
633 basegfx::B2DPolyPolygon aCandidate(pPathObj->GetPathPoly());
634 if(aCandidate.areControlPointsUsed())
635 {
636 aCandidate = basegfx::utils::adaptiveSubdivideByAngle(aCandidate);
637 }
638 aOutlines2d.append(aCandidate);
639 }
640 }
641
642 return aOutlines2d;
643}
644
645static void CalcDistances( const tools::Polygon& rPoly, std::vector< double >& rDistances )
646{
647 sal_uInt16 i, nCount = rPoly.GetSize();
648 if ( nCount <= 1 )
649 return;
650
651 for ( i = 0; i < nCount; i++ )
652 {
653 double fDistance = i ? rPoly.CalcDistance( i, i - 1 ) : 0.0;
654 rDistances.push_back( fDistance );
655 }
656 std::partial_sum( rDistances.begin(), rDistances.end(), rDistances.begin() );
657 double fLength = rDistances[ rDistances.size() - 1 ];
658 if ( fLength > 0.0 )
659 {
660 for ( auto& rDistance : rDistances )
661 rDistance /= fLength;
662 }
663}
664
665static void InsertMissingOutlinePoints( const std::vector< double >& rDistances,
666 const tools::Rectangle& rTextAreaBoundRect, tools::Polygon& rPoly )
667{
668 sal_uInt16 nSize = rPoly.GetSize();
669 if (nSize == 0)
670 return;
671
672 tools::Long nTextWidth = rTextAreaBoundRect.GetWidth();
673
674 if (nTextWidth == 0)
675 throw o3tl::divide_by_zero();
676
677 double fLastDistance = 0.0;
678 for (sal_uInt16 i = 0; i < nSize; ++i)
679 {
680 Point& rPoint = rPoly[ i ];
681 double fDistance = static_cast<double>( rPoint.X() - rTextAreaBoundRect.Left() ) / static_cast<double>(nTextWidth);
682 if ( i )
683 {
684 if ( fDistance > fLastDistance )
685 {
686 std::vector< double >::const_iterator aIter = std::upper_bound( rDistances.begin(), rDistances.end(), fLastDistance );
687 if ( aIter != rDistances.end() && ( *aIter > fLastDistance ) && ( *aIter < fDistance ) )
688 {
689 Point& rPt0 = rPoly[ i - 1 ];
690 sal_Int32 fX = rPoint.X() - rPt0.X();
691 sal_Int32 fY = rPoint.Y() - rPt0.Y();
692 double fd = ( 1.0 / ( fDistance - fLastDistance ) ) * ( *aIter - fLastDistance );
693 rPoly.Insert( i, Point( static_cast<sal_Int32>( rPt0.X() + fX * fd ), static_cast<sal_Int32>( rPt0.Y() + fY * fd ) ) );
694 fDistance = *aIter;
695 }
696 }
697 else if ( fDistance < fLastDistance )
698 {
699 std::vector< double >::const_iterator aIter = std::lower_bound( rDistances.begin(), rDistances.end(), fLastDistance );
700 if ( aIter != rDistances.begin() )
701 {
702 --aIter;
703 if ( ( *aIter > fDistance ) && ( *aIter < fLastDistance ) )
704 {
705 Point& rPt0 = rPoly[ i - 1 ];
706 sal_Int32 fX = rPoint.X() - rPt0.X();
707 sal_Int32 fY = rPoint.Y() - rPt0.Y();
708 double fd = ( 1.0 / ( fDistance - fLastDistance ) ) * ( *aIter - fLastDistance );
709 rPoly.Insert( i, Point( static_cast<sal_Int32>( rPt0.X() + fX * fd ), static_cast<sal_Int32>( rPt0.Y() + fY * fd ) ) );
710 fDistance = *aIter;
711 }
712 }
713 }
714 }
715 fLastDistance = fDistance;
716 }
717}
718
719static void GetPoint( const tools::Polygon& rPoly, const std::vector< double >& rDistances, const double& fX, double& fx1, double& fy1 )
720{
721 fy1 = fx1 = 0.0;
722 if ( rPoly.GetSize() <= 1 )
723 return;
724
725 std::vector< double >::const_iterator aIter = std::lower_bound( rDistances.begin(), rDistances.end(), fX );
726 sal_uInt16 nIdx = sal::static_int_cast<sal_uInt16>( std::distance( rDistances.begin(), aIter ) );
727 if ( aIter == rDistances.end() )
728 nIdx--;
729 const Point& rPt = rPoly[ nIdx ];
730 fx1 = rPt.X();
731 fy1 = rPt.Y();
732 if ( !nIdx || ( aIter == rDistances.end() ) || rtl::math::approxEqual( *aIter, fX ) )
733 return;
734
735 nIdx = sal::static_int_cast<sal_uInt16>( std::distance( rDistances.begin(), aIter ) );
736 double fDist0 = *( aIter - 1 );
737 double fd = ( 1.0 / ( *aIter - fDist0 ) ) * ( fX - fDist0 );
738 const Point& rPt2 = rPoly[ nIdx - 1 ];
739 double fWidth = rPt.X() - rPt2.X();
740 double fHeight= rPt.Y() - rPt2.Y();
741 fWidth *= fd;
742 fHeight*= fd;
743 fx1 = rPt2.X() + fWidth;
744 fy1 = rPt2.Y() + fHeight;
745}
746
747static void FitTextOutlinesToShapeOutlines( const tools::PolyPolygon& aOutlines2d, FWData& rFWData )
748{
749 sal_uInt16 nOutline2dIdx = 0;
750 for( auto& rTextArea : rFWData.vTextAreas )
751 {
752 tools::Rectangle rTextAreaBoundRect = rTextArea.aBoundRect;
753 sal_Int32 nLeft = rTextAreaBoundRect.Left();
754 sal_Int32 nTop = rTextAreaBoundRect.Top();
755 sal_Int32 nWidth = rTextAreaBoundRect.GetWidth();
756 sal_Int32 nHeight= rTextAreaBoundRect.GetHeight();
757
758 if (rFWData.bScaleX)
759 {
760 nWidth *= rFWData.fHorizontalTextScaling;
761 }
762
763 if ( rFWData.bSingleLineMode && nHeight && nWidth )
764 {
765 if ( nOutline2dIdx >= aOutlines2d.Count() )
766 break;
767 const tools::Polygon& rOutlinePoly( aOutlines2d[ nOutline2dIdx++ ] );
768 const sal_uInt16 nPointCount = rOutlinePoly.GetSize();
769 if ( nPointCount > 1 )
770 {
771 std::vector< double > vDistances;
772 vDistances.reserve( nPointCount );
773 CalcDistances( rOutlinePoly, vDistances );
774 if ( !vDistances.empty() )
775 {
776 for( auto& rParagraph : rTextArea.vParagraphs )
777 {
778 for ( auto& rCharacter : rParagraph.vCharacters )
779 {
780 for( tools::PolyPolygon& rPolyPoly : rCharacter.vOutlines )
781 {
782 tools::Rectangle aBoundRect( rPolyPoly.GetBoundRect() );
783 double fx1 = aBoundRect.Left() - nLeft;
784 double fx2 = aBoundRect.Right() - nLeft;
785 double fy1, fy2;
786 double fM1 = fx1 / static_cast<double>(nWidth);
787 double fM2 = fx2 / static_cast<double>(nWidth);
788
789 GetPoint( rOutlinePoly, vDistances, fM1, fx1, fy1 );
790 GetPoint( rOutlinePoly, vDistances, fM2, fx2, fy2 );
791
792 double fvx = fy2 - fy1;
793 double fvy = - ( fx2 - fx1 );
794 fx1 = fx1 + ( ( fx2 - fx1 ) * 0.5 );
795 fy1 = fy1 + ( ( fy2 - fy1 ) * 0.5 );
796
797 double fAngle = atan2( -fvx, -fvy );
798 double fL = hypot( fvx, fvy );
799 if (fL == 0.0)
800 {
801 SAL_WARN("svx", "FitTextOutlinesToShapeOutlines div-by-zero, abandon fit");
802 break;
803 }
804 fvx = fvx / fL;
805 fvy = fvy / fL;
806 fL = rTextArea.aBoundRect.GetHeight() / 2.0 + rTextArea.aBoundRect.Top() - rParagraph.aBoundRect.Center().Y();
807 fvx *= fL;
808 fvy *= fL;
809 rPolyPoly.Rotate( Point( aBoundRect.Center().X(), rParagraph.aBoundRect.Center().Y() ), sin( fAngle ), cos( fAngle ) );
810 rPolyPoly.Move( static_cast<sal_Int32>( ( fx1 + fvx )- aBoundRect.Center().X() ), static_cast<sal_Int32>( ( fy1 + fvy ) - rParagraph.aBoundRect.Center().Y() ) );
811 }
812 }
813 }
814 }
815 }
816 }
817 else
818 {
819 if ( ( nOutline2dIdx + 1 ) >= aOutlines2d.Count() )
820 break;
821 const tools::Polygon& rOutlinePoly( aOutlines2d[ nOutline2dIdx++ ] );
822 const tools::Polygon& rOutlinePoly2( aOutlines2d[ nOutline2dIdx++ ] );
823 const sal_uInt16 nPointCount = rOutlinePoly.GetSize();
824 const sal_uInt16 nPointCount2 = rOutlinePoly2.GetSize();
825 if ( ( nPointCount > 1 ) && ( nPointCount2 > 1 ) )
826 {
827 std::vector< double > vDistances;
828 vDistances.reserve( nPointCount );
829 std::vector< double > vDistances2;
830 vDistances2.reserve( nPointCount2 );
831 CalcDistances( rOutlinePoly, vDistances );
832 CalcDistances( rOutlinePoly2, vDistances2 );
833 for( auto& rParagraph : rTextArea.vParagraphs )
834 {
835 for ( auto& rCharacter : rParagraph.vCharacters )
836 {
837 for( tools::PolyPolygon& rPolyPoly : rCharacter.vOutlines )
838 {
839 sal_uInt16 i, nPolyCount = rPolyPoly.Count();
840 for ( i = 0; i < nPolyCount; i++ )
841 {
842 // #i35928#
843 basegfx::B2DPolygon aCandidate(rPolyPoly[ i ].getB2DPolygon());
844
845 if(aCandidate.areControlPointsUsed())
846 {
847 aCandidate = basegfx::utils::adaptiveSubdivideByAngle(aCandidate);
848 }
849
850 // create local polygon copy to work on
851 tools::Polygon aLocalPoly(aCandidate);
852
853 InsertMissingOutlinePoints( vDistances, rTextAreaBoundRect, aLocalPoly );
854 InsertMissingOutlinePoints( vDistances2, rTextAreaBoundRect, aLocalPoly );
855
856 sal_uInt16 _nPointCount = aLocalPoly.GetSize();
857 if (_nPointCount)
858 {
859 if (!nWidth || !nHeight)
860 throw o3tl::divide_by_zero();
861 for (sal_uInt16 j = 0; j < _nPointCount; ++j)
862 {
863 Point& rPoint = aLocalPoly[ j ];
864 rPoint.AdjustX( -nLeft );
865 rPoint.AdjustY( -nTop );
866 double fX = static_cast<double>(rPoint.X()) / static_cast<double>(nWidth);
867 double fY = static_cast<double>(rPoint.Y()) / static_cast<double>(nHeight);
868
869 double fx1, fy1, fx2, fy2;
870 GetPoint( rOutlinePoly, vDistances, fX, fx1, fy1 );
871 GetPoint( rOutlinePoly2, vDistances2, fX, fx2, fy2 );
872 double fWidth = fx2 - fx1;
873 double fHeight= fy2 - fy1;
874 rPoint.setX( static_cast<sal_Int32>( fx1 + fWidth * fY ) );
875 rPoint.setY( static_cast<sal_Int32>( fy1 + fHeight* fY ) );
876 }
877 }
878
879 // write back polygon
880 rPolyPoly[ i ] = aLocalPoly;
881 }
882 }
883 }
884 }
885 }
886 }
887 }
888}
889
891 const FWData& rFWData,
892 const SdrObjCustomShape& rSdrObjCustomShape)
893{
895 basegfx::B2DPolyPolygon aPolyPoly;
896 if ( !rFWData.vTextAreas.empty() )
897 {
898 for ( const auto& rTextArea : rFWData.vTextAreas )
899 {
900 for ( const auto& rParagraph : rTextArea.vParagraphs )
901 {
902 for ( const auto& rCharacter : rParagraph.vCharacters )
903 {
904 for( const auto& rOutline : rCharacter.vOutlines )
905 {
906 aPolyPoly.append( rOutline.getB2DPolyPolygon() );
907 }
908 }
909 }
910 }
911
912 pRet = new SdrPathObj(
913 rSdrObjCustomShape.getSdrModelFromSdrObject(),
915 std::move(aPolyPoly));
916
917 SfxItemSet aSet(rSdrObjCustomShape.GetMergedItemSet());
918 aSet.ClearItem( SDRATTR_TEXTDIRECTION ); //SJ: vertical writing is not required, by removing this item no outliner is created
919 aSet.Put(makeSdrShadowItem(false)); // #i37011# NO shadow for FontWork geometry
920 pRet->SetMergedItemSet( aSet ); // * otherwise we would crash, because the outliner tries to create a Paraobject, but there is no model
921 }
922
923 return pRet;
924}
925
927
929{
930 if ( !mxBreakIterator.is() )
931 {
932 Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
933 mxBreakIterator = i18n::BreakIterator::create(xContext);
934 }
935 return mxBreakIterator;
936}
937
939 const SdrObject* pShape2d,
940 const SdrObjCustomShape& rSdrObjCustomShape)
941{
943
944 // calculating scaling factor is too slow
946 return pRet;
947
948 tools::PolyPolygon aOutlines2d( GetOutlinesFromShape2d( pShape2d ) );
949 sal_uInt16 nOutlinesCount2d = aOutlines2d.Count();
950 if ( nOutlinesCount2d )
951 {
952 FWData aFWData;
953
954 if(InitializeFontWorkData(rSdrObjCustomShape, nOutlinesCount2d, aFWData))
955 {
956 /* retrieves the horizontal scaling factor that has to be used
957 to fit each paragraph text into its corresponding 2d outline */
959 rSdrObjCustomShape,
960 aFWData,
961 aOutlines2d);
962
963 /* retrieving the Outlines for the each Paragraph. */
965 aFWData,
966 rSdrObjCustomShape))
967 {
968 return nullptr;
969 }
970
971 FitTextOutlinesToShapeOutlines( aOutlines2d, aFWData );
972
974 aFWData,
975 rSdrObjCustomShape);
976 }
977 }
978 return pRet;
979}
980
981/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static void CalcDistances(const tools::Polygon &rPoly, std::vector< double > &rDistances)
static void GetPoint(const tools::Polygon &rPoly, const std::vector< double > &rDistances, const double &fX, double &fx1, double &fy1)
static bool GetFontWorkOutline(FWData &rFWData, const SdrObjCustomShape &rSdrObjCustomShape)
static void FitTextOutlinesToShapeOutlines(const tools::PolyPolygon &aOutlines2d, FWData &rFWData)
static rtl::Reference< SdrObject > CreateSdrObjectFromParagraphOutlines(const FWData &rFWData, const SdrObjCustomShape &rSdrObjCustomShape)
static void InsertMissingOutlinePoints(const std::vector< double > &rDistances, const tools::Rectangle &rTextAreaBoundRect, tools::Polygon &rPoly)
static void CalculateHorizontalScalingFactor(const SdrObjCustomShape &rSdrObjCustomShape, FWData &rFWData, const tools::PolyPolygon &rOutline2d)
static bool InitializeFontWorkData(const SdrObjCustomShape &rSdrObjCustomShape, const sal_uInt16 nOutlinesCount2d, FWData &rFWData)
static void GetTextAreaOutline(const FWData &rFWData, const SdrObjCustomShape &rSdrObjCustomShape, FWTextArea &rTextArea, bool bSameLetterHeights)
static double GetLength(const tools::Polygon &rPolygon)
static basegfx::B2DPolyPolygon GetOutlinesFromShape2d(const SdrObject *pShape2d)
virtual sal_Int32 GetParagraphCount() const=0
virtual OUString GetText(sal_Int32 nPara) const=0
virtual const SfxItemSet & GetParaAttribs(sal_Int32 nPara) const=0
static css::uno::Reference< css::i18n::XBreakIterator > mxBreakIterator
static css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIterator()
static rtl::Reference< SdrObject > CreateFontWork(const SdrObject *pShape2d, const SdrObjCustomShape &rSdrObjCustomShape)
size_t size() const
sal_Int32 back() const
bool empty() const
const EditTextObject & GetTextObject() const
css::uno::Any * GetPropertyValueByName(const OUString &rPropName)
bool IsLegacySingleLineFontwork() const
Definition: svdmodel.cxx:1731
SdrObject * Next()
Definition: svditer.hxx:63
bool IsMore() const
Definition: svditer.hxx:62
Abstract DrawObject.
Definition: svdobj.hxx:261
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
Definition: svdobj.cxx:2012
SdrModel & getSdrModelFromSdrObject() const
Definition: svdobj.cxx:289
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1977
virtual OutlinerParaObject * GetOutlinerParaObject() const override
Definition: svdotext.cxx:1344
virtual const tools::Rectangle & GetLogicRect() const override
Definition: svdotxtr.cxx:69
virtual bool IsVerticalWriting() const
Definition: svdotext.cxx:1484
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt32 GetHeight() const
FontFamily GetFamily() const
const OUString & GetStyleName() const
const OUString & GetFamilyName() const
FontItalic GetPosture() const
FontWeight GetWeight() const
void clear()
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
bool areControlPointsUsed() const
bool areControlPointsUsed() const
sal_uInt16 Count() const
void Move(tools::Long nHorzMove, tools::Long nVertMove)
void Rotate(const Point &rCenter, double fSin, double fCos)
const tools::Polygon & GetObject(sal_uInt16 nPos) const
tools::Rectangle GetBoundRect() const
void Insert(sal_uInt16 nPos, const Point &rPt)
double CalcDistance(sal_uInt16 nPt1, sal_uInt16 nPt2) const
sal_uInt16 GetSize() const
constexpr Point Center() const
constexpr tools::Long GetWidth() const
constexpr tools::Long Top() const
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
constexpr tools::Long Right() const
constexpr tools::Long GetHeight() const
tools::Rectangle & Union(const tools::Rectangle &rRect)
constexpr tools::Long Left() const
static bool IsFuzzing()
tools::Long GetFontHeight() const
void SetOrientation(Degree10 nLineOrientation)
void SetStyleName(const OUString &rStyleName)
void SetAverageFontWidth(tools::Long nWidth)
void SetItalic(FontItalic)
void SetWeight(FontWeight)
void SetFontHeight(tools::Long nHeight)
void SetFamily(FontFamily)
void SetAlignment(TextAlign)
void SetFamilyName(const OUString &rFamilyName)
tools::Long GetAverageFontWidth() const
int nCount
float u
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT(EE_CHAR_START+4)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC(EE_CHAR_START+7)
constexpr TypedWhichId< SvxFrameDirectionItem > EE_PARA_WRITINGDIR(EE_PARA_START+0)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
constexpr TypedWhichId< SvxCharScaleWidthItem > EE_CHAR_FONTWIDTH(EE_CHAR_START+3)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
ALIGN_TOP
SvxFrameDirection
uno_Any a
sal_uInt16 nPos
#define SAL_WARN(area, stream)
double getLength(const B2DPolygon &rCandidate)
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
B2DPolygon adaptiveSubdivideByAngle(const B2DPolygon &rCandidate, double fAngleBound)
int i
long Long
SdrOnOffItem makeSdrShadowItem(bool bShadow)
Definition: sdshitm.hxx:25
SdrTextVertAdjust
Definition: sdtaitm.hxx:29
@ SDRTEXTVERTADJUST_BOTTOM
Definition: sdtaitm.hxx:31
@ SDRTEXTVERTADJUST_TOP
Definition: sdtaitm.hxx:29
SdrTextHorzAdjust
Definition: sdtaitm.hxx:53
@ SDRTEXTHORZADJUST_LEFT
Definition: sdtaitm.hxx:53
@ SDRTEXTHORZADJUST_BLOCK
Definition: sdtaitm.hxx:56
@ SDRTEXTHORZADJUST_CENTER
Definition: sdtaitm.hxx:54
@ SDRTEXTHORZADJUST_RIGHT
Definition: sdtaitm.hxx:55
constexpr TypedWhichId< SdrTextFitToSizeTypeItem > SDRATTR_TEXT_FITTOSIZE(SDRATTR_MISC_FIRST+3)
constexpr TypedWhichId< SdrTextHorzAdjustItem > SDRATTR_TEXT_HORZADJUST(SDRATTR_MISC_FIRST+13)
constexpr TypedWhichId< SdrTextVertAdjustItem > SDRATTR_TEXT_VERTADJUST(SDRATTR_MISC_FIRST+8)
constexpr TypedWhichId< SdrCustomShapeGeometryItem > SDRATTR_CUSTOMSHAPE_GEOMETRY(SDRATTR_CUSTOMSHAPE_FIRST+2)
constexpr TypedWhichId< SvxWritingModeItem > SDRATTR_TEXTDIRECTION(SDRATTR_NOTPERSIST_FIRST+34)
@ Polygon
circle cut
#define SAL_MIN_INT32
sal_uInt16 sal_Unicode