diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-06-23 12:34:31 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-06-26 13:12:31 +0200 |
commit | 0193b284e880a659ab73160e42238e1d5fe5cf8f (patch) | |
tree | da09299838a6afb43d7c601803a6bab787489854 | |
parent | 2ef138de767c312188d41a7f206234eafac3108b (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>
223 files changed, 709 insertions, 616 deletions
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 64ba5cd20c86..1070f1986e38 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -1893,7 +1893,7 @@ Reference< frame::XModel > StarBASIC::GetModelFromBasic( SbxObject* pBasic ) // look for the ThisComponent variable, first in the parent (which // might be the document's Basic), then in the parent's parent (which might be // the application Basic) - static const OUStringLiteral sThisComponent( u"ThisComponent"); + static constexpr OUStringLiteral sThisComponent( u"ThisComponent"); SbxVariable* pThisComponent = nullptr; SbxObject* pLookup = pBasic->GetParent(); diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index 317539fbeecd..6003734cc050 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -122,7 +122,7 @@ ErrCode ImpScan( const OUString& rWSrc, double& nVal, SbxDataType& rType, if( bOnlyIntntl ) aSearchStr.append(cIntntlGrpSep); const OUString pSearchStr = aSearchStr.makeStringAndClear(); - static const OUStringLiteral pDdEe = u"DdEe"; + static constexpr OUStringLiteral pDdEe = u"DdEe"; while( ImpStrChr( pSearchStr, *p ) ) { aBuf.append( *p ); @@ -191,7 +191,7 @@ ErrCode ImpScan( const OUString& rWSrc, double& nVal, SbxDataType& rType, eScanType = SbxDOUBLE; // type detection? - static const OUStringLiteral pTypes = u"%!&#"; + static constexpr OUStringLiteral pTypes = u"%!&#"; if( ImpStrChr( pTypes, *p ) ) p++; } 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; diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx index e9b173a47369..6493776a158b 100644 --- a/comphelper/source/misc/backupfilehelper.cxx +++ b/comphelper/source/misc/backupfilehelper.cxx @@ -661,8 +661,8 @@ namespace const ExtensionInfoEntryVector& rToBeEnabled, const ExtensionInfoEntryVector& rToBeDisabled) { - static const OUStringLiteral aRegPathFront(u"/uno_packages/cache/registry/com.sun.star.comp.deployment."); - static const OUStringLiteral aRegPathBack(u".PackageRegistryBackend/backenddb.xml"); + static constexpr OUStringLiteral aRegPathFront(u"/uno_packages/cache/registry/com.sun.star.comp.deployment."); + static constexpr OUStringLiteral aRegPathBack(u".PackageRegistryBackend/backenddb.xml"); // first appearance to check { const OUString aUnoPackagReg(OUString::Concat(rUserConfigWorkURL) + aRegPathFront + "bundle" + aRegPathBack); @@ -1467,7 +1467,7 @@ namespace comphelper // points to registrymodifications.xcu OUString conf("${CONFIGURATION_LAYERS}"); rtl::Bootstrap::expandMacros(conf); - static const OUStringLiteral aTokenUser(u"user:"); + static constexpr OUStringLiteral aTokenUser(u"user:"); sal_Int32 nStart(conf.indexOf(aTokenUser)); if (-1 != nStart) diff --git a/compilerplugins/clang/constexprliteral.cxx b/compilerplugins/clang/constexprliteral.cxx new file mode 100644 index 000000000000..86bba13e090c --- /dev/null +++ b/compilerplugins/clang/constexprliteral.cxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef LO_CLANG_SHARED_PLUGINS + +#include <cassert> +#include <stack> + +#include "check.hxx" +#include "plugin.hxx" +#include "config_clang.h" + +namespace +{ +class ConstexprLiteral final : public loplugin::FilteringPlugin<ConstexprLiteral> +{ +public: + explicit ConstexprLiteral(loplugin::InstantiationData const& data) + : FilteringPlugin(data) + { + } + + bool VisitVarDecl(const VarDecl* varDecl) + { + if (ignoreLocation(varDecl)) + return true; + if (varDecl->isConstexpr()) + return true; + if (!loplugin::TypeCheck(varDecl->getType()) + .Class("OUStringLiteral") + .Namespace("rtl") + .GlobalNamespace()) + return true; + report(DiagnosticsEngine::Warning, "OUStringLiteral should be declared constexpr", + varDecl->getBeginLoc()) + << varDecl->getSourceRange(); + return true; + } + + bool preRun() override + { + if (!compiler.getLangOpts().CPlusPlus) + return false; + return true; + } + +private: + void run() override + { + if (preRun()) + { + TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); + } + } +}; + +loplugin::Plugin::Registration<ConstexprLiteral> constexprliteral("constexprliteral"); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/compilerplugins/clang/test/constexprliteral.cxx b/compilerplugins/clang/test/constexprliteral.cxx new file mode 100644 index 000000000000..f33ab2ff7a74 --- /dev/null +++ b/compilerplugins/clang/test/constexprliteral.cxx @@ -0,0 +1,24 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <sal/config.h> +#include <rtl/string.hxx> +#include <rtl/ustring.hxx> + +namespace test1 +{ +void f() +{ + // expected-error@+1 {{OUStringLiteral should be declared constexpr [loplugin:constexprliteral]}} + const OUStringLiteral foo = u"foo"; + (void)foo; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/connectivity/qa/connectivity/ado/DriverTest.cxx b/connectivity/qa/connectivity/ado/DriverTest.cxx index abe4da67b012..a737387fe010 100644 --- a/connectivity/qa/connectivity/ado/DriverTest.cxx +++ b/connectivity/qa/connectivity/ado/DriverTest.cxx @@ -93,8 +93,8 @@ void AdoDriverTest::test_metadata() } const Any catalog; - static const OUStringLiteral schemaPattern = u"%"; - static const OUStringLiteral tableNamePattern = u"%"; + static constexpr OUStringLiteral schemaPattern = u"%"; + static constexpr OUStringLiteral tableNamePattern = u"%"; const Sequence< OUString > types; Reference< XResultSet > xResultSet = @@ -107,7 +107,7 @@ void AdoDriverTest::test_metadata() void AdoDriverTest::test_select_default_all() { - static const OUStringLiteral sql = u"select \"FirstName\" from \"Students\" ORDER BY \"FirstName\""; + static constexpr OUStringLiteral sql = u"select \"FirstName\" from \"Students\" ORDER BY \"FirstName\""; Reference< XPreparedStatement > xStatement = m_xConnection->prepareStatement(sql); if (!xStatement.is()) { diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index b6ab062c94dc..1e66826e80b6 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -389,7 +389,7 @@ static SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet, // build a connection with its current settings (4. data source name, or 5. URL) - static const OUStringLiteral sUserProp( u"User" ); + static constexpr OUStringLiteral sUserProp( u"User" ); OUString sDataSourceName; xRowSetProps->getPropertyValue("DataSourceName") >>= sDataSourceName; OUString sURL; diff --git a/connectivity/source/commontools/formattedcolumnvalue.cxx b/connectivity/source/commontools/formattedcolumnvalue.cxx index b13637a97a67..621bc9acf59b 100644 --- a/connectivity/source/commontools/formattedcolumnvalue.cxx +++ b/connectivity/source/commontools/formattedcolumnvalue.cxx @@ -147,7 +147,7 @@ namespace dbtools // get the format key of our bound field Reference< XPropertySetInfo > xPSI( _rxColumn->getPropertySetInfo(), UNO_SET_THROW ); bool bHaveFieldFormat = false; - static const OUStringLiteral sFormatKeyProperty( u"FormatKey" ); + static constexpr OUStringLiteral sFormatKeyProperty( u"FormatKey" ); if ( xPSI->hasPropertyByName( sFormatKeyProperty ) ) { bHaveFieldFormat = ( _rxColumn->getPropertyValue( sFormatKeyProperty ) >>= _rData.m_nFormatKey ); diff --git a/connectivity/source/commontools/statementcomposer.cxx b/connectivity/source/commontools/statementcomposer.cxx index eb199c50641d..c7113b2f179f 100644 --- a/connectivity/source/commontools/statementcomposer.cxx +++ b/connectivity/source/commontools/statementcomposer.cxx @@ -166,7 +166,7 @@ namespace dbtools xComposer->setElementaryQuery( sStatement ); // the sort order - static const OUStringLiteral sPropOrder( u"Order" ); + static constexpr OUStringLiteral sPropOrder( u"Order" ); if ( ::comphelper::hasProperty( sPropOrder, xQuery ) ) { OUString sOrder; @@ -176,7 +176,7 @@ namespace dbtools // the filter bool bApplyFilter = true; - static const OUStringLiteral sPropApply( u"ApplyFilter" ); + static constexpr OUStringLiteral sPropApply( u"ApplyFilter" ); if ( ::comphelper::hasProperty( sPropApply, xQuery ) ) { OSL_VERIFY( xQuery->getPropertyValue( sPropApply ) >>= bApplyFilter ); diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx index 4589a636d951..4585629a877c 100644 --- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx +++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx @@ -1074,7 +1074,7 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables( // check if any type is given // when no types are given then we have to return all tables e.g. TABLE - static const OUStringLiteral aTable(u"TABLE"); + static constexpr OUStringLiteral aTable(u"TABLE"); bool bTableFound = true; sal_Int32 nLength = types.getLength(); diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx index 200d9f4bd3fe..5b69086b3934 100644 --- a/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -243,7 +243,7 @@ namespace connectivity OUString sMessage; try { - static const OUStringLiteral sProperties( u"properties" ); + static constexpr OUStringLiteral sProperties( u"properties" ); if ( !bIsNewDatabase && xStorage->isStreamElement(sProperties) ) { Reference<XStream > xStream = xStorage->openStreamElement(sProperties,ElementModes::READ); @@ -297,7 +297,7 @@ namespace connectivity // // hsqldb 2.6.0 release notes have: added system role SCRIPT_OPS for export / import of database structure and data // which seems to provide a builtin way to do this with contemporary hsqldb - static const OUStringLiteral sScript(u"script"); + static constexpr OUStringLiteral sScript(u"script"); if (!bIsNewDatabase && xStorage->isStreamElement(sScript)) { Reference<XStream > xStream = xStorage->openStreamElement(sScript, ElementModes::READ); diff --git a/cpputools/source/unoexe/unoexe.cxx b/cpputools/source/unoexe/unoexe.cxx index d4c51e2f40c3..9f2e233cdd7b 100644 --- a/cpputools/source/unoexe/unoexe.cxx +++ b/cpputools/source/unoexe/unoexe.cxx @@ -90,7 +90,7 @@ const char arUsingText[] = static bool readOption( OUString * pValue, const char * pOpt, sal_uInt32 * pnIndex, const OUString & aArg) { - static const OUStringLiteral dash(u"-"); + static constexpr OUStringLiteral dash(u"-"); if(!aArg.startsWith(dash)) return false; diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx index 04b50b44e309..96b61a7e2806 100644 --- a/cui/source/dialogs/hlmarkwn.cxx +++ b/cui/source/dialogs/hlmarkwn.cxx @@ -293,9 +293,9 @@ int SvxHlinkDlgMarkWnd::FillTree( const uno::Reference< container::XNameAccess > const sal_Int32 nLinks = aNames.getLength(); const OUString* pNames = aNames.getConstArray(); - static const OUStringLiteral aProp_LinkDisplayName( u"LinkDisplayName" ); - static const OUStringLiteral aProp_LinkTarget( u"com.sun.star.document.LinkTarget" ); - static const OUStringLiteral aProp_LinkDisplayBitmap( u"LinkDisplayBitmap" ); + static constexpr OUStringLiteral aProp_LinkDisplayName( u"LinkDisplayName" ); + static constexpr OUStringLiteral aProp_LinkTarget( u"com.sun.star.document.LinkTarget" ); + static constexpr OUStringLiteral aProp_LinkDisplayBitmap( u"LinkDisplayBitmap" ); for( sal_Int32 i = 0; i < nLinks; i++ ) { uno::Any aAny; diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index 79cb8d454e39..ae7414c5b5e5 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -3010,7 +3010,7 @@ bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet ) void SvxCharPositionPage::FillUserData() { - static const OUStringLiteral cTok( u";" ); + static constexpr OUStringLiteral cTok( u";" ); OUString sUser = OUString::number( m_nSuperEsc ) + cTok + OUString::number( m_nSubEsc ) + cTok + diff --git a/dbaccess/qa/extras/dialog-save.cxx b/dbaccess/qa/extras/dialog-save.cxx index 71bf28868891..4b07eebff459 100644 --- a/dbaccess/qa/extras/dialog-save.cxx +++ b/dbaccess/qa/extras/dialog-save.cxx @@ -56,7 +56,7 @@ void DialogSaveTest::test() uno::Reference< script::XStorageBasedLibraryContainer > xStorDlgLib(xDocScr->getDialogLibraries()); CPPUNIT_ASSERT(xStorDlgLib.is()); uno::Reference< script::XLibraryContainer > xDlgLib(xStorDlgLib, UNO_QUERY_THROW); - static const OUStringLiteral sStandard(u"Standard"); + static constexpr OUStringLiteral sStandard(u"Standard"); xBasLib->loadLibrary(sStandard); CPPUNIT_ASSERT(xBasLib->isLibraryLoaded(sStandard)); // the whole point of this test is to test the "save" operation diff --git a/dbaccess/qa/extras/empty-stdlib-save.cxx b/dbaccess/qa/extras/empty-stdlib-save.cxx index ae9a9234dca9..41074d909c89 100644 --- a/dbaccess/qa/extras/empty-stdlib-save.cxx +++ b/dbaccess/qa/extras/empty-stdlib-save.cxx @@ -54,7 +54,7 @@ void DialogSaveTest::test() uno::Reference< script::XStorageBasedLibraryContainer > xStorDlgLib(xDocScr->getDialogLibraries()); CPPUNIT_ASSERT(xStorDlgLib.is()); uno::Reference< script::XLibraryContainer > xDlgLib(xStorDlgLib, UNO_QUERY_THROW); - static const OUStringLiteral sStandard(u"Standard"); + static constexpr OUStringLiteral sStandard(u"Standard"); xBasLib->loadLibrary(sStandard); xDlgLib->loadLibrary(sStandard); CPPUNIT_ASSERT(xBasLib->isLibraryLoaded(sStandard)); diff --git a/dbaccess/qa/extras/nolib-save.cxx b/dbaccess/qa/extras/nolib-save.cxx index f5e83769c645..054ad9a369ca 100644 --- a/dbaccess/qa/extras/nolib-save.cxx +++ b/dbaccess/qa/extras/nolib-save.cxx @@ -54,7 +54,7 @@ void DialogSaveTest::test() uno::Reference< script::XStorageBasedLibraryContainer > xStorDlgLib(xDocScr->getDialogLibraries()); CPPUNIT_ASSERT(xStorDlgLib.is()); uno::Reference< script::XLibraryContainer > xDlgLib(xStorDlgLib, UNO_QUERY_THROW); - static const OUStringLiteral sStandard(u"Standard"); + static constexpr OUStringLiteral sStandard(u"Standard"); xBasLib->loadLibrary(sStandard); xDlgLib->loadLibrary(sStandard); CPPUNIT_ASSERT(xBasLib->isLibraryLoaded(sStandard)); diff --git a/dbaccess/source/core/api/FilteredContainer.cxx b/dbaccess/source/core/api/FilteredContainer.cxx index c6944375082b..1a565103d710 100644 --- a/dbaccess/source/core/api/FilteredContainer.cxx +++ b/dbaccess/source/core/api/FilteredContainer.cxx @@ -430,9 +430,9 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std:: OSL_VERIFY( aFilterModeSetting >>= nFilterMode ); } - static const OUStringLiteral sAll( u"%" ); - static const OUStringLiteral sView( u"VIEW" ); - static const OUStringLiteral sTable( u"TABLE" ); + static constexpr OUStringLiteral sAll( u"%" ); + static constexpr OUStringLiteral sView( u"VIEW" ); + static constexpr OUStringLiteral sTable( u"TABLE" ); switch ( nFilterMode ) { diff --git a/dbaccess/source/core/recovery/subcomponentrecovery.cxx b/dbaccess/source/core/recovery/subcomponentrecovery.cxx index f51ff855b3a8..ec5783ded992 100644 --- a/dbaccess/source/core/recovery/subcomponentrecovery.cxx +++ b/dbaccess/source/core/recovery/subcomponentrecovery.cxx @@ -478,7 +478,7 @@ namespace dbaccess StorageXMLOutputStream aDesignOutput( m_rContext, i_rObjectStorage, sSettingsStreamName ); SettingsExportContext aSettingsExportContext( m_rContext, aDesignOutput ); - static const OUStringLiteral sWhitespace( u" " ); + static constexpr OUStringLiteral sWhitespace( u" " ); aDesignOutput.startElement( "office:settings" ); aDesignOutput.ignorableWhitespace( sWhitespace ); diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index 47b71fc82140..5bbee1c4ccd1 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -561,7 +561,7 @@ void ODBExport::exportConnectionData() Reference< XPropertySetInfo > xSettingsInfo( xDataSourceSettings->getPropertySetInfo(), UNO_SET_THROW ); - static const OUStringLiteral sPropertyName = u"LocalSocket"; + static constexpr OUStringLiteral sPropertyName = u"LocalSocket"; if ( xSettingsInfo->hasPropertyByName( sPropertyName ) ) { OUString sPropertyValue; diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index 0ce7a06afdb4..88f95d9832db 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -664,7 +664,7 @@ void ODbDataSourceAdministrationHelper::translateProperties(const SfxItemSet& _r try { xInfo = _rxDest->getPropertySetInfo(); } catch(Exception&) { } - static const OUStringLiteral sUrlProp(u"URL"); + static constexpr OUStringLiteral sUrlProp(u"URL"); // transfer the direct properties for (auto const& elem : m_aDirectPropTranslator) { diff --git a/dbaccess/source/ui/dlg/queryorder.cxx b/dbaccess/source/ui/dlg/queryorder.cxx index 53e10f4fd3db..1bad7a802fce 100644 --- a/dbaccess/source/ui/dlg/queryorder.cxx +++ b/dbaccess/source/ui/dlg/queryorder.cxx @@ -126,8 +126,8 @@ void DlgOrderCrit::impl_initializeOrderList_nothrow() { try { - static const OUStringLiteral sNameProperty = u"Name"; - static const OUStringLiteral sAscendingProperty = u"IsAscending"; + static constexpr OUStringLiteral sNameProperty = u"Name"; + static constexpr OUStringLiteral sAscendingProperty = u"IsAscending"; Reference< XIndexAccess > xOrderColumns( m_xQueryComposer->getOrderColumns(), UNO_SET_THROW ); sal_Int32 nColumns = xOrderColumns->getCount(); diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx index ae6b9030f17f..59a2aa771b32 100644 --- a/desktop/source/app/crashreport.cxx +++ b/desktop/source/app/crashreport.cxx @@ -135,8 +135,8 @@ void CrashReporter::writeCommonInfo() ucbhelper::InternetProxyDecider proxy_decider(::comphelper::getProcessComponentContext()); - static const OUStringLiteral protocol = u"https"; - static const OUStringLiteral url = u"crashreport.libreoffice.org"; + static constexpr OUStringLiteral protocol = u"https"; + static constexpr OUStringLiteral url = u"crashreport.libreoffice.org"; const sal_Int32 port = 443; const ucbhelper::InternetProxyServer proxy_server = proxy_decider.getProxy(protocol, url, port); diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index 9e1a75fb93fb..888f35262f3d 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -421,7 +421,7 @@ void BackendImpl::implProcessHelp( &langFolderContent, langFolderDest, xCmdEnv); - static const OUStringLiteral aHelpStr(u"help"); + static constexpr OUStringLiteral aHelpStr(u"help"); OUString aJarFile( makeURL(sHelpFolder, langFolderURLSegment + "/" + aHelpStr + ".jar")); diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index 0eb02321a74f..c27f5174045a 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -1057,9 +1057,9 @@ void BackendImpl::PackageImpl::exportTo( manifest.reserve( bundle.getLength() ); sal_Int32 baseURLlen = m_url_expanded.getLength(); Reference<deployment::XPackage> const *pbundle = bundle.getConstArray(); - static const OUStringLiteral strMediaType( u"MediaType" ); - static const OUStringLiteral strFullPath( u"FullPath" ); - static const OUStringLiteral strIsFolder( u"IsFolder" ); + static constexpr OUStringLiteral strMediaType( u"MediaType" ); + static constexpr OUStringLiteral strFullPath( u"FullPath" ); + static constexpr OUStringLiteral strIsFolder( u"IsFolder" ); for ( sal_Int32 pos = bundle.getLength(); pos--; ) { Reference<deployment::XPackage> const & xPackage = pbundle[ pos ]; diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 52cd5411a7e5..102028689451 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -5945,7 +5945,7 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand) { boost::property_tree::ptree aChild; boost::property_tree::ptree aChildren; - static const OUStringLiteral sPageStyles(u"PageStyles"); + static constexpr OUStringLiteral sPageStyles(u"PageStyles"); uno::Reference<beans::XPropertySet> xProperty; uno::Reference<container::XNameContainer> xContainer; diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index 273dd5e3def6..3b60cd771c75 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -190,8 +190,8 @@ bool MigrationImpl::doMigration() copyFiles(); - static const OUStringLiteral sMenubarResourceURL(u"private:resource/menubar/menubar"); - static const OUStringLiteral sToolbarResourcePre(u"private:resource/toolbar/"); + static constexpr OUStringLiteral sMenubarResourceURL(u"private:resource/menubar/menubar"); + static constexpr OUStringLiteral sToolbarResourcePre(u"private:resource/toolbar/"); for (MigrationModuleInfo & i : vModulesInfo) { OUString sModuleIdentifier = mapModuleShortNameToIdentifier(i.sModuleShortName); if (sModuleIdentifier.isEmpty()) @@ -307,8 +307,8 @@ void MigrationImpl::readAvailableMigrations(migrations_available& rAvailableMigr uno::Reference< XNameAccess > aMigrationAccess(getConfigAccess("org.openoffice.Setup/Migration/SupportedVersions"), uno::UNO_SET_THROW); const uno::Sequence< OUString > seqSupportedVersions = aMigrationAccess->getElementNames(); - static const OUStringLiteral aVersionIdentifiers( u"VersionIdentifiers" ); - static const OUStringLiteral aPriorityIdentifier( u"Priority" ); + static constexpr OUStringLiteral aVersionIdentifiers( u"VersionIdentifiers" ); + static constexpr OUStringLiteral aPriorityIdentifier( u"Priority" ); for (OUString const & supportedVersion :seqSupportedVersions) { sal_Int32 nPriority( 0 ); @@ -905,8 +905,8 @@ void MigrationImpl::runServices() std::vector< MigrationModuleInfo > MigrationImpl::detectUIChangesForAllModules() const { std::vector< MigrationModuleInfo > vModulesInfo; - static const OUStringLiteral MENUBAR(u"menubar"); - static const OUStringLiteral TOOLBAR(u"toolbar"); + static constexpr OUStringLiteral MENUBAR(u"menubar"); + static constexpr OUStringLiteral TOOLBAR(u"toolbar"); uno::Sequence< uno::Any > lArgs {uno::Any(m_aInfo.userdata + "/user/config/soffice.cfg/modules"), uno::Any(embed::ElementModes::READ)}; @@ -966,7 +966,7 @@ void MigrationImpl::compareOldAndNewConfig(const OUString& sParent, const uno::Reference< container::XIndexContainer >& xIndexNew, const OUString& sResourceURL) { - static const OUStringLiteral MENU_SEPARATOR(u" | "); + static constexpr OUStringLiteral MENU_SEPARATOR(u" | "); std::vector< MigrationItem > vOldItems; std::vector< MigrationItem > vNewItems; @@ -1176,8 +1176,8 @@ void NewVersionUIInfo::init(const std::vector< MigrationModuleInfo >& vModulesIn m_lNewVersionToolbarSettingsSeq.realloc(vModulesInfo.size()); auto p_lNewVersionToolbarSettingsSeq = m_lNewVersionToolbarSettingsSeq.getArray(); - static const OUStringLiteral sMenubarResourceURL(u"private:resource/menubar/menubar"); - static const OUStringLiteral sToolbarResourcePre(u"private:resource/toolbar/"); + static constexpr OUStringLiteral sMenubarResourceURL(u"private:resource/menubar/menubar"); + static constexpr OUStringLiteral sToolbarResourcePre(u"private:resource/toolbar/"); uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier = ui::theModuleUIConfigurationManagerSupplier::get( ::comphelper::getProcessComponentContext() ); diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 794f8085f9c8..39ffdf05e318 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -1083,7 +1083,7 @@ void VclMetafileProcessor2D::processControlPrimitive2D( uno::Reference<beans::XPropertySetInfo> xPropertyInfo( xModelProperties.is() ? xModelProperties->getPropertySetInfo() : uno::Reference<beans::XPropertySetInfo>()); - static const OUStringLiteral sPrintablePropertyName(u"Printable"); + static constexpr OUStringLiteral sPrintablePropertyName(u"Printable"); if (xPropertyInfo.is() && xPropertyInfo->hasPropertyByName(sPrintablePropertyName)) { diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx index c0935283fbda..b8b5676099f1 100644 --- a/editeng/source/misc/unolingu.cxx +++ b/editeng/source/misc/unolingu.cxx @@ -633,7 +633,7 @@ uno::Reference< XDictionary > LinguMgr::GetStandard() if (!xTmpDicList.is()) return nullptr; - static const OUStringLiteral aDicName( u"standard.dic" ); + static constexpr OUStringLiteral aDicName( u"standard.dic" ); uno::Reference< XDictionary > xDic = xTmpDicList->getDictionaryByName( aDicName ); if (!xDic.is()) { diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx index 40278457081f..444a435c3d5b 100644 --- a/editeng/source/xml/xmltxtexp.cxx +++ b/editeng/source/xml/xmltxtexp.cxx @@ -304,7 +304,7 @@ void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& uno::Reference<io::XOutputStream> xOut( new utl::OOutputStreamWrapper( rStream ) ); /* testcode - static const OUStringLiteral aURL( u"file:///e:/test.xml" ); + static constexpr OUStringLiteral aURL( u"file:///e:/test.xml" ); SvFileStream aStream(aURL, StreamMode::WRITE | StreamMode::TRUNC); xOut = new utl::OOutputStreamWrapper(aStream); */ diff --git a/editeng/source/xml/xmltxtimp.cxx b/editeng/source/xml/xmltxtimp.cxx index d04e37a822bf..c752a0eb70c5 100644 --- a/editeng/source/xml/xmltxtimp.cxx +++ b/editeng/source/xml/xmltxtimp.cxx @@ -169,7 +169,7 @@ EditPaM SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection uno::Reference<io::XInputStream> xInputStream = new utl::OInputStreamWrapper( rStream ); /* testcode - static const OUStringLiteral aURL( u"file:///e:/test.xml" ); + static constexpr OUStringLiteral aURL( u"file:///e:/test.xml" ); SfxMedium aMedium( aURL, StreamMode::READ | STREAM_NOCREATE, sal_True ); uno::Reference<io::XOutputStream> xOut( new utl::OOutputStreamWrapper( *aMedium.GetOutStream() ) ); diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index 1ccd15884318..2fdc6af47d08 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -177,7 +177,7 @@ static void TransferMediaType( const uno::Reference< embed::XStorage >& i_rSourc { const uno::Reference< beans::XPropertySet > xSourceProps( i_rSource, uno::UNO_QUERY_THROW ); const uno::Reference< beans::XPropertySet > xTargetProps( i_rTarget, uno::UNO_QUERY_THROW ); - static const OUStringLiteral sMediaTypePropName( u"MediaType" ); + static constexpr OUStringLiteral sMediaTypePropName( u"MediaType" ); xTargetProps->setPropertyValue( sMediaTypePropName, xSourceProps->getPropertyValue( sMediaTypePropName ) ); } catch( const uno::Exception& ) diff --git a/extensions/source/abpilot/fieldmappingimpl.cxx b/extensions/source/abpilot/fieldmappingimpl.cxx index 64197737150e..0b747ecb89ae 100644 --- a/extensions/source/abpilot/fieldmappingimpl.cxx +++ b/extensions/source/abpilot/fieldmappingimpl.cxx @@ -219,8 +219,8 @@ namespace abp const OUString* pExistentFields = aExistentFields.getConstArray(); const OUString* pExistentFieldsEnd = pExistentFields + aExistentFields.getLength(); - static const OUStringLiteral sProgrammaticNodeName( u"ProgrammaticFieldName" ); - static const OUStringLiteral sAssignedNodeName( u"AssignedFieldName" ); + static constexpr OUStringLiteral sProgrammaticNodeName( u"ProgrammaticFieldName" ); + static constexpr OUStringLiteral sAssignedNodeName( u"AssignedFieldName" ); for ( ; pExistentFields != pExistentFieldsEnd; ++pExistentFields ) { diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 1f74c795d3f9..f4502fbdfa32 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -599,7 +599,7 @@ void EscherPropertyContainer::CreateFillProperties( uno::Any aAny; AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapNone ); AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle ); - static const OUStringLiteral aPropName( u"FillStyle" ); + static constexpr OUStringLiteral aPropName( u"FillStyle" ); if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, aPropName ) ) @@ -2597,14 +2597,14 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT if ( !(aGeoPropSet >>= aGeoPropSeq) ) return; - static const OUStringLiteral sViewBox ( u"ViewBox" ); - static const OUStringLiteral sTextRotateAngle ( u"TextRotateAngle" ); - static const OUStringLiteral sExtrusion ( u"Extrusion" ); - static const OUStringLiteral sEquations ( u"Equations" ); - static const OUStringLiteral sPath ( u"Path" ); - static const OUStringLiteral sTextPath ( u"TextPath" ); - static const OUStringLiteral sHandles ( u"Handles" ); - static const OUStringLiteral sAdjustmentValues ( u"AdjustmentValues" ); + static constexpr OUStringLiteral sViewBox ( u"ViewBox" ); + static constexpr OUStringLiteral sTextRotateAngle ( u"TextRotateAngle" ); + static constexpr OUStringLiteral sExtrusion ( u"Extrusion" ); + static constexpr OUStringLiteral sEquations ( u"Equations" ); + static constexpr OUStringLiteral sPath ( u"Path" ); + static constexpr OUStringLiteral sTextPath ( u"TextPath" ); + static constexpr OUStringLiteral sHandles ( u"Handles" ); + static constexpr OUStringLiteral sAdjustmentValues ( u"AdjustmentValues" ); bool bAdjustmentValuesProp = false; uno::Any aAdjustmentValuesProp; diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 1b4d214035fe..8d6f9023ad16 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -614,7 +614,7 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver ) { const SfxPoolItem& aCustomShape = static_cast<SdrObjCustomShape*>(pO)->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ); SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(aCustomShape) ); - static const OUStringLiteral sPath( u"Path" ); + static constexpr OUStringLiteral sPath( u"Path" ); sal_Int16 nGluePointType = EnhancedCustomShapeGluePointType::SEGMENTS; css::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sPath, "GluePointType" ); if ( pAny ) @@ -736,7 +736,7 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver ) sal_Int32 nX = 0, nY = 0; if ( ( rPara.First.Value >>= nX ) && ( rPara.Second.Value >>= nY ) ) { - static const OUStringLiteral sGluePoints( u"GluePoints" ); + static constexpr OUStringLiteral sGluePoints( u"GluePoints" ); css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair > aGluePoints; pAny = aGeometryItem.GetPropertyValueByName( sPath, sGluePoints ); if ( pAny ) @@ -2822,7 +2822,7 @@ void DffPropertyReader::CheckAndCorrectExcelTextRotation( SvStream& rIn, SfxItem const css::uno::Any* pAny; SdrCustomShapeGeometryItem aGeometryItem(rSet.Get( SDRATTR_CUSTOMSHAPE_GEOMETRY )); - static const OUStringLiteral sTextRotateAngle( u"TextRotateAngle" ); + static constexpr OUStringLiteral sTextRotateAngle( u"TextRotateAngle" ); pAny = aGeometryItem.GetPropertyValueByName( sTextRotateAngle ); double fExtraTextRotateAngle = 0.0; if ( pAny ) @@ -4601,9 +4601,9 @@ rtl::Reference<SdrObject> SvxMSDffManager::ImportShape( const DffRecordHeader& r // applies only if importing arcs from MS Office. if ( aObjData.eShapeType == mso_sptArc ) { - static const OUStringLiteral sAdjustmentValues( u"AdjustmentValues" ); - static const OUStringLiteral sViewBox( u"ViewBox" ); - static const OUStringLiteral sPath( u"Path" ); + static constexpr OUStringLiteral sAdjustmentValues( u"AdjustmentValues" ); + static constexpr OUStringLiteral sViewBox( u"ViewBox" ); + static constexpr OUStringLiteral sPath( u"Path" ); SdrCustomShapeGeometryItem aGeometryItem( static_cast<SdrObjCustomShape*>(xRet.get())->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); PropertyValue aPropVal; diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index a29ff1afb777..eb43260d8a83 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -987,9 +987,9 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& } bool bExportNotesPages = false; bool bReChangeToNormalView = false; - static const OUStringLiteral sShowOnlineLayout( u"ShowOnlineLayout" ); + static constexpr OUStringLiteral sShowOnlineLayout( u"ShowOnlineLayout" ); bool bReHideWhitespace = false; - static const OUStringLiteral sHideWhitespace(u"HideWhitespace"); + static constexpr OUStringLiteral sHideWhitespace(u"HideWhitespace"); uno::Reference< beans::XPropertySet > xViewProperties; if ( aCreator == "Writer" ) diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 1826507bead8..00e78ce5c5f2 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -1164,8 +1164,8 @@ bool SVGTextWriter::nextTextPortion() Reference < XTextField > xTextField( xRangePropSet->getPropertyValue( "TextField" ), UNO_QUERY ); if( xTextField.is() ) { - static const OUStringLiteral sServicePrefix(u"com.sun.star.text.textfield."); - static const OUStringLiteral sPresentationServicePrefix(u"com.sun.star.presentation.TextField."); + static constexpr OUStringLiteral sServicePrefix(u"com.sun.star.text.textfield."); + static constexpr OUStringLiteral sPresentationServicePrefix(u"com.sun.star.presentation.TextField."); Reference< XServiceInfo > xService( xTextField, UNO_QUERY ); const Sequence< OUString > aServices = xService->getSupportedServiceNames(); @@ -1894,8 +1894,8 @@ tools::PolyPolygon& SVGActionWriter::ImplMap( const tools::PolyPolygon& rPolyPol OUString SVGActionWriter::GetPathString( const tools::PolyPolygon& rPolyPoly, bool bLine ) { OUStringBuffer aPathData; - static const OUStringLiteral aBlank( u" " ); - static const OUStringLiteral aComma( u"," ); + static constexpr OUStringLiteral aBlank( u" " ); + static constexpr OUStringLiteral aComma( u"," ); Point aPolyPoint; for( tools::Long i = 0, nCount = rPolyPoly.Count(); i < nCount; i++ ) diff --git a/filter/source/xsltdialog/typedetectionexport.cxx b/filter/source/xsltdialog/typedetectionexport.cxx index af367ec8a483..6fc2f26380d2 100644 --- a/filter/source/xsltdialog/typedetectionexport.cxx +++ b/filter/source/xsltdialog/typedetectionexport.cxx @@ -79,17 +79,17 @@ void TypeDetectionExporter::doExport( const Reference< XOutputStream >& xOS, co { try { - static const OUStringLiteral sComponentData ( u"oor:component-data" ); - static const OUStringLiteral sNode ( u"node" ); - static const OUStringLiteral sName ( u"oor:name" ); - static const OUStringLiteral sWhiteSpace ( u" " ); - static const OUStringLiteral sUIName ( u"UIName" ); - static const OUStringLiteral sComma ( u"," ); - static const OUStringLiteral sDelim ( u";" ); - static const OUStringLiteral sData ( u"Data" ); - static const OUStringLiteral sDocTypePrefix ( u"doctype:" ); - static const OUStringLiteral sFilterAdaptorService( u"com.sun.star.comp.Writer.XmlFilterAdaptor" ); - static const OUStringLiteral sXSLTFilterService ( u"com.sun.star.documentconversion.XSLTFilter" ); + static constexpr OUStringLiteral sComponentData ( u"oor:component-data" ); + static constexpr OUStringLiteral sNode ( u"node" ); + static constexpr OUStringLiteral sName ( u"oor:name" ); + static constexpr OUStringLiteral sWhiteSpace ( u" " ); + static constexpr OUStringLiteral sUIName ( u"UIName" ); + static constexpr OUStringLiteral sComma ( u"," ); + static constexpr OUStringLiteral sDelim ( u";" ); + static constexpr OUStringLiteral sData ( u"Data" ); + static constexpr OUStringLiteral sDocTypePrefix ( u"doctype:" ); + static constexpr OUStringLiteral sFilterAdaptorService( u"com.sun.star.comp.Writer.XmlFilterAdaptor" ); + static constexpr OUStringLiteral sXSLTFilterService ( u"com.sun.star.documentconversion.XSLTFilter" ); // set up sax writer and connect to given output stream @@ -206,9 +206,9 @@ void TypeDetectionExporter::addProperty( const Reference< XWriter >& xHandler, c { try { - static const OUStringLiteral sProp( u"prop" ); - static const OUStringLiteral sValue( u"value" ); - static const OUStringLiteral sWhiteSpace ( u" " ); + static constexpr OUStringLiteral sProp( u"prop" ); + static constexpr OUStringLiteral sValue( u"value" ); + static constexpr OUStringLiteral sWhiteSpace ( u" " ); rtl::Reference<::comphelper::AttributeList>pAttrList = new ::comphelper::AttributeList; pAttrList->AddAttribute ( "oor:name", rName ); @@ -233,9 +233,9 @@ void TypeDetectionExporter::addLocaleProperty( const Reference< XWriter >& xHand { try { - static const OUStringLiteral sProp( u"prop" ); - static const OUStringLiteral sValue( u"value" ); - static const OUStringLiteral sWhiteSpace ( u" " ); + static constexpr OUStringLiteral sProp( u"prop" ); + static constexpr OUStringLiteral sValue( u"value" ); + static constexpr OUStringLiteral sWhiteSpace ( u" " ); rtl::Reference<::comphelper::AttributeList> pAttrList = new ::comphelper::AttributeList; pAttrList->AddAttribute ( "oor:name", rName ); diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx index c14b96191be6..4aab958f934e 100644 --- a/forms/source/component/Columns.cxx +++ b/forms/source/component/Columns.cxx @@ -83,8 +83,8 @@ const css::uno::Sequence<OUString>& getColumnTypes() sal_Int32 getColumnTypeByModelName(const OUString& aModelName) { - static const OUStringLiteral aModelPrefix (u"com.sun.star.form.component."); - static const OUStringLiteral aCompatibleModelPrefix (u"stardiv.one.form.component."); + static constexpr OUStringLiteral aModelPrefix (u"com.sun.star.form.component."); + static constexpr OUStringLiteral aCompatibleModelPrefix (u"stardiv.one.form.component."); sal_Int32 nTypeId = -1; if (aModelName == FRM_COMPONENT_EDIT) diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 0536a87d411a..00685bc25d7f 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -236,7 +236,7 @@ namespace if ( xProviderProps.is() ) { Reference< XPropertySetInfo > xPropInfo = xProviderProps->getPropertySetInfo(); - static const OUStringLiteral sHomeDirPropertyName( u"HomeDirectory" ); + static constexpr OUStringLiteral sHomeDirPropertyName( u"HomeDirectory" ); if ( !xPropInfo.is() || xPropInfo->hasPropertyByName( sHomeDirPropertyName ) ) { OUString sHomeDirectory; diff --git a/fpicker/source/win32/workbench/Test_fps.cxx b/fpicker/source/win32/workbench/Test_fps.cxx index 899f208f1f61..010a79c3aa55 100644 --- a/fpicker/source/win32/workbench/Test_fps.cxx +++ b/fpicker/source/win32/workbench/Test_fps.cxx @@ -78,7 +78,7 @@ void TestFilterManager( Reference< XFilePicker > xFilePicker ); Reference< XMultiServiceFactory > g_xFactory; -static const OUStringLiteral BMP_EXTENSION( u"bmp" ); +static constexpr OUStringLiteral BMP_EXTENSION( u"bmp" ); // a test client diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index e07c826109a7..975b5bf11f7d 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -962,7 +962,7 @@ void XCUBasedAcceleratorConfiguration::impl_ts_load( bool bPreferred, const css: } const OUString sIsoLang = impl_ts_getLocale(); - static const OUStringLiteral sDefaultLocale(u"en-US"); + static constexpr OUStringLiteral sDefaultLocale(u"en-US"); css::uno::Reference< css::container::XNameAccess > xKey; css::uno::Reference< css::container::XNameAccess > xCommand; diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx index eb49e5778350..d35b9a34c69e 100644 --- a/framework/source/fwe/classes/addonsoptions.cxx +++ b/framework/source/fwe/classes/addonsoptions.cxx @@ -928,7 +928,7 @@ OUString AddonsOptions_Impl::GeneratePrefixURL() void AddonsOptions_Impl::ReadMenuMergeInstructions( MergeMenuInstructionContainer& aContainer ) { - static const OUStringLiteral aMenuMergeRootName( u"AddonUI/OfficeMenuBarMerging/" ); + static constexpr OUStringLiteral aMenuMergeRootName( u"AddonUI/OfficeMenuBarMerging/" ); Sequence< OUString > aAddonMergeNodesSeq = GetNodeNames( aMenuMergeRootName ); @@ -1000,7 +1000,7 @@ void AddonsOptions_Impl::ReadMergeMenuData( std::u16string_view aMergeAddonInstr void AddonsOptions_Impl::ReadToolbarMergeInstructions( ToolbarMergingInstructions& rCachedToolbarMergingInstructions ) { - static const OUStringLiteral aToolbarMergeRootName( u"AddonUI/OfficeToolbarMerging/" ); + static constexpr OUStringLiteral aToolbarMergeRootName( u"AddonUI/OfficeToolbarMerging/" ); Sequence< OUString > aAddonMergeNodesSeq = GetNodeNames( aToolbarMergeRootName ); sal_uInt32 nCount = aAddonMergeNodesSeq.getLength(); @@ -1072,7 +1072,7 @@ void AddonsOptions_Impl::ReadMergeToolbarData( std::u16string_view aMergeAddonIn void AddonsOptions_Impl::ReadNotebookBarMergeInstructions( NotebookBarMergingInstructions& rCachedNotebookBarMergingInstructions) { - static const OUStringLiteral aNotebookBarMergeRootName(u"AddonUI/OfficeNotebookBarMerging/"); + static constexpr OUStringLiteral aNotebookBarMergeRootName(u"AddonUI/OfficeNotebookBarMerging/"); Sequence<OUString> aAddonMergeNodesSeq = GetNodeNames(aNotebookBarMergeRootName); sal_uInt32 nCount = aAddonMergeNodesSeq.getLength(); @@ -1147,7 +1147,7 @@ void AddonsOptions_Impl::ReadMergeNotebookBarData( void AddonsOptions_Impl::ReadStatusbarMergeInstructions( MergeStatusbarInstructionContainer& aContainer ) { - static const OUStringLiteral aStatusbarMergeRootName( u"AddonUI/OfficeStatusbarMerging/" ); + static constexpr OUStringLiteral aStatusbarMergeRootName( u"AddonUI/OfficeStatusbarMerging/" ); Sequence< OUString > aAddonMergeNodesSeq = GetNodeNames( aStatusbarMergeRootName ); sal_uInt32 nCount = aAddonMergeNodesSeq.getLength(); diff --git a/framework/source/uielement/fontmenucontroller.cxx b/framework/source/uielement/fontmenucontroller.cxx index 6dec522a3869..0190053563e1 100644 --- a/framework/source/uielement/fontmenucontroller.cxx +++ b/framework/source/uielement/fontmenucontroller.cxx @@ -93,7 +93,7 @@ void FontMenuController::fillPopupMenu( const Sequence< OUString >& rFontNameSeq } sort(aVector.begin(), aVector.end(), lcl_I18nCompareString ); - static const OUStringLiteral aFontNameCommandPrefix( u".uno:CharFontName?CharFontName.FamilyName:string=" ); + static constexpr OUStringLiteral aFontNameCommandPrefix( u".uno:CharFontName?CharFontName.FamilyName:string=" ); const sal_Int16 nCount = static_cast<sal_Int16>(aVector.size()); for ( sal_Int16 i = 0; i < nCount; i++ ) { diff --git a/framework/source/uielement/fontsizemenucontroller.cxx b/framework/source/uielement/fontsizemenucontroller.cxx index bb81c23c284b..62d3ce3bec14 100644 --- a/framework/source/uielement/fontsizemenucontroller.cxx +++ b/framework/source/uielement/fontsizemenucontroller.cxx @@ -155,7 +155,7 @@ void FontSizeMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > co m_aHeightArray.clear(); sal_uInt16 nPos = 0; // Id is nPos+1 - static const OUStringLiteral aFontHeightCommand( u".uno:FontHeight?FontHeight.Height:float=" ); + static constexpr OUStringLiteral aFontHeightCommand( u".uno:FontHeight?FontHeight.Height:float=" ); // first insert font size names (for simplified/traditional chinese) FontSizeNames aFontSizeNames( Application::GetSettings().GetUILanguageTag().getLanguageType() ); diff --git a/framework/source/uielement/headermenucontroller.cxx b/framework/source/uielement/headermenucontroller.cxx index 7fc2259ef553..985fbd382627 100644 --- a/framework/source/uielement/headermenucontroller.cxx +++ b/framework/source/uielement/headermenucontroller.cxx @@ -97,8 +97,8 @@ void HeaderMenuController::fillPopupMenu( const Reference< css::frame::XModel >& aCmd = ".uno:InsertPageFooter"; aHeaderFooterIsOnStr = "FooterIsOn"; } - static const OUStringLiteral aIsPhysicalStr( u"IsPhysical" ); - static const OUStringLiteral aDisplayNameStr( u"DisplayName" ); + static constexpr OUStringLiteral aIsPhysicalStr( u"IsPhysical" ); + static constexpr OUStringLiteral aDisplayNameStr( u"DisplayName" ); try { diff --git a/framework/source/uielement/langselectionmenucontroller.cxx b/framework/source/uielement/langselectionmenucontroller.cxx index 4685afbea6a7..9a7ec12b5ccd 100644 --- a/framework/source/uielement/langselectionmenucontroller.cxx +++ b/framework/source/uielement/langselectionmenucontroller.cxx @@ -192,7 +192,7 @@ void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopup // the different menus purpose will be handled by the different string // for aCmd_Dialog and aCmd_Language sal_Int16 nItemId = 0; // in this control the item id is not important for executing the command - static const OUStringLiteral sAsterisk(u"*"); // multiple languages in current selection + static constexpr OUStringLiteral sAsterisk(u"*"); // multiple languages in current selection const OUString sNone( SvtLanguageTable::GetLanguageString( LANGUAGE_NONE )); for (auto const& langItem : aLangItems) { diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx b/framework/source/uielement/langselectionstatusbarcontroller.cxx index e620af612092..8ea7cb5eccc6 100644 --- a/framework/source/uielement/langselectionstatusbarcontroller.cxx +++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx @@ -134,7 +134,7 @@ void LangSelectionStatusbarController::LangMenu( // add first few entries to main menu sal_Int16 nItemId = static_cast< sal_Int16 >(MID_LANG_SEL_1); - static const OUStringLiteral sAsterisk(u"*"); // multiple languages in current selection + static constexpr OUStringLiteral sAsterisk(u"*"); // multiple languages in current selection const OUString sNone( SvtLanguageTable::GetLanguageString( LANGUAGE_NONE )); std::map< sal_Int16, OUString > aLangMap; for (auto const& langItem : aLangItems) diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx index 8a80d00c1861..1c0ebf629a79 100644 --- a/framework/source/uielement/macrosmenucontroller.cxx +++ b/framework/source/uielement/macrosmenucontroller.cxx @@ -119,9 +119,9 @@ void SAL_CALL MacrosMenuController::statusChanged( const FeatureStateEvent& ) void MacrosMenuController::addScriptItems(const Reference<css::awt::XPopupMenu>& rPopupMenu, sal_uInt16 startItemId) { - static const OUStringLiteral aCmdBase(u".uno:ScriptOrganizer?ScriptOrganizer.Language:string="); - static const OUStringLiteral ellipsis( u"..." ); - static const OUStringLiteral providerKey(u"com.sun.star.script.provider.ScriptProviderFor"); + static constexpr OUStringLiteral aCmdBase(u".uno:ScriptOrganizer?ScriptOrganizer.Language:string="); + static constexpr OUStringLiteral ellipsis( u"..." ); + static constexpr OUStringLiteral providerKey(u"com.sun.star.script.provider.ScriptProviderFor"); sal_uInt16 itemId = startItemId; Reference< XContentEnumerationAccess > xEnumAccess( m_xContext->getServiceManager(), UNO_QUERY_THROW ); Reference< XEnumeration > xEnum = xEnumAccess->createContentEnumeration ( "com.sun.star.script.provider.LanguageScriptProvider" ); diff --git a/framework/source/uielement/objectmenucontroller.cxx b/framework/source/uielement/objectmenucontroller.cxx index 653a02d60a17..9c86a091337f 100644 --- a/framework/source/uielement/objectmenucontroller.cxx +++ b/framework/source/uielement/objectmenucontroller.cxx @@ -85,7 +85,7 @@ void ObjectMenuController::fillPopupMenu( const Sequence< css::embed::VerbDescri resetPopupMenu( rPopupMenu ); - static const OUStringLiteral aVerbCommand( u".uno:ObjectMenue?VerbID:short=" ); + static constexpr OUStringLiteral aVerbCommand( u".uno:ObjectMenue?VerbID:short=" ); for ( sal_Int32 i = 0; i < rVerbCommandSeq.getLength(); i++ ) { const css::embed::VerbDescriptor& rVerb = pVerbCommandArray[i]; diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx index e630dda1cba3..75d13407ad93 100644 --- a/framework/source/uielement/recentfilesmenucontroller.cxx +++ b/framework/source/uielement/recentfilesmenucontroller.cxx @@ -448,7 +448,7 @@ void SAL_CALL RecentFilesMenuController::dispatch( if ( nQueryPart <= 0 ) return; - static const OUStringLiteral aEntryArgStr( u"entry=" ); + static constexpr OUStringLiteral aEntryArgStr( u"entry=" ); sal_Int32 nEntryArg = aURL.Complete.indexOf( aEntryArgStr, nQueryPart ); sal_Int32 nEntryPos = nEntryArg + aEntryArgStr.getLength(); if (( nEntryArg <= 0 ) || ( nEntryPos >= aURL.Complete.getLength() )) diff --git a/framework/source/uifactory/uicontrollerfactory.cxx b/framework/source/uifactory/uicontrollerfactory.cxx index 5f23900763de..fa7c76d61144 100644 --- a/framework/source/uifactory/uicontrollerfactory.cxx +++ b/framework/source/uifactory/uicontrollerfactory.cxx @@ -118,7 +118,7 @@ Reference< XInterface > SAL_CALL UIControllerFactory::createInstanceWithArgument const Sequence< Any >& Arguments, const Reference< XComponentContext >& ) { - static const OUStringLiteral aPropModuleName( u"ModuleIdentifier" ); + static constexpr OUStringLiteral aPropModuleName( u"ModuleIdentifier" ); OUString aPropName; PropertyValue aPropValue; diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx b/i18npool/source/breakiterator/breakiteratorImpl.cxx index 5402caa7a469..2b56d2726303 100644 --- a/i18npool/source/breakiterator/breakiteratorImpl.cxx +++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx @@ -623,7 +623,7 @@ BreakIteratorImpl::getLocaleSpecificBreakIterator(const Locale& rLocale) } } - OUStringLiteral under(u"_"); + static constexpr OUStringLiteral under(u"_"); sal_Int32 l = rLocale.Language.getLength(); sal_Int32 c = rLocale.Country.getLength(); diff --git a/i18npool/source/collator/chaptercollator.cxx b/i18npool/source/collator/chaptercollator.cxx index 729045ac59e0..06e2fcbc04cb 100644 --- a/i18npool/source/collator/chaptercollator.cxx +++ b/i18npool/source/collator/chaptercollator.cxx @@ -61,7 +61,7 @@ ChapterCollator::compareSubstring( const OUString& str1, sal_Int32 off1, sal_Int if( ans != 0 ) return ans; - static const OUStringLiteral aAddAllowed(u"?"); + static constexpr OUStringLiteral aAddAllowed(u"?"); ParseResult res1, res2; // since parseAnyToken does not take length as parameter, we have to copy // it to a temp. string. diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index 7bc4da873138..fa63ac0dc5c8 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -1837,35 +1837,35 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const of.writeInt(nbOfCalendars); of.writeAsciiString(";\n\n"); - of.writeAsciiString("static const OUStringLiteral nbOfDays = u\""); + of.writeAsciiString("static constexpr OUStringLiteral nbOfDays = u\""); for(i = 0; i < nbOfCalendars; i++) { of.writeAsciiString("\\x"); of.writeHexInt(nbOfDays[i]); } of.writeAsciiString("\";\n"); - of.writeAsciiString("static const OUStringLiteral nbOfMonths = u\""); + of.writeAsciiString("static constexpr OUStringLiteral nbOfMonths = u\""); for(i = 0; i < nbOfCalendars; i++) { of.writeAsciiString("\\x"); of.writeHexInt(nbOfMonths[i]); } of.writeAsciiString("\";\n"); - of.writeAsciiString("static const OUStringLiteral nbOfGenitiveMonths = u\""); + of.writeAsciiString("static constexpr OUStringLiteral nbOfGenitiveMonths = u\""); for(i = 0; i < nbOfCalendars; i++) { of.writeAsciiString("\\x"); of.writeHexInt(nbOfGenitiveMonths[i]); } of.writeAsciiString("\";\n"); - of.writeAsciiString("static const OUStringLiteral nbOfPartitiveMonths = u\""); + of.writeAsciiString("static constexpr OUStringLiteral nbOfPartitiveMonths = u\""); for(i = 0; i < nbOfCalendars; i++) { of.writeAsciiString("\\x"); of.writeHexInt(nbOfPartitiveMonths[i]); } of.writeAsciiString("\";\n"); - of.writeAsciiString("static const OUStringLiteral nbOfEras = u\""); + of.writeAsciiString("static constexpr OUStringLiteral nbOfEras = u\""); for(i = 0; i < nbOfCalendars; i++) { of.writeAsciiString("\\x"); of.writeHexInt(nbOfEras[i]); diff --git a/i18nutil/source/utility/paper.cxx b/i18nutil/source/utility/paper.cxx index f6871e655f58..f88510c48afa 100644 --- a/i18nutil/source/utility/paper.cxx +++ b/i18nutil/source/utility/paper.cxx @@ -356,7 +356,7 @@ PaperInfo PaperInfo::getSystemDefaultPaper() if (aLocaleStr.isEmpty()) aLocaleStr = officecfg::System::L10N::Locale::get(); - static const OUStringLiteral EN_US = u"en-US"; + static constexpr OUStringLiteral EN_US = u"en-US"; if (aLocaleStr.isEmpty()) aLocaleStr = EN_US; diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx index 69e884257e33..ed415ca1e13a 100644 --- a/linguistic/source/lngsvcmgr.cxx +++ b/linguistic/source/lngsvcmgr.cxx @@ -710,10 +710,10 @@ void LngSvcMgr::UpdateAll() void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames ) { - static const OUStringLiteral aSpellCheckerList( u"ServiceManager/SpellCheckerList" ); - static const OUStringLiteral aGrammarCheckerList( u"ServiceManager/GrammarCheckerList" ); - static const OUStringLiteral aHyphenatorList( u"ServiceManager/HyphenatorList" ); - static const OUStringLiteral aThesaurusList( u"ServiceManager/ThesaurusList" ); + static constexpr OUStringLiteral aSpellCheckerList( u"ServiceManager/SpellCheckerList" ); + static constexpr OUStringLiteral aGrammarCheckerList( u"ServiceManager/GrammarCheckerList" ); + static constexpr OUStringLiteral aHyphenatorList( u"ServiceManager/HyphenatorList" ); + static constexpr OUStringLiteral aThesaurusList( u"ServiceManager/ThesaurusList" ); const uno::Sequence< OUString > aSpellCheckerListEntries( GetNodeNames( aSpellCheckerList ) ); const uno::Sequence< OUString > aGrammarCheckerListEntries( GetNodeNames( aGrammarCheckerList ) ); diff --git a/officecfg/registry/cppheader.xsl b/officecfg/registry/cppheader.xsl index 06d76c190425..78e3bb05a10e 100644 --- a/officecfg/registry/cppheader.xsl +++ b/officecfg/registry/cppheader.xsl @@ -129,7 +129,7 @@ <xsl:text>: public comphelper::ConfigurationGroup< </xsl:text> <xsl:value-of select="$name"/> <xsl:text>> {
</xsl:text> - <xsl:text> static OUString path() { static const OUStringLiteral PATH(<!-- + <xsl:text> static OUString path() { static constexpr OUStringLiteral PATH(<!-- -->u"</xsl:text> <xsl:value-of select="$path"/> <xsl:text>/</xsl:text> @@ -163,7 +163,7 @@ <xsl:text>: public comphelper::ConfigurationSet< </xsl:text> <xsl:value-of select="$name"/> <xsl:text>> {
</xsl:text> - <xsl:text> static OUString path() { static const OUStringLiteral PATH(<!-- + <xsl:text> static OUString path() { static constexpr OUStringLiteral PATH(<!-- -->u"</xsl:text> <xsl:value-of select="$path"/> <xsl:text>/</xsl:text> @@ -252,7 +252,7 @@ <xsl:text>> </xsl:text> </xsl:if> <xsl:text>> {
</xsl:text> - <xsl:text> static OUString path() { static const OUStringLiteral PATH(<!-- + <xsl:text> static OUString path() { static constexpr OUStringLiteral PATH(<!-- -->u"</xsl:text> <xsl:value-of select="$path"/> <xsl:text>/</xsl:text> diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx index cc00953685a0..105cb0660b7b 100644 --- a/oox/source/core/filterbase.cxx +++ b/oox/source/core/filterbase.cxx @@ -269,10 +269,10 @@ OUString FilterBase::getAbsoluteUrl( const OUString& rUrl ) const { // handle some special cases before calling ::rtl::Uri::convertRelToAbs() - static const OUStringLiteral aFileSchema = u"file:"; - static const OUStringLiteral aFilePrefix = u"file:///"; + static constexpr OUStringLiteral aFileSchema = u"file:"; + static constexpr OUStringLiteral aFilePrefix = u"file:///"; const sal_Int32 nFilePrefixLen = aFilePrefix.getLength(); - static const OUStringLiteral aUncPrefix = u"//"; + static constexpr OUStringLiteral aUncPrefix = u"//"; /* (1) convert all backslashes to slashes, and check that passed URL is not empty. */ diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx index 9cdbb4ee8801..ac6fba8e7d53 100644 --- a/oox/source/drawingml/customshapeproperties.cxx +++ b/oox/source/drawingml/customshapeproperties.cxx @@ -134,8 +134,8 @@ void CustomShapeProperties::pushToPropSet( if ( !maAdjustmentGuideList.empty() ) { - static const OUStringLiteral sCustomShapeGeometry(u"CustomShapeGeometry"); - static const OUStringLiteral sAdjustmentValues(u"AdjustmentValues"); + static constexpr OUStringLiteral sCustomShapeGeometry(u"CustomShapeGeometry"); + static constexpr OUStringLiteral sAdjustmentValues(u"AdjustmentValues"); uno::Any aGeoPropSet = xPropSet->getPropertyValue( sCustomShapeGeometry ); uno::Sequence< beans::PropertyValue > aGeoPropSeq; if ( aGeoPropSet >>= aGeoPropSeq ) diff --git a/oox/source/drawingml/fontworkhelpers.cxx b/oox/source/drawingml/fontworkhelpers.cxx index 3061230f9e5b..70c24ed5c3c8 100644 --- a/oox/source/drawingml/fontworkhelpers.cxx +++ b/oox/source/drawingml/fontworkhelpers.cxx @@ -155,9 +155,9 @@ void FontworkHelpers::putCustomShapeIntoTextPathMode( = comphelper::sequenceToContainer<std::vector<beans::PropertyValue>>(aGeomPropSeq); // Reset old properties - static const OUStringLiteral sTextPath(u"TextPath"); - static const OUStringLiteral sAdjustmentValues(u"AdjustmentValues"); - static const OUStringLiteral sPresetTextWarp(u"PresetTextWarp"); + static constexpr OUStringLiteral sTextPath(u"TextPath"); + static constexpr OUStringLiteral sAdjustmentValues(u"AdjustmentValues"); + static constexpr OUStringLiteral sPresetTextWarp(u"PresetTextWarp"); resetPropertyValueInVec(aGeomPropVec, u"CoordinateSize"); resetPropertyValueInVec(aGeomPropVec, u"Equations"); diff --git a/oox/source/drawingml/hyperlinkcontext.cxx b/oox/source/drawingml/hyperlinkcontext.cxx index 920d37609f8f..c4bc08b40c13 100644 --- a/oox/source/drawingml/hyperlinkcontext.cxx +++ b/oox/source/drawingml/hyperlinkcontext.cxx @@ -81,7 +81,7 @@ HyperLinkContext::HyperLinkContext( ContextHandler2Helper const & rParent, // ppaction://macro?name=MACRO_NAME // ppaction://program - static const OUStringLiteral sPPAction( u"ppaction://" ); + static constexpr OUStringLiteral sPPAction( u"ppaction://" ); if ( aAction.matchIgnoreAsciiCase( sPPAction ) ) { OUString aPPAct( aAction.copy( sPPAction.getLength() ) ); @@ -90,7 +90,7 @@ HyperLinkContext::HyperLinkContext( ContextHandler2Helper const & rParent, if ( aPPAction.match( "hlinkshowjump" ) ) { - static const OUStringLiteral sJump( u"jump=" ); + static constexpr OUStringLiteral sJump( u"jump=" ); if ( aPPAct.match( sJump, nIndex + 1 ) ) { std::u16string_view aDestination( aPPAct.subView( nIndex + 1 + sJump.getLength() ) ); diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index b9aebab1b31d..4c1492451dd4 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1413,7 +1413,7 @@ Reference< XShape > const & Shape::createAndInsert( if(mnRotation) { uno::Reference<beans::XPropertySet> xPropertySet(mxShape, uno::UNO_QUERY); - static const OUStringLiteral aGrabBagPropName = u"FrameInteropGrabBag"; + static constexpr OUStringLiteral aGrabBagPropName = u"FrameInteropGrabBag"; uno::Sequence<beans::PropertyValue> aGrabBag; xPropertySet->getPropertyValue(aGrabBagPropName) >>= aGrabBag; beans::PropertyValue aPair(comphelper::makePropertyValue("mso-rotation-angle", diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index b93dd01b69fb..dceb4ee706f8 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -646,7 +646,7 @@ static void lcl_AnalyzeHandles( const uno::Sequence<beans::PropertyValues> & rHa { for ( const Sequence< PropertyValue >& rPropSeq : rHandles ) { - static const OUStringLiteral sPosition( u"Position" ); + static constexpr OUStringLiteral sPosition( u"Position" ); bool bPosition = false; EnhancedCustomShapeParameterPair aPosition; for ( const PropertyValue& rPropVal: rPropSeq ) diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx index 7290fa1573a3..9b2bd48e5715 100644 --- a/oox/source/helper/propertymap.cxx +++ b/oox/source/helper/propertymap.cxx @@ -909,7 +909,7 @@ void PropertyMap::dumpCode( const Reference< XPropertySet >& rXPropSet ) { Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo (); const Sequence< Property > props = info->getProperties (); - static const OUStringLiteral sType = u"Type"; + static constexpr OUStringLiteral sType = u"Type"; for (const Property& rProp : props) { diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx index 217fc32fcf2e..dd9de50a2501 100644 --- a/oox/source/ole/vbacontrol.cxx +++ b/oox/source/ole/vbacontrol.cxx @@ -803,7 +803,7 @@ void VbaUserForm::importForm( const Reference< XNameContainer >& rxDialogLib, // scan for the line 'Begin {GUID} <FormName>' TextInputStream aFrameTextStrm( mxContext, aInStrm, eTextEnc ); - static const OUStringLiteral aBegin = u"Begin"; + static constexpr OUStringLiteral aBegin = u"Begin"; OUString aLine; bool bBeginFound = false; while( !bBeginFound && !aFrameTextStrm.isEof() ) diff --git a/oox/source/ole/vbaexport.cxx b/oox/source/ole/vbaexport.cxx index 5e0fc8ae2a71..c59895246a09 100644 --- a/oox/source/ole/vbaexport.cxx +++ b/oox/source/ole/vbaexport.cxx @@ -773,7 +773,7 @@ void exportDirStream(SvStream& rStrm, aDirStream.WriteUInt32(0x00000000); // reserved #if VBA_EXPORT_DEBUG - static const OUStringLiteral aDirFileName(u"/tmp/vba_dir_out.bin"); + static constexpr OUStringLiteral aDirFileName(u"/tmp/vba_dir_out.bin"); SvFileStream aDirStreamDebug(aDirFileName, StreamMode::READWRITE); aDirStream.Seek(0); aDirStreamDebug.WriteStream(aDirStream); diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index be7046c7498e..daa482eab94f 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -182,7 +182,7 @@ void PPTShape::addShape( if (sServiceName != "com.sun.star.drawing.GraphicObjectShape" && sServiceName != "com.sun.star.drawing.OLE2Shape") { - static const OUStringLiteral sOutlinerShapeService(u"com.sun.star.presentation.OutlinerShape"); + static constexpr OUStringLiteral sOutlinerShapeService(u"com.sun.star.presentation.OutlinerShape"); SAL_INFO("oox.ppt","has master: " << std::hex << rSlidePersist.getMasterPersist().get()); switch (mnSubType) { diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index cc972b80a8b0..9b52b92d97d0 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -194,7 +194,7 @@ void PresentationFragmentHandler::importCustomSlideShow(std::vector<CustomShow>& UNO_QUERY); if (xShow.is()) { - static const OUStringLiteral sSlide = u"slides/slide"; + static constexpr OUStringLiteral sSlide = u"slides/slide"; for (size_t j = 0; j < rCustomShowList[i].maSldLst.size(); ++j) { OUString sCustomSlide = rCustomShowList[i].maSldLst[j]; @@ -228,7 +228,7 @@ void PresentationFragmentHandler::saveThemeToGrabBag(const oox::drawingml::Theme { uno::Reference<beans::XPropertySetInfo> xPropsInfo = xDocProps->getPropertySetInfo(); - static const OUStringLiteral aGrabBagPropName = u"InteropGrabBag"; + static constexpr OUStringLiteral aGrabBagPropName = u"InteropGrabBag"; if (xPropsInfo.is() && xPropsInfo->hasPropertyByName(aGrabBagPropName)) { // get existing grab bag diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx index 0f7479e8ede9..7ea55ced1b96 100644 --- a/oox/source/ppt/slidepersist.cxx +++ b/oox/source/ppt/slidepersist.cxx @@ -241,10 +241,10 @@ void SlidePersist::applyTextStyles( const XmlFilterBase& rFilterBase ) OUString aStyle; OUString aFamily; - static const OUStringLiteral sOutline( u"outline1" ); - static const OUStringLiteral sTitle( u"title" ); - static const OUStringLiteral sStandard( u"standard" ); - static const OUStringLiteral sSubtitle( u"subtitle" ); + static constexpr OUStringLiteral sOutline( u"outline1" ); + static constexpr OUStringLiteral sTitle( u"title" ); + static constexpr OUStringLiteral sStandard( u"standard" ); + static constexpr OUStringLiteral sSubtitle( u"subtitle" ); for( int i = 0; i < 4; i++ ) // todo: aggregation of bodystyle (subtitle) { diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index bdbea0c86fc4..607ddf5354b4 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -312,7 +312,7 @@ void ShapeBase::finalizeFragmentImport() else { // Temporary fix, shapetype not found if referenced from different substream // FIXME: extend scope of ShapeContainer to store all shapetypes from the document - static const OUStringLiteral sShapeTypePrefix = u"shapetype_"; + static constexpr OUStringLiteral sShapeTypePrefix = u"shapetype_"; OUString tmp; if (aType.startsWith(sShapeTypePrefix)) { maTypeModel.moShapeType = o3tl::toInt32(aType.subView(sShapeTypePrefix.getLength())); diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx index 938a33526d3c..79948c9ff068 100644 --- a/package/source/manifest/ManifestExport.cxx +++ b/package/source/manifest/ManifestExport.cxx @@ -45,24 +45,24 @@ using namespace ::com::sun::star; ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > const & xHandler, const uno::Sequence< uno::Sequence < beans::PropertyValue > >& rManList ) { - static const OUStringLiteral sKeyInfo ( u"KeyInfo" ); - static const OUStringLiteral sPgpKeyIDProperty ( u"KeyId" ); - static const OUStringLiteral sPgpKeyPacketProperty ( u"KeyPacket" ); - static const OUStringLiteral sCipherValueProperty ( u"CipherValue" ); - static const OUStringLiteral sFullPathProperty ( u"FullPath" ); - static const OUStringLiteral sVersionProperty ( u"Version" ); - static const OUStringLiteral sMediaTypeProperty ( u"MediaType" ); - static const OUStringLiteral sIterationCountProperty ( u"IterationCount" ); - static const OUStringLiteral sDerivedKeySizeProperty ( u"DerivedKeySize" ); - static const OUStringLiteral sSaltProperty ( u"Salt" ); - static const OUStringLiteral sInitialisationVectorProperty( u"InitialisationVector" ); - static const OUStringLiteral sSizeProperty ( u"Size" ); - static const OUStringLiteral sDigestProperty ( u"Digest" ); - static const OUStringLiteral sEncryptionAlgProperty ( u"EncryptionAlgorithm" ); - static const OUStringLiteral sStartKeyAlgProperty ( u"StartKeyAlgorithm" ); - static const OUStringLiteral sDigestAlgProperty ( u"DigestAlgorithm" ); - - static const OUStringLiteral sWhiteSpace ( u" " ); + static constexpr OUStringLiteral sKeyInfo ( u"KeyInfo" ); + static constexpr OUStringLiteral sPgpKeyIDProperty ( u"KeyId" ); + static constexpr OUStringLiteral sPgpKeyPacketProperty ( u"KeyPacket" ); + static constexpr OUStringLiteral sCipherValueProperty ( u"CipherValue" ); + static constexpr OUStringLiteral sFullPathProperty ( u"FullPath" ); + static constexpr OUStringLiteral sVersionProperty ( u"Version" ); + static constexpr OUStringLiteral sMediaTypeProperty ( u"MediaType" ); + static constexpr OUStringLiteral sIterationCountProperty ( u"IterationCount" ); + static constexpr OUStringLiteral sDerivedKeySizeProperty ( u"DerivedKeySize" ); + static constexpr OUStringLiteral sSaltProperty ( u"Salt" ); + static constexpr OUStringLiteral sInitialisationVectorProperty( u"InitialisationVector" ); + static constexpr OUStringLiteral sSizeProperty ( u"Size" ); + static constexpr OUStringLiteral sDigestProperty ( u"Digest" ); + static constexpr OUStringLiteral sEncryptionAlgProperty ( u"EncryptionAlgorithm" ); + static constexpr OUStringLiteral sStartKeyAlgProperty ( u"StartKeyAlgorithm" ); + static constexpr OUStringLiteral sDigestAlgProperty ( u"DigestAlgorithm" ); + + static constexpr OUStringLiteral sWhiteSpace ( u" " ); const OUString sSHA256_URL_ODF12 ( SHA256_URL_ODF12 ); const OUString sSHA1_Name ( SHA1_NAME ); diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 9c841ec58bc6..1ba45654b73c 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -168,11 +168,11 @@ void ZipPackage::parseManifest() return; bool bManifestParsed = false; - static const OUStringLiteral sMeta (u"META-INF"); + static constexpr OUStringLiteral sMeta (u"META-INF"); if ( m_xRootFolder->hasByName( sMeta ) ) { try { - static const OUStringLiteral sManifest (u"manifest.xml"); + static constexpr OUStringLiteral sManifest (u"manifest.xml"); Any aAny = m_xRootFolder->getByName( sMeta ); uno::Reference< XNameContainer > xMetaInfFolder; aAny >>= xMetaInfFolder; @@ -185,19 +185,19 @@ void ZipPackage::parseManifest() { uno::Reference < XManifestReader > xReader = ManifestReader::create( m_xContext ); - static const OUStringLiteral sPropFullPath (u"FullPath"); - static const OUStringLiteral sPropVersion (u"Version"); - static const OUStringLiteral sPropMediaType (u"MediaType"); - static const OUStringLiteral sPropInitialisationVector (u"InitialisationVector"); - static const OUStringLiteral sPropSalt (u"Salt"); - static const OUStringLiteral sPropIterationCount (u"IterationCount"); - static const OUStringLiteral sPropSize (u"Size"); - static const OUStringLiteral sPropDigest (u"Digest"); - static const OUStringLiteral sPropDerivedKeySize (u"DerivedKeySize"); - static const OUStringLiteral sPropDigestAlgorithm (u"DigestAlgorithm"); - static const OUStringLiteral sPropEncryptionAlgorithm (u"EncryptionAlgorithm"); - static const OUStringLiteral sPropStartKeyAlgorithm (u"StartKeyAlgorithm"); - static const OUStringLiteral sKeyInfo (u"KeyInfo"); + static constexpr OUStringLiteral sPropFullPath (u"FullPath"); + static constexpr OUStringLiteral sPropVersion (u"Version"); + static constexpr OUStringLiteral sPropMediaType (u"MediaType"); + static constexpr OUStringLiteral sPropInitialisationVector (u"InitialisationVector"); + static constexpr OUStringLiteral sPropSalt (u"Salt"); + static constexpr OUStringLiteral sPropIterationCount (u"IterationCount"); + static constexpr OUStringLiteral sPropSize (u"Size"); + static constexpr OUStringLiteral sPropDigest (u"Digest"); + static constexpr OUStringLiteral sPropDerivedKeySize (u"DerivedKeySize"); + static constexpr OUStringLiteral sPropDigestAlgorithm (u"DigestAlgorithm"); + static constexpr OUStringLiteral sPropEncryptionAlgorithm (u"EncryptionAlgorithm"); + static constexpr OUStringLiteral sPropStartKeyAlgorithm (u"StartKeyAlgorithm"); + static constexpr OUStringLiteral sKeyInfo (u"KeyInfo"); const uno::Sequence < uno::Sequence < PropertyValue > > aManifestSequence = xReader->readManifestSequence ( xSink->getInputStream() ); const Any *pKeyInfo = nullptr; @@ -370,7 +370,7 @@ void ZipPackage::parseManifest() throw ZipIOException( THROW_WHERE "Could not parse manifest.xml" ); - static const OUStringLiteral sMimetype (u"mimetype"); + static constexpr OUStringLiteral sMimetype (u"mimetype"); if ( m_xRootFolder->hasByName( sMimetype ) ) { // get mediatype from the "mimetype" stream @@ -447,7 +447,7 @@ void ZipPackage::parseContentType() return; try { - static const OUStringLiteral aContentTypes(u"[Content_Types].xml"); + static constexpr OUStringLiteral aContentTypes(u"[Content_Types].xml"); // the content type must exist in OFOPXML format! if ( !m_xRootFolder->hasByName( aContentTypes ) ) throw io::IOException(THROW_WHERE "Wrong format!" ); @@ -1001,7 +1001,7 @@ uno::Reference< XInterface > SAL_CALL ZipPackage::createInstanceWithArguments( c void ZipPackage::WriteMimetypeMagicFile( ZipOutputStream& aZipOut ) { - static const OUStringLiteral sMime (u"mimetype"); + static constexpr OUStringLiteral sMime (u"mimetype"); if ( m_xRootFolder->hasByName( sMime ) ) m_xRootFolder->removeByName( sMime ); @@ -1214,7 +1214,7 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile() if ( m_xRootFolder->hasByName( sMeta ) ) { - static const OUStringLiteral sManifest (u"manifest.xml"); + static constexpr OUStringLiteral sManifest (u"manifest.xml"); uno::Reference< XNameContainer > xMetaInfFolder; Any aAny = m_xRootFolder->getByName( sMeta ); diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index 353216694f8a..6af3480d9e02 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -435,11 +435,11 @@ bool ZipPackageStream::saveChild( { bool bSuccess = true; - static const OUStringLiteral sDigestProperty (u"Digest"); - static const OUStringLiteral sEncryptionAlgProperty (u"EncryptionAlgorithm"); - static const OUStringLiteral sStartKeyAlgProperty (u"StartKeyAlgorithm"); - static const OUStringLiteral sDigestAlgProperty (u"DigestAlgorithm"); - static const OUStringLiteral sDerivedKeySizeProperty (u"DerivedKeySize"); + static constexpr OUStringLiteral sDigestProperty (u"Digest"); + static constexpr OUStringLiteral sEncryptionAlgProperty (u"EncryptionAlgorithm"); + static constexpr OUStringLiteral sStartKeyAlgProperty (u"StartKeyAlgorithm"); + static constexpr OUStringLiteral sDigestAlgProperty (u"DigestAlgorithm"); + static constexpr OUStringLiteral sDerivedKeySizeProperty (u"DerivedKeySize"); uno::Sequence < beans::PropertyValue > aPropSet (PKG_SIZE_NOENCR_MNFST); diff --git a/reportdesign/source/core/misc/conditionalexpression.cxx b/reportdesign/source/core/misc/conditionalexpression.cxx index a395a371f445..d913d0e132bc 100644 --- a/reportdesign/source/core/misc/conditionalexpression.cxx +++ b/reportdesign/source/core/misc/conditionalexpression.cxx @@ -74,8 +74,8 @@ namespace rptui OUString sMatchExpression( m_sPattern ); sMatchExpression = sMatchExpression.replaceAll(u"$$", _rFieldDataSource); - static const OUStringLiteral sLHSPattern( u"$1" ); - static const OUStringLiteral sRHSPattern( u"$2" ); + static constexpr OUStringLiteral sLHSPattern( u"$1" ); + static constexpr OUStringLiteral sRHSPattern( u"$2" ); sal_Int32 nLHSIndex( sMatchExpression.indexOf( sLHSPattern ) ); sal_Int32 nRHSIndex( sMatchExpression.indexOf( sRHSPattern ) ); diff --git a/reportdesign/source/core/sdr/formatnormalizer.cxx b/reportdesign/source/core/sdr/formatnormalizer.cxx index 44948b2dddaf..cf208f4465ce 100644 --- a/reportdesign/source/core/sdr/formatnormalizer.cxx +++ b/reportdesign/source/core/sdr/formatnormalizer.cxx @@ -219,7 +219,7 @@ namespace rptui return; OUString sDataField( _rxFormatted->getDataField() ); - static const OUStringLiteral sFieldPrefix( u"field:[" ); + static constexpr OUStringLiteral sFieldPrefix( u"field:[" ); if ( sDataField.indexOf( sFieldPrefix ) != 0 ) // not bound to a table field // TODO: we might also do this kind of thing for functions and expressions ... diff --git a/reportdesign/source/ui/inspection/DataProviderHandler.cxx b/reportdesign/source/ui/inspection/DataProviderHandler.cxx index 763f0e5077f9..c55f472b78cc 100644 --- a/reportdesign/source/ui/inspection/DataProviderHandler.cxx +++ b/reportdesign/source/ui/inspection/DataProviderHandler.cxx @@ -112,11 +112,11 @@ void SAL_CALL DataProviderHandler::inspect(const uno::Reference< uno::XInterface try { uno::Reference< container::XNameContainer > xNameCont(Component,uno::UNO_QUERY); - static const OUStringLiteral sFormComponent(u"FormComponent"); + static constexpr OUStringLiteral sFormComponent(u"FormComponent"); if ( xNameCont->hasByName(sFormComponent) ) { uno::Reference<beans::XPropertySet> xProp(xNameCont->getByName(sFormComponent),uno::UNO_QUERY); - static const OUStringLiteral sModel(u"Model"); + static constexpr OUStringLiteral sModel(u"Model"); if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(sModel) ) { m_xChartModel.set(xProp->getPropertyValue(sModel),uno::UNO_QUERY); diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx index e11ce4f7fe91..81065f0fe83e 100644 --- a/reportdesign/source/ui/inspection/GeometryHandler.cxx +++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx @@ -282,7 +282,7 @@ void SAL_CALL GeometryHandler::inspect( const uno::Reference< uno::XInterface > const uno::Reference< container::XNameContainer > xObjectAsContainer( _rxInspectee, uno::UNO_QUERY ); m_xReportComponent.set( xObjectAsContainer->getByName("ReportComponent"), uno::UNO_QUERY ); - static const OUStringLiteral sRowSet(u"RowSet"); + static constexpr OUStringLiteral sRowSet(u"RowSet"); if ( xObjectAsContainer->hasByName( sRowSet ) ) { const uno::Any aRowSet( xObjectAsContainer->getByName(sRowSet) ); @@ -2093,8 +2093,8 @@ void GeometryHandler::impl_createFunction(const OUString& _sFunctionName,std::u1 m_xFunction.set(report::Function::create(m_xContext)); m_xFunction->setName( _sFunctionName ); - static const OUStringLiteral sPlaceHolder1(u"%Column"); - static const OUStringLiteral sPlaceHolder2(u"%FunctionName"); + static constexpr OUStringLiteral sPlaceHolder1(u"%Column"); + static constexpr OUStringLiteral sPlaceHolder2(u"%FunctionName"); OUString sFormula(_aFunction.m_sFormula); sFormula = sFormula.replaceAll(sPlaceHolder1,_sDataField); sFormula = sFormula.replaceAll(sPlaceHolder2,_sFunctionName); diff --git a/reportdesign/source/ui/inspection/ReportComponentHandler.cxx b/reportdesign/source/ui/inspection/ReportComponentHandler.cxx index 7f84aeb5b11c..76dd1dfcf0d3 100644 --- a/reportdesign/source/ui/inspection/ReportComponentHandler.cxx +++ b/reportdesign/source/ui/inspection/ReportComponentHandler.cxx @@ -86,10 +86,10 @@ void SAL_CALL ReportComponentHandler::inspect(const uno::Reference< uno::XInterf try { uno::Reference< container::XNameContainer > xNameCont(Component,uno::UNO_QUERY); - static const OUStringLiteral sFormComponent(u"FormComponent"); + static constexpr OUStringLiteral sFormComponent(u"FormComponent"); if ( xNameCont->hasByName(sFormComponent) ) xNameCont->getByName(sFormComponent) >>= m_xFormComponent; - static const OUStringLiteral sRowSet(u"RowSet"); + static constexpr OUStringLiteral sRowSet(u"RowSet"); if ( xNameCont->hasByName(sRowSet) ) { uno::Reference<beans::XPropertySet> xProp(m_xFormComponentHandler,uno::UNO_QUERY); diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 781f4b1c80e6..cc3a096b3046 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -3990,7 +3990,7 @@ void OReportController::checkChartEnabled() ::utl::OConfigurationTreeRoot::createWithComponentContext( m_xContext, "/org.openoffice.Office.ReportDesign" ) ); bool bChartEnabled = false; - static const OUStringLiteral sPropertyName( u"UserData/Chart" ); + static constexpr OUStringLiteral sPropertyName( u"UserData/Chart" ); if ( aConfiguration.hasByHierarchicalName(sPropertyName) ) aConfiguration.getNodeValue( sPropertyName ) >>= bChartEnabled; m_bChartEnabled = bChartEnabled; diff --git a/sal/qa/rtl/process/rtl_Process.cxx b/sal/qa/rtl/process/rtl_Process.cxx index 5d4f3e5b52c0..346e31436dd4 100644 --- a/sal/qa/rtl/process/rtl_Process.cxx +++ b/sal/qa/rtl/process/rtl_Process.cxx @@ -69,9 +69,9 @@ public: void getAppCommandArg_001() { #if defined(_WIN32) - static const OUStringLiteral EXECUTABLE_NAME(u"child_process.exe"); + static constexpr OUStringLiteral EXECUTABLE_NAME(u"child_process.exe"); #else - static const OUStringLiteral EXECUTABLE_NAME(u"child_process"); + static constexpr OUStringLiteral EXECUTABLE_NAME(u"child_process"); #endif OUString suCWD = getModulePath(); // OUString suCWD2 = getExecutableDirectory(); @@ -198,9 +198,9 @@ public: void getGlobalProcessId_002() { #if defined(_WIN32) - static const OUStringLiteral EXEC_NAME(u"child_process_id.exe"); + static constexpr OUStringLiteral EXEC_NAME(u"child_process_id.exe"); #else - static const OUStringLiteral EXEC_NAME(u"child_process_id"); + static constexpr OUStringLiteral EXEC_NAME(u"child_process_id"); #endif sal_uInt8 pTargetUUID1[16]; rtl_getGlobalProcessId( pTargetUUID1 ); diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index b35266db5b03..5adf672a7915 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -269,9 +269,9 @@ CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf89920) CPPUNIT_TEST_FIXTURE(ScMacrosTest, testPasswordProtectedUnicodeString) { const OUString sCorrectString(u"English Русский 中文"); - static const OUStringLiteral sMacroURL( + static constexpr OUStringLiteral sMacroURL( u"vnd.sun.Star.script:Protected.Module1.TestUnicodeString?language=Basic&location=document"); - static const OUStringLiteral sLibName(u"Protected"); + static constexpr OUStringLiteral sLibName(u"Protected"); createScDoc("tdf57113.ods"); @@ -309,9 +309,9 @@ CPPUNIT_TEST_FIXTURE(ScMacrosTest, testPasswordProtectedUnicodeString) CPPUNIT_TEST_FIXTURE(ScMacrosTest, testPasswordProtectedArrayInUserType) { - static const OUStringLiteral sMacroURL( + static constexpr OUStringLiteral sMacroURL( u"vnd.sun.Star.script:Protected.Module1.TestMyType?language=Basic&location=document"); - static const OUStringLiteral sLibName(u"Protected"); + static constexpr OUStringLiteral sLibName(u"Protected"); createScDoc("ProtectedArrayInCustomType.ods"); diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx index b22eb2a3ed46..68752e6cab35 100644 --- a/sc/qa/unit/screenshots/screenshots.cxx +++ b/sc/qa/unit/screenshots/screenshots.cxx @@ -132,7 +132,7 @@ VclPtr<VclAbstractDialog> ScScreenshotTest::createDialogByID(sal_uInt32 nID) { VclPtr<VclAbstractDialog> pReturnDialog; ////FIXME: translatable string here - static const OUStringLiteral aDefaultSheetName(u"Sheet1"); + static constexpr OUStringLiteral aDefaultSheetName(u"Sheet1"); switch ( nID ) { diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index 64525457f894..5b51f8754f93 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -1911,8 +1911,8 @@ bool XclExpChSeries::ConvertDataSeries( Reference< XColorScheme > xColorScheme = xDiagram->getDefaultColorScheme(); if( xColorScheme.is() ) { - static const OUStringLiteral aFillStyleName = u"FillStyle"; - static const OUStringLiteral aColorName = u"Color"; + static constexpr OUStringLiteral aFillStyleName = u"FillStyle"; + static constexpr OUStringLiteral aColorName = u"Color"; namespace cssd = ::com::sun::star::drawing; for( sal_Int32 nPointIdx = 0; nPointIdx < nMaxPointCount; ++nPointIdx ) { diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index 07dea311bea7..6606390da375 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -1013,7 +1013,7 @@ void XclImpWebQuery::ReadWqtables( XclImpStream& rStrm ) OUString aTables( rStrm.ReadUniString() ); const sal_Unicode cSep = ';'; - static const OUStringLiteral aQuotedPairs( u"\"\"" ); + static constexpr OUStringLiteral aQuotedPairs( u"\"\"" ); maTables.clear(); for ( sal_Int32 nStringIx {aTables.isEmpty() ? -1 : 0}; nStringIx>=0; ) { diff --git a/sc/source/filter/oox/querytablebuffer.cxx b/sc/source/filter/oox/querytablebuffer.cxx index 82f9821fcee9..754eafce5137 100644 --- a/sc/source/filter/oox/querytablebuffer.cxx +++ b/sc/source/filter/oox/querytablebuffer.cxx @@ -249,7 +249,7 @@ void QueryTable::finalizeImport() PropertySet aDocProps( getDocument() ); Reference< XAreaLinks > xAreaLinks( aDocProps.getAnyProperty( PROP_AreaLinks ), UNO_QUERY_THROW ); CellAddress aDestPos( aDestRange.aStart.Tab(), aDestRange.aStart.Col(), aDestRange.aStart.Row() ); - static const OUStringLiteral aFilterName = u"calc_HTML_WebQuery"; + static constexpr OUStringLiteral aFilterName = u"calc_HTML_WebQuery"; xAreaLinks->insertAtPosition( aDestPos, aFileUrl, aTables, aFilterName, /*aFilterOptions*/"" ); // set refresh interval (convert minutes to seconds) sal_Int32 nRefreshPeriod = xConnection->getModel().mnInterval * 60; diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx index 99d4db7ca53f..5120dea3973a 100644 --- a/sc/source/filter/xcl97/xcl97esc.cxx +++ b/sc/source/filter/xcl97/xcl97esc.cxx @@ -164,7 +164,7 @@ bool lcl_IsFontwork( const SdrObject* pObj ) bool bIsFontwork = false; if( pObj->GetObjIdentifier() == SdrObjKind::CustomShape ) { - static const OUStringLiteral aTextPath = u"TextPath"; + static constexpr OUStringLiteral aTextPath = u"TextPath"; const SdrCustomShapeGeometryItem& rGeometryItem = pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ); if( const Any* pAny = rGeometryItem.GetPropertyValueByName( aTextPath, aTextPath ) ) diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx index 67a9cffeaff9..a100c61e5c8d 100644 --- a/sc/source/filter/xml/XMLStylesExportHelper.cxx +++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx @@ -384,7 +384,7 @@ void ScMyValidationsContainer::WriteValidations(ScXMLExport& rExport) // and the property name is "MacroName". bool bScriptURL = SfxApplication::IsXScriptURL( rValidation.sErrorTitle ); - static const OUStringLiteral sScript(u"Script"); + static constexpr OUStringLiteral sScript(u"Script"); uno::Sequence<beans::PropertyValue> aSeq( comphelper::InitPropertySequence({ { "EventType", uno::Any(bScriptURL ? sScript : OUString("StarBasic")) }, { "Library", uno::Any(OUString()) }, diff --git a/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx b/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx index f58b61570342..e9ac99dda4bd 100644 --- a/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx +++ b/sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx @@ -71,7 +71,7 @@ ScRange ScMatrixComparisonGenerator::ApplyOutput(ScDocShell* pDocShell) output.writeString(getLabel()); output.nextColumn(); - static const OUStringLiteral strWildcardNumber(u"%NUMBER%"); + static constexpr OUStringLiteral strWildcardNumber(u"%NUMBER%"); // write labels to columns for (size_t i = 0; i < aRangeList.size(); i++) diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index f202d8ab7926..4445f68245c8 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -314,7 +314,7 @@ void lclGetFormulaFromStringList( OUString& rFmlaStr, std::u16string_view rStrin @return true = Conversion successful. */ bool lclGetStringListFromFormula( OUString& rStringList, const OUString& rFmlaStr, sal_Unicode cFmlaSep ) { - static const OUStringLiteral aQuotes( u"\"\"" ); + static constexpr OUStringLiteral aQuotes( u"\"\"" ); rStringList.clear(); bool bIsStringList = !rFmlaStr.isEmpty(); diff --git a/sc/source/ui/docshell/datastream.cxx b/sc/source/ui/docshell/datastream.cxx index cbce943eda11..3cbf57616670 100644 --- a/sc/source/ui/docshell/datastream.cxx +++ b/sc/source/ui/docshell/datastream.cxx @@ -253,7 +253,7 @@ void DataStream::MakeToolbarVisible() if (!xLayoutManager.is()) return; - static const OUStringLiteral sResourceURL( u"private:resource/toolbar/datastreams" ); + static constexpr OUStringLiteral sResourceURL( u"private:resource/toolbar/datastreams" ); css::uno::Reference< css::ui::XUIElement > xUIElement = xLayoutManager->getElement(sResourceURL); if (!xUIElement.is()) { diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index cc553c38f067..99cf080cb7f3 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -1224,9 +1224,9 @@ void ScDocShell::Execute( SfxRequest& rReq ) if ( !aLangText.isEmpty() ) { LanguageType eLang, eLatin, eCjk, eCtl; - static const OUStringLiteral aSelectionLangPrefix(u"Current_"); - static const OUStringLiteral aParagraphLangPrefix(u"Paragraph_"); - static const OUStringLiteral aDocLangPrefix(u"Default_"); + static constexpr OUStringLiteral aSelectionLangPrefix(u"Current_"); + static constexpr OUStringLiteral aParagraphLangPrefix(u"Paragraph_"); + static constexpr OUStringLiteral aDocLangPrefix(u"Default_"); bool bSelection = false; bool bParagraph = false; @@ -1374,7 +1374,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) if (pItem2) sApplyText = pItem2->GetValue(); - static const OUStringLiteral sSpellingRule(u"Spelling_"); + static constexpr OUStringLiteral sSpellingRule(u"Spelling_"); sal_Int32 nPos = 0; if(-1 != (nPos = sApplyText.indexOf( sSpellingRule ))) { diff --git a/sd/qa/unit/SVGExportTests.cxx b/sd/qa/unit/SVGExportTests.cxx index a8d64e828a67..c300bb03527e 100644 --- a/sd/qa/unit/SVGExportTests.cxx +++ b/sd/qa/unit/SVGExportTests.cxx @@ -263,7 +263,7 @@ public: void testSVGPlaceholderLocale() { - static const OUStringLiteral aLangISO(u"it-IT"); + static constexpr OUStringLiteral aLangISO(u"it-IT"); SvtSysLocaleOptions aSysLocaleOptions; aSysLocaleOptions.SetLocaleConfigString(aLangISO); aSysLocaleOptions.SetUILocaleConfigString(aLangISO); diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx index 485feb5bbbd8..b0dedac84636 100644 --- a/sd/qa/unit/misc-tests.cxx +++ b/sd/qa/unit/misc-tests.cxx @@ -831,7 +831,7 @@ void SdMiscTest::testTdf129898LayerDrawnInSlideshow() SdDrawDocument* pDoc = pXImpressDocument->GetDoc(); // Verify model - static const OUStringLiteral sName = u"DrawnInSlideshow"; + static constexpr OUStringLiteral sName = u"DrawnInSlideshow"; SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin(); SdrLayer* pLayer = rLayerAdmin.GetLayer(sName); CPPUNIT_ASSERT_MESSAGE("No layer DrawnInSlideshow", pLayer); diff --git a/sd/source/console/PresenterController.cxx b/sd/source/console/PresenterController.cxx index 39ed5506960d..2a0e6d25aa47 100644 --- a/sd/source/console/PresenterController.cxx +++ b/sd/source/console/PresenterController.cxx @@ -303,9 +303,9 @@ void PresenterController::UpdatePaneTitles() return; // Get placeholders and their values. - static const OUStringLiteral sCurrentSlideNumberPlaceholder (u"CURRENT_SLIDE_NUMBER"); - static const OUStringLiteral sCurrentSlideNamePlaceholder (u"CURRENT_SLIDE_NAME"); - static const OUStringLiteral sSlideCountPlaceholder (u"SLIDE_COUNT"); + static constexpr OUStringLiteral sCurrentSlideNumberPlaceholder (u"CURRENT_SLIDE_NUMBER"); + static constexpr OUStringLiteral sCurrentSlideNamePlaceholder (u"CURRENT_SLIDE_NAME"); + static constexpr OUStringLiteral sSlideCountPlaceholder (u"SLIDE_COUNT"); // Get string for slide count. OUString sSlideCount ("---"); diff --git a/sd/source/console/PresenterSlideSorter.cxx b/sd/source/console/PresenterSlideSorter.cxx index 911452036660..85d7831b165d 100644 --- a/sd/source/console/PresenterSlideSorter.cxx +++ b/sd/source/console/PresenterSlideSorter.cxx @@ -1583,7 +1583,7 @@ OUString PresenterSlideSorter::MouseOverManager::GetFittingText ( double nBestWidth (0); OUString sBestCandidate; sal_Int32 nLength (round(rsText.getLength() * nMaximalWidth / nTextWidth)); - static const OUStringLiteral sEllipses (u"..."); + static constexpr OUStringLiteral sEllipses (u"..."); while (true) { const OUString sCandidate (rsText.subView(0,nLength) + sEllipses); diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index b74179dfb1f7..f041d0e1e45b 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -307,7 +307,7 @@ sal_Int32 CustomAnimationEffect::getNumberOfSubitems( const Any& aTarget, sal_In Reference< XEnumerationAccess > xEA( xShape, UNO_QUERY_THROW ); Reference< XEnumeration > xEnumeration( xEA->createEnumeration(), UNO_SET_THROW ); css::lang::Locale aLocale; - static const OUStringLiteral aStrLocaleName( u"CharLocale" ); + static constexpr OUStringLiteral aStrLocaleName( u"CharLocale" ); Reference< XTextRange > xParagraph; sal_Int32 nPara = 0; diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index 693f297a19c6..4866b269f776 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -264,7 +264,7 @@ bool SdGRFFilter::Export() beans::PropertyValues aArgs; TransformItems( SID_SAVEASDOC, *pSet, aArgs ); - static const OUStringLiteral sFilterName( u"FilterName" ); + static constexpr OUStringLiteral sFilterName( u"FilterName" ); OUString sShortName( rGraphicFilter.GetExportFormatShortName( nFilter ) ); bool bFilterNameFound = false; diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx index 43c3d0d7766d..f1c2d9d29ffa 100644 --- a/sd/source/filter/xml/sdxmlwrp.cxx +++ b/sd/source/filter/xml/sdxmlwrp.cxx @@ -676,7 +676,7 @@ bool SdXMLFilter::Import( ErrCode& nError ) if( xModelSet.is() ) { uno::Reference< beans::XPropertySetInfo > xModelSetInfo( xModelSet->getPropertySetInfo() ); - static const OUStringLiteral sPropName( u"BuildId" ); + static constexpr OUStringLiteral sPropName( u"BuildId" ); OUString sBuildId; xInfoSet->getPropertyValue(sPropName) >>= sBuildId; diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx index e12e6ea123e7..1b4df937ae27 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -1570,7 +1570,7 @@ CustomAnimationDurationTabPage::CustomAnimationDurationTabPage(weld::Container* if( !xCurrentPage.is() ) return; - static const OUStringLiteral aStrIsEmptyPresObj( u"IsEmptyPresentationObject" ); + static constexpr OUStringLiteral aStrIsEmptyPresObj( u"IsEmptyPresentationObject" ); sal_Int32 nShape, nCount = xCurrentPage->getCount(); for( nShape = 0; nShape < nCount; nShape++ ) diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx index 0128f210eb77..78f3f1203e27 100644 --- a/sd/source/ui/animations/CustomAnimationList.cxx +++ b/sd/source/ui/animations/CustomAnimationList.cxx @@ -134,13 +134,13 @@ OUString getShapeDescription( const Reference< XShape >& xShape, bool bWithText Reference<XPropertySetInfo> xInfo(xSet->getPropertySetInfo()); if (xInfo.is()) { - static const OUStringLiteral aPropName1(u"Name"); + static constexpr OUStringLiteral aPropName1(u"Name"); if(xInfo->hasPropertyByName(aPropName1)) xSet->getPropertyValue(aPropName1) >>= aDescription; bAppendIndex = aDescription.isEmpty(); - static const OUStringLiteral aPropName2(u"UINameSingular"); + static constexpr OUStringLiteral aPropName2(u"UINameSingular"); if(xInfo->hasPropertyByName(aPropName2)) xSet->getPropertyValue(aPropName2) >>= aDescription; } diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index 2276fa91b3aa..bcec46b33ebd 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -944,7 +944,7 @@ Any CustomAnimationPane::getProperty1Value( sal_Int32 nType, const CustomAnimati case nPropertyTypeCharHeight: { - static const OUStringLiteral aAttributeName( u"CharHeight" ); + static constexpr OUStringLiteral aAttributeName( u"CharHeight" ); Any aValue( pEffect->getProperty( AnimationNodeType::SET, aAttributeName, EValue::To ) ); if( !aValue.hasValue() ) aValue = pEffect->getProperty( AnimationNodeType::ANIMATE, aAttributeName, EValue::To ); @@ -1017,7 +1017,7 @@ bool CustomAnimationPane::setProperty1Value( sal_Int32 nType, const CustomAnimat case nPropertyTypeCharHeight: { - static const OUStringLiteral aAttributeName( u"CharHeight" ); + static constexpr OUStringLiteral aAttributeName( u"CharHeight" ); bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, aAttributeName, EValue::To, rValue ); if( !bEffectChanged ) bEffectChanged = pEffect->setProperty( AnimationNodeType::ANIMATE, aAttributeName, EValue::To, rValue ); diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx index be045818a67a..19ae6796841c 100644 --- a/sd/source/ui/docshell/docshel3.cxx +++ b/sd/source/ui/docshell/docshel3.cxx @@ -298,9 +298,9 @@ void DrawDocShell::Execute( SfxRequest& rReq ) // setting the new language... if (!aNewLangTxt.isEmpty()) { - static const OUStringLiteral aSelectionLangPrefix(u"Current_"); - static const OUStringLiteral aParagraphLangPrefix(u"Paragraph_"); - static const OUStringLiteral aDocumentLangPrefix(u"Default_"); + static constexpr OUStringLiteral aSelectionLangPrefix(u"Current_"); + static constexpr OUStringLiteral aParagraphLangPrefix(u"Paragraph_"); + static constexpr OUStringLiteral aDocumentLangPrefix(u"Default_"); bool bSelection = false; bool bParagraph = false; @@ -407,7 +407,7 @@ void DrawDocShell::Execute( SfxRequest& rReq ) if (pItem2) sApplyText = pItem2->GetValue(); - static const OUStringLiteral sSpellingRule(u"Spelling_"); + static constexpr OUStringLiteral sSpellingRule(u"Spelling_"); sal_Int32 nPos = 0; if(-1 != (nPos = sApplyText.indexOf( sSpellingRule ))) { diff --git a/sd/source/ui/framework/configuration/ConfigurationTracer.cxx b/sd/source/ui/framework/configuration/ConfigurationTracer.cxx index 00ddd5ff1b39..68cc9fe9a10b 100644 --- a/sd/source/ui/framework/configuration/ConfigurationTracer.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationTracer.cxx @@ -56,7 +56,7 @@ void ConfigurationTracer::TraceBoundResources ( { const Sequence<Reference<XResourceId> > aResourceList ( rxConfiguration->getResources(rxResourceId, OUString(), AnchorBindingMode_DIRECT)); - static const OUStringLiteral sIndentation (u" "); + static constexpr OUStringLiteral sIndentation (u" "); for (Reference<XResourceId> const & resourceId : aResourceList) { OUString sLine (resourceId->getResourceURL()); diff --git a/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx b/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx index 8e3fcff143a4..be339116f6c3 100644 --- a/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx +++ b/sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx @@ -115,8 +115,8 @@ void RecentlyUsedMasterPages::LoadPersistentValues() if ( ! xSet.is()) return; - static const OUStringLiteral sURLMemberName(u"URL"); - static const OUStringLiteral sNameMemberName(u"Name"); + static constexpr OUStringLiteral sURLMemberName(u"URL"); + static constexpr OUStringLiteral sNameMemberName(u"Name"); OUString sURL; OUString sName; @@ -183,8 +183,8 @@ void RecentlyUsedMasterPages::SavePersistentValues() xSet->removeByName (rKey); // Fill it with the URLs of this object. - static const OUStringLiteral sURLMemberName(u"URL"); - static const OUStringLiteral sNameMemberName(u"Name"); + static constexpr OUStringLiteral sURLMemberName(u"URL"); + static constexpr OUStringLiteral sNameMemberName(u"Name"); Any aValue; Reference<lang::XSingleServiceFactory> xChildFactory ( xSet, UNO_QUERY); diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 1f2f76d11d1b..9e9845c3c3cd 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2014,8 +2014,8 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r // exporting transition effects to pdf if ( mbImpressDoc && !pPDFExtOutDevData->GetIsExportNotesPages() && pPDFExtOutDevData->GetIsExportTransitionEffects() ) { - static const OUStringLiteral sEffect( u"Effect" ); - static const OUStringLiteral sSpeed ( u"Speed" ); + static constexpr OUStringLiteral sEffect( u"Effect" ); + static constexpr OUStringLiteral sSpeed ( u"Speed" ); sal_Int32 nTime = 800; presentation::AnimationSpeed aAs; if ( xPagePropSet->getPropertySetInfo( )->hasPropertyByName( sSpeed ) ) diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 8e55d1f1ab99..ee95c853d37c 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -399,7 +399,7 @@ rtl::Reference<SdrObject> SdGenericDrawPage::CreateSdrObject_( const Reference< return nullptr; OUString aType( xShape->getShapeType() ); - static const OUStringLiteral aPrefix( u"com.sun.star.presentation." ); + static constexpr OUStringLiteral aPrefix( u"com.sun.star.presentation." ); if( !aType.startsWith( aPrefix ) ) { return SvxFmDrawPage::CreateSdrObject_( xShape ); diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index 7ca62d9daa1b..fb7cec583aff 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -965,7 +965,7 @@ namespace { SdPage& rHandoutPage (*rDocument.GetSdPage(0, PageKind::Handout)); Reference< css::beans::XPropertySet > xHandoutPage( rHandoutPage.getUnoPage(), UNO_QUERY ); - static const OUStringLiteral sPageNumber( u"Number" ); + static constexpr OUStringLiteral sPageNumber( u"Number" ); // Collect the page objects of the handout master. std::vector<SdrPageObj*> aHandoutPageObjects; diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index e74fe71dd45e..08d75842a187 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -121,13 +121,13 @@ void DrawViewShell::GetCtrlState(SfxItemSet &rSet) uno::Reference< beans::XPropertySetInfo > xPropInfo( xPropSet->getPropertySetInfo(), uno::UNO_SET_THROW ); form::FormButtonType eButtonType = form::FormButtonType_URL; - static const OUStringLiteral sButtonType( u"ButtonType" ); + static constexpr OUStringLiteral sButtonType( u"ButtonType" ); if(xPropInfo->hasPropertyByName( sButtonType ) && (xPropSet->getPropertyValue( sButtonType ) >>= eButtonType ) ) { OUString aString; // Label - static const OUStringLiteral sLabel( u"Label" ); + static constexpr OUStringLiteral sLabel( u"Label" ); if(xPropInfo->hasPropertyByName(sLabel)) { if( xPropSet->getPropertyValue(sLabel) >>= aString ) @@ -135,7 +135,7 @@ void DrawViewShell::GetCtrlState(SfxItemSet &rSet) } // URL - static const OUStringLiteral sTargetURL( u"TargetURL" ); + static constexpr OUStringLiteral sTargetURL( u"TargetURL" ); if(xPropInfo->hasPropertyByName(sTargetURL)) { if( xPropSet->getPropertyValue(sTargetURL) >>= aString ) @@ -143,7 +143,7 @@ void DrawViewShell::GetCtrlState(SfxItemSet &rSet) } // Target - static const OUStringLiteral sTargetFrame( u"TargetFrame" ); + static constexpr OUStringLiteral sTargetFrame( u"TargetFrame" ); if(xPropInfo->hasPropertyByName(sTargetFrame) ) { if( xPropSet->getPropertyValue(sTargetFrame) >>= aString ) diff --git a/sdext/source/minimizer/informationdialog.cxx b/sdext/source/minimizer/informationdialog.cxx index ad6dc2b74548..dc4b03042895 100644 --- a/sdext/source/minimizer/informationdialog.cxx +++ b/sdext/source/minimizer/informationdialog.cxx @@ -83,7 +83,7 @@ void InformationDialog::InitDialog() aURL.Complete = maSaveAsURL; xURLTransformer->parseSmart( aURL, OUString() ); - static const OUStringLiteral sFileProtocol( u"file:///" ); + static constexpr OUStringLiteral sFileProtocol( u"file:///" ); aPresentationURL.Complete = sFileProtocol + aURL.Name; aTitle = xURLTransformer->getPresentation( aPresentationURL, false ); @@ -93,8 +93,8 @@ void InformationDialog::InitDialog() OUString sPrimary( getString( STR_INFO_PRIMARY ) ); OUString sSecondary( getString( eInfoString ) ); - static const OUStringLiteral aOldSizePlaceholder( u"%OLDFILESIZE" ); - static const OUStringLiteral aNewSizePlaceholder( u"%NEWFILESIZE" ); + static constexpr OUStringLiteral aOldSizePlaceholder( u"%OLDFILESIZE" ); + static constexpr OUStringLiteral aNewSizePlaceholder( u"%NEWFILESIZE" ); const OUString aTitlePlaceholder( !aTitle.isEmpty() ? OUString("%TITLE" ) : OUString("'%TITLE'") ); diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 507a00c4e2ae..060ec181b60e 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -207,7 +207,7 @@ static OUString const & HelpLocaleString() if (!aLocaleStr.isEmpty()) return aLocaleStr; - static const OUStringLiteral aEnglish(u"en-US"); + static constexpr OUStringLiteral aEnglish(u"en-US"); // detect installed locale aLocaleStr = utl::ConfigManager::getUILocale(); diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 5c564af981a2..f8caa35aad90 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -160,7 +160,7 @@ OUString ConvertDateTime_Impl( std::u16string_view rName, { Date aD(uDT); tools::Time aT(uDT); - static const OUStringLiteral aDelim( u", " ); + static constexpr OUStringLiteral aDelim( u", " ); OUString aStr = rWrapper.getDate( aD ) + aDelim + rWrapper.getTime( aT ); diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx index 35845bf7d2cf..75dfa8e8da7f 100644 --- a/sfx2/source/dialog/mailmodel.cxx +++ b/sfx2/source/dialog/mailmodel.cxx @@ -464,7 +464,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( OUString aFileURL = aFilePathObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ); sal_Int32 nNumArgs(1); - static const OUStringLiteral aPasswordPropName( u"Password" ); + static constexpr OUStringLiteral aPasswordPropName( u"Password" ); css::uno::Sequence< css::beans::PropertyValue > aArgs{ comphelper::makePropertyValue( "FilterName", aFilterName) }; diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx index 98d8e069f57c..05e517319e92 100644 --- a/sfx2/source/doc/docmacromode.cxx +++ b/sfx2/source/doc/docmacromode.cxx @@ -335,8 +335,8 @@ namespace sfx2 bHasMacroLib = false; else { - static const OUStringLiteral aStdLibName( u"Standard" ); - static const OUStringLiteral aVBAProject( u"VBAProject" ); + static constexpr OUStringLiteral aStdLibName( u"Standard" ); + static constexpr OUStringLiteral aVBAProject( u"VBAProject" ); const Sequence< OUString > aElements = xContainer->getElementNames(); for( const OUString& aElement : aElements ) { diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index e51e49481d89..9b71addc5fe2 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -1950,7 +1950,7 @@ sal_Bool SfxDocTplService::addTemplate( const OUString& rGroupName, Content aResultContent; if ( Content::create( aNewTemplateTargetURL, xEnv, comphelper::getProcessComponentContext(), aResultContent ) ) { - static const OUStringLiteral aPropertyName( u"IsReadOnly" ); + static constexpr OUStringLiteral aPropertyName( u"IsReadOnly" ); uno::Any aProperty; bool bReadOnly = false; if ( getProperty( aResultContent, aPropertyName, aProperty ) && ( aProperty >>= bReadOnly ) && bReadOnly ) diff --git a/sfx2/source/doc/doctemplateslocal.cxx b/sfx2/source/doc/doctemplateslocal.cxx index fa83d1f4ccf4..7a7e4fbe554b 100644 --- a/sfx2/source/doc/doctemplateslocal.cxx +++ b/sfx2/source/doc/doctemplateslocal.cxx @@ -58,7 +58,7 @@ void DocTemplLocaleHelper::WriteGroupLocalizationSequence( const uno::Reference< xWriterHandler->setOutputStream( xOutStream ); - static const OUStringLiteral aWhiteSpace( u" " ); + static constexpr OUStringLiteral aWhiteSpace( u" " ); // write the namespace rtl::Reference<::comphelper::AttributeList> pRootAttrList = new ::comphelper::AttributeList; diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 272d68fedac6..0f9df1ccd124 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -726,13 +726,13 @@ sal_Int8 ModelData_Impl::CheckStateForSave() // check acceptable entries for media descriptor ::comphelper::SequenceAsHashMap aAcceptedArgs; - static const OUStringLiteral aVersionCommentString(u"VersionComment"); - static const OUStringLiteral aAuthorString(u"Author"); - static const OUStringLiteral aDontTerminateEdit(u"DontTerminateEdit"); - static const OUStringLiteral aInteractionHandlerString(u"InteractionHandler"); - static const OUStringLiteral aStatusIndicatorString(u"StatusIndicator"); - static const OUStringLiteral aFailOnWarningString(u"FailOnWarning"); - static const OUStringLiteral aNoFileSync(u"NoFileSync"); + static constexpr OUStringLiteral aVersionCommentString(u"VersionComment"); + static constexpr OUStringLiteral aAuthorString(u"Author"); + static constexpr OUStringLiteral aDontTerminateEdit(u"DontTerminateEdit"); + static constexpr OUStringLiteral aInteractionHandlerString(u"InteractionHandler"); + static constexpr OUStringLiteral aStatusIndicatorString(u"StatusIndicator"); + static constexpr OUStringLiteral aFailOnWarningString(u"FailOnWarning"); + static constexpr OUStringLiteral aNoFileSync(u"NoFileSync"); if ( GetMediaDescr().find( aVersionCommentString ) != GetMediaDescr().end() ) aAcceptedArgs[ aVersionCommentString ] = GetMediaDescr()[ aVersionCommentString ]; diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index ba1ea30e0436..a7d1eaee766f 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -726,7 +726,7 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed ) && !bPdfiumImport) { uno::Reference < beans::XPropertySet > xSet( GetModel(), uno::UNO_QUERY ); - static const OUStringLiteral sLockUpdates(u"LockUpdates"); + static constexpr OUStringLiteral sLockUpdates(u"LockUpdates"); bool bSetProperty = true; try { @@ -776,9 +776,9 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed ) css::uno::Reference < XPropertySetInfo > xProps = aContent.getProperties(); if ( xProps.is() ) { - static const OUStringLiteral aAuthor( u"Author" ); - static const OUStringLiteral aKeywords( u"Keywords" ); - static const OUStringLiteral aSubject( u"Subject" ); + static constexpr OUStringLiteral aAuthor( u"Author" ); + static constexpr OUStringLiteral aKeywords( u"Keywords" ); + static constexpr OUStringLiteral aSubject( u"Subject" ); Any aAny; OUString aValue; uno::Reference<document::XDocumentPropertiesSupplier> xDPS( @@ -1044,8 +1044,8 @@ bool SfxObjectShell::DoSave() if ( !xTmpStorage.is() ) throw uno::RuntimeException(); - static const OUStringLiteral aBasicStorageName( u"Basic" ); - static const OUStringLiteral aDialogsStorageName( u"Dialogs" ); + static constexpr OUStringLiteral aBasicStorageName( u"Basic" ); + static constexpr OUStringLiteral aDialogsStorageName( u"Dialogs" ); if ( GetMedium()->GetStorage()->hasByName( aBasicStorageName ) ) GetMedium()->GetStorage()->copyElementTo( aBasicStorageName, xTmpStorage, aBasicStorageName ); if ( GetMedium()->GetStorage()->hasByName( aDialogsStorageName ) ) @@ -1486,7 +1486,7 @@ bool SfxObjectShell::SaveTo_Impl if ( aVersions.hasElements() ) { // copy the version streams - static const OUStringLiteral aVersionsName( u"Versions" ); + static constexpr OUStringLiteral aVersionsName( u"Versions" ); uno::Reference< embed::XStorage > xNewVerStor = xMedStorage->openStorageElement( aVersionsName, embed::ElementModes::READWRITE ); @@ -1723,9 +1723,9 @@ bool SfxObjectShell::SaveTo_Impl css::uno::Reference < XPropertySetInfo > xProps = aContent.getProperties(); if ( xProps.is() ) { - static const OUStringLiteral aAuthor( u"Author" ); - static const OUStringLiteral aKeywords( u"Keywords" ); - static const OUStringLiteral aSubject( u"Subject" ); + static constexpr OUStringLiteral aAuthor( u"Author" ); + static constexpr OUStringLiteral aKeywords( u"Keywords" ); + static constexpr OUStringLiteral aSubject( u"Subject" ); uno::Reference<document::XDocumentPropertiesSupplier> xDPS( GetModel(), uno::UNO_QUERY_THROW); @@ -2227,7 +2227,7 @@ bool SfxObjectShell::ImportFrom(SfxMedium& rMedium, css::uno::Sequence < css::beans::PropertyValue > aArgs ( lDescriptor.getLength() ); css::beans::PropertyValue * pNewValue = aArgs.getArray(); const css::beans::PropertyValue * pOldValue = lDescriptor.getConstArray(); - static const OUStringLiteral sInputStream ( u"InputStream" ); + static constexpr OUStringLiteral sInputStream ( u"InputStream" ); bool bHasInputStream = false; bool bHasBaseURL = false; @@ -2406,8 +2406,8 @@ bool SfxObjectShell::ExportTo( SfxMedium& rMedium ) css::beans::PropertyValue * pNewValue = aArgs.getArray(); // put in the REAL file name, and copy all PropertyValues - static const OUStringLiteral sOutputStream ( u"OutputStream" ); - static const OUStringLiteral sStream ( u"StreamForOutput" ); + static constexpr OUStringLiteral sOutputStream ( u"OutputStream" ); + static constexpr OUStringLiteral sStream ( u"StreamForOutput" ); bool bHasOutputStream = false; bool bHasStream = false; bool bHasBaseURL = false; @@ -3455,7 +3455,7 @@ static bool StoragesOfUnknownMediaTypeAreCopied_Impl( const uno::Reference< embe if ( xSource->isStorageElement( rSubElement ) ) { OUString aMediaType; - static const OUStringLiteral aMediaTypePropName( u"MediaType" ); + static constexpr OUStringLiteral aMediaTypePropName( u"MediaType" ); bool bGotMediaType = false; try @@ -3598,7 +3598,7 @@ bool SfxObjectShell::CopyStoragesOfUnknownMediaType(const uno::Reference< embed: else if (xSource->isStorageElement(rSubElement)) { OUString aMediaType; - static const OUStringLiteral aMediaTypePropName( u"MediaType" ); + static constexpr OUStringLiteral aMediaTypePropName( u"MediaType" ); bool bGotMediaType = false; try diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 45c992c8dc5b..82e25ed00f42 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2750,7 +2750,7 @@ void SfxBaseModel::loadCmisProperties( ) utl::UCBContentHelper::getDefaultCommandEnvironment(), comphelper::getProcessComponentContext() ); Reference < beans::XPropertySetInfo > xProps = aContent.getProperties(); - static const OUStringLiteral aCmisProps( u"CmisProperties" ); + static constexpr OUStringLiteral aCmisProps( u"CmisProperties" ); if ( xProps->hasPropertyByName( aCmisProps ) ) { Sequence< document::CmisProperty> aCmisProperties; @@ -2858,7 +2858,7 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , && m_pData->m_pObjectShell->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) { Reference< embed::XStorage > xConfigStorage; - static const OUStringLiteral aUIConfigFolderName( u"Configurations2" ); + static constexpr OUStringLiteral aUIConfigFolderName( u"Configurations2" ); xConfigStorage = getDocumentSubStorage( aUIConfigFolderName, embed::ElementModes::READWRITE ); if ( !xConfigStorage.is() ) @@ -3030,7 +3030,7 @@ void SfxBaseModel::impl_store( const OUString& sURL // this is the same file URL as the current document location, try to use storeOwn if possible ::comphelper::SequenceAsHashMap aArgHash( seqArguments ); - static const OUStringLiteral aFilterString( u"FilterName" ); + static constexpr OUStringLiteral aFilterString( u"FilterName" ); const OUString aFilterName( aArgHash.getUnpackedValueOrDefault( aFilterString, OUString() ) ); if ( !aFilterName.isEmpty() ) { @@ -3616,7 +3616,7 @@ Reference< ui::XUIConfigurationManager2 > SfxBaseModel::getUIConfigurationManage xConfigStorage = getDocumentSubStorage( aUIConfigFolderName, embed::ElementModes::READWRITE ); if ( xConfigStorage.is() ) { - static const OUStringLiteral aMediaTypeProp( u"MediaType" ); + static constexpr OUStringLiteral aMediaTypeProp( u"MediaType" ); OUString aMediaType; Reference< beans::XPropertySet > xPropSet( xConfigStorage, UNO_QUERY ); Any a = xPropSet->getPropertyValue( aMediaTypeProp ); @@ -3992,7 +3992,7 @@ OUString SAL_CALL SfxBaseModel::getTitle() = aContent.getProperties(); if ( xProps.is() ) { - static const OUStringLiteral aServerTitle( u"TitleOnServer" ); + static constexpr OUStringLiteral aServerTitle( u"TitleOnServer" ); if ( xProps->hasPropertyByName( aServerTitle ) ) { Any aAny = aContent.getPropertyValue( aServerTitle ); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index f6e8378290ed..6cde535cc3c3 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -3081,7 +3081,7 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) case SID_RECORDMACRO : { // try to find any active recorder on this frame - static const OUStringLiteral sProperty(u"DispatchRecorderSupplier"); + static constexpr OUStringLiteral sProperty(u"DispatchRecorderSupplier"); css::uno::Reference< css::frame::XFrame > xFrame = GetFrame().GetFrameInterface(); @@ -3143,7 +3143,7 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) { if ( auto xLayoutManager = getLayoutManager(GetFrame()) ) { - static const OUStringLiteral aStatusbarResString( u"private:resource/statusbar/statusbar" ); + static constexpr OUStringLiteral aStatusbarResString( u"private:resource/statusbar/statusbar" ); // Evaluate parameter. const SfxBoolItem* pShowItem = rReq.GetArg<SfxBoolItem>(rReq.GetSlot()); bool bShow( true ); diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk index a4bf3dbf45a9..db95241b4585 100644 --- a/solenv/CompilerTest_compilerplugins_clang.mk +++ b/solenv/CompilerTest_compilerplugins_clang.mk @@ -19,6 +19,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \ compilerplugins/clang/test/collapseif \ compilerplugins/clang/test/commaoperator \ compilerplugins/clang/test/conditionalstring \ + compilerplugins/clang/test/constexprliteral \ compilerplugins/clang/test/constmethod \ compilerplugins/clang/test/constmove \ compilerplugins/clang/test/consttobool \ diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 0739e86436c2..1eee64ad04c7 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -659,7 +659,7 @@ void SmEditWindow::SelPrevMark() sal_Int32 nPara = eSelection.nStartPara; sal_Int32 nMax = eSelection.nStartPos; OUString aText(pEditEngine->GetText(nPara)); - static const OUStringLiteral aMark(u"<?>"); + static constexpr OUStringLiteral aMark(u"<?>"); sal_Int32 nPos; while ( (nPos = aText.lastIndexOf(aMark, nMax)) < 0 ) diff --git a/starmath/source/mathml/import.cxx b/starmath/source/mathml/import.cxx index 8a0463283286..4af01642d9dd 100644 --- a/starmath/source/mathml/import.cxx +++ b/starmath/source/mathml/import.cxx @@ -1366,9 +1366,9 @@ void SmMLImport::SetConfigurationSettings(const Sequence<PropertyValue>& aConfPr return; } - static const OUStringLiteral sFormula(u"Formula"); - static const OUStringLiteral sBasicLibraries(u"BasicLibraries"); - static const OUStringLiteral sDialogLibraries(u"DialogLibraries"); + static constexpr OUStringLiteral sFormula(u"Formula"); + static constexpr OUStringLiteral sBasicLibraries(u"BasicLibraries"); + static constexpr OUStringLiteral sDialogLibraries(u"DialogLibraries"); for (const PropertyValue& rValue : aConfProps) { if (rValue.Name != sFormula && rValue.Name != sBasicLibraries diff --git a/starmath/source/mathml/mathmlexport.cxx b/starmath/source/mathml/mathmlexport.cxx index 6382ade13a53..2253b0269d27 100644 --- a/starmath/source/mathml/mathmlexport.cxx +++ b/starmath/source/mathml/mathmlexport.cxx @@ -292,12 +292,12 @@ bool SmXMLExportWrapper::WriteThroughComponent(const Reference<embed::XStorage>& } uno::Reference<beans::XPropertySet> xSet(xStream, uno::UNO_QUERY); - static const OUStringLiteral sMediaType = u"MediaType"; - static const OUStringLiteral sTextXml = u"text/xml"; + static constexpr OUStringLiteral sMediaType = u"MediaType"; + static constexpr OUStringLiteral sTextXml = u"text/xml"; xSet->setPropertyValue(sMediaType, Any(OUString(sTextXml))); // all streams must be encrypted in encrypted document - static const OUStringLiteral sUseCommonStoragePasswordEncryption + static constexpr OUStringLiteral sUseCommonStoragePasswordEncryption = u"UseCommonStoragePasswordEncryption"; xSet->setPropertyValue(sUseCommonStoragePasswordEncryption, Any(true)); diff --git a/starmath/source/mathml/mathmlimport.cxx b/starmath/source/mathml/mathmlimport.cxx index a33a4015846f..2894f399a833 100644 --- a/starmath/source/mathml/mathmlimport.cxx +++ b/starmath/source/mathml/mathmlimport.cxx @@ -2617,9 +2617,9 @@ void SmXMLImport::SetConfigurationSettings(const Sequence<PropertyValue>& aConfP if (!xInfo.is()) return; - static const OUStringLiteral sFormula(u"Formula"); - static const OUStringLiteral sBasicLibraries(u"BasicLibraries"); - static const OUStringLiteral sDialogLibraries(u"DialogLibraries"); + static constexpr OUStringLiteral sFormula(u"Formula"); + static constexpr OUStringLiteral sBasicLibraries(u"BasicLibraries"); + static constexpr OUStringLiteral sDialogLibraries(u"DialogLibraries"); for (const PropertyValue& rValue : aConfProps) { if (rValue.Name != sFormula && rValue.Name != sBasicLibraries diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 62bd7957d635..1b655e12f1c3 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -1759,8 +1759,8 @@ short SvNumberformat::ImpNextSymbol(OUStringBuffer& rString, break; default: { - static const OUStringLiteral aNatNum(u"NATNUM"); - static const OUStringLiteral aDBNum(u"DBNUM"); + static constexpr OUStringLiteral aNatNum(u"NATNUM"); + static constexpr OUStringLiteral aDBNum(u"DBNUM"); const OUString aBufStr( rString.toString()); sal_Int32 nNatNumNum; sal_Int32 nDBNum; diff --git a/svtools/source/config/extcolorcfg.cxx b/svtools/source/config/extcolorcfg.cxx index 5a5e2c6c006c..8707f6b36af3 100644 --- a/svtools/source/config/extcolorcfg.cxx +++ b/svtools/source/config/extcolorcfg.cxx @@ -307,7 +307,7 @@ void ExtendedColorConfig_Impl::Load(const OUString& rScheme) void ExtendedColorConfig_Impl::FillComponentColors(const uno::Sequence < OUString >& _rComponents,const TDisplayNames& _rDisplayNames) { - static const OUStringLiteral sColorEntries(u"/Entries"); + static constexpr OUStringLiteral sColorEntries(u"/Entries"); for(OUString const & component : _rComponents) { OUString sComponentName = component.copy(component.lastIndexOf('/')+1); @@ -318,7 +318,7 @@ void ExtendedColorConfig_Impl::FillComponentColors(const uno::Sequence < OUStrin uno::Sequence < OUString > aColorNames = GetPropertyNames(sEntry); uno::Sequence < OUString > aDefaultColorNames = aColorNames; - static const OUStringLiteral sColor(u"/Color"); + static constexpr OUStringLiteral sColor(u"/Color"); lcl_addString(aColorNames,sColor); lcl_addString(aDefaultColorNames,u"/DefaultColor"); uno::Sequence< uno::Any > aColors = GetProperties( aColorNames ); @@ -384,11 +384,11 @@ void ExtendedColorConfig_Impl::ImplCommit() { if ( m_sLoadedScheme.isEmpty() ) return; - static const OUStringLiteral sColorEntries(u"Entries"); - static const OUStringLiteral sColor(u"/Color"); + static constexpr OUStringLiteral sColorEntries(u"Entries"); + static constexpr OUStringLiteral sColor(u"/Color"); OUString sBase = "ExtendedColorScheme/ColorSchemes/" + m_sLoadedScheme; - static const OUStringLiteral s_sSep(u"/"); + static constexpr OUStringLiteral s_sSep(u"/"); for (auto const& configValue : m_aConfigValues) { diff --git a/svtools/source/dialogs/colrdlg.cxx b/svtools/source/dialogs/colrdlg.cxx index 49ea8294f0e3..793772b5f020 100644 --- a/svtools/source/dialogs/colrdlg.cxx +++ b/svtools/source/dialogs/colrdlg.cxx @@ -39,7 +39,7 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::ui::dialogs; -const OUStringLiteral sColor = u"Color"; +constexpr OUStringLiteral sColor = u"Color"; SvColorDialog::SvColorDialog() : meMode(svtools::ColorPickerMode::Select) diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx index d2718b533be7..d68a520db951 100644 --- a/svtools/source/filter/exportdialog.cxx +++ b/svtools/source/filter/exportdialog.cxx @@ -197,8 +197,8 @@ uno::Sequence< beans::PropertyValue > ExportDialog::GetFilterData( bool bUpdateC pFilterOptions = new FilterConfigItem( &aFilterData ); } - static const OUStringLiteral sLogicalWidth(u"LogicalWidth"); - static const OUStringLiteral sLogicalHeight(u"LogicalHeight"); + static constexpr OUStringLiteral sLogicalWidth(u"LogicalWidth"); + static constexpr OUStringLiteral sLogicalHeight(u"LogicalHeight"); if ( mbIsPixelFormat ) { pFilterOptions->WriteInt32("PixelWidth", maSize.Width ); diff --git a/svx/qa/unit/gallery/test_gallery.cxx b/svx/qa/unit/gallery/test_gallery.cxx index 47b73c87fbd2..fc3a89c50771 100644 --- a/svx/qa/unit/gallery/test_gallery.cxx +++ b/svx/qa/unit/gallery/test_gallery.cxx @@ -68,7 +68,7 @@ void GalleryObjTest::TestCreateTheme() std::unique_ptr<Gallery> pGallery(new Gallery(aGalleryURL)); CPPUNIT_ASSERT_MESSAGE("Could not create gallery instance", (pGallery != nullptr)); - static const OUStringLiteral myThemeName = u"addytesttheme"; + static constexpr OUStringLiteral myThemeName = u"addytesttheme"; CPPUNIT_ASSERT_MESSAGE("Could not create theme", pGallery->CreateTheme(myThemeName)); CPPUNIT_ASSERT_MESSAGE("Could not find theme", pGallery->HasTheme(myThemeName)); @@ -93,7 +93,7 @@ void GalleryObjTest::TestDeleteTheme() std::unique_ptr<Gallery> pGallery(new Gallery(aGalleryURL)); CPPUNIT_ASSERT_MESSAGE("Could not create gallery instance", (pGallery != nullptr)); - static const OUStringLiteral myThemeName = u"addytesttheme"; + static constexpr OUStringLiteral myThemeName = u"addytesttheme"; CPPUNIT_ASSERT_MESSAGE("Could not create theme", pGallery->CreateTheme(myThemeName)); CPPUNIT_ASSERT_MESSAGE("Could not find theme", pGallery->HasTheme(myThemeName)); @@ -129,12 +129,12 @@ void GalleryObjTest::TestSetThemeName() std::unique_ptr<Gallery> pGallery(new Gallery(aGalleryURL)); CPPUNIT_ASSERT_MESSAGE("Could not create gallery instance", (pGallery != nullptr)); - static const OUStringLiteral myThemeName = u"addytesttheme"; + static constexpr OUStringLiteral myThemeName = u"addytesttheme"; CPPUNIT_ASSERT_MESSAGE("Could not create theme", pGallery->CreateTheme(myThemeName)); CPPUNIT_ASSERT_MESSAGE("Could not find theme", pGallery->HasTheme(myThemeName)); // Rename theme - static const OUStringLiteral myNewThemeName = u"addytestthemenew"; + static constexpr OUStringLiteral myNewThemeName = u"addytestthemenew"; pGallery->RenameTheme(myThemeName, myNewThemeName); CPPUNIT_ASSERT_MESSAGE("Could not rename theme because old theme name still exists", !pGallery->HasTheme(myThemeName)); @@ -296,7 +296,7 @@ void GalleryObjTest::TestInsertGalleryObject() std::unique_ptr<Gallery> pGallery(new Gallery(aGalleryURL)); CPPUNIT_ASSERT_MESSAGE("Could not create gallery instance", (pGallery != nullptr)); - static const OUStringLiteral myThemeName = u"addytesttheme"; + static constexpr OUStringLiteral myThemeName = u"addytesttheme"; CPPUNIT_ASSERT_MESSAGE("Could not create theme", pGallery->CreateTheme(myThemeName)); CPPUNIT_ASSERT_MESSAGE("Could not find theme", pGallery->HasTheme(myThemeName)); @@ -341,7 +341,7 @@ void GalleryObjTest::TestRemoveGalleryObject() std::unique_ptr<Gallery> pGallery(new Gallery(aGalleryURL)); CPPUNIT_ASSERT_MESSAGE("Could not create gallery instance", (pGallery != nullptr)); - static const OUStringLiteral myThemeName = u"addytesttheme"; + static constexpr OUStringLiteral myThemeName = u"addytesttheme"; CPPUNIT_ASSERT_MESSAGE("Could not create theme", pGallery->CreateTheme(myThemeName)); CPPUNIT_ASSERT_MESSAGE("Could not find theme", pGallery->HasTheme(myThemeName)); @@ -396,7 +396,7 @@ void GalleryObjTest::TestChangePositionGalleryObject() std::unique_ptr<Gallery> pGallery(new Gallery(aGalleryURL)); CPPUNIT_ASSERT_MESSAGE("Could not create gallery instance", (pGallery != nullptr)); - static const OUStringLiteral myThemeName = u"addytesttheme"; + static constexpr OUStringLiteral myThemeName = u"addytesttheme"; CPPUNIT_ASSERT_MESSAGE("Could not create theme", pGallery->CreateTheme(myThemeName)); CPPUNIT_ASSERT_MESSAGE("Could not find theme", pGallery->HasTheme(myThemeName)); diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx index 54e8fc8361b2..4d800542a38f 100644 --- a/svx/source/core/graphichelper.cxx +++ b/svx/source/core/graphichelper.cxx @@ -440,7 +440,7 @@ void GraphicHelper::SaveShapeAsGraphic(weld::Window* pParent, // populate filter dialog filter list and select default filter to match graphic mime type GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter(); - static const OUStringLiteral aDefaultMimeType(u"image/png"); + static constexpr OUStringLiteral aDefaultMimeType(u"image/png"); OUString aDefaultFormatName; sal_uInt16 nCount = rGraphicFilter.GetExportFormatCount(); diff --git a/svx/source/dialog/svxbmpnumvalueset.cxx b/svx/source/dialog/svxbmpnumvalueset.cxx index c75e54482f40..63a5e5dce802 100644 --- a/svx/source/dialog/svxbmpnumvalueset.cxx +++ b/svx/source/dialog/svxbmpnumvalueset.cxx @@ -213,7 +213,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt ) aOrgRect.TopLeft(), aRectSize, *pVDev ); // Now comes the text - static const OUStringLiteral sValue(u"Value"); + static constexpr OUStringLiteral sValue(u"Value"); if( NumberingPageType::SINGLENUM == ePageType || NumberingPageType::BULLET == ePageType ) { diff --git a/svx/source/fmcomp/gridcols.cxx b/svx/source/fmcomp/gridcols.cxx index 92546d155cb0..1e06a8e1b6c3 100644 --- a/svx/source/fmcomp/gridcols.cxx +++ b/svx/source/fmcomp/gridcols.cxx @@ -76,8 +76,8 @@ namespace sal_Int32 getColumnTypeByModelName(const OUString& aModelName) { - static const OUStringLiteral aModelPrefix(u"com.sun.star.form.component."); - static const OUStringLiteral aCompatibleModelPrefix(u"stardiv.one.form.component."); + static constexpr OUStringLiteral aModelPrefix(u"com.sun.star.form.component."); + static constexpr OUStringLiteral aCompatibleModelPrefix(u"stardiv.one.form.component."); sal_Int32 nTypeId = -1; if (aModelName == FM_COMPONENT_EDIT) diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx index 6d0682b38c3c..b33b625f3ae4 100644 --- a/svx/source/form/formcontrolfactory.cxx +++ b/svx/source/form/formcontrolfactory.cxx @@ -433,7 +433,7 @@ namespace svxform case FormComponentType::IMAGEBUTTON: case FormComponentType::IMAGECONTROL: { - static const OUStringLiteral sScaleModeProperty( u"ScaleMode" ); + static constexpr OUStringLiteral sScaleModeProperty( u"ScaleMode" ); if ( xPSI->hasPropertyByName( sScaleModeProperty ) ) _rxControlModel->setPropertyValue( sScaleModeProperty, Any( ImageScaleMode::ISOTROPIC ) ); } diff --git a/svx/source/mnuctrls/smarttagmenu.cxx b/svx/source/mnuctrls/smarttagmenu.cxx index 3a78b5726bea..67edb3ab96a2 100644 --- a/svx/source/mnuctrls/smarttagmenu.cxx +++ b/svx/source/mnuctrls/smarttagmenu.cxx @@ -183,7 +183,7 @@ void SmartTagMenuController::FillMenu() sal_Int16 nItemCount = m_xPopupMenu->getItemCount(); if (nItemCount > 0) { - static const OUStringLiteral aCommand = u".uno:AutoCorrectDlg?OpenSmartTag:bool=true"; + static constexpr OUStringLiteral aCommand = u".uno:AutoCorrectDlg?OpenSmartTag:bool=true"; m_xPopupMenu->insertSeparator(nItemCount++); auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aCommand, m_aModuleName); m_xPopupMenu->insertItem(nMenuId, vcl::CommandInfoProvider::GetPopupLabelForCommand(aProperties), diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index c86c9ad0e194..01c23527c514 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -444,7 +444,7 @@ const SdrObject* SdrObjCustomShape::GetSdrObjectShadowFromCustomShape() const bool SdrObjCustomShape::IsTextPath() const { - static const OUStringLiteral sTextPath( u"TextPath" ); + static constexpr OUStringLiteral sTextPath( u"TextPath" ); bool bTextPathOn = false; const SdrCustomShapeGeometryItem& rGeometryItem = GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ); const uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sTextPath, sTextPath ); @@ -457,7 +457,7 @@ bool SdrObjCustomShape::UseNoFillStyle() const { bool bRet = false; OUString sShapeType; - static const OUStringLiteral sType( u"Type" ); + static constexpr OUStringLiteral sType( u"Type" ); const SdrCustomShapeGeometryItem& rGeometryItem( GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); const uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sType ); if ( pAny ) @@ -841,7 +841,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) { beans::PropertyValue aPropVal; OUString sShapeType; - static const OUStringLiteral sType( u"Type" ); + static constexpr OUStringLiteral sType( u"Type" ); SdrCustomShapeGeometryItem aGeometryItem( GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); if ( pType && !pType->isEmpty() ) { @@ -873,7 +873,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) // AdjustmentValues - static const OUStringLiteral sAdjustmentValues( u"AdjustmentValues" ); + static constexpr OUStringLiteral sAdjustmentValues( u"AdjustmentValues" ); const uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sAdjustmentValues ); if ( pAny ) *pAny >>= seqAdjustmentValues; @@ -908,7 +908,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) // Coordsize - static const OUStringLiteral sViewBox( u"ViewBox" ); + static constexpr OUStringLiteral sViewBox( u"ViewBox" ); const uno::Any* pViewBox = aGeometryItem.GetPropertyValueByName( sViewBox ); awt::Rectangle aViewBox; if ( !pViewBox || !(*pViewBox >>= aViewBox ) ) @@ -925,12 +925,12 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) } } - static const OUStringLiteral sPath( u"Path" ); + static constexpr OUStringLiteral sPath( u"Path" ); // Path/Coordinates - static const OUStringLiteral sCoordinates( u"Coordinates" ); + static constexpr OUStringLiteral sCoordinates( u"Coordinates" ); pAny = aGeometryItem.GetPropertyValueByName( sPath, sCoordinates ); if ( !pAny && pDefCustomShape && pDefCustomShape->nVertices && pDefCustomShape->pVertices ) { @@ -948,7 +948,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) } // Path/GluePoints - static const OUStringLiteral sGluePoints( u"GluePoints" ); + static constexpr OUStringLiteral sGluePoints( u"GluePoints" ); pAny = aGeometryItem.GetPropertyValueByName( sPath, sGluePoints ); if ( !pAny && pDefCustomShape && pDefCustomShape->nGluePoints && pDefCustomShape->pGluePoints ) { @@ -966,7 +966,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) } // Path/Segments - static const OUStringLiteral sSegments( u"Segments" ); + static constexpr OUStringLiteral sSegments( u"Segments" ); pAny = aGeometryItem.GetPropertyValueByName( sPath, sSegments ); if ( !pAny && pDefCustomShape && pDefCustomShape->nElements && pDefCustomShape->pElements ) { @@ -985,7 +985,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) } // Path/StretchX - static const OUStringLiteral sStretchX( u"StretchX" ); + static constexpr OUStringLiteral sStretchX( u"StretchX" ); pAny = aGeometryItem.GetPropertyValueByName( sPath, sStretchX ); if ( !pAny && pDefCustomShape ) { @@ -999,7 +999,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) } // Path/StretchY - static const OUStringLiteral sStretchY( u"StretchY" ); + static constexpr OUStringLiteral sStretchY( u"StretchY" ); pAny = aGeometryItem.GetPropertyValueByName( sPath, sStretchY ); if ( !pAny && pDefCustomShape ) { @@ -1013,7 +1013,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) } // Path/TextFrames - static const OUStringLiteral sTextFrames( u"TextFrames" ); + static constexpr OUStringLiteral sTextFrames( u"TextFrames" ); pAny = aGeometryItem.GetPropertyValueByName( sPath, sTextFrames ); if ( !pAny && pDefCustomShape && pDefCustomShape->nTextRect && pDefCustomShape->pTextRect ) { @@ -1034,7 +1034,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) } // Equations - static const OUStringLiteral sEquations( u"Equations" ); + static constexpr OUStringLiteral sEquations( u"Equations" ); pAny = aGeometryItem.GetPropertyValueByName( sEquations ); if ( !pAny && pDefCustomShape && pDefCustomShape->nCalculation && pDefCustomShape->pCalculation ) { @@ -1050,7 +1050,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType ) } // Handles - static const OUStringLiteral sHandles( u"Handles" ); + static constexpr OUStringLiteral sHandles( u"Handles" ); pAny = aGeometryItem.GetPropertyValueByName( sHandles ); if ( !pAny && pDefCustomShape && pDefCustomShape->nHandles && pDefCustomShape->pHandles ) { @@ -1126,7 +1126,7 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons MSO_SPT eSpType = EnhancedCustomShapeTypeNames::Get( sShapeType ); const mso_CustomShape* pDefCustomShape = GetCustomShapeContent( eSpType ); - static const OUStringLiteral sPath( u"Path" ); + static constexpr OUStringLiteral sPath( u"Path" ); switch( eDefaultType ) { case DefaultType::Viewbox : diff --git a/svx/source/table/cellcursor.cxx b/svx/source/table/cellcursor.cxx index 7ce3a60cf9b1..6d3aa8a72f94 100644 --- a/svx/source/table/cellcursor.cxx +++ b/svx/source/table/cellcursor.cxx @@ -284,7 +284,7 @@ void CellCursor::split_column( sal_Int32 nCol, sal_Int32 nColumns, std::vector< if( nNewCols > 0 ) { - static const OUStringLiteral sWidth(u"Width"); + static constexpr OUStringLiteral sWidth(u"Width"); Reference< XTableColumns > xCols( mxTable->getColumns(), UNO_SET_THROW ); Reference< XPropertySet > xRefColumn( xCols->getByIndex( nCol ), UNO_QUERY_THROW ); sal_Int32 nWidth = 0; @@ -398,7 +398,7 @@ void CellCursor::split_row( sal_Int32 nRow, sal_Int32 nRows, std::vector< sal_In if( nNewRows > 0 ) { - static const OUStringLiteral sHeight(u"Height"); + static constexpr OUStringLiteral sHeight(u"Height"); Reference< XTableRows > xRows( mxTable->getRows(), UNO_SET_THROW ); Reference< XPropertySet > xRefRow( xRows->getByIndex( nRow ), UNO_QUERY_THROW ); sal_Int32 nHeight = 0; diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 25ab8715d307..d29685627afc 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -263,7 +263,7 @@ void SdrTableObjImpl::CropTableModelToSelection(const CellPos& rStart, const Cel // copy row heights Reference< XTableRows > xNewRows(mxTable->getRows(), css::uno::UNO_SET_THROW ); - static const OUStringLiteral sHeight( u"Height" ); + static constexpr OUStringLiteral sHeight( u"Height" ); for( sal_Int32 nRow = 0; nRow < nRows; ++nRow ) { Reference< XPropertySet > xNewSet( xNewRows->getByIndex( nRow ), UNO_QUERY_THROW ); @@ -272,7 +272,7 @@ void SdrTableObjImpl::CropTableModelToSelection(const CellPos& rStart, const Cel // copy column widths Reference< XTableColumns > xNewColumns( mxTable->getColumns(), css::uno::UNO_SET_THROW ); - static const OUStringLiteral sWidth( u"Width" ); + static constexpr OUStringLiteral sWidth( u"Width" ); for( sal_Int32 nCol = 0; nCol < nColumns; ++nCol ) { Reference< XPropertySet > xNewSet( xNewColumns->getByIndex( nCol ), UNO_QUERY_THROW ); @@ -537,7 +537,7 @@ void SdrTableObjImpl::DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset try { - static const OUStringLiteral sSize( u"Size" ); + static constexpr OUStringLiteral sSize( u"Size" ); if( mbHorizontal ) { if (nEdge <= getRowCount()) diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index bfb65d5674aa..a5469e949ba5 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -563,7 +563,7 @@ void SvxTableController::onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs ) RemoveSelection(); - static const OUStringLiteral sSize( u"Size" ); + static constexpr OUStringLiteral sSize( u"Size" ); const bool bUndo(rModel.IsUndoEnabled()); switch( nSId ) diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx index 72c692c96748..7399687840e9 100644 --- a/svx/source/table/tablelayouter.cxx +++ b/svx/source/table/tablelayouter.cxx @@ -583,7 +583,7 @@ void TableLayouter::LayoutTableWidth( tools::Rectangle& rArea, bool bFit ) MergeVector aMergedCells( nColCount ); std::vector<sal_Int32> aOptimalColumns; - static const OUStringLiteral sOptimalSize(u"OptimalSize"); + static constexpr OUStringLiteral sOptimalSize(u"OptimalSize"); if( sal::static_int_cast< sal_Int32 >( maColumns.size() ) != nColCount ) maColumns.resize( nColCount ); @@ -735,7 +735,7 @@ void TableLayouter::LayoutTableHeight( tools::Rectangle& rArea, bool bFit ) MergeVector aMergedCells( nRowCount ); std::vector<sal_Int32> aOptimalRows; - static const OUStringLiteral sOptimalSize(u"OptimalSize"); + static constexpr OUStringLiteral sOptimalSize(u"OptimalSize"); // first calculate current height and initial minimum size per column, // merged cells will be counted later diff --git a/svx/source/table/tablemodel.cxx b/svx/source/table/tablemodel.cxx index 5dcbcf7ce617..64918a39b4de 100644 --- a/svx/source/table/tablemodel.cxx +++ b/svx/source/table/tablemodel.cxx @@ -980,7 +980,7 @@ void TableModel::optimize() { try { - static const OUStringLiteral sWidth(u"Width"); + static constexpr OUStringLiteral sWidth(u"Width"); sal_Int32 nWidth1 = 0, nWidth2 = 0; uno::Reference<beans::XPropertySet> xSet1( static_cast< XCellRange* >( maColumns[nCol].get() ), uno::UNO_QUERY_THROW ); uno::Reference<beans::XPropertySet> xSet2( static_cast< XCellRange* >( maColumns[nCol-1].get() ), uno::UNO_QUERY_THROW ); @@ -1017,7 +1017,7 @@ void TableModel::optimize() { try { - static const OUStringLiteral sHeight(u"Height"); + static constexpr OUStringLiteral sHeight(u"Height"); sal_Int32 nHeight1 = 0, nHeight2 = 0; uno::Reference<beans::XPropertySet> xSet1( static_cast< XCellRange* >( maRows[nRow].get() ), uno::UNO_QUERY_THROW ); uno::Reference<beans::XPropertySet> xSet2( static_cast< XCellRange* >( maRows[nRow-1].get() ), uno::UNO_QUERY_THROW ); diff --git a/svx/source/table/tablertfimporter.cxx b/svx/source/table/tablertfimporter.cxx index 91b62a42973b..c2e3de7ab144 100644 --- a/svx/source/table/tablertfimporter.cxx +++ b/svx/source/table/tablertfimporter.cxx @@ -281,7 +281,7 @@ void SdrTableRTFParser::FillTable() nColCount = mxTable->getColumnCount(); } - static const OUStringLiteral sWidth(u"Width"); + static constexpr OUStringLiteral sWidth(u"Width"); sal_Int32 nCol, nLastEdge = 0; for( nCol = 0; nCol < nColCount; nCol++ ) { diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index eb7ab2e61410..8833ed524d01 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -4213,7 +4213,7 @@ void SvxCurrencyToolBoxControl::inner_GetCurrencySymbols( CollatorWrapper aCollator( ::comphelper::getProcessComponentContext() ); aCollator.loadDefaultCollator( Application::GetSettings().GetLanguageTag().getLocale(), 0 ); - static const OUStringLiteral aTwoSpace(u" "); + static constexpr OUStringLiteral aTwoSpace(u" "); // appending "long symbol" list for( sal_uInt16 i = 1; i < nCount; ++i ) diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index 9ae446b50346..aaa7cddb4fd4 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -296,7 +296,7 @@ IMPL_LINK(FindTextFieldControl, KeyInputHdl, const KeyEvent&, rKeyEvent, bool) aValue >>= xLayoutManager; if (xLayoutManager.is()) { - static const OUStringLiteral sResourceURL( u"private:resource/toolbar/findbar" ); + static constexpr OUStringLiteral sResourceURL( u"private:resource/toolbar/findbar" ); xLayoutManager->hideElement( sResourceURL ); xLayoutManager->destroyElement( sResourceURL ); } @@ -1126,7 +1126,7 @@ void SAL_CALL ExitSearchToolboxController::execute( sal_Int16 /*KeyModifier*/ ) aValue >>= xLayoutManager; if (xLayoutManager.is()) { - static const OUStringLiteral sResourceURL( u"private:resource/toolbar/findbar" ); + static constexpr OUStringLiteral sResourceURL( u"private:resource/toolbar/findbar" ); xLayoutManager->hideElement( sResourceURL ); xLayoutManager->destroyElement( sResourceURL ); } @@ -1371,7 +1371,7 @@ void SAL_CALL FindbarDispatcher::dispatch( const css::util::URL& aURL, const css if (!xLayoutManager.is()) return; - static const OUStringLiteral sResourceURL( u"private:resource/toolbar/findbar" ); + static constexpr OUStringLiteral sResourceURL( u"private:resource/toolbar/findbar" ); css::uno::Reference< css::ui::XUIElement > xUIElement = xLayoutManager->getElement(sResourceURL); if (!xUIElement.is()) { diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx index 97991e47818c..e2b77d36fe5c 100644 --- a/svx/source/toolbars/fontworkbar.cxx +++ b/svx/source/toolbars/fontworkbar.cxx @@ -306,19 +306,19 @@ static void impl_execute( SfxRequest const & rReq, SdrCustomShapeGeometryItem& r static void GetGeometryForCustomShape( SdrCustomShapeGeometryItem& rGeometryItem, const OUString& rCustomShape ) { - static const OUStringLiteral sType( u"Type" ); + static constexpr OUStringLiteral sType( u"Type" ); css::beans::PropertyValue aPropVal; aPropVal.Name = sType; aPropVal.Value <<= rCustomShape; rGeometryItem.SetPropertyValue( aPropVal ); - static const OUStringLiteral sAdjustmentValues( u"AdjustmentValues" ); - static const OUStringLiteral sCoordinateOrigin( u"CoordinateOrigin" ); - static const OUStringLiteral sCoordinateSize( u"CoordinateSize" ); - static const OUStringLiteral sEquations( u"Equations" ); - static const OUStringLiteral sHandles( u"Handles" ); - static const OUStringLiteral sPath( u"Path" ); + static constexpr OUStringLiteral sAdjustmentValues( u"AdjustmentValues" ); + static constexpr OUStringLiteral sCoordinateOrigin( u"CoordinateOrigin" ); + static constexpr OUStringLiteral sCoordinateSize( u"CoordinateSize" ); + static constexpr OUStringLiteral sEquations( u"Equations" ); + static constexpr OUStringLiteral sHandles( u"Handles" ); + static constexpr OUStringLiteral sPath( u"Path" ); rGeometryItem.ClearPropertyValue( sAdjustmentValues ); rGeometryItem.ClearPropertyValue( sCoordinateOrigin ); rGeometryItem.ClearPropertyValue( sCoordinateSize ); diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx index b36eb09a5caa..c6d3ee635cf7 100644 --- a/svx/source/unodraw/unomod.cxx +++ b/svx/source/unodraw/unomod.cxx @@ -373,7 +373,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawingModel::createInstance( c uno::Reference< uno::XInterface > xRet; - static const OUStringLiteral aPackagePrefix( u"com.sun.star.presentation." ); + static constexpr OUStringLiteral aPackagePrefix( u"com.sun.star.presentation." ); if( aServiceSpecifier.startsWith( aPackagePrefix ) ) { SvxShape* pShape = nullptr; diff --git a/sw/qa/core/txtnode/justify.cxx b/sw/qa/core/txtnode/justify.cxx index 6a8afd2b52ef..f8f178543a1f 100644 --- a/sw/qa/core/txtnode/justify.cxx +++ b/sw/qa/core/txtnode/justify.cxx @@ -77,7 +77,7 @@ template <typename Function> void CharWidthArray::InvokeWithKernArray(Function f CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSpaceDistributionHalfSpace) { // Related to: tdf#149017 - static const OUStringLiteral aText = u"ne del pro"; + static constexpr OUStringLiteral aText = u"ne del pro"; CharWidthArray aActual{ 720, 639, 360, 720, 639, 400, 360, 720, 480, 720 }; CharWidthArray aExpected{ 720, 851, 573, 720, 639, 612, 573, 720, 480, 720 }; @@ -89,7 +89,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSpaceDistributionHalfSpace) CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSpaceDistributionNoHalfSpace) { // Related to: tdf#149017 - static const OUStringLiteral aText = u"ne del pro"; + static constexpr OUStringLiteral aText = u"ne del pro"; CharWidthArray aActual{ 720, 639, 360, 720, 639, 400, 360, 720, 480, 720 }; CharWidthArray aExpected{ 720, 639, 785, 720, 639, 400, 785, 720, 480, 720 }; @@ -101,7 +101,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSpaceDistributionNoHalfSpace) CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSpaceDistributionUnicodeIVS) { // Related to: tdf#148594 - static const OUStringLiteral aText + static constexpr OUStringLiteral aText = u"\u9B54\u9AD8\u4E00\U000E01E1\u4E08\u4F55\u9B54\u9AD8\u4E00\U000E01E1"; CharWidthArray aActual{ 1600, 1600, 1600, 0, 0, 1600, 1600, 1600, 1600, 1600, 0, 0 }; CharWidthArray aExpected{ 1800, 1800, 1800, 0, 0, 1800, 1800, 1800, 1800, 1800, 0, 0 }; @@ -114,7 +114,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSnapToGrid) { tools::Long nDelta = 0; // "曰〈道高一尺化太平〉云云" - static const OUStringLiteral aText + static constexpr OUStringLiteral aText = u"\u66f0\u3008\u9053\u9ad8\u4e00\u5c3a\u5316\u592a\u5e73\u3009\u4e91\u4e91"; CharWidthArray aActual{ 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, 880 }; CharWidthArray aExpected{ @@ -131,7 +131,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSnapToGridMixWidth) // Related to: tdf#149365 tools::Long nDelta = 0; // "中中中ケコサシスセソカケコ" ( mixing fullwidth ideograph and half-width kana ) - static const OUStringLiteral aText + static constexpr OUStringLiteral aText = u"\u4e2d\u4e2d\u4e2d\uff79\uff7a\uff7b\uff7c\uff7d\uff7e\uff7f\uff76\uff79\uff7a"; CharWidthArray aActual{ 640, 640, 640, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320 }; CharWidthArray aExpected{ 800, 800, 760, 400, 400, 400, 400, 400, 400, 400, 400, 400, 360 }; @@ -145,7 +145,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreJustifyTest, testSnapToGridIVS) { // Related to: tdf#149214 tools::Long nDelta = 0; - static const OUStringLiteral aText = u"\u9053\u9ad8\u4e00\U000E01E2\u5c3a\u5316"; + static constexpr OUStringLiteral aText = u"\u9053\u9ad8\u4e00\U000E01E2\u5c3a\u5316"; CharWidthArray aActual{ 800, 800, 800, 0, 0, 800, 800 }; CharWidthArray aExpected{ 800, 800, 800, 0, 0, 800, 800 }; diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 7eea1b230e06..6875d63073d7 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -1818,7 +1818,7 @@ void SwDocTest::test64kPageDescs() CPPUNIT_ASSERT_EQUAL( OUString("Page65535"), rDesc.GetName() ); SwPageDesc aDesc( rDesc ); - static const OUStringLiteral aChanged(u"Changed01"); + static constexpr OUStringLiteral aChanged(u"Changed01"); aDesc.SetName( aChanged ); m_pDoc->ChgPageDesc( nPageDescCount, aDesc ); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index aa1433f07ac0..a9742f1a3736 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -705,8 +705,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf38778) loadAndSave("tdf38778_properties_in_run_for_field.doc"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); - static const OUStringLiteral psz(u"20"); - static const OUStringLiteral pszCs(u"20"); + static constexpr OUStringLiteral psz(u"20"); + static constexpr OUStringLiteral pszCs(u"20"); // w:fldCharType="begin" assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[3]/w:rPr/w:sz", "val", psz); diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 95e526f9c3a6..6b2b2243c3b8 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1702,7 +1702,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf87533_bidi) { createSwDoc("tdf87533_bidi.docx"); // "w:bidi" (specified inside Default paragraph properties) should not be ignored - static const OUStringLiteral writingMode = u"WritingMode"; //getPropertyName(PROP_WRITING_MODE); + static constexpr OUStringLiteral writingMode = u"WritingMode"; //getPropertyName(PROP_WRITING_MODE); // check: "Default Style" master-style has RTL { diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx index 78b5e9ac5ec1..dec2f5708470 100644 --- a/sw/qa/extras/uiwriter/uiwriter6.cxx +++ b/sw/qa/extras/uiwriter/uiwriter6.cxx @@ -1566,7 +1566,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf65535) SfxViewShell* pViewShell = SfxViewShell::Current(); { - static const OUStringLiteral sApplyRule(u"Spelling_Baaed"); + static constexpr OUStringLiteral sApplyRule(u"Spelling_Baaed"); SfxStringItem aApplyItem(FN_PARAM_1, sApplyRule); pViewShell->GetViewFrame().GetDispatcher()->ExecuteList( SID_SPELLCHECK_APPLY_SUGGESTION, SfxCallMode::SYNCHRON, { &aApplyItem }); diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx index 61b9b524b399..429a8d4e0498 100644 --- a/sw/qa/extras/unowriter/unowriter.cxx +++ b/sw/qa/extras/unowriter/unowriter.cxx @@ -314,11 +314,11 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testXAutoTextGroup) uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1); - static const OUStringLiteral sGroupName = u"TestGroup*1"; - static const OUStringLiteral sTextName = u"TEST"; - static const OUStringLiteral sTextNameNew = u"TESTRENAMED"; - static const OUStringLiteral sTextTitle = u"Test Auto Text"; - static const OUStringLiteral sTextTitleNew = u"Test Auto Text Renamed"; + static constexpr OUStringLiteral sGroupName = u"TestGroup*1"; + static constexpr OUStringLiteral sTextName = u"TEST"; + static constexpr OUStringLiteral sTextNameNew = u"TESTRENAMED"; + static constexpr OUStringLiteral sTextTitle = u"Test Auto Text"; + static constexpr OUStringLiteral sTextTitleNew = u"Test Auto Text Renamed"; // Create new temporary group uno::Reference<text::XAutoTextGroup> xAutoTextGroup @@ -1187,7 +1187,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf129841) // Get SwXCellRange for the same cell css::uno::Reference<css::beans::XPropertySet> xCellRange( xTableCellRange->getCellRangeByName("A1:A1"), css::uno::UNO_QUERY_THROW); - static const OUStringLiteral sBackColor = u"BackColor"; + static constexpr OUStringLiteral sBackColor = u"BackColor"; // Apply background color to table cursor, and read background color from cell range css::uno::Any aRefColor(sal_Int32(0x00FF0000)); xTableCursor->setPropertyValue(sBackColor, aRefColor); diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 470a018eb0ef..1387ebfe65a9 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -1122,7 +1122,7 @@ namespace if( bRegExpRplc ) { sal_Int32 nPos = 0; - static const OUStringLiteral sPara(u"\\n"); + static constexpr OUStringLiteral sPara(u"\\n"); for (;;) { nPos = rStr.indexOf( sPara, nPos ); diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index b6e8f7267d33..01bcc1cd8483 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -934,8 +934,8 @@ void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int eGetMode ) } } - static const OUStringLiteral sTrue(u"TRUE"); - static const OUStringLiteral sFalse(u"FALSE"); + static constexpr OUStringLiteral sTrue(u"TRUE"); + static constexpr OUStringLiteral sFalse(u"FALSE"); #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS bool bIsDBManager = nullptr != rDoc.GetDBManager(); diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 02029856a09e..48e77a284d77 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -126,7 +126,7 @@ rtl::Reference<SdrObject> SwDoc::CloneSdrObj( const SdrObject& rObj, bool bMoveW uno::Reference< awt::XControlModel > xModel = static_cast<SdrUnoObj*>(pObj.get())->GetUnoControlModel(); uno::Any aVal; uno::Reference< beans::XPropertySet > xSet(xModel, uno::UNO_QUERY); - static const OUStringLiteral sName(u"Name"); + static constexpr OUStringLiteral sName(u"Name"); if( xSet.is() ) aVal = xSet->getPropertyValue( sName ); if( bInsInPage ) diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index 1be771b89174..2d7f1e4f5884 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -1322,7 +1322,7 @@ static std::vector<svx::ClassificationResult> lcl_CollectParagraphClassification uno::Reference<text::XTextRange> xTextRange(xField, uno::UNO_QUERY); const OUString aName = rdfNamePair.first; const OUString aValue = rdfNamePair.second; - static const OUStringLiteral sBlank(u""); + static constexpr OUStringLiteral sBlank(u""); if (aKeyCreator.isMarkingTextKey(aName)) { aResult.push_back({ svx::ClassificationType::TEXT, aValue, sBlank, sBlank }); diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index cda4850d8671..422b1236c489 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -2592,7 +2592,7 @@ void SwXShape::AdjustPositionProperties( const awt::Point& rPosition ) if ( eTextAnchorType != text::TextContentAnchorType_AS_CHARACTER ) { // determine current x-position - static const OUStringLiteral aHoriPosPropStr(u"HoriOrientPosition"); + static constexpr OUStringLiteral aHoriPosPropStr(u"HoriOrientPosition"); uno::Any aHoriPos( getPropertyValue( aHoriPosPropStr ) ); sal_Int32 dCurrX = 0; aHoriPos >>= dCurrX; @@ -2601,7 +2601,7 @@ void SwXShape::AdjustPositionProperties( const awt::Point& rPosition ) { // adjust x-position orientation to text::HoriOrientation::NONE, if needed // Note: has to be done before setting x-position attribute - static const OUStringLiteral aHoriOrientPropStr(u"HoriOrient"); + static constexpr OUStringLiteral aHoriOrientPropStr(u"HoriOrient"); uno::Any aHoriOrient( getPropertyValue( aHoriOrientPropStr ) ); sal_Int16 eHoriOrient; if (aHoriOrient >>= eHoriOrient) // may be void @@ -2622,7 +2622,7 @@ void SwXShape::AdjustPositionProperties( const awt::Point& rPosition ) // handle y-position { // determine current y-position - static const OUStringLiteral aVertPosPropStr(u"VertOrientPosition"); + static constexpr OUStringLiteral aVertPosPropStr(u"VertOrientPosition"); uno::Any aVertPos( getPropertyValue( aVertPosPropStr ) ); sal_Int32 dCurrY = 0; aVertPos >>= dCurrY; @@ -2631,7 +2631,7 @@ void SwXShape::AdjustPositionProperties( const awt::Point& rPosition ) { // adjust y-position orientation to text::VertOrientation::NONE, if needed // Note: has to be done before setting y-position attribute - static const OUStringLiteral aVertOrientPropStr(u"VertOrient"); + static constexpr OUStringLiteral aVertOrientPropStr(u"VertOrient"); uno::Any aVertOrient( getPropertyValue( aVertOrientPropStr ) ); sal_Int16 eVertOrient; if (aVertOrient >>= eVertOrient) // may be void diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx index a52473a6b8e8..62a2780f9c58 100644 --- a/sw/source/core/view/printdata.cxx +++ b/sw/source/core/view/printdata.cxx @@ -273,7 +273,7 @@ SwPrintUIOptions::SwPrintUIOptions( aPrintRangeOpt ); // create a choice for the content to create - static const OUStringLiteral aPrintRangeName( u"PrintContent" ); + static constexpr OUStringLiteral aPrintRangeName( u"PrintContent" ); uno::Sequence< OUString > aChoices{ SwResId( STR_PRINTOPTUI_PRINTALLPAGES ), SwResId( STR_PRINTOPTUI_PRINTPAGES ), SwResId( STR_PRINTOPTUI_PRINTSELECTION ) }; @@ -332,7 +332,7 @@ SwPrintUIOptions::SwPrintUIOptions( // create a bool option for brochure bDefaultVal = rDefaultPrintData.IsPrintProspect(); - static const OUStringLiteral aBrochurePropertyName( u"PrintProspect" ); + static constexpr OUStringLiteral aBrochurePropertyName( u"PrintProspect" ); m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("brochure", SwResId( STR_PRINTOPTUI_BROCHURE), ".HelpID:vcl:PrintDialog:PrintProspect:CheckBox", aBrochurePropertyName, diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index e32eb6e85ce3..7c4532bf7015 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -169,7 +169,7 @@ OUString HTMLReader::GetTemplateName(SwDoc& rDoc) const // HTML import into Writer, avoid loading the Writer/Web template. return OUString(); - static const OUStringLiteral sTemplateWithoutExt(u"internal/html"); + static constexpr OUStringLiteral sTemplateWithoutExt(u"internal/html"); SvtPathOptions aPathOpt; // first search for OpenDocument Writer/Web template @@ -5605,7 +5605,7 @@ void HTMLReader::SetupFilterOptions() return; OUString aFilterOptions = pItem->GetValue(); - static const OUStringLiteral aXhtmlNsKey(u"xhtmlns="); + static constexpr OUStringLiteral aXhtmlNsKey(u"xhtmlns="); if (aFilterOptions.startsWith(aXhtmlNsKey)) { OUString aNamespace = aFilterOptions.copy(aXhtmlNsKey.getLength()); diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 9cbbdd5d9d4a..1c9d68a15fd5 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -237,7 +237,7 @@ void SwHTMLWriter::SetupFilterOptions(std::u16string_view rFilterOptions) const uno::Sequence<OUString> aOptionSeq = comphelper::string::convertCommaSeparated(rFilterOptions); - static const OUStringLiteral aXhtmlNsKey(u"xhtmlns="); + static constexpr OUStringLiteral aXhtmlNsKey(u"xhtmlns="); for (const auto& rOption : aOptionSeq) { if (rOption == "XHTML") diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index a5f1d6892fbb..894b76f94891 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -2295,7 +2295,7 @@ eF_ResT SwWW8ImplReader::Read_F_PgRef( WW8FieldDesc*, OUString& rStr ) } OUString sURL = "#" + sBookmarkName; SwFormatINetFormat aURL( sURL, "" ); - static const OUStringLiteral sLinkStyle(u"Index Link"); + static constexpr OUStringLiteral sLinkStyle(u"Index Link"); const sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( sLinkStyle, SwGetPoolIdFromName::ChrFmt ); aURL.SetVisitedFormatAndId( sLinkStyle, nPoolId); diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx index f8a271825d39..09d34d2b893b 100644 --- a/sw/source/filter/ww8/ww8toolbar.cxx +++ b/sw/source/filter/ww8/ww8toolbar.cxx @@ -265,7 +265,7 @@ bool Customization::ImportMenu( SwCTBWrapper& rWrapper, CustomToolBarImportHelpe if ( pCust ) { // currently only support built-in menu - static const OUStringLiteral sMenuBar( u"private:resource/menubar/menubar" ); + static constexpr OUStringLiteral sMenuBar( u"private:resource/menubar/menubar" ); // Get menu name SwTBC* pTBC = m_pWrapper->GetTBCAtOffset( rTBDelta.TBCStreamOffset() ); diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index b679f111a3b6..d6496e779299 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -604,7 +604,7 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con if( xParentSet.is() ) { uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xParentSet->getPropertySetInfo() ); - static const OUStringLiteral sPropName(u"BuildId" ); + static constexpr OUStringLiteral sPropName(u"BuildId" ); if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(sPropName) ) { xInfoSet->setPropertyValue( sPropName, xParentSet->getPropertyValue(sPropName) ); @@ -742,9 +742,9 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con ErrCode nRet = ERRCODE_NONE; // save redline mode into import info property set - static const OUStringLiteral sShowChanges(u"ShowChanges"); - static const OUStringLiteral sRecordChanges(u"RecordChanges"); - static const OUStringLiteral sRedlineProtectionKey(u"RedlineProtectionKey"); + static constexpr OUStringLiteral sShowChanges(u"ShowChanges"); + static constexpr OUStringLiteral sRecordChanges(u"RecordChanges"); + static constexpr OUStringLiteral sRedlineProtectionKey(u"RedlineProtectionKey"); xInfoSet->setPropertyValue( sShowChanges, Any(IDocumentRedlineAccess::IsShowChanges(rDoc.getIDocumentRedlineAccess().GetRedlineFlags())) ); xInfoSet->setPropertyValue( sRecordChanges, @@ -950,7 +950,7 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con if( xModelSet.is() ) { uno::Reference< beans::XPropertySetInfo > xModelSetInfo( xModelSet->getPropertySetInfo() ); - static const OUStringLiteral sName(u"BuildId" ); + static constexpr OUStringLiteral sName(u"BuildId" ); if( xModelSetInfo.is() && xModelSetInfo->hasPropertyByName(sName) ) { xModelSet->setPropertyValue( sName, xInfoSet->getPropertyValue(sName) ); @@ -983,7 +983,7 @@ size_t XMLReader::GetSectionList( SfxMedium& rMedium, try { xml::sax::InputSource aParserInput; - static const OUStringLiteral sDocName( u"content.xml" ); + static constexpr OUStringLiteral sDocName( u"content.xml" ); aParserInput.sSystemId = sDocName; uno::Reference < io::XStream > xStm = xStg2->openStreamElement( sDocName, embed::ElementModes::READ ); diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index 693c2b7c6b7b..689206c9e92d 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -107,7 +107,7 @@ ErrCode SwXMLExport::exportDoc( enum XMLTokenEnum eClass ) Reference<XPropertySet> rInfoSet = getExportInfo(); if( rInfoSet.is() ) { - static const OUStringLiteral sAutoTextMode(u"AutoTextMode"); + static constexpr OUStringLiteral sAutoTextMode(u"AutoTextMode"); if( rInfoSet->getPropertySetInfo()->hasPropertyByName( sAutoTextMode ) ) { @@ -369,7 +369,7 @@ void SwXMLExport::GetViewSettings(Sequence<PropertyValue>& aProps) Reference<XPropertySet> xInfoSet( getExportInfo() ); if ( xInfoSet.is() ) { - static const OUStringLiteral sShowChanges( u"ShowChanges" ); + static constexpr OUStringLiteral sShowChanges( u"ShowChanges" ); if( xInfoSet->getPropertySetInfo()->hasPropertyByName( sShowChanges ) ) { bShowRedlineChanges = *o3tl::doAccess<bool>(xInfoSet-> diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 43fe07ecff4a..4287a6848f4c 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -417,7 +417,7 @@ void SwXMLImport::startDocument() } bool bOverwrite = false; - static const OUStringLiteral sStyleInsertModeOverwrite(u"StyleInsertModeOverwrite"); + static constexpr OUStringLiteral sStyleInsertModeOverwrite(u"StyleInsertModeOverwrite"); if( xPropertySetInfo->hasPropertyByName(sStyleInsertModeOverwrite) ) { aAny = xImportInfo->getPropertyValue(sStyleInsertModeOverwrite); @@ -433,7 +433,7 @@ void SwXMLImport::startDocument() } // text insert mode? - static const OUStringLiteral sTextInsertModeRange(u"TextInsertModeRange"); + static constexpr OUStringLiteral sTextInsertModeRange(u"TextInsertModeRange"); if( xPropertySetInfo->hasPropertyByName(sTextInsertModeRange) ) { aAny = xImportInfo->getPropertyValue(sTextInsertModeRange); @@ -443,7 +443,7 @@ void SwXMLImport::startDocument() } // auto text mode - static const OUStringLiteral sAutoTextMode(u"AutoTextMode"); + static constexpr OUStringLiteral sAutoTextMode(u"AutoTextMode"); if( xPropertySetInfo->hasPropertyByName(sAutoTextMode) ) { aAny = xImportInfo->getPropertyValue(sAutoTextMode); @@ -455,7 +455,7 @@ void SwXMLImport::startDocument() } // organizer mode - static const OUStringLiteral sOrganizerMode(u"OrganizerMode"); + static constexpr OUStringLiteral sOrganizerMode(u"OrganizerMode"); if( xPropertySetInfo->hasPropertyByName(sOrganizerMode) ) { aAny = xImportInfo->getPropertyValue(sOrganizerMode); @@ -467,7 +467,7 @@ void SwXMLImport::startDocument() } // default document properties - static const OUStringLiteral sDefSettings(u"DefaultDocumentSettings"); + static constexpr OUStringLiteral sDefSettings(u"DefaultDocumentSettings"); if (xPropertySetInfo->hasPropertyByName(sDefSettings)) { aAny = xImportInfo->getPropertyValue(sDefSettings); diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index f596caca73e5..eb45452c2245 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -315,7 +315,7 @@ SwMailMergeDlg::SwMailMergeDlg(weld::Window* pParent, SwWrtShell& rShell, + OUString::number(static_cast<sal_Int32>(SfxFilterFlags::NOTINFILEDLG)) + ":default_first"); uno::Reference< container::XEnumeration > xList = xQuery->createSubSetEnumerationByQuery(sCommand); - static const OUStringLiteral sName(u"Name"); + static constexpr OUStringLiteral sName(u"Name"); sal_Int32 nODT = -1; while(xList->hasMoreElements()) { comphelper::SequenceAsHashMap aFilter(xList->nextElement()); diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx index 202a6222089c..ed74973a1b84 100644 --- a/sw/source/ui/misc/glosbib.cxx +++ b/sw/source/ui/misc/glosbib.cxx @@ -90,7 +90,7 @@ SwGlossaryGroupDlg::SwGlossaryGroupDlg(weld::Window * pParent, const size_t nCount = pHdl->GetGroupCnt(); /* tdf#111870 "My AutoText" comes from mytexts.bau but should be translated here as well, see also SwGlossaryDlg::Init */ - static const OUStringLiteral sMyAutoTextEnglish(u"My AutoText"); + static constexpr OUStringLiteral sMyAutoTextEnglish(u"My AutoText"); for( size_t i = 0; i < nCount; ++i) { OUString sTitle; diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 12145f1e74ed..c7183d5126e1 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -807,7 +807,7 @@ void SwGlossaryDlg::Init() const OUString sSelStr(::GetCurrGlosGroup().getToken(0, GLOS_DELIM)); const sal_Int32 nSelPath = o3tl::toInt32(o3tl::getToken(::GetCurrGlosGroup(), 1, GLOS_DELIM)); // #i66304# - "My AutoText" comes from mytexts.bau, but should be translated - static const OUStringLiteral sMyAutoTextEnglish(u"My AutoText"); + static constexpr OUStringLiteral sMyAutoTextEnglish(u"My AutoText"); const OUString sMyAutoTextTranslated(SwResId(STR_MY_AUTOTEXT)); for(size_t nId = 0; nId < nCnt; ++nId ) { diff --git a/sw/source/ui/vba/vbaparagraphformat.cxx b/sw/source/ui/vba/vbaparagraphformat.cxx index c70478171cb2..1e08c8f1246a 100644 --- a/sw/source/ui/vba/vbaparagraphformat.cxx +++ b/sw/source/ui/vba/vbaparagraphformat.cxx @@ -184,7 +184,7 @@ sal_Int32 SAL_CALL SwVbaParagraphFormat::getOutlineLevel() { sal_Int32 nLevel = word::WdOutlineLevel::wdOutlineLevelBodyText; OUString aHeading; - static const OUStringLiteral HEADING = u"Heading"; + static constexpr OUStringLiteral HEADING = u"Heading"; mxParaProps->getPropertyValue("ParaStyleName") >>= aHeading; if( aHeading.startsWith( HEADING ) ) { diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index c78966a762e6..fe6835f9d8d4 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -985,7 +985,7 @@ OUString SwDocStyleSheet::GetDescription(MapUnit eUnit) { IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag()); - static const OUStringLiteral sPlus(u" + "); + static constexpr OUStringLiteral sPlus(u" + "); if ( SfxStyleFamily::Page == nFamily ) { if( !pSet ) diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx index 219b02cbca70..e97d1bdcbef8 100644 --- a/sw/source/uibase/shells/langhelper.cxx +++ b/sw/source/uibase/shells/langhelper.cxx @@ -121,9 +121,9 @@ namespace SwLangHelper // setting the new language... if (!aNewLangText.isEmpty()) { - static const OUStringLiteral aSelectionLangPrefix(u"Current_"); - static const OUStringLiteral aParagraphLangPrefix(u"Paragraph_"); - static const OUStringLiteral aDocumentLangPrefix(u"Default_"); + static constexpr OUStringLiteral aSelectionLangPrefix(u"Current_"); + static constexpr OUStringLiteral aParagraphLangPrefix(u"Paragraph_"); + static constexpr OUStringLiteral aDocumentLangPrefix(u"Default_"); sal_Int32 nPos = 0; bool bForSelection = true; diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 02f4fced8aa9..e5c2416a9cbe 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -860,9 +860,9 @@ void SwTextShell::Execute(SfxRequest &rReq) // setting the new language... if (!aNewLangText.isEmpty()) { - static const OUStringLiteral aSelectionLangPrefix(u"Current_"); - static const OUStringLiteral aParagraphLangPrefix(u"Paragraph_"); - static const OUStringLiteral aDocumentLangPrefix(u"Default_"); + static constexpr OUStringLiteral aSelectionLangPrefix(u"Current_"); + static constexpr OUStringLiteral aParagraphLangPrefix(u"Paragraph_"); + static constexpr OUStringLiteral aDocumentLangPrefix(u"Default_"); SfxItemSetFixed <RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE, @@ -2071,8 +2071,8 @@ void SwTextShell::Execute(SfxRequest &rReq) if (pItem2) sApplyText = pItem2->GetValue(); - static const OUStringLiteral sSpellingRule(u"Spelling_"); - static const OUStringLiteral sGrammarRule(u"Grammar_"); + static constexpr OUStringLiteral sSpellingRule(u"Spelling_"); + static constexpr OUStringLiteral sGrammarRule(u"Grammar_"); bool bGrammar = false; sal_Int32 nPos = 0; @@ -2442,8 +2442,8 @@ void SwTextShell::GetState( SfxItemSet &rSet ) OUString aStyleName; std::vector<OUString> aList; - static const OUStringLiteral sPhysical(u"IsPhysical"); - static const OUStringLiteral sDisplay(u"DisplayName"); + static constexpr OUStringLiteral sPhysical(u"IsPhysical"); + static constexpr OUStringLiteral sDisplay(u"DisplayName"); const OUString sHeaderOn(nWhich == FN_INSERT_PAGEHEADER ? OUString("HeaderIsOn") : OUString("FooterIsOn")); uno::Reference< XStyleFamiliesSupplier > xSupplier(GetView().GetDocShell()->GetBaseModel(), uno::UNO_QUERY); diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx index 7399f71f5c44..e06c5bbf803b 100644 --- a/sw/source/uibase/uno/unomailmerge.cxx +++ b/sw/source/uibase/uno/unomailmerge.cxx @@ -718,7 +718,7 @@ uno::Any SAL_CALL SwXMailMerge::execute( aURLObj.SetSmartURL( aCurOutputURL ); OUString aPath = aURLObj.GetMainURL( INetURLObject::DecodeMechanism::ToIUri ); - static const OUStringLiteral aDelim( u"/" ); + static constexpr OUStringLiteral aDelim( u"/" ); if (!aPath.isEmpty() && !aPath.endsWith(aDelim)) aPath += aDelim; if (bCurFileNameFromColumn) diff --git a/test/source/sheet/cellarealink.cxx b/test/source/sheet/cellarealink.cxx index bfaf4c3fe99b..412d1b6260e3 100644 --- a/test/source/sheet/cellarealink.cxx +++ b/test/source/sheet/cellarealink.cxx @@ -22,7 +22,7 @@ void CellAreaLink::testUrl() { uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW); - static const OUStringLiteral propName(u"Url"); + static constexpr OUStringLiteral propName(u"Url"); OUString aUrl; CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aUrl); @@ -39,7 +39,7 @@ void CellAreaLink::testFilter() { uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW); - static const OUStringLiteral propName(u"Filter"); + static constexpr OUStringLiteral propName(u"Filter"); OUString aFilter; CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aFilter); @@ -56,7 +56,7 @@ void CellAreaLink::testFilterOptions() { uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW); - static const OUStringLiteral propName(u"FilterOptions"); + static constexpr OUStringLiteral propName(u"FilterOptions"); OUString aFilterOptions; CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aFilterOptions); @@ -75,7 +75,7 @@ void CellAreaLink::testRefreshDelay() { uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW); - static const OUStringLiteral propName(u"RefreshDelay"); + static constexpr OUStringLiteral propName(u"RefreshDelay"); sal_Int32 aRefreshDelay = 0; CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aRefreshDelay); @@ -94,7 +94,7 @@ void CellAreaLink::testRefreshPeriod() { uno::Reference<beans::XPropertySet> xCellAreaLink(init(), uno::UNO_QUERY_THROW); - static const OUStringLiteral propName(u"RefreshPeriod"); + static constexpr OUStringLiteral propName(u"RefreshPeriod"); sal_Int32 aRefreshPeriod = 0; CPPUNIT_ASSERT(xCellAreaLink->getPropertyValue(propName) >>= aRefreshPeriod); diff --git a/test/source/sheet/databaserange.cxx b/test/source/sheet/databaserange.cxx index d87e3723ce3b..a9e316be7ce3 100644 --- a/test/source/sheet/databaserange.cxx +++ b/test/source/sheet/databaserange.cxx @@ -26,7 +26,7 @@ void DatabaseRange::testMoveCells() { uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); - static const OUStringLiteral propName(u"MoveCells"); + static constexpr OUStringLiteral propName(u"MoveCells"); bool bMoveCells = true; CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bMoveCells); @@ -43,7 +43,7 @@ void DatabaseRange::testKeepFormats() { uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); - static const OUStringLiteral propName(u"KeepFormats"); + static constexpr OUStringLiteral propName(u"KeepFormats"); bool bKeepFormats = true; CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bKeepFormats); @@ -60,7 +60,7 @@ void DatabaseRange::testStripData() { uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); - static const OUStringLiteral propName(u"StripData"); + static constexpr OUStringLiteral propName(u"StripData"); bool bStripData = true; CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bStripData); @@ -77,7 +77,7 @@ void DatabaseRange::testAutoFilter() { uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); - static const OUStringLiteral propName(u"AutoFilter"); + static constexpr OUStringLiteral propName(u"AutoFilter"); bool bAutoFilter = true; CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bAutoFilter); @@ -94,7 +94,7 @@ void DatabaseRange::testUseFilterCriteriaSource() { uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); - static const OUStringLiteral propName(u"UseFilterCriteriaSource"); + static constexpr OUStringLiteral propName(u"UseFilterCriteriaSource"); bool bUseFilterCriteriaSource = true; CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bUseFilterCriteriaSource); @@ -113,7 +113,7 @@ void DatabaseRange::testFilterCriteriaSource() { uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); - static const OUStringLiteral propName(u"FilterCriteriaSource"); + static constexpr OUStringLiteral propName(u"FilterCriteriaSource"); table::CellRangeAddress cellRangeAddress; CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= cellRangeAddress); @@ -132,7 +132,7 @@ void DatabaseRange::testRefreshPeriod() { uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); - static const OUStringLiteral propName(u"RefreshPeriod"); + static constexpr OUStringLiteral propName(u"RefreshPeriod"); sal_Int32 aRefreshPeriod = 1; CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= aRefreshPeriod); @@ -151,7 +151,7 @@ void DatabaseRange::testFromSelection() { uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); - static const OUStringLiteral propName(u"FromSelection"); + static constexpr OUStringLiteral propName(u"FromSelection"); bool bFromSelection = true; CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bFromSelection); @@ -168,7 +168,7 @@ void DatabaseRange::testTokenIndex() { uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); - static const OUStringLiteral propName(u"TokenIndex"); + static constexpr OUStringLiteral propName(u"TokenIndex"); sal_Int32 aTokenIndex = 0; CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= aTokenIndex); @@ -185,7 +185,7 @@ void DatabaseRange::testTotalsRow() { uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); - static const OUStringLiteral propName(u"TotalsRow"); + static constexpr OUStringLiteral propName(u"TotalsRow"); bool bTotalsRow = true; CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bTotalsRow); @@ -202,7 +202,7 @@ void DatabaseRange::testContainsHeader() { uno::Reference<beans::XPropertySet> xDatabaseRange(init("DataArea"), UNO_QUERY_THROW); - static const OUStringLiteral propName(u"ContainsHeader"); + static constexpr OUStringLiteral propName(u"ContainsHeader"); bool bContainsHeader = false; CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bContainsHeader); diff --git a/test/source/sheet/datapilotitem.cxx b/test/source/sheet/datapilotitem.cxx index bfbe2110afec..625b1e634807 100644 --- a/test/source/sheet/datapilotitem.cxx +++ b/test/source/sheet/datapilotitem.cxx @@ -24,7 +24,7 @@ void DataPilotItem::testProperties() { uno::Reference<beans::XPropertySet> xItem(init(), UNO_QUERY_THROW); - static const OUStringLiteral propNameIS(u"IsHidden"); + static constexpr OUStringLiteral propNameIS(u"IsHidden"); bool bIsHidden = true; CPPUNIT_ASSERT(xItem->getPropertyValue(propNameIS) >>= bIsHidden); @@ -36,7 +36,7 @@ void DataPilotItem::testProperties() CPPUNIT_ASSERT(xItem->getPropertyValue(propNameIS) >>= bIsHidden); CPPUNIT_ASSERT_MESSAGE("Value of IsHidden wasn't changed", !bIsHidden); - static const OUStringLiteral propNameSD(u"ShowDetail"); + static constexpr OUStringLiteral propNameSD(u"ShowDetail"); bool bShowDetail = false; CPPUNIT_ASSERT(xItem->getPropertyValue(propNameSD) >>= bShowDetail); diff --git a/test/source/sheet/xarrayformularange.cxx b/test/source/sheet/xarrayformularange.cxx index f7f30a1af73e..55372e18589c 100644 --- a/test/source/sheet/xarrayformularange.cxx +++ b/test/source/sheet/xarrayformularange.cxx @@ -27,7 +27,7 @@ void XArrayFormulaRange::testGetSetArrayFormula() { uno::Reference<sheet::XArrayFormulaRange> xAFR(init(), UNO_QUERY_THROW); - static const OUStringLiteral sFormula(u"=1 + 2 * 5"); + static constexpr OUStringLiteral sFormula(u"=1 + 2 * 5"); xAFR->setArrayFormula(sFormula); uno::Reference<sheet::XCellRangeAddressable> xCRA(xAFR, UNO_QUERY_THROW); diff --git a/test/source/sheet/xspreadsheets2.cxx b/test/source/sheet/xspreadsheets2.cxx index 3bd539710480..c783d7f6b565 100644 --- a/test/source/sheet/xspreadsheets2.cxx +++ b/test/source/sheet/xspreadsheets2.cxx @@ -243,7 +243,7 @@ void XSpreadsheets2::testImportCellStyle() //new style created in dest uno::Reference< beans::XPropertySet > xSrcCellPropSet (xSrcCell, UNO_QUERY_THROW); - static const OUStringLiteral aCellProperty(u"CellStyle"); + static constexpr OUStringLiteral aCellProperty(u"CellStyle"); OUString aSrcStyleName; CPPUNIT_ASSERT(xSrcCellPropSet->getPropertyValue(aCellProperty) >>= aSrcStyleName); diff --git a/test/source/text/textsettings.cxx b/test/source/text/textsettings.cxx index 112fc939dee9..2003156074b3 100644 --- a/test/source/text/textsettings.cxx +++ b/test/source/text/textsettings.cxx @@ -44,7 +44,7 @@ bool isPropertyReadOnly(css::uno::Reference<css::beans::XPropertySet> const& rxP // [property] string PrinterName; void testPrinterName(css::uno::Reference<css::beans::XPropertySet> const& rxSettings) { - static const OUStringLiteral rPropertyName(u"PrinterName"); + static constexpr OUStringLiteral rPropertyName(u"PrinterName"); if (!extstsProperty(rxSettings, rPropertyName)) return; // Property is sometimes not set - bug? it is not defined as optional @@ -67,7 +67,7 @@ void testPrinterName(css::uno::Reference<css::beans::XPropertySet> const& rxSett // [optional, property] short PrinterIndependentLayout; void testPrinterIndependentLayout(css::uno::Reference<css::beans::XPropertySet> const& rxSettings) { - static const OUStringLiteral rPropertyName(u"PrinterIndependentLayout"); + static constexpr OUStringLiteral rPropertyName(u"PrinterIndependentLayout"); if (!extstsProperty(rxSettings, rPropertyName)) return; // Property is optional @@ -91,7 +91,7 @@ void testPrinterIndependentLayout(css::uno::Reference<css::beans::XPropertySet> // [optional, property] com::sun::star::i18n::XForbiddenCharacters ForbiddenCharacters; void testForbiddenCharacters(css::uno::Reference<css::beans::XPropertySet> const& rxSettings) { - static const OUStringLiteral rPropertyName(u"ForbiddenCharacters"); + static constexpr OUStringLiteral rPropertyName(u"ForbiddenCharacters"); if (!extstsProperty(rxSettings, rPropertyName)) return; // Property is optional diff --git a/ucb/source/core/ucbcmds.cxx b/ucb/source/core/ucbcmds.cxx index b0264080de00..8b95f48c0702 100644 --- a/ucb/source/core/ucbcmds.cxx +++ b/ucb/source/core/ucbcmds.cxx @@ -1501,7 +1501,7 @@ void globalTransfer_( 0, rContext.xEnv ); - static const OUStringLiteral cmdName(u"flush"); + static constexpr OUStringLiteral cmdName(u"flush"); if((aAny >>= xci) && xci->hasCommandByName(cmdName)) xcp->execute( ucb::Command( diff --git a/ucb/source/core/ucbstore.cxx b/ucb/source/core/ucbstore.cxx index 1aae1235c0f0..a06e430c3586 100644 --- a/ucb/source/core/ucbstore.cxx +++ b/ucb/source/core/ucbstore.cxx @@ -1670,9 +1670,9 @@ Sequence< PropertyValue > SAL_CALL PersistentPropertySet::getPropertyValues() Sequence< PropertyValue > aValues( nCount ); auto pValues = aValues.getArray(); - static const OUStringLiteral aHandleName(u"/Handle"); - static const OUStringLiteral aValueName(u"/Value"); - static const OUStringLiteral aStateName(u"/State"); + static constexpr OUStringLiteral aHandleName(u"/Handle"); + static constexpr OUStringLiteral aValueName(u"/Value"); + static constexpr OUStringLiteral aStateName(u"/State"); for ( sal_Int32 n = 0; n < nCount; ++n ) { @@ -1981,9 +1981,9 @@ Sequence< Property > SAL_CALL PropertySetInfo_Impl::getProperties() if ( xHierNameAccess.is() ) { - static const OUStringLiteral aHandleName(u"/Handle"); - static const OUStringLiteral aValueName(u"/Value"); - static const OUStringLiteral aAttrName(u"/Attributes"); + static constexpr OUStringLiteral aHandleName(u"/Handle"); + static constexpr OUStringLiteral aValueName(u"/Value"); + static constexpr OUStringLiteral aAttrName(u"/Attributes"); Property* pProps = aPropSeq.getArray(); diff --git a/ucb/source/ucp/ext/ucpext_provider.cxx b/ucb/source/ucp/ext/ucpext_provider.cxx index faf96540675a..c35c54220fa3 100644 --- a/ucb/source/ucp/ext/ucpext_provider.cxx +++ b/ucb/source/ucp/ext/ucpext_provider.cxx @@ -93,7 +93,7 @@ namespace ucb::ucp::ext Reference< XContent > SAL_CALL ContentProvider::queryContent( const Reference< XContentIdentifier >& i_rIdentifier ) { // Check URL scheme... - static const OUStringLiteral sScheme( u"vnd.sun.star.extension" ); + static constexpr OUStringLiteral sScheme( u"vnd.sun.star.extension" ); if ( !i_rIdentifier->getContentProviderScheme().equalsIgnoreAsciiCase( sScheme ) ) throw IllegalIdentifierException(); diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx index 9b0618690331..c5e47c6b0b55 100644 --- a/ucb/source/ucp/file/bc.cxx +++ b/ucb/source/ucp/file/bc.cxx @@ -685,7 +685,7 @@ BaseContent::setPropertyValues( return Sequence< Any >( Values.getLength() ); } - static const OUStringLiteral Title(u"Title"); + static constexpr OUStringLiteral Title(u"Title"); // Special handling for files which have to be inserted if( m_nState & JustInserted ) diff --git a/unodevtools/source/unodevtools/options.cxx b/unodevtools/source/unodevtools/options.cxx index bf465af09f51..4d0c3a51cd7c 100644 --- a/unodevtools/source/unodevtools/options.cxx +++ b/unodevtools/source/unodevtools/options.cxx @@ -31,7 +31,7 @@ namespace unodevtools { bool readOption( OUString * pValue, const char * pOpt, sal_uInt32 * pnIndex, std::u16string_view aArg) { - static const OUStringLiteral dash = u"-"; + static constexpr OUStringLiteral dash = u"-"; if(aArg.find(dash) != 0) return false; diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index b894395e4660..328a03340c97 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -1715,7 +1715,7 @@ JSMessageDialog::~JSMessageDialog() void JSMessageDialog::RememberMessageDialog() { - static OUStringLiteral sWidgetName = u"__DIALOG__"; + static constexpr OUStringLiteral sWidgetName = u"__DIALOG__"; OUString sWindowId = OUString::number(m_xMessageDialog->GetLOKWindowId()); if (JSInstanceBuilder::FindWeldWidgetsMap(sWindowId, sWidgetName) != nullptr) return; diff --git a/vcl/source/image/ImplImageTree.cxx b/vcl/source/image/ImplImageTree.cxx index bdd4fcedfda5..a178211dbb2c 100644 --- a/vcl/source/image/ImplImageTree.cxx +++ b/vcl/source/image/ImplImageTree.cxx @@ -578,7 +578,7 @@ bool ImplImageTree::findImage(std::vector<OUString> const & rPaths, ImageRequest void ImplImageTree::loadImageLinks() { - static const OUStringLiteral aLinkFilename(u"links.txt"); + static constexpr OUStringLiteral aLinkFilename(u"links.txt"); if (!checkPathAccess()) return; diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx index 1fd9df908854..54f2381b8aa4 100644 --- a/vcl/source/treelist/transfer.cxx +++ b/vcl/source/treelist/transfer.cxx @@ -164,14 +164,14 @@ static void ImplSetParameterString( TransferableObjectDescriptor& rObjDesc, cons if( xMimeType.is() ) { - static const OUStringLiteral aClassNameString( u"classname" ); - static const OUStringLiteral aTypeNameString( u"typename" ); - static const OUStringLiteral aDisplayNameString( u"displayname" ); - static const OUStringLiteral aViewAspectString( u"viewaspect" ); - static const OUStringLiteral aWidthString( u"width" ); - static const OUStringLiteral aHeightString( u"height" ); - static const OUStringLiteral aPosXString( u"posx" ); - static const OUStringLiteral aPosYString( u"posy" ); + static constexpr OUStringLiteral aClassNameString( u"classname" ); + static constexpr OUStringLiteral aTypeNameString( u"typename" ); + static constexpr OUStringLiteral aDisplayNameString( u"displayname" ); + static constexpr OUStringLiteral aViewAspectString( u"viewaspect" ); + static constexpr OUStringLiteral aWidthString( u"width" ); + static constexpr OUStringLiteral aHeightString( u"height" ); + static constexpr OUStringLiteral aPosXString( u"posx" ); + static constexpr OUStringLiteral aPosYString( u"posy" ); if( xMimeType->hasParameter( aClassNameString ) ) { @@ -1173,7 +1173,7 @@ void TransferableDataHelper::FillDataFlavorExVector( const Sequence< DataFlavor Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); Reference< XMimeContentTypeFactory > xMimeFact = MimeContentTypeFactory::create( xContext ); DataFlavorEx aFlavorEx; - static const OUStringLiteral aCharsetStr( u"charset" ); + static constexpr OUStringLiteral aCharsetStr( u"charset" ); for (auto const& rFlavor : rDataFlavorSeq) @@ -2178,7 +2178,7 @@ bool TransferableDataHelper::IsEqual( const css::datatransfer::DataFlavor& rInte if( xRequestType1->getFullMediaType().equalsIgnoreAsciiCase( "text/plain" ) ) { // special handling for text/plain media types - static const OUStringLiteral aCharsetString( u"charset" ); + static constexpr OUStringLiteral aCharsetString( u"charset" ); if( !xRequestType2->hasParameter( aCharsetString ) || xRequestType2->getParameterValue( aCharsetString ).equalsIgnoreAsciiCase( "utf-16" ) || @@ -2190,7 +2190,7 @@ bool TransferableDataHelper::IsEqual( const css::datatransfer::DataFlavor& rInte else if( xRequestType1->getFullMediaType().equalsIgnoreAsciiCase( "application/x-openoffice" ) ) { // special handling for application/x-openoffice media types - static const OUStringLiteral aFormatString( u"windows_formatname" ); + static constexpr OUStringLiteral aFormatString( u"windows_formatname" ); if( xRequestType1->hasParameter( aFormatString ) && xRequestType2->hasParameter( aFormatString ) && diff --git a/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx b/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx index 733fef6b1db6..97a19ef8da68 100644 --- a/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx @@ -74,7 +74,7 @@ CPPUNIT_TEST_FIXTURE(Test, testNumberingRestartStyleParent) uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); uno::Reference<beans::XPropertySet> xPara; - static OUStringLiteral aProp(u"ListLabelString"); + static constexpr OUStringLiteral aProp(u"ListLabelString"); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("A."), xPara->getPropertyValue(aProp).get<OUString>()); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); diff --git a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx index a737255595d5..0db3eee44304 100644 --- a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx @@ -128,46 +128,46 @@ bool OOXMLStreamImpl::lcl_getTarget(const uno::Reference<embed::XRelationshipAcc uno::Reference<uri::XUriReference> xBase = xFac->parse("file:///" + msPath); static const char sType[] = "Type"; - static const OUStringLiteral sDocumentType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; - static const OUStringLiteral sStylesType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; - static const OUStringLiteral sNumberingType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering"; - static const OUStringLiteral sFonttableType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable"; - static const OUStringLiteral sFootnotesType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes"; - static const OUStringLiteral sEndnotesType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes"; - static const OUStringLiteral sCommentsType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"; - static const OUStringLiteral sThemeType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"; - static const OUStringLiteral sCustomType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml"; - static const OUStringLiteral sCustomPropsType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps"; - static const OUStringLiteral sGlossaryType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument"; - static const OUStringLiteral sWebSettings = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings"; - static const OUStringLiteral sSettingsType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"; - static const OUStringLiteral sChartType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"; - static const OUStringLiteral sEmbeddingsType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"; - static const OUStringLiteral sFooterType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer"; - static const OUStringLiteral sHeaderType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header"; - static const OUStringLiteral sOleObjectType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"; - static const OUStringLiteral sCommentsExtendedType = u"http://schemas.microsoft.com/office/2011/relationships/commentsExtended"; + static constexpr OUStringLiteral sDocumentType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; + static constexpr OUStringLiteral sStylesType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; + static constexpr OUStringLiteral sNumberingType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering"; + static constexpr OUStringLiteral sFonttableType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable"; + static constexpr OUStringLiteral sFootnotesType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes"; + static constexpr OUStringLiteral sEndnotesType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes"; + static constexpr OUStringLiteral sCommentsType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"; + static constexpr OUStringLiteral sThemeType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"; + static constexpr OUStringLiteral sCustomType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml"; + static constexpr OUStringLiteral sCustomPropsType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps"; + static constexpr OUStringLiteral sGlossaryType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument"; + static constexpr OUStringLiteral sWebSettings = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings"; + static constexpr OUStringLiteral sSettingsType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"; + static constexpr OUStringLiteral sChartType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"; + static constexpr OUStringLiteral sEmbeddingsType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"; + static constexpr OUStringLiteral sFooterType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer"; + static constexpr OUStringLiteral sHeaderType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header"; + static constexpr OUStringLiteral sOleObjectType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"; + static constexpr OUStringLiteral sCommentsExtendedType = u"http://schemas.microsoft.com/office/2011/relationships/commentsExtended"; // OOXML strict - static const OUStringLiteral sDocumentTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/officeDocument"; - static const OUStringLiteral sStylesTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/styles"; - static const OUStringLiteral sNumberingTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/numbering"; - static const OUStringLiteral sFonttableTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/fontTable"; - static const OUStringLiteral sFootnotesTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/footnotes"; - static const OUStringLiteral sEndnotesTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/endnotes"; - static const OUStringLiteral sCommentsTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/comments"; - static const OUStringLiteral sThemeTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/theme"; - static const OUStringLiteral sCustomTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/customXml"; - static const OUStringLiteral sCustomPropsTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/customXmlProps"; - static const OUStringLiteral sGlossaryTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/glossaryDocument"; - static const OUStringLiteral sWebSettingsStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/webSettings"; - static const OUStringLiteral sSettingsTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/settings"; - static const OUStringLiteral sChartTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/chart"; - static const OUStringLiteral sEmbeddingsTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/package"; - static const OUStringLiteral sFootersTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/footer"; - static const OUStringLiteral sHeaderTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/header"; - static const OUStringLiteral sOleObjectTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/oleObject"; - static const OUStringLiteral sVBAProjectType = u"http://schemas.microsoft.com/office/2006/relationships/vbaProject"; - static const OUStringLiteral sVBADataType = u"http://schemas.microsoft.com/office/2006/relationships/wordVbaData"; + static constexpr OUStringLiteral sDocumentTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/officeDocument"; + static constexpr OUStringLiteral sStylesTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/styles"; + static constexpr OUStringLiteral sNumberingTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/numbering"; + static constexpr OUStringLiteral sFonttableTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/fontTable"; + static constexpr OUStringLiteral sFootnotesTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/footnotes"; + static constexpr OUStringLiteral sEndnotesTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/endnotes"; + static constexpr OUStringLiteral sCommentsTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/comments"; + static constexpr OUStringLiteral sThemeTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/theme"; + static constexpr OUStringLiteral sCustomTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/customXml"; + static constexpr OUStringLiteral sCustomPropsTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/customXmlProps"; + static constexpr OUStringLiteral sGlossaryTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/glossaryDocument"; + static constexpr OUStringLiteral sWebSettingsStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/webSettings"; + static constexpr OUStringLiteral sSettingsTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/settings"; + static constexpr OUStringLiteral sChartTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/chart"; + static constexpr OUStringLiteral sEmbeddingsTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/package"; + static constexpr OUStringLiteral sFootersTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/footer"; + static constexpr OUStringLiteral sHeaderTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/header"; + static constexpr OUStringLiteral sOleObjectTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/oleObject"; + static constexpr OUStringLiteral sVBAProjectType = u"http://schemas.microsoft.com/office/2006/relationships/vbaProject"; + static constexpr OUStringLiteral sVBADataType = u"http://schemas.microsoft.com/office/2006/relationships/wordVbaData"; OUString sStreamType; OUString sStreamTypeStrict; diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx index 5304f43ab014..b559d5f075e0 100644 --- a/xmloff/source/chart/SchXMLSeries2Context.cxx +++ b/xmloff/source/chart/SchXMLSeries2Context.cxx @@ -886,7 +886,7 @@ void SchXMLSeries2Context::setStylesToSeries( SeriesDefaultsAndStyles& rSeriesDe // this property) bool bHasErrorBarRangesFromData = false; { - static const OUStringLiteral aErrorBarStylePropName( u"ErrorBarStyle"); + static constexpr OUStringLiteral aErrorBarStylePropName( u"ErrorBarStyle"); uno::Any aErrorBarStyle( SchXMLTools::getPropertyFromContext( aErrorBarStylePropName, pPropStyleContext, pStylesCtxt )); if( aErrorBarStyle.hasValue()) diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx index 27ae7311364c..b12f5886e69b 100644 --- a/xmloff/source/chart/SchXMLTableContext.cxx +++ b/xmloff/source/chart/SchXMLTableContext.cxx @@ -104,7 +104,7 @@ void lcl_fillRangeMapping( sal_Int32 nColOffset = ( rTable.bHasHeaderColumn ? 1 : 0 ); const OUString lcl_aCategoriesRange(aCategoriesRange); - static const OUStringLiteral lcl_aLabelPrefix(u"label "); + static constexpr OUStringLiteral lcl_aLabelPrefix(u"label "); // Fill range mapping const size_t nTableRowCount( rTable.aData.size()); diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index b6299a4b0ed7..ff344f164edc 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -91,7 +91,7 @@ sal_Int32 lcl_getBuildIDFromGenerator( std::u16string_view rGenerator ) { //returns -1 if nothing found sal_Int32 nBuildId = -1; - static const OUStringLiteral sBuildCompare( u"$Build-" ); + static constexpr OUStringLiteral sBuildCompare( u"$Build-" ); size_t nBegin = rGenerator.find( sBuildCompare ); if( nBegin != std::u16string_view::npos ) { @@ -632,7 +632,7 @@ void setXMLRangePropertyAtDataSequence( return; 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 )) @@ -654,7 +654,7 @@ bool getXMLRangePropertyFromDataSequence( { 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()); bResult = @@ -840,7 +840,7 @@ Reference< chart2::data::XDataProvider > getDataProviderFromParent( const Refere Reference< lang::XMultiServiceFactory > xFact( xChild->getParent(), uno::UNO_QUERY ); if( xFact.is() ) { - static const OUStringLiteral aDataProviderServiceName( u"com.sun.star.chart2.data.DataProvider"); + static constexpr OUStringLiteral aDataProviderServiceName( u"com.sun.star.chart2.data.DataProvider"); const uno::Sequence< OUString > aServiceNames( xFact->getAvailableServiceNames()); const OUString * pBegin = aServiceNames.getConstArray(); const OUString * pEnd = pBegin + aServiceNames.getLength(); diff --git a/xmloff/source/core/SettingsExportHelper.cxx b/xmloff/source/core/SettingsExportHelper.cxx index ad73fe9843d1..8cd0519918a5 100644 --- a/xmloff/source/core/SettingsExportHelper.cxx +++ b/xmloff/source/core/SettingsExportHelper.cxx @@ -287,16 +287,16 @@ void XMLSettingsExportHelper::exportSymbolDescriptors( { rtl::Reference< comphelper::IndexedPropertyValuesContainer > xBox = new comphelper::IndexedPropertyValuesContainer(); - static const OUStringLiteral sName ( u"Name" ); - static const OUStringLiteral sExportName ( u"ExportName" ); - static const OUStringLiteral sSymbolSet ( u"SymbolSet" ); - static const OUStringLiteral sCharacter ( u"Character" ); - static const OUStringLiteral sFontName ( u"FontName" ); - static const OUStringLiteral sCharSet ( u"CharSet" ); - static const OUStringLiteral sFamily ( u"Family" ); - static const OUStringLiteral sPitch ( u"Pitch" ); - static const OUStringLiteral sWeight ( u"Weight" ); - static const OUStringLiteral sItalic ( u"Italic" ); + static constexpr OUStringLiteral sName ( u"Name" ); + static constexpr OUStringLiteral sExportName ( u"ExportName" ); + static constexpr OUStringLiteral sSymbolSet ( u"SymbolSet" ); + static constexpr OUStringLiteral sCharacter ( u"Character" ); + static constexpr OUStringLiteral sFontName ( u"FontName" ); + static constexpr OUStringLiteral sCharSet ( u"CharSet" ); + static constexpr OUStringLiteral sFamily ( u"Family" ); + static constexpr OUStringLiteral sPitch ( u"Pitch" ); + static constexpr OUStringLiteral sWeight ( u"Weight" ); + static constexpr OUStringLiteral sItalic ( u"Italic" ); sal_Int32 nCount = rProps.getLength(); const formula::SymbolDescriptor *pDescriptor = rProps.getConstArray(); @@ -427,11 +427,11 @@ void XMLSettingsExportHelper::exportForbiddenCharacters( * xmloff/source/core/DocumentSettingsContext.cxx * XMLConfigItemMapIndexedContext::EndElement() */ - static const OUStringLiteral sLanguage ( u"Language" ); - static const OUStringLiteral sCountry ( u"Country" ); - static const OUStringLiteral sVariant ( u"Variant" ); - static const OUStringLiteral sBeginLine ( u"BeginLine" ); - static const OUStringLiteral sEndLine ( u"EndLine" ); + static constexpr OUStringLiteral sLanguage ( u"Language" ); + static constexpr OUStringLiteral sCountry ( u"Country" ); + static constexpr OUStringLiteral sVariant ( u"Variant" ); + static constexpr OUStringLiteral sBeginLine ( u"BeginLine" ); + static constexpr OUStringLiteral sEndLine ( u"EndLine" ); sal_Int32 nPos = 0; for( const auto& rLocale : aLocales ) diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 03277884ae0b..36e0a8454ebf 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -731,7 +731,7 @@ void SAL_CALL SvXMLExport::initialize( const uno::Sequence< uno::Any >& aArgumen mpImpl->mStreamName = sName; // Note: may be empty (XSLT) // Written OpenDocument file format doesn't fit to the created text document (#i69627#) - static const OUStringLiteral sOutlineStyleAsNormalListStyle( + static constexpr OUStringLiteral sOutlineStyleAsNormalListStyle( u"OutlineStyleAsNormalListStyle" ); if( xPropertySetInfo->hasPropertyByName( sOutlineStyleAsNormalListStyle ) ) { @@ -743,7 +743,7 @@ void SAL_CALL SvXMLExport::initialize( const uno::Sequence< uno::Any >& aArgumen if( xPropertySetInfo->hasPropertyByName( sTargetStorage ) ) mxExportInfo->getPropertyValue( sTargetStorage ) >>= mpImpl->mxTargetStorage; - static const OUStringLiteral sExportTextNumberElement( + static constexpr OUStringLiteral sExportTextNumberElement( u"ExportTextNumberElement" ); if( xPropertySetInfo->hasPropertyByName( sExportTextNumberElement ) ) { 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; }); diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx index 6f75963056b2..e03b87662c1e 100644 --- a/xmloff/source/meta/xmlmetai.cxx +++ b/xmloff/source/meta/xmlmetai.cxx @@ -245,7 +245,7 @@ void SvXMLMetaDocumentContext::setBuildId(std::u16string_view i_rBuildId, const { OUStringBuffer sBuffer( i_rBuildId.substr( nBegin+1, nEnd-nBegin-1 ) ); - static const OUStringLiteral sBuildCompare( + static constexpr OUStringLiteral sBuildCompare( u"$Build-" ); nBegin = i_rBuildId.find( sBuildCompare, nEnd ); if ( nBegin != std::u16string_view::npos ) @@ -305,7 +305,7 @@ void SvXMLMetaDocumentContext::setBuildId(std::u16string_view i_rBuildId, const { if( xImportInfo.is() ) { - static const OUStringLiteral aPropName(u"BuildId"); + static constexpr OUStringLiteral aPropName(u"BuildId"); uno::Reference< beans::XPropertySetInfo > xSetInfo( xImportInfo->getPropertySetInfo()); if( xSetInfo.is() && xSetInfo->hasPropertyByName( aPropName ) ) diff --git a/xmloff/source/style/XMLPageExport.cxx b/xmloff/source/style/XMLPageExport.cxx index a428cdf4c546..41f212901feb 100644 --- a/xmloff/source/style/XMLPageExport.cxx +++ b/xmloff/source/style/XMLPageExport.cxx @@ -215,7 +215,7 @@ XMLPageExport::XMLPageExport(SvXMLExport & rExp) "getStyleFamilies() from XModel failed for export!" ); if( xFamilies.is() ) { - static const OUStringLiteral aPageStyleName(u"PageStyles"); + static constexpr OUStringLiteral aPageStyleName(u"PageStyles"); if( xFamilies->hasByName( aPageStyleName ) ) { diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx index 8280ce2f47be..4c00fab10e96 100644 --- a/xmloff/source/style/xmlnume.cxx +++ b/xmloff/source/style/xmlnume.cxx @@ -798,7 +798,7 @@ void SvxXMLNumRuleExport::exportStyles( bool bUsed, bool bExportChapterNumbering if( !xFamilies.is() ) return; - static const OUStringLiteral aNumberStyleName( u"NumberingStyles" ); + static constexpr OUStringLiteral aNumberStyleName( u"NumberingStyles" ); Reference< XIndexAccess > xStyles; if( !xFamilies->hasByName( aNumberStyleName ) ) diff --git a/xmloff/source/table/XMLTableExport.cxx b/xmloff/source/table/XMLTableExport.cxx index 3bc2adba5cee..fe6613836bca 100644 --- a/xmloff/source/table/XMLTableExport.cxx +++ b/xmloff/source/table/XMLTableExport.cxx @@ -712,7 +712,7 @@ void XMLCellStyleExport::exportStyleAttributes(const Reference<XStyle>& rStyle) return; Reference<XPropertySetInfo> xPropSetInfo(xPropSet->getPropertySetInfo()); - static const OUStringLiteral sNumberFormat(u"NumberFormat"); + static constexpr OUStringLiteral sNumberFormat(u"NumberFormat"); if (xPropSetInfo->hasPropertyByName(sNumberFormat)) { Reference<XPropertyState> xPropState(xPropSet, UNO_QUERY); diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx index cba9da2a7293..ceea38316150 100644 --- a/xmloff/source/text/XMLSectionExport.cxx +++ b/xmloff/source/text/XMLSectionExport.cxx @@ -1588,7 +1588,7 @@ void XMLSectionExport::ExportBibliographyConfiguration(SvXMLExport& rExport) if ( !xTextFieldsSupp.is() ) return; - static const OUStringLiteral sFieldMaster_Bibliography(u"com.sun.star.text.FieldMaster.Bibliography"); + static constexpr OUStringLiteral sFieldMaster_Bibliography(u"com.sun.star.text.FieldMaster.Bibliography"); // get bibliography field master Reference<XNameAccess> xMasters = diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index 8d0bac4964dc..2df8234dfa0d 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -307,14 +307,14 @@ XMLTextFrameContourContext_Impl::XMLTextFrameContourContext_Impl( xPropSet->setPropertyValue( sContourPolyPolygon, Any(aPointSequenceSequence) ); } - static const OUStringLiteral sIsPixelContour(u"IsPixelContour"); + static constexpr OUStringLiteral sIsPixelContour(u"IsPixelContour"); if( xPropSetInfo->hasPropertyByName( sIsPixelContour ) ) { xPropSet->setPropertyValue( sIsPixelContour, Any(bPixelWidth) ); } - static const OUStringLiteral sIsAutomaticContour(u"IsAutomaticContour"); + static constexpr OUStringLiteral sIsAutomaticContour(u"IsAutomaticContour"); if( xPropSetInfo->hasPropertyByName( sIsAutomaticContour ) ) { diff --git a/xmloff/source/text/XMLTextHeaderFooterContext.cxx b/xmloff/source/text/XMLTextHeaderFooterContext.cxx index 9c176c7f4f47..db79c6933273 100644 --- a/xmloff/source/text/XMLTextHeaderFooterContext.cxx +++ b/xmloff/source/text/XMLTextHeaderFooterContext.cxx @@ -69,7 +69,7 @@ XMLTextHeaderFooterContext::XMLTextHeaderFooterContext( SvXMLImport& rImport, } if (bFirst) { - static const OUStringLiteral sShareContentFirst( u"FirstIsShared" ); + static constexpr OUStringLiteral sShareContentFirst( u"FirstIsShared" ); aAny = xPropSet->getPropertyValue( sShareContentFirst ); bool bSharedFirst = bool(); if (!(aAny >>= bSharedFirst)) diff --git a/xmloff/source/text/XMLTextListAutoStylePool.cxx b/xmloff/source/text/XMLTextListAutoStylePool.cxx index 5f138010ec06..1e62a66e6846 100644 --- a/xmloff/source/text/XMLTextListAutoStylePool.cxx +++ b/xmloff/source/text/XMLTextListAutoStylePool.cxx @@ -166,7 +166,7 @@ XMLTextListAutoStylePool::XMLTextListAutoStylePool( SvXMLExport& rExp ) : xFamilies = xFamiliesSupp->getStyleFamilies(); Reference<XIndexAccess> xStyles; - static const OUStringLiteral aNumberStyleName(u"NumberingStyles"); + static constexpr OUStringLiteral aNumberStyleName(u"NumberingStyles"); if (xFamilies.is() && xFamilies->hasByName(aNumberStyleName)) xFamilies->getByName(aNumberStyleName) >>= xStyles; diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index b31c2b6ab99b..0a4a18ad10d3 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -456,42 +456,42 @@ XMLTextImportHelper::XMLTextImportHelper( { Reference< XNameAccess > xFamilies(xFamiliesSupp->getStyleFamilies()); - static const OUStringLiteral aParaStyles(u"ParagraphStyles"); + static constexpr OUStringLiteral aParaStyles(u"ParagraphStyles"); if( xFamilies->hasByName( aParaStyles ) ) { m_xImpl->m_xParaStyles.set(xFamilies->getByName(aParaStyles), UNO_QUERY); } - static const OUStringLiteral aCharStyles(u"CharacterStyles"); + static constexpr OUStringLiteral aCharStyles(u"CharacterStyles"); if( xFamilies->hasByName( aCharStyles ) ) { m_xImpl->m_xTextStyles.set(xFamilies->getByName(aCharStyles), UNO_QUERY); } - static const OUStringLiteral aNumStyles(u"NumberingStyles"); + static constexpr OUStringLiteral aNumStyles(u"NumberingStyles"); if( xFamilies->hasByName( aNumStyles ) ) { m_xImpl->m_xNumStyles.set(xFamilies->getByName(aNumStyles), UNO_QUERY); } - static const OUStringLiteral aFrameStyles(u"FrameStyles"); + static constexpr OUStringLiteral aFrameStyles(u"FrameStyles"); if( xFamilies->hasByName( aFrameStyles ) ) { m_xImpl->m_xFrameStyles.set(xFamilies->getByName(aFrameStyles), UNO_QUERY); } - static const OUStringLiteral aPageStyles(u"PageStyles"); + static constexpr OUStringLiteral aPageStyles(u"PageStyles"); if( xFamilies->hasByName( aPageStyles ) ) { m_xImpl->m_xPageStyles.set(xFamilies->getByName(aPageStyles), UNO_QUERY); } - static const OUStringLiteral aCellStyles(u"CellStyles"); + static constexpr OUStringLiteral aCellStyles(u"CellStyles"); if( xFamilies->hasByName( aCellStyles ) ) { m_xImpl->m_xCellStyles.set(xFamilies->getByName(aCellStyles), diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 6407e0248626..3591e4c41c02 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -525,8 +525,8 @@ void BoundFrames::Fill(const filter_t& rFilter) const Reference< XEnumeration > xEnum = m_xEnumAccess->createEnumeration(); if(!xEnum.is()) return; - static const OUStringLiteral our_sAnchorType(u"AnchorType"); - static const OUStringLiteral our_sAnchorFrame(u"AnchorFrame"); + static constexpr OUStringLiteral our_sAnchorType(u"AnchorType"); + static constexpr OUStringLiteral our_sAnchorFrame(u"AnchorFrame"); while(xEnum->hasMoreElements()) { Reference<XPropertySet> xPropSet(xEnum->nextElement(), UNO_QUERY); diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx b/xmlsecurity/source/helper/documentsignaturemanager.cxx index cd08aadacc13..80d74c27ba53 100644 --- a/xmlsecurity/source/helper/documentsignaturemanager.cxx +++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx @@ -173,9 +173,9 @@ bool DocumentSignatureManager::isXML(std::u16string_view rURI) bool bIsXML = false; bool bPropsAvailable = false; - static const OUStringLiteral sPropFullPath(u"FullPath"); - static const OUStringLiteral sPropMediaType(u"MediaType"); - static const OUStringLiteral sPropDigest(u"Digest"); + static constexpr OUStringLiteral sPropFullPath(u"FullPath"); + static constexpr OUStringLiteral sPropMediaType(u"MediaType"); + static constexpr OUStringLiteral sPropDigest(u"Digest"); if (readManifest()) { |