LibreOffice Module oox (master) 1
Functions
oox::vml::ConversionHelper Namespace Reference

Functions

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. More...
 
OOX_DLLPUBLIC bool decodeBool (std::u16string_view rValue)
 Returns the boolean value from the passed string of a VML attribute. More...
 
OOX_DLLPUBLIC double decodePercent (std::u16string_view rValue, double fDefValue)
 Converts the passed VML percentage measure string to a normalized floating-point value. More...
 
OOX_DLLPUBLIC Degree100 decodeRotation (std::u16string_view rValue)
 Converts the passed VML rotation value to degrees. More...
 
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). More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 

Function Documentation

◆ decodeBool()

bool oox::vml::ConversionHelper::decodeBool ( std::u16string_view  rValue)

Returns the boolean value from the passed string of a VML attribute.

Supported values: 'f', 't', 'false', 'true'. False for anything else.

Definition at line 97 of file vmlformatting.cxx.

References oox::AttributeConversion::decodeToken(), and nToken.

Referenced by oox::vml::ShapeContext::onCreateContext().

◆ decodeColor()

Color oox::vml::ConversionHelper::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.

Parameters
roVmlColorThe VML string representation of the color. If existing, this can be a 3-digit or 6-digit hexadecimal RGB value with leading '#' character, a predefined color name (e.g. 'black', 'red', etc.), the index into an application defined color palette in brackets with leading color name (e.g. 'red [9]' or 'windowColor [64]'), or a color modifier used in one-color gradients (e.g. 'fill darken(128)' or 'fill lighten(0)').
roVmlOpacityThe opacity of the color. If existing, this should be a floating-point value in the range [0.0;1.0].
nDefaultRgbDefault RGB color used if the parameter roVmlColor is empty.
nPrimaryRgbIf set to something else than API_RGB_TRANSPARENT, specifies the color to be used to resolve the color modifiers used in one-color gradients.
Returns
The resulting DrawingML color.

Definition at line 225 of file vmlformatting.cxx.

References oox::API_RGB_TRANSPARENT, oox::AttributeConversion::decodeToken(), oox::GraphicHelper::getSystemColor(), oox::drawingml::MAX_PERCENT, nValue, OUStringToOString(), separatePair(), o3tl::toInt32(), o3tl::toUInt32(), and XML_TOKEN_INVALID.

Referenced by oox::vml::StrokeModel::pushToPropMap(), oox::vml::FillModel::pushToPropMap(), and oox::vml::ShadowModel::pushToPropMap().

◆ decodeMeasureToEmu()

sal_Int64 oox::vml::ConversionHelper::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).

Parameters
rGraphicHelperThe graphic helper needed to perform pixel conversion according to the current output device.
rValueThe VML measure value. This is a floating-point value with optional measure string following the value.
nRefValueReference value needed for percentage measure.
bPixelXSet to true if the value is oriented horizontally (e.g. X coordinates, widths). Set to false if the value is oriented vertically (e.g. Y coordinates, heights). This is needed because output devices may specify different width and height for a pixel.
bDefaultAsPixelSet to true if omitted measure unit means pixel. Set to false if omitted measure unit means EMU.

Definition at line 151 of file vmlformatting.cxx.

References o3tl::cm, o3tl::convert(), oox::GraphicHelper::convertScreenPixelXToHmm(), oox::GraphicHelper::convertScreenPixelYToHmm(), o3tl::emu, o3tl::in, o3tl::mm, o3tl::mm100, o3tl::pc, o3tl::pt, and u.

Referenced by decodeMeasureToHmm(), and decodeMeasureToTwip().

◆ decodeMeasureToHmm()

sal_Int32 oox::vml::ConversionHelper::decodeMeasureToHmm ( const GraphicHelper rGraphicHelper,
std::u16string_view  rValue,
sal_Int32  nRefValue,
bool  bPixelX,
bool  bDefaultAsPixel 
)

◆ decodeMeasureToTwip()

sal_Int32 oox::vml::ConversionHelper::decodeMeasureToTwip ( const GraphicHelper rGraphicHelper,
std::u16string_view  rValue,
sal_Int32  nRefValue,
bool  bPixelX,
bool  bDefaultAsPixel 
)

Converts the passed VML measure string to Twip.

@param rGraphicHelper  See above.
@param rValue  See above.
@param nRefValue  See above.
@param bPixelX  See above.
@param bDefaultAsPixel  See above.

Definition at line 216 of file vmlformatting.cxx.

References decodeMeasureToEmu(), o3tl::emu, and o3tl::twip.

Referenced by oox::vml::ShapeContext::setPoints().

◆ decodePercent()

double oox::vml::ConversionHelper::decodePercent ( std::u16string_view  rValue,
double  fDefValue 
)

Converts the passed VML percentage measure string to a normalized floating-point value.

Parameters
rValueThe VML percentage value. This is a floating-point value with optional following '' or 'f' sign. If the sign is missing, the floating point value will be returned unmodified. If the '' sign is present, the value will be divided by 100. If the 'f' sign is present, the value will be divided by 65536.

Definition at line 104 of file vmlformatting.cxx.

◆ decodeRotation()

Degree100 oox::vml::ConversionHelper::decodeRotation ( std::u16string_view  rValue)

Converts the passed VML rotation value to degrees.

See DffPropertyReader::Fix16ToAngle(): in VML, positive rotation angles are clockwise, we have them as counter-clockwise. Additionally, VML type is 0..360, our is 0..36000.

Parameters
rValueThe VML rotation value. This is a floating-point value with optional 'fd' suffix. If the suffix is missing, the floating point value will be returned unmodified. If the 'fd' suffix is present, the value will be divided by 65536.

Definition at line 127 of file vmlformatting.cxx.

References NormAngle36000().

Referenced by oox::vml::ShapeBase::convertAndInsert(), oox::vml::SimpleShape::createPictureObject(), oox::vml::SimpleShape::implConvertAndInsert(), and oox::vml::GroupShape::implConvertAndInsert().

◆ decodeVmlPath()

OOX_DLLPUBLIC void oox::vml::ConversionHelper::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.

Parameters
rPointsThe point vector to fill with coordinates.
rFlagsThe flag vector to fill. PolygonFlags_NORMAL indicates a corresponding plain shape coordinate in rPoints and PolygonFlags_CONTROL indicates a bezier curve control point.
rPathThe VML path string.
rGraphicHelperSee above.

Referenced by oox::vml::BezierShape::implConvertAndInsert().

◆ separatePair()

bool oox::vml::ConversionHelper::separatePair ( std::u16string_view &  orValue1,
std::u16string_view &  orValue2,
std::u16string_view  rValue,
sal_Unicode  cSep 
)