diff options
author | Noel <noelgrandin@gmail.com> | 2020-11-25 08:14:07 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-11-30 12:32:14 +0100 |
commit | 8332d6d8200e8ca1f22dd98d9373efd5a431d09c (patch) | |
tree | dd45d452202998297b8562743ea6345462304d04 /xmloff/source | |
parent | d05a4cfbdcece491f7385dbeaa7eca03f2fdc1d5 (diff) |
loplugin:stringviewparam include comparisons with string literals
Change-Id: I8ba1214500dddaf413c506a4b82f43d63cda804b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106559
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source')
-rw-r--r-- | xmloff/source/chart/SchXMLAxisContext.cxx | 10 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLAxisContext.hxx | 4 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLChartContext.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLExport.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/core/xmlmultiimagehelper.cxx | 24 | ||||
-rw-r--r-- | xmloff/source/draw/ximpshap.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/draw/ximpstyl.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/text/XMLRedlineExport.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/text/XMLRedlineExport.hxx | 2 | ||||
-rw-r--r-- | xmloff/source/text/XMLTextMarkImportContext.cxx | 12 | ||||
-rw-r--r-- | xmloff/source/text/txtflde.cxx | 64 |
11 files changed, 72 insertions, 72 deletions
diff --git a/xmloff/source/chart/SchXMLAxisContext.cxx b/xmloff/source/chart/SchXMLAxisContext.cxx index d395fbae78f2..4447c093c566 100644 --- a/xmloff/source/chart/SchXMLAxisContext.cxx +++ b/xmloff/source/chart/SchXMLAxisContext.cxx @@ -671,12 +671,12 @@ Reference< chart2::XAxis > lcl_getAxis( const Reference< chart2::XCoordinateSyst } // anonymous namespace void SchXMLAxisContext::CorrectAxisPositions( const Reference< chart2::XChartDocument >& xNewDoc, - const OUString& rChartTypeServiceName, - const OUString& rODFVersionOfFile, + std::u16string_view rChartTypeServiceName, + std::u16string_view rODFVersionOfFile, bool bAxisPositionAttributeImported ) { - if( !(rODFVersionOfFile.isEmpty() || rODFVersionOfFile == "1.0" || rODFVersionOfFile == "1.1" - || ( rODFVersionOfFile == "1.2" && !bAxisPositionAttributeImported )) ) + if( !(rODFVersionOfFile.empty() || rODFVersionOfFile == u"1.0" || rODFVersionOfFile == u"1.1" + || ( rODFVersionOfFile == u"1.2" && !bAxisPositionAttributeImported )) ) return; try @@ -702,7 +702,7 @@ void SchXMLAxisContext::CorrectAxisPositions( const Reference< chart2::XChartDoc if( xMainXAxisProp.is() && xMainYAxisProp.is() ) { chart2::ScaleData aMainXScale = xMainXAxis->getScaleData(); - if( rChartTypeServiceName == "com.sun.star.chart2.ScatterChartType" ) + if( rChartTypeServiceName == u"com.sun.star.chart2.ScatterChartType" ) { xMainYAxisProp->setPropertyValue("CrossoverPosition" , uno::makeAny( css::chart::ChartAxisPosition_VALUE) ); diff --git a/xmloff/source/chart/SchXMLAxisContext.hxx b/xmloff/source/chart/SchXMLAxisContext.hxx index 8cb8f78098e9..ab2516a0bffd 100644 --- a/xmloff/source/chart/SchXMLAxisContext.hxx +++ b/xmloff/source/chart/SchXMLAxisContext.hxx @@ -49,8 +49,8 @@ public: const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; static void CorrectAxisPositions( const css::uno::Reference< css::chart2::XChartDocument >& xNewDoc, - const OUString& rChartTypeServiceName, - const OUString& rODFVersionOfFile, + std::u16string_view rChartTypeServiceName, + std::u16string_view rODFVersionOfFile, bool bAxisPositionAttributeImported ); private: diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx index 02c4df000d36..5221ffd67140 100644 --- a/xmloff/source/chart/SchXMLChartContext.cxx +++ b/xmloff/source/chart/SchXMLChartContext.cxx @@ -602,11 +602,11 @@ void lcl_swapPointAndSeriesStylesForDonutCharts( ::std::vector< DataRowPointStyl } bool lcl_SpecialHandlingForDonutChartNeeded( - const OUString & rServiceName, + std::u16string_view rServiceName, const SvXMLImport & rImport ) { bool bResult = false; - if( rServiceName == "com.sun.star.chart2.DonutChartType" ) + if( rServiceName == u"com.sun.star.chart2.DonutChartType" ) { bResult = SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan2_3( rImport.GetModel() ); } diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index af1f9e33bd4b..0ae039da9a3e 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -205,7 +205,7 @@ public: void exportAxis( enum XMLTokenEnum eDimension, enum XMLTokenEnum eAxisName, const Reference< beans::XPropertySet >& rAxisProps, const Reference< chart2::XAxis >& rChart2Axis, const OUString& rCategoriesRanges, - bool bHasTitle, bool bHasMajorGrid, bool bHasMinorGrid, bool bExportContent, OUString sChartType ); + bool bHasTitle, bool bHasMajorGrid, bool bHasMinorGrid, bool bExportContent, std::u16string_view sChartType ); void exportGrid( const Reference< beans::XPropertySet >& rGridProperties, bool bMajor, bool bExportContent ); void exportDateScale( const Reference< beans::XPropertySet >& rAxisProps ); void exportAxisTitle( const Reference< beans::XPropertySet >& rTitleProps, bool bExportContent ); @@ -2290,7 +2290,7 @@ void SchXMLExportHelper_Impl::exportAxis( const Reference< chart2::XAxis >& rChart2Axis, const OUString& rCategoriesRange, bool bHasTitle, bool bHasMajorGrid, bool bHasMinorGrid, - bool bExportContent, OUString sChartType ) + bool bExportContent, std::u16string_view sChartType ) { std::vector< XMLPropertyState > aPropertyStates; std::unique_ptr<SvXMLElementExport> pAxis; @@ -2304,7 +2304,7 @@ void SchXMLExportHelper_Impl::exportAxis( { chart2::ScaleData aScaleData(rChart2Axis->getScaleData()); bool bShiftedCatPos = aScaleData.ShiftedCategoryPosition; - if (sChartType == "com.sun.star.chart.BarDiagram" || sChartType == "com.sun.star.chart.StockDiagram") + if (sChartType == u"com.sun.star.chart.BarDiagram" || sChartType == u"com.sun.star.chart.StockDiagram") { if (!bShiftedCatPos) rAxisProps->setPropertyValue("MajorOrigin", uno::makeAny(0.0)); diff --git a/xmloff/source/core/xmlmultiimagehelper.cxx b/xmloff/source/core/xmlmultiimagehelper.cxx index af03e7bb1361..f48ae6e9a576 100644 --- a/xmloff/source/core/xmlmultiimagehelper.cxx +++ b/xmloff/source/core/xmlmultiimagehelper.cxx @@ -37,52 +37,52 @@ namespace return sMimeType; } - sal_uInt32 getQualityIndex(const OUString& rMimeType) + sal_uInt32 getQualityIndex(std::u16string_view rMimeType) { // pixel formats first - if (rMimeType == "image/bmp") + if (rMimeType == u"image/bmp") { return 10; } - if (rMimeType == "image/gif") + if (rMimeType == u"image/gif") { return 20; } - if (rMimeType == "image/jpeg") + if (rMimeType == u"image/jpeg") { return 30; } - if (rMimeType == "image/png") + if (rMimeType == u"image/png") { return 40; } // vector formats, prefer always - if (rMimeType == "image/x-vclgraphic") // MIMETYPE_VCLGRAPHIC + if (rMimeType == u"image/x-vclgraphic") // MIMETYPE_VCLGRAPHIC { return 990; } - if (rMimeType == "image/x-svm") + if (rMimeType == u"image/x-svm") { return 1000; } - if (rMimeType == "image/x-wmf") + if (rMimeType == u"image/x-wmf") { return 1010; } - if (rMimeType == "image/x-emf") + if (rMimeType == u"image/x-emf") { return 1020; } - if (rMimeType == "image/x-eps") + if (rMimeType == u"image/x-eps") { return 1025; } - if (rMimeType == "application/pdf") + if (rMimeType == u"application/pdf") { return 1030; } - if (rMimeType == "image/svg+xml") + if (rMimeType == u"image/svg+xml") { return 1040; } diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 15e627ba3953..0d9a171d3848 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -125,14 +125,14 @@ SvXMLEnumMapEntry<drawing::EscapeDirection> const aXML_GlueEscapeDirection_EnumM { XML_TOKEN_INVALID, drawing::EscapeDirection(0) } }; -static bool ImpIsEmptyURL( const OUString& rURL ) +static bool ImpIsEmptyURL( std::u16string_view rURL ) { - if( rURL.isEmpty() ) + if( rURL.empty() ) return true; // #i13140# Also compare against 'toplevel' URLs. which also // result in empty filename strings. - if( rURL == "#./" ) + if( rURL == u"#./" ) return true; return false; diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx index 3a25c4c65027..ee2c51add4bb 100644 --- a/xmloff/source/draw/ximpstyl.cxx +++ b/xmloff/source/draw/ximpstyl.cxx @@ -1093,11 +1093,11 @@ void SdXMLStylesContext::ImpSetCellStyles() const //master page shapes from resizing themselves due to autoheight becoming //enabled before having autoheight turned off again and getting stuck on that //autosized height -static bool canSkipReset(const OUString &rName, const XMLPropStyleContext* pPropStyle, +static bool canSkipReset(std::u16string_view rName, const XMLPropStyleContext* pPropStyle, const uno::Reference< beans::XPropertySet > &rPropSet, const rtl::Reference < XMLPropertySetMapper >& rPrMap) { bool bCanSkipReset = false; - if (pPropStyle && rName == "TextAutoGrowHeight") + if (pPropStyle && rName == u"TextAutoGrowHeight") { bool bOldStyleTextAutoGrowHeight(false); rPropSet->getPropertyValue("TextAutoGrowHeight") >>= bOldStyleTextAutoGrowHeight; diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx index 43ced7d6e1d8..966a0614a3f9 100644 --- a/xmloff/source/text/XMLRedlineExport.cxx +++ b/xmloff/source/text/XMLRedlineExport.cxx @@ -395,17 +395,17 @@ void XMLRedlineExport::ExportChangedRegion( OUString const & XMLRedlineExport::ConvertTypeName( - const OUString& sApiName) + std::u16string_view sApiName) { - if (sApiName == "Delete") + if (sApiName == u"Delete") { return sDeletion; } - else if (sApiName == "Insert") + else if (sApiName == u"Insert") { return sInsertion; } - else if (sApiName == "Format") + else if (sApiName == u"Format") { return sFormatChange; } diff --git a/xmloff/source/text/XMLRedlineExport.hxx b/xmloff/source/text/XMLRedlineExport.hxx index 3da7d70ddbd8..f67d124e8a17 100644 --- a/xmloff/source/text/XMLRedlineExport.hxx +++ b/xmloff/source/text/XMLRedlineExport.hxx @@ -151,7 +151,7 @@ private: const css::uno::Sequence<css::beans::PropertyValue> & rValues); /// convert the change type from API to XML names - OUString const & ConvertTypeName(const OUString& sApiName); + OUString const & ConvertTypeName(std::u16string_view sApiName); /// Get ID string! static OUString GetRedlineID( diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx b/xmloff/source/text/XMLTextMarkImportContext.cxx index f759c1b6fe8d..ef1fa9556c0a 100644 --- a/xmloff/source/text/XMLTextMarkImportContext.cxx +++ b/xmloff/source/text/XMLTextMarkImportContext.cxx @@ -125,14 +125,14 @@ SvXMLEnumMapEntry<lcl_MarkType> const lcl_aMarkTypeMap[] = }; -static const char *lcl_getFormFieldmarkName(OUString const &name) +static const sal_Unicode *lcl_getFormFieldmarkName(std::u16string_view name) { if (name == ODF_FORMCHECKBOX || - name == "msoffice.field.FORMCHECKBOX" || - name == "ecma.office-open-xml.field.FORMCHECKBOX") + name == u"msoffice.field.FORMCHECKBOX" || + name == u"ecma.office-open-xml.field.FORMCHECKBOX") return ODF_FORMCHECKBOX; else if (name == ODF_FORMDROPDOWN || - name == "ecma.office-open-xml.field.FORMDROPDOWN") + name == u"ecma.office-open-xml.field.FORMDROPDOWN") return ODF_FORMDROPDOWN; else return nullptr; @@ -279,7 +279,7 @@ void XMLTextMarkImportContext::endFastElement(sal_Int32 ) [[fallthrough]]; case TypeFieldmark: { - const char *formFieldmarkName=lcl_getFormFieldmarkName(m_sFieldName); + const sal_Unicode *formFieldmarkName=lcl_getFormFieldmarkName(m_sFieldName); bool bImportAsField = (nTmp==TypeFieldmark && formFieldmarkName!=nullptr); //@TODO handle abbreviation cases... // export point bookmark const Reference<XInterface> xContent( @@ -292,7 +292,7 @@ void XMLTextMarkImportContext::endFastElement(sal_Int32 ) if (xContent.is() && bImportAsField) { // setup fieldmark... Reference< css::text::XFormField> xFormField(xContent, UNO_QUERY); - xFormField->setFieldType(OUString::createFromAscii(formFieldmarkName)); + xFormField->setFieldType(OUString(formFieldmarkName)); if (xFormField.is() && m_rHelper.hasCurrentFieldCtx()) { m_rHelper.setCurrentFieldParamsTo(xFormField); } diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index 2654a23bca7e..effacfd668df 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -3299,131 +3299,131 @@ enum XMLTokenEnum XMLTextFieldExport::MapDocInfoFieldName( return eElement; } -enum XMLTokenEnum XMLTextFieldExport::MapBibliographyFieldName(const OUString& sName) +enum XMLTokenEnum XMLTextFieldExport::MapBibliographyFieldName(std::u16string_view sName) { enum XMLTokenEnum eName = XML_TOKEN_INVALID; - if( sName == "Identifier" ) + if( sName == u"Identifier" ) { eName = XML_IDENTIFIER; } - else if( sName == "BibiliographicType" ) + else if( sName == u"BibiliographicType" ) { eName = XML_BIBLIOGRAPHY_TYPE; } - else if( sName == "Address" ) + else if( sName == u"Address" ) { eName = XML_ADDRESS; } - else if( sName == "Annote" ) + else if( sName == u"Annote" ) { eName = XML_ANNOTE; } - else if( sName == "Author" ) + else if( sName == u"Author" ) { eName = XML_AUTHOR; } - else if( sName == "Booktitle" ) + else if( sName == u"Booktitle" ) { eName = XML_BOOKTITLE; } - else if( sName == "Chapter" ) + else if( sName == u"Chapter" ) { eName = XML_CHAPTER; } - else if( sName == "Edition" ) + else if( sName == u"Edition" ) { eName = XML_EDITION; } - else if( sName == "Editor" ) + else if( sName == u"Editor" ) { eName = XML_EDITOR; } - else if( sName == "Howpublished" ) + else if( sName == u"Howpublished" ) { eName = XML_HOWPUBLISHED; } - else if( sName == "Institution" ) + else if( sName == u"Institution" ) { eName = XML_INSTITUTION; } - else if( sName == "Journal" ) + else if( sName == u"Journal" ) { eName = XML_JOURNAL; } - else if( sName =="Month" ) + else if( sName == u"Month" ) { eName = XML_MONTH; } - else if( sName == "Note" ) + else if( sName == u"Note" ) { eName = XML_NOTE; } - else if( sName == "Number" ) + else if( sName == u"Number" ) { eName = XML_NUMBER; } - else if( sName == "Organizations" ) + else if( sName == u"Organizations" ) { eName = XML_ORGANIZATIONS; } - else if( sName == "Pages" ) + else if( sName == u"Pages" ) { eName = XML_PAGES; } - else if( sName == "Publisher" ) + else if( sName == u"Publisher" ) { eName = XML_PUBLISHER; } - else if( sName == "School" ) + else if( sName == u"School" ) { eName = XML_SCHOOL; } - else if( sName == "Series" ) + else if( sName == u"Series" ) { eName = XML_SERIES; } - else if( sName == "Title" ) + else if( sName == u"Title" ) { eName = XML_TITLE; } - else if( sName == "Report_Type" ) + else if( sName == u"Report_Type" ) { eName = XML_REPORT_TYPE; } - else if( sName == "Volume" ) + else if( sName == u"Volume" ) { eName = XML_VOLUME; } - else if( sName == "Year" ) + else if( sName == u"Year" ) { eName = XML_YEAR; } - else if( sName == "URL" ) + else if( sName == u"URL" ) { eName = XML_URL; } - else if( sName == "Custom1" ) + else if( sName == u"Custom1" ) { eName = XML_CUSTOM1; } - else if( sName == "Custom2" ) + else if( sName == u"Custom2" ) { eName = XML_CUSTOM2; } - else if( sName == "Custom3" ) + else if( sName == u"Custom3" ) { eName = XML_CUSTOM3; } - else if( sName == "Custom4" ) + else if( sName == u"Custom4" ) { eName = XML_CUSTOM4; } - else if( sName == "Custom5" ) + else if( sName == u"Custom5" ) { eName = XML_CUSTOM5; } - else if( sName == "ISBN" ) + else if( sName == u"ISBN" ) { eName = XML_ISBN; } |