LibreOffice Module oox (master) 1
vmlformatting.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 <cstdlib>
23
25
26#include <com/sun/star/beans/PropertyValue.hpp>
27#include <com/sun/star/beans/XPropertySet.hpp>
28#include <com/sun/star/drawing/XShape.hpp>
29#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
30#include <com/sun/star/table/ShadowFormat.hpp>
31#include <com/sun/star/text/XTextRange.hpp>
34#include <rtl/strbuf.hxx>
35#include <sal/log.hxx>
36#include <osl/diagnose.h>
44#include <oox/token/properties.hxx>
45#include <oox/token/tokens.hxx>
46#include <svx/svdtrans.hxx>
48#include <o3tl/string_view.hxx>
49#include <vcl/virdev.hxx>
50
51namespace oox::vml {
52
53using namespace ::com::sun::star;
54using namespace ::com::sun::star::geometry;
55
56using ::oox::drawingml::Color;
57using ::oox::drawingml::FillProperties;
58using ::oox::drawingml::LineArrowProperties;
59using ::oox::drawingml::LineProperties;
60using ::oox::drawingml::ShapePropertyMap;
61using ::com::sun::star::awt::Point;
62using ::com::sun::star::drawing::PolygonFlags;
63using ::com::sun::star::drawing::PolygonFlags_NORMAL;
64using ::com::sun::star::drawing::PolygonFlags_CONTROL;
65
66namespace {
67
68bool lclExtractDouble( double& orfValue, size_t& ornEndPos, std::u16string_view aValue )
69{
70 // extract the double value and find start position of unit characters
71 rtl_math_ConversionStatus eConvStatus = rtl_math_ConversionStatus_Ok;
72 sal_Int32 nEndPos;
73 orfValue = ::rtl::math::stringToDouble( aValue, '.', '\0', &eConvStatus, &nEndPos );
74 ornEndPos = nEndPos;
75 return eConvStatus == rtl_math_ConversionStatus_Ok;
76}
77
78} // namespace
79
80bool ConversionHelper::separatePair( std::u16string_view& orValue1, std::u16string_view& orValue2,
81 std::u16string_view rValue, sal_Unicode cSep )
82{
83 size_t nSepPos = rValue.find( cSep );
84 if( nSepPos != std::u16string_view::npos )
85 {
86 orValue1 = o3tl::trim(rValue.substr( 0, nSepPos ));
87 orValue2 = o3tl::trim(rValue.substr( nSepPos + 1 ));
88 }
89 else
90 {
91 orValue1 = o3tl::trim(rValue);
92 orValue2 = std::u16string_view();
93 }
94 return !orValue1.empty() && !orValue2.empty();
95}
96
97bool ConversionHelper::decodeBool( std::u16string_view rValue )
98{
99 sal_Int32 nToken = AttributeConversion::decodeToken( rValue );
100 // anything else than 't' or 'true' is considered to be false, as specified
101 return (nToken == XML_t) || (nToken == XML_true);
102}
103
104double ConversionHelper::decodePercent( std::u16string_view rValue, double fDefValue )
105{
106 if( rValue.empty() )
107 return fDefValue;
108
109 double fValue = 0.0;
110 size_t nEndPos = 0;
111 if( !lclExtractDouble( fValue, nEndPos, rValue ) )
112 return fDefValue;
113
114 if( nEndPos == rValue.size() )
115 return fValue;
116
117 if( (nEndPos + 1 == rValue.size()) && (rValue[ nEndPos ] == '%') )
118 return fValue / 100.0;
119
120 if( (nEndPos + 1 == rValue.size()) && (rValue[ nEndPos ] == 'f') )
121 return fValue / 65536.0;
122
123 OSL_FAIL( "ConversionHelper::decodePercent - unknown measure unit" );
124 return fDefValue;
125}
126
127Degree100 ConversionHelper::decodeRotation( std::u16string_view rValue )
128{
129 if( rValue.empty() )
130 return 0_deg100;
131
132 double fValue = 0.0;
133 double fRotation = 0.0;
134 size_t nEndPos = 0;
135 if( !lclExtractDouble(fValue, nEndPos, rValue) )
136 return 0_deg100;
137
138 if( nEndPos == rValue.size() )
139 fRotation = fValue;
140 else if( (nEndPos + 2 == rValue.size()) && (rValue[nEndPos] == 'f') && (rValue[nEndPos+1] == 'd') )
141 fRotation = fValue / 65536.0;
142 else
143 {
144 OSL_FAIL("ConversionHelper::decodeRotation - unknown measure unit");
145 return 0_deg100;
146 }
147
148 return NormAngle36000(Degree100(static_cast<sal_Int32>(fRotation * -100)));
149}
150
152 std::u16string_view rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel )
153{
154 // default for missing values is 0
155 if( rValue.empty() )
156 return 0;
157
158 // TODO: according to spec, value may contain "auto"
159 if ( rValue == u"auto" )
160 {
161 OSL_FAIL( "ConversionHelper::decodeMeasureToEmu - special value 'auto' must be handled by caller" );
162 return nRefValue;
163 }
164
165 // extract the double value and find start position of unit characters
166 double fValue = 0.0;
167 size_t nEndPos = 0;
168 if( !lclExtractDouble( fValue, nEndPos, rValue ) || (fValue == 0.0) )
169 return 0;
170
171 // process trailing unit, convert to EMU
172 std::u16string_view aUnit;
173 if( (0 < nEndPos) && (nEndPos < rValue.size()) )
174 aUnit = rValue.substr( nEndPos );
175 else if( bDefaultAsPixel )
176 aUnit = u"px";
177 // else default is EMU
178
179 if( aUnit.size() == 2 )
180 {
181 sal_Unicode cChar1 = aUnit[ 0 ];
182 sal_Unicode cChar2 = aUnit[ 1 ];
183 if ((cChar1 == 'i') && (cChar2 == 'n'))
185 else if ((cChar1 == 'c') && (cChar2 == 'm'))
187 else if ((cChar1 == 'm') && (cChar2 == 'm'))
189 else if ((cChar1 == 'p') && (cChar2 == 't'))
191 else if ((cChar1 == 'p') && (cChar2 == 'c'))
193 else if( (cChar1 == 'p') && (cChar2 == 'x') ) // 1 pixel, dependent on output device
194 fValue = o3tl::convert(bPixelX ? rGraphicHelper.convertScreenPixelXToHmm(fValue)
195 : rGraphicHelper.convertScreenPixelYToHmm(fValue),
197 }
198 else if( (aUnit.size() == 1) && (aUnit[ 0 ] == '%') )
199 {
200 fValue *= nRefValue / 100.0;
201 }
202 else if( bDefaultAsPixel || !aUnit.empty() ) // default as EMU and no unit -> do nothing
203 {
204 OSL_FAIL( "ConversionHelper::decodeMeasureToEmu - unknown measure unit" );
205 fValue = nRefValue;
206 }
207 return o3tl::saturating_cast< sal_Int64 >( fValue + 0.5 );
208}
209
211 std::u16string_view rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel )
212{
213 return ::oox::drawingml::convertEmuToHmm( decodeMeasureToEmu( rGraphicHelper, rValue, nRefValue, bPixelX, bDefaultAsPixel ) );
214}
215
217 std::u16string_view rValue, sal_Int32 nRefValue,
218 bool bPixelX, bool bDefaultAsPixel)
219{
220 return ::o3tl::convert(
221 decodeMeasureToEmu(rGraphicHelper, rValue, nRefValue, bPixelX, bDefaultAsPixel),
223}
224
226 const std::optional< OUString >& roVmlColor, const std::optional< double >& roVmlOpacity,
227 ::Color nDefaultRgb, ::Color nPrimaryRgb )
228{
229 Color aDmlColor;
230
231 // convert opacity
232 const sal_Int32 DML_FULL_OPAQUE = ::oox::drawingml::MAX_PERCENT;
233 double fOpacity = roVmlOpacity.value_or( 1.0 );
234 sal_Int32 nOpacity = getLimitedValue< sal_Int32, double >( fOpacity * DML_FULL_OPAQUE, 0, DML_FULL_OPAQUE );
235 if( nOpacity < DML_FULL_OPAQUE )
236 aDmlColor.addTransformation( XML_alpha, nOpacity );
237
238 // color attribute not present - set passed default color
239 if( !roVmlColor.has_value() )
240 {
241 aDmlColor.setSrgbClr( nDefaultRgb );
242 return aDmlColor;
243 }
244
245 // separate leading color name or RGB value from following palette index
246 std::u16string_view aColorName, aColorIndex;
247 separatePair( aColorName, aColorIndex, roVmlColor.value(), ' ' );
248
249 // RGB colors in the format '#RRGGBB'
250 if( (aColorName.size() == 7) && (aColorName[ 0 ] == '#') )
251 {
252 aDmlColor.setSrgbClr( o3tl::toUInt32(aColorName.substr( 1 ), 16) );
253 return aDmlColor;
254 }
255
256 // RGB colors in the format '#RGB'
257 if( (aColorName.size() == 4) && (aColorName[ 0 ] == '#') )
258 {
259 sal_Int32 nR = o3tl::toUInt32(aColorName.substr( 1, 1 ), 16 ) * 0x11;
260 sal_Int32 nG = o3tl::toUInt32(aColorName.substr( 2, 1 ), 16 ) * 0x11;
261 sal_Int32 nB = o3tl::toUInt32(aColorName.substr( 3, 1 ), 16 ) * 0x11;
262 aDmlColor.setSrgbClr( (nR << 16) | (nG << 8) | nB );
263 return aDmlColor;
264 }
265
266 /* Predefined color names or system color names (resolve to RGB to detect
267 valid color name). */
268 sal_Int32 nColorToken = AttributeConversion::decodeToken( aColorName );
269 ::Color nRgbValue = Color::getVmlPresetColor( nColorToken, API_RGB_TRANSPARENT );
270 if( nRgbValue == API_RGB_TRANSPARENT )
271 nRgbValue = rGraphicHelper.getSystemColor( nColorToken );
272 if( nRgbValue != API_RGB_TRANSPARENT )
273 {
274 aDmlColor.setSrgbClr( nRgbValue );
275 return aDmlColor;
276 }
277
278 // try palette colors enclosed in brackets
279 if( (aColorIndex.size() >= 3) && (aColorIndex[ 0 ] == '[') && (aColorIndex[ aColorIndex.size() - 1 ] == ']') )
280 {
281 aDmlColor.setPaletteClr( o3tl::toInt32(aColorIndex.substr( 1, aColorIndex.size() - 2 )) );
282 return aDmlColor;
283 }
284
285 // try fill gradient modificator 'fill <modifier>(<amount>)'
286 if( (nPrimaryRgb != API_RGB_TRANSPARENT) && (nColorToken == XML_fill) )
287 {
288 size_t nOpenParen = aColorIndex.find( '(' );
289 size_t nCloseParen = aColorIndex.find( ')' );
290 if( nOpenParen != std::u16string_view::npos && nCloseParen != std::u16string_view::npos &&
291 (2 <= nOpenParen) && (nOpenParen + 1 < nCloseParen) && (nCloseParen + 1 == aColorIndex.size()) )
292 {
293 sal_Int32 nModToken = XML_TOKEN_INVALID;
294 switch( AttributeConversion::decodeToken( aColorIndex.substr( 0, nOpenParen ) ) )
295 {
296 case XML_darken: nModToken = XML_shade;break;
297 case XML_lighten: nModToken = XML_tint;
298 }
299 sal_Int32 nValue = o3tl::toInt32(aColorIndex.substr( nOpenParen + 1, nCloseParen - nOpenParen - 1 ));
300 if( (nModToken != XML_TOKEN_INVALID) && (0 <= nValue) && (nValue < 255) )
301 {
302 /* Simulate this modifier color by a color with related transformation.
303 The modifier amount has to be converted from the range [0;255] to
304 percentage [0;100000] used by DrawingML. */
305 aDmlColor.setSrgbClr( nPrimaryRgb );
306 aDmlColor.addTransformation( nModToken, static_cast< sal_Int32 >( nValue * ::oox::drawingml::MAX_PERCENT / 255 ) );
307 return aDmlColor;
308 }
309 }
310 }
311
312 OSL_FAIL( OStringBuffer( "lclGetColor - invalid VML color name '" +
313 OUStringToOString( roVmlColor.value(), RTL_TEXTENCODING_ASCII_US ) + "'" ).getStr() );
314 aDmlColor.setSrgbClr( nDefaultRgb );
315 return aDmlColor;
316}
317
318void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& rPointLists, ::std::vector< ::std::vector< PolygonFlags > >& rFlagLists, std::u16string_view rPath )
319{
320 ::std::vector< sal_Int32 > aCoordList;
321 Point aCurrentPoint;
322 sal_Int32 nTokenStart = 0;
323 sal_Int32 nTokenLen = 0;
324 sal_Int32 nParamCount = 0;
325 bool bCommand = false;
326 enum VML_State { START, MOVE_REL, MOVE_ABS, BEZIER_REL, BEZIER_ABS,
327 LINE_REL, LINE_ABS, CLOSE, END, UNSUPPORTED };
328 VML_State state = START;
329
330 rPointLists.emplace_back( );
331 rFlagLists.emplace_back( );
332
333 for ( size_t i = 0; i < rPath.size(); i++ )
334 {
335 // Keep track of current integer token
336 if ( ( rPath[ i ] >= '0' && rPath[ i ] <= '9' ) || rPath[ i ] == '-' )
337 nTokenLen++;
338 else if ( rPath[ i ] != ' ' )
339 {
340 // Store coordinate from current token
341 if ( state != START && state != UNSUPPORTED )
342 {
343 if ( nTokenLen > 0 )
344 aCoordList.push_back( o3tl::toInt32(rPath.substr( nTokenStart, nTokenLen )) );
345 else
346 aCoordList.push_back( 0 );
347 nTokenLen = 0;
348 }
349
350 if (rPath[ i ] == ',' )
351 {
352 nParamCount--;
353 }
354
355 // Upon finding the next command code, deal with stored
356 // coordinates for previous command and reset parameters counter if needed.
357 // See http://www.w3.org/TR/NOTE-VML#_Toc416858382 for params count reference
358 if ( rPath[ i ] != ',' || nParamCount == 0 )
359 {
360 switch ( state )
361 {
362 case MOVE_REL:
363 aCoordList.resize(2, 0); // 2* params -> param count reset
364 if ( !rPointLists.empty() && !rPointLists.back().empty() )
365 {
366 rPointLists.emplace_back( );
367 rFlagLists.emplace_back( );
368 }
369 rPointLists.back().emplace_back( aCoordList[ 0 ], aCoordList[ 1 ] );
370 rFlagLists.back().push_back( PolygonFlags_NORMAL );
371 aCurrentPoint = rPointLists.back().back();
372 nParamCount = 2;
373 break;
374
375 case MOVE_ABS:
376 aCoordList.resize(2, 0); // 2 params -> no param count reset
377 if ( !rPointLists.empty() && !rPointLists.back().empty() )
378 {
379 rPointLists.emplace_back( );
380 rFlagLists.emplace_back( );
381 }
382 rPointLists.back().emplace_back( (aCoordList[ 0 ]), aCoordList[ 1 ] );
383 rFlagLists.back().push_back( PolygonFlags_NORMAL );
384 aCurrentPoint = rPointLists.back().back();
385 break;
386
387 case BEZIER_REL:
388 aCoordList.resize(6, 0); // 6* params -> param count reset
389 rPointLists.back().emplace_back( aCurrentPoint.X + aCoordList[ 0 ],
390 aCurrentPoint.Y + aCoordList[ 1 ] );
391 rPointLists.back().emplace_back( aCurrentPoint.X + aCoordList[ 2 ],
392 aCurrentPoint.Y + aCoordList[ 3 ] );
393 rPointLists.back().emplace_back( aCurrentPoint.X + aCoordList[ 4 ],
394 aCurrentPoint.Y + aCoordList[ 5 ] );
395 rFlagLists.back().push_back( PolygonFlags_CONTROL );
396 rFlagLists.back().push_back( PolygonFlags_CONTROL );
397 rFlagLists.back().push_back( PolygonFlags_NORMAL );
398 aCurrentPoint = rPointLists.back().back();
399 nParamCount = 6;
400 break;
401
402 case BEZIER_ABS:
403 aCoordList.resize(6, 0); // 6* params -> param count reset
404 rPointLists.back().emplace_back( aCoordList[ 0 ], aCoordList[ 1 ] );
405 rPointLists.back().emplace_back( aCoordList[ 2 ], aCoordList[ 3 ] );
406 rPointLists.back().emplace_back( aCoordList[ 4 ], aCoordList[ 5 ] );
407 rFlagLists.back().push_back( PolygonFlags_CONTROL );
408 rFlagLists.back().push_back( PolygonFlags_CONTROL );
409 rFlagLists.back().push_back( PolygonFlags_NORMAL );
410 aCurrentPoint = rPointLists.back().back();
411 nParamCount = 6;
412 break;
413
414 case LINE_REL:
415 aCoordList.resize(2, 0); // 2* params -> param count reset
416 rPointLists.back().emplace_back( aCurrentPoint.X + aCoordList[ 0 ],
417 aCurrentPoint.Y + aCoordList[ 1 ] );
418 rFlagLists.back().push_back( PolygonFlags_NORMAL );
419 aCurrentPoint = rPointLists.back().back();
420 nParamCount = 2;
421 break;
422
423 case LINE_ABS:
424 aCoordList.resize(2, 0); // 2* params -> param count reset
425 rPointLists.back().emplace_back( aCoordList[ 0 ], (aCoordList.size() > 1 ? aCoordList[ 1 ] : 0) );
426 rFlagLists.back().push_back( PolygonFlags_NORMAL );
427 aCurrentPoint = rPointLists.back().back();
428 nParamCount = 2;
429 break;
430
431 case CLOSE: // 0 param
432 SAL_WARN_IF(rPointLists.back().empty() || rFlagLists.back().empty(), "oox", "empty pointlists at close");
433 if (!rPointLists.back().empty() && !rFlagLists.back().empty())
434 {
435 rPointLists.back().push_back( rPointLists.back()[ 0 ] );
436 rFlagLists.back().push_back( rFlagLists.back()[ 0 ] );
437 aCurrentPoint = rPointLists.back().back();
438 }
439 break;
440
441 case END: // 0 param
442 rPointLists.emplace_back( );
443 rFlagLists.emplace_back( );
444 break;
445
446 case START:
447 case UNSUPPORTED:
448 break;
449 }
450
451 aCoordList.clear();
452 }
453
454 // Allow two-char commands to peek ahead to the next character
455 sal_Unicode nextChar = '\0';
456 if (i+1 < rPath.size())
457 nextChar = rPath[i+1];
458
459 // Move to relevant state upon finding a command
460 bCommand = true;
461 switch ( rPath[ i ] )
462 {
463 // Single-character commands
464 case 't': // rmoveto
465 state = MOVE_REL; nParamCount = 2; break;
466 case 'm': // moveto
467 state = MOVE_ABS; nParamCount = 2; break;
468 case 'v': // rcurveto
469 state = BEZIER_REL; nParamCount = 6; break;
470 case 'c': // curveto
471 state = BEZIER_ABS; nParamCount = 6; break;
472 case 'r': // rlineto
473 state = LINE_REL; nParamCount = 2; break;
474 case 'l': // lineto
475 state = LINE_ABS; nParamCount = 2; break;
476 case 'x': // close
477 state = CLOSE; break;
478 case 'e': // end
479 state = END; break;
480
481 // Two-character commands
482 case 'n':
483 {
484 switch ( nextChar )
485 {
486 case 'f': // nf - nofill
487 case 's': // ns - nostroke
488 state = UNSUPPORTED; i++; break;
489 }
490 break;
491 }
492 case 'a': // Elliptical curves
493 {
494 switch ( nextChar )
495 {
496 case 'e': // ae - angleellipseto
497 case 'l': // al - angleellipse
498 state = UNSUPPORTED; i++; break;
499 case 't': // at - arcto
500 case 'r': // ar - arc
501 state = UNSUPPORTED; i++; break;
502 }
503 break;
504 }
505 case 'w': // Clockwise elliptical arcs
506 {
507 switch ( nextChar )
508 {
509 case 'a': // wa - clockwisearcto
510 case 'r': // wr - clockwisearc
511 state = UNSUPPORTED; i++; break;
512 }
513 break;
514 }
515 case 'q':
516 {
517 switch ( nextChar )
518 {
519 case 'x': // qx - ellipticalquadrantx
520 case 'y': // qy - ellipticalquadranty
521 state = UNSUPPORTED; i++; break;
522 case 'b': // qb - quadraticbezier
523 state = UNSUPPORTED; i++; break;
524 }
525 break;
526 }
527 case 'h': // behaviour extensions
528 {
529 switch ( nextChar )
530 {
531 case 'a': // ha - AutoLine
532 case 'b': // hb - AutoCurve
533 case 'c': // hc - CornerLine
534 case 'd': // hd - CornerCurve
535 case 'e': // he - SmoothLine
536 case 'f': // hf - SmoothCurve
537 case 'g': // hg - SymmetricLine
538 case 'h': // hh - SymmetricCurve
539 case 'i': // hi - Freeform
540 state = UNSUPPORTED; i++; break;
541 }
542 break;
543 }
544 default:
545 bCommand = false;
546 break;
547 }
548
549 if (bCommand) nTokenLen = 0;
550 nTokenStart = i+1;
551 }
552 }
553}
554
555namespace {
556
557sal_Int64 lclGetEmu( const GraphicHelper& rGraphicHelper, const std::optional< OUString >& roValue, sal_Int64 nDefValue )
558{
559 return roValue.has_value() ? ConversionHelper::decodeMeasureToEmu( rGraphicHelper, roValue.value(), 0, false, false ) : nDefValue;
560}
561
562void lclGetDmlLineDash( std::optional< sal_Int32 >& oroPresetDash, LineProperties::DashStopVector& orCustomDash, const std::optional< OUString >& roDashStyle )
563{
564 if( !roDashStyle.has_value() )
565 return;
566
567 const OUString& rDashStyle = roDashStyle.value();
568 switch( AttributeConversion::decodeToken( rDashStyle ) )
569 {
570 case XML_solid: oroPresetDash = XML_solid; return;
571 case XML_shortdot: oroPresetDash = XML_sysDot; return;
572 case XML_shortdash: oroPresetDash = XML_sysDash; return;
573 case XML_shortdashdot: oroPresetDash = XML_sysDashDot; return;
574 case XML_shortdashdotdot: oroPresetDash = XML_sysDashDotDot; return;
575 case XML_dot: oroPresetDash = XML_dot; return;
576 case XML_dash: oroPresetDash = XML_dash; return;
577 case XML_dashdot: oroPresetDash = XML_dashDot; return;
578 case XML_longdash: oroPresetDash = XML_lgDash; return;
579 case XML_longdashdot: oroPresetDash = XML_lgDashDot; return;
580 case XML_longdashdotdot: oroPresetDash = XML_lgDashDotDot; return;
581
582 // try to convert user-defined dash style
583 default:
584 {
585 ::std::vector< sal_Int32 > aValues;
586 sal_Int32 nIndex = 0;
587 while( nIndex >= 0 )
588 aValues.push_back( o3tl::toInt32(o3tl::getToken(rDashStyle, 0, ' ', nIndex )) );
589 size_t nPairs = aValues.size() / 2; // ignore last value if size is odd
590 for( size_t nPairIdx = 0; nPairIdx < nPairs; ++nPairIdx )
591 orCustomDash.emplace_back( aValues[ 2 * nPairIdx ], aValues[ 2 * nPairIdx + 1 ] );
592 }
593 }
594}
595
596sal_Int32 lclGetDmlArrowType( const std::optional< sal_Int32 >& roArrowType )
597{
598 if( roArrowType.has_value() ) switch( roArrowType.value() )
599 {
600 case XML_none: return XML_none;
601 case XML_block: return XML_triangle;
602 case XML_classic: return XML_stealth;
603 case XML_diamond: return XML_diamond;
604 case XML_oval: return XML_oval;
605 case XML_open: return XML_arrow;
606 }
607 return XML_none;
608}
609
610sal_Int32 lclGetDmlArrowWidth( const std::optional< sal_Int32 >& roArrowWidth )
611{
612 if( roArrowWidth.has_value() ) switch( roArrowWidth.value() )
613 {
614 case XML_narrow: return XML_sm;
615 case XML_medium: return XML_med;
616 case XML_wide: return XML_lg;
617 }
618 return XML_med;
619}
620
621sal_Int32 lclGetDmlArrowLength( const std::optional< sal_Int32 >& roArrowLength )
622{
623 if( roArrowLength.has_value() ) switch( roArrowLength.value() )
624 {
625 case XML_short: return XML_sm;
626 case XML_medium: return XML_med;
627 case XML_long: return XML_lg;
628 }
629 return XML_med;
630}
631
632void lclConvertArrow( LineArrowProperties& orArrowProp, const StrokeArrowModel& rStrokeArrow )
633{
634 orArrowProp.moArrowType = lclGetDmlArrowType( rStrokeArrow.moArrowType );
635 orArrowProp.moArrowWidth = lclGetDmlArrowWidth( rStrokeArrow.moArrowWidth );
636 orArrowProp.moArrowLength = lclGetDmlArrowLength( rStrokeArrow.moArrowLength );
637}
638
639sal_Int32 lclGetDmlLineCompound( const std::optional< sal_Int32 >& roLineStyle )
640{
641 if( roLineStyle.has_value() ) switch( roLineStyle.value() )
642 {
643 case XML_single: return XML_sng;
644 case XML_thinThin: return XML_dbl;
645 case XML_thinThick: return XML_thinThick;
646 case XML_thickThin: return XML_thickThin;
647 case XML_thickBetweenThin: return XML_tri;
648 }
649 return XML_sng;
650}
651
652sal_Int32 lclGetDmlLineCap( const std::optional< sal_Int32 >& roEndCap )
653{
654 if( roEndCap.has_value() ) switch( roEndCap.value() )
655 {
656 case XML_flat: return XML_flat;
657 case XML_square: return XML_sq;
658 case XML_round: return XML_rnd;
659 }
660 return XML_flat; // different defaults in VML (flat) and DrawingML (square)
661}
662
663sal_Int32 lclGetDmlLineJoint( const std::optional< sal_Int32 >& roJoinStyle )
664{
665 if( roJoinStyle.has_value() ) switch( roJoinStyle.value() )
666 {
667 case XML_round: return XML_round;
668 case XML_bevel: return XML_bevel;
669 case XML_miter: return XML_miter;
670 }
671 return XML_round;
672}
673
674} // namespace
675
677{
681}
682
684{
685 assignIfUsed( moStroked, rSource.moStroked );
688 assignIfUsed( moColor, rSource.moColor );
689 assignIfUsed( moOpacity, rSource.moOpacity );
690 assignIfUsed( moWeight, rSource.moWeight );
693 assignIfUsed( moEndCap, rSource.moEndCap );
695}
696
697void StrokeModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper ) const
698{
699 /* Convert VML line formatting to DrawingML line formatting and let the
700 DrawingML code do the hard work. */
701 LineProperties aLineProps;
702
703 if( moStroked.value_or( true ) )
704 {
705 aLineProps.maLineFill.moFillType = XML_solidFill;
706 lclConvertArrow( aLineProps.maStartArrow, maStartArrow );
707 lclConvertArrow( aLineProps.maEndArrow, maEndArrow );
708 aLineProps.maLineFill.maFillColor = ConversionHelper::decodeColor( rGraphicHelper, moColor, moOpacity, API_RGB_BLACK );
709 aLineProps.moLineWidth = getLimitedValue< sal_Int32, sal_Int64 >( lclGetEmu( rGraphicHelper, moWeight, 1 ), 0, SAL_MAX_INT32 );
710 lclGetDmlLineDash( aLineProps.moPresetDash, aLineProps.maCustomDash, moDashStyle );
711 aLineProps.moLineCompound = lclGetDmlLineCompound( moLineStyle );
712 aLineProps.moLineCap = lclGetDmlLineCap( moEndCap );
713 aLineProps.moLineJoint = lclGetDmlLineJoint( moJoinStyle );
714 }
715 else
716 {
717 aLineProps.maLineFill.moFillType = XML_noFill;
718 }
719
720 aLineProps.pushToPropMap( rPropMap, rGraphicHelper );
721}
722
723void FillModel::assignUsed( const FillModel& rSource )
724{
725 assignIfUsed( moFilled, rSource.moFilled );
726 assignIfUsed( moColor, rSource.moColor );
727 assignIfUsed( moOpacity, rSource.moOpacity );
728 assignIfUsed( moColor2, rSource.moColor2 );
730 assignIfUsed( moType, rSource.moType );
731 assignIfUsed( moAngle, rSource.moAngle );
732 assignIfUsed( moFocus, rSource.moFocus );
736 assignIfUsed( moRotate, rSource.moRotate );
737}
738
739static void lcl_setGradientStop( std::multimap< double, Color >& rMap, const double fKey, const Color& rValue ) {
740 auto aElement = rMap.find( fKey );
741
742 if (aElement != rMap.end())
743 aElement->second = rValue;
744 else
745 rMap.emplace( fKey, rValue );
746}
747
748void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper ) const
749{
750 /* Convert VML fill formatting to DrawingML fill formatting and let the
751 DrawingML code do the hard work. */
752 FillProperties aFillProps;
753
754 if( moFilled.value_or( true ) )
755 {
756 sal_Int32 nFillType = moType.value_or( XML_solid );
757 switch( nFillType )
758 {
759 case XML_gradient:
760 case XML_gradientRadial:
761 {
762 aFillProps.moFillType = XML_gradFill;
763 aFillProps.maGradientProps.moRotateWithShape = moRotate.value_or( false );
764 double fFocus = moFocus.value_or( 0.0 );
765
766 // prepare colors
768 Color aColor2 = ConversionHelper::decodeColor( rGraphicHelper, moColor2, moOpacity2, API_RGB_WHITE, aColor1.getColor( rGraphicHelper ) );
769
770 // type XML_gradient is linear or axial gradient
771 if( nFillType == XML_gradient )
772 {
773 // normalize angle to range [0;360) degrees
774 sal_Int32 nVmlAngle = getIntervalValue< sal_Int32, sal_Int32 >( moAngle.value_or( 0 ), 0, 360 );
775
776 // focus of -50% or 50% is axial gradient
777 if( ((-0.75 <= fFocus) && (fFocus <= -0.25)) || ((0.25 <= fFocus) && (fFocus <= 0.75)) )
778 {
779 /* According to spec, focus of 50% is outer-to-inner,
780 and -50% is inner-to-outer (color to color2).
781 BUT: For angles >= 180 deg., the behaviour is
782 reversed... that's not spec'ed of course. So,
783 [0;180) deg. and 50%, or [180;360) deg. and -50% is
784 outer-to-inner in fact. */
785 bool bOuterToInner = (fFocus > 0.0) == (nVmlAngle < 180);
786 // simulate axial gradient by 3-step DrawingML gradient
787 const Color& rOuterColor = bOuterToInner ? aColor1 : aColor2;
788 const Color& rInnerColor = bOuterToInner ? aColor2 : aColor1;
789
790 lcl_setGradientStop( aFillProps.maGradientProps.maGradientStops, 0.0, rOuterColor);
791 lcl_setGradientStop( aFillProps.maGradientProps.maGradientStops, 1.0, rOuterColor);
792 lcl_setGradientStop( aFillProps.maGradientProps.maGradientStops, 0.5, rInnerColor );
793 }
794 else // focus of -100%, 0%, and 100% is linear gradient
795 {
796 /* According to spec, focus of -100% or 100% swaps the
797 start and stop colors, effectively reversing the
798 gradient. BUT: For angles >= 180 deg., the
799 behaviour is reversed. This means that in this case
800 a focus of 0% swaps the gradient. */
801 if( fFocus < -0.5 || fFocus > 0.5 )
802 nVmlAngle = (nVmlAngle + 180) % 360;
803 // set the start and stop colors
804 lcl_setGradientStop( aFillProps.maGradientProps.maGradientStops, 0.0, aColor1 );
805 lcl_setGradientStop( aFillProps.maGradientProps.maGradientStops, 1.0, aColor2 );
806 }
807
808 // VML counts counterclockwise from bottom, DrawingML clockwise from left
809 sal_Int32 nDmlAngle = (630 - nVmlAngle) % 360;
810 aFillProps.maGradientProps.moShadeAngle = nDmlAngle * ::oox::drawingml::PER_DEGREE;
811 }
812 else // XML_gradientRadial is rectangular gradient
813 {
814 aFillProps.maGradientProps.moGradientPath = XML_rect;
815 // convert VML focus position and size to DrawingML fill-to-rect
816 DoublePair aFocusPos = moFocusPos.value_or( DoublePair( 0.0, 0.0 ) );
817 DoublePair aFocusSize = moFocusSize.value_or( DoublePair( 0.0, 0.0 ) );
818 double fLeft = getLimitedValue< double, double >( aFocusPos.first, 0.0, 1.0 );
819 double fTop = getLimitedValue< double, double >( aFocusPos.second, 0.0, 1.0 );
820 double fRight = getLimitedValue< double, double >( fLeft + aFocusSize.first, fLeft, 1.0 );
821 double fBottom = getLimitedValue< double, double >( fTop + aFocusSize.second, fTop, 1.0 );
822 aFillProps.maGradientProps.moFillToRect = IntegerRectangle2D(
823 static_cast< sal_Int32 >( fLeft * ::oox::drawingml::MAX_PERCENT ),
824 static_cast< sal_Int32 >( fTop * ::oox::drawingml::MAX_PERCENT ),
825 static_cast< sal_Int32 >( (1.0 - fRight) * ::oox::drawingml::MAX_PERCENT ),
826 static_cast< sal_Int32 >( (1.0 - fBottom) * ::oox::drawingml::MAX_PERCENT ) );
827
828 // set the start and stop colors (focus of 0% means outer-to-inner)
829 bool bOuterToInner = (-0.5 <= fFocus) && (fFocus <= 0.5);
830 lcl_setGradientStop( aFillProps.maGradientProps.maGradientStops, 0.0, bOuterToInner ? aColor2 : aColor1 );
831 lcl_setGradientStop( aFillProps.maGradientProps.maGradientStops, 1.0, bOuterToInner ? aColor1 : aColor2 );
832 }
833 }
834 break;
835
836 case XML_pattern:
837 case XML_tile:
838 case XML_frame:
839 {
840 if( moBitmapPath.has_value() && !moBitmapPath.value().isEmpty() )
841 {
842 aFillProps.maBlipProps.mxFillGraphic = rGraphicHelper.importEmbeddedGraphic(moBitmapPath.value());
843 if (aFillProps.maBlipProps.mxFillGraphic.is())
844 {
845 aFillProps.moFillType = XML_blipFill;
846 aFillProps.maBlipProps.moBitmapMode = (nFillType == XML_frame) ? XML_stretch : XML_tile;
847 break; // do not break if bitmap is missing, but run to XML_solid instead
848 }
849 }
850 }
851 [[fallthrough]]; // to XML_solid in case of missing bitmap path intended!
852
853 case XML_solid:
854 default:
855 {
856 aFillProps.moFillType = XML_solidFill;
857 // fill color (default is white)
858 aFillProps.maFillColor = ConversionHelper::decodeColor( rGraphicHelper, moColor, moOpacity, API_RGB_WHITE );
859 }
860 }
861 }
862 else
863 {
864 aFillProps.moFillType = XML_noFill;
865 }
866
867 aFillProps.pushToPropMap( rPropMap, rGraphicHelper );
868}
869
871 : mbHasShadow(false)
872{
873}
874
875void ShadowModel::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelper& rGraphicHelper) const
876{
877 if (!mbHasShadow || (moShadowOn.has_value() && !moShadowOn.value()))
878 return;
879
881 // nOffset* is in mm100, default value is 35 twips, see DffPropertyReader::ApplyAttributes() in msfilter.
882 sal_Int32 nOffsetX = 62, nOffsetY = 62;
883 if (moOffset.has_value())
884 {
885 std::u16string_view aOffsetX, aOffsetY;
886 ConversionHelper::separatePair(aOffsetX, aOffsetY, moOffset.value(), ',');
887 if (!aOffsetX.empty())
888 nOffsetX = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, aOffsetX, 0, false, false );
889 if (!aOffsetY.empty())
890 nOffsetY = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, aOffsetY, 0, false, false );
891 }
892
893 table::ShadowFormat aFormat;
894 aFormat.Color = sal_Int32(aColor.getColor(rGraphicHelper));
895 aFormat.Location = nOffsetX < 0
896 ? nOffsetY < 0 ? table::ShadowLocation_TOP_LEFT : table::ShadowLocation_BOTTOM_LEFT
897 : nOffsetY < 0 ? table::ShadowLocation_TOP_RIGHT : table::ShadowLocation_BOTTOM_RIGHT;
898 // The width of the shadow is the average of the x and y values, see SwWW8ImplReader::MatchSdrItemsIntoFlySet().
899 aFormat.ShadowWidth = ((std::abs(nOffsetX) + std::abs(nOffsetY)) / 2);
900 rPropMap.setProperty(PROP_ShadowFormat, aFormat);
901}
902
904{
905}
906
907static beans::PropertyValue lcl_createTextpathProps()
908{
909 uno::Sequence<beans::PropertyValue> aTextpathPropSeq( comphelper::InitPropertySequence({
910 { "TextPath", uno::Any(true) },
911 { "TextPathMode", uno::Any(drawing::EnhancedCustomShapeTextPathMode_SHAPE) },
912 { "ScaleX", uno::Any(false) },
913 { "SameLetterHeights", uno::Any(false) }
914 }));
915
916 beans::PropertyValue aRet;
917 aRet.Name = "TextPath";
918 aRet.Value <<= aTextpathPropSeq;
919 return aRet;
920}
921
922void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, const uno::Reference<drawing::XShape>& xShape, const GraphicHelper& rGraphicHelper) const
923{
924 OUString sFont = "";
925
926 if (moString.has_value())
927 {
928 uno::Reference<text::XTextRange> xTextRange(xShape, uno::UNO_QUERY);
929 xTextRange->setString(moString.value());
930
931 uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
932 uno::Sequence<beans::PropertyValue> aGeomPropSeq = xPropertySet->getPropertyValue("CustomShapeGeometry").get< uno::Sequence<beans::PropertyValue> >();
933 bool bFound = false;
934 for (beans::PropertyValue& rProp : asNonConstRange(aGeomPropSeq))
935 {
936 if (rProp.Name == "TextPath")
937 {
938 bFound = true;
939 rProp = lcl_createTextpathProps();
940 }
941 }
942 if (!bFound)
943 {
944 sal_Int32 nSize = aGeomPropSeq.getLength();
945 aGeomPropSeq.realloc(nSize+1);
946 aGeomPropSeq.getArray()[nSize] = lcl_createTextpathProps();
947 }
948 rPropMap.setAnyProperty(PROP_CustomShapeGeometry, uno::Any(aGeomPropSeq));
949 }
950 if (moStyle.has_value())
951 {
952 OUString aStyle = moStyle.value_or(OUString());
953
954 sal_Int32 nIndex = 0;
955 while( nIndex >= 0 )
956 {
957 std::u16string_view aName, aValue;
958 if (ConversionHelper::separatePair(aName, aValue, o3tl::getToken(aStyle, 0, ';', nIndex), ':'))
959 {
960 if (aName == u"font-family")
961 {
962 // remove " (first, and last character)
963 if (aValue.size() > 2)
964 aValue = aValue.substr(1, aValue.size() - 2);
965
966 uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
967 xPropertySet->setPropertyValue("CharFontName", uno::Any(OUString(aValue)));
968 sFont = aValue;
969 }
970 else if (aName == u"font-size")
971 {
972 std::optional<OUString> aOptString {OUString(aValue)};
973 float nSize = drawingml::convertEmuToPoints(lclGetEmu(rGraphicHelper, aOptString, 1));
974
975 uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
976 xPropertySet->setPropertyValue("CharHeight", uno::Any(nSize));
977 }
978 }
979 }
980 }
981 if (moTrim.has_value() && moTrim.value())
982 return;
983
984 OUString sText = moString.value_or("");
986 vcl::Font aFont = pDevice->GetFont();
987 aFont.SetFamilyName(sFont);
988 aFont.SetFontSize(Size(0, 96));
989 pDevice->SetFont(aFont);
990
991 auto nTextWidth = pDevice->GetTextWidth(sText);
992 if (nTextWidth)
993 {
994 sal_Int32 nNewHeight = (static_cast<double>(pDevice->GetTextHeight()) / nTextWidth) * xShape->getSize().Width;
995 xShape->setSize(awt::Size(xShape->getSize().Width, nNewHeight));
996 }
997}
998
999} // namespace oox
1000
1001/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const short CLOSE
static sal_Int32 decodeToken(std::u16string_view rValue)
Returns the XML token identifier from the passed string.
Provides helper functions for colors, device measurement conversion, graphics, and graphic objects ha...
sal_Int32 convertScreenPixelYToHmm(double fPixelY) const
Converts the passed value from vertical screen pixels to 1/100 mm.
css::uno::Reference< css::graphic::XGraphic > importEmbeddedGraphic(const OUString &rStreamName, const WmfExternal *pExtHeader=nullptr) const
Imports a graphic from the storage stream with the passed path and name.
sal_Int32 convertScreenPixelXToHmm(double fPixelX) const
Converts the passed value from horizontal screen pixels to 1/100 mm.
::Color getSystemColor(sal_Int32 nToken, ::Color nDefaultRgb=API_RGB_TRANSPARENT) const
Returns a system color specified by the passed XML token identifier.
::Color getColor(const GraphicHelper &rGraphicHelper, ::Color nPhClr=API_RGB_TRANSPARENT) const
Returns the final RGB color value.
Definition: color.cxx:531
void SetFontSize(const Size &)
void SetFamilyName(const OUString &rFamilyName)
float u
sal_Int16 nValue
sal_Int32 nIndex
OUString aName
#define SAL_WARN_IF(condition, area, stream)
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
std::u16string_view trim(std::u16string_view str)
sal_uInt32 toUInt32(std::u16string_view str, sal_Int16 radix=10)
float convertEmuToPoints(sal_Int64 nValue)
Converts the passed 64-bit integer value from EMUs to Points.
sal_Int32 convertEmuToHmm(sal_Int64 nValue)
Converts the passed 64-bit integer value from EMUs to 1/100 mm.
const sal_Int32 MAX_PERCENT
const sal_Int32 PER_DEGREE
OOX_DLLPUBLIC bool separatePair(std::u16string_view &orValue1, std::u16string_view &orValue2, std::u16string_view rValue, sal_Unicode cSep)
Returns two values contained in rValue separated by cSep.
OOX_DLLPUBLIC::oox::drawingml::Color decodeColor(const GraphicHelper &rGraphicHelper, const std::optional< OUString > &roVmlColor, const std::optional< double > &roVmlOpacity, ::Color nDefaultRgb, ::Color nPrimaryRgb=API_RGB_TRANSPARENT)
Converts VML color attributes to a DrawingML color.
OOX_DLLPUBLIC void decodeVmlPath(::std::vector< ::std::vector< css::awt::Point > > &rPoints, ::std::vector< ::std::vector< css::drawing::PolygonFlags > > &rFlags, std::u16string_view rPath)
Converts VML path string into point and flag vectors.
OOX_DLLPUBLIC sal_Int64 decodeMeasureToEmu(const GraphicHelper &rGraphicHelper, std::u16string_view rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel)
Converts the passed VML measure string to EMU (English Metric Units).
OOX_DLLPUBLIC sal_Int32 decodeMeasureToTwip(const GraphicHelper &rGraphicHelper, std::u16string_view rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel)
Converts the passed VML measure string to Twip.
OOX_DLLPUBLIC double decodePercent(std::u16string_view rValue, double fDefValue)
Converts the passed VML percentage measure string to a normalized floating-point value.
OOX_DLLPUBLIC sal_Int32 decodeMeasureToHmm(const GraphicHelper &rGraphicHelper, std::u16string_view rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel)
Converts the passed VML measure string to 1/100 mm.
OOX_DLLPUBLIC bool decodeBool(std::u16string_view rValue)
Returns the boolean value from the passed string of a VML attribute.
OOX_DLLPUBLIC Degree100 decodeRotation(std::u16string_view rValue)
Converts the passed VML rotation value to degrees.
static void lcl_setGradientStop(std::multimap< double, Color > &rMap, const double fKey, const Color &rValue)
::std::pair< double, double > DoublePair
static beans::PropertyValue lcl_createTextpathProps()
void assignIfUsed(std::optional< Type > &rDestValue, const std::optional< Type > &rSourceValue)
Definition: helper.hxx:174
const ::Color API_RGB_WHITE(0xFFFFFF)
White color for API calls.
const ::Color API_RGB_GRAY(0x808080)
Gray color for API calls.
const ::Color API_RGB_BLACK(0x000000)
Black color for API calls.
const ::Color API_RGB_TRANSPARENT(ColorTransparency, 0xffffffff)
Transparent color for API calls.
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
END
XML_none
START
XML_TOKEN_INVALID
DefTokenId nToken
The fill model structure contains all shape fill properties.
std::optional< DoublePair > moFocusSize
Rectangular gradient focus size of second color.
std::optional< double > moOpacity
Solid fill color opacity.
void pushToPropMap(::oox::drawingml::ShapePropertyMap &rPropMap, const GraphicHelper &rGraphicHelper) const
Writes the properties to the passed property map.
std::optional< OUString > moColor2
End color of gradient.
std::optional< bool > moRotate
True = rotate gradient/bitmap with shape.
std::optional< DoublePair > moFocusPos
Rectangular gradient focus position of second color.
std::optional< sal_Int32 > moType
Fill type.
std::optional< double > moFocus
Linear gradient focus of second color.
std::optional< bool > moFilled
Shape fill on/off.
std::optional< OUString > moBitmapPath
Path to fill bitmap fragment.
std::optional< double > moOpacity2
End color opacity of gradient.
std::optional< sal_Int32 > moAngle
Gradient rotation angle.
std::optional< OUString > moColor
Solid fill color.
void assignUsed(const FillModel &rSource)
bool mbHasShadow
Is a v:shadow element seen?
std::optional< double > moOpacity
Specifies the opacity of the shadow.
std::optional< OUString > moOffset
Specifies the shadow's offset from the shape's location.
std::optional< bool > moShadowOn
Is the element turned on?
std::optional< OUString > moColor
Specifies the color of the shadow.
void pushToPropMap(oox::drawingml::ShapePropertyMap &rPropMap, const GraphicHelper &rGraphicHelper) const
Writes the properties to the passed property map.
The stroke arrow model structure contains all properties for a line end arrow.
std::optional< sal_Int32 > moArrowWidth
std::optional< sal_Int32 > moArrowType
void assignUsed(const StrokeArrowModel &rSource)
std::optional< sal_Int32 > moArrowLength
The stroke model structure contains all shape border properties.
void pushToPropMap(::oox::drawingml::ShapePropertyMap &rPropMap, const GraphicHelper &rGraphicHelper) const
Writes the properties to the passed property map.
void assignUsed(const StrokeModel &rSource)
StrokeArrowModel maStartArrow
Start line arrow style.
StrokeArrowModel maEndArrow
End line arrow style.
std::optional< sal_Int32 > moLineStyle
Line style (single, double, ...).
std::optional< sal_Int32 > moEndCap
Type of line end cap.
std::optional< OUString > moColor
Solid line color.
std::optional< bool > moStroked
Shape border line on/off.
std::optional< OUString > moDashStyle
Line dash (predefined or manually).
std::optional< sal_Int32 > moJoinStyle
Type of line join.
std::optional< double > moOpacity
Solid line color opacity.
std::optional< OUString > moWeight
Line width.
std::optional< OUString > moStyle
Specifies the style of the textpath.
void pushToPropMap(oox::drawingml::ShapePropertyMap &rPropMap, const css::uno::Reference< css::drawing::XShape > &xShape, const GraphicHelper &rGraphicHelper) const
Writes the properties to the passed property map.
std::optional< bool > moTrim
Specifies whether extra space is removed above and below the text.
std::optional< OUString > moString
Specifies the string of the textpath.
SVXCORE_DLLPUBLIC Degree100 NormAngle36000(Degree100 a)
#define SAL_MAX_INT32
sal_uInt16 sal_Unicode
constexpr OUStringLiteral PROP_ShadowFormat