diff options
author | Noel <noelgrandin@gmail.com> | 2020-11-25 08:14:07 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-11-30 12:32:14 +0100 |
commit | 8332d6d8200e8ca1f22dd98d9373efd5a431d09c (patch) | |
tree | dd45d452202998297b8562743ea6345462304d04 /sd | |
parent | d05a4cfbdcece491f7385dbeaa7eca03f2fdc1d5 (diff) |
loplugin:stringviewparam include comparisons with string literals
Change-Id: I8ba1214500dddaf413c506a4b82f43d63cda804b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106559
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/core/CustomAnimationEffect.cxx | 4 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptexanimations.cxx | 40 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptexanimations.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/animations/CustomAnimationPane.cxx | 40 | ||||
-rw-r--r-- | sd/source/ui/annotations/annotationmanager.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/func/fuconbez.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/func/fuconrec.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshowimpl.cxx | 28 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshowimpl.hxx | 2 |
9 files changed, 67 insertions, 67 deletions
diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index 492c9c0e45fc..bf4c3dab60db 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -1238,9 +1238,9 @@ bool CustomAnimationEffect::setProperty( sal_Int32 nNodeType, std::u16string_vie return bChanged; } -static bool implIsColorAttribute( const OUString& rAttributeName ) +static bool implIsColorAttribute( std::u16string_view rAttributeName ) { - return rAttributeName == "FillColor" || rAttributeName == "LineColor" || rAttributeName == "CharColor"; + return rAttributeName == u"FillColor" || rAttributeName == u"LineColor" || rAttributeName == u"CharColor"; } Any CustomAnimationEffect::getColor( sal_Int32 nIndex ) diff --git a/sd/source/filter/eppt/pptexanimations.cxx b/sd/source/filter/eppt/pptexanimations.cxx index eaa346b809ed..d1659dd730d3 100644 --- a/sd/source/filter/eppt/pptexanimations.cxx +++ b/sd/source/filter/eppt/pptexanimations.cxx @@ -1354,13 +1354,13 @@ void AnimationExporter::exportAnimEvent( SvStream& rStrm, const Reference< XAnim } } -Any AnimationExporter::convertAnimateValue( const Any& rSourceValue, const OUString& rAttributeName ) +Any AnimationExporter::convertAnimateValue( const Any& rSourceValue, std::u16string_view rAttributeName ) { OUString aDest; - if ( rAttributeName == "X" - || rAttributeName == "Y" - || rAttributeName == "Width" - || rAttributeName == "Height" + if ( rAttributeName == u"X" + || rAttributeName == u"Y" + || rAttributeName == u"Width" + || rAttributeName == u"Height" ) { OUString aStr; @@ -1370,20 +1370,20 @@ Any AnimationExporter::convertAnimateValue( const Any& rSourceValue, const OUStr aDest += aStr; } } - else if ( rAttributeName == "Rotate" // "r" or "style.rotation" ? - || rAttributeName == "Opacity" - || rAttributeName == "CharHeight" - || rAttributeName == "SkewX" + else if ( rAttributeName == u"Rotate" // "r" or "style.rotation" ? + || rAttributeName == u"Opacity" + || rAttributeName == u"CharHeight" + || rAttributeName == u"SkewX" ) { double fNumber = 0.0; if ( rSourceValue >>= fNumber ) aDest += OUString::number( fNumber ); } - else if ( rAttributeName == "Color" - || rAttributeName == "FillColor" // "Fillcolor" or "FillColor" ? - || rAttributeName == "LineColor" - || rAttributeName == "CharColor" + else if ( rAttributeName == u"Color" + || rAttributeName == u"FillColor" // "Fillcolor" or "FillColor" ? + || rAttributeName == u"LineColor" + || rAttributeName == u"CharColor" ) { sal_Int32 nColor = 0; @@ -1410,7 +1410,7 @@ Any AnimationExporter::convertAnimateValue( const Any& rSourceValue, const OUStr + ")"; } } - else if ( rAttributeName == "FillStyle" ) + else if ( rAttributeName == u"FillStyle" ) { css::drawing::FillStyle eFillStyle; if ( rSourceValue >>= eFillStyle ) @@ -1421,7 +1421,7 @@ Any AnimationExporter::convertAnimateValue( const Any& rSourceValue, const OUStr aDest += "solid"; } } - else if (rAttributeName == "FillOn") + else if (rAttributeName == u"FillOn") { bool bFillOn; if ( rSourceValue >>= bFillOn ) @@ -1432,7 +1432,7 @@ Any AnimationExporter::convertAnimateValue( const Any& rSourceValue, const OUStr aDest += "false"; } } - else if ( rAttributeName == "LineStyle" ) + else if ( rAttributeName == u"LineStyle" ) { css::drawing::LineStyle eLineStyle; if ( rSourceValue >>= eLineStyle ) @@ -1443,7 +1443,7 @@ Any AnimationExporter::convertAnimateValue( const Any& rSourceValue, const OUStr aDest += "true"; } } - else if ( rAttributeName == "CharWeight" ) + else if ( rAttributeName == u"CharWeight" ) { float fFontWeight = 0.0; if ( rSourceValue >>= fFontWeight ) @@ -1454,7 +1454,7 @@ Any AnimationExporter::convertAnimateValue( const Any& rSourceValue, const OUStr aDest += "normal"; } } - else if ( rAttributeName == "CharUnderline" ) + else if ( rAttributeName == u"CharUnderline" ) { sal_Int16 nFontUnderline = 0; if ( rSourceValue >>= nFontUnderline ) @@ -1465,7 +1465,7 @@ Any AnimationExporter::convertAnimateValue( const Any& rSourceValue, const OUStr aDest += "true"; } } - else if ( rAttributeName == "CharPosture" ) + else if ( rAttributeName == u"CharPosture" ) { css::awt::FontSlant eFontSlant; if ( rSourceValue >>= eFontSlant ) @@ -1476,7 +1476,7 @@ Any AnimationExporter::convertAnimateValue( const Any& rSourceValue, const OUStr aDest += "normal"; // ? } } - else if ( rAttributeName == "Visibility" ) + else if ( rAttributeName == u"Visibility" ) { bool bVisible = true; if ( rSourceValue >>= bVisible ) diff --git a/sd/source/filter/eppt/pptexanimations.hxx b/sd/source/filter/eppt/pptexanimations.hxx index 87432a7b5cb0..90916711f1c6 100644 --- a/sd/source/filter/eppt/pptexanimations.hxx +++ b/sd/source/filter/eppt/pptexanimations.hxx @@ -119,7 +119,7 @@ public: void doexport( const css::uno::Reference< css::drawing::XDrawPage >& xPage, SvStream& rStrm ); // helper methods also used in ooxml export - static css::uno::Any convertAnimateValue( const css::uno::Any& rSource, const OUString& rAttributeName ); + static css::uno::Any convertAnimateValue( const css::uno::Any& rSource, std::u16string_view rAttributeName ); static bool GetNodeType( const css::uno::Reference< css::animations::XAnimationNode >& xNode, sal_Int16& nType ); static sal_Int16 GetFillMode( const css::uno::Reference< css::animations::XAnimationNode >& xNode, const sal_Int16 nFillDefault ); static void GetUserData( const css::uno::Sequence< css::beans::NamedValue >& rUserData, const css::uno::Any ** pAny, std::size_t nLen ); diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index 39ea654879a9..4832de20446a 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -334,63 +334,63 @@ IMPL_LINK(CustomAnimationPane,EventMultiplexerListener, } } -static sal_Int32 getPropertyType( const OUString& rProperty ) +static sal_Int32 getPropertyType( std::u16string_view rProperty ) { - if ( rProperty == "Direction" ) + if ( rProperty == u"Direction" ) return nPropertyTypeDirection; - if ( rProperty == "Spokes" ) + if ( rProperty == u"Spokes" ) return nPropertyTypeSpokes; - if ( rProperty == "Zoom" ) + if ( rProperty == u"Zoom" ) return nPropertyTypeZoom; - if ( rProperty == "Accelerate" ) + if ( rProperty == u"Accelerate" ) return nPropertyTypeAccelerate; - if ( rProperty == "Decelerate" ) + if ( rProperty == u"Decelerate" ) return nPropertyTypeDecelerate; - if ( rProperty == "Color1" ) + if ( rProperty == u"Color1" ) return nPropertyTypeFirstColor; - if ( rProperty == "Color2" ) + if ( rProperty == u"Color2" ) return nPropertyTypeSecondColor; - if ( rProperty == "FillColor" ) + if ( rProperty == u"FillColor" ) return nPropertyTypeFillColor; - if ( rProperty == "ColorStyle" ) + if ( rProperty == u"ColorStyle" ) return nPropertyTypeColorStyle; - if ( rProperty == "AutoReverse" ) + if ( rProperty == u"AutoReverse" ) return nPropertyTypeAutoReverse; - if ( rProperty == "FontStyle" ) + if ( rProperty == u"FontStyle" ) return nPropertyTypeFont; - if ( rProperty == "CharColor" ) + if ( rProperty == u"CharColor" ) return nPropertyTypeCharColor; - if ( rProperty == "CharHeight" ) + if ( rProperty == u"CharHeight" ) return nPropertyTypeCharHeight; - if ( rProperty == "CharDecoration" ) + if ( rProperty == u"CharDecoration" ) return nPropertyTypeCharDecoration; - if ( rProperty == "LineColor" ) + if ( rProperty == u"LineColor" ) return nPropertyTypeLineColor; - if ( rProperty == "Rotate" ) + if ( rProperty == u"Rotate" ) return nPropertyTypeRotate; - if ( rProperty == "Transparency" ) + if ( rProperty == u"Transparency" ) return nPropertyTypeTransparency; - if ( rProperty == "Color" ) + if ( rProperty == u"Color" ) return nPropertyTypeColor; - if ( rProperty == "Scale" ) + if ( rProperty == u"Scale" ) return nPropertyTypeScale; return nPropertyTypeNone; diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index d24897a5c7dd..c98b433ee350 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -1037,7 +1037,7 @@ IMPL_LINK(AnnotationManagerImpl,EventMultiplexerListener, namespace { - sal_uInt16 IdentToSID(const OString& rIdent) + sal_uInt16 IdentToSID(std::string_view rIdent) { if (rIdent == "reply") return SID_REPLYTO_POSTIT; diff --git a/sd/source/ui/func/fuconbez.cxx b/sd/source/ui/func/fuconbez.cxx index a28bb06eb959..ee7099819bdf 100644 --- a/sd/source/ui/func/fuconbez.cxx +++ b/sd/source/ui/func/fuconbez.cxx @@ -357,15 +357,15 @@ void FuConstructBezierPolygon::SelectionHasChanged() namespace { /// Returns the color based on the color names listed in core/include/tools/color.hxx /// Feel free to extend with more color names from color.hxx -Color strToColor(const OUString& sColor) +Color strToColor(std::u16string_view sColor) { Color aColor = COL_AUTO; - if (sColor == "COL_GRAY") + if (sColor == u"COL_GRAY") aColor = COL_GRAY; - else if (sColor == "COL_GRAY3") + else if (sColor == u"COL_GRAY3") aColor = COL_GRAY3; - else if (sColor == "COL_GRAY7") + else if (sColor == u"COL_GRAY7") aColor = COL_GRAY7; return aColor; diff --git a/sd/source/ui/func/fuconrec.cxx b/sd/source/ui/func/fuconrec.cxx index b998191083f9..0d303efaedf5 100644 --- a/sd/source/ui/func/fuconrec.cxx +++ b/sd/source/ui/func/fuconrec.cxx @@ -511,15 +511,15 @@ void FuConstructRectangle::Deactivate() namespace { /// Returns the color based on the color names listed in core/include/tools/color.hxx /// Feel free to extend with more color names from color.hxx -Color strToColor(const OUString& sColor) +Color strToColor(std::u16string_view sColor) { Color aColor = COL_AUTO; - if (sColor == "COL_GRAY") + if (sColor == u"COL_GRAY") aColor = COL_GRAY; - else if (sColor == "COL_GRAY3") + else if (sColor == u"COL_GRAY3") aColor = COL_GRAY3; - else if (sColor == "COL_GRAY7") + else if (sColor == u"COL_GRAY7") aColor = COL_GRAY7; return aColor; diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 4219c5f76a1f..e4f36ff7fe14 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -3040,24 +3040,24 @@ void PresentationSettingsEx::SetArguments( const Sequence< PropertyValue >& rArg } } -void PresentationSettingsEx::SetPropertyValue( const OUString& rProperty, const Any& rValue ) +void PresentationSettingsEx::SetPropertyValue( std::u16string_view rProperty, const Any& rValue ) { - if ( rProperty == "RehearseTimings" ) + if ( rProperty == u"RehearseTimings" ) { if( rValue >>= mbRehearseTimings ) return; } - else if ( rProperty == "Preview" ) + else if ( rProperty == u"Preview" ) { if( rValue >>= mbPreview ) return; } - else if ( rProperty == "AnimationNode" ) + else if ( rProperty == u"AnimationNode" ) { if( rValue >>= mxAnimationNode ) return; } - else if ( rProperty == "ParentWindow" ) + else if ( rProperty == u"ParentWindow" ) { Reference< XWindow > xWindow; if( rValue >>= xWindow ) @@ -3067,12 +3067,12 @@ void PresentationSettingsEx::SetPropertyValue( const OUString& rProperty, const return; } } - else if ( rProperty == "AllowAnimations" ) + else if ( rProperty == u"AllowAnimations" ) { if( rValue >>= mbAnimationAllowed ) return; } - else if ( rProperty == "FirstPage" ) + else if ( rProperty == u"FirstPage" ) { OUString aPresPage; if( rValue >>= aPresPage ) @@ -3088,32 +3088,32 @@ void PresentationSettingsEx::SetPropertyValue( const OUString& rProperty, const return; } } - else if ( rProperty == "IsAlwaysOnTop" ) + else if ( rProperty == u"IsAlwaysOnTop" ) { if( rValue >>= mbAlwaysOnTop ) return; } - else if ( rProperty == "IsAutomatic" ) + else if ( rProperty == u"IsAutomatic" ) { if( rValue >>= mbManual ) return; } - else if ( rProperty == "IsEndless" ) + else if ( rProperty == u"IsEndless" ) { if( rValue >>= mbEndless ) return; } - else if ( rProperty == "IsFullScreen" ) + else if ( rProperty == u"IsFullScreen" ) { if( rValue >>= mbFullScreen ) return; } - else if ( rProperty == "IsMouseVisible" ) + else if ( rProperty == u"IsMouseVisible" ) { if( rValue >>= mbMouseVisible ) return; } - else if ( rProperty == "Pause" ) + else if ( rProperty == u"Pause" ) { sal_Int32 nPause = -1; if( (rValue >>= nPause) && (nPause >= 0) ) @@ -3122,7 +3122,7 @@ void PresentationSettingsEx::SetPropertyValue( const OUString& rProperty, const return; } } - else if ( rProperty == "UsePen" ) + else if ( rProperty == u"UsePen" ) { if( rValue >>= mbMouseAsPen ) return; diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx index ac84875c4c65..8f848a4f1aa9 100644 --- a/sd/source/ui/slideshow/slideshowimpl.hxx +++ b/sd/source/ui/slideshow/slideshowimpl.hxx @@ -69,7 +69,7 @@ struct PresentationSettingsEx : public PresentationSettings void SetArguments( const css::uno::Sequence< css::beans::PropertyValue >& rArguments ); /// @throws css::lang::IllegalArgumentException - void SetPropertyValue( const OUString& rProperty, const css::uno::Any& rValue ); + void SetPropertyValue( std::u16string_view rProperty, const css::uno::Any& rValue ); }; struct WrappedShapeEventImpl |