summaryrefslogtreecommitdiff
path: root/chart2/source
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 /chart2/source
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 'chart2/source')
-rw-r--r--chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx2
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.cxx4
-rw-r--r--chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx4
-rw-r--r--chart2/source/model/template/PieChartTypeTemplate.cxx2
-rw-r--r--chart2/source/tools/InternalDataProvider.cxx2
-rw-r--r--chart2/source/tools/ObjectIdentifier.cxx8
-rw-r--r--chart2/source/tools/RegressionCurveHelper.cxx2
-rw-r--r--chart2/source/tools/StatisticsHelper.cxx2
-rw-r--r--chart2/source/tools/UncachedDataSequence.cxx2
-rw-r--r--chart2/source/view/axes/VCartesianAxis.cxx2
-rw-r--r--chart2/source/view/main/VLegend.cxx2
11 files changed, 16 insertions, 16 deletions
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
index f5cc10484417..a491dafa6c02 100644
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -447,7 +447,7 @@ sal_Int32 lcl_getNewAPIIndexForOldAPIIndex(
OUString lcl_getDiagramType( std::u16string_view rTemplateServiceName )
{
- static const OUStringLiteral aPrefix(u"com.sun.star.chart2.template.");
+ static constexpr OUStringLiteral aPrefix(u"com.sun.star.chart2.template.");
if( o3tl::starts_with(rTemplateServiceName, aPrefix) )
{
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index d6c4c6565621..0f21a03fd4f8 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -350,7 +350,7 @@ void DataSourceTabPage::fillSeriesListBox()
OUString aResString(::chart::SchResId( STR_DATA_UNNAMED_SERIES_WITH_INDEX ));
// replace index of unnamed series
- static const OUStringLiteral aReplacementStr( u"%NUMBER" );
+ static constexpr OUStringLiteral aReplacementStr( u"%NUMBER" );
sal_Int32 nIndex = aResString.indexOf( aReplacementStr );
if( nIndex != -1 )
aLabel = aResString.replaceAt(
@@ -480,7 +480,7 @@ IMPL_LINK_NOARG(DataSourceTabPage, RoleSelectionChangedHdl, weld::TreeView&, voi
OUString aSelectedRange = lcl_GetSelectedRolesRange( *m_xLB_ROLE );
// replace role in fixed text label
- static const OUStringLiteral aReplacementStr( u"%VALUETYPE" );
+ static constexpr OUStringLiteral aReplacementStr( u"%VALUETYPE" );
sal_Int32 nIndex = m_aFixedTextRange.indexOf( aReplacementStr );
if( nIndex != -1 )
{
diff --git a/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx b/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx
index 44cac45aa605..39bbc4bf2ec4 100644
--- a/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx
@@ -426,7 +426,7 @@ bool GraphicPropertyItemConverter::ApplySpecialItem(
case XATTR_FILLBMP_STRETCH:
if( lcl_supportsFillProperties( m_GraphicObjectType ))
{
- static const OUStringLiteral aModePropName(u"FillBitmapMode");
+ static constexpr OUStringLiteral aModePropName(u"FillBitmapMode");
bool bStretched = rItemSet.Get( XATTR_FILLBMP_STRETCH ).GetValue();
drawing::BitmapMode aMode =
(bStretched ? drawing::BitmapMode_STRETCH : drawing::BitmapMode_NO_REPEAT);
@@ -448,7 +448,7 @@ bool GraphicPropertyItemConverter::ApplySpecialItem(
case XATTR_FILLBMP_TILE:
if( lcl_supportsFillProperties( m_GraphicObjectType ))
{
- static const OUStringLiteral aModePropName(u"FillBitmapMode");
+ static constexpr OUStringLiteral aModePropName(u"FillBitmapMode");
bool bTiled = rItemSet.Get( XATTR_FILLBMP_TILE ).GetValue();
drawing::BitmapMode aMode =
(bTiled ? drawing::BitmapMode_REPEAT : drawing::BitmapMode_NO_REPEAT);
diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx
index 166245168d0b..0fe822e6348c 100644
--- a/chart2/source/model/template/PieChartTypeTemplate.cxx
+++ b/chart2/source/model/template/PieChartTypeTemplate.cxx
@@ -419,7 +419,7 @@ void PieChartTypeTemplate::applyStyle2(
if( nSeriesIndex == nOuterSeriesIndex ) //@todo in future this will depend on Orientation of the radius axis scale
{
- static const OUStringLiteral aOffsetPropName( u"Offset" );
+ static constexpr OUStringLiteral aOffsetPropName( u"Offset" );
// get offset mode
chart2::PieChartOffsetMode ePieOffsetMode;
getFastPropertyValue( PROP_PIE_TEMPLATE_OFFSET_MODE ) >>= ePieOffsetMode;
diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx
index cd201b6270e2..a07832babd24 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -1245,7 +1245,7 @@ OUString SAL_CALL InternalDataProvider::convertRangeFromXML( const OUString& aXM
return "";
}
- static const OUStringLiteral aPivotTableID(u"PT@");
+ static constexpr OUStringLiteral aPivotTableID(u"PT@");
if (aXMLRange.startsWith(aPivotTableID))
return aXMLRange.copy(aPivotTableID.getLength());
diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx
index eed5cbe6a8b9..f2f95ad5296a 100644
--- a/chart2/source/tools/ObjectIdentifier.cxx
+++ b/chart2/source/tools/ObjectIdentifier.cxx
@@ -58,10 +58,10 @@ using namespace ::com::sun::star::chart2;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Any;
-const OUStringLiteral m_aMultiClick = u"MultiClick";
-const OUStringLiteral m_aDragMethodEquals = u"DragMethod=";
-const OUStringLiteral m_aDragParameterEquals = u"DragParameter=";
-const OUStringLiteral m_aProtocol = u"CID/";
+constexpr OUStringLiteral m_aMultiClick = u"MultiClick";
+constexpr OUStringLiteral m_aDragMethodEquals = u"DragMethod=";
+constexpr OUStringLiteral m_aDragParameterEquals = u"DragParameter=";
+constexpr OUStringLiteral m_aProtocol = u"CID/";
const OUString m_aPieSegmentDragMethodServiceName("PieSegmentDragging");
namespace
diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx
index 0bed3ca19e16..8d9ba75962e9 100644
--- a/chart2/source/tools/RegressionCurveHelper.cxx
+++ b/chart2/source/tools/RegressionCurveHelper.cxx
@@ -851,7 +851,7 @@ void RegressionCurveHelper::resetEquationPosition(
try
{
- static const OUStringLiteral aPosPropertyName( u"RelativePosition" );
+ static constexpr OUStringLiteral aPosPropertyName( u"RelativePosition" );
Reference< beans::XPropertySet > xEqProp( xCurve->getEquationProperties()); // since m233: , uno::UNO_SET_THROW );
if( xEqProp->getPropertyValue( aPosPropertyName ).hasValue())
xEqProp->setPropertyValue( aPosPropertyName, uno::Any());
diff --git a/chart2/source/tools/StatisticsHelper.cxx b/chart2/source/tools/StatisticsHelper.cxx
index 1336f471432c..95fa4464ad52 100644
--- a/chart2/source/tools/StatisticsHelper.cxx
+++ b/chart2/source/tools/StatisticsHelper.cxx
@@ -144,7 +144,7 @@ void lcl_setXMLRangePropertyAtDataSequence(
{
try
{
- static const OUStringLiteral aXMLRangePropName( u"CachedXMLRange");
+ static constexpr OUStringLiteral aXMLRangePropName( u"CachedXMLRange");
Reference< beans::XPropertySet > xProp( xDataSequence, uno::UNO_QUERY_THROW );
Reference< beans::XPropertySetInfo > xInfo( xProp->getPropertySetInfo());
if( xInfo.is() && xInfo->hasPropertyByName( aXMLRangePropName ))
diff --git a/chart2/source/tools/UncachedDataSequence.cxx b/chart2/source/tools/UncachedDataSequence.cxx
index ddf80d52b221..0e9f654cec95 100644
--- a/chart2/source/tools/UncachedDataSequence.cxx
+++ b/chart2/source/tools/UncachedDataSequence.cxx
@@ -212,7 +212,7 @@ Sequence< OUString > SAL_CALL UncachedDataSequence::generateLabel( chart2::data:
// auto-generated label
sal_Int32 nSeries = m_aSourceRepresentation.toInt32() + 1;
OUString aResString(::chart::SchResId(STR_DATA_UNNAMED_SERIES_WITH_INDEX));
- static const OUStringLiteral aReplacementStr(u"%NUMBER");
+ static constexpr OUStringLiteral aReplacementStr(u"%NUMBER");
sal_Int32 nIndex = aResString.indexOf(aReplacementStr);
OUString aName;
if( nIndex != -1 )
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index 8bd6690ff3ca..25919f548cfb 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -103,7 +103,7 @@ static void lcl_ResizeTextShapeToFitAvailableSpace( SvxShapeText& rShape2DText,
if( !nAvgCharWidth )
return;
- static const OUStringLiteral sDots = u"...";
+ static constexpr OUStringLiteral sDots = u"...";
const sal_Int32 nCharsToRemove = ( nTextSize - nMaxLabelsSize ) / nAvgCharWidth + 1;
sal_Int32 nNewLen = rLabel.size() - nCharsToRemove - sDots.getLength();
// Prevent from showing only dots
diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx
index 885f1acac8d6..de8d0377bd7c 100644
--- a/chart2/source/view/main/VLegend.cxx
+++ b/chart2/source/view/main/VLegend.cxx
@@ -421,7 +421,7 @@ awt::Size lcl_placeLegendEntries(
try
{
OUString aLabelString = rEntries[0].xLabel->getString();
- static const OUStringLiteral sDots = u"...";
+ static constexpr OUStringLiteral sDots = u"...";
for (sal_Int32 nNewLen = aLabelString.getLength() - sDots.getLength(); nNewLen > 0; )
{
OUString aNewLabel = aLabelString.subView(0, nNewLen) + sDots;