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 --- avmedia/source/gstreamer/gstuno.cxx | 3 +- avmedia/source/opengl/ogluno.cxx | 4 +- basctl/source/basicide/basobj2.cxx | 5 +- basctl/source/basicide/basobj3.cxx | 3 +- basctl/source/basicide/moduldl2.cxx | 4 +- basic/source/classes/eventatt.cxx | 4 +- basic/source/classes/propacc.cxx | 3 +- basic/source/classes/sbunoobj.cxx | 6 +- .../controller/dialogs/tp_3D_SceneIllumination.cxx | 18 +-- chart2/source/tools/DataSeriesHelper.cxx | 3 +- chart2/source/tools/ErrorBar.cxx | 3 +- chart2/source/tools/ExplicitCategoriesProvider.cxx | 3 +- chart2/source/view/main/VLegend.cxx | 3 +- comphelper/source/xml/ofopxmlhelper.cxx | 18 +-- compilerplugins/clang/oncevar.cxx | 146 +++++++++++++++++++++ configmgr/source/configurationprovider.cxx | 3 +- configmgr/source/configurationregistry.cxx | 3 +- configmgr/source/defaultprovider.cxx | 3 +- configmgr/source/readonlyaccess.cxx | 3 +- configmgr/source/readwriteaccess.cxx | 3 +- configmgr/source/update.cxx | 3 +- connectivity/source/commontools/DateConversion.cxx | 3 +- connectivity/source/commontools/dbtools.cxx | 6 +- connectivity/source/drivers/hsqldb/HDriver.cxx | 7 +- .../source/drivers/postgresql/pq_connection.cxx | 3 +- .../source/drivers/postgresql/pq_driver.cxx | 10 +- connectivity/source/manager/mdrivermanager.cxx | 14 +- cppu/source/uno/lbenv.cxx | 3 +- cppu/source/uno/lbmap.cxx | 3 +- cpputools/source/unoexe/unoexe.cxx | 6 +- dbaccess/source/ui/misc/UITools.cxx | 4 +- dbaccess/source/ui/querydesign/QueryDesignView.cxx | 6 +- desktop/source/lib/init.cxx | 3 +- desktop/source/splash/splash.cxx | 6 +- desktop/source/splash/unxsplash.cxx | 4 +- .../drawinglayeruno/xprimitive2drenderer.cxx | 4 +- editeng/source/uno/unofield.cxx | 3 +- filter/source/graphicfilter/ieps/ieps.cxx | 24 ++-- filter/source/msfilter/escherex.cxx | 3 +- forms/source/xforms/xpathlib/xpathlib.cxx | 4 +- framework/source/layoutmanager/helpers.cxx | 9 +- io/source/stm/opump.cxx | 4 +- javaunohelper/source/javaunohelper.cxx | 12 +- jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 6 +- jvmfwk/source/fwkbase.cxx | 16 +-- linguistic/source/dlistimp.cxx | 3 +- oox/source/drawingml/customshapegeometry.cxx | 60 ++------- oox/source/drawingml/table/tableproperties.cxx | 6 +- oox/source/export/chartexport.cxx | 3 +- reportdesign/source/ui/report/propbrw.cxx | 8 +- sc/source/core/data/docpool.cxx | 3 +- sc/source/core/tool/interpr4.cxx | 3 +- scripting/source/dlgprov/dlgprov.cxx | 3 +- sd/source/filter/xml/sdxmlwrp.cxx | 3 +- sd/source/ui/animations/CustomAnimationPane.cxx | 9 +- sd/source/ui/table/tablefunction.cxx | 3 +- sd/source/ui/unoidl/unomodel.cxx | 10 +- sd/source/ui/view/drviewse.cxx | 3 +- sdext/source/minimizer/graphiccollector.cxx | 16 +-- sdext/source/minimizer/impoptimizer.cxx | 12 +- sfx2/source/appl/appinit.cxx | 3 +- sfx2/source/appl/appuno.cxx | 6 +- sfx2/source/config/evntconf.cxx | 21 +-- sfx2/source/dialog/filtergrouping.cxx | 13 +- sfx2/source/doc/sfxbasemodel.cxx | 6 +- stoc/source/javavm/javavm.cxx | 3 +- svgio/source/svguno/xsvgparser.cxx | 4 +- svx/source/form/fmPropBrw.cxx | 9 +- svx/source/svdraw/svdoashp.cxx | 36 ++--- svx/source/toolbars/extrusionbar.cxx | 7 +- svx/source/toolbars/fontworkbar.cxx | 3 +- sw/source/filter/ww8/docxexportfilter.cxx | 4 +- sw/source/filter/ww8/rtfexportfilter.cxx | 4 +- sw/source/uibase/dbui/dbmgr.cxx | 2 +- sw/source/uibase/shells/langhelper.cxx | 6 +- unodevtools/source/unodevtools/options.cxx | 6 +- unotools/source/config/bootstrap.cxx | 4 +- vbahelper/source/vbahelper/vbahelper.cxx | 4 +- vcl/source/components/dtranscomp.cxx | 34 ++--- vcl/source/components/fontident.cxx | 4 +- vcl/source/control/field2.cxx | 10 +- vcl/unx/generic/desktopdetect/desktopdetector.cxx | 38 +++--- 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 +- xmlscript/source/xml_helper/xml_impctx.cxx | 3 +- xmlscript/source/xmldlg_imexp/xmldlg_export.cxx | 3 +- xmlscript/source/xmllib_imexp/xmllib_export.cxx | 12 +- xmlscript/source/xmlmod_imexp/xmlmod_export.cxx | 3 +- xmlsecurity/source/dialogs/resourcemanager.cxx | 3 +- .../source/helper/documentsignaturehelper.cxx | 9 +- 97 files changed, 390 insertions(+), 515 deletions(-) create mode 100644 compilerplugins/clang/oncevar.cxx diff --git a/avmedia/source/gstreamer/gstuno.cxx b/avmedia/source/gstreamer/gstuno.cxx index 6e8bbc837fd0..b72a355d5a4d 100644 --- a/avmedia/source/gstreamer/gstuno.cxx +++ b/avmedia/source/gstreamer/gstuno.cxx @@ -46,10 +46,9 @@ extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL avmediagst_component_getFactory( if( rtl_str_compare( pImplName, IMPL_NAME ) == 0 ) { - const OUString aServiceName( SERVICE_NAME ); xFactory.set( ::cppu::createSingleFactory( static_cast< lang::XMultiServiceFactory* >( pServiceManager ), - IMPL_NAME, create_MediaPlayer, uno::Sequence< OUString >( &aServiceName, 1 ) ) ); + IMPL_NAME, create_MediaPlayer, uno::Sequence< OUString > { SERVICE_NAME } ) ); } if( xFactory.is() ) diff --git a/avmedia/source/opengl/ogluno.cxx b/avmedia/source/opengl/ogluno.cxx index fc9f6095be34..ca2b7127d21e 100644 --- a/avmedia/source/opengl/ogluno.cxx +++ b/avmedia/source/opengl/ogluno.cxx @@ -27,12 +27,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL avmediaogl_component_getFactory( if( rtl_str_compare( pImplName, "com.sun.star.comp.avmedia.Manager_OpenGL" ) == 0 ) { - const OUString aServiceName( "com.sun.star.media.Manager_OpenGL" ); - xFactory.set( ::cppu::createSingleFactory( static_cast< lang::XMultiServiceFactory* >( pServiceManager ), "com.sun.star.comp.avmedia.Manager_OpenGL", - create_MediaPlayer, uno::Sequence< OUString >( &aServiceName, 1 ) ) ); + create_MediaPlayer, uno::Sequence< OUString >{ "com.sun.star.media.Manager_OpenGL" } ) ); } if( xFactory.is() ) diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx index e2a9fb781c0b..68a87ea0172e 100644 --- a/basctl/source/basicide/basobj2.cxx +++ b/basctl/source/basicide/basobj2.cxx @@ -296,9 +296,6 @@ OUString ChooseMacro( const uno::Reference< frame::XModel >& rxLimitToDocument, aName += "."; aName += pMethod->GetName(); - // language - OUString aLanguage("Basic"); - // location OUString aLocation; ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) ); @@ -348,7 +345,7 @@ OUString ChooseMacro( const uno::Reference< frame::XModel >& rxLimitToDocument, aScriptURL = "vnd.sun.star.script:" ; aScriptURL += aName; aScriptURL += "?language=" ; - aScriptURL += aLanguage; + aScriptURL += "Basic"; aScriptURL += "&location=" ; aScriptURL += aLocation; } diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx index 9edd9958f334..dceb6be61d05 100644 --- a/basctl/source/basicide/basobj3.cxx +++ b/basctl/source/basicide/basobj3.cxx @@ -69,11 +69,10 @@ SbMethod* CreateMacro( SbModule* pModule, const OUString& rMacroName ) else { bool bValid = false; - OUString aStdMacroText( "Macro" ); sal_Int32 nMacro = 1; while ( !bValid ) { - aMacroName = aStdMacroText; + aMacroName = "Macro"; aMacroName += OUString::number( nMacro ); // test whether existing... bValid = pModule->GetMethods()->Find( aMacroName, SbxCLASS_METHOD ) == nullptr; diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index ced2c307b423..9490bed33433 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -1481,13 +1481,11 @@ void createLibImpl( vcl::Window* pWin, const ScriptDocument& rDocument, // create library name OUString aLibName; - OUString aLibStdName( "Library" ); - //String aLibStdName( IDEResId( RID_STR_STDLIBNAME ) ); bool bValid = false; sal_Int32 i = 1; while ( !bValid ) { - aLibName = aLibStdName + OUString::number( i ); + aLibName = "Library" + OUString::number( i ); if ( !rDocument.hasLibrary( E_SCRIPTS, aLibName ) && !rDocument.hasLibrary( E_DIALOGS, aLibName ) ) bValid = true; i++; diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx index a47404dca919..ccdfd20311ae 100644 --- a/basic/source/classes/eventatt.cxx +++ b/basic/source/classes/eventatt.cxx @@ -477,9 +477,7 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, bool bWrite ) if( !bDecoration ) { xDlgModPropSet->setPropertyValue( aDecorationPropName, makeAny( true ) ); - - OUString aTitlePropName("Title"); - xDlgModPropSet->setPropertyValue( aTitlePropName, makeAny( OUString() ) ); + xDlgModPropSet->setPropertyValue( "Title", makeAny( OUString() ) ); } } catch(const UnknownPropertyException& ) diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx index ae2cdb2fc78e..ead41afb7253 100644 --- a/basic/source/classes/propacc.cxx +++ b/basic/source/classes/propacc.cxx @@ -204,7 +204,6 @@ void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, bool bWrite } // Get class names of struct - OUString aServiceName( "stardiv.uno.beans.PropertySet"); Reference< XInterface > xInterface = static_cast(new SbPropertyValues()); @@ -222,7 +221,7 @@ void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, bool bWrite // Build a SbUnoObject and return it Any aAny; aAny <<= xInterface; - SbUnoObjectRef xUnoObj = new SbUnoObject( aServiceName, aAny ); + SbUnoObjectRef xUnoObj = new SbUnoObject( "stardiv.uno.beans.PropertySet", aAny ); if( xUnoObj->getUnoAny().getValueType().getTypeClass() != TypeClass_VOID ) { // Return object diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 74a97996fc4a..4d7c18924742 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -346,9 +346,8 @@ Any convertAny( const Any& rVal, const Type& aDestType ) } catch( const CannotConvertException& e2 ) { - OUString aCannotConvertExceptionName( "com.sun.star.lang.IllegalArgumentException"); StarBASIC::Error( ERRCODE_BASIC_EXCEPTION, - implGetExceptionMsg( e2, aCannotConvertExceptionName ) ); + implGetExceptionMsg( e2, "com.sun.star.lang.IllegalArgumentException" ) ); return aConvertedVal; } return aConvertedVal; @@ -4283,9 +4282,8 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, bool bWrite ) } catch( const NoSuchElementException& e1 ) { - OUString aNoSuchElementExceptionName( "com.sun.star.container.NoSuchElementException" ); StarBASIC::Error( ERRCODE_BASIC_EXCEPTION, - implGetExceptionMsg( e1, aNoSuchElementExceptionName ) ); + implGetExceptionMsg( e1, "com.sun.star.container.NoSuchElementException" ) ); return; } Reference< XTypeDescription > xTypeDesc; diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx index a4796a815175..80255fb15264 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx @@ -133,16 +133,13 @@ namespace ::chart::LightSource aResult; if( 0 <= nIndex && nIndex < 8 ) { - OUString aColorPropertyPrefix("D3DSceneLightColor"); - OUString aDirectionPropertyPrefix("D3DSceneLightDirection"); - OUString aEnabledPropertyPrefix("D3DSceneLightOn"); OUString aIndex( OUString::number( nIndex + 1 )); try { - xSceneProperties->getPropertyValue( aColorPropertyPrefix + aIndex ) >>= aResult.nDiffuseColor; - xSceneProperties->getPropertyValue( aDirectionPropertyPrefix + aIndex ) >>= aResult.aDirection; - xSceneProperties->getPropertyValue( aEnabledPropertyPrefix + aIndex ) >>= aResult.bIsEnabled; + xSceneProperties->getPropertyValue( "D3DSceneLightColor" + aIndex ) >>= aResult.nDiffuseColor; + xSceneProperties->getPropertyValue( "D3DSceneLightDirection" + aIndex ) >>= aResult.aDirection; + xSceneProperties->getPropertyValue( "D3DSceneLightOn" + aIndex ) >>= aResult.bIsEnabled; } catch( const uno::Exception & ex ) { @@ -161,18 +158,15 @@ namespace { if( 0 <= nIndex && nIndex < 8 ) { - OUString aColorPropertyPrefix("D3DSceneLightColor"); - OUString aDirectionPropertyPrefix("D3DSceneLightDirection"); - OUString aEnabledPropertyPrefix("D3DSceneLightOn"); OUString aIndex( OUString::number( nIndex + 1 )); try { - xSceneProperties->setPropertyValue( aColorPropertyPrefix + aIndex, + xSceneProperties->setPropertyValue( "D3DSceneLightColor" + aIndex, uno::makeAny( rLightSource.nDiffuseColor )); - xSceneProperties->setPropertyValue( aDirectionPropertyPrefix + aIndex, + xSceneProperties->setPropertyValue( "D3DSceneLightDirection" + aIndex, uno::makeAny( rLightSource.aDirection )); - xSceneProperties->setPropertyValue( aEnabledPropertyPrefix + aIndex, + xSceneProperties->setPropertyValue( "D3DSceneLightOn" + aIndex, uno::makeAny( rLightSource.bIsEnabled )); } catch( const uno::Exception & ex ) diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx index 6cea3031b228..eea642e0ace9 100644 --- a/chart2/source/tools/DataSeriesHelper.cxx +++ b/chart2/source/tools/DataSeriesHelper.cxx @@ -390,7 +390,6 @@ void setStackModeAtSeries( if( eStackMode == StackMode_AMBIGUOUS ) return; - const OUString aPropName( "StackingDirection" ); const uno::Any aPropValue = uno::makeAny( ( (eStackMode == StackMode_Y_STACKED) || (eStackMode == StackMode_Y_STACKED_PERCENT) ) @@ -407,7 +406,7 @@ void setStackModeAtSeries( Reference< beans::XPropertySet > xProp( aSeries[i], uno::UNO_QUERY ); if( xProp.is() ) { - xProp->setPropertyValue( aPropName, aPropValue ); + xProp->setPropertyValue( "StackingDirection", aPropValue ); sal_Int32 nAxisIndex; xProp->getPropertyValue( "AttachedAxisIndex" ) >>= nAxisIndex; diff --git a/chart2/source/tools/ErrorBar.cxx b/chart2/source/tools/ErrorBar.cxx index 4f301e460fb7..c22e592028b0 100644 --- a/chart2/source/tools/ErrorBar.cxx +++ b/chart2/source/tools/ErrorBar.cxx @@ -179,7 +179,6 @@ namespace { OUString getSourceRangeStrFromLabeledSequences( const uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > >& aSequences, bool bPositive ) { - const OUString aRolePrefix( "error-bars" ); OUString aDirection; if(bPositive) aDirection = "positive"; @@ -196,7 +195,7 @@ OUString getSourceRangeStrFromLabeledSequences( const uno::Sequence< uno::Refere uno::Reference< beans::XPropertySet > xSeqProp( xSequence, uno::UNO_QUERY_THROW ); OUString aRole; if( ( xSeqProp->getPropertyValue( "Role" ) >>= aRole ) && - aRole.match( aRolePrefix ) && aRole.indexOf(aDirection) >= 0 ) + aRole.match( "error-bars" ) && aRole.indexOf(aDirection) >= 0 ) { return xSequence->getSourceRangeRepresentation(); } diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index 56977db55e4b..c7c588b699c9 100644 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -371,7 +371,6 @@ Sequence< OUString > lcl_getExplicitSimpleCategories( { aRet.realloc(nMaxCategoryCount); aOuterEnd = aComplexCatsPerIndex.end(); - OUString aSpace(" "); for(sal_Int32 nN=0; nN lcl_getExplicitSimpleCategories( if( !aAddText.isEmpty() ) { if(!aText.isEmpty()) - aText += aSpace; + aText += " "; aText += aAddText; } } diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index 584ea6bd9877..478cd1928920 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -288,8 +288,7 @@ awt::Size lcl_placeLegendEntries( const sal_Int32 nSymbolToTextDistance = static_cast< sal_Int32 >( std::max( 100.0, fViewFontSize * 0.22 ) );//minimum 1mm const sal_Int32 nSymbolPlusDistanceWidth = rMaxSymbolExtent.Width + nSymbolToTextDistance; sal_Int32 nMaxTextWidth = rAvailableSpace.Width - (2 * nXPadding) - nSymbolPlusDistanceWidth; - OUString aPropNameTextMaximumFrameWidth( "TextMaximumFrameWidth" ); - uno::Any* pFrameWidthAny = PropertyMapper::getValuePointer( rTextProperties.second, rTextProperties.first, aPropNameTextMaximumFrameWidth); + uno::Any* pFrameWidthAny = PropertyMapper::getValuePointer( rTextProperties.second, rTextProperties.first, "TextMaximumFrameWidth"); if(pFrameWidthAny) { if( eExpansion == ::com::sun::star::chart::ChartLegendExpansion_HIGH ) diff --git a/comphelper/source/xml/ofopxmlhelper.cxx b/comphelper/source/xml/ofopxmlhelper.cxx index 23ced17483a2..161481229914 100644 --- a/comphelper/source/xml/ofopxmlhelper.cxx +++ b/comphelper/source/xml/ofopxmlhelper.cxx @@ -128,10 +128,6 @@ void WriteRelationsInfoSequence( OUString aRelListElement( "Relationships" ); OUString aRelElement( "Relationship" ); - OUString aIDAttr( "Id" ); - OUString aTypeAttr( "Type" ); - OUString aTargetModeAttr( "TargetMode" ); - OUString aTargetAttr( "Target" ); OUString aCDATAString( "CDATA" ); OUString aWhiteSpace( " " ); @@ -152,10 +148,10 @@ void WriteRelationsInfoSequence( uno::Reference< xml::sax::XAttributeList > xAttrList( pAttrList ); for( sal_Int32 nSecInd = 0; nSecInd < aSequence[nInd].getLength(); nSecInd++ ) { - if ( aSequence[nInd][nSecInd].First.equals( aIDAttr ) - || aSequence[nInd][nSecInd].First.equals( aTypeAttr ) - || aSequence[nInd][nSecInd].First.equals( aTargetModeAttr ) - || aSequence[nInd][nSecInd].First.equals( aTargetAttr ) ) + if ( aSequence[nInd][nSecInd].First == "Id" + || aSequence[nInd][nSecInd].First == "Type" + || aSequence[nInd][nSecInd].First == "TargetMode" + || aSequence[nInd][nSecInd].First == "Target" ) { pAttrList->AddAttribute( aSequence[nInd][nSecInd].First, aCDATAString, aSequence[nInd][nSecInd].Second ); } @@ -194,8 +190,6 @@ void WriteContentSequence( OUString aTypesElement( "Types" ); OUString aDefaultElement( "Default" ); OUString aOverrideElement( "Override" ); - OUString aExtensionAttr( "Extension" ); - OUString aPartNameAttr( "PartName" ); OUString aContentTypeAttr( "ContentType" ); OUString aCDATAString( "CDATA" ); OUString aWhiteSpace( " " ); @@ -215,7 +209,7 @@ void WriteContentSequence( { AttributeList *pAttrList = new AttributeList; uno::Reference< xml::sax::XAttributeList > xAttrList( pAttrList ); - pAttrList->AddAttribute( aExtensionAttr, aCDATAString, aDefaultsSequence[nInd].First ); + pAttrList->AddAttribute( "Extension", aCDATAString, aDefaultsSequence[nInd].First ); pAttrList->AddAttribute( aContentTypeAttr, aCDATAString, aDefaultsSequence[nInd].Second ); xWriter->startElement( aDefaultElement, xAttrList ); @@ -227,7 +221,7 @@ void WriteContentSequence( { AttributeList *pAttrList = new AttributeList; uno::Reference< xml::sax::XAttributeList > xAttrList( pAttrList ); - pAttrList->AddAttribute( aPartNameAttr, aCDATAString, aOverridesSequence[nInd].First ); + pAttrList->AddAttribute( "PartName", aCDATAString, aOverridesSequence[nInd].First ); pAttrList->AddAttribute( aContentTypeAttr, aCDATAString, aOverridesSequence[nInd].Second ); xWriter->startElement( aOverrideElement, xAttrList ); diff --git a/compilerplugins/clang/oncevar.cxx b/compilerplugins/clang/oncevar.cxx new file mode 100644 index 000000000000..6a348b4235b9 --- /dev/null +++ b/compilerplugins/clang/oncevar.cxx @@ -0,0 +1,146 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 +#include +#include + +#include "plugin.hxx" +#include "compat.hxx" +#include "clang/AST/CXXInheritance.h" + +// Idea from tml. +// Check for OUString variables that are +// (1) initialised from a string literal +// (2) only used in one spot +// In which case, we might as well inline it. + +namespace +{ + +class OnceVar: + public RecursiveASTVisitor, public loplugin::Plugin +{ +public: + explicit OnceVar(InstantiationData const & data): Plugin(data) {} + + virtual void run() override { + TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); + } + + bool TraverseFunctionDecl( FunctionDecl* stmt ); + bool VisitDeclRefExpr( const DeclRefExpr* ); + +private: + bool mbChecking; + std::map maVarUsesMap; + std::map maVarDeclSourceRangeMap; + std::map maVarUseSourceRangeMap; + StringRef getFilename(SourceLocation loc); +}; + +StringRef OnceVar::getFilename(SourceLocation loc) +{ + SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(loc); + StringRef name { compiler.getSourceManager().getFilename(spellingLocation) }; + return name; +} + +bool OnceVar::TraverseFunctionDecl(FunctionDecl * decl) +{ + if (ignoreLocation(decl)) { + return true; + } + if (!decl->hasBody()) { + return true; + } + if ( decl != decl->getCanonicalDecl() ) { + return true; + } + + // some places, it makes the code worse + StringRef aFileName = getFilename(decl->getLocStart()); + if (aFileName.startswith(SRCDIR "/sal/qa/osl/module/osl_Module.cxx")) { + return true; + } + + maVarUsesMap.clear(); + maVarDeclSourceRangeMap.clear(); + mbChecking = true; + TraverseStmt(decl->getBody()); + mbChecking = false; + for (auto it = maVarUsesMap.cbegin(); it != maVarUsesMap.cend(); ++it) + { + if (it->second == 1) + { + report(DiagnosticsEngine::Warning, + "OUString var used only once, should be inlined", + it->first) + << maVarDeclSourceRangeMap[it->first]; + report(DiagnosticsEngine::Note, + "to this spot", + maVarUseSourceRangeMap[it->first].getBegin()) + << maVarUseSourceRangeMap[it->first]; + } + } + return true; +} + +bool OnceVar::VisitDeclRefExpr( const DeclRefExpr* declRefExpr ) +{ + if (!mbChecking) + return true; + const Decl* decl = declRefExpr->getDecl(); + if (!isa(decl) || isa(decl)) { + return true; + } + const VarDecl * varDecl = dyn_cast(decl)->getCanonicalDecl(); + if (!varDecl->hasInit() || varDecl->hasGlobalStorage()) { + return true; + } + if (varDecl->getType().getUnqualifiedType().getAsString().find("OUString") == std::string::npos) { + return true; + } + const CXXConstructExpr* constructExpr = dyn_cast(varDecl->getInit()); + if (!constructExpr || constructExpr->getNumArgs() < 1) { + return true; + } + if (!isa(constructExpr->getArg(0))) { + return true; + } + + SourceLocation loc = varDecl->getLocation(); + + // ignore cases like: + // const OUString("xxx") xxx; + // rtl_something(xxx.pData); + // and + // foo(&xxx); + // where we cannot inline the declaration. + if (isa(parentStmt(declRefExpr)) + || isa(parentStmt(declRefExpr))) { + maVarUsesMap[loc] = 2; + return true; + } + + if (maVarUsesMap.find(loc) == maVarUsesMap.end()) { + maVarUsesMap[loc] = 1; + maVarDeclSourceRangeMap[loc] = varDecl->getSourceRange(); + maVarUseSourceRangeMap[loc] = declRefExpr->getSourceRange(); + } else { + maVarUsesMap[loc]++; + } + return true; +} + +loplugin::Plugin::Registration< OnceVar > X("oncevar"); + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/configmgr/source/configurationprovider.cxx b/configmgr/source/configurationprovider.cxx index 0c4b40868772..2707a4f35e0d 100644 --- a/configmgr/source/configurationprovider.cxx +++ b/configmgr/source/configurationprovider.cxx @@ -476,8 +476,7 @@ OUString getImplementationName() { } css::uno::Sequence< OUString > getSupportedServiceNames() { - OUString name("com.sun.star.configuration.ConfigurationProvider"); - return css::uno::Sequence< OUString >(&name, 1); + return css::uno::Sequence< OUString > { "com.sun.star.configuration.ConfigurationProvider" }; } css::uno::Reference< css::lang::XSingleComponentFactory > diff --git a/configmgr/source/configurationregistry.cxx b/configmgr/source/configurationregistry.cxx index 2d0274628292..b91bd1db21ee 100644 --- a/configmgr/source/configurationregistry.cxx +++ b/configmgr/source/configurationregistry.cxx @@ -795,8 +795,7 @@ OUString getImplementationName() { } css::uno::Sequence< OUString > getSupportedServiceNames() { - OUString name("com.sun.star.configuration.ConfigurationRegistry"); - return css::uno::Sequence< OUString >(&name, 1); + return css::uno::Sequence< OUString > { "com.sun.star.configuration.ConfigurationRegistry" }; } } } diff --git a/configmgr/source/defaultprovider.cxx b/configmgr/source/defaultprovider.cxx index df4d1b5ad083..0032bf3835ff 100644 --- a/configmgr/source/defaultprovider.cxx +++ b/configmgr/source/defaultprovider.cxx @@ -47,8 +47,7 @@ OUString getImplementationName() { } css::uno::Sequence< OUString > getSupportedServiceNames() { - OUString name("com.sun.star.configuration.DefaultProvider"); - return css::uno::Sequence< OUString >(&name, 1); + return css::uno::Sequence< OUString > { "com.sun.star.configuration.DefaultProvider" }; } } } diff --git a/configmgr/source/readonlyaccess.cxx b/configmgr/source/readonlyaccess.cxx index b1c331bdb878..864eb131ab3c 100644 --- a/configmgr/source/readonlyaccess.cxx +++ b/configmgr/source/readonlyaccess.cxx @@ -132,8 +132,7 @@ OUString getImplementationName() { } css::uno::Sequence< OUString > getSupportedServiceNames() { - OUString name("com.sun.star.configuration.ReadOnlyAccess"); - return css::uno::Sequence< OUString >(&name, 1); + return css::uno::Sequence< OUString > { "com.sun.star.configuration.ReadOnlyAccess" }; } } } diff --git a/configmgr/source/readwriteaccess.cxx b/configmgr/source/readwriteaccess.cxx index 1a3b0d4503cb..ca59f551eea1 100644 --- a/configmgr/source/readwriteaccess.cxx +++ b/configmgr/source/readwriteaccess.cxx @@ -167,8 +167,7 @@ OUString getImplementationName() { } css::uno::Sequence< OUString > getSupportedServiceNames() { - OUString name("com.sun.star.configuration.ReadWriteAccess"); - return css::uno::Sequence< OUString >(&name, 1); + return css::uno::Sequence< OUString > { "com.sun.star.configuration.ReadWriteAccess" }; } } } diff --git a/configmgr/source/update.cxx b/configmgr/source/update.cxx index 058235ed6aba..b479ffe40585 100644 --- a/configmgr/source/update.cxx +++ b/configmgr/source/update.cxx @@ -168,8 +168,7 @@ OUString getImplementationName() { } css::uno::Sequence< OUString > getSupportedServiceNames() { - OUString name("com.sun.star.configuration.Update_Service"); - return css::uno::Sequence< OUString >(&name, 1); + return css::uno::Sequence< OUString > { "com.sun.star.configuration.Update_Service" }; } } } diff --git a/connectivity/source/commontools/DateConversion.cxx b/connectivity/source/commontools/DateConversion.cxx index b50fd8c3e653..4fa406653e4a 100644 --- a/connectivity/source/commontools/DateConversion.cxx +++ b/connectivity/source/commontools/DateConversion.cxx @@ -83,13 +83,12 @@ OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal, bool b _rxTypeConverter->convertToSimpleType(_rVal, TypeClass_STRING) >>= aTemp; sal_Int32 nIndex = (sal_Int32)-1; const OUString sQuot("\'"); - const OUString sQuotToReplace("\'\'"); do { nIndex += 2; nIndex = aTemp.indexOf(sQuot,nIndex); if(nIndex != -1) - aTemp = aTemp.replaceAt(nIndex,sQuot.getLength(),sQuotToReplace); + aTemp = aTemp.replaceAt(nIndex,sQuot.getLength(), "\'\'"); } while (nIndex != -1); aRet.append(aTemp); diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index feed005fd073..247b8d71dd72 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -943,8 +943,6 @@ try Property* pOldProps = aOldProperties.getArray(); Property* pNewProps = aNewProperties.getArray(); - OUString sPropDefaultControl("DefaultControl"); - OUString sPropLabelControl("LabelControl"); OUString sPropFormatsSupplier("FormatsSupplier"); OUString sPropCurrencySymbol("CurrencySymbol"); OUString sPropDecimals("Decimals"); @@ -962,9 +960,7 @@ try for (sal_Int32 i=0; i aArguments(2); // the path to the node to open - OUString sNodePath("/org.openoffice.Setup/L10N" ); - aArguments[0] <<= PropertyValue( OUString("nodepath"), 0, - makeAny( sNodePath ), PropertyState_DIRECT_VALUE + aArguments[0] <<= PropertyValue( + OUString("nodepath"), 0, + makeAny( OUString("/org.openoffice.Setup/L10N" ) ), + PropertyState_DIRECT_VALUE ); // the depth: -1 means unlimited aArguments[1] <<= PropertyValue( diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx index d93d7baa0f68..9df93ea8c05f 100644 --- a/connectivity/source/drivers/postgresql/pq_connection.cxx +++ b/connectivity/source/drivers/postgresql/pq_connection.cxx @@ -137,8 +137,7 @@ OUString ConnectionGetImplementationName() } com::sun::star::uno::Sequence ConnectionGetSupportedServiceNames() { - OUString serv( "com.sun.star.sdbc.Connection" ); - return Sequence< OUString> (&serv,1); + return Sequence< OUString > { "com.sun.star.sdbc.Connection" }; } static sal_Int32 readLogLevelFromConfiguration() diff --git a/connectivity/source/drivers/postgresql/pq_driver.cxx b/connectivity/source/drivers/postgresql/pq_driver.cxx index 8ff522348834..d67d14a1777b 100644 --- a/connectivity/source/drivers/postgresql/pq_driver.cxx +++ b/connectivity/source/drivers/postgresql/pq_driver.cxx @@ -76,15 +76,7 @@ OUString DriverGetImplementationName() Sequence< OUString > DriverGetSupportedServiceNames() { - static Sequence< OUString > *p; - if( ! p ) - { - MutexGuard guard( osl::Mutex::getGlobalMutex() ); - OUString tmp( "com.sun.star.sdbc.Driver" ); - static Sequence< OUString > instance( &tmp,1 ); - p = &instance; - } - return *p; + return Sequence< OUString > { "com.sun.star.sdbc.Driver" }; } Reference< XConnection > Driver::connect( diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx index cddcf29630d8..686fdf6ee1a4 100644 --- a/connectivity/source/manager/mdrivermanager.cxx +++ b/connectivity/source/manager/mdrivermanager.cxx @@ -180,28 +180,24 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, W _rPrecedence.realloc( 0 ); try { - // some strings we need - const OUString sDriverManagerConfigLocation( "org.openoffice.Office.DataAccess/DriverManager" ); - const OUString sDriverPreferenceLocation( "DriverPrecedence" ); - const OUString sNodePathArgumentName( "nodepath" ); - const OUString sNodeAccessServiceName( "com.sun.star.configuration.ConfigurationAccess" ); - // create a configuration provider Reference< XMultiServiceFactory > xConfigurationProvider( com::sun::star::configuration::theDefaultProvider::get( _rContext ) ); // one argument for creating the node access: the path to the configuration node Sequence< Any > aCreationArgs(1); - aCreationArgs[0] <<= NamedValue( sNodePathArgumentName, makeAny( sDriverManagerConfigLocation ) ); + aCreationArgs[0] <<= NamedValue( "nodepath", makeAny( OUString("org.openoffice.Office.DataAccess/DriverManager") ) ); // create the node access - Reference< XNameAccess > xDriverManagerNode(xConfigurationProvider->createInstanceWithArguments(sNodeAccessServiceName, aCreationArgs), UNO_QUERY); + Reference< XNameAccess > xDriverManagerNode( + xConfigurationProvider->createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aCreationArgs), + UNO_QUERY); OSL_ENSURE(xDriverManagerNode.is(), "lcl_getDriverPrecedence: could not open my configuration node!"); if (xDriverManagerNode.is()) { // obtain the preference list - Any aPreferences = xDriverManagerNode->getByName(sDriverPreferenceLocation); + Any aPreferences = xDriverManagerNode->getByName("DriverPrecedence"); bool bSuccess = aPreferences >>= _rPrecedence; OSL_ENSURE(bSuccess || !aPreferences.hasValue(), "lcl_getDriverPrecedence: invalid value for the preferences node (no string sequence but not NULL)!"); } diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx index c888910493e0..d03621282919 100644 --- a/cppu/source/uno/lbenv.cxx +++ b/cppu/source/uno/lbenv.cxx @@ -1055,8 +1055,7 @@ static bool loadEnv(OUString const & cLibStem, if (!bMod) return false; - OUString aSymbolName(UNO_INIT_ENVIRONMENT); - uno_initEnvironmentFunc fpInit = reinterpret_cast(aMod.getSymbol(aSymbolName)); + uno_initEnvironmentFunc fpInit = reinterpret_cast(aMod.getSymbol(UNO_INIT_ENVIRONMENT)); if (!fpInit) return false; diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx index 7da528cb372e..51e1c26dc617 100644 --- a/cppu/source/uno/lbmap.cxx +++ b/cppu/source/uno/lbmap.cxx @@ -418,9 +418,8 @@ static Mapping loadExternalMapping( if (bModule) { - OUString aSymbolName( UNO_EXT_GETMAPPING ); uno_ext_getMappingFunc fpGetMapFunc = - reinterpret_cast(aModule.getSymbol( aSymbolName )); + reinterpret_cast(aModule.getSymbol( UNO_EXT_GETMAPPING )); if (fpGetMapFunc) { diff --git a/cpputools/source/unoexe/unoexe.cxx b/cpputools/source/unoexe/unoexe.cxx index 512dfecda97b..806e7a107ed9 100644 --- a/cpputools/source/unoexe/unoexe.cxx +++ b/cpputools/source/unoexe/unoexe.cxx @@ -140,10 +140,9 @@ static bool readOption( OUString * pValue, const sal_Char * pOpt, static bool readOption( bool * pbOpt, const sal_Char * pOpt, sal_uInt32 * pnIndex, const OUString & aArg) { - const OUString dashdash("--"); OUString aOpt = OUString::createFromAscii(pOpt); - if(aArg.startsWith(dashdash) && aOpt.equals(aArg.copy(2))) + if(aArg.startsWith("--") && aOpt.equals(aArg.copy(2))) { ++(*pnIndex); *pbOpt = true; @@ -408,8 +407,7 @@ SAL_IMPLEMENT_MAIN() rtl_getAppCommandArg(nPos, &arg.pData); - const OUString dashdash("--"); - if (dashdash == arg) + if (arg == "--") { ++nPos; break; diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index e58a6f2ae6d7..0398b56afac4 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -1273,9 +1273,9 @@ TOTypeInfoSP queryTypeInfoByType(sal_Int32 _nDataType,const OTypeInfoMap& _rType } if ( !pTypeInfo ) { - OUString sCreate("x"),sTypeName; + OUString sTypeName; bool bForce = true; - pTypeInfo = ::dbaui::getTypeInfoFromType(_rTypeInfo,DataType::VARCHAR,sTypeName,sCreate,50,0,false,bForce); + pTypeInfo = ::dbaui::getTypeInfoFromType(_rTypeInfo,DataType::VARCHAR,sTypeName,"x",50,0,false,bForce); } OSL_ENSURE(pTypeInfo,"Wrong DataType supplied!"); return pTypeInfo; diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index d2606d9b2711..9312308a47ba 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -295,7 +295,6 @@ namespace { const Reference< XDatabaseMetaData > xMetaData = _xConnection->getMetaData(); const OUString aQuote = xMetaData->getIdentifierQuoteString(); - const OUString sEqual(" = "); for(;aIter != aEnd;++aIter) { @@ -304,7 +303,7 @@ namespace aCondition.append(C_AND); aCondition.append(quoteTableAlias(true,pData->GetAliasName(JTCS_FROM),aQuote)); aCondition.append(::dbtools::quoteName(aQuote, pLineData->GetFieldName(JTCS_FROM) )); - aCondition.append(sEqual); + aCondition.append(" = "); aCondition.append(quoteTableAlias(true,pData->GetAliasName(JTCS_TO),aQuote)); aCondition.append(::dbtools::quoteName(aQuote, pLineData->GetFieldName(JTCS_TO) )); } @@ -2100,14 +2099,13 @@ namespace { SqlParseError eErrorCode = eOk; bool bFirstField = true; - OUString sAsterisk("*"); OJoinTableView::OTableWindowMap::iterator aIter = _pTabList->begin(); OJoinTableView::OTableWindowMap::iterator aEnd = _pTabList->end(); for(;aIter != aEnd && eOk == eErrorCode ;++aIter) { OQueryTableWindow* pTabWin = static_cast(aIter->second.get()); OTableFieldDescRef aInfo = new OTableFieldDesc(); - if (pTabWin->ExistsField( sAsterisk, aInfo )) + if (pTabWin->ExistsField( "*", aInfo )) { eErrorCode = _pView->InsertField(aInfo, true, bFirstField); bFirstField = false; diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index aaa5492087c7..2d545caa544d 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1100,9 +1100,8 @@ static bool doc_paste(LibreOfficeKitDocument* pThis, const char* pMimeType, cons return false; } - OUString aCommand(".uno:Paste"); uno::Sequence aPropertyValues; - if (!comphelper::dispatchCommand(aCommand, aPropertyValues)) + if (!comphelper::dispatchCommand(".uno:Paste", aPropertyValues)) { gImpl->maLastExceptionMsg = "Failed to dispatch the .uno: command"; return false; diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index c933dcf9f396..bf69ff2686c1 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -687,9 +687,9 @@ OUString desktop::splash::getImplementationName() { return OUString("com.sun.star.office.comp.SplashScreen"); } -css::uno::Sequence< OUString > desktop::splash::getSupportedServiceNames() { - OUString name("com.sun.star.office.SplashScreen"); - return css::uno::Sequence< OUString >(&name, 1); +css::uno::Sequence< OUString > desktop::splash::getSupportedServiceNames() +{ + return Sequence< OUString > { "com.sun.star.office.SplashScreen" }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/splash/unxsplash.cxx b/desktop/source/splash/unxsplash.cxx index 1170e84b97e8..13daaefb714c 100644 --- a/desktop/source/splash/unxsplash.cxx +++ b/desktop/source/splash/unxsplash.cxx @@ -163,9 +163,7 @@ OUString UnxSplash_getImplementationName() uno::Sequence< OUString > UnxSplash_getSupportedServiceNames() throw() { - const OUString aServiceName( "com.sun.star.office.PipeSplashScreen" ); - const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; + return uno::Sequence< OUString > { "com.sun.star.office.PipeSplashScreen" }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx b/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx index a87619bd7eee..70cae59dffdd 100644 --- a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx +++ b/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx @@ -82,9 +82,7 @@ namespace drawinglayer { uno::Sequence< OUString > XPrimitive2DRenderer_getSupportedServiceNames() { - OUString aServiceName("com.sun.star.graphic.Primitive2DTools" ); - uno::Sequence< OUString > aServiceNames( &aServiceName, 1 ); - return aServiceNames; + return uno::Sequence< OUString > { "com.sun.star.graphic.Primitive2DTools" }; } OUString XPrimitive2DRenderer_getImplementationName() diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx index fd129b962bd2..ee597604f042 100644 --- a/editeng/source/uno/unofield.cxx +++ b/editeng/source/uno/unofield.cxx @@ -885,10 +885,9 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoTextCreateTextField( const OUSt // #i93308# up to OOo 3.2 we used this wrong namespace name with the capital T & F. This is // fixed since OOo 3.2 but for compatibility we will still provide support for the wrong notation. - const OUString aTextFieldPrexit2( "com.sun.star.text.TextField." ); if( (ServiceSpecifier.startsWith( aTextFieldPrexit )) || - (ServiceSpecifier.startsWith( aTextFieldPrexit2 )) ) + (ServiceSpecifier.startsWith( "com.sun.star.text.TextField." )) ) { OUString aFieldType( ServiceSpecifier.copy( aTextFieldPrexit.getLength() ) ); diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx index ca7b30a58e6e..67554054531e 100644 --- a/filter/source/graphicfilter/ieps/ieps.cxx +++ b/filter/source/graphicfilter/ieps/ieps.cxx @@ -208,7 +208,6 @@ static bool RenderAsEMF(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &r sal_uInt64 nCount = pInputStream->Write(pBuf, nBytesRead); aTempInput.CloseStream(); - OUString fileName("pstoedit" EXESUFFIX); //fdo#64161 pstoedit under non-windows uses libEMF to output the EMF, but //libEMF cannot calculate the bounding box of text, so the overall bounding //box is not increased to include that of any text in the eps @@ -231,7 +230,8 @@ static bool RenderAsEMF(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &r oslFileHandle pIn = NULL; oslFileHandle pOut = NULL; oslFileHandle pErr = NULL; - oslProcessError eErr = runProcessWithPathSearch(fileName, + oslProcessError eErr = runProcessWithPathSearch( + "pstoedit" EXESUFFIX, args, sizeof(args)/sizeof(rtl_uString *), &aProcess, &pIn, &pOut, &pErr); @@ -292,7 +292,7 @@ static void WriteFileInThread(void *wData) } static bool RenderAsBMPThroughHelper(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, - Graphic &rGraphic, OUString &rProgName, rtl_uString *pArgs[], size_t nArgs) + Graphic &rGraphic, const OUString &rProgName, rtl_uString *pArgs[], size_t nArgs) { oslProcess aProcess; oslFileHandle pIn = NULL; @@ -344,7 +344,6 @@ static bool RenderAsBMPThroughHelper(const sal_uInt8* pBuf, sal_uInt32 nBytesRea static bool RenderAsBMPThroughConvert(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &rGraphic) { - OUString fileName("convert" EXESUFFIX); // density in pixel/inch OUString arg1("-density"); // since the preview is also used for PDF-Export & printing on non-PS-printers, @@ -358,18 +357,15 @@ static bool RenderAsBMPThroughConvert(const sal_uInt8* pBuf, sal_uInt32 nBytesRe { arg1.pData, arg2.pData, arg3.pData, arg4.pData }; - return RenderAsBMPThroughHelper(pBuf, nBytesRead, rGraphic, fileName, args, + return RenderAsBMPThroughHelper(pBuf, nBytesRead, rGraphic, + ("convert" EXESUFFIX), + args, sizeof(args)/sizeof(rtl_uString *)); } static bool RenderAsBMPThroughGS(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &rGraphic) { -#ifdef WNT - OUString fileName("gswin32c" EXESUFFIX); -#else - OUString fileName("gs" EXESUFFIX); -#endif OUString arg1("-q"); OUString arg2("-dBATCH"); OUString arg3("-dNOPAUSE"); @@ -387,7 +383,13 @@ static bool RenderAsBMPThroughGS(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, arg6.pData, arg7.pData, arg8.pData, arg9.pData, arg10.pData, arg11.pData }; - return RenderAsBMPThroughHelper(pBuf, nBytesRead, rGraphic, fileName, args, + return RenderAsBMPThroughHelper(pBuf, nBytesRead, rGraphic, +#ifdef WNT + "gswin32c" EXESUFFIX, +#else + "gs" EXESUFFIX, +#endif + args, sizeof(args)/sizeof(rtl_uString *)); } diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index b4433da54015..eb8e2134cd26 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -2472,10 +2472,9 @@ void ConvertEnhancedCustomShapeEquation( SdrObjCustomShape* pCustoShape, if ( pCustoShape ) { uno::Sequence< OUString > sEquationSource; - const OUString sEquations( "Equations" ); const SdrCustomShapeGeometryItem& rGeometryItem = static_cast( pCustoShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )); - const uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sEquations ); + const uno::Any* pAny = rGeometryItem.GetPropertyValueByName( "Equations" ); if ( pAny ) *pAny >>= sEquationSource; sal_Int32 nEquationSourceCount = sEquationSource.getLength(); diff --git a/forms/source/xforms/xpathlib/xpathlib.cxx b/forms/source/xforms/xpathlib/xpathlib.cxx index c90a41388a96..7d1943d365ed 100644 --- a/forms/source/xforms/xpathlib/xpathlib.cxx +++ b/forms/source/xforms/xpathlib/xpathlib.cxx @@ -299,8 +299,6 @@ static bool parseDateTime(const OUString& aString, DateTime& aDateTime) sal_Int32 nDateLength = 10; sal_Int32 nTimeLength = 8; - OUString aUTCString("Z"); - OUString aDateString = aDateTimeString.copy(0, nDateLength); OUString aTimeString = aDateTimeString.copy(nDateLength+1, nTimeLength); @@ -316,7 +314,7 @@ static bool parseDateTime(const OUString& aString, DateTime& aDateTime) Date tmpDate((sal_uInt16)nDay, (sal_uInt16)nMonth, (sal_uInt16)nYear); tools::Time tmpTime(nHour, nMinute, nSecond); DateTime tmpDateTime(tmpDate, tmpTime); - if (aString.indexOf(aUTCString) < 0) + if (aString.indexOf("Z") < 0) tmpDateTime.ConvertToUTC(); aDateTime = tmpDateTime; diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx index 738aaef3201e..11b7e20fe490 100644 --- a/framework/source/layoutmanager/helpers.cxx +++ b/framework/source/layoutmanager/helpers.cxx @@ -300,18 +300,13 @@ bool implts_isFrameOrWindowTop( const uno::Reference< frame::XFrame >& xFrame ) void impl_setDockingWindowVisibility( const css::uno::Reference< css::uno::XComponentContext>& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rDockingWindowName, bool bVisible ) { - const OUString aDockWinPrefixCommand( "DockingWindow" ); - sal_Int32 nID = rDockingWindowName.toInt32(); sal_Int32 nIndex = nID - DOCKWIN_ID_BASE; css::uno::Reference< css::frame::XDispatchProvider > xProvider(rFrame, css::uno::UNO_QUERY); if ( nIndex >= 0 && xProvider.is() ) { - OUString aDockWinCommand( ".uno:" ); - OUString aDockWinArgName( aDockWinPrefixCommand ); - - aDockWinArgName += OUString::number( nIndex ); + OUString aDockWinArgName = "DockingWindow" + OUString::number( nIndex ); css::uno::Sequence< css::beans::PropertyValue > aArgs(1); aArgs[0].Name = aDockWinArgName; @@ -319,7 +314,7 @@ void impl_setDockingWindowVisibility( const css::uno::Reference< css::uno::XComp css::uno::Reference< css::frame::XDispatchHelper > xDispatcher = css::frame::DispatchHelper::create( rxContext ); - aDockWinCommand = aDockWinCommand + aDockWinArgName; + OUString aDockWinCommand = ".uno:" + aDockWinArgName; xDispatcher->executeDispatch( xProvider, aDockWinCommand, diff --git a/io/source/stm/opump.cxx b/io/source/stm/opump.cxx index d967a74f9b9b..c68d174fab08 100644 --- a/io/source/stm/opump.cxx +++ b/io/source/stm/opump.cxx @@ -467,9 +467,7 @@ OUString OPumpImpl_getImplementationName() Sequence OPumpImpl_getSupportedServiceNames() { - OUString s("com.sun.star.io.Pump"); - Sequence< OUString > seq( &s , 1 ); - return seq; + return Sequence< OUString > { "com.sun.star.io.Pump" }; } } diff --git a/javaunohelper/source/javaunohelper.cxx b/javaunohelper/source/javaunohelper.cxx index 86e0cd0ea496..4fd51a28e17e 100644 --- a/javaunohelper/source/javaunohelper.cxx +++ b/javaunohelper/source/javaunohelper.cxx @@ -72,8 +72,7 @@ jboolean Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1writeInfo( lib.release(); // ========================= LATEST VERSION ========================= - OUString aGetEnvName( COMPONENT_GETENV ); - oslGenericFunction pSym = lib.getFunctionSymbol(aGetEnvName); + oslGenericFunction pSym = lib.getFunctionSymbol(COMPONENT_GETENV); if (pSym) { Environment java_env, loader_env; @@ -94,8 +93,7 @@ jboolean Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1writeInfo( uno_getEnvironment( reinterpret_cast(&java_env), java_env_name.pData, vm_access.get() ); - OUString aWriteInfoName( COMPONENT_WRITEINFO ); - pSym = lib.getFunctionSymbol(aWriteInfoName); + pSym = lib.getFunctionSymbol(COMPONENT_WRITEINFO); if (pSym) { if (loader_env.is() && java_env.is()) @@ -164,8 +162,7 @@ jobject Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1getFactory( lib.release(); // ========================= LATEST VERSION ========================= - OUString aGetEnvName( COMPONENT_GETENV ); - oslGenericFunction pSym = lib.getFunctionSymbol(aGetEnvName); + oslGenericFunction pSym = lib.getFunctionSymbol(COMPONENT_GETENV); if (pSym) { Environment java_env, loader_env; @@ -187,8 +184,7 @@ jobject Java_com_sun_star_comp_helper_SharedLibraryLoader_component_1getFactory( uno_getEnvironment( reinterpret_cast(&java_env), java_env_name.pData, vm_access.get() ); - OUString aGetFactoryName( COMPONENT_GETFACTORY ); - pSym = lib.getFunctionSymbol(aGetFactoryName); + pSym = lib.getFunctionSymbol(COMPONENT_GETFACTORY); if (pSym) { if (loader_env.is() && java_env.is()) diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx index 3463e74ce58d..1423c49578e8 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx @@ -1038,12 +1038,11 @@ rtl::Reference getJREInfoByPath( //find java.vendor property typedef vector >::const_iterator c_ip; - OUString sVendor("java.vendor"); OUString sVendorName; for (c_ip i = props.begin(); i != props.end(); ++i) { - if (sVendor.equals(i->first)) + if (i->first == "java.vendor") { sVendorName = i->second; break; @@ -1254,10 +1253,9 @@ void addJavaInfosDirScan( - OUString usFile("file:///"); for( int ii = 0; ii < cSearchPaths; ii ++) { - OUString usDir1(usFile + arPaths[ii]); + OUString usDir1("file:///" + arPaths[ii]); DirectoryItem item; if(DirectoryItem::get(usDir1, item) == File::E_None) { diff --git a/jvmfwk/source/fwkbase.cxx b/jvmfwk/source/fwkbase.cxx index 8292fab24fbf..ff178a18166a 100644 --- a/jvmfwk/source/fwkbase.cxx +++ b/jvmfwk/source/fwkbase.cxx @@ -293,9 +293,7 @@ OString BootParams::getClasspath() OUString BootParams::getVendorSettings() { OUString sVendor; - OUString sName( - UNO_JAVA_JFW_VENDOR_SETTINGS); - if (Bootstrap::get()->getFrom(sName ,sVendor)) + if (Bootstrap::get()->getFrom(UNO_JAVA_JFW_VENDOR_SETTINGS, sVendor)) { //check the value of the bootstrap variable jfw::FileStatus s = checkFileURL(sVendor); @@ -407,17 +405,13 @@ JFW_MODE getMode() bool bDirectMode = true; OUString sValue; const rtl::Bootstrap * aBoot = Bootstrap::get(); - OUString sJREHome(UNO_JAVA_JFW_JREHOME); - if (!aBoot->getFrom(sJREHome, sValue)) + if (!aBoot->getFrom(UNO_JAVA_JFW_JREHOME, sValue)) { - OUString sEnvJRE(UNO_JAVA_JFW_ENV_JREHOME); - if (!aBoot->getFrom(sEnvJRE, sValue)) + if (!aBoot->getFrom(UNO_JAVA_JFW_ENV_JREHOME, sValue)) { - OUString sClasspath(UNO_JAVA_JFW_CLASSPATH); - if (!aBoot->getFrom(sClasspath, sValue)) + if (!aBoot->getFrom(UNO_JAVA_JFW_CLASSPATH, sValue)) { - OUString sEnvClasspath(UNO_JAVA_JFW_ENV_CLASSPATH); - if (!aBoot->getFrom(sEnvClasspath, sValue)) + if (!aBoot->getFrom(UNO_JAVA_JFW_ENV_CLASSPATH, sValue)) { OUString sParams = UNO_JAVA_JFW_PARAMETER + OUString::number(1); diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx index dfe2d2294403..bc18293c1eba 100644 --- a/linguistic/source/dlistimp.cxx +++ b/linguistic/source/dlistimp.cxx @@ -853,13 +853,12 @@ static bool IsVers2OrNewer( const OUString& rFileURL, sal_uInt16& nLng, bool& bN { if (rFileURL.isEmpty()) return false; - OUString aDIC("dic"); OUString aExt; sal_Int32 nPos = rFileURL.lastIndexOf( '.' ); if (-1 != nPos) aExt = rFileURL.copy( nPos + 1 ).toAsciiLowerCase(); - if (aDIC != aExt) + if (aExt != "dic") return false; // get stream to be used diff --git a/oox/source/drawingml/customshapegeometry.cxx b/oox/source/drawingml/customshapegeometry.cxx index 6875629f87f2..9eabc38637f1 100644 --- a/oox/source/drawingml/customshapegeometry.cxx +++ b/oox/source/drawingml/customshapegeometry.cxx @@ -146,76 +146,40 @@ OUString GetFormulaParameter( const EnhancedCustomShapeParameter& rParameter ) } break; case EnhancedCustomShapeParameterType::LEFT : - { - const OUString sLeft( "left" ); - aRet = sLeft; - } + aRet = "left"; break; case EnhancedCustomShapeParameterType::TOP : - { - const OUString sTop( "top" ); - aRet = sTop; - } + aRet = "top"; break; case EnhancedCustomShapeParameterType::RIGHT : - { - const OUString sRight( "right" ); - aRet = sRight; - } + aRet = "right"; break; case EnhancedCustomShapeParameterType::BOTTOM : - { - const OUString sBottom( "bottom" ); - aRet = sBottom; - } + aRet = "bottom"; break; case EnhancedCustomShapeParameterType::XSTRETCH : - { - const OUString sXStretch( "xstretch" ); - aRet = sXStretch; - } + aRet = "xstretch"; break; case EnhancedCustomShapeParameterType::YSTRETCH : - { - const OUString sYStretch( "ystretch" ); - aRet = sYStretch; - } + aRet = "ystretch"; break; case EnhancedCustomShapeParameterType::HASSTROKE : - { - const OUString sHasStroke( "hasstroke" ); - aRet = sHasStroke; - } + aRet = "hasstroke"; break; case EnhancedCustomShapeParameterType::HASFILL : - { - const OUString sHasFill( "hasfill" ); - aRet = sHasFill; - } + aRet = "hasfill"; break; case EnhancedCustomShapeParameterType::WIDTH : - { - const OUString sWidth( "width" ); - aRet = sWidth; - } + aRet = "width"; break; case EnhancedCustomShapeParameterType::HEIGHT : - { - const OUString sHeight( "height" ); - aRet = sHeight; - } + aRet = "height"; break; case EnhancedCustomShapeParameterType::LOGWIDTH : - { - const OUString sLogWidth( "logwidth" ); - aRet = sLogWidth; - } + aRet = "logwidth"; break; case EnhancedCustomShapeParameterType::LOGHEIGHT : - { - const OUString sLogHeight( "logheight" ); - aRet = sLogHeight; - } + aRet = "logheight"; break; } return aRet; diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx index 380fcfb11bd2..fc8e8a95cf6a 100644 --- a/oox/source/drawingml/table/tableproperties.cxx +++ b/oox/source/drawingml/table/tableproperties.cxx @@ -58,11 +58,10 @@ void CreateTableRows( uno::Reference< XTableRows > xTableRows, const std::vector xTableRows->insertByIndex( 0, rvTableRows.size() - 1 ); std::vector< TableRow >::const_iterator aTableRowIter( rvTableRows.begin() ); uno::Reference< container::XIndexAccess > xIndexAccess( xTableRows, UNO_QUERY_THROW ); - const OUString sHeight("Height"); for ( sal_Int32 n = 0; n < xIndexAccess->getCount(); n++ ) { Reference< XPropertySet > xPropSet( xIndexAccess->getByIndex( n ), UNO_QUERY_THROW ); - xPropSet->setPropertyValue( sHeight, Any( static_cast< sal_Int32 >( aTableRowIter->getHeight() / 360 ) ) ); + xPropSet->setPropertyValue( "Height", Any( static_cast< sal_Int32 >( aTableRowIter->getHeight() / 360 ) ) ); ++aTableRowIter; } } @@ -73,11 +72,10 @@ void CreateTableColumns( Reference< XTableColumns > xTableColumns, const std::ve xTableColumns->insertByIndex( 0, rvTableGrid.size() - 1 ); std::vector< sal_Int32 >::const_iterator aTableGridIter( rvTableGrid.begin() ); uno::Reference< container::XIndexAccess > xIndexAccess( xTableColumns, UNO_QUERY_THROW ); - const OUString sWidth("Width"); for ( sal_Int32 n = 0; n < xIndexAccess->getCount(); n++ ) { Reference< XPropertySet > xPropSet( xIndexAccess->getByIndex( n ), UNO_QUERY_THROW ); - xPropSet->setPropertyValue( sWidth, Any( static_cast< sal_Int32 >( *aTableGridIter++ / 360 ) ) ); + xPropSet->setPropertyValue( "Width", Any( static_cast< sal_Int32 >( *aTableGridIter++ / 360 ) ) ); } } diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index d3952fc150bc..3b4967bd2520 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -3558,7 +3558,6 @@ Reference< chart2::data::XDataSequence> getLabeledSequence( const uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > >& aSequences, bool bPositive ) { - const OUString aRolePrefix( "error-bars" ); OUString aDirection; if(bPositive) aDirection = "positive"; @@ -3573,7 +3572,7 @@ Reference< chart2::data::XDataSequence> getLabeledSequence( uno::Reference< beans::XPropertySet > xSeqProp( xSequence, uno::UNO_QUERY_THROW ); OUString aRole; if( ( xSeqProp->getPropertyValue( "Role" ) >>= aRole ) && - aRole.match( aRolePrefix ) && aRole.indexOf(aDirection) >= 0 ) + aRole.match( "error-bars" ) && aRole.indexOf(aDirection) >= 0 ) { return xSequence; } diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx index 84727cd65202..0f948b2287b6 100644 --- a/reportdesign/source/ui/report/propbrw.cxx +++ b/reportdesign/source/ui/report/propbrw.cxx @@ -73,14 +73,12 @@ namespace { static bool lcl_shouldEnableHelpSection( const Reference< XComponentContext >& _rxContext ) { - const OUString sConfigName( "/org.openoffice.Office.ReportDesign/PropertyBrowser/" ); - const OUString sPropertyName( "DirectHelp" ); - ::utl::OConfigurationTreeRoot aConfiguration( - ::utl::OConfigurationTreeRoot::createWithComponentContext( _rxContext, sConfigName ) ); + ::utl::OConfigurationTreeRoot::createWithComponentContext( + _rxContext, "/org.openoffice.Office.ReportDesign/PropertyBrowser/" ) ); bool bEnabled = false; - OSL_VERIFY( aConfiguration.getNodeValue( sPropertyName ) >>= bEnabled ); + OSL_VERIFY( aConfiguration.getNodeValue( "DirectHelp" ) >>= bEnabled ); return bEnabled; } } diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx index 41b15efa9417..b6888e776a4b 100644 --- a/sc/source/core/data/docpool.cxx +++ b/sc/source/core/data/docpool.cxx @@ -710,7 +710,6 @@ static bool lcl_HFPresentation SfxItemIter aIter( rSet ); pItem = aIter.FirstItem(); OUString aText; - OUString aDel(" + "); while( pItem ) { @@ -776,7 +775,7 @@ static bool lcl_HFPresentation if ( aText.getLength() ) { - rText = rText + aText + aDel; + rText = rText + aText + " + "; } pItem = aIter.NextItem(); diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index eb10b4f6521b..f4c29583be7d 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -2849,8 +2849,7 @@ static bool lcl_setVBARange( ScRange& aRange, ScDocument* pDok, SbxVariable* pPa xVBARange = ooo::vba::createVBAUnoAPIServiceWithArgs( pDok->GetDocumentShell(), "ooo.vba.excel.Range", aArgs ); if ( xVBARange.is() ) { - OUString sDummy("A-Range"); - SbxObjectRef aObj = GetSbUnoObject( sDummy, uno::Any( xVBARange ) ); + SbxObjectRef aObj = GetSbUnoObject( "A-Range", uno::Any( xVBARange ) ); SetSbUnoObjectDfltPropName( aObj ); bOk = pPar->PutObject( aObj ); } diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx index 545188613e94..464ae7d3b970 100644 --- a/scripting/source/dlgprov/dlgprov.cxx +++ b/scripting/source/dlgprov/dlgprov.cxx @@ -136,9 +136,8 @@ static const char aResourceResolverPropName[] = "ResourceResolver"; { Reference< container::XNameContainer > xDialogModel( lcl_createControlModel(i_xContext) ); - OUString aDlgSrcUrlPropName( "DialogSourceURL" ); Reference< beans::XPropertySet > xDlgPropSet( xDialogModel, UNO_QUERY ); - xDlgPropSet->setPropertyValue( aDlgSrcUrlPropName, aDialogSourceURL ); + xDlgPropSet->setPropertyValue( "DialogSourceURL", aDialogSourceURL ); // #TODO we really need to detect the source of the Dialog, is it // the dialog. E.g. if the dialog was created from basic ( then we just diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx index 190edaa38a24..de06bbea82d5 100644 --- a/sd/source/filter/xml/sdxmlwrp.cxx +++ b/sd/source/filter/xml/sdxmlwrp.cxx @@ -375,8 +375,7 @@ sal_Int32 ReadThroughComponent( DBG_ASSERT( xInfoSet.is(), "missing property set" ); if( xInfoSet.is() ) { - OUString sPropName( "StreamName" ); - xInfoSet->setPropertyValue( sPropName, makeAny( sStreamName ) ); + xInfoSet->setPropertyValue( "StreamName", makeAny( sStreamName ) ); } try diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index c6c144577a82..bac92fa6c6f4 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -867,7 +867,6 @@ static sal_Int32 calcMaxParaDepth( Reference< XShape > xTargetShape ) if( xText.is() ) { Reference< XPropertySet > xParaSet; - const OUString strNumberingLevel( "NumberingLevel" ); Reference< XEnumeration > xEnumeration( xText->createEnumeration(), UNO_QUERY_THROW ); while( xEnumeration->hasMoreElements() ) @@ -876,7 +875,7 @@ static sal_Int32 calcMaxParaDepth( Reference< XShape > xTargetShape ) if( xParaSet.is() ) { sal_Int32 nParaDepth = 0; - xParaSet->getPropertyValue( strNumberingLevel ) >>= nParaDepth; + xParaSet->getPropertyValue( "NumberingLevel" ) >>= nParaDepth; if( nParaDepth > nMaxParaDepth ) nMaxParaDepth = nParaDepth; @@ -1027,15 +1026,13 @@ static bool hasVisibleShape( const Reference< XShape >& xShape ) if( sShapeType == "com.sun.star.presentation.TitleTextShape" || sShapeType == "com.sun.star.presentation.OutlinerShape" || sShapeType == "com.sun.star.presentation.SubtitleShape" || sShapeType == "com.sun.star.drawing.TextShape" ) { - const OUString sFillStyle( "FillStyle" ); - const OUString sLineStyle( "LineStyle" ); Reference< XPropertySet > xSet( xShape, UNO_QUERY_THROW ); FillStyle eFillStyle; - xSet->getPropertyValue( sFillStyle ) >>= eFillStyle; + xSet->getPropertyValue( "FillStyle" ) >>= eFillStyle; css::drawing::LineStyle eLineStyle; - xSet->getPropertyValue( sLineStyle ) >>= eLineStyle; + xSet->getPropertyValue( "LineStyle" ) >>= eLineStyle; return eFillStyle != FillStyle_NONE || eLineStyle != css::drawing::LineStyle_NONE; } diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx index 5f1a09abda98..7ec28cbb21e2 100644 --- a/sd/source/ui/table/tablefunction.cxx +++ b/sd/source/ui/table/tablefunction.cxx @@ -87,8 +87,7 @@ static void apply_table_style( SdrTableObj* pObj, SdrModel* pModel, const OUStri Reference< XNameAccess > xPool( dynamic_cast< XNameAccess* >( pModel->GetStyleSheetPool() ) ); if( xPool.is() ) try { - const OUString sFamilyName("table" ); - Reference< XNameContainer > xTableFamily( xPool->getByName( sFamilyName ), UNO_QUERY_THROW ); + Reference< XNameContainer > xTableFamily( xPool->getByName( "table" ), UNO_QUERY_THROW ); OUString aStdName( "default" ); if( !sTableStyle.isEmpty() ) aStdName = sTableStyle; diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index f1e5614aa731..d1d352cbf855 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -1638,11 +1638,7 @@ void ImplPDFExportComments( uno::Reference< drawing::XDrawPage > xPage, vcl::PDF void ImplPDFExportShapeInteraction( uno::Reference< drawing::XShape > xShape, SdDrawDocument& rDoc, vcl::PDFExtOutDevData& rPDFExtOutDevData ) { - const OUString sGroup ( "com.sun.star.drawing.GroupShape"); - const OUString sOnClick ( "OnClick" ); - const OUString sBookmark( "Bookmark" ); - - if ( xShape->getShapeType().equals( sGroup ) ) + if ( xShape->getShapeType() == "com.sun.star.drawing.GroupShape" ) { uno::Reference< container::XIndexAccess > xIndexAccess( xShape, uno::UNO_QUERY ); if ( xIndexAccess.is() ) @@ -1670,7 +1666,7 @@ void ImplPDFExportShapeInteraction( uno::Reference< drawing::XShape > xShape, Sd Rectangle aLinkRect( Point( aShapePos.X, aShapePos.Y ), Size( aShapeSize.Width, aShapeSize.Height ) ); presentation::ClickAction eCa; - uno::Any aAny( xShapePropSet->getPropertyValue( sOnClick ) ); + uno::Any aAny( xShapePropSet->getPropertyValue( "OnClick" ) ); if ( aAny >>= eCa ) { switch ( eCa ) @@ -1717,7 +1713,7 @@ void ImplPDFExportShapeInteraction( uno::Reference< drawing::XShape > xShape, Sd case presentation::ClickAction_DOCUMENT : { OUString aBookmark; - xShapePropSet->getPropertyValue( sBookmark ) >>= aBookmark; + xShapePropSet->getPropertyValue( "Bookmark" ) >>= aBookmark; if( !aBookmark.isEmpty() ) { switch( eCa ) diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index 60002348136d..6133fe3bb1cf 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -1757,10 +1757,9 @@ namespace slideshowhelp //show settings if any were set Sequence< PropertyValue > aArguments(1); PropertyValue aPage; - OUString sValue("0"); aPage.Name = "FirstPage"; - aPage.Value <<= sValue; + aPage.Value <<= OUString("0"); aArguments[0] = aPage; diff --git a/sdext/source/minimizer/graphiccollector.cxx b/sdext/source/minimizer/graphiccollector.cxx index e341371d3fc6..c5f59d6b4fec 100644 --- a/sdext/source/minimizer/graphiccollector.cxx +++ b/sdext/source/minimizer/graphiccollector.cxx @@ -62,9 +62,9 @@ const DeviceInfo& GraphicCollector::GetDeviceInfo( const Reference< XComponentCo void ImpAddEntity( std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities, const GraphicSettings& rGraphicSettings, const GraphicCollector::GraphicUser& rUser ) { const OUString aGraphicURL( rUser.maGraphicURL ); - const OUString sPackageURL( "vnd.sun.star.GraphicObject:" ); - if ( rGraphicSettings.mbEmbedLinkedGraphics || (aGraphicURL.isEmpty() || aGraphicURL.match( sPackageURL ) ) ) + if ( rGraphicSettings.mbEmbedLinkedGraphics || + aGraphicURL.isEmpty() || aGraphicURL.match( "vnd.sun.star.GraphicObject:" ) ) { std::vector< GraphicCollector::GraphicEntity >::iterator aIter( rGraphicEntities.begin() ); while( aIter != rGraphicEntities.end() ) @@ -221,18 +221,16 @@ void ImpCollectGraphicObjects( const Reference< XComponentContext >& rxMSF, cons { try { - const OUString sGraphicObjectShape( "com.sun.star.drawing.GraphicObjectShape" ); - const OUString sGroupShape( "com.sun.star.drawing.GroupShape" ); Reference< XShape > xShape( rxShapes->getByIndex( i ), UNO_QUERY_THROW ); const OUString sShapeType( xShape->getShapeType() ); - if ( sShapeType == sGroupShape ) + if ( sShapeType == "com.sun.star.drawing.GroupShape" ) { Reference< XShapes > xShapes( xShape, UNO_QUERY_THROW ); ImpCollectGraphicObjects( rxMSF, xShapes, rGraphicSettings, rGraphicEntities ); continue; } - if ( sShapeType == sGraphicObjectShape ) + if ( sShapeType == "com.sun.star.drawing.GraphicObjectShape" ) ImpAddGraphicEntity( rxMSF, xShape, rGraphicSettings, rGraphicEntities ); // now check for a fillstyle @@ -343,18 +341,16 @@ void ImpCountGraphicObjects( const Reference< XComponentContext >& rxMSF, const { try { - const OUString sGraphicObjectShape( "com.sun.star.drawing.GraphicObjectShape" ); - const OUString sGroupShape( "com.sun.star.drawing.GroupShape" ); Reference< XShape > xShape( rxShapes->getByIndex( i ), UNO_QUERY_THROW ); const OUString sShapeType( xShape->getShapeType() ); - if ( sShapeType == sGroupShape ) + if ( sShapeType == "com.sun.star.drawing.GroupShape" ) { Reference< XShapes > xShapes( xShape, UNO_QUERY_THROW ); ImpCountGraphicObjects( rxMSF, xShapes, rGraphicSettings, rnGraphics ); continue; } - if ( sShapeType == sGraphicObjectShape ) + if ( sShapeType == "com.sun.star.drawing.GraphicObjectShape" ) { rnGraphics++; } diff --git a/sdext/source/minimizer/impoptimizer.cxx b/sdext/source/minimizer/impoptimizer.cxx index 44af41ce2889..f2be9365ed66 100644 --- a/sdext/source/minimizer/impoptimizer.cxx +++ b/sdext/source/minimizer/impoptimizer.cxx @@ -122,8 +122,7 @@ void ImpDeleteHiddenSlides( const Reference< XModel >& rxModel ) Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY_THROW ); bool bVisible = true; - const OUString sVisible( "Visible" ); - if ( xPropSet->getPropertyValue( sVisible ) >>= bVisible ) + if ( xPropSet->getPropertyValue( "Visible" ) >>= bVisible ) { if (!bVisible ) { @@ -153,8 +152,7 @@ void ImpDeleteNotesPages( const Reference< XModel >& rxModel ) while( xShapes->getCount() ) xShapes->remove( Reference< XShape >( xShapes->getByIndex( xShapes->getCount() - 1 ), UNO_QUERY_THROW ) ); - const OUString sLayout( "Layout" ); - xPropSet->setPropertyValue( sLayout, Any( (sal_Int16)21 ) ); + xPropSet->setPropertyValue( "Layout", Any( (sal_Int16)21 ) ); } } catch( Exception& ) @@ -173,9 +171,8 @@ void ImpConvertOLE( const Reference< XModel >& rxModel, sal_Int32 nOLEOptimizati Reference< XShapes > xShapes( xDrawPages->getByIndex( i ), UNO_QUERY_THROW ); for ( sal_Int32 j = 0; j < xShapes->getCount(); j++ ) { - const OUString sOLE2Shape( "com.sun.star.drawing.OLE2Shape" ); Reference< XShape > xShape( xShapes->getByIndex( j ), UNO_QUERY_THROW ); - if ( xShape->getShapeType() == sOLE2Shape ) + if ( xShape->getShapeType() == "com.sun.star.drawing.OLE2Shape" ) { Reference< XPropertySet > xPropSet( xShape, UNO_QUERY_THROW ); @@ -191,9 +188,8 @@ void ImpConvertOLE( const Reference< XModel >& rxModel, sal_Int32 nOLEOptimizati Reference< XGraphic > xGraphic; if ( xPropSet->getPropertyValue( "Graphic" ) >>= xGraphic ) { - const OUString sGraphicShape( "com.sun.star.drawing.GraphicObjectShape" ); Reference< XMultiServiceFactory > xFact( rxModel, UNO_QUERY_THROW ); - Reference< XShape > xShape2( xFact->createInstance( sGraphicShape ), UNO_QUERY_THROW ); + Reference< XShape > xShape2( xFact->createInstance( "com.sun.star.drawing.GraphicObjectShape" ), UNO_QUERY_THROW ); xShapes->add( xShape2 ); xShape2->setPosition( xShape->getPosition() ); xShape2->setSize( xShape->getSize() ); diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index 4a038b5e4982..7d7ee7b410fc 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -185,8 +185,7 @@ OUString GetSpecialCharsForEdit(vcl::Window* pParent, const vcl::Font& rFont) aMod.loadRelative(&thisModule, SVLIBRARY("cui")); // get symbol - OUString aSymbol( "GetSpecialCharsForEdit" ); - pfunc_getSpecialCharsForEdit = reinterpret_cast(aMod.getFunctionSymbol(aSymbol)); + pfunc_getSpecialCharsForEdit = reinterpret_cast(aMod.getFunctionSymbol("GetSpecialCharsForEdit")); DBG_ASSERT( pfunc_getSpecialCharsForEdit, "GetSpecialCharsForEdit() not found!" ); aMod.release(); #else diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 52ed0ffcf054..0bea0bdfd733 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -884,15 +884,13 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::SequencepUnoName, strlen(pSlot->pUnoName), RTL_TEXTENCODING_UTF8 ) ) + if ( "OptionsTreeDialog" == OUString( pSlot->pUnoName, strlen(pSlot->pUnoName), RTL_TEXTENCODING_UTF8 ) ) { for ( sal_Int32 n = 0; n < nCount; ++n ) { const PropertyValue& rProp = pPropsVal[n]; OUString sName( rProp.Name ); - if ( sName == sPropName ) + if ( sName == "OptionsPageURL" ) { OUString sURL; if ( rProp.Value >>= sURL ) diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx index 3005e084b756..517e1f37560f 100644 --- a/sfx2/source/config/evntconf.cxx +++ b/sfx2/source/config/evntconf.cxx @@ -159,18 +159,14 @@ uno::Any CreateEventData_Impl( const SvxMacro *pMacro ) uno::Sequence < beans::PropertyValue > aProperties(3); beans::PropertyValue *pValues = aProperties.getArray(); - OUString aType(STAR_BASIC ); - OUString aLib = pMacro->GetLibName(); - OUString aMacro = pMacro->GetMacName(); - pValues[ 0 ].Name = PROP_EVENT_TYPE; - pValues[ 0 ].Value <<= aType; + pValues[ 0 ].Value <<= OUString("STAR_BASIC"); pValues[ 1 ].Name = PROP_LIBRARY; - pValues[ 1 ].Value <<= aLib; + pValues[ 1 ].Value <<= pMacro->GetLibName(); pValues[ 2 ].Name = PROP_MACRO_NAME; - pValues[ 2 ].Value <<= aMacro; + pValues[ 2 ].Value <<= pMacro->GetMacName(); aEventData <<= aProperties; } @@ -179,14 +175,11 @@ uno::Any CreateEventData_Impl( const SvxMacro *pMacro ) uno::Sequence < beans::PropertyValue > aProperties(2); beans::PropertyValue *pValues = aProperties.getArray(); - OUString aLib = pMacro->GetLibName(); - OUString aMacro = pMacro->GetMacName(); - pValues[ 0 ].Name = PROP_EVENT_TYPE; - pValues[ 0 ].Value <<= aLib; + pValues[ 0 ].Value <<= pMacro->GetLibName(); pValues[ 1 ].Name = PROP_SCRIPT; - pValues[ 1 ].Value <<= aMacro; + pValues[ 1 ].Value <<= pMacro->GetMacName(); aEventData <<= aProperties; } @@ -195,13 +188,11 @@ uno::Any CreateEventData_Impl( const SvxMacro *pMacro ) uno::Sequence < beans::PropertyValue > aProperties(2); beans::PropertyValue *pValues = aProperties.getArray(); - OUString aMacro = pMacro->GetMacName(); - pValues[ 0 ].Name = PROP_EVENT_TYPE; pValues[ 0 ].Value <<= OUString(SVX_MACRO_LANGUAGE_JAVASCRIPT); pValues[ 1 ].Name = PROP_MACRO_NAME; - pValues[ 1 ].Value <<= aMacro; + pValues[ 1 ].Value <<= pMacro->GetMacName(); aEventData <<= aProperties; } diff --git a/sfx2/source/dialog/filtergrouping.cxx b/sfx2/source/dialog/filtergrouping.cxx index ea8da230d2f4..3fb2ff5ea7b8 100644 --- a/sfx2/source/dialog/filtergrouping.cxx +++ b/sfx2/source/dialog/filtergrouping.cxx @@ -987,11 +987,6 @@ namespace sfx2 std::vector< ExportFilter > aFilterGroup; Reference< XFilterGroupManager > xFilterGroupManager( _rxFilterManager, UNO_QUERY ); OUString sTypeName; - const OUString sWriterHTMLType( "generic_HTML" ); - const OUString sGraphicHTMLType( "graphic_HTML" ); - const OUString sXHTMLType( "XHTML_File" ); - const OUString sPDFType( "pdf_Portable_Document_Format" ); - const OUString sFlashType( "graphic_SWF" ); for ( const SfxFilter* pFilter = _rFilterMatcher.First(); pFilter; pFilter = _rFilterMatcher.Next() ) { @@ -1001,12 +996,12 @@ namespace sfx2 ExportFilter aExportFilter( sUIName, sExtensions ); if ( nHTMLIndex == -1 && - ( sTypeName.equals( sWriterHTMLType ) || sTypeName.equals( sGraphicHTMLType ) ) ) + ( sTypeName == "generic_HTML" || sTypeName == "graphic_HTML" ) ) { aImportantFilterGroup.insert( aImportantFilterGroup.begin(), aExportFilter ); nHTMLIndex = 0; } - else if ( nXHTMLIndex == -1 && sTypeName.equals( sXHTMLType ) ) + else if ( nXHTMLIndex == -1 && sTypeName == "XHTML_File" ) { std::vector< ExportFilter >::iterator aIter = aImportantFilterGroup.begin(); if ( nHTMLIndex == -1 ) @@ -1015,7 +1010,7 @@ namespace sfx2 aImportantFilterGroup.insert( ++aIter, aExportFilter ); nXHTMLIndex = 0; } - else if ( nPDFIndex == -1 && sTypeName.equals( sPDFType ) ) + else if ( nPDFIndex == -1 && sTypeName == "pdf_Portable_Document_Format" ) { std::vector< ExportFilter >::iterator aIter = aImportantFilterGroup.begin(); if ( nHTMLIndex != -1 ) @@ -1025,7 +1020,7 @@ namespace sfx2 aImportantFilterGroup.insert( aIter, aExportFilter ); nPDFIndex = 0; } - else if ( nFlashIndex == -1 && sTypeName.equals( sFlashType ) ) + else if ( nFlashIndex == -1 && sTypeName == "graphic_SWF" ) { std::vector< ExportFilter >::iterator aIter = aImportantFilterGroup.begin(); if ( nHTMLIndex != -1 ) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index f6a1cd24a624..3a702be52cbd 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3488,8 +3488,6 @@ static void ConvertSlotsToCommands( SfxObjectShell* pDoc, Reference< container:: if ( pDoc ) { SfxModule* pModule( pDoc->GetFactory().GetModule() ); - OUString aSlotCmd( "slot:" ); - OUString aUnoCmd( ".uno:" ); Sequence< beans::PropertyValue > aSeqPropValue; for ( sal_Int32 i = 0; i < rToolbarDefinition->getCount(); i++ ) @@ -3500,7 +3498,7 @@ static void ConvertSlotsToCommands( SfxObjectShell* pDoc, Reference< container:: if ( rToolbarDefinition->getByIndex( i ) >>= aSeqPropValue ) { GetCommandFromSequence( aCommand, nIndex, aSeqPropValue ); - if ( nIndex >= 0 && ( aCommand.startsWith( aSlotCmd ) )) + if ( nIndex >= 0 && aCommand.startsWith( "slot:" ) ) { OUString aSlot( aCommand.copy( 5 )); @@ -3508,7 +3506,7 @@ static void ConvertSlotsToCommands( SfxObjectShell* pDoc, Reference< container:: const SfxSlot* pSlot = pModule->GetSlotPool()->GetSlot( sal_uInt16( aSlot.toInt32() )); if ( pSlot ) { - OUStringBuffer aStrBuf( aUnoCmd ); + OUStringBuffer aStrBuf( ".uno:" ); aStrBuf.appendAscii( pSlot->GetUnoName() ); aCommand = aStrBuf.makeStringAndClear(); diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx index b3f33add0635..50e864ed87c7 100644 --- a/stoc/source/javavm/javavm.cxx +++ b/stoc/source/javavm/javavm.cxx @@ -201,8 +201,7 @@ OUString serviceGetImplementationName() css::uno::Sequence< OUString > serviceGetSupportedServiceNames() { - OUString aServiceName("com.sun.star.java.JavaVirtualMachine"); - return css::uno::Sequence< OUString >(&aServiceName, 1); + return css::uno::Sequence< OUString > { "com.sun.star.java.JavaVirtualMachine" }; } css::uno::Reference< css::uno::XInterface > SAL_CALL serviceCreateInstance( diff --git a/svgio/source/svguno/xsvgparser.cxx b/svgio/source/svguno/xsvgparser.cxx index 7c6141308294..4c722a039171 100644 --- a/svgio/source/svguno/xsvgparser.cxx +++ b/svgio/source/svguno/xsvgparser.cxx @@ -70,9 +70,7 @@ namespace svgio { uno::Sequence< OUString > XSvgParser_getSupportedServiceNames() { - OUString aServiceName("com.sun.star.graphic.SvgTools" ); - uno::Sequence< OUString > aServiceNames( &aServiceName, 1 ); - return aServiceNames; + return uno::Sequence< OUString > { "com.sun.star.graphic.SvgTools" }; } OUString XSvgParser_getImplementationName() diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx index d7bcdbd754f9..8caf6c64d98a 100644 --- a/svx/source/form/fmPropBrw.cxx +++ b/svx/source/form/fmPropBrw.cxx @@ -495,14 +495,13 @@ namespace { static bool lcl_shouldEnableHelpSection( const Reference< XComponentContext >& _rxContext ) { - const OUString sConfigName( "/org.openoffice.Office.Common/Forms/PropertyBrowser/" ); - const OUString sPropertyName( "DirectHelp" ); - ::utl::OConfigurationTreeRoot aConfiguration( - ::utl::OConfigurationTreeRoot::createWithComponentContext( _rxContext, sConfigName ) ); + ::utl::OConfigurationTreeRoot::createWithComponentContext( + _rxContext, + "/org.openoffice.Office.Common/Forms/PropertyBrowser/" ) ); bool bEnabled = false; - OSL_VERIFY( aConfiguration.getNodeValue( sPropertyName ) >>= bEnabled ); + OSL_VERIFY( aConfiguration.getNodeValue( "DirectHelp" ) >>= bEnabled ); return bEnabled; } } diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index c03e0e9ac62e..6f217513cf93 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -175,9 +175,8 @@ static MSO_SPT ImpGetCustomShapeType( const SdrObjCustomShape& rCustoShape ) if ( aEngine.isEmpty() || aEngine == "com.sun.star.drawing.EnhancedCustomShapeEngine" ) { OUString sShapeType; - const OUString sType( "Type" ); const SdrCustomShapeGeometryItem& rGeometryItem( static_cast(rCustoShape.GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )) ); - const Any* pAny = rGeometryItem.GetPropertyValueByName( sType ); + const Any* pAny = rGeometryItem.GetPropertyValueByName( "Type" ); if ( pAny && ( *pAny >>= sShapeType ) ) eRetValue = EnhancedCustomShapeTypeNames::Get( sShapeType ); } @@ -738,62 +737,55 @@ static void lcl_ShapePropertiesFromDFF( const SvxMSDffHandle* pData, css::beans: // POSITION { - const OUString sPosition( "Position" ); css::drawing::EnhancedCustomShapeParameterPair aPosition; EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aPosition.First, pData->nPositionX, true, true ); EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aPosition.Second, pData->nPositionY, true, false ); - rPropValues[ n ].Name = sPosition; + rPropValues[ n ].Name = "Position"; rPropValues[ n++ ].Value <<= aPosition; } if ( nFlags & SvxMSDffHandleFlags::MIRRORED_X ) { - const OUString sMirroredX( "MirroredX" ); bool bMirroredX = true; - rPropValues[ n ].Name = sMirroredX; + rPropValues[ n ].Name = "MirroredX"; rPropValues[ n++ ].Value <<= bMirroredX; } if ( nFlags & SvxMSDffHandleFlags::MIRRORED_Y ) { - const OUString sMirroredY( "MirroredY" ); bool bMirroredY = true; - rPropValues[ n ].Name = sMirroredY; + rPropValues[ n ].Name = "MirroredY"; rPropValues[ n++ ].Value <<= bMirroredY; } if ( nFlags & SvxMSDffHandleFlags::SWITCHED ) { - const OUString sSwitched( "Switched" ); bool bSwitched = true; - rPropValues[ n ].Name = sSwitched; + rPropValues[ n ].Name = "Switched"; rPropValues[ n++ ].Value <<= bSwitched; } if ( nFlags & SvxMSDffHandleFlags::POLAR ) { - const OUString sPolar( "Polar" ); css::drawing::EnhancedCustomShapeParameterPair aCenter; EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aCenter.First, pData->nCenterX, bool( nFlags & SvxMSDffHandleFlags::CENTER_X_IS_SPECIAL ), true ); EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aCenter.Second, pData->nCenterY, bool( nFlags & SvxMSDffHandleFlags::CENTER_Y_IS_SPECIAL ), false ); - rPropValues[ n ].Name = sPolar; + rPropValues[ n ].Name = "Polar"; rPropValues[ n++ ].Value <<= aCenter; if ( nFlags & SvxMSDffHandleFlags::RADIUS_RANGE ) { if ( pData->nRangeXMin != DEFAULT_MINIMUM_SIGNED_COMPARE ) { - const OUString sRadiusRangeMinimum( "RadiusRangeMinimum" ); css::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum; EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRadiusRangeMinimum, pData->nRangeXMin, bool( nFlags & SvxMSDffHandleFlags::RANGE_X_MIN_IS_SPECIAL ), true ); - rPropValues[ n ].Name = sRadiusRangeMinimum; + rPropValues[ n ].Name = "RadiusRangeMinimum"; rPropValues[ n++ ].Value <<= aRadiusRangeMinimum; } if ( pData->nRangeXMax != DEFAULT_MAXIMUM_SIGNED_COMPARE ) { - const OUString sRadiusRangeMaximum( "RadiusRangeMaximum" ); css::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum; EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRadiusRangeMaximum, pData->nRangeXMax, bool( nFlags & SvxMSDffHandleFlags::RANGE_X_MAX_IS_SPECIAL ), false ); - rPropValues[ n ].Name = sRadiusRangeMaximum; + rPropValues[ n ].Name = "RadiusRangeMaximum"; rPropValues[ n++ ].Value <<= aRadiusRangeMaximum; } } @@ -802,38 +794,34 @@ static void lcl_ShapePropertiesFromDFF( const SvxMSDffHandle* pData, css::beans: { if ( pData->nRangeXMin != DEFAULT_MINIMUM_SIGNED_COMPARE ) { - const OUString sRangeXMinimum( "RangeXMinimum" ); css::drawing::EnhancedCustomShapeParameter aRangeXMinimum; EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeXMinimum, pData->nRangeXMin, bool( nFlags & SvxMSDffHandleFlags::RANGE_X_MIN_IS_SPECIAL ), true ); - rPropValues[ n ].Name = sRangeXMinimum; + rPropValues[ n ].Name = "RangeXMinimum"; rPropValues[ n++ ].Value <<= aRangeXMinimum; } if ( pData->nRangeXMax != DEFAULT_MAXIMUM_SIGNED_COMPARE ) { - const OUString sRangeXMaximum( "RangeXMaximum" ); css::drawing::EnhancedCustomShapeParameter aRangeXMaximum; EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeXMaximum, pData->nRangeXMax, bool( nFlags & SvxMSDffHandleFlags::RANGE_X_MAX_IS_SPECIAL ), false ); - rPropValues[ n ].Name = sRangeXMaximum; + rPropValues[ n ].Name = "RangeXMaximum"; rPropValues[ n++ ].Value <<= aRangeXMaximum; } if ( pData->nRangeYMin != DEFAULT_MINIMUM_SIGNED_COMPARE ) { - const OUString sRangeYMinimum( "RangeYMinimum" ); css::drawing::EnhancedCustomShapeParameter aRangeYMinimum; EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeYMinimum, pData->nRangeYMin, bool( nFlags & SvxMSDffHandleFlags::RANGE_Y_MIN_IS_SPECIAL ), true ); - rPropValues[ n ].Name = sRangeYMinimum; + rPropValues[ n ].Name = "RangeYMinimum"; rPropValues[ n++ ].Value <<= aRangeYMinimum; } if ( pData->nRangeYMax != DEFAULT_MAXIMUM_SIGNED_COMPARE ) { - const OUString sRangeYMaximum( "RangeYMaximum" ); css::drawing::EnhancedCustomShapeParameter aRangeYMaximum; EnhancedCustomShape2d::SetEnhancedCustomShapeHandleParameter( aRangeYMaximum, pData->nRangeYMax, bool( nFlags & SvxMSDffHandleFlags::RANGE_Y_MAX_IS_SPECIAL ), false ); - rPropValues[ n ].Name = sRangeYMaximum; + rPropValues[ n ].Name = "RangeYMaximum"; rPropValues[ n++ ].Value <<= aRangeYMaximum; } } diff --git a/svx/source/toolbars/extrusionbar.cxx b/svx/source/toolbars/extrusionbar.cxx index 1185081d0b18..b1fed1402738 100644 --- a/svx/source/toolbars/extrusionbar.cxx +++ b/svx/source/toolbars/extrusionbar.cxx @@ -449,20 +449,17 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem if((nDirection >= 0) && (nDirection < 9)) { - const OUString sFirstLightDirection( "FirstLightDirection" ); - const OUString sSecondLightDirection( "SecondLightDirection" ); - const Direction3D * pLighting1Defaults; const Direction3D * pLighting2Defaults; getLightingDirectionDefaults( &pLighting1Defaults, &pLighting2Defaults ); css::beans::PropertyValue aPropValue; - aPropValue.Name = sFirstLightDirection; + aPropValue.Name = "FirstLightDirection"; aPropValue.Value <<= pLighting1Defaults[nDirection]; rGeometryItem.SetPropertyValue( sExtrusion, aPropValue ); - aPropValue.Name = sSecondLightDirection; + aPropValue.Name = "SecondLightDirection"; aPropValue.Value <<= pLighting2Defaults[nDirection]; rGeometryItem.SetPropertyValue( sExtrusion, aPropValue ); } diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx index f981076e6806..25f2f8c054f1 100644 --- a/svx/source/toolbars/fontworkbar.cxx +++ b/svx/source/toolbars/fontworkbar.cxx @@ -141,9 +141,8 @@ void SetFontWorkShapeTypeState( SdrView* pSdrView, SfxItemSet& rSet ) SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj(); if( dynamic_cast( pObj) != nullptr ) { - const OUString sType( "Type" ); const SdrCustomShapeGeometryItem aGeometryItem( static_cast(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ))); - const Any* pAny = aGeometryItem.GetPropertyValueByName( sType ); + const Any* pAny = aGeometryItem.GetPropertyValueByName( "Type" ); if( pAny ) { OUString aType; diff --git a/sw/source/filter/ww8/docxexportfilter.cxx b/sw/source/filter/ww8/docxexportfilter.cxx index d3c221305e4e..0076ed07fe43 100644 --- a/sw/source/filter/ww8/docxexportfilter.cxx +++ b/sw/source/filter/ww8/docxexportfilter.cxx @@ -98,9 +98,7 @@ OUString DocxExportFilter::getImplementationName() throw (css::uno::RuntimeExcep uno::Sequence< OUString > SAL_CALL DocxExport_getSupportedServiceNames() throw() { - const OUString aServiceName( "com.sun.star.document.ExportFilter" ); - const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; + return uno::Sequence< OUString > { "com.sun.star.document.ExportFilter" }; } uno::Reference< uno::XInterface > SAL_CALL DocxExport_createInstance(const uno::Reference< uno::XComponentContext > & xCtx ) throw( uno::Exception ) diff --git a/sw/source/filter/ww8/rtfexportfilter.cxx b/sw/source/filter/ww8/rtfexportfilter.cxx index 466e539ff1e3..b7ea8f22f38e 100644 --- a/sw/source/filter/ww8/rtfexportfilter.cxx +++ b/sw/source/filter/ww8/rtfexportfilter.cxx @@ -107,9 +107,7 @@ OUString RtfExport_getImplementationName() uno::Sequence< OUString > SAL_CALL RtfExport_getSupportedServiceNames() throw() { - const OUString aServiceName("com.sun.star.document.ExportFilter"); - const uno::Sequence< OUString > aSeq(&aServiceName, 1); - return aSeq; + return uno::Sequence< OUString > { "com.sun.star.document.ExportFilter" }; } uno::Reference< uno::XInterface > SAL_CALL RtfExport_createInstance(const uno::Reference< uno::XComponentContext >& xCtx) throw(uno::Exception) diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 868bf061e7ba..02f296e3a3ee 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -862,7 +862,7 @@ static void lcl_RemoveSectionLinks( SwWrtShell& rWorkShell ) static void lcl_SaveDoc( SfxObjectShell *xTargetDocShell, const char *name, int no = 0 ) { - OUString sExt( ".odt" ); + const OUString sExt( ".odt" ); OUString basename = OUString::createFromAscii( name ); if (no > 0) basename += OUString::number(no) + "-"; diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx index 27329776a93e..3f9ced7a89d7 100644 --- a/sw/source/uibase/shells/langhelper.cxx +++ b/sw/source/uibase/shells/langhelper.cxx @@ -138,8 +138,6 @@ namespace SwLangHelper const OUString aSelectionLangPrefix("Current_"); const OUString aParagraphLangPrefix("Paragraph_"); const OUString aDocumentLangPrefix("Default_"); - const OUString aStrNone("LANGUAGE_NONE"); - const OUString aStrResetLangs("RESET_LANGUAGES"); sal_Int32 nPos = 0; bool bForSelection = true; @@ -181,9 +179,9 @@ namespace SwLangHelper rSh.ExtendedSelectAll(); } - if (aNewLangText == aStrNone) + if (aNewLangText == "LANGUAGE_NONE") SwLangHelper::SetLanguage_None( rSh, pOLV, aSelection, bForSelection, aEditAttr ); - else if (aNewLangText == aStrResetLangs) + else if (aNewLangText == "RESET_LANGUAGES") SwLangHelper::ResetLanguages( rSh, pOLV, aSelection, bForSelection ); else SwLangHelper::SetLanguage( rSh, pOLV, aSelection, aNewLangText, bForSelection, aEditAttr ); diff --git a/unodevtools/source/unodevtools/options.cxx b/unodevtools/source/unodevtools/options.cxx index a2fc5f349217..8e0e870b4040 100644 --- a/unodevtools/source/unodevtools/options.cxx +++ b/unodevtools/source/unodevtools/options.cxx @@ -88,12 +88,10 @@ bool readOption( OUString * pValue, const sal_Char * pOpt, bool readOption( sal_Bool * pbOpt, const sal_Char * pOpt, sal_uInt32 * pnIndex, const OUString & aArg) { - const OUString dashdash("--"); - const OUString dash("-"); OUString aOpt = OUString::createFromAscii(pOpt); - if((aArg.startsWith(dash) && aOpt.equalsIgnoreAsciiCase(aArg.copy(1))) || - (aArg.startsWith(dashdash) && aOpt.equalsIgnoreAsciiCase(aArg.copy(2))) ) + if((aArg.startsWith("-") && aOpt.equalsIgnoreAsciiCase(aArg.copy(1))) || + (aArg.startsWith("--") && aOpt.equalsIgnoreAsciiCase(aArg.copy(2))) ) { ++(*pnIndex); *pbOpt = sal_True; diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx index 40dcf5d5a392..3ad6fc81eded 100644 --- a/unotools/source/config/bootstrap.cxx +++ b/unotools/source/config/bootstrap.cxx @@ -395,9 +395,7 @@ Bootstrap::PathStatus implGetBootstrapFile(rtl::Bootstrap& _rData, Bootstrap::Im static Bootstrap::PathStatus implGetVersionFile(rtl::Bootstrap& _rData, Bootstrap::Impl::PathData & _rVersionFile) { - OUString const csVersionFileItem(BOOTSTRAP_ITEM_VERSIONFILE); - - _rData.getFrom(csVersionFileItem,_rVersionFile.path); + _rData.getFrom(BOOTSTRAP_ITEM_VERSIONFILE, _rVersionFile.path); return updateStatus(_rVersionFile); } diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index aa72b3cd1de4..e45911c544f6 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -548,10 +548,10 @@ ContainerUtilities::FieldInList( const uno::Sequence< OUString >& SearchList, co return retvalue; } + bool NeedEsc(sal_Unicode cCode) { - OUString sEsc(".^$+\\|{}()"); - return -1 != sEsc.indexOf(cCode); + return OUString(".^$+\\|{}()").indexOf(cCode) != -1; } OUString VBAToRegexp(const OUString &rIn, bool bForLike ) diff --git a/vcl/source/components/dtranscomp.cxx b/vcl/source/components/dtranscomp.cxx index bbe623aee352..6dc83ff295d0 100644 --- a/vcl/source/components/dtranscomp.cxx +++ b/vcl/source/components/dtranscomp.cxx @@ -346,18 +346,13 @@ void GenericDragSource::initialize( const Sequence< Any >& ) throw( Exception, s Sequence< OUString > SAL_CALL DragSource_getSupportedServiceNames() { - #if defined UNX - OUString aServiceName( - #if ! defined MACOSX - "com.sun.star.datatransfer.dnd.X11DragSource" - #else - "com.sun.star.datatransfer.dnd.OleDragSource" - #endif - ); - return Sequence< OUString >(&aServiceName, 1); - #else +#if defined MACOSX + return Sequence< OUString > { "com.sun.star.datatransfer.dnd.OleDragSource" }; +#elif defined UNX + return Sequence< OUString > { "com.sun.star.datatransfer.dnd.X11DragSource" }; +#else return GenericDragSource::getSupportedServiceNames_static(); - #endif +#endif } OUString SAL_CALL DragSource_getImplementationName() @@ -470,18 +465,13 @@ void GenericDropTarget::setDefaultActions( sal_Int8) throw(std::exception) Sequence< OUString > SAL_CALL DropTarget_getSupportedServiceNames() { - #if defined UNX - OUString aServiceName( - #if ! defined MACOSX - "com.sun.star.datatransfer.dnd.X11DropTarget" - #else - "com.sun.star.datatransfer.dnd.OleDropTarget" - #endif - ); - return Sequence< OUString >(&aServiceName, 1); - #else +#if defined MACOSX + return Sequence< OUString > { "com.sun.star.datatransfer.dnd.OleDropTarget" }; +#elif defined UNX + return Sequence< OUString > { "com.sun.star.datatransfer.dnd.X11DropTarget" }; +#else return GenericDropTarget::getSupportedServiceNames_static(); - #endif +#endif } OUString SAL_CALL DropTarget_getImplementationName() diff --git a/vcl/source/components/fontident.cxx b/vcl/source/components/fontident.cxx index d80dd74f59fa..11066c63ae9e 100644 --- a/vcl/source/components/fontident.cxx +++ b/vcl/source/components/fontident.cxx @@ -154,9 +154,7 @@ Any SAL_CALL FontIdentificator::getMaterial() throw(RuntimeException, std::excep Sequence< OUString > FontIdentificator_getSupportedServiceNames() { - OUString aServiceName( "com.sun.star.awt.FontIdentificator" ); - Sequence< OUString > aServiceNames( &aServiceName, 1 ); - return aServiceNames; + return Sequence< OUString >{ "com.sun.star.awt.FontIdentificator" }; } OUString FontIdentificator_getImplementationName() diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index ddcd40c8f5ef..0c2644994e93 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -2125,15 +2125,13 @@ static bool ImplTimeGetValue( const OUString& rStr, tools::Time& rTime, return false; OUString aUpperCaseStr = aStr.toString().toAsciiUpperCase(); - OUString aAM(rLocaleDataWrapper.getTimeAM().toAsciiUpperCase()); - OUString aPM(rLocaleDataWrapper.getTimePM().toAsciiUpperCase()); - OUString aAM2("AM"); // aAM is localized - OUString aPM2("PM"); // aPM is localized + OUString aAMlocalised(rLocaleDataWrapper.getTimeAM().toAsciiUpperCase()); + OUString aPMlocalised(rLocaleDataWrapper.getTimePM().toAsciiUpperCase()); - if ( (nHour < 12) && ( ( aUpperCaseStr.indexOf( aPM ) >= 0 ) || ( aUpperCaseStr.indexOf( aPM2 ) >= 0 ) ) ) + if ( (nHour < 12) && ( ( aUpperCaseStr.indexOf( "PM" ) >= 0 ) || ( aUpperCaseStr.indexOf( aPMlocalised ) >= 0 ) ) ) nHour += 12; - if ( (nHour == 12) && ( ( aUpperCaseStr.indexOf( aAM ) >= 0 ) || ( aUpperCaseStr.indexOf( aAM2 ) >= 0 ) ) ) + if ( (nHour == 12) && ( ( aUpperCaseStr.indexOf( "AM" ) >= 0 ) || ( aUpperCaseStr.indexOf( aAMlocalised ) >= 0 ) ) ) nHour = 0; aTime = tools::Time( (sal_uInt16)nHour, (sal_uInt16)nMinute, (sal_uInt16)nSecond, diff --git a/vcl/unx/generic/desktopdetect/desktopdetector.cxx b/vcl/unx/generic/desktopdetect/desktopdetector.cxx index 2f8ee6629842..f769bf075438 100644 --- a/vcl/unx/generic/desktopdetect/desktopdetector.cxx +++ b/vcl/unx/generic/desktopdetect/desktopdetector.cxx @@ -231,18 +231,18 @@ static bool is_tde_desktop( Display* pDisplay ) return false; } -static bool is_kde_desktop( Display* pDisplay ) +static bool is_kde3_desktop( Display* pDisplay ) { - if ( NULL != getenv( "KDE_FULL_SESSION" ) ) + static const char * pFullVersion = getenv( "KDE_FULL_SESSION" ); + static const char * pSessionVersion = getenv( "KDE_SESSION_VERSION" ); + if ( pFullVersion ) { - const char *pVer = getenv( "KDE_SESSION_VERSION" ); - if ( !pVer || pVer[0] == '0' ) + if ( !pSessionVersion || pSessionVersion[0] == '0' ) { return true; // does not exist => KDE3 } - OUString aVer( "3" ); - if ( aVer.equalsIgnoreAsciiCaseAscii( pVer ) ) + if ( strcmp(pSessionVersion, "3" ) == 0 ) { return true; } @@ -256,14 +256,10 @@ static bool is_kde_desktop( Display* pDisplay ) static bool is_kde4_desktop( Display* pDisplay ) { - if ( NULL != getenv( "KDE_FULL_SESSION" ) ) - { - OUString aVer( "4" ); - - const char *pVer = getenv( "KDE_SESSION_VERSION" ); - if ( pVer && aVer.equalsIgnoreAsciiCaseAscii( pVer ) ) - return true; - } + static const char * pFullVersion = getenv( "KDE_FULL_SESSION" ); + static const char * pSessionVersion = getenv( "KDE_SESSION_VERSION" ); + if ( pFullVersion && pSessionVersion && strcmp(pSessionVersion, "4") == 0 ) + return true; if ( KDEVersion( pDisplay ) == 4 ) return true; @@ -273,14 +269,10 @@ static bool is_kde4_desktop( Display* pDisplay ) static bool is_kde5_desktop( Display* pDisplay ) { - if ( NULL != getenv( "KDE_FULL_SESSION" ) ) - { - OUString aVer( "5" ); - - const char *pVer = getenv( "KDE_SESSION_VERSION" ); - if ( pVer && aVer.equalsIgnoreAsciiCaseAscii( pVer ) ) - return true; - } + static const char * pFullVersion = getenv( "KDE_FULL_SESSION" ); + static const char * pSessionVersion = getenv( "KDE_SESSION_VERSION" ); + if ( pFullVersion && pSessionVersion && strcmp(pSessionVersion, "5") ) + return true; if ( KDEVersion( pDisplay ) == 5 ) return true; @@ -400,7 +392,7 @@ DESKTOP_DETECTOR_PUBLIC DesktopType get_desktop_environment() ret = DESKTOP_KDE4; else if ( is_gnome_desktop( pDisplay ) ) ret = DESKTOP_GNOME; - else if ( is_kde_desktop( pDisplay ) ) + else if ( is_kde3_desktop( pDisplay ) ) ret = DESKTOP_KDE3; else if ( is_tde_desktop( pDisplay ) ) ret = DESKTOP_TDE; 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; } } diff --git a/xmlscript/source/xml_helper/xml_impctx.cxx b/xmlscript/source/xml_helper/xml_impctx.cxx index 35299be38efd..6b8ac8c8f50e 100644 --- a/xmlscript/source/xml_helper/xml_impctx.cxx +++ b/xmlscript/source/xml_helper/xml_impctx.cxx @@ -47,8 +47,7 @@ const sal_Int32 UID_UNKNOWN = -1; Sequence< OUString > getSupportedServiceNames_DocumentHandlerImpl() { - OUString name( "com.sun.star.xml.input.SaxDocumentHandler" ); - return Sequence< OUString >( &name, 1 ); + return Sequence< OUString > { "com.sun.star.xml.input.SaxDocumentHandler" }; } OUString getImplementationName_DocumentHandlerImpl() diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx index 9ad72727d66d..35264f3cc38b 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx @@ -1384,10 +1384,9 @@ void SAL_CALL exportDialogModel( xOut->startDocument(); - OUString aDocTypeStr( + xOut->unknown( "" ); - xOut->unknown( aDocTypeStr ); xOut->ignorableWhitespace( OUString() ); OUString aWindowName( XMLNS_DIALOGS_PREFIX ":window" ); diff --git a/xmlscript/source/xmllib_imexp/xmllib_export.cxx b/xmlscript/source/xmllib_imexp/xmllib_export.cxx index a10df1535221..1b791ef7c9b1 100644 --- a/xmlscript/source/xmllib_imexp/xmllib_export.cxx +++ b/xmlscript/source/xmllib_imexp/xmllib_export.cxx @@ -36,10 +36,9 @@ SAL_CALL exportLibraryContainer( { xOut->startDocument(); - OUString aDocTypeStr( + xOut->unknown( "" ); - xOut->unknown( aDocTypeStr ); xOut->ignorableWhitespace( OUString() ); OUString aLibrariesName( XMLNS_LIBRARY_PREFIX ":libraries" ); @@ -60,8 +59,7 @@ SAL_CALL exportLibraryContainer( { LibDescriptor& rLib = pLibArray->mpLibs[i]; - OUString aLibraryName( XMLNS_LIBRARY_PREFIX ":library" ); - XMLElement* pLibElement = new XMLElement( aLibraryName ); + XMLElement* pLibElement = new XMLElement( XMLNS_LIBRARY_PREFIX ":library" ); Reference< xml::sax::XAttributeList > xLibElementAttribs; xLibElementAttribs = static_cast< xml::sax::XAttributeList* >( pLibElement ); @@ -96,14 +94,12 @@ SAL_CALL exportLibrary( { xOut->startDocument(); - OUString aDocTypeStr( + xOut->unknown( "" ); - xOut->unknown( aDocTypeStr ); xOut->ignorableWhitespace( OUString() ); - OUString aLibraryName( XMLNS_LIBRARY_PREFIX ":library" ); - XMLElement* pLibElement = new XMLElement( aLibraryName ); + XMLElement* pLibElement = new XMLElement( XMLNS_LIBRARY_PREFIX ":library" ); Reference< xml::sax::XAttributeList > xAttributes( pLibElement ); pLibElement->addAttribute( "xmlns:" XMLNS_LIBRARY_PREFIX, XMLNS_LIBRARY_URI ); diff --git a/xmlscript/source/xmlmod_imexp/xmlmod_export.cxx b/xmlscript/source/xmlmod_imexp/xmlmod_export.cxx index 377fb440320a..38d6239055b5 100644 --- a/xmlscript/source/xmlmod_imexp/xmlmod_export.cxx +++ b/xmlscript/source/xmlmod_imexp/xmlmod_export.cxx @@ -33,10 +33,9 @@ SAL_CALL exportScriptModule( { xOut->startDocument(); - OUString aDocTypeStr( + xOut->unknown( ""); - xOut->unknown( aDocTypeStr ); xOut->ignorableWhitespace( OUString() ); OUString aModuleName( XMLNS_SCRIPT_PREFIX ":module" ); diff --git a/xmlsecurity/source/dialogs/resourcemanager.cxx b/xmlsecurity/source/dialogs/resourcemanager.cxx index dc06278561f8..f6c4ce812c51 100644 --- a/xmlsecurity/source/dialogs/resourcemanager.cxx +++ b/xmlsecurity/source/dialogs/resourcemanager.cxx @@ -81,7 +81,6 @@ namespace XmlSec { vector< pair< OUString, OUString > > vecAttrValueOfDN = parseDN(rRawString); OUStringBuffer s1, s2; - OUString sEqual(" = "); typedef vector< pair < OUString, OUString > >::const_iterator CIT; for (CIT i = vecAttrValueOfDN.begin(); i < vecAttrValueOfDN.end(); ++i) { @@ -91,7 +90,7 @@ namespace XmlSec s2.append('\n'); } s1.append(i->second); - s2.append(i->first + sEqual + i->second); + s2.append(i->first + " = " + i->second); } return make_pair(s1.makeStringAndClear(), s2.makeStringAndClear()); } diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx b/xmlsecurity/source/helper/documentsignaturehelper.cxx index 1d78da35c18d..faca8c83170b 100644 --- a/xmlsecurity/source/helper/documentsignaturehelper.cxx +++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx @@ -80,10 +80,6 @@ void ImplFillElementList( const OUString& rRootStorageName, const bool bRecursive, const DocumentSignatureAlgorithm mode) { - OUString aMetaInfName( "META-INF" ); - OUString sMimeTypeName ("mimetype"); - OUString aSep( "/" ); - Reference < css::container::XNameAccess > xElements( rxStore, UNO_QUERY ); Sequence< OUString > aElements = xElements->getElementNames(); sal_Int32 nElements = aElements.getLength(); @@ -92,8 +88,7 @@ void ImplFillElementList( for ( sal_Int32 n = 0; n < nElements; n++ ) { if (mode != OOo3_2Document - && (pNames[n] == aMetaInfName - || pNames[n] == sMimeTypeName)) + && (pNames[n] == "META-INF" || pNames[n] == "mimetype")) { continue; } @@ -117,7 +112,7 @@ void ImplFillElementList( else if ( bRecursive && rxStore->isStorageElement( pNames[n] ) ) { Reference < css::embed::XStorage > xSubStore = rxStore->openStorageElement( pNames[n], css::embed::ElementModes::READ ); - OUString aFullRootName( rRootStorageName + sEncName + aSep ); + OUString aFullRootName( rRootStorageName + sEncName + "/" ); ImplFillElementList(rList, xSubStore, aFullRootName, bRecursive, mode); } } -- cgit