basic/source/classes/sb.cxx | 2 basic/source/sbx/sbxscan.cxx | 4 chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx | 2 chart2/source/controller/dialogs/tp_DataSource.cxx | 4 chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx | 4 chart2/source/model/template/PieChartTypeTemplate.cxx | 2 chart2/source/tools/InternalDataProvider.cxx | 2 chart2/source/tools/ObjectIdentifier.cxx | 8 - chart2/source/tools/RegressionCurveHelper.cxx | 2 chart2/source/tools/StatisticsHelper.cxx | 2 chart2/source/tools/UncachedDataSequence.cxx | 2 chart2/source/view/axes/VCartesianAxis.cxx | 2 chart2/source/view/main/VLegend.cxx | 2 comphelper/source/misc/backupfilehelper.cxx | 6 compilerplugins/clang/constexprliteral.cxx | 68 ++++++++ compilerplugins/clang/test/constexprliteral.cxx | 24 +++ connectivity/qa/connectivity/ado/DriverTest.cxx | 6 connectivity/source/commontools/dbtools.cxx | 2 connectivity/source/commontools/formattedcolumnvalue.cxx | 2 connectivity/source/commontools/statementcomposer.cxx | 4 connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx | 2 connectivity/source/drivers/hsqldb/HDriver.cxx | 4 cpputools/source/unoexe/unoexe.cxx | 2 cui/source/dialogs/hlmarkwn.cxx | 6 cui/source/tabpages/chardlg.cxx | 2 dbaccess/qa/extras/dialog-save.cxx | 2 dbaccess/qa/extras/empty-stdlib-save.cxx | 2 dbaccess/qa/extras/nolib-save.cxx | 2 dbaccess/source/core/api/FilteredContainer.cxx | 6 dbaccess/source/core/recovery/subcomponentrecovery.cxx | 2 dbaccess/source/filter/xml/xmlExport.cxx | 2 dbaccess/source/ui/dlg/DbAdminImpl.cxx | 2 dbaccess/source/ui/dlg/queryorder.cxx | 4 desktop/source/app/crashreport.cxx | 4 desktop/source/deployment/registry/help/dp_help.cxx | 2 desktop/source/deployment/registry/package/dp_package.cxx | 6 desktop/source/lib/init.cxx | 2 desktop/source/migration/migration.cxx | 18 +- drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 2 editeng/source/misc/unolingu.cxx | 2 editeng/source/xml/xmltxtexp.cxx | 2 editeng/source/xml/xmltxtimp.cxx | 2 embeddedobj/source/commonembedding/persistence.cxx | 2 extensions/source/abpilot/fieldmappingimpl.cxx | 4 filter/source/msfilter/escherex.cxx | 18 +- filter/source/msfilter/msdffimp.cxx | 12 - filter/source/pdf/pdfexport.cxx | 4 filter/source/svg/svgwriter.cxx | 8 - filter/source/xsltdialog/typedetectionexport.cxx | 34 ++-- forms/source/component/Columns.cxx | 4 fpicker/source/office/iodlg.cxx | 2 fpicker/source/win32/workbench/Test_fps.cxx | 2 framework/source/accelerators/acceleratorconfiguration.cxx | 2 framework/source/fwe/classes/addonsoptions.cxx | 8 - framework/source/uielement/fontmenucontroller.cxx | 2 framework/source/uielement/fontsizemenucontroller.cxx | 2 framework/source/uielement/headermenucontroller.cxx | 4 framework/source/uielement/langselectionmenucontroller.cxx | 2 framework/source/uielement/langselectionstatusbarcontroller.cxx | 2 framework/source/uielement/macrosmenucontroller.cxx | 6 framework/source/uielement/objectmenucontroller.cxx | 2 framework/source/uielement/recentfilesmenucontroller.cxx | 2 framework/source/uifactory/uicontrollerfactory.cxx | 2 i18npool/source/breakiterator/breakiteratorImpl.cxx | 2 i18npool/source/collator/chaptercollator.cxx | 2 i18npool/source/localedata/LocaleNode.cxx | 10 - i18nutil/source/utility/paper.cxx | 2 linguistic/source/lngsvcmgr.cxx | 8 - officecfg/registry/cppheader.xsl | 6 oox/source/core/filterbase.cxx | 6 oox/source/drawingml/customshapeproperties.cxx | 4 oox/source/drawingml/fontworkhelpers.cxx | 6 oox/source/drawingml/hyperlinkcontext.cxx | 4 oox/source/drawingml/shape.cxx | 2 oox/source/export/shapes.cxx | 2 oox/source/helper/propertymap.cxx | 2 oox/source/ole/vbacontrol.cxx | 2 oox/source/ole/vbaexport.cxx | 2 oox/source/ppt/pptshape.cxx | 2 oox/source/ppt/presentationfragmenthandler.cxx | 4 oox/source/ppt/slidepersist.cxx | 8 - oox/source/vml/vmlshape.cxx | 2 package/source/manifest/ManifestExport.cxx | 36 ++-- package/source/zippackage/ZipPackage.cxx | 38 ++-- package/source/zippackage/ZipPackageStream.cxx | 10 - reportdesign/source/core/misc/conditionalexpression.cxx | 4 reportdesign/source/core/sdr/formatnormalizer.cxx | 2 reportdesign/source/ui/inspection/DataProviderHandler.cxx | 4 reportdesign/source/ui/inspection/GeometryHandler.cxx | 6 reportdesign/source/ui/inspection/ReportComponentHandler.cxx | 4 reportdesign/source/ui/report/ReportController.cxx | 2 sal/qa/rtl/process/rtl_Process.cxx | 8 - sc/qa/extras/macros-test.cxx | 8 - sc/qa/unit/screenshots/screenshots.cxx | 2 sc/source/filter/excel/xechart.cxx | 4 sc/source/filter/excel/xicontent.cxx | 2 sc/source/filter/oox/querytablebuffer.cxx | 2 sc/source/filter/xcl97/xcl97esc.cxx | 2 sc/source/filter/xml/XMLStylesExportHelper.cxx | 2 sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx | 2 sc/source/ui/dbgui/validate.cxx | 2 sc/source/ui/docshell/datastream.cxx | 2 sc/source/ui/docshell/docsh4.cxx | 8 - sd/qa/unit/SVGExportTests.cxx | 2 sd/qa/unit/misc-tests.cxx | 2 sd/source/console/PresenterController.cxx | 6 sd/source/console/PresenterSlideSorter.cxx | 2 sd/source/core/CustomAnimationEffect.cxx | 2 sd/source/filter/grf/sdgrffilter.cxx | 2 sd/source/filter/xml/sdxmlwrp.cxx | 2 sd/source/ui/animations/CustomAnimationDialog.cxx | 2 sd/source/ui/animations/CustomAnimationList.cxx | 4 sd/source/ui/animations/CustomAnimationPane.cxx | 4 sd/source/ui/docshell/docshel3.cxx | 8 - sd/source/ui/framework/configuration/ConfigurationTracer.cxx | 2 sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx | 8 - sd/source/ui/unoidl/unomodel.cxx | 4 sd/source/ui/unoidl/unopage.cxx | 2 sd/source/ui/view/DocumentRenderer.cxx | 2 sd/source/ui/view/drviewsf.cxx | 8 - sdext/source/minimizer/informationdialog.cxx | 6 sfx2/source/appl/sfxhelp.cxx | 2 sfx2/source/dialog/dinfdlg.cxx | 2 sfx2/source/dialog/mailmodel.cxx | 2 sfx2/source/doc/docmacromode.cxx | 4 sfx2/source/doc/doctemplates.cxx | 2 sfx2/source/doc/doctemplateslocal.cxx | 2 sfx2/source/doc/guisaveas.cxx | 14 - sfx2/source/doc/objstor.cxx | 30 +-- sfx2/source/doc/sfxbasemodel.cxx | 10 - sfx2/source/view/viewfrm.cxx | 4 solenv/CompilerTest_compilerplugins_clang.mk | 1 starmath/source/edit.cxx | 2 starmath/source/mathml/import.cxx | 6 starmath/source/mathml/mathmlexport.cxx | 6 starmath/source/mathml/mathmlimport.cxx | 6 svl/source/numbers/zformat.cxx | 4 svtools/source/config/extcolorcfg.cxx | 10 - svtools/source/dialogs/colrdlg.cxx | 2 svtools/source/filter/exportdialog.cxx | 4 svx/qa/unit/gallery/test_gallery.cxx | 14 - svx/source/core/graphichelper.cxx | 2 svx/source/dialog/svxbmpnumvalueset.cxx | 2 svx/source/fmcomp/gridcols.cxx | 4 svx/source/form/formcontrolfactory.cxx | 2 svx/source/mnuctrls/smarttagmenu.cxx | 2 svx/source/svdraw/svdoashp.cxx | 30 +-- svx/source/table/cellcursor.cxx | 4 svx/source/table/svdotable.cxx | 6 svx/source/table/tablecontroller.cxx | 2 svx/source/table/tablelayouter.cxx | 4 svx/source/table/tablemodel.cxx | 4 svx/source/table/tablertfimporter.cxx | 2 svx/source/tbxctrls/tbcontrl.cxx | 2 svx/source/tbxctrls/tbunosearchcontrollers.cxx | 6 svx/source/toolbars/fontworkbar.cxx | 14 - svx/source/unodraw/unomod.cxx | 2 sw/qa/core/txtnode/justify.cxx | 12 - sw/qa/core/uwriter.cxx | 2 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 4 sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 2 sw/qa/extras/uiwriter/uiwriter6.cxx | 2 sw/qa/extras/unowriter/unowriter.cxx | 12 - sw/source/core/doc/DocumentContentOperationsManager.cxx | 2 sw/source/core/doc/docfld.cxx | 4 sw/source/core/doc/doclay.cxx | 2 sw/source/core/edit/edfcol.cxx | 2 sw/source/core/unocore/unodraw.cxx | 8 - sw/source/core/view/printdata.cxx | 4 sw/source/filter/html/swhtml.cxx | 4 sw/source/filter/html/wrthtml.cxx | 2 sw/source/filter/ww8/ww8par5.cxx | 2 sw/source/filter/ww8/ww8toolbar.cxx | 2 sw/source/filter/xml/swxml.cxx | 12 - sw/source/filter/xml/xmlexp.cxx | 4 sw/source/filter/xml/xmlimp.cxx | 10 - sw/source/ui/envelp/mailmrge.cxx | 2 sw/source/ui/misc/glosbib.cxx | 2 sw/source/ui/misc/glossary.cxx | 2 sw/source/ui/vba/vbaparagraphformat.cxx | 2 sw/source/uibase/app/docstyle.cxx | 2 sw/source/uibase/shells/langhelper.cxx | 6 sw/source/uibase/shells/textsh1.cxx | 14 - sw/source/uibase/uno/unomailmerge.cxx | 2 test/source/sheet/cellarealink.cxx | 10 - test/source/sheet/databaserange.cxx | 22 +- test/source/sheet/datapilotitem.cxx | 4 test/source/sheet/xarrayformularange.cxx | 2 test/source/sheet/xspreadsheets2.cxx | 2 test/source/text/textsettings.cxx | 6 ucb/source/core/ucbcmds.cxx | 2 ucb/source/core/ucbstore.cxx | 12 - ucb/source/ucp/ext/ucpext_provider.cxx | 2 ucb/source/ucp/file/bc.cxx | 2 unodevtools/source/unodevtools/options.cxx | 2 vcl/jsdialog/jsdialogbuilder.cxx | 2 vcl/source/image/ImplImageTree.cxx | 2 vcl/source/treelist/transfer.cxx | 22 +- writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx | 2 writerfilter/source/ooxml/OOXMLStreamImpl.cxx | 78 +++++----- xmloff/source/chart/SchXMLSeries2Context.cxx | 2 xmloff/source/chart/SchXMLTableContext.cxx | 2 xmloff/source/chart/SchXMLTools.cxx | 8 - xmloff/source/core/SettingsExportHelper.cxx | 30 +-- xmloff/source/core/xmlexp.cxx | 4 xmloff/source/draw/XMLGraphicsDefaultStyle.cxx | 2 xmloff/source/draw/layerexp.cxx | 12 - xmloff/source/draw/sdxmlexp.cxx | 8 - xmloff/source/draw/shapeexport.cxx | 14 - xmloff/source/draw/xexptran.cxx | 24 +-- xmloff/source/draw/ximppage.cxx | 8 - xmloff/source/draw/ximpshap.cxx | 12 - xmloff/source/meta/xmlmetai.cxx | 4 xmloff/source/style/XMLPageExport.cxx | 2 xmloff/source/style/xmlnume.cxx | 2 xmloff/source/table/XMLTableExport.cxx | 2 xmloff/source/text/XMLSectionExport.cxx | 2 xmloff/source/text/XMLTextFrameContext.cxx | 4 xmloff/source/text/XMLTextHeaderFooterContext.cxx | 2 xmloff/source/text/XMLTextListAutoStylePool.cxx | 2 xmloff/source/text/txtimp.cxx | 12 - xmloff/source/text/txtparae.cxx | 4 xmlsecurity/source/helper/documentsignaturemanager.cxx | 6 223 files changed, 709 insertions(+), 616 deletions(-)
New commits: commit 0193b284e880a659ab73160e42238e1d5fe5cf8f Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Jun 23 12:34:31 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Jun 26 13:12:31 2023 +0200 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.gran...@collabora.co.uk> 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 ... etc. - the rest is truncated