summaryrefslogtreecommitdiff
path: root/xmloff/source/draw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-06-23 12:34:31 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-06-26 13:12:31 +0200
commit0193b284e880a659ab73160e42238e1d5fe5cf8f (patch)
treeda09299838a6afb43d7c601803a6bab787489854 /xmloff/source/draw
parent2ef138de767c312188d41a7f206234eafac3108b (diff)
new loplugin:constexprliteral
OUStringLiteral should be declared constexpr, to enforce that it is initialised at compile-time and not runtime. This seems to make a different at least on Visual Studio Change-Id: I1698f5fa22ddb480347c2f4d444530c2e0e88d92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153499 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source/draw')
-rw-r--r--xmloff/source/draw/XMLGraphicsDefaultStyle.cxx2
-rw-r--r--xmloff/source/draw/layerexp.cxx12
-rw-r--r--xmloff/source/draw/sdxmlexp.cxx8
-rw-r--r--xmloff/source/draw/shapeexport.cxx14
-rw-r--r--xmloff/source/draw/xexptran.cxx24
-rw-r--r--xmloff/source/draw/ximppage.cxx8
-rw-r--r--xmloff/source/draw/ximpshap.cxx12
7 files changed, 40 insertions, 40 deletions
diff --git a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
index 4341c6db98cc..a13c58b41d91 100644
--- a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
+++ b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
@@ -119,7 +119,7 @@ void XMLGraphicsDefaultStyle::SetDefaults()
) )
bWordWrapDefault = false;
- static const OUStringLiteral sTextWordWrap( u"TextWordWrap" );
+ static constexpr OUStringLiteral sTextWordWrap( u"TextWordWrap" );
Reference< XPropertySetInfo > xInfo( xDefaults->getPropertySetInfo() );
if ( xInfo->hasPropertyByName( sTextWordWrap ) )
xDefaults->setPropertyValue( sTextWordWrap, Any( bWordWrapDefault ) );
diff --git a/xmloff/source/draw/layerexp.cxx b/xmloff/source/draw/layerexp.cxx
index 491d28c9d4ab..82a8dd410d6a 100644
--- a/xmloff/source/draw/layerexp.cxx
+++ b/xmloff/source/draw/layerexp.cxx
@@ -53,12 +53,12 @@ void SdXMLayerExporter::exportLayer( SvXMLExport& rExport )
if( nCount == 0 )
return;
- static const OUStringLiteral strName( u"Name" );
- static const OUStringLiteral strTitle( u"Title" );
- static const OUStringLiteral strDescription( u"Description" );
- static const OUStringLiteral strIsVisible( u"IsVisible");
- static const OUStringLiteral strIsPrintable( u"IsPrintable");
- static const OUStringLiteral strIsLocked( u"IsLocked" );
+ static constexpr OUStringLiteral strName( u"Name" );
+ static constexpr OUStringLiteral strTitle( u"Title" );
+ static constexpr OUStringLiteral strDescription( u"Description" );
+ static constexpr OUStringLiteral strIsVisible( u"IsVisible");
+ static constexpr OUStringLiteral strIsPrintable( u"IsPrintable");
+ static constexpr OUStringLiteral strIsLocked( u"IsLocked" );
OUString sTmp;
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index 915c3e9360c0..6b28da6fd2e2 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -1377,7 +1377,7 @@ HeaderFooterPageSettingsImpl SdXMLExport::ImpPrepDrawPageHeaderFooterDecls( cons
OUString aStrText;
- static const OUStringLiteral aStrHeaderTextProp( u"HeaderText" );
+ static constexpr OUStringLiteral aStrHeaderTextProp( u"HeaderText" );
if( xInfo->hasPropertyByName( aStrHeaderTextProp ) )
{
xSet->getPropertyValue( aStrHeaderTextProp ) >>= aStrText;
@@ -1385,7 +1385,7 @@ HeaderFooterPageSettingsImpl SdXMLExport::ImpPrepDrawPageHeaderFooterDecls( cons
aSettings.maStrHeaderDeclName = findOrAppendImpl( maHeaderDeclsVector, aStrText, gpStrHeaderTextPrefix );
}
- static const OUStringLiteral aStrFooterTextProp( u"FooterText" );
+ static constexpr OUStringLiteral aStrFooterTextProp( u"FooterText" );
if( xInfo->hasPropertyByName( aStrFooterTextProp ) )
{
xSet->getPropertyValue( aStrFooterTextProp ) >>= aStrText;
@@ -1393,7 +1393,7 @@ HeaderFooterPageSettingsImpl SdXMLExport::ImpPrepDrawPageHeaderFooterDecls( cons
aSettings.maStrFooterDeclName = findOrAppendImpl( maFooterDeclsVector, aStrText, gpStrFooterTextPrefix );
}
- static const OUStringLiteral aStrDateTimeTextProp( u"DateTimeText" );
+ static constexpr OUStringLiteral aStrDateTimeTextProp( u"DateTimeText" );
if( xInfo->hasPropertyByName( aStrDateTimeTextProp ) )
{
bool bFixed = false;
@@ -1508,7 +1508,7 @@ OUString SdXMLExport::ImpCreatePresPageStyleName( const Reference<XDrawPage>& xD
// which itself is a property of the pages property set
// we now merge these two propertysets if possible to simulate
// a single propertyset with all draw page properties
- static const OUStringLiteral aBackground(u"Background");
+ static constexpr OUStringLiteral aBackground(u"Background");
Reference< beans::XPropertySet > xPropSet2;
Reference< beans::XPropertySetInfo > xInfo( xPropSet1->getPropertySetInfo() );
if( xInfo.is() && xInfo->hasPropertyByName( aBackground ) )
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index 51976a625c97..a7f91d9326ef 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -3127,7 +3127,7 @@ void XMLShapeExport::ImpExportPageShape(
// export page number used for this page
uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
- static const OUStringLiteral aPageNumberStr(u"PageNumber");
+ static constexpr OUStringLiteral aPageNumberStr(u"PageNumber");
if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(aPageNumberStr))
{
sal_Int32 nPageNumber = 0;
@@ -3527,14 +3527,14 @@ void XMLShapeExport::ImpExportMediaShape(
const OUString aFalseStr( "false" ), aTrueStr( "true" );
bool bLoop = false;
- static const OUStringLiteral aLoopStr( u"Loop" );
+ static constexpr OUStringLiteral aLoopStr( u"Loop" );
xPropSet->getPropertyValue( aLoopStr ) >>= bLoop;
mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aLoopStr );
mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bLoop ? aTrueStr : aFalseStr );
delete new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true );
bool bMute = false;
- static const OUStringLiteral aMuteStr( u"Mute" );
+ static constexpr OUStringLiteral aMuteStr( u"Mute" );
xPropSet->getPropertyValue( aMuteStr ) >>= bMute;
mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aMuteStr );
mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bMute ? aTrueStr : aFalseStr );
@@ -3910,9 +3910,9 @@ void XMLShapeExport::export3DLamps( const css::uno::Reference< css::beans::XProp
OUString aStr;
OUStringBuffer sStringBuffer;
- static const OUStringLiteral aColorPropName(u"D3DSceneLightColor");
- static const OUStringLiteral aDirectionPropName(u"D3DSceneLightDirection");
- static const OUStringLiteral aLightOnPropName(u"D3DSceneLightOn");
+ static constexpr OUStringLiteral aColorPropName(u"D3DSceneLightColor");
+ static constexpr OUStringLiteral aDirectionPropName(u"D3DSceneLightDirection");
+ static constexpr OUStringLiteral aLightOnPropName(u"D3DSceneLightOn");
::basegfx::B3DVector aLightDirection;
drawing::Direction3D aLightDir;
@@ -4366,7 +4366,7 @@ static void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Referenc
uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
// geometry
- static const OUStringLiteral sCustomShapeGeometry( u"CustomShapeGeometry" );
+ static constexpr OUStringLiteral sCustomShapeGeometry( u"CustomShapeGeometry" );
if ( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( sCustomShapeGeometry ) )
{
uno::Any aGeoPropSet( xPropSet->getPropertyValue( sCustomShapeGeometry ) );
diff --git a/xmloff/source/draw/xexptran.cxx b/xmloff/source/draw/xexptran.cxx
index 3665533eeff7..c3ea5a4b0f70 100644
--- a/xmloff/source/draw/xexptran.cxx
+++ b/xmloff/source/draw/xexptran.cxx
@@ -355,12 +355,12 @@ void SdXMLImExTransform2D::SetString(const OUString& rNew, const SvXMLUnitConver
const OUString aStr = msString;
const sal_Int32 nLen(aStr.getLength());
- static const OUStringLiteral aString_rotate( u"rotate" );
- static const OUStringLiteral aString_scale( u"scale" );
- static const OUStringLiteral aString_translate( u"translate" );
- static const OUStringLiteral aString_skewX( u"skewX" );
- static const OUStringLiteral aString_skewY( u"skewY" );
- static const OUStringLiteral aString_matrix( u"matrix" );
+ static constexpr OUStringLiteral aString_rotate( u"rotate" );
+ static constexpr OUStringLiteral aString_scale( u"scale" );
+ static constexpr OUStringLiteral aString_translate( u"translate" );
+ static constexpr OUStringLiteral aString_skewX( u"skewX" );
+ static constexpr OUStringLiteral aString_skewY( u"skewY" );
+ static constexpr OUStringLiteral aString_matrix( u"matrix" );
sal_Int32 nPos(0);
@@ -762,12 +762,12 @@ void SdXMLImExTransform3D::SetString(const OUString& rNew, const SvXMLUnitConver
const OUString aStr = msString;
const sal_Int32 nLen(aStr.getLength());
- static const OUStringLiteral aString_rotatex( u"rotatex" );
- static const OUStringLiteral aString_rotatey( u"rotatey" );
- static const OUStringLiteral aString_rotatez( u"rotatez" );
- static const OUStringLiteral aString_scale( u"scale" );
- static const OUStringLiteral aString_translate( u"translate" );
- static const OUStringLiteral aString_matrix( u"matrix" );
+ static constexpr OUStringLiteral aString_rotatex( u"rotatex" );
+ static constexpr OUStringLiteral aString_rotatey( u"rotatey" );
+ static constexpr OUStringLiteral aString_rotatez( u"rotatez" );
+ static constexpr OUStringLiteral aString_scale( u"scale" );
+ static constexpr OUStringLiteral aString_translate( u"translate" );
+ static constexpr OUStringLiteral aString_matrix( u"matrix" );
sal_Int32 nPos(0);
diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx
index 117942c72f0b..c97be226bd3e 100644
--- a/xmloff/source/draw/ximppage.cxx
+++ b/xmloff/source/draw/ximppage.cxx
@@ -286,7 +286,7 @@ void SdXMLGenericPageContext::endFastElement(sal_Int32 )
if( !maUseHeaderDeclName.isEmpty() )
{
- static const OUStringLiteral aStrHeaderTextProp( u"HeaderText" );
+ static constexpr OUStringLiteral aStrHeaderTextProp( u"HeaderText" );
if( xInfo->hasPropertyByName( aStrHeaderTextProp ) )
xSet->setPropertyValue( aStrHeaderTextProp,
Any( GetSdImport().GetHeaderDecl( maUseHeaderDeclName ) ) );
@@ -294,7 +294,7 @@ void SdXMLGenericPageContext::endFastElement(sal_Int32 )
if( !maUseFooterDeclName.isEmpty() )
{
- static const OUStringLiteral aStrFooterTextProp( u"FooterText" );
+ static constexpr OUStringLiteral aStrFooterTextProp( u"FooterText" );
if( xInfo->hasPropertyByName( aStrFooterTextProp ) )
xSet->setPropertyValue( aStrFooterTextProp,
Any( GetSdImport().GetFooterDecl( maUseFooterDeclName ) ) );
@@ -302,7 +302,7 @@ void SdXMLGenericPageContext::endFastElement(sal_Int32 )
if( !maUseDateTimeDeclName.isEmpty() )
{
- static const OUStringLiteral aStrDateTimeTextProp( u"DateTimeText" );
+ static constexpr OUStringLiteral aStrDateTimeTextProp( u"DateTimeText" );
if( xInfo->hasPropertyByName( aStrDateTimeTextProp ) )
{
bool bFixed;
@@ -369,7 +369,7 @@ void SdXMLGenericPageContext::SetStyle( OUString const & rStyleName )
Reference< beans::XPropertySet > xPropSet( xPropSet1 );
Reference< beans::XPropertySet > xBackgroundSet;
- static const OUStringLiteral aBackground(u"Background");
+ static constexpr OUStringLiteral aBackground(u"Background");
if( xPropSet1->getPropertySetInfo()->hasPropertyByName( aBackground ) )
{
Reference< beans::XPropertySetInfo > xInfo( xPropSet1->getPropertySetInfo() );
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 5e965eba5aaa..c64a80b756a1 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -2195,7 +2195,7 @@ void SdXMLPageShapeContext::startFastElement (sal_Int32 nElement,
if(xPropSet.is())
{
uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
- static const OUStringLiteral aPageNumberStr(u"PageNumber");
+ static constexpr OUStringLiteral aPageNumberStr(u"PageNumber");
if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(aPageNumberStr))
xPropSet->setPropertyValue(aPageNumberStr, uno::Any( mnPageNumber ));
}
@@ -2627,7 +2627,7 @@ void SdXMLObjectShapeContext::startFastElement (sal_Int32 /*nElement*/,
if ( GetImport().IsPackageURL( maHref ) )
{
- static const OUStringLiteral sURL( u"vnd.sun.star.EmbeddedObject:" );
+ static constexpr OUStringLiteral sURL( u"vnd.sun.star.EmbeddedObject:" );
if ( aPersistName.startsWith( sURL ) )
aPersistName = aPersistName.copy( sURL.getLength() );
@@ -2675,7 +2675,7 @@ void SdXMLObjectShapeContext::endFastElement(sal_Int32 nElement)
if( mxBase64Stream.is() )
{
OUString aPersistName( GetImport().ResolveEmbeddedObjectURLFromBase64() );
- static const OUStringLiteral sURL( u"vnd.sun.star.EmbeddedObject:" );
+ static constexpr OUStringLiteral sURL( u"vnd.sun.star.EmbeddedObject:" );
aPersistName = aPersistName.copy( sURL.getLength() );
@@ -2991,7 +2991,7 @@ void SdXMLPluginShapeContext::endFastElement(sal_Int32 nElement)
{
if ( maSize.Width && maSize.Height )
{
- static const OUStringLiteral sVisibleArea( u"VisibleArea" );
+ static constexpr OUStringLiteral sVisibleArea( u"VisibleArea" );
uno::Reference< beans::XPropertySetInfo > aXPropSetInfo( xProps->getPropertySetInfo() );
if ( !aXPropSetInfo.is() || aXPropSetInfo->hasPropertyByName( sVisibleArea ) )
{
@@ -3671,7 +3671,7 @@ void SdXMLCustomShapeContext::endFastElement(sal_Int32 nElement)
if (aScale.getX() < 0.0)
{
- static const OUStringLiteral sName(u"MirroredX");
+ static constexpr OUStringLiteral sName(u"MirroredX");
//fdo#84043 Merge, if property exists, otherwise append it
auto aI = std::find_if(maCustomShapeGeometry.begin(), maCustomShapeGeometry.end(),
[](beans::PropertyValue& rValue) { return rValue.Name == sName; });
@@ -3697,7 +3697,7 @@ void SdXMLCustomShapeContext::endFastElement(sal_Int32 nElement)
if (aScale.getY() < 0.0)
{
- static const OUStringLiteral sName(u"MirroredY");
+ static constexpr OUStringLiteral sName(u"MirroredY");
//fdo#84043 Merge, if property exists, otherwise append it
auto aI = std::find_if(maCustomShapeGeometry.begin(), maCustomShapeGeometry.end(),
[](beans::PropertyValue& rValue) { return rValue.Name == sName; });