From 39414827352e58e8be76abaa9a5a1ac9518d927f Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 1 Nov 2016 13:18:59 +0200 Subject: loplugin:oncevar in sal..scripting Change-Id: Id9ab12f3a61eb83a2288b2fd4d99ab77f5833e1b Reviewed-on: https://gerrit.libreoffice.org/30461 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- scripting/source/dlgprov/dlgevtatt.cxx | 4 +--- scripting/source/dlgprov/dlgprov.cxx | 8 ++------ scripting/source/provider/URIHelper.cxx | 19 ++++++------------- scripting/source/stringresource/stringresource.cxx | 7 ++----- 4 files changed, 11 insertions(+), 27 deletions(-) (limited to 'scripting') diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx index 4e94a6f8f53a..633ec641ad88 100644 --- a/scripting/source/dlgprov/dlgevtatt.cxx +++ b/scripting/source/dlgprov/dlgevtatt.cxx @@ -536,9 +536,7 @@ namespace dlgprov void DialogUnoScriptListenerImpl::firing_impl( const ScriptEvent& aScriptEvent, Any* pRet ) { - static const char sUnoURLScheme[] = "vnd.sun.star.UNO:"; - - OUString aMethodName = aScriptEvent.ScriptCode.copy( strlen(sUnoURLScheme) ); + OUString aMethodName = aScriptEvent.ScriptCode.copy( strlen("vnd.sun.star.UNO:") ); const Any* pArguments = aScriptEvent.Arguments.getConstArray(); Any aEventObject = pArguments[0]; diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx index 4adfd13e6c2f..c47a84959277 100644 --- a/scripting/source/dlgprov/dlgprov.cxx +++ b/scripting/source/dlgprov/dlgprov.cxx @@ -86,9 +86,6 @@ namespace comp_DialogModelProvider namespace dlgprov { - -static const char aResourceResolverPropName[] = "ResourceResolver"; - Reference< resource::XStringResourceManager > lcl_getStringResourceManager(const Reference< XComponentContext >& i_xContext,const OUString& i_sURL) { INetURLObject aInetObj( i_sURL ); @@ -153,7 +150,7 @@ static const char aResourceResolverPropName[] = "ResourceResolver"; Reference< beans::XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY ); Any aStringResourceManagerAny; aStringResourceManagerAny <<= xStringResourceManager; - xDlgPSet->setPropertyValue( aResourceResolverPropName, aStringResourceManagerAny ); + xDlgPSet->setPropertyValue( "ResourceResolver", aStringResourceManagerAny ); } return xDialogModel; @@ -614,7 +611,6 @@ static const char aResourceResolverPropName[] = "ResourceResolver"; static const char aDecorationPropName[] = "Decoration"; - static const char aTitlePropName[] = "Title"; Reference < XControl > DialogProviderImpl::createDialogImpl( const OUString& URL, const Reference< XInterface >& xHandler, @@ -664,7 +660,7 @@ static const char aResourceResolverPropName[] = "ResourceResolver"; if( !bDecoration ) { xDlgModPropSet->setPropertyValue( aDecorationPropName, makeAny( true ) ); - xDlgModPropSet->setPropertyValue( aTitlePropName, makeAny( OUString() ) ); + xDlgModPropSet->setPropertyValue( "Title", makeAny( OUString() ) ); } } catch( UnknownPropertyException& ) diff --git a/scripting/source/provider/URIHelper.cxx b/scripting/source/provider/URIHelper.cxx index 56a78bc8d1af..1bf4cf958021 100644 --- a/scripting/source/provider/URIHelper.cxx +++ b/scripting/source/provider/URIHelper.cxx @@ -35,9 +35,7 @@ namespace lang = ::com::sun::star::lang; namespace uri = ::com::sun::star::uri; static const char SHARE[] = "share"; -static const char SHARE_URI[] = "vnd.sun.star.expand:$BRAND_BASE_DIR"; -static const char SHARE_UNO_PACKAGES[] = "share:uno_packages"; static const char SHARE_UNO_PACKAGES_URI[] = "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE"; @@ -45,12 +43,7 @@ static const char USER[] = "user"; static const char USER_URI[] = "vnd.sun.star.expand:${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE( "bootstrap") "::UserInstallation}"; -static const char USER_UNO_PACKAGES[] = "user:uno_packages"; -static const char USER_UNO_PACKAGES_DIR[] = - "/user/uno_packages/cache"; -static const char DOCUMENT[] = "document"; -static const char TDOC_SCHEME[] = "vnd.sun.star.tdoc"; ScriptingFrameworkURIHelper::ScriptingFrameworkURIHelper( const uno::Reference< uno::XComponentContext >& xContext) @@ -118,26 +111,26 @@ ScriptingFrameworkURIHelper::initBaseURI() uri = USER_URI; bAppendScriptsPart = true; } - else if ( m_sLocation == USER_UNO_PACKAGES ) + else if ( m_sLocation == "user:uno_packages" ) { test = "uno_packages"; - uri = OUStringLiteral(USER_URI) + USER_UNO_PACKAGES_DIR; + uri = OUStringLiteral(USER_URI) + "/user/uno_packages/cache"; } else if (m_sLocation == SHARE) { test = SHARE; - uri = SHARE_URI; + uri = "vnd.sun.star.expand:$BRAND_BASE_DIR"; bAppendScriptsPart = true; } - else if (m_sLocation == SHARE_UNO_PACKAGES) + else if (m_sLocation == "share:uno_packages") { test = "uno_packages"; uri = SHARE_UNO_PACKAGES_URI; } - else if (m_sLocation.startsWith(TDOC_SCHEME)) + else if (m_sLocation.startsWith("vnd.sun.star.tdoc")) { m_sBaseURI = m_sLocation.concat( SCRIPTS_PART ); - m_sLocation = DOCUMENT; + m_sLocation = "document"; return true; } else diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index 9d71b74f9311..f29dbfbf56f4 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -2130,9 +2130,6 @@ void implWriteStringWithEncoding( const OUString& aStr, bool StringResourcePersistenceImpl::implWritePropertiesFile( LocaleItem* pLocaleItem, const Reference< io::XOutputStream >& xOutputStream, const OUString& aComment ) { - static const char aAssignmentStr[] = "="; - static const char aLineFeedStr[] = "\n"; - if( !xOutputStream.is() || pLocaleItem == nullptr ) return false; @@ -2146,7 +2143,7 @@ bool StringResourcePersistenceImpl::implWritePropertiesFile( LocaleItem* pLocale xTextOutputStream->setEncoding( aEncodingStr ); xTextOutputStream->writeString( aComment ); - xTextOutputStream->writeString( aLineFeedStr ); + xTextOutputStream->writeString( "\n" ); const IdToStringMap& rHashMap = pLocaleItem->m_aIdToStringMap; if( !rHashMap.empty() ) @@ -2189,7 +2186,7 @@ bool StringResourcePersistenceImpl::implWritePropertiesFile( LocaleItem* pLocale if( !( it == rHashMap.end() ) ) { implWriteStringWithEncoding( aResourceID, xTextOutputStream, true ); - xTextOutputStream->writeString( aAssignmentStr ); + xTextOutputStream->writeString( "=" ); OUString aValStr = (*it).second; implWriteStringWithEncoding( aValStr, xTextOutputStream, false ); } -- cgit