From 3457da6abe0fd03efd19442e9790fbd1aa04c160 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 6 Aug 2020 10:55:58 +0200 Subject: loplugin:stringstatic also look for local statics Add some API to O*StringLiteral, to make it easier to use in some places that were using O*String Change-Id: I1fb93bd47ac2065c9220d509aad3f4320326d99e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100270 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/source/core/tool/compiler.cxx | 6 ++-- sc/source/filter/excel/xiescher.cxx | 4 +-- .../ui/StatisticsDialogs/FourierAnalysisDialog.cxx | 2 +- sc/source/ui/dbgui/scuiasciiopt.cxx | 6 ++-- sc/source/ui/unoobj/PivotTableDataProvider.cxx | 6 ++-- sc/source/ui/vba/excelvbahelper.cxx | 2 -- sc/source/ui/vba/vbaaxis.cxx | 8 +++--- sc/source/ui/vba/vbachart.cxx | 32 +++++++++++----------- sc/source/ui/vba/vbachartobject.cxx | 2 +- sc/source/ui/view/formatsh.cxx | 2 +- 10 files changed, 34 insertions(+), 36 deletions(-) (limited to 'sc') diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 4eb3012b04ad..7a79eb75131c 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -727,7 +727,7 @@ struct Convention_A1 : public ScCompiler::Convention KParseTokens::ASC_UNDERSCORE | KParseTokens::ASC_DOLLAR; constexpr sal_Int32 nContFlags = nStartFlags | KParseTokens::ASC_DOT; // '?' allowed in range names because of Xcl :-/ - static const OUString aAddAllowed("?#"); + static const OUStringLiteral aAddAllowed("?#"); return pCharClass->parseAnyToken( rFormula, nSrcPos, nStartFlags, aAddAllowed, (bGroupSeparator ? nContFlags | KParseTokens::GROUP_SEPARATOR_IN_NUMBER : nContFlags), @@ -1358,7 +1358,7 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL KParseTokens::ASC_UNDERSCORE | KParseTokens::ASC_DOLLAR; constexpr sal_Int32 nContFlags = nStartFlags | KParseTokens::ASC_DOT; // '?' allowed in range names - static const OUString aAddAllowed("?!"); + static const OUStringLiteral aAddAllowed("?!"); return pCharClass->parseAnyToken( rFormula, nSrcPos, nStartFlags, aAddAllowed, (bGroupSeparator ? nContFlags | KParseTokens::GROUP_SEPARATOR_IN_NUMBER : nContFlags), @@ -1681,7 +1681,7 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL KParseTokens::ASC_UNDERSCORE ; constexpr sal_Int32 nContFlags = nStartFlags | KParseTokens::ASC_DOT; // '?' allowed in range names - static const OUString aAddAllowed("?-[]!"); + static const OUStringLiteral aAddAllowed("?-[]!"); return pCharClass->parseAnyToken( rFormula, nSrcPos, nStartFlags, aAddAllowed, diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index b3e1c10ac424..70f30c693bb3 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -468,7 +468,7 @@ SdrObjectUniquePtr XclImpDrawObjBase::CreateSdrObject( XclImpDffConverter& rDffC { const Reference< XControlModel >& xCtrlModel = pSdrUnoObj->GetUnoControlModel(); Reference< XPropertySet > xPropSet(xCtrlModel,UNO_QUERY); - const static OUString sPropertyName("ControlTypeinMSO"); + const static OUStringLiteral sPropertyName("ControlTypeinMSO"); enum { eCreateFromOffice = 0, eCreateFromMSTBXControl, eCreateFromMSOCXControl }; @@ -488,7 +488,7 @@ SdrObjectUniquePtr XclImpDrawObjBase::CreateSdrObject( XclImpDffConverter& rDffC if( mnObjType == 8 )//OCX { //Need summary type for export - const static OUString sObjIdPropertyName("ObjIDinMSO"); + const static OUStringLiteral sObjIdPropertyName("ObjIDinMSO"); const XclImpPictureObj* const pObj = dynamic_cast< const XclImpPictureObj* const >(this); if( pObj != nullptr && pObj->IsOcxControl() ) { diff --git a/sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx b/sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx index 70116e059077..b7093cc39ff1 100644 --- a/sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx @@ -219,7 +219,7 @@ void ScFourierAnalysisDialog::getDataLabel(OUString& rLabel) void ScFourierAnalysisDialog::genFormula(OUString& rFormula) { - static const OUString aSep(";"); + static const OUStringLiteral aSep(";"); if (!mbPolar) { diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index a270332ddf2c..9665ac78c642 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -77,9 +77,9 @@ const ::std::vector CSVImportOptionNames = "Language", "SkipEmptyCells" }; -const OUString aSep_Path = "Office.Calc/Dialogs/CSVImport"; -const OUString aSep_Path_Clpbrd = "Office.Calc/Dialogs/ClipboardTextImport"; -const OUString aSep_Path_Text2Col = "Office.Calc/Dialogs/TextToColumnsImport"; +const OUStringLiteral aSep_Path = "Office.Calc/Dialogs/CSVImport"; +const OUStringLiteral aSep_Path_Clpbrd = "Office.Calc/Dialogs/ClipboardTextImport"; +const OUStringLiteral aSep_Path_Text2Col = "Office.Calc/Dialogs/TextToColumnsImport"; namespace { CSVImportOptionsIndex getSkipEmptyCellsIndex( ScImportAsciiCall eCall ) diff --git a/sc/source/ui/unoobj/PivotTableDataProvider.cxx b/sc/source/ui/unoobj/PivotTableDataProvider.cxx index dafac1918735..c8b98bde29da 100644 --- a/sc/source/ui/unoobj/PivotTableDataProvider.cxx +++ b/sc/source/ui/unoobj/PivotTableDataProvider.cxx @@ -55,9 +55,9 @@ namespace sc { namespace { -const OUString constIdCategories("categories"); -const OUString constIdLabel("label"); -const OUString constIdData("data"); +const OUStringLiteral constIdCategories("categories"); +const OUStringLiteral constIdLabel("label"); +const OUStringLiteral constIdData("data"); const SfxItemPropertyMapEntry* lcl_GetDataProviderPropertyMap() { diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx index db12c6bab9ca..aa2c16378700 100644 --- a/sc/source/ui/vba/excelvbahelper.cxx +++ b/sc/source/ui/vba/excelvbahelper.cxx @@ -106,8 +106,6 @@ void implSetZoom( const uno::Reference< frame::XModel >& xModel, sal_Int16 nZoom pViewSh->RefreshZoom(); } -const OUString REPLACE_CELLS_WARNING( "ReplaceCellsWarning"); - namespace { class PasteCellsWarningReseter diff --git a/sc/source/ui/vba/vbaaxis.cxx b/sc/source/ui/vba/vbaaxis.cxx index f50b04a57e7e..876b6bff0111 100644 --- a/sc/source/ui/vba/vbaaxis.cxx +++ b/sc/source/ui/vba/vbaaxis.cxx @@ -29,10 +29,10 @@ using namespace ::ooo::vba::excel::XlAxisCrosses; using namespace ::ooo::vba::excel::XlAxisType; using namespace ::ooo::vba::excel::XlScaleType; -const OUString ORIGIN("Origin"); -const OUString AUTOORIGIN("AutoOrigin"); -const OUString VBA_MIN("Max"); -const OUString VBA_MAX("Min"); +const OUStringLiteral ORIGIN("Origin"); +const OUStringLiteral AUTOORIGIN("AutoOrigin"); +const OUStringLiteral VBA_MIN("Max"); +const OUStringLiteral VBA_MAX("Min"); ScVbaChart* ScVbaAxis::getChartPtr() { diff --git a/sc/source/ui/vba/vbachart.cxx b/sc/source/ui/vba/vbachart.cxx index d83cee30b002..cd96b0a9312f 100644 --- a/sc/source/ui/vba/vbachart.cxx +++ b/sc/source/ui/vba/vbachart.cxx @@ -48,23 +48,23 @@ using namespace ::ooo::vba::excel::XlRowCol; using namespace ::ooo::vba::excel::XlAxisType; using namespace ::ooo::vba::excel::XlAxisGroup; -const OUString CHART_NAME("Name"); +const OUStringLiteral CHART_NAME("Name"); // #TODO move this constant to vbaseries.[ch]xx ( when it exists ) -const OUString DEFAULTSERIESPREFIX("Series"); -const OUString DATAROWSOURCE("DataRowSource"); -const OUString UPDOWN("UpDown"); -const OUString VOLUME("Volume"); -const OUString LINES("Lines"); -const OUString SPLINETYPE("SplineType"); -const OUString SYMBOLTYPE("SymbolType"); -const OUString DEEP("Deep"); -const OUString SOLIDTYPE("SolidType"); -const OUString VERTICAL("Vertical"); -const OUString PERCENT("Percent"); -const OUString STACKED("Stacked"); -const OUString DIM3D("Dim3D"); -const OUString HASMAINTITLE("HasMainTitle"); -const OUString HASLEGEND("HasLegend"); +const OUStringLiteral DEFAULTSERIESPREFIX("Series"); +const OUStringLiteral DATAROWSOURCE("DataRowSource"); +const OUStringLiteral UPDOWN("UpDown"); +const OUStringLiteral VOLUME("Volume"); +const OUStringLiteral LINES("Lines"); +const OUStringLiteral SPLINETYPE("SplineType"); +const OUStringLiteral SYMBOLTYPE("SymbolType"); +const OUStringLiteral DEEP("Deep"); +const OUStringLiteral SOLIDTYPE("SolidType"); +const OUStringLiteral VERTICAL("Vertical"); +const OUStringLiteral PERCENT("Percent"); +const OUStringLiteral STACKED("Stacked"); +const OUStringLiteral DIM3D("Dim3D"); +const OUStringLiteral HASMAINTITLE("HasMainTitle"); +const OUStringLiteral HASLEGEND("HasLegend"); ScVbaChart::ScVbaChart( const css::uno::Reference< ov::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext, const css::uno::Reference< css::lang::XComponent >& _xChartComponent, const css::uno::Reference< css::table::XTableChart >& _xTableChart ) : ChartImpl_BASE( _xParent, _xContext ), mxTableChart( _xTableChart ) { diff --git a/sc/source/ui/vba/vbachartobject.cxx b/sc/source/ui/vba/vbachartobject.cxx index 424143b27e07..e64df679560a 100644 --- a/sc/source/ui/vba/vbachartobject.cxx +++ b/sc/source/ui/vba/vbachartobject.cxx @@ -29,7 +29,7 @@ using namespace ::com::sun::star; using namespace ::ooo::vba; -const OUString PERSIST_NAME("PersistName"); +const OUStringLiteral PERSIST_NAME("PersistName"); ScVbaChartObject::ScVbaChartObject( const css::uno::Reference< ov::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext, const css::uno::Reference< css::table::XTableChart >& _xTableChart, const css::uno::Reference< css::drawing::XDrawPageSupplier >& _xDrawPageSupplier ) : ChartObjectImpl_BASE( _xParent, _xContext ), xTableChart( _xTableChart ), xDrawPageSupplier( _xDrawPageSupplier ) { diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 5f4f407d2485..5303666e91be 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -2575,7 +2575,7 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet ) bThousand = nIntegerDigits > 0 && ((nIntegerDigits % 3) == 0); } OUString aFormat; - static const OUString sBreak = ","; + static const OUStringLiteral sBreak = ","; const OUString sThousand = OUString::number(static_cast(bThousand)); const OUString sNegRed = OUString::number(static_cast(bNegRed)); const OUString sPrecision = OUString::number(nPrecision); -- cgit