From 513108bd57bc64091f1faaa640c0f026b7d91001 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 12 Dec 2014 12:25:35 +0100 Subject: xmloff: Use appropriate OUString functions on string constants Change-Id: Idbe6ac27a4125bd9d9acb01ac42b60396abf0c81 --- xmloff/source/draw/XMLImageMapExport.cxx | 14 +++---------- xmloff/source/draw/shapeexport.cxx | 2 +- xmloff/source/draw/ximpcustomshape.cxx | 24 +++++++++++----------- xmloff/source/draw/ximpshap.cxx | 34 ++++++++++++++++---------------- 4 files changed, 33 insertions(+), 41 deletions(-) (limited to 'xmloff/source/draw') diff --git a/xmloff/source/draw/XMLImageMapExport.cxx b/xmloff/source/draw/XMLImageMapExport.cxx index b1f33257e350..b1a4b71d64e1 100644 --- a/xmloff/source/draw/XMLImageMapExport.cxx +++ b/xmloff/source/draw/XMLImageMapExport.cxx @@ -53,11 +53,6 @@ using ::com::sun::star::document::XEventsSupplier; using ::com::sun::star::lang::XServiceInfo; using ::com::sun::star::drawing::PointSequence; - -const sal_Char sAPI_ImageMapRectangleObject[] = "com.sun.star.image.ImageMapRectangleObject"; -const sal_Char sAPI_ImageMapCircleObject[] = "com.sun.star.image.ImageMapCircleObject"; -const sal_Char sAPI_ImageMapPolygonObject[] = "com.sun.star.image.ImageMapPolygonObject"; - XMLImageMapExport::XMLImageMapExport(SvXMLExport& rExp) : msBoundary("Boundary"), msCenter("Center"), @@ -144,20 +139,17 @@ void XMLImageMapExport::ExportMapEntry( { OUString& rName = sServiceNames[i]; - if ( rName.equalsAsciiL(sAPI_ImageMapRectangleObject, - sizeof(sAPI_ImageMapRectangleObject)-1) ) + if ( rName == "com.sun.star.image.ImageMapRectangleObject" ) { eType = XML_AREA_RECTANGLE; break; } - else if ( rName.equalsAsciiL(sAPI_ImageMapCircleObject, - sizeof(sAPI_ImageMapCircleObject)-1) ) + else if ( rName == "com.sun.star.image.ImageMapCircleObject" ) { eType = XML_AREA_CIRCLE; break; } - else if ( rName.equalsAsciiL(sAPI_ImageMapPolygonObject, - sizeof(sAPI_ImageMapPolygonObject)-1)) + else if ( rName == "com.sun.star.image.ImageMapPolygonObject" ) { eType = XML_AREA_POLYGON; break; diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 3efaba0a7350..09ba163f611a 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -195,7 +195,7 @@ uno::Reference< drawing::XShape > XMLShapeExport::checkForCustomShapeReplacement if( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 ) { OUString aType( xShape->getShapeType() ); - if( aType.equalsAscii( "com.sun.star.drawing.CustomShape" ) ) + if( aType == "com.sun.star.drawing.CustomShape" ) { uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY ); if( xSet.is() ) diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx index b6b0db95bfcf..8015a4b797ad 100644 --- a/xmloff/source/draw/ximpcustomshape.cxx +++ b/xmloff/source/draw/ximpcustomshape.cxx @@ -226,62 +226,62 @@ bool GetNextParameter( com::sun::star::drawing::EnhancedCustomShapeParameter& rP else if ( rParaString[ nIndex ] > '9' ) { bNumberRequired = false; - if ( rParaString.matchIgnoreAsciiCaseAsciiL( "left", 4, nIndex ) ) + if ( rParaString.matchIgnoreAsciiCase( "left", nIndex ) ) { rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::LEFT; nIndex += 4; } - else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "top", 3, nIndex ) ) + else if ( rParaString.matchIgnoreAsciiCase( "top", nIndex ) ) { rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::TOP; nIndex += 3; } - else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "right", 5, nIndex ) ) + else if ( rParaString.matchIgnoreAsciiCase( "right", nIndex ) ) { rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::RIGHT; nIndex += 5; } - else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "bottom", 6, nIndex ) ) + else if ( rParaString.matchIgnoreAsciiCase( "bottom", nIndex ) ) { rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::BOTTOM; nIndex += 6; } - else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "xstretch", 8, nIndex ) ) + else if ( rParaString.matchIgnoreAsciiCase( "xstretch", nIndex ) ) { rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::XSTRETCH; nIndex += 8; } - else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "ystretch", 8, nIndex ) ) + else if ( rParaString.matchIgnoreAsciiCase( "ystretch", nIndex ) ) { rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::YSTRETCH; nIndex += 8; } - else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "hasstroke", 9, nIndex ) ) + else if ( rParaString.matchIgnoreAsciiCase( "hasstroke", nIndex ) ) { rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::HASSTROKE; nIndex += 9; } - else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "hasfill", 7, nIndex ) ) + else if ( rParaString.matchIgnoreAsciiCase( "hasfill", nIndex ) ) { rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::HASFILL; nIndex += 7; } - else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "width", 5, nIndex ) ) + else if ( rParaString.matchIgnoreAsciiCase( "width", nIndex ) ) { rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::WIDTH; nIndex += 5; } - else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "height", 6, nIndex ) ) + else if ( rParaString.matchIgnoreAsciiCase( "height", nIndex ) ) { rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::HEIGHT; nIndex += 6; } - else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "logwidth", 8, nIndex ) ) + else if ( rParaString.matchIgnoreAsciiCase( "logwidth", nIndex ) ) { rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::LOGWIDTH; nIndex += 8; } - else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "logheight", 9, nIndex ) ) + else if ( rParaString.matchIgnoreAsciiCase( "logheight", nIndex ) ) { rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::LOGHEIGHT; nIndex += 9; diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 6a8c77a39b66..bc0ee6184675 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -128,7 +128,7 @@ static bool ImpIsEmptyURL( const OUString& rURL ) // #i13140# Also compare against 'toplevel' URLs. which also // result in empty filename strings. - if( rURL.equalsAscii( "#./" ) ) + if( rURL == "#./" ) return true; return false; @@ -3068,10 +3068,10 @@ void SdXMLPluginShapeContext::StartElement( const ::com::sun::star::uno::Referen if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( aLocalName, XML_MIME_TYPE ) ) { - if( xAttrList->getValueByIndex( n ).equalsAscii( "application/vnd.sun.star.media" ) ) + if( xAttrList->getValueByIndex( n ) == "application/vnd.sun.star.media" ) mbMedia = true; #if HAVE_FEATURE_GLTF - if( xAttrList->getValueByIndex( n ).equalsAscii( "model/vnd.gltf+json" ) ) + if( xAttrList->getValueByIndex( n ) == "model/vnd.gltf+json" ) mbMedia = true; #endif // leave this loop @@ -3220,49 +3220,49 @@ void SdXMLPluginShapeContext::EndElement() { const OUString& rName = maParams[ nParam ].Name; - if( rName.equalsAscii( "Loop" ) ) + if( rName == "Loop" ) { OUString aValueStr; maParams[ nParam ].Value >>= aValueStr; xProps->setPropertyValue("Loop", - uno::makeAny( aValueStr.equalsAscii( "true" ) ) ); + uno::makeAny( aValueStr == "true" ) ); } - else if( rName.equalsAscii( "Mute" ) ) + else if( rName == "Mute" ) { OUString aValueStr; maParams[ nParam ].Value >>= aValueStr; xProps->setPropertyValue("Mute", - uno::makeAny( aValueStr.equalsAscii( "true" ) ) ); + uno::makeAny( aValueStr == "true" ) ); } - else if( rName.equalsAscii( "VolumeDB" ) ) + else if( rName == "VolumeDB" ) { OUString aValueStr; maParams[ nParam ].Value >>= aValueStr; xProps->setPropertyValue("VolumeDB", uno::makeAny( static_cast< sal_Int16 >( aValueStr.toInt32() ) ) ); } - else if( rName.equalsAscii( "Zoom" ) ) + else if( rName == "Zoom" ) { OUString aZoomStr; media::ZoomLevel eZoomLevel; maParams[ nParam ].Value >>= aZoomStr; - if( aZoomStr.equalsAscii( "25%" ) ) + if( aZoomStr == "25%" ) eZoomLevel = media::ZoomLevel_ZOOM_1_TO_4; - else if( aZoomStr.equalsAscii( "50%" ) ) + else if( aZoomStr == "50%" ) eZoomLevel = media::ZoomLevel_ZOOM_1_TO_2; - else if( aZoomStr.equalsAscii( "100%" ) ) + else if( aZoomStr == "100%" ) eZoomLevel = media::ZoomLevel_ORIGINAL; - else if( aZoomStr.equalsAscii( "200%" ) ) + else if( aZoomStr == "200%" ) eZoomLevel = media::ZoomLevel_ZOOM_2_TO_1; - else if( aZoomStr.equalsAscii( "400%" ) ) + else if( aZoomStr == "400%" ) eZoomLevel = media::ZoomLevel_ZOOM_4_TO_1; - else if( aZoomStr.equalsAscii( "fit" ) ) + else if( aZoomStr == "fit" ) eZoomLevel = media::ZoomLevel_FIT_TO_WINDOW; - else if( aZoomStr.equalsAscii( "fixedfit" ) ) + else if( aZoomStr == "fixedfit" ) eZoomLevel = media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT; - else if( aZoomStr.equalsAscii( "fullscreen" ) ) + else if( aZoomStr == "fullscreen" ) eZoomLevel = media::ZoomLevel_FULLSCREEN; else eZoomLevel = media::ZoomLevel_NOT_AVAILABLE; -- cgit