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>
36#include <osl/diagnose.h>
44#include <oox/token/properties.hxx>
45#include <oox/token/tokens.hxx>
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;
68bool lclExtractDouble(
double& orfValue,
size_t& ornEndPos, std::u16string_view aValue )
71 rtl_math_ConversionStatus eConvStatus = rtl_math_ConversionStatus_Ok;
73 orfValue = ::rtl::math::stringToDouble( aValue,
'.',
'\0', &eConvStatus, &nEndPos );
75 return eConvStatus == rtl_math_ConversionStatus_Ok;
83 size_t nSepPos = rValue.find( cSep );
84 if( nSepPos != std::u16string_view::npos )
86 orValue1 =
o3tl::trim(rValue.substr( 0, nSepPos ));
87 orValue2 =
o3tl::trim(rValue.substr( nSepPos + 1 ));
92 orValue2 = std::u16string_view();
94 return !orValue1.empty() && !orValue2.empty();
111 if( !lclExtractDouble( fValue, nEndPos, rValue ) )
114 if( nEndPos == rValue.size() )
117 if( (nEndPos + 1 == rValue.size()) && (rValue[ nEndPos ] ==
'%') )
118 return fValue / 100.0;
120 if( (nEndPos + 1 == rValue.size()) && (rValue[ nEndPos ] ==
'f') )
121 return fValue / 65536.0;
123 OSL_FAIL(
"ConversionHelper::decodePercent - unknown measure unit" );
133 double fRotation = 0.0;
135 if( !lclExtractDouble(fValue, nEndPos, rValue) )
138 if( nEndPos == rValue.size() )
140 else if( (nEndPos + 2 == rValue.size()) && (rValue[nEndPos] ==
'f') && (rValue[nEndPos+1] ==
'd') )
141 fRotation = fValue / 65536.0;
144 OSL_FAIL(
"ConversionHelper::decodeRotation - unknown measure unit");
152 std::u16string_view rValue, sal_Int32 nRefValue,
bool bPixelX,
bool bDefaultAsPixel )
159 if ( rValue ==
u"auto" )
161 OSL_FAIL(
"ConversionHelper::decodeMeasureToEmu - special value 'auto' must be handled by caller" );
168 if( !lclExtractDouble( fValue, nEndPos, rValue ) || (fValue == 0.0) )
172 std::u16string_view aUnit;
173 if( (0 < nEndPos) && (nEndPos < rValue.size()) )
174 aUnit = rValue.substr( nEndPos );
175 else if( bDefaultAsPixel )
179 if( aUnit.size() == 2 )
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') )
198 else if( (aUnit.size() == 1) && (aUnit[ 0 ] ==
'%') )
200 fValue *= nRefValue / 100.0;
202 else if( bDefaultAsPixel || !aUnit.empty() )
204 OSL_FAIL(
"ConversionHelper::decodeMeasureToEmu - unknown measure unit" );
207 return o3tl::saturating_cast< sal_Int64 >( fValue + 0.5 );
211 std::u16string_view rValue, sal_Int32 nRefValue,
bool bPixelX,
bool bDefaultAsPixel )
217 std::u16string_view rValue, sal_Int32 nRefValue,
218 bool bPixelX,
bool bDefaultAsPixel)
220 return ::o3tl::convert(
226 const std::optional< OUString >& roVmlColor,
const std::optional< double >& roVmlOpacity,
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 );
239 if( !roVmlColor.has_value() )
241 aDmlColor.setSrgbClr( nDefaultRgb );
246 std::u16string_view aColorName, aColorIndex;
247 separatePair( aColorName, aColorIndex, roVmlColor.value(),
' ' );
250 if( (aColorName.size() == 7) && (aColorName[ 0 ] ==
'#') )
252 aDmlColor.setSrgbClr(
o3tl::toUInt32(aColorName.substr( 1 ), 16) );
257 if( (aColorName.size() == 4) && (aColorName[ 0 ] ==
'#') )
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 );
274 aDmlColor.setSrgbClr( nRgbValue );
279 if( (aColorIndex.size() >= 3) && (aColorIndex[ 0 ] ==
'[') && (aColorIndex[ aColorIndex.size() - 1 ] ==
']') )
281 aDmlColor.setPaletteClr(
o3tl::toInt32(aColorIndex.substr( 1, aColorIndex.size() - 2 )) );
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()) )
296 case XML_darken: nModToken = XML_shade;
break;
297 case XML_lighten: nModToken = XML_tint;
299 sal_Int32
nValue =
o3tl::toInt32(aColorIndex.substr( nOpenParen + 1, nCloseParen - nOpenParen - 1 ));
305 aDmlColor.setSrgbClr( nPrimaryRgb );
312 OSL_FAIL( OStringBuffer(
"lclGetColor - invalid VML color name '" +
313 OUStringToOString( roVmlColor.value(), RTL_TEXTENCODING_ASCII_US ) +
"'" ).getStr() );
314 aDmlColor.setSrgbClr( nDefaultRgb );
318void ConversionHelper::decodeVmlPath( ::std::vector< ::std::vector< Point > >& rPointLists, ::std::vector< ::std::vector< PolygonFlags > >& rFlagLists, std::u16string_view rPath )
320 ::std::vector< sal_Int32 > aCoordList;
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;
330 rPointLists.emplace_back( );
331 rFlagLists.emplace_back( );
333 for (
size_t i = 0;
i < rPath.size();
i++ )
336 if ( ( rPath[
i ] >=
'0' && rPath[
i ] <=
'9' ) || rPath[
i ] ==
'-' )
338 else if ( rPath[
i ] !=
' ' )
341 if ( state != START && state != UNSUPPORTED )
344 aCoordList.push_back(
o3tl::toInt32(rPath.substr( nTokenStart, nTokenLen )) );
346 aCoordList.push_back( 0 );
350 if (rPath[
i ] ==
',' )
358 if ( rPath[
i ] !=
',' || nParamCount == 0 )
363 aCoordList.resize(2, 0);
364 if ( !rPointLists.empty() && !rPointLists.back().empty() )
366 rPointLists.emplace_back( );
367 rFlagLists.emplace_back( );
369 rPointLists.back().emplace_back( aCoordList[ 0 ], aCoordList[ 1 ] );
370 rFlagLists.back().push_back( PolygonFlags_NORMAL );
371 aCurrentPoint = rPointLists.back().back();
376 aCoordList.resize(2, 0);
377 if ( !rPointLists.empty() && !rPointLists.back().empty() )
379 rPointLists.emplace_back( );
380 rFlagLists.emplace_back( );
382 rPointLists.back().emplace_back( (aCoordList[ 0 ]), aCoordList[ 1 ] );
383 rFlagLists.back().push_back( PolygonFlags_NORMAL );
384 aCurrentPoint = rPointLists.back().back();
388 aCoordList.resize(6, 0);
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();
403 aCoordList.resize(6, 0);
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();
415 aCoordList.resize(2, 0);
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();
424 aCoordList.resize(2, 0);
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();
432 SAL_WARN_IF(rPointLists.back().empty() || rFlagLists.back().empty(),
"oox",
"empty pointlists at close");
433 if (!rPointLists.back().empty() && !rFlagLists.back().empty())
435 rPointLists.back().push_back( rPointLists.back()[ 0 ] );
436 rFlagLists.back().push_back( rFlagLists.back()[ 0 ] );
437 aCurrentPoint = rPointLists.back().back();
442 rPointLists.emplace_back( );
443 rFlagLists.emplace_back( );
456 if (
i+1 < rPath.size())
457 nextChar = rPath[
i+1];
461 switch ( rPath[
i ] )
465 state = MOVE_REL; nParamCount = 2;
break;
467 state = MOVE_ABS; nParamCount = 2;
break;
469 state = BEZIER_REL; nParamCount = 6;
break;
471 state = BEZIER_ABS; nParamCount = 6;
break;
473 state = LINE_REL; nParamCount = 2;
break;
475 state = LINE_ABS; nParamCount = 2;
break;
477 state =
CLOSE;
break;
488 state = UNSUPPORTED;
i++;
break;
498 state = UNSUPPORTED;
i++;
break;
501 state = UNSUPPORTED;
i++;
break;
511 state = UNSUPPORTED;
i++;
break;
521 state = UNSUPPORTED;
i++;
break;
523 state = UNSUPPORTED;
i++;
break;
540 state = UNSUPPORTED;
i++;
break;
549 if (bCommand) nTokenLen = 0;
557sal_Int64 lclGetEmu(
const GraphicHelper& rGraphicHelper,
const std::optional< OUString >& roValue, sal_Int64 nDefValue )
562void lclGetDmlLineDash( std::optional< sal_Int32 >& oroPresetDash, LineProperties::DashStopVector& orCustomDash,
const std::optional< OUString >& roDashStyle )
564 if( !roDashStyle.has_value() )
567 const OUString& rDashStyle = roDashStyle.value();
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;
585 ::std::vector< sal_Int32 > aValues;
589 size_t nPairs = aValues.size() / 2;
590 for(
size_t nPairIdx = 0; nPairIdx < nPairs; ++nPairIdx )
591 orCustomDash.emplace_back( aValues[ 2 * nPairIdx ], aValues[ 2 * nPairIdx + 1 ] );
596sal_Int32 lclGetDmlArrowType(
const std::optional< sal_Int32 >& roArrowType )
598 if( roArrowType.has_value() )
switch( roArrowType.value() )
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;
610sal_Int32 lclGetDmlArrowWidth(
const std::optional< sal_Int32 >& roArrowWidth )
612 if( roArrowWidth.has_value() )
switch( roArrowWidth.value() )
614 case XML_narrow:
return XML_sm;
615 case XML_medium:
return XML_med;
616 case XML_wide:
return XML_lg;
621sal_Int32 lclGetDmlArrowLength(
const std::optional< sal_Int32 >& roArrowLength )
623 if( roArrowLength.has_value() )
switch( roArrowLength.value() )
625 case XML_short:
return XML_sm;
626 case XML_medium:
return XML_med;
627 case XML_long:
return XML_lg;
632void lclConvertArrow( LineArrowProperties& orArrowProp,
const StrokeArrowModel& rStrokeArrow )
634 orArrowProp.moArrowType = lclGetDmlArrowType( rStrokeArrow.moArrowType );
635 orArrowProp.moArrowWidth = lclGetDmlArrowWidth( rStrokeArrow.moArrowWidth );
636 orArrowProp.moArrowLength = lclGetDmlArrowLength( rStrokeArrow.moArrowLength );
639sal_Int32 lclGetDmlLineCompound(
const std::optional< sal_Int32 >& roLineStyle )
641 if( roLineStyle.has_value() )
switch( roLineStyle.value() )
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;
652sal_Int32 lclGetDmlLineCap(
const std::optional< sal_Int32 >& roEndCap )
654 if( roEndCap.has_value() )
switch( roEndCap.value() )
656 case XML_flat:
return XML_flat;
657 case XML_square:
return XML_sq;
658 case XML_round:
return XML_rnd;
663sal_Int32 lclGetDmlLineJoint(
const std::optional< sal_Int32 >& roJoinStyle )
665 if( roJoinStyle.has_value() )
switch( roJoinStyle.value() )
667 case XML_round:
return XML_round;
668 case XML_bevel:
return XML_bevel;
669 case XML_miter:
return XML_miter;
705 aLineProps.maLineFill.moFillType = XML_solidFill;
706 lclConvertArrow( aLineProps.maStartArrow,
maStartArrow );
707 lclConvertArrow( aLineProps.maEndArrow,
maEndArrow );
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 );
717 aLineProps.maLineFill.moFillType = XML_noFill;
720 aLineProps.pushToPropMap( rPropMap, rGraphicHelper );
740 auto aElement = rMap.find( fKey );
742 if (aElement != rMap.end())
743 aElement->second = rValue;
745 rMap.emplace( fKey, rValue );
752 FillProperties aFillProps;
756 sal_Int32 nFillType =
moType.value_or( XML_solid );
760 case XML_gradientRadial:
762 aFillProps.moFillType = XML_gradFill;
763 aFillProps.maGradientProps.moRotateWithShape =
moRotate.value_or(
false );
764 double fFocus =
moFocus.value_or( 0.0 );
771 if( nFillType == XML_gradient )
774 sal_Int32 nVmlAngle = getIntervalValue< sal_Int32, sal_Int32 >(
moAngle.value_or( 0 ), 0, 360 );
777 if( ((-0.75 <= fFocus) && (fFocus <= -0.25)) || ((0.25 <= fFocus) && (fFocus <= 0.75)) )
785 bool bOuterToInner = (fFocus > 0.0) == (nVmlAngle < 180);
787 const Color& rOuterColor = bOuterToInner ? aColor1 : aColor2;
788 const Color& rInnerColor = bOuterToInner ? aColor2 : aColor1;
802 if( fFocus < -0.5 || fFocus > 0.5 )
803 nVmlAngle = (nVmlAngle + 180) % 360;
810 sal_Int32 nDmlAngle = (630 - nVmlAngle) % 360;
815 aFillProps.maGradientProps.moGradientPath = XML_rect;
819 double fLeft = getLimitedValue< double, double >( aFocusPos.first, 0.0, 1.0 );
820 double fTop = getLimitedValue< double, double >( aFocusPos.second, 0.0, 1.0 );
821 double fRight = getLimitedValue< double, double >( fLeft + aFocusSize.first, fLeft, 1.0 );
822 double fBottom = getLimitedValue< double, double >( fTop + aFocusSize.second, fTop, 1.0 );
823 aFillProps.maGradientProps.moFillToRect = IntegerRectangle2D(
830 bool bOuterToInner = (-0.5 <= fFocus) && (fFocus <= 0.5);
831 lcl_setGradientStop( aFillProps.maGradientProps.maGradientStops, 0.0, bOuterToInner ? aColor2 : aColor1 );
832 lcl_setGradientStop( aFillProps.maGradientProps.maGradientStops, 1.0, bOuterToInner ? aColor1 : aColor2 );
844 if (aFillProps.maBlipProps.mxFillGraphic.is())
846 aFillProps.moFillType = XML_blipFill;
847 aFillProps.maBlipProps.moBitmapMode = (nFillType == XML_frame) ? XML_stretch : XML_tile;
857 aFillProps.moFillType = XML_solidFill;
865 aFillProps.moFillType = XML_noFill;
868 aFillProps.pushToPropMap( rPropMap, rGraphicHelper );
883 sal_Int32 nOffsetX = 62, nOffsetY = 62;
886 std::u16string_view aOffsetX, aOffsetY;
888 if (!aOffsetX.empty())
890 if (!aOffsetY.empty())
894 table::ShadowFormat aFormat;
895 aFormat.Color = sal_Int32(aColor.
getColor(rGraphicHelper));
896 aFormat.Location = nOffsetX < 0
897 ? nOffsetY < 0 ? table::ShadowLocation_TOP_LEFT : table::ShadowLocation_BOTTOM_LEFT
898 : nOffsetY < 0 ? table::ShadowLocation_TOP_RIGHT : table::ShadowLocation_BOTTOM_RIGHT;
900 aFormat.ShadowWidth = ((std::abs(nOffsetX) + std::abs(nOffsetY)) / 2);
912 {
"TextPathMode",
uno::Any(drawing::EnhancedCustomShapeTextPathMode_SHAPE) },
914 {
"SameLetterHeights",
uno::Any(
false) }
917 beans::PropertyValue aRet;
918 aRet.Name =
"TextPath";
919 aRet.Value <<= aTextpathPropSeq;
929 uno::Reference<text::XTextRange> xTextRange(xShape, uno::UNO_QUERY);
930 xTextRange->setString(
moString.value());
932 uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
933 uno::Sequence<beans::PropertyValue> aGeomPropSeq = xPropertySet->getPropertyValue(
"CustomShapeGeometry").get< uno::Sequence<beans::PropertyValue> >();
935 for (beans::PropertyValue& rProp : asNonConstRange(aGeomPropSeq))
937 if (rProp.Name ==
"TextPath")
945 sal_Int32 nSize = aGeomPropSeq.getLength();
946 aGeomPropSeq.realloc(nSize+1);
949 rPropMap.setAnyProperty(PROP_CustomShapeGeometry,
uno::Any(aGeomPropSeq));
953 OUString aStyle =
moStyle.value_or(OUString());
958 std::u16string_view
aName, aValue;
961 if (
aName ==
u"font-family")
964 if (aValue.size() > 2)
965 aValue = aValue.substr(1, aValue.size() - 2);
967 uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
968 xPropertySet->setPropertyValue(
"CharFontName",
uno::Any(OUString(aValue)));
971 else if (
aName ==
u"font-size")
973 std::optional<OUString> aOptString {OUString(aValue)};
976 uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
977 xPropertySet->setPropertyValue(
"CharHeight",
uno::Any(nSize));
985 OUString sText =
moString.value_or(
"");
990 pDevice->SetFont(aFont);
992 auto nTextWidth = pDevice->GetTextWidth(sText);
995 sal_Int32 nNewHeight = (
static_cast<double>(pDevice->GetTextHeight()) / nTextWidth) * xShape->getSize().Width;
996 xShape->setSize(awt::Size(xShape->getSize().Width, nNewHeight));
constexpr tools::Long Y() const
constexpr tools::Long X() const
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.
void SetFontSize(const Size &)
void SetFamilyName(const OUString &rFamilyName)
#define SAL_WARN_IF(condition, area, stream)
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
std::basic_string_view< charT, traits > trim(std::basic_string_view< charT, traits > str)
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)
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)
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)
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)
constexpr OUStringLiteral PROP_ShadowFormat