diff options
-rw-r--r-- | include/oox/vml/vmlformatting.hxx | 12 | ||||
-rw-r--r-- | oox/source/vml/vmlformatting.cxx | 97 | ||||
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 24 | ||||
-rw-r--r-- | oox/source/vml/vmlshapecontext.cxx | 66 | ||||
-rw-r--r-- | oox/source/vml/vmltextboxcontext.cxx | 24 |
5 files changed, 113 insertions, 110 deletions
diff --git a/include/oox/vml/vmlformatting.hxx b/include/oox/vml/vmlformatting.hxx index 29d726a2bdba..3f7bbe60a457 100644 --- a/include/oox/vml/vmlformatting.hxx +++ b/include/oox/vml/vmlformatting.hxx @@ -57,7 +57,7 @@ namespace ConversionHelper /** Returns two values contained in rValue separated by cSep. */ OOX_DLLPUBLIC bool separatePair( - OUString& orValue1, OUString& orValue2, + std::u16string_view& orValue1, std::u16string_view& orValue2, std::u16string_view rValue, sal_Unicode cSep ); /** Returns the boolean value from the passed string of a VML attribute. @@ -75,7 +75,7 @@ namespace ConversionHelper the value will be divided by 65536. */ OOX_DLLPUBLIC double decodePercent( - const OUString& rValue, + std::u16string_view rValue, double fDefValue ); /** Converts the passed VML rotation value to degrees. @@ -88,7 +88,7 @@ namespace ConversionHelper point value will be returned unmodified. If the 'fd' suffix is present, the value will be divided by 65536. */ - OOX_DLLPUBLIC Degree100 decodeRotation( const OUString& rValue ); + OOX_DLLPUBLIC Degree100 decodeRotation( std::u16string_view rValue ); /** Converts the passed VML measure string to EMU (English Metric Units). @@ -110,7 +110,7 @@ namespace ConversionHelper */ OOX_DLLPUBLIC sal_Int64 decodeMeasureToEmu( const GraphicHelper& rGraphicHelper, - const OUString& rValue, + std::u16string_view rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel ); @@ -125,7 +125,7 @@ namespace ConversionHelper */ OOX_DLLPUBLIC sal_Int32 decodeMeasureToHmm( const GraphicHelper& rGraphicHelper, - const OUString& rValue, + std::u16string_view rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel ); @@ -139,7 +139,7 @@ namespace ConversionHelper @param bDefaultAsPixel See above. */ OOX_DLLPUBLIC sal_Int32 decodeMeasureToTwip(const GraphicHelper& rGraphicHelper, - const OUString& rValue, sal_Int32 nRefValue, + std::u16string_view rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel); /** Converts VML color attributes to a DrawingML color. diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index 241991dac3c8..80e38c2b318b 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -65,17 +65,19 @@ using ::com::sun::star::drawing::PolygonFlags_CONTROL; namespace { -bool lclExtractDouble( double& orfValue, sal_Int32& ornEndPos, std::u16string_view aValue ) +bool lclExtractDouble( double& orfValue, size_t& ornEndPos, std::u16string_view aValue ) { // extract the double value and find start position of unit characters rtl_math_ConversionStatus eConvStatus = rtl_math_ConversionStatus_Ok; - orfValue = ::rtl::math::stringToDouble( aValue, '.', '\0', &eConvStatus, &ornEndPos ); + sal_Int32 nEndPos; + orfValue = ::rtl::math::stringToDouble( aValue, '.', '\0', &eConvStatus, &nEndPos ); + ornEndPos = nEndPos; return eConvStatus == rtl_math_ConversionStatus_Ok; } } // namespace -bool ConversionHelper::separatePair( OUString& orValue1, OUString& orValue2, +bool ConversionHelper::separatePair( std::u16string_view& orValue1, std::u16string_view& orValue2, std::u16string_view rValue, sal_Unicode cSep ) { size_t nSepPos = rValue.find( cSep ); @@ -88,7 +90,7 @@ bool ConversionHelper::separatePair( OUString& orValue1, OUString& orValue2, { orValue1 = o3tl::trim(rValue); } - return !orValue1.isEmpty() && !orValue2.isEmpty(); + return !orValue1.empty() && !orValue2.empty(); } bool ConversionHelper::decodeBool( std::u16string_view rValue ) @@ -98,43 +100,43 @@ bool ConversionHelper::decodeBool( std::u16string_view rValue ) return (nToken == XML_t) || (nToken == XML_true); } -double ConversionHelper::decodePercent( const OUString& rValue, double fDefValue ) +double ConversionHelper::decodePercent( std::u16string_view rValue, double fDefValue ) { - if( rValue.isEmpty() ) + if( rValue.empty() ) return fDefValue; double fValue = 0.0; - sal_Int32 nEndPos = 0; + size_t nEndPos = 0; if( !lclExtractDouble( fValue, nEndPos, rValue ) ) return fDefValue; - if( nEndPos == rValue.getLength() ) + if( nEndPos == rValue.size() ) return fValue; - if( (nEndPos + 1 == rValue.getLength()) && (rValue[ nEndPos ] == '%') ) + if( (nEndPos + 1 == rValue.size()) && (rValue[ nEndPos ] == '%') ) return fValue / 100.0; - if( (nEndPos + 1 == rValue.getLength()) && (rValue[ nEndPos ] == 'f') ) + if( (nEndPos + 1 == rValue.size()) && (rValue[ nEndPos ] == 'f') ) return fValue / 65536.0; OSL_FAIL( "ConversionHelper::decodePercent - unknown measure unit" ); return fDefValue; } -Degree100 ConversionHelper::decodeRotation( const OUString& rValue ) +Degree100 ConversionHelper::decodeRotation( std::u16string_view rValue ) { - if( rValue.isEmpty() ) + if( rValue.empty() ) return 0_deg100; double fValue = 0.0; double fRotation = 0.0; - sal_Int32 nEndPos = 0; + size_t nEndPos = 0; if( !lclExtractDouble(fValue, nEndPos, rValue) ) return 0_deg100; - if( nEndPos == rValue.getLength() ) + if( nEndPos == rValue.size() ) fRotation = fValue; - else if( (nEndPos + 2 == rValue.getLength()) && (rValue[nEndPos] == 'f') && (rValue[nEndPos+1] == 'd') ) + else if( (nEndPos + 2 == rValue.size()) && (rValue[nEndPos] == 'f') && (rValue[nEndPos+1] == 'd') ) fRotation = fValue / 65536.0; else { @@ -146,14 +148,14 @@ Degree100 ConversionHelper::decodeRotation( const OUString& rValue ) } sal_Int64 ConversionHelper::decodeMeasureToEmu( const GraphicHelper& rGraphicHelper, - const OUString& rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel ) + std::u16string_view rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel ) { // default for missing values is 0 - if( rValue.isEmpty() ) + if( rValue.empty() ) return 0; // TODO: according to spec, value may contain "auto" - if ( rValue == "auto" ) + if ( rValue == u"auto" ) { OSL_FAIL( "ConversionHelper::decodeMeasureToEmu - special value 'auto' must be handled by caller" ); return nRefValue; @@ -161,14 +163,14 @@ sal_Int64 ConversionHelper::decodeMeasureToEmu( const GraphicHelper& rGraphicHel // extract the double value and find start position of unit characters double fValue = 0.0; - sal_Int32 nEndPos = 0; + size_t nEndPos = 0; if( !lclExtractDouble( fValue, nEndPos, rValue ) || (fValue == 0.0) ) return 0; // process trailing unit, convert to EMU std::u16string_view aUnit; - if( (0 < nEndPos) && (nEndPos < rValue.getLength()) ) - aUnit = rValue.subView( nEndPos ); + if( (0 < nEndPos) && (nEndPos < rValue.size()) ) + aUnit = rValue.substr( nEndPos ); else if( bDefaultAsPixel ) aUnit = u"px"; // else default is EMU @@ -205,13 +207,13 @@ sal_Int64 ConversionHelper::decodeMeasureToEmu( const GraphicHelper& rGraphicHel } sal_Int32 ConversionHelper::decodeMeasureToHmm( const GraphicHelper& rGraphicHelper, - const OUString& rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel ) + std::u16string_view rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel ) { return ::oox::drawingml::convertEmuToHmm( decodeMeasureToEmu( rGraphicHelper, rValue, nRefValue, bPixelX, bDefaultAsPixel ) ); } sal_Int32 ConversionHelper::decodeMeasureToTwip(const GraphicHelper& rGraphicHelper, - const OUString& rValue, sal_Int32 nRefValue, + std::u16string_view rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel) { return ::o3tl::convert( @@ -240,22 +242,22 @@ Color ConversionHelper::decodeColor( const GraphicHelper& rGraphicHelper, } // separate leading color name or RGB value from following palette index - OUString aColorName, aColorIndex; + std::u16string_view aColorName, aColorIndex; separatePair( aColorName, aColorIndex, roVmlColor.get(), ' ' ); // RGB colors in the format '#RRGGBB' - if( (aColorName.getLength() == 7) && (aColorName[ 0 ] == '#') ) + if( (aColorName.size() == 7) && (aColorName[ 0 ] == '#') ) { - aDmlColor.setSrgbClr( o3tl::toUInt32(aColorName.subView( 1 ), 16) ); + aDmlColor.setSrgbClr( o3tl::toUInt32(aColorName.substr( 1 ), 16) ); return aDmlColor; } // RGB colors in the format '#RGB' - if( (aColorName.getLength() == 4) && (aColorName[ 0 ] == '#') ) + if( (aColorName.size() == 4) && (aColorName[ 0 ] == '#') ) { - sal_Int32 nR = o3tl::toUInt32(aColorName.subView( 1, 1 ), 16 ) * 0x11; - sal_Int32 nG = o3tl::toUInt32(aColorName.subView( 2, 1 ), 16 ) * 0x11; - sal_Int32 nB = o3tl::toUInt32(aColorName.subView( 3, 1 ), 16 ) * 0x11; + sal_Int32 nR = o3tl::toUInt32(aColorName.substr( 1, 1 ), 16 ) * 0x11; + sal_Int32 nG = o3tl::toUInt32(aColorName.substr( 2, 1 ), 16 ) * 0x11; + sal_Int32 nB = o3tl::toUInt32(aColorName.substr( 3, 1 ), 16 ) * 0x11; aDmlColor.setSrgbClr( (nR << 16) | (nG << 8) | nB ); return aDmlColor; } @@ -273,26 +275,27 @@ Color ConversionHelper::decodeColor( const GraphicHelper& rGraphicHelper, } // try palette colors enclosed in brackets - if( (aColorIndex.getLength() >= 3) && (aColorIndex[ 0 ] == '[') && (aColorIndex[ aColorIndex.getLength() - 1 ] == ']') ) + if( (aColorIndex.size() >= 3) && (aColorIndex[ 0 ] == '[') && (aColorIndex[ aColorIndex.size() - 1 ] == ']') ) { - aDmlColor.setPaletteClr( o3tl::toInt32(aColorIndex.subView( 1, aColorIndex.getLength() - 2 )) ); + aDmlColor.setPaletteClr( o3tl::toInt32(aColorIndex.substr( 1, aColorIndex.size() - 2 )) ); return aDmlColor; } // try fill gradient modificator 'fill <modifier>(<amount>)' if( (nPrimaryRgb != API_RGB_TRANSPARENT) && (nColorToken == XML_fill) ) { - sal_Int32 nOpenParen = aColorIndex.indexOf( '(' ); - sal_Int32 nCloseParen = aColorIndex.indexOf( ')' ); - if( (2 <= nOpenParen) && (nOpenParen + 1 < nCloseParen) && (nCloseParen + 1 == aColorIndex.getLength()) ) + size_t nOpenParen = aColorIndex.find( '(' ); + size_t nCloseParen = aColorIndex.find( ')' ); + if( nOpenParen != std::u16string_view::npos && nCloseParen != std::u16string_view::npos && + (2 <= nOpenParen) && (nOpenParen + 1 < nCloseParen) && (nCloseParen + 1 == aColorIndex.size()) ) { sal_Int32 nModToken = XML_TOKEN_INVALID; - switch( AttributeConversion::decodeToken( aColorIndex.subView( 0, nOpenParen ) ) ) + switch( AttributeConversion::decodeToken( aColorIndex.substr( 0, nOpenParen ) ) ) { case XML_darken: nModToken = XML_shade;break; case XML_lighten: nModToken = XML_tint; } - sal_Int32 nValue = o3tl::toInt32(aColorIndex.subView( nOpenParen + 1, nCloseParen - nOpenParen - 1 )); + sal_Int32 nValue = o3tl::toInt32(aColorIndex.substr( nOpenParen + 1, nCloseParen - nOpenParen - 1 )); if( (nModToken != XML_TOKEN_INVALID) && (0 <= nValue) && (nValue < 255) ) { /* Simulate this modifier color by a color with related transformation. @@ -878,11 +881,11 @@ void ShadowModel::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelper& sal_Int32 nOffsetX = 62, nOffsetY = 62; if (moOffset.has()) { - OUString aOffsetX, aOffsetY; + std::u16string_view aOffsetX, aOffsetY; ConversionHelper::separatePair(aOffsetX, aOffsetY, moOffset.get(), ','); - if (!aOffsetX.isEmpty()) + if (!aOffsetX.empty()) nOffsetX = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, aOffsetX, 0, false, false ); - if (!aOffsetY.isEmpty()) + if (!aOffsetY.empty()) nOffsetY = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, aOffsetY, 0, false, false ); } @@ -950,22 +953,22 @@ void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, const uno::Referen sal_Int32 nIndex = 0; while( nIndex >= 0 ) { - OUString aName, aValue; + std::u16string_view aName, aValue; if (ConversionHelper::separatePair(aName, aValue, o3tl::getToken(aStyle, 0, ';', nIndex), ':')) { - if (aName == "font-family") + if (aName == u"font-family") { // remove " (first, and last character) - if (aValue.getLength() > 2) - aValue = aValue.copy(1, aValue.getLength() - 2); + if (aValue.size() > 2) + aValue = aValue.substr(1, aValue.size() - 2); uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); - xPropertySet->setPropertyValue("CharFontName", uno::Any(aValue)); + xPropertySet->setPropertyValue("CharFontName", uno::Any(OUString(aValue))); sFont = aValue; } - else if (aName == "font-size") + else if (aName == u"font-size") { - oox::OptValue<OUString> aOptString(aValue); + oox::OptValue<OUString> aOptString {OUString(aValue)}; float nSize = drawingml::convertEmuToPoints(lclGetEmu(rGraphicHelper, aOptString, 1)); uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 4a380480d29c..ecc23746d7ed 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -1143,11 +1143,11 @@ awt::Rectangle LineShape::getAbsRectangle() const awt::Rectangle aShapeRect; sal_Int32 nIndex = 0; - aShapeRect.X = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maShapeModel.maFrom.getToken(0, ',', nIndex), 0, true, true); - aShapeRect.Y = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maShapeModel.maFrom.getToken(0, ',', nIndex), 0, false, true); + aShapeRect.X = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, o3tl::getToken(maShapeModel.maFrom, 0, ',', nIndex), 0, true, true); + aShapeRect.Y = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, o3tl::getToken(maShapeModel.maFrom, 0, ',', nIndex), 0, false, true); nIndex = 0; - aShapeRect.Width = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maShapeModel.maTo.getToken(0, ',', nIndex), 0, true, true) - aShapeRect.X; - aShapeRect.Height = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maShapeModel.maTo.getToken(0, ',', nIndex), 0, false, true) - aShapeRect.Y; + aShapeRect.Width = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, o3tl::getToken(maShapeModel.maTo, 0, ',', nIndex), 0, true, true) - aShapeRect.X; + aShapeRect.Height = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, o3tl::getToken(maShapeModel.maTo, 0, ',', nIndex), 0, false, true) - aShapeRect.Y; return aShapeRect; } @@ -1199,20 +1199,20 @@ Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes // Start point aCoordLists[ 0 ].emplace_back( - ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maFrom.getToken( 0, ',', nIndex ), 0, true, true ), - ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maFrom.getToken( 0, ',', nIndex ), 0, false, true ) ); + ConversionHelper::decodeMeasureToHmm( rGraphicHelper, o3tl::getToken(maShapeModel.maFrom, 0, ',', nIndex ), 0, true, true ), + ConversionHelper::decodeMeasureToHmm( rGraphicHelper, o3tl::getToken(maShapeModel.maFrom, 0, ',', nIndex ), 0, false, true ) ); // Control point 1 aCoordLists[ 0 ].emplace_back( - ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maControl1.getToken( 0, ',', nIndex ), 0, true, true ), - ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maControl1.getToken( 0, ',', nIndex ), 0, false, true ) ); + ConversionHelper::decodeMeasureToHmm( rGraphicHelper, o3tl::getToken(maShapeModel.maControl1, 0, ',', nIndex ), 0, true, true ), + ConversionHelper::decodeMeasureToHmm( rGraphicHelper, o3tl::getToken(maShapeModel.maControl1, 0, ',', nIndex ), 0, false, true ) ); // Control point 2 aCoordLists[ 0 ].emplace_back( - ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maControl2.getToken( 0, ',', nIndex ), 0, true, true ), - ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maControl2.getToken( 0, ',', nIndex ), 0, false, true ) ); + ConversionHelper::decodeMeasureToHmm( rGraphicHelper, o3tl::getToken(maShapeModel.maControl2, 0, ',', nIndex ), 0, true, true ), + ConversionHelper::decodeMeasureToHmm( rGraphicHelper, o3tl::getToken(maShapeModel.maControl2, 0, ',', nIndex ), 0, false, true ) ); // End point aCoordLists[ 0 ].emplace_back( - ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maTo.getToken( 0, ',', nIndex ), 0, true, true ), - ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maTo.getToken( 0, ',', nIndex ), 0, false, true ) ); + ConversionHelper::decodeMeasureToHmm( rGraphicHelper, o3tl::getToken(maShapeModel.maTo, 0, ',', nIndex ), 0, true, true ), + ConversionHelper::decodeMeasureToHmm( rGraphicHelper, o3tl::getToken(maShapeModel.maTo, 0, ',', nIndex ), 0, false, true ) ); // First and last points are normals, points 2 and 4 are controls aFlagLists[ 0 ].resize( aCoordLists[ 0 ].size(), PolygonFlags_CONTROL ); diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index 9b489ce9b351..3141cb3aad68 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -103,9 +103,9 @@ OptValue< Int32Pair > lclDecodeInt32Pair( const AttributeList& rAttribs, sal_Int OptValue< Int32Pair > oRetValue; if( oValue.has() ) { - OUString aValue1, aValue2; + std::u16string_view aValue1, aValue2; ConversionHelper::separatePair( aValue1, aValue2, oValue.get(), ',' ); - oRetValue = Int32Pair( aValue1.toInt32(), aValue2.toInt32() ); + oRetValue = Int32Pair( o3tl::toInt32(aValue1), o3tl::toInt32(aValue2) ); } return oRetValue; } @@ -118,7 +118,7 @@ OptValue< DoublePair > lclDecodePercentPair( const AttributeList& rAttribs, sal_ OptValue< DoublePair > oRetValue; if( oValue.has() ) { - OUString aValue1, aValue2; + std::u16string_view aValue1, aValue2; ConversionHelper::separatePair( aValue1, aValue2, oValue.get(), ',' ); oRetValue = DoublePair( ConversionHelper::decodePercent( aValue1, 0.0 ), @@ -464,36 +464,36 @@ void ShapeTypeContext::setStyle( std::u16string_view rStyle ) sal_Int32 nIndex = 0; while( nIndex >= 0 ) { - OUString aName, aValue; + std::u16string_view aName, aValue; if( ConversionHelper::separatePair( aName, aValue, o3tl::getToken(rStyle, 0, ';', nIndex ), ':' ) ) { - if( aName == "position" ) mrTypeModel.maPosition = aValue; - else if( aName == "z-index" ) mrTypeModel.maZIndex = aValue; - else if( aName == "left" ) mrTypeModel.maLeft = aValue; - else if( aName == "top" ) mrTypeModel.maTop = aValue; - else if( aName == "width" ) mrTypeModel.maWidth = aValue; - else if( aName == "height" ) mrTypeModel.maHeight = aValue; - else if( aName == "margin-left" ) mrTypeModel.maMarginLeft = aValue; - else if( aName == "margin-top" ) mrTypeModel.maMarginTop = aValue; - else if( aName == "mso-position-vertical-relative" ) mrTypeModel.maPositionVerticalRelative = aValue; - else if( aName == "mso-position-horizontal-relative" ) mrTypeModel.maPositionHorizontalRelative = aValue; - else if( aName == "mso-position-horizontal" ) mrTypeModel.maPositionHorizontal = aValue; - else if( aName == "mso-position-vertical" ) mrTypeModel.maPositionVertical = aValue; - else if( aName == "mso-width-percent" ) mrTypeModel.maWidthPercent = aValue; - else if( aName == "mso-width-relative" ) mrTypeModel.maWidthRelative = aValue; - else if( aName == "mso-height-percent" ) mrTypeModel.maHeightPercent = aValue; - else if( aName == "mso-height-relative" ) mrTypeModel.maHeightRelative = aValue; - else if( aName == "mso-fit-shape-to-text" ) mrTypeModel.mbAutoHeight = true; - else if( aName == "rotation" ) mrTypeModel.maRotation = aValue; - else if( aName == "flip" ) mrTypeModel.maFlip = aValue; - else if( aName == "visibility" ) - mrTypeModel.mbVisible = aValue != "hidden"; - else if( aName == "mso-wrap-style" ) mrTypeModel.maWrapStyle = aValue; - else if ( aName == "v-text-anchor" ) mrTypeModel.maVTextAnchor = aValue; - else if ( aName == "mso-wrap-distance-left" ) mrTypeModel.maWrapDistanceLeft = aValue; - else if ( aName == "mso-wrap-distance-right" ) mrTypeModel.maWrapDistanceRight = aValue; - else if ( aName == "mso-wrap-distance-top" ) mrTypeModel.maWrapDistanceTop = aValue; - else if ( aName == "mso-wrap-distance-bottom" ) mrTypeModel.maWrapDistanceBottom = aValue; + if( aName == u"position" ) mrTypeModel.maPosition = aValue; + else if( aName == u"z-index" ) mrTypeModel.maZIndex = aValue; + else if( aName == u"left" ) mrTypeModel.maLeft = aValue; + else if( aName == u"top" ) mrTypeModel.maTop = aValue; + else if( aName == u"width" ) mrTypeModel.maWidth = aValue; + else if( aName == u"height" ) mrTypeModel.maHeight = aValue; + else if( aName == u"margin-left" ) mrTypeModel.maMarginLeft = aValue; + else if( aName == u"margin-top" ) mrTypeModel.maMarginTop = aValue; + else if( aName == u"mso-position-vertical-relative" ) mrTypeModel.maPositionVerticalRelative = aValue; + else if( aName == u"mso-position-horizontal-relative" ) mrTypeModel.maPositionHorizontalRelative = aValue; + else if( aName == u"mso-position-horizontal" ) mrTypeModel.maPositionHorizontal = aValue; + else if( aName == u"mso-position-vertical" ) mrTypeModel.maPositionVertical = aValue; + else if( aName == u"mso-width-percent" ) mrTypeModel.maWidthPercent = aValue; + else if( aName == u"mso-width-relative" ) mrTypeModel.maWidthRelative = aValue; + else if( aName == u"mso-height-percent" ) mrTypeModel.maHeightPercent = aValue; + else if( aName == u"mso-height-relative" ) mrTypeModel.maHeightRelative = aValue; + else if( aName == u"mso-fit-shape-to-text" ) mrTypeModel.mbAutoHeight = true; + else if( aName == u"rotation" ) mrTypeModel.maRotation = aValue; + else if( aName == u"flip" ) mrTypeModel.maFlip = aValue; + else if( aName == u"visibility" ) + mrTypeModel.mbVisible = aValue != u"hidden"; + else if( aName == u"mso-wrap-style" ) mrTypeModel.maWrapStyle = aValue; + else if ( aName == u"v-text-anchor" ) mrTypeModel.maVTextAnchor = aValue; + else if ( aName == u"mso-wrap-distance-left" ) mrTypeModel.maWrapDistanceLeft = aValue; + else if ( aName == u"mso-wrap-distance-right" ) mrTypeModel.maWrapDistanceRight = aValue; + else if ( aName == u"mso-wrap-distance-top" ) mrTypeModel.maWrapDistanceTop = aValue; + else if ( aName == u"mso-wrap-distance-bottom" ) mrTypeModel.maWrapDistanceBottom = aValue; } } } @@ -599,10 +599,10 @@ void ShapeContext::setPoints(std::u16string_view rPoints) while (nIndex >= 0) { sal_Int32 nX = ConversionHelper::decodeMeasureToTwip( - mrShape.getDrawing().getFilter().getGraphicHelper(), OUString(o3tl::getToken(rPoints, 0, ',', nIndex)), + mrShape.getDrawing().getFilter().getGraphicHelper(), o3tl::getToken(rPoints, 0, ',', nIndex), 0, true, true); sal_Int32 nY = ConversionHelper::decodeMeasureToTwip( - mrShape.getDrawing().getFilter().getGraphicHelper(), OUString(o3tl::getToken(rPoints, 0, ',', nIndex)), + mrShape.getDrawing().getFilter().getGraphicHelper(), o3tl::getToken(rPoints, 0, ',', nIndex), 0, false, true); mrShapeModel.maPoints.emplace_back(nX, nY); } diff --git a/oox/source/vml/vmltextboxcontext.cxx b/oox/source/vml/vmltextboxcontext.cxx index 00c56092ed2e..d043ebc87f00 100644 --- a/oox/source/vml/vmltextboxcontext.cxx +++ b/oox/source/vml/vmltextboxcontext.cxx @@ -184,27 +184,27 @@ TextBoxContext::TextBoxContext( ContextHandler2Helper const & rParent, TextBox& if( rAttribs.getString( XML_insetmode ).get() != "auto" ) { OUString inset = rAttribs.getString( XML_inset ).get(); - OUString value; - OUString remainingStr; + std::u16string_view value; + std::u16string_view remainingStr; ConversionHelper::separatePair( value, remainingStr, inset, ',' ); rTextBox.borderDistanceLeft = ConversionHelper::decodeMeasureToHmm( graphicHelper, - value.isEmpty() ? "0.1in" : value, 0, false, false ); + value.empty() ? u"0.1in" : value, 0, false, false ); inset = remainingStr; ConversionHelper::separatePair( value, remainingStr, inset, ',' ); rTextBox.borderDistanceTop = ConversionHelper::decodeMeasureToHmm( graphicHelper, - value.isEmpty() ? "0.05in" : value, 0, false, false ); + value.empty() ? u"0.05in" : value, 0, false, false ); inset = remainingStr; ConversionHelper::separatePair( value, remainingStr, inset, ',' ); rTextBox.borderDistanceRight = ConversionHelper::decodeMeasureToHmm( graphicHelper, - value.isEmpty() ? "0.1in" : value, 0, false, false ); + value.empty() ? u"0.1in" : value, 0, false, false ); inset = remainingStr; ConversionHelper::separatePair( value, remainingStr, inset, ',' ); rTextBox.borderDistanceBottom = ConversionHelper::decodeMeasureToHmm( graphicHelper, - value.isEmpty() ? "0.05in" : value, 0, false, false ); + value.empty() ? u"0.05in" : value, 0, false, false ); rTextBox.borderDistanceSet = true; } @@ -213,18 +213,18 @@ TextBoxContext::TextBoxContext( ContextHandler2Helper const & rParent, TextBox& sal_Int32 nIndex = 0; while( nIndex >= 0 ) { - OUString aName, aValue; + std::u16string_view aName, aValue; if( ConversionHelper::separatePair( aName, aValue, o3tl::getToken(sStyle, 0, ';', nIndex ), ':' ) ) { - if( aName == "layout-flow" ) rTextBox.maLayoutFlow = aValue; - else if (aName == "mso-fit-shape-to-text") + if( aName == u"layout-flow" ) rTextBox.maLayoutFlow = aValue; + else if (aName == u"mso-fit-shape-to-text") rTextBox.mrTypeModel.mbAutoHeight = true; - else if (aName == "mso-layout-flow-alt") + else if (aName == u"mso-layout-flow-alt") rTextBox.mrTypeModel.maLayoutFlowAlt = aValue; - else if (aName == "mso-next-textbox") + else if (aName == u"mso-next-textbox") rTextBox.msNextTextbox = aValue; else - SAL_WARN("oox", "unhandled style property: " << aName); + SAL_WARN("oox", "unhandled style property: " << OUString(aName)); } } } |