From a0656ec6fc2b41e65f1b40dbd64f546175e2762f Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 25 Mar 2021 09:53:33 +0300 Subject: const OUString -> const OUStringLiteral Mostly automated rewrite Change-Id: Ie020a083f898bc126b8fb039d4ecb2e687172da1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112965 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- reportdesign/source/core/misc/conditionalexpression.cxx | 6 +++--- 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 | 7 +++---- 6 files changed, 14 insertions(+), 15 deletions(-) (limited to 'reportdesign/source') diff --git a/reportdesign/source/core/misc/conditionalexpression.cxx b/reportdesign/source/core/misc/conditionalexpression.cxx index d68c25c95a63..97284c8b0d64 100644 --- a/reportdesign/source/core/misc/conditionalexpression.cxx +++ b/reportdesign/source/core/misc/conditionalexpression.cxx @@ -71,7 +71,7 @@ namespace rptui // Okay, let's start with replacing all $$ in our pattern with the actual field data source OUString sMatchExpression( m_sPattern ); - const OUString sFieldDataPattern( "$$" ); + static const OUStringLiteral sFieldDataPattern( u"$$" ); sal_Int32 nIndex( sMatchExpression.indexOf( sFieldDataPattern ) ); while ( nIndex != -1 ) { @@ -79,8 +79,8 @@ namespace rptui nIndex = sMatchExpression.indexOf( sFieldDataPattern, nIndex + _rFieldDataSource.getLength() ); } - const OUString sLHSPattern( "$1" ); - const OUString sRHSPattern( "$2" ); + static const OUStringLiteral sLHSPattern( u"$1" ); + static const 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 195582503839..c4d22941fbf3 100644 --- a/reportdesign/source/core/sdr/formatnormalizer.cxx +++ b/reportdesign/source/core/sdr/formatnormalizer.cxx @@ -220,7 +220,7 @@ namespace rptui return; OUString sDataField( _rxFormatted->getDataField() ); - const OUString sFieldPrefix( "field:[" ); + static const 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 bcc6be58ff29..dd770ff9fd5b 100644 --- a/reportdesign/source/ui/inspection/DataProviderHandler.cxx +++ b/reportdesign/source/ui/inspection/DataProviderHandler.cxx @@ -111,11 +111,11 @@ void SAL_CALL DataProviderHandler::inspect(const uno::Reference< uno::XInterface try { uno::Reference< container::XNameContainer > xNameCont(Component,uno::UNO_QUERY); - const OUString sFormComponent("FormComponent"); + static const OUStringLiteral sFormComponent(u"FormComponent"); if ( xNameCont->hasByName(sFormComponent) ) { uno::Reference xProp(xNameCont->getByName(sFormComponent),uno::UNO_QUERY); - const OUString sModel("Model"); + static const 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 9ac2957f356e..2392f6e6b6a9 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 ); - const OUString sRowSet("RowSet"); + static const OUStringLiteral sRowSet(u"RowSet"); if ( xObjectAsContainer->hasByName( sRowSet ) ) { const uno::Any aRowSet( xObjectAsContainer->getByName(sRowSet) ); @@ -2090,8 +2090,8 @@ void GeometryHandler::impl_createFunction(const OUString& _sFunctionName,std::u1 m_xFunction.set(report::Function::create(m_xContext)); m_xFunction->setName( _sFunctionName ); - const OUString sPlaceHolder1("%Column"); - const OUString sPlaceHolder2("%FunctionName"); + static const OUStringLiteral sPlaceHolder1(u"%Column"); + static const 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 3e4fe9ae6884..28b33acc4133 100644 --- a/reportdesign/source/ui/inspection/ReportComponentHandler.cxx +++ b/reportdesign/source/ui/inspection/ReportComponentHandler.cxx @@ -85,10 +85,10 @@ void SAL_CALL ReportComponentHandler::inspect(const uno::Reference< uno::XInterf try { uno::Reference< container::XNameContainer > xNameCont(Component,uno::UNO_QUERY); - const OUString sFormComponent("FormComponent"); + static const OUStringLiteral sFormComponent(u"FormComponent"); if ( xNameCont->hasByName(sFormComponent) ) xNameCont->getByName(sFormComponent) >>= m_xFormComponent; - const OUString sRowSet("RowSet"); + static const OUStringLiteral sRowSet(u"RowSet"); if ( xNameCont->hasByName(sRowSet) ) { uno::Reference xProp(m_xFormComponentHandler,uno::UNO_QUERY); diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 46a23a3a4f9a..475bef77a29f 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -3972,12 +3972,11 @@ void OReportController::createDefaultControl(const uno::Sequence< beans::Propert if ( !xSection.is() ) return; - const OUString sKeyModifier("KeyModifier"); const beans::PropertyValue* pIter = _aArgs.getConstArray(); const beans::PropertyValue* pEnd = pIter + _aArgs.getLength(); const beans::PropertyValue* pKeyModifier = ::std::find_if(pIter, pEnd, - [&sKeyModifier] (const beans::PropertyValue& x) -> bool { - return x.Name == sKeyModifier; + [] (const beans::PropertyValue& x) -> bool { + return x.Name == "KeyModifier"; }); sal_Int16 nKeyModifier = 0; if ( pKeyModifier == pEnd || ((pKeyModifier->Value >>= nKeyModifier) && nKeyModifier == KEY_MOD1) ) @@ -4002,7 +4001,7 @@ void OReportController::checkChartEnabled() ::utl::OConfigurationTreeRoot::createWithComponentContext( m_xContext, "/org.openoffice.Office.ReportDesign" ) ); bool bChartEnabled = false; - const OUString sPropertyName( "UserData/Chart" ); + static const OUStringLiteral sPropertyName( u"UserData/Chart" ); if ( aConfiguration.hasByHierarchicalName(sPropertyName) ) aConfiguration.getNodeValue( sPropertyName ) >>= bChartEnabled; m_bChartEnabled = bChartEnabled; -- cgit