From 6c80a8fe89fadf9a2c7260a09c037a09462f53d1 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 6 Nov 2015 09:23:33 +0200 Subject: new loplugin: oncevar Change-Id: If57390510dde4d166be3141b9f658a7453755d3f Reviewed-on: https://gerrit.libreoffice.org/19815 Tested-by: Jenkins Reviewed-by: Noel Grandin --- xmloff/source/chart/SchXMLExport.cxx | 34 ++++++++---------------------- xmloff/source/chart/SchXMLImport.cxx | 18 +++++----------- xmloff/source/draw/animationimport.cxx | 4 +--- xmloff/source/draw/sdxmlexp.cxx | 4 +--- xmloff/source/draw/sdxmlimp.cxx | 6 ++---- xmloff/source/draw/shapeexport.cxx | 3 +-- xmloff/source/meta/MetaExportComponent.cxx | 14 ++++-------- xmloff/source/meta/xmlmetai.cxx | 7 +++--- xmloff/source/text/txtexppr.cxx | 3 +-- 9 files changed, 27 insertions(+), 66 deletions(-) (limited to 'xmloff') diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 01a9b21141e8..d7e02b83b873 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -917,8 +917,6 @@ void lcl_exportNumberFormat( const OUString& rPropertyName, const Reference< bea if( !xErrorBarDataSource.is()) return aResult; - const OUString aRolePrefix( "error-bars-" ); - Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences( xErrorBarDataSource->getDataSequences()); for( sal_Int32 nI=0; nI< aSequences.getLength(); ++nI ) @@ -931,7 +929,7 @@ void lcl_exportNumberFormat( const OUString& rPropertyName, const Reference< bea Reference< beans::XPropertySet > xSeqProp( xSequence, uno::UNO_QUERY_THROW ); OUString aRole; if( ( xSeqProp->getPropertyValue( "Role" ) >>= aRole ) && - aRole.match( aRolePrefix )) + aRole.match( "error-bars-" )) { aResult.push_back( xSequence ); } @@ -3720,9 +3718,7 @@ void SchXMLExportHelper_Impl::InitRangeSegmentationProperties( const Reference< Sequence< OUString > SAL_CALL SchXMLExport_getSupportedServiceNames() throw() { - const OUString aServiceName( "com.sun.star.comp.Chart.XMLExporter" ); - const Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; + return Sequence< OUString > { "com.sun.star.comp.Chart.XMLExporter" }; } OUString SAL_CALL SchXMLExport_getImplementationName() throw() @@ -3739,9 +3735,7 @@ Reference< uno::XInterface > SAL_CALL SchXMLExport_createInstance(const Referenc // Oasis format Sequence< OUString > SAL_CALL SchXMLExport_Oasis_getSupportedServiceNames() throw() { - const OUString aServiceName( "com.sun.star.comp.Chart.XMLOasisExporter" ); - const Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; + return Sequence< OUString > { "com.sun.star.comp.Chart.XMLOasisExporter" }; } OUString SAL_CALL SchXMLExport_Oasis_getImplementationName() throw() @@ -3761,9 +3755,7 @@ Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_createInstance(const Re Sequence< OUString > SAL_CALL SchXMLExport_Styles_getSupportedServiceNames() throw() { - const OUString aServiceName( "com.sun.star.comp.Chart.XMLStylesExporter" ); - const Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; + return Sequence< OUString > { "com.sun.star.comp.Chart.XMLStylesExporter" }; } OUString SAL_CALL SchXMLExport_Styles_getImplementationName() throw() @@ -3779,14 +3771,12 @@ Reference< uno::XInterface > SAL_CALL SchXMLExport_Styles_createInstance(const R // Oasis format Sequence< OUString > SAL_CALL SchXMLExport_Oasis_Styles_getSupportedServiceNames() throw() { - const OUString aServiceName( "com.sun.star.comp.Chart.XMLOasisStylesExporter" ); - const Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; + return Sequence< OUString > { "com.sun.star.comp.Chart.XMLOasisStylesExporter" }; } OUString SAL_CALL SchXMLExport_Oasis_Styles_getImplementationName() throw() { - return OUString( "SchXMLExport.Oasis.Styles" ); + return OUString( "SchXMLExport.Oasis.Styles" ); } Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_Styles_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) @@ -3796,9 +3786,7 @@ Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_Styles_createInstance(c Sequence< OUString > SAL_CALL SchXMLExport_Content_getSupportedServiceNames() throw() { - const OUString aServiceName( "com.sun.star.comp.Chart.XMLContentExporter" ); - const Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; + return Sequence< OUString > { "com.sun.star.comp.Chart.XMLContentExporter" }; } OUString SAL_CALL SchXMLExport_Content_getImplementationName() throw() @@ -3814,9 +3802,7 @@ Reference< uno::XInterface > SAL_CALL SchXMLExport_Content_createInstance(const // Oasis format Sequence< OUString > SAL_CALL SchXMLExport_Oasis_Content_getSupportedServiceNames() throw() { - const OUString aServiceName( "com.sun.star.comp.Chart.XMLOasisContentExporter" ); - const Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; + return Sequence< OUString > { "com.sun.star.comp.Chart.XMLOasisContentExporter" }; } OUString SAL_CALL SchXMLExport_Oasis_Content_getImplementationName() throw() @@ -3832,9 +3818,7 @@ Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_Content_createInstance( // Oasis format Sequence< OUString > SAL_CALL SchXMLExport_Oasis_Meta_getSupportedServiceNames() throw() { - const OUString aServiceName( "com.sun.star.comp.Chart.XMLOasisMetaExporter" ); - const Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; + return Sequence< OUString > { "com.sun.star.comp.Chart.XMLOasisMetaExporter" }; } OUString SAL_CALL SchXMLExport_Oasis_Meta_getImplementationName() throw() diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx index 2f7a58607b42..d144a650f899 100644 --- a/xmloff/source/chart/SchXMLImport.cxx +++ b/xmloff/source/chart/SchXMLImport.cxx @@ -658,9 +658,7 @@ void SAL_CALL SchXMLImport::setTargetDocument( const uno::Reference< lang::XComp Sequence< OUString > SAL_CALL SchXMLImport_getSupportedServiceNames() throw() { - const OUString aServiceName( "com.sun.star.comp.Chart.XMLOasisImporter" ); - const Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; + return Sequence< OUString > { "com.sun.star.comp.Chart.XMLOasisImporter" }; } OUString SAL_CALL SchXMLImport_getImplementationName() throw() @@ -677,14 +675,12 @@ Reference< uno::XInterface > SAL_CALL SchXMLImport_createInstance(const Referenc Sequence< OUString > SAL_CALL SchXMLImport_Styles_getSupportedServiceNames() throw() { - const OUString aServiceName( "com.sun.star.comp.Chart.XMLOasisStylesImporter" ); - const Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; + return Sequence< OUString > { "com.sun.star.comp.Chart.XMLOasisStylesImporter" }; } OUString SAL_CALL SchXMLImport_Styles_getImplementationName() throw() { - return OUString( "SchXMLImport.Styles" ); + return OUString( "SchXMLImport.Styles" ); } Reference< uno::XInterface > SAL_CALL SchXMLImport_Styles_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) @@ -694,9 +690,7 @@ Reference< uno::XInterface > SAL_CALL SchXMLImport_Styles_createInstance(const R Sequence< OUString > SAL_CALL SchXMLImport_Content_getSupportedServiceNames() throw() { - const OUString aServiceName( "com.sun.star.comp.Chart.XMLOasisContentImporter" ); - const Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; + return Sequence< OUString > { "com.sun.star.comp.Chart.XMLOasisContentImporter" }; } OUString SAL_CALL SchXMLImport_Content_getImplementationName() throw() @@ -711,9 +705,7 @@ Reference< uno::XInterface > SAL_CALL SchXMLImport_Content_createInstance(const Sequence< OUString > SAL_CALL SchXMLImport_Meta_getSupportedServiceNames() throw() { - const OUString aServiceName( "com.sun.star.comp.Chart.XMLOasisMetaImporter" ); - const Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; + return Sequence< OUString > { "com.sun.star.comp.Chart.XMLOasisMetaImporter" }; } OUString SAL_CALL SchXMLImport_Meta_getImplementationName() throw() diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx index becd54016286..a012696d3238 100644 --- a/xmloff/source/draw/animationimport.cxx +++ b/xmloff/source/draw/animationimport.cxx @@ -90,9 +90,7 @@ using ::com::sun::star::lang::XInitialization; Sequence< OUString > SAL_CALL AnimationsImport_getSupportedServiceNames() throw() { - const OUString aServiceName( "com.sun.star.comp.Xmloff.AnimationsImport" ); - const Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; + return Sequence< OUString > { "com.sun.star.comp.Xmloff.AnimationsImport" }; } OUString SAL_CALL AnimationsImport_getImplementationName() throw() diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 51d536f5d3c3..9283b168fc10 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -2729,9 +2729,7 @@ void SdXMLExport::exportAnnotations( const Reference& xDrawPage ) #define SERVICE( classname, servicename, implementationname, draw, flags )\ uno::Sequence< OUString > SAL_CALL classname##_getSupportedServiceNames() throw()\ {\ - const OUString aServiceName( servicename );\ - const uno::Sequence< OUString > aSeq( &aServiceName, 1 );\ - return aSeq;\ + return uno::Sequence< OUString > { servicename };\ }\ OUString SAL_CALL classname##_getImplementationName() throw()\ {\ diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx index afc5130e15fc..88d036da02f9 100644 --- a/xmloff/source/draw/sdxmlimp.cxx +++ b/xmloff/source/draw/sdxmlimp.cxx @@ -254,13 +254,11 @@ SvXMLImportContext *SdXMLFlatDocContext_Impl::CreateChildContext( #define SERVICE(classname,servicename,implementationname,draw,flags)\ uno::Sequence< OUString > SAL_CALL classname##_getSupportedServiceNames() throw()\ {\ - const OUString aServiceName( servicename );\ - const uno::Sequence< OUString > aSeq( &aServiceName, 1 );\ - return aSeq;\ + return uno::Sequence< OUString > { servicename };\ }\ OUString SAL_CALL classname##_getImplementationName() throw()\ {\ - return OUString( implementationname );\ + return OUString( implementationname );\ }\ uno::Reference< uno::XInterface > SAL_CALL classname##_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )\ {\ diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index de47927b9331..676e5a670883 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -4205,8 +4205,7 @@ void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Reference< bean if ( aGeoPropSet >>= aGeoPropSeq ) { bool bCoordinates = false; - const OUString sCustomShapeType( "non-primitive" ); - OUString aCustomShapeType( sCustomShapeType ); + OUString aCustomShapeType( "non-primitive" ); sal_Int32 j, nGeoPropCount = aGeoPropSeq.getLength(); for ( j = 0; j < nGeoPropCount; j++ ) diff --git a/xmloff/source/meta/MetaExportComponent.cxx b/xmloff/source/meta/MetaExportComponent.cxx index 3f9d0eb71ca1..951eb5554d28 100644 --- a/xmloff/source/meta/MetaExportComponent.cxx +++ b/xmloff/source/meta/MetaExportComponent.cxx @@ -184,15 +184,12 @@ void XMLMetaExportComponent::_ExportContent() {} uno::Sequence< OUString > SAL_CALL XMLMetaExportComponent_getSupportedServiceNames() throw() { - const OUString aServiceName( - "com.sun.star.document.XMLOasisMetaExporter" ); - const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; + return uno::Sequence< OUString > { "com.sun.star.document.XMLOasisMetaExporter" }; } OUString SAL_CALL XMLMetaExportComponent_getImplementationName() throw() { - return OUString( "XMLMetaExportComponent" ); + return OUString( "XMLMetaExportComponent" ); } uno::Reference< uno::XInterface > SAL_CALL XMLMetaExportComponent_createInstance( @@ -205,15 +202,12 @@ uno::Reference< uno::XInterface > SAL_CALL XMLMetaExportComponent_createInstance uno::Sequence< OUString > SAL_CALL XMLMetaExportOOO_getSupportedServiceNames() throw() { - const OUString aServiceName( - "com.sun.star.document.XMLMetaExporter" ); - const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; + return uno::Sequence< OUString > { "com.sun.star.document.XMLMetaExporter" }; } OUString SAL_CALL XMLMetaExportOOO_getImplementationName() throw() { - return OUString( "XMLMetaExportOOo" ); + return OUString( "XMLMetaExportOOo" ); } uno::Reference< uno::XInterface > SAL_CALL XMLMetaExportOOO_createInstance( diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx index ce4f96b8ac68..c6b6f6dc5ad0 100644 --- a/xmloff/source/meta/xmlmetai.cxx +++ b/xmloff/source/meta/xmlmetai.cxx @@ -146,17 +146,16 @@ lcl_initGenerator(SvXMLImport & rImport, xPath->registerNS(GetXMLToken(XML_NP_OFFICE),GetXMLToken(XML_N_OFFICE)); xPath->registerNS(GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META)); - OUString const expr( "string(/office:document-meta/office:meta/meta:generator)"); uno::Reference< xml::xpath::XXPathObject > const xObj( - xPath->eval(xDoc.get(), expr), uno::UNO_SET_THROW); + xPath->eval(xDoc.get(), "string(/office:document-meta/office:meta/meta:generator)"), + uno::UNO_SET_THROW); OUString const value(xObj->getString()); SvXMLMetaDocumentContext::setBuildId(value, rImport.getImportInfo()); } catch (const uno::RuntimeException&) { throw; } catch (const uno::Exception& e) { throw lang::WrappedTargetRuntimeException( - OUString( - "SvXMLMetaDocumentContext::initGenerator: exception"), + "SvXMLMetaDocumentContext::initGenerator: exception", rImport, makeAny(e)); } } diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx index 542ca8de84c1..5db79f5bc7a4 100644 --- a/xmloff/source/text/txtexppr.cxx +++ b/xmloff/source/text/txtexppr.cxx @@ -1156,7 +1156,6 @@ static bool lcl_IsOutlineStyle(const SvXMLExport &rExport, const OUString & rNam xCNSupplier(rExport.GetModel(), UNO_QUERY); OUString sOutlineName; - OUString sName("Name"); if (xCNSupplier.is()) { @@ -1165,7 +1164,7 @@ static bool lcl_IsOutlineStyle(const SvXMLExport &rExport, const OUString & rNam DBG_ASSERT( xNumRule.is(), "no chapter numbering rules" ); if (xNumRule.is()) { - xNumRule->getPropertyValue(sName) >>= sOutlineName; + xNumRule->getPropertyValue("Name") >>= sOutlineName; } } -- cgit e/debugevent LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author