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