diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-13 09:51:32 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-13 14:43:49 +0200 |
commit | 5c76b36437625cb533b9e2c28aa0dc2c41630b22 (patch) | |
tree | d15366ce8e81b6f5c6b31c1d11daafd7e1927784 | |
parent | 3eb427b31e624af9b2fe2bd68fee859d3d76a661 (diff) |
loplugin:ostr in scripting
Change-Id: Idde1ec2254cebc9acd8aab092e52632b1625877f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167576
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | scripting/source/basprov/basmethnode.cxx | 18 | ||||
-rw-r--r-- | scripting/source/basprov/basprov.cxx | 22 | ||||
-rw-r--r-- | scripting/source/basprov/basscript.cxx | 8 | ||||
-rw-r--r-- | scripting/source/dlgprov/DialogModelProvider.cxx | 4 | ||||
-rw-r--r-- | scripting/source/dlgprov/dlgevtatt.cxx | 28 | ||||
-rw-r--r-- | scripting/source/dlgprov/dlgprov.cxx | 42 | ||||
-rw-r--r-- | scripting/source/inc/util/MiscUtils.hxx | 6 | ||||
-rw-r--r-- | scripting/source/protocolhandler/scripthandler.cxx | 12 | ||||
-rw-r--r-- | scripting/source/provider/ActiveMSPList.cxx | 8 | ||||
-rw-r--r-- | scripting/source/provider/BrowseNodeFactoryImpl.cxx | 12 | ||||
-rw-r--r-- | scripting/source/provider/MasterScriptProvider.cxx | 54 | ||||
-rw-r--r-- | scripting/source/provider/MasterScriptProviderFactory.cxx | 4 | ||||
-rw-r--r-- | scripting/source/provider/ProviderCache.cxx | 2 | ||||
-rw-r--r-- | scripting/source/provider/URIHelper.cxx | 12 | ||||
-rw-r--r-- | scripting/source/stringresource/stringresource.cxx | 50 | ||||
-rw-r--r-- | scripting/source/vbaevents/eventhelper.cxx | 58 |
16 files changed, 169 insertions, 171 deletions
diff --git a/scripting/source/basprov/basmethnode.cxx b/scripting/source/basprov/basmethnode.cxx index d4e4f9e79539..d0e1d8d93c54 100644 --- a/scripting/source/basprov/basmethnode.cxx +++ b/scripting/source/basprov/basmethnode.cxx @@ -189,7 +189,7 @@ namespace basprov if ( aFunctionName != BASPROV_PROPERTY_EDITABLE ) { throw IllegalArgumentException( - "BasicMethodNodeImpl::invoke: function name not supported!", + u"BasicMethodNodeImpl::invoke: function name not supported!"_ustr, Reference< XInterface >(), 1 ); } @@ -240,13 +240,13 @@ namespace basprov Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create( m_xContext ) ); Sequence < PropertyValue > aArgs{ - comphelper::makePropertyValue("Document", sDocURL), - comphelper::makePropertyValue("LibName", sLibName), - comphelper::makePropertyValue("Name", sModName), - comphelper::makePropertyValue("Type", OUString("Module")), - comphelper::makePropertyValue("Line", static_cast< sal_uInt32 >( nLine1 )) + comphelper::makePropertyValue(u"Document"_ustr, sDocURL), + comphelper::makePropertyValue(u"LibName"_ustr, sLibName), + comphelper::makePropertyValue(u"Name"_ustr, sModName), + comphelper::makePropertyValue(u"Type"_ustr, u"Module"_ustr), + comphelper::makePropertyValue(u"Line"_ustr, static_cast< sal_uInt32 >( nLine1 )) }; - xHelper->executeDispatch( xProv, ".uno:BasicIDEAppear", OUString(), 0, aArgs ); + xHelper->executeDispatch( xProv, u".uno:BasicIDEAppear"_ustr, OUString(), 0, aArgs ); } } @@ -258,14 +258,14 @@ namespace basprov void BasicMethodNodeImpl::setValue( const OUString&, const Any& ) { throw UnknownPropertyException( - "BasicMethodNodeImpl::setValue: property name is unknown!" ); + u"BasicMethodNodeImpl::setValue: property name is unknown!"_ustr ); } Any BasicMethodNodeImpl::getValue( const OUString& ) { throw UnknownPropertyException( - "BasicMethodNodeImpl::getValue: property name is unknown!" ); + u"BasicMethodNodeImpl::getValue: property name is unknown!"_ustr ); } diff --git a/scripting/source/basprov/basprov.cxx b/scripting/source/basprov/basprov.cxx index cafd4daa76d0..0271ddaab64c 100644 --- a/scripting/source/basprov/basprov.cxx +++ b/scripting/source/basprov/basprov.cxx @@ -146,7 +146,7 @@ namespace basprov // XServiceInfo OUString BasicProviderImpl::getImplementationName( ) { - return "com.sun.star.comp.scripting.ScriptProviderForBasic"; + return u"com.sun.star.comp.scripting.ScriptProviderForBasic"_ustr; } sal_Bool BasicProviderImpl::supportsService( const OUString& rServiceName ) @@ -157,10 +157,10 @@ namespace basprov Sequence< OUString > BasicProviderImpl::getSupportedServiceNames( ) { return { - "com.sun.star.script.provider.ScriptProviderForBasic", - "com.sun.star.script.provider.LanguageScriptProvider", - "com.sun.star.script.provider.ScriptProvider", - "com.sun.star.script.browse.BrowseNode"}; + u"com.sun.star.script.provider.ScriptProviderForBasic"_ustr, + u"com.sun.star.script.provider.LanguageScriptProvider"_ustr, + u"com.sun.star.script.provider.ScriptProvider"_ustr, + u"com.sun.star.script.browse.BrowseNode"_ustr}; } @@ -176,7 +176,7 @@ namespace basprov if ( aArguments.getLength() != 1 ) { throw IllegalArgumentException( - "BasicProviderImpl::initialize: incorrect argument count.", + u"BasicProviderImpl::initialize: incorrect argument count."_ustr, *this, 1 ); @@ -191,7 +191,7 @@ namespace basprov if ( !xModel.is() ) { throw IllegalArgumentException( - "BasicProviderImpl::initialize: unable to determine the document model from the script invocation context.", + u"BasicProviderImpl::initialize: unable to determine the document model from the script invocation context."_ustr, *this, 1 ); @@ -277,13 +277,13 @@ namespace basprov throw provider::ScriptFrameworkErrorException( "BasicProviderImpl::getScript: failed to parse URI: " + scriptURI, Reference< XInterface >(), - scriptURI, "Basic", + scriptURI, u"Basic"_ustr, provider::ScriptFrameworkErrorType::MALFORMED_URL ); } OUString aDescription = sfUri->getName(); - OUString aLocation = sfUri->getParameter( "location" ); + OUString aLocation = sfUri->getParameter( u"location"_ustr ); sal_Int32 nIndex = 0; // In some strange circumstances the Library name can have an @@ -360,7 +360,7 @@ namespace basprov "method: '" + aMethod + "'\n" "location: '" + aLocation + "'\n", Reference< XInterface >(), - scriptURI, "Basic", + scriptURI, u"Basic"_ustr, provider::ScriptFrameworkErrorType::NO_SUCH_SCRIPT ); } @@ -373,7 +373,7 @@ namespace basprov OUString BasicProviderImpl::getName( ) { - return "Basic"; + return u"Basic"_ustr; } diff --git a/scripting/source/basprov/basscript.cxx b/scripting/source/basprov/basscript.cxx index 35eb04f8d29f..5f124d1c3d80 100644 --- a/scripting/source/basprov/basscript.cxx +++ b/scripting/source/basprov/basscript.cxx @@ -194,10 +194,10 @@ constexpr OUString BASSCRIPT_PROPERTY_CALLER = u"Caller"_ustr; if ( nParamsCount < nSbxCount - nSbxOptional ) { throw provider::ScriptFrameworkErrorException( - "wrong number of parameters!", + u"wrong number of parameters!"_ustr, Reference< XInterface >(), m_funcName, - "Basic", + u"Basic"_ustr, provider::ScriptFrameworkErrorType::NO_SUCH_SCRIPT ); } } @@ -250,7 +250,7 @@ constexpr OUString BASSCRIPT_PROPERTY_CALLER = u"Caller"_ustr; // if it's a document-based script, temporarily reset ThisComponent to the script invocation context Any aOldThisComponent; if ( m_documentBasicManager && m_xDocumentScriptContext.is() ) - m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", Any( m_xDocumentScriptContext ), &aOldThisComponent ); + m_documentBasicManager->SetGlobalUNOConstant( u"ThisComponent"_ustr, Any( m_xDocumentScriptContext ), &aOldThisComponent ); if ( m_caller.hasElements() && m_caller[ 0 ].hasValue() ) { @@ -262,7 +262,7 @@ constexpr OUString BASSCRIPT_PROPERTY_CALLER = u"Caller"_ustr; nErr = m_xMethod->Call( xReturn.get() ); if ( m_documentBasicManager && m_xDocumentScriptContext.is() ) - m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent ); + m_documentBasicManager->SetGlobalUNOConstant( u"ThisComponent"_ustr, aOldThisComponent ); if ( nErr != ERRCODE_NONE ) { diff --git a/scripting/source/dlgprov/DialogModelProvider.cxx b/scripting/source/dlgprov/DialogModelProvider.cxx index ceb46f53c103..7bd62f614fef 100644 --- a/scripting/source/dlgprov/DialogModelProvider.cxx +++ b/scripting/source/dlgprov/DialogModelProvider.cxx @@ -139,7 +139,7 @@ void SAL_CALL DialogModelProvider::removeVetoableChangeListener( const OUString& // com.sun.star.uno.XServiceInfo: OUString SAL_CALL DialogModelProvider::getImplementationName() { - return "com.sun.star.comp.scripting.DialogModelProvider"; + return u"com.sun.star.comp.scripting.DialogModelProvider"_ustr; } sal_Bool SAL_CALL DialogModelProvider::supportsService(OUString const & serviceName) @@ -149,7 +149,7 @@ sal_Bool SAL_CALL DialogModelProvider::supportsService(OUString const & serviceN css::uno::Sequence< OUString > SAL_CALL DialogModelProvider::getSupportedServiceNames() { - return { "com.sun.star.awt.UnoControlDialogModelProvider" }; + return { u"com.sun.star.awt.UnoControlDialogModelProvider"_ustr }; } } // closing anonymous implementation namespace diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx index 53c2e5b67406..30cade77c880 100644 --- a/scripting/source/dlgprov/dlgevtatt.cxx +++ b/scripting/source/dlgprov/dlgevtatt.cxx @@ -115,7 +115,7 @@ namespace dlgprov if ( xSMgr.is() ) { args.getArray()[0] <<= xModel; - mxListener.set( xSMgr->createInstanceWithArgumentsAndContext( "ooo.vba.EventListener", args, m_xContext ), UNO_QUERY ); + mxListener.set( xSMgr->createInstanceWithArgumentsAndContext( u"ooo.vba.EventListener"_ustr, args, m_xContext ), UNO_QUERY ); } if ( !rxControl.is() ) return; @@ -123,9 +123,9 @@ namespace dlgprov try { Reference< XPropertySet > xProps( rxControl->getModel(), UNO_QUERY_THROW ); - xProps->getPropertyValue("Name") >>= msDialogCodeName; + xProps->getPropertyValue(u"Name"_ustr) >>= msDialogCodeName; xProps.set( mxListener, UNO_QUERY_THROW ); - xProps->setPropertyValue("Model", args[ 0 ] ); + xProps->setPropertyValue(u"Model"_ustr, args[ 0 ] ); } catch( const Exception& ) { @@ -161,26 +161,26 @@ namespace dlgprov // key listeners by protocol when ScriptType = 'Script' // otherwise key is the ScriptType e.g. StarBasic if ( rxRTLListener.is() ) // set up handler for RTL_BASIC - listenersForTypes[ OUString("StarBasic") ] = rxRTLListener; + listenersForTypes[ u"StarBasic"_ustr ] = rxRTLListener; else - listenersForTypes[ OUString("StarBasic") ] = new DialogLegacyScriptListenerImpl( rxContext, rxModel ); + listenersForTypes[ u"StarBasic"_ustr ] = new DialogLegacyScriptListenerImpl( rxContext, rxModel ); // handler for Script & OUString("vnd.sun.star.UNO:") - listenersForTypes[ OUString("vnd.sun.star.UNO") ] = new DialogUnoScriptListenerImpl( rxContext, rxModel, rxControl, rxHandler, rxIntrospect, bProviderMode ); - listenersForTypes[ OUString("vnd.sun.star.script") ] = new DialogSFScriptListenerImpl( rxContext, rxModel ); + listenersForTypes[ u"vnd.sun.star.UNO"_ustr ] = new DialogUnoScriptListenerImpl( rxContext, rxModel, rxControl, rxHandler, rxIntrospect, bProviderMode ); + listenersForTypes[ u"vnd.sun.star.script"_ustr ] = new DialogSFScriptListenerImpl( rxContext, rxModel ); // determine the VBA compatibility mode from the Basic library container try { uno::Reference< beans::XPropertySet > xModelProps( rxModel, uno::UNO_QUERY_THROW ); uno::Reference< script::vba::XVBACompatibility > xVBACompat( - xModelProps->getPropertyValue("BasicLibraries"), uno::UNO_QUERY_THROW ); + xModelProps->getPropertyValue(u"BasicLibraries"_ustr), uno::UNO_QUERY_THROW ); mbUseFakeVBAEvents = xVBACompat->getVBACompatibilityMode(); } catch( uno::Exception& ) { } if ( mbUseFakeVBAEvents ) - listenersForTypes[ OUString("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel, sDialogLibName ); + listenersForTypes[ u"VBAInterop"_ustr ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel, sDialogLibName ); } @@ -203,7 +203,7 @@ namespace dlgprov Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() ); if ( xSMgr.is() ) { - Reference< ooo::vba::XVBAToOOEventDescGen > xVBAToOOEvtDesc( xSMgr->createInstanceWithContext("ooo.vba.VBAToOOEventDesc", m_xContext ), UNO_QUERY ); + Reference< ooo::vba::XVBAToOOEventDescGen > xVBAToOOEvtDesc( xSMgr->createInstanceWithContext(u"ooo.vba.VBAToOOEventDesc"_ustr, m_xContext ), UNO_QUERY ); if ( xVBAToOOEvtDesc.is() ) xEventsSupplier = xVBAToOOEvtDesc->getEventSupplier( xControl, sControlName ); @@ -330,7 +330,7 @@ namespace dlgprov throw RuntimeException(); m_xEventAttacher.set( xSMgr->createInstanceWithContext( - "com.sun.star.script.EventAttacher", m_xContext ), UNO_QUERY ); + u"com.sun.star.script.EventAttacher"_ustr, m_xContext ), UNO_QUERY ); if ( !m_xEventAttacher.is() ) throw ServiceNotRegisteredException(); @@ -344,7 +344,7 @@ namespace dlgprov Reference< XPropertySet > xProps( xDlgControl->getModel(), UNO_QUERY ); try { - xProps->getPropertyValue("Name") >>= sDialogCodeName; + xProps->getPropertyValue(u"Name"_ustr) >>= sDialogCodeName; } catch( Exception& ){} } @@ -464,7 +464,7 @@ namespace dlgprov provider::theMasterScriptProviderFactory::get( m_xContext ); Any aCtx; - aCtx <<= OUString("user"); + aCtx <<= u"user"_ustr; xScriptProvider = xFactory->createScriptProvider( aCtx ); } } @@ -603,7 +603,7 @@ namespace dlgprov else { OUString aRes(SfxResId(STR_ERRUNOEVENTBINDUNG)); - OUString aQuoteChar( "\"" ); + OUString aQuoteChar( u"\""_ustr ); sal_Int32 nIndex = aRes.indexOf( '%' ); diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx index bf499982ac7a..eb229770f6a5 100644 --- a/scripting/source/dlgprov/dlgprov.cxx +++ b/scripting/source/dlgprov/dlgprov.cxx @@ -83,7 +83,7 @@ namespace dlgprov Reference< XMultiComponentFactory > xSMgr_( i_xContext->getServiceManager(), UNO_SET_THROW ); // TODO: Ctor Reference< resource::XStringResourceManager > xStringResourceManager( xSMgr_->createInstanceWithContext - ( "com.sun.star.resource.StringResourceWithLocation", + ( u"com.sun.star.resource.StringResourceWithLocation"_ustr, i_xContext ), UNO_QUERY ); if( xStringResourceManager.is() ) { @@ -96,7 +96,7 @@ namespace dlgprov Reference< container::XNameContainer > lcl_createControlModel(const Reference< XComponentContext >& i_xContext) { Reference< XMultiComponentFactory > xSMgr_( i_xContext->getServiceManager(), UNO_SET_THROW ); - Reference< container::XNameContainer > xControlModel( xSMgr_->createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", i_xContext ), UNO_QUERY_THROW ); + Reference< container::XNameContainer > xControlModel( xSMgr_->createInstanceWithContext(u"com.sun.star.awt.UnoControlDialogModel"_ustr, i_xContext ), UNO_QUERY_THROW ); return xControlModel; } Reference< container::XNameContainer > lcl_createDialogModel( const Reference< XComponentContext >& i_xContext, @@ -108,7 +108,7 @@ namespace dlgprov Reference< container::XNameContainer > xDialogModel( lcl_createControlModel(i_xContext) ); Reference< beans::XPropertySet > xDlgPropSet( xDialogModel, UNO_QUERY ); - xDlgPropSet->setPropertyValue( "DialogSourceURL", aDialogSourceURL ); + xDlgPropSet->setPropertyValue( u"DialogSourceURL"_ustr, 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 @@ -125,7 +125,7 @@ namespace dlgprov Reference< beans::XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY ); Any aStringResourceManagerAny; aStringResourceManagerAny <<= xStringResourceManager; - xDlgPSet->setPropertyValue( "ResourceResolver", aStringResourceManagerAny ); + xDlgPSet->setPropertyValue( u"ResourceResolver"_ustr, aStringResourceManagerAny ); } return xDialogModel; @@ -187,7 +187,7 @@ namespace dlgprov { if (!m_BasicInfo) // shouldn't get here - throw RuntimeException("No information to create dialog" ); + throw RuntimeException(u"No information to create dialog"_ustr ); Reference< resource::XStringResourceManager > xStringResourceManager = getStringResourceFromDialogLibrary( m_BasicInfo->mxDlgLib ); Any aDialogSourceURL((OUString())); @@ -258,7 +258,7 @@ namespace dlgprov if ( nIndex != -1 ) sDlgName = sDescription.getToken( 0, '.', nIndex ); - OUString sLocation = sfUri->getParameter( "location" ); + OUString sLocation = sfUri->getParameter( u"location"_ustr ); // get dialog library container @@ -313,7 +313,7 @@ namespace dlgprov if ( !xLibContainer.is() ) { throw IllegalArgumentException( - "DialogProviderImpl::getDialog: library container not found!", + u"DialogProviderImpl::getDialog: library container not found!"_ustr, Reference< XInterface >(), 1 ); } @@ -331,7 +331,7 @@ namespace dlgprov if ( !xDialogLib.is() ) { throw IllegalArgumentException( - "DialogProviderImpl::getDialogModel: library not found!", + u"DialogProviderImpl::getDialogModel: library not found!"_ustr, Reference< XInterface >(), 1 ); } @@ -345,7 +345,7 @@ namespace dlgprov if ( !xISP.is() ) { throw IllegalArgumentException( - "DialogProviderImpl::getDialogModel: dialog not found!", + u"DialogProviderImpl::getDialogModel: dialog not found!"_ustr, Reference< XInterface >(), 1 ); } @@ -494,7 +494,7 @@ namespace dlgprov OUString DialogProviderImpl::getImplementationName( ) { - return "com.sun.star.comp.scripting.DialogProvider"; + return u"com.sun.star.comp.scripting.DialogProvider"_ustr; } sal_Bool DialogProviderImpl::supportsService( const OUString& rServiceName ) @@ -504,9 +504,9 @@ namespace dlgprov Sequence< OUString > DialogProviderImpl::getSupportedServiceNames( ) { - return { "com.sun.star.awt.DialogProvider", - "com.sun.star.awt.DialogProvider2", - "com.sun.star.awt.ContainerWindowProvider" }; + return { u"com.sun.star.awt.DialogProvider"_ustr, + u"com.sun.star.awt.DialogProvider2"_ustr, + u"com.sun.star.awt.ContainerWindowProvider"_ustr }; } @@ -523,7 +523,7 @@ namespace dlgprov if ( !m_xModel.is() ) { - throw RuntimeException( "DialogProviderImpl::initialize: invalid argument format!" ); + throw RuntimeException( u"DialogProviderImpl::initialize: invalid argument format!"_ustr ); } } else if ( aArguments.getLength() == 4 ) @@ -543,7 +543,7 @@ namespace dlgprov } else if ( aArguments.getLength() > 4 ) { - throw RuntimeException( "DialogProviderImpl::initialize: invalid number of arguments!" ); + throw RuntimeException( u"DialogProviderImpl::initialize: invalid number of arguments!"_ustr ); } } @@ -600,7 +600,7 @@ namespace dlgprov if( !bDecoration ) { xDlgModPropSet->setPropertyValue( aDecorationPropName, Any( true ) ); - xDlgModPropSet->setPropertyValue( "Title", Any( OUString() ) ); + xDlgModPropSet->setPropertyValue( u"Title"_ustr, Any( OUString() ) ); } } catch( UnknownPropertyException& ) @@ -634,7 +634,7 @@ namespace dlgprov if( !xHandler.is() ) { throw IllegalArgumentException( - "DialogProviderImpl::createDialogWithHandler: Invalid xHandler!", + u"DialogProviderImpl::createDialogWithHandler: Invalid xHandler!"_ustr, Reference< XInterface >(), 1 ); } Reference< XWindowPeer > xDummyPeer; @@ -649,9 +649,9 @@ namespace dlgprov ::comphelper::NamedValueCollection aArguments( Arguments ); Reference< XWindowPeer > xParentPeer; - if ( aArguments.has( "ParentWindow" ) ) + if ( aArguments.has( u"ParentWindow"_ustr ) ) { - const Any& aParentWindow( aArguments.get( "ParentWindow" ) ); + const Any& aParentWindow( aArguments.get( u"ParentWindow"_ustr ) ); if ( !( aParentWindow >>= xParentPeer ) ) { const Reference< XControl > xParentControl( aParentWindow, UNO_QUERY ); @@ -660,7 +660,7 @@ namespace dlgprov } } - const Reference< XInterface > xHandler( aArguments.get( "EventHandler" ), UNO_QUERY ); + const Reference< XInterface > xHandler( aArguments.get( u"EventHandler"_ustr ), UNO_QUERY ); Reference < XControl > xControl = DialogProviderImpl::createDialogImpl( URL, xHandler, xParentPeer, true ); Reference< XDialog > xDialog( xControl, UNO_QUERY ); @@ -674,7 +674,7 @@ namespace dlgprov if( !xParent.is() ) { throw IllegalArgumentException( - "DialogProviderImpl::createContainerWindow: Invalid xParent!", + u"DialogProviderImpl::createContainerWindow: Invalid xParent!"_ustr, Reference< XInterface >(), 1 ); } Reference < XControl > xControl = DialogProviderImpl::createDialogImpl( URL, xHandler, xParent, false ); diff --git a/scripting/source/inc/util/MiscUtils.hxx b/scripting/source/inc/util/MiscUtils.hxx index 2ba4492abae3..8c332e5fe98e 100644 --- a/scripting/source/inc/util/MiscUtils.hxx +++ b/scripting/source/inc/util/MiscUtils.hxx @@ -49,7 +49,7 @@ static css::uno::Sequence< OUString > allOpenTDocUrls( const css::uno::Referenc return result; } css::uno::Reference < css::ucb::XSimpleFileAccess3 > xSFA( css::ucb::SimpleFileAccess::create(xCtx) ); - result = xSFA->getFolderContents( "vnd.sun.star.tdoc:/", true ); + result = xSFA->getFolderContents( u"vnd.sun.star.tdoc:/"_ustr, true ); } catch ( css::uno::Exception& ) { @@ -67,7 +67,7 @@ static OUString xModelToTdocUrl( const css::uno::Reference< css::frame::XModel > try { xDocFac.set(xMCF->createInstanceWithContext( - "com.sun.star.frame.TransientDocumentsDocumentContentFactory", + u"com.sun.star.frame.TransientDocumentsDocumentContentFactory"_ustr, xContext ), css::uno::UNO_QUERY ); } @@ -101,7 +101,7 @@ static css::uno::Reference< css::frame::XModel > tDocUrlToModel( const OUString& try { ::ucbhelper::Content root( url, nullptr, comphelper::getProcessComponentContext() ); - result = getUCBProperty( root, "DocumentModel" ); + result = getUCBProperty( root, u"DocumentModel"_ustr ); } catch ( css::ucb::ContentCreationException& ) { diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx index 54ca264b32f6..f4217b820f13 100644 --- a/scripting/source/protocolhandler/scripthandler.cxx +++ b/scripting/source/protocolhandler/scripthandler.cxx @@ -75,7 +75,7 @@ void SAL_CALL ScriptProtocolHandler::initialize( // but usually it's a "real" frame) if ( aArguments.hasElements() && !( aArguments[ 0 ] >>= m_xFrame ) ) { - throw RuntimeException( "ScriptProtocolHandler::initialize: could not extract reference to the frame" ); + throw RuntimeException( u"ScriptProtocolHandler::initialize: could not extract reference to the frame"_ustr ); } ENSURE_OR_THROW( m_xContext.is(), "ScriptProtocolHandler::initialize: No Service Manager available" ); @@ -133,7 +133,7 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification( css::uri::UriReferenceFactory::create(m_xContext)); css::uno::Reference<css::uri::XVndSunStarScriptUrlReference> uri( urifac->parse(aURL.Complete), css::uno::UNO_QUERY_THROW); - auto const loc = uri->getParameter("location"); + auto const loc = uri->getParameter(u"location"_ustr); bool bIsDocumentScript = loc == "document"; if ( bIsDocumentScript ) @@ -247,9 +247,7 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification( } else { - invokeResult <<= OUString( - "ScriptProtocolHandler::dispatchWithNotification failed, ScriptProtocolHandler not initialised" - ); + invokeResult <<= u"ScriptProtocolHandler::dispatchWithNotification failed, ScriptProtocolHandler not initialised"_ustr; } if ( bCaughtException ) @@ -408,7 +406,7 @@ ScriptProtocolHandler::~ScriptProtocolHandler() /* XServiceInfo */ OUString SAL_CALL ScriptProtocolHandler::getImplementationName( ) { - return "com.sun.star.comp.ScriptProtocolHandler"; + return u"com.sun.star.comp.ScriptProtocolHandler"_ustr; } /* XServiceInfo */ @@ -420,7 +418,7 @@ sal_Bool SAL_CALL ScriptProtocolHandler::supportsService(const OUString& sServic /* XServiceInfo */ Sequence< OUString > SAL_CALL ScriptProtocolHandler::getSupportedServiceNames() { - return {"com.sun.star.frame.ProtocolHandler"}; + return {u"com.sun.star.frame.ProtocolHandler"_ustr}; } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* diff --git a/scripting/source/provider/ActiveMSPList.cxx b/scripting/source/provider/ActiveMSPList.cxx index 8ff88be99512..a53aa9a73478 100644 --- a/scripting/source/provider/ActiveMSPList.cxx +++ b/scripting/source/provider/ActiveMSPList.cxx @@ -52,7 +52,7 @@ ActiveMSPList::createNewMSP( const uno::Any& context ) Reference< provider::XScriptProvider > msp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( - "com.sun.star.script.provider.MasterScriptProvider", args, m_xContext ), UNO_QUERY ); + u"com.sun.star.script.provider.MasterScriptProvider"_ustr, args, m_xContext ), UNO_QUERY ); return msp; } @@ -128,8 +128,8 @@ Reference< provider::XScriptProvider > if ( !xScripts.is() ) { throw lang::IllegalArgumentException( - "Failed to create MasterScriptProvider for ScriptInvocationContext: " - "Component supporting XEmbeddScripts interface not found.", + u"Failed to create MasterScriptProvider for ScriptInvocationContext: " + "Component supporting XEmbeddScripts interface not found."_ustr, nullptr, 1 ); } @@ -272,7 +272,7 @@ void ActiveMSPList::createNonDocMSPs() { // do creation of user and share MSPs here - OUString serviceName("com.sun.star.script.provider.MasterScriptProvider"); + OUString serviceName(u"com.sun.star.script.provider.MasterScriptProvider"_ustr); Sequence< Any > args{ Any(userDirString) }; // should check if provider reference is valid diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx index 3ea45aeecd7e..003cb999f520 100644 --- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx +++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx @@ -266,8 +266,8 @@ std::vector< Reference< browse::XBrowseNode > > getAllBrowseNodes( const Referen { xFac = provider::theMasterScriptProviderFactory::get( xCtx ); - locnBNs[ mspIndex++ ].set( xFac->createScriptProvider( Any( OUString("user") ) ), UNO_QUERY_THROW ); - locnBNs[ mspIndex++ ].set( xFac->createScriptProvider( Any( OUString("share") ) ), UNO_QUERY_THROW ); + locnBNs[ mspIndex++ ].set( xFac->createScriptProvider( Any( u"user"_ustr ) ), UNO_QUERY_THROW ); + locnBNs[ mspIndex++ ].set( xFac->createScriptProvider( Any( u"share"_ustr ) ), UNO_QUERY_THROW ); } // TODO proper exception handling, should throw catch( const Exception& ) @@ -545,7 +545,7 @@ public: virtual OUString SAL_CALL getName() override { - return "Root"; + return u"Root"_ustr; } virtual Sequence< Reference< browse::XBrowseNode > > SAL_CALL @@ -607,7 +607,7 @@ BrowseNodeFactoryImpl::createView( sal_Int16 viewType ) case browse::BrowseNodeFactoryViewTypes::MACROORGANIZER: return getOrganizerHierarchy(); default: - throw RuntimeException( "Unknown view type" ); + throw RuntimeException( u"Unknown view type"_ustr ); } } @@ -624,13 +624,13 @@ BrowseNodeFactoryImpl::getOrganizerHierarchy() const OUString SAL_CALL BrowseNodeFactoryImpl::getImplementationName() { - return "com.sun.star.script.browse.BrowseNodeFactory"; + return u"com.sun.star.script.browse.BrowseNodeFactory"_ustr; } Sequence< OUString > SAL_CALL BrowseNodeFactoryImpl::getSupportedServiceNames() { - return { "com.sun.star.script.browse.BrowseNodeFactory" }; + return { u"com.sun.star.script.browse.BrowseNodeFactory"_ustr }; } sal_Bool BrowseNodeFactoryImpl::supportsService(OUString const & serviceName ) diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx index 66fc58db78bd..a6350846e20d 100644 --- a/scripting/source/provider/MasterScriptProvider.cxx +++ b/scripting/source/provider/MasterScriptProvider.cxx @@ -90,7 +90,7 @@ void SAL_CALL MasterScriptProvider::initialize( const Sequence < Any >& args ) if ( len > 1 ) { throw RuntimeException( - "MasterScriptProvider::initialize: invalid number of arguments" ); + u"MasterScriptProvider::initialize: invalid number of arguments"_ustr ); } Sequence< Any > invokeArgs( len ); @@ -128,7 +128,7 @@ void SAL_CALL MasterScriptProvider::initialize( const Sequence < Any >& args ) if ( !xScripts.is() ) { throw lang::IllegalArgumentException( - "The given document does not support embedding scripts into it, and cannot be associated with such a document.", + u"The given document does not support embedding scripts into it, and cannot be associated with such a document."_ustr, *this, 1 ); @@ -158,7 +158,7 @@ void SAL_CALL MasterScriptProvider::initialize( const Sequence < Any >& args ) pinvokeArgs[ 0 ] <<= m_sCtxString; } - OUString pkgSpec = "uno_packages"; + OUString pkgSpec = u"uno_packages"_ustr; sal_Int32 indexOfPkgSpec = m_sCtxString.lastIndexOf( pkgSpec ); // if context string ends with "uno_packages" @@ -216,8 +216,8 @@ MasterScriptProvider::getScript( const OUString& scriptURI ) if ( !m_bIsValid ) { throw provider::ScriptFrameworkErrorException( - "MasterScriptProvider not initialised", Reference< XInterface >(), - scriptURI, "", + u"MasterScriptProvider not initialised"_ustr, Reference< XInterface >(), + scriptURI, u""_ustr, provider::ScriptFrameworkErrorType::UNKNOWN ); } @@ -234,12 +234,12 @@ MasterScriptProvider::getScript( const OUString& scriptURI ) throw provider::ScriptFrameworkErrorException( "Incorrect format for Script URI: " + scriptURI, Reference< XInterface >(), - scriptURI, "", + scriptURI, u""_ustr, provider::ScriptFrameworkErrorType::UNKNOWN ); } - OUString langKey("language"); - OUString locKey("location"); + OUString langKey(u"language"_ustr); + OUString locKey(u"location"_ustr); if ( !sfUri->hasParameter( langKey ) || !sfUri->hasParameter( locKey ) || @@ -248,7 +248,7 @@ MasterScriptProvider::getScript( const OUString& scriptURI ) throw provider::ScriptFrameworkErrorException( "Incorrect format for Script URI: " + scriptURI, Reference< XInterface >(), - scriptURI, "", + scriptURI, u""_ustr, provider::ScriptFrameworkErrorType::UNKNOWN ); } @@ -257,7 +257,7 @@ MasterScriptProvider::getScript( const OUString& scriptURI ) // if script us located in uno pkg sal_Int32 index = -1; - OUString pkgTag(":uno_packages"); + OUString pkgTag(u":uno_packages"_ustr); // for languages other than basic, scripts located in uno packages // are merged into the user/share location context. // For other languages the location attribute in script url has the form @@ -295,7 +295,7 @@ MasterScriptProvider::getScript( const OUString& scriptURI ) if ( !providerCache() ) { throw provider::ScriptFrameworkErrorException( - "No LanguageProviders detected", + u"No LanguageProviders detected"_ustr, Reference< XInterface >(), sfUri->getName(), language, provider::ScriptFrameworkErrorType::NOTSUPPORTED ); @@ -339,7 +339,7 @@ MasterScriptProvider::providerCache() std::scoped_lock aGuard( m_mutex ); if ( !m_pPCache ) { - Sequence<OUString> denylist { "com.sun.star.script.provider.ScriptProviderForBasic" }; + Sequence<OUString> denylist { u"com.sun.star.script.provider.ScriptProviderForBasic"_ustr }; if ( !m_bIsPkgMSP ) { @@ -492,7 +492,7 @@ MasterScriptProvider::insertByName( const OUString& aName, const Any& aElement ) { if ( !m_xMSPPkg.is() ) { - throw RuntimeException( "PackageMasterScriptProvider is unitialised" ); + throw RuntimeException( u"PackageMasterScriptProvider is unitialised"_ustr ); } Reference< container::XNameContainer > xCont( m_xMSPPkg, UNO_QUERY_THROW ); @@ -503,12 +503,12 @@ MasterScriptProvider::insertByName( const OUString& aName, const Any& aElement ) Reference< deployment::XPackage > xPkg( aElement, UNO_QUERY ); if ( !xPkg.is() ) { - throw lang::IllegalArgumentException( "Couldn't convert to XPackage", + throw lang::IllegalArgumentException( u"Couldn't convert to XPackage"_ustr, Reference < XInterface > (), 2 ); } if ( aName.isEmpty() ) { - throw lang::IllegalArgumentException( "Name not set!!", + throw lang::IllegalArgumentException( u"Name not set!!"_ustr, Reference < XInterface > (), 1 ); } // TODO for library package parse the language, for the moment will try @@ -537,7 +537,7 @@ MasterScriptProvider::removeByName( const OUString& Name ) { if ( !m_xMSPPkg.is() ) { - throw RuntimeException( "PackageMasterScriptProvider is unitialised" ); + throw RuntimeException( u"PackageMasterScriptProvider is unitialised"_ustr ); } Reference< container::XNameContainer > xCont( m_xMSPPkg, UNO_QUERY_THROW ); @@ -547,7 +547,7 @@ MasterScriptProvider::removeByName( const OUString& Name ) { if ( Name.isEmpty() ) { - throw lang::IllegalArgumentException( "Name not set!!", + throw lang::IllegalArgumentException( u"Name not set!!"_ustr, Reference < XInterface > (), 1 ); } // TODO for Script library package url parse the language, @@ -573,14 +573,14 @@ void SAL_CALL MasterScriptProvider::replaceByName( const OUString& /*aName*/, const Any& /*aElement*/ ) { // TODO needs implementing - throw RuntimeException( "replaceByName not implemented!!!!" ); + throw RuntimeException( u"replaceByName not implemented!!!!"_ustr ); } Any SAL_CALL MasterScriptProvider::getByName( const OUString& /*aName*/ ) { // TODO needs to be implemented - throw RuntimeException( "getByName not implemented!!!!" ); + throw RuntimeException( u"getByName not implemented!!!!"_ustr ); } sal_Bool SAL_CALL @@ -598,7 +598,7 @@ MasterScriptProvider::hasByName( const OUString& aName ) // have a PackageProvider else if (!m_xModel.is()) { - throw RuntimeException( "PackageMasterScriptProvider is unitialised" ); + throw RuntimeException( u"PackageMasterScriptProvider is unitialised"_ustr ); } } @@ -606,7 +606,7 @@ MasterScriptProvider::hasByName( const OUString& aName ) { if ( aName.isEmpty() ) { - throw lang::IllegalArgumentException( "Name not set!!", + throw lang::IllegalArgumentException( u"Name not set!!"_ustr, Reference < XInterface > (), 1 ); } // TODO for Script library package url parse the language, @@ -626,7 +626,7 @@ Sequence< OUString > SAL_CALL MasterScriptProvider::getElementNames( ) { // TODO needs implementing - throw RuntimeException( "getElementNames not implemented!!!!" ); + throw RuntimeException( u"getElementNames not implemented!!!!"_ustr ); } Type SAL_CALL @@ -640,13 +640,13 @@ MasterScriptProvider::getElementType( ) sal_Bool SAL_CALL MasterScriptProvider::hasElements( ) { // TODO needs implementing - throw RuntimeException( "hasElements not implemented!!!!" ); + throw RuntimeException( u"hasElements not implemented!!!!"_ustr ); } OUString SAL_CALL MasterScriptProvider::getImplementationName( ) { - return "com.sun.star.script.provider.MasterScriptProvider"; + return u"com.sun.star.script.provider.MasterScriptProvider"_ustr; } sal_Bool SAL_CALL MasterScriptProvider::supportsService( const OUString& serviceName ) @@ -658,9 +658,9 @@ sal_Bool SAL_CALL MasterScriptProvider::supportsService( const OUString& service Sequence< OUString > SAL_CALL MasterScriptProvider::getSupportedServiceNames( ) { return { - "com.sun.star.script.provider.MasterScriptProvider", - "com.sun.star.script.browse.BrowseNode", - "com.sun.star.script.provider.ScriptProvider" }; + u"com.sun.star.script.provider.MasterScriptProvider"_ustr, + u"com.sun.star.script.browse.BrowseNode"_ustr, + u"com.sun.star.script.provider.ScriptProvider"_ustr }; } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* diff --git a/scripting/source/provider/MasterScriptProviderFactory.cxx b/scripting/source/provider/MasterScriptProviderFactory.cxx index acdb8f8da0ff..20050e116e09 100644 --- a/scripting/source/provider/MasterScriptProviderFactory.cxx +++ b/scripting/source/provider/MasterScriptProviderFactory.cxx @@ -59,12 +59,12 @@ MasterScriptProviderFactory::getActiveMSPList() const OUString SAL_CALL MasterScriptProviderFactory::getImplementationName() { - return "com.sun.star.script.provider.MasterScriptProviderFactory"; + return u"com.sun.star.script.provider.MasterScriptProviderFactory"_ustr; } Sequence< OUString > SAL_CALL MasterScriptProviderFactory::getSupportedServiceNames() { - return { "com.sun.star.script.provider.MasterScriptProviderFactory" }; + return { u"com.sun.star.script.provider.MasterScriptProviderFactory"_ustr }; } sal_Bool MasterScriptProviderFactory::supportsService( diff --git a/scripting/source/provider/ProviderCache.cxx b/scripting/source/provider/ProviderCache.cxx index 7b240fe590fd..f679df5d10e5 100644 --- a/scripting/source/provider/ProviderCache.cxx +++ b/scripting/source/provider/ProviderCache.cxx @@ -137,7 +137,7 @@ ProviderCache::populateCache() try { Reference< container::XContentEnumerationAccess > xEnumAccess( m_xMgr, UNO_QUERY_THROW ); - Reference< container::XEnumeration > xEnum = xEnumAccess->createContentEnumeration ( "com.sun.star.script.provider.LanguageScriptProvider" ); + Reference< container::XEnumeration > xEnum = xEnumAccess->createContentEnumeration ( u"com.sun.star.script.provider.LanguageScriptProvider"_ustr ); while ( xEnum->hasMoreElements() ) { diff --git a/scripting/source/provider/URIHelper.cxx b/scripting/source/provider/URIHelper.cxx index 4b122da8b1d7..a335abbaad3d 100644 --- a/scripting/source/provider/URIHelper.cxx +++ b/scripting/source/provider/URIHelper.cxx @@ -80,19 +80,19 @@ ScriptingFrameworkURIHelper::initialize( args[0].getValueType() != ::cppu::UnoType<OUString>::get() || args[1].getValueType() != ::cppu::UnoType<OUString>::get() ) { - throw uno::RuntimeException( "ScriptingFrameworkURIHelper got invalid argument list" ); + throw uno::RuntimeException( u"ScriptingFrameworkURIHelper got invalid argument list"_ustr ); } if ( !(args[0] >>= m_sLanguage) || !(args[1] >>= m_sLocation) ) { - throw uno::RuntimeException( "ScriptingFrameworkURIHelper error parsing args" ); + throw uno::RuntimeException( u"ScriptingFrameworkURIHelper error parsing args"_ustr ); } SCRIPTS_PART = "/Scripts/" + m_sLanguage.toAsciiLowerCase(); if ( !initBaseURI() ) { - throw uno::RuntimeException( "ScriptingFrameworkURIHelper cannot find script directory" ); + throw uno::RuntimeException( u"ScriptingFrameworkURIHelper cannot find script directory"_ustr ); } } @@ -211,7 +211,7 @@ ScriptingFrameworkURIHelper::getStorageURI(const OUString& rScriptURI) catch ( uno::Exception& ) { throw lang::IllegalArgumentException( - "Script URI not valid", + u"Script URI not valid"_ustr, uno::Reference< uno::XInterface >(), 1 ); } @@ -228,7 +228,7 @@ OUString SAL_CALL ScriptingFrameworkURIHelper::getImplementationName() { return - "com.sun.star.script.provider.ScriptURIHelper"; + u"com.sun.star.script.provider.ScriptURIHelper"_ustr; } sal_Bool SAL_CALL @@ -240,7 +240,7 @@ ScriptingFrameworkURIHelper::supportsService( const OUString& serviceName ) uno::Sequence< OUString > SAL_CALL ScriptingFrameworkURIHelper::getSupportedServiceNames() { - return { "com.sun.star.script.provider.ScriptURIHelper" }; + return { u"com.sun.star.script.provider.ScriptURIHelper"_ustr }; } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index 7b5db938a08d..1ab21c569382 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -85,7 +85,7 @@ StringResourceImpl::~StringResourceImpl() OUString StringResourceImpl::getImplementationName( ) { - return "com.sun.star.comp.scripting.StringResource"; + return u"com.sun.star.comp.scripting.StringResource"_ustr; } sal_Bool StringResourceImpl::supportsService( const OUString& rServiceName ) @@ -95,7 +95,7 @@ sal_Bool StringResourceImpl::supportsService( const OUString& rServiceName ) Sequence< OUString > StringResourceImpl::getSupportedServiceNames( ) { - return { "com.sun.star.resource.StringResource" }; + return { u"com.sun.star.resource.StringResource"_ustr }; } @@ -392,7 +392,7 @@ void StringResourceImpl::newLocale( const Locale& locale ) if( getItemForLocale( locale, false ) != nullptr ) { - throw ElementExistException( "StringResourceImpl: locale already exists" ); + throw ElementExistException( u"StringResourceImpl: locale already exists"_ustr ); } // TODO?: Check if locale is valid? How? @@ -538,7 +538,7 @@ sal_Int32 StringResourceImpl::getUniqueNumericId( ) if( m_nNextUniqueNumericId < UNIQUE_NUMBER_NEEDS_INITIALISATION ) { - throw NoSupportException( "getUniqueNumericId: Extended sal_Int32 range" ); + throw NoSupportException( u"getUniqueNumericId: Extended sal_Int32 range"_ustr ); } return m_nNextUniqueNumericId; } @@ -569,7 +569,7 @@ LocaleItem* StringResourceImpl::getItemForLocale if( pRetItem == nullptr && bException ) { - throw IllegalArgumentException( "StringResourceImpl: Invalid locale", Reference< XInterface >(), 0 ); + throw IllegalArgumentException( u"StringResourceImpl: Invalid locale"_ustr, Reference< XInterface >(), 0 ); } return pRetItem; } @@ -646,7 +646,7 @@ StringResourcePersistenceImpl::~StringResourcePersistenceImpl() OUString StringResourcePersistenceImpl::getImplementationName( ) { - return "com.sun.star.comp.scripting.StringResource"; + return u"com.sun.star.comp.scripting.StringResource"_ustr; } @@ -673,20 +673,20 @@ void StringResourcePersistenceImpl::implInitializeCommonParameters bool bReadOnlyOk = (aArguments[1] >>= m_bReadOnly); if( !bReadOnlyOk ) { - throw IllegalArgumentException( "XInitialization::initialize: Expected ReadOnly flag", Reference< XInterface >(), 1 ); + throw IllegalArgumentException( u"XInitialization::initialize: Expected ReadOnly flag"_ustr, Reference< XInterface >(), 1 ); } css::lang::Locale aCurrentLocale; bool bLocaleOk = (aArguments[2] >>= aCurrentLocale); if( !bLocaleOk ) { - throw IllegalArgumentException( "XInitialization::initialize: Expected Locale", Reference< XInterface >(), 2 ); + throw IllegalArgumentException( u"XInitialization::initialize: Expected Locale"_ustr, Reference< XInterface >(), 2 ); } bool bNameBaseOk = (aArguments[3] >>= m_aNameBase); if( !bNameBaseOk ) { - throw IllegalArgumentException( "XInitialization::initialize: Expected NameBase string", Reference< XInterface >(), 3 ); + throw IllegalArgumentException( u"XInitialization::initialize: Expected NameBase string"_ustr, Reference< XInterface >(), 3 ); } if( m_aNameBase.isEmpty() ) m_aNameBase = aNameBaseDefaultStr; @@ -694,7 +694,7 @@ void StringResourcePersistenceImpl::implInitializeCommonParameters bool bCommentOk = (aArguments[4] >>= m_aComment); if( !bCommentOk ) { - throw IllegalArgumentException( "XInitialization::initialize: Expected Comment string", Reference< XInterface >(), 4 ); + throw IllegalArgumentException( u"XInitialization::initialize: Expected Comment string"_ustr, Reference< XInterface >(), 4 ); } implScanLocales(); @@ -870,8 +870,8 @@ void StringResourcePersistenceImpl::implStoreAtStorage OSL_ENSURE( xProps.is(), "The StorageStream must implement XPropertySet interface!" ); if ( xProps.is() ) { - OUString aPropName("MediaType"); - xProps->setPropertyValue( aPropName, uno::Any( OUString("text/plain") ) ); + OUString aPropName(u"MediaType"_ustr); + xProps->setPropertyValue( aPropName, uno::Any( u"text/plain"_ustr ) ); aPropName = "UseCommonStoragePasswordEncryption"; xProps->setPropertyValue( aPropName, uno::Any( true ) ); @@ -1946,7 +1946,7 @@ bool StringResourcePersistenceImpl::implWritePropertiesFile( LocaleItem const * xTextOutputStream->setEncoding( aEncodingStr ); xTextOutputStream->writeString( aComment ); - xTextOutputStream->writeString( "\n" ); + xTextOutputStream->writeString( u"\n"_ustr ); const IdToStringMap& rHashMap = pLocaleItem->m_aIdToStringMap; if( !rHashMap.empty() ) @@ -1982,7 +1982,7 @@ bool StringResourcePersistenceImpl::implWritePropertiesFile( LocaleItem const * if( it != rHashMap.end() ) { implWriteStringWithEncoding( aResourceID, xTextOutputStream, true ); - xTextOutputStream->writeString( "=" ); + xTextOutputStream->writeString( u"="_ustr ); OUString aValStr = (*it).second; implWriteStringWithEncoding( aValStr, xTextOutputStream, false ); } @@ -2023,7 +2023,7 @@ StringResourceWithStorageImpl::~StringResourceWithStorageImpl() OUString StringResourceWithStorageImpl::getImplementationName( ) { - return "com.sun.star.comp.scripting.StringResourceWithStorage"; + return u"com.sun.star.comp.scripting.StringResourceWithStorage"_ustr; } sal_Bool StringResourceWithStorageImpl::supportsService( const OUString& rServiceName ) @@ -2033,7 +2033,7 @@ sal_Bool StringResourceWithStorageImpl::supportsService( const OUString& rServic Sequence< OUString > StringResourceWithStorageImpl::getSupportedServiceNames( ) { - return { "com.sun.star.resource.StringResourceWithStorage" }; + return { u"com.sun.star.resource.StringResourceWithStorage"_ustr }; } @@ -2047,7 +2047,7 @@ void StringResourceWithStorageImpl::initialize( const Sequence< Any >& aArgument if ( aArguments.getLength() != 5 ) { throw RuntimeException( - "StringResourceWithStorageImpl::initialize: invalid number of arguments!" ); + u"StringResourceWithStorageImpl::initialize: invalid number of arguments!"_ustr ); } bool bOk = (aArguments[0] >>= m_xStorage); @@ -2056,7 +2056,7 @@ void StringResourceWithStorageImpl::initialize( const Sequence< Any >& aArgument if( !bOk ) { - throw IllegalArgumentException( "StringResourceWithStorageImpl::initialize: invalid storage", Reference< XInterface >(), 0 ); + throw IllegalArgumentException( u"StringResourceWithStorageImpl::initialize: invalid storage"_ustr, Reference< XInterface >(), 0 ); } implInitializeCommonParameters( aGuard, aArguments ); @@ -2216,7 +2216,7 @@ void StringResourceWithStorageImpl::setStorage( const Reference< XStorage >& Sto if( !Storage.is() ) { - throw IllegalArgumentException( "StringResourceWithStorageImpl::setStorage: invalid storage", Reference< XInterface >(), 0 ); + throw IllegalArgumentException( u"StringResourceWithStorageImpl::setStorage: invalid storage"_ustr, Reference< XInterface >(), 0 ); } implLoadAllLocales(); @@ -2298,7 +2298,7 @@ StringResourceWithLocationImpl::~StringResourceWithLocationImpl() OUString StringResourceWithLocationImpl::getImplementationName( ) { - return "com.sun.star.comp.scripting.StringResourceWithLocation"; + return u"com.sun.star.comp.scripting.StringResourceWithLocation"_ustr; } sal_Bool StringResourceWithLocationImpl::supportsService( const OUString& rServiceName ) @@ -2308,7 +2308,7 @@ sal_Bool StringResourceWithLocationImpl::supportsService( const OUString& rServi Sequence< OUString > StringResourceWithLocationImpl::getSupportedServiceNames( ) { - return { "com.sun.star.resource.StringResourceWithLocation" }; + return { u"com.sun.star.resource.StringResourceWithLocation"_ustr }; } @@ -2322,7 +2322,7 @@ void StringResourceWithLocationImpl::initialize( const Sequence< Any >& aArgumen if ( aArguments.getLength() != 6 ) { throw RuntimeException( - "XInitialization::initialize: invalid number of arguments!" ); + u"XInitialization::initialize: invalid number of arguments!"_ustr ); } bool bOk = (aArguments[0] >>= m_aLocation); @@ -2339,14 +2339,14 @@ void StringResourceWithLocationImpl::initialize( const Sequence< Any >& aArgumen if( !bOk ) { - throw IllegalArgumentException( "XInitialization::initialize: invalid URL", Reference< XInterface >(), 0 ); + throw IllegalArgumentException( u"XInitialization::initialize: invalid URL"_ustr, Reference< XInterface >(), 0 ); } bOk = (aArguments[5] >>= m_xInteractionHandler); if( !bOk ) { - throw IllegalArgumentException( "StringResourceWithStorageImpl::initialize: invalid type", Reference< XInterface >(), 5 ); + throw IllegalArgumentException( u"StringResourceWithStorageImpl::initialize: invalid type"_ustr, Reference< XInterface >(), 5 ); } implInitializeCommonParameters( aGuard, aArguments ); @@ -2511,7 +2511,7 @@ void StringResourceWithLocationImpl::setURL( const OUString& URL ) sal_Int32 nLen = URL.getLength(); if( nLen == 0 ) { - throw IllegalArgumentException( "StringResourceWithLocationImpl::setURL: invalid URL", Reference< XInterface >(), 0 ); + throw IllegalArgumentException( u"StringResourceWithLocationImpl::setURL: invalid URL"_ustr, Reference< XInterface >(), 0 ); } implLoadAllLocales(); diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx index 0efc50085040..6feed05e6dda 100644 --- a/scripting/source/vbaevents/eventhelper.cxx +++ b/scripting/source/vbaevents/eventhelper.cxx @@ -202,49 +202,49 @@ TypeList const listBoxList = {&typeXListBox, 1}; //this array stores the OO event to VBA event translation info static TranslatePropMap aTranslatePropMap_Impl[] = { - { OUString("actionPerformed"), { OUString("_Change"), nullptr, DenyType, static_cast<void const *>(&radioButtonList) } }, + { u"actionPerformed"_ustr, { u"_Change"_ustr, nullptr, DenyType, static_cast<void const *>(&radioButtonList) } }, // actionPerformed ooo event - { OUString("actionPerformed"), { OUString("_Click"), nullptr, ApproveAll, nullptr } }, - { OUString("itemStateChanged"), { OUString("_Change"), nullptr, ApproveType, static_cast<void const *>(&radioButtonList) } }, + { u"actionPerformed"_ustr, { u"_Click"_ustr, nullptr, ApproveAll, nullptr } }, + { u"itemStateChanged"_ustr, { u"_Change"_ustr, nullptr, ApproveType, static_cast<void const *>(&radioButtonList) } }, // itemStateChanged ooo event - { OUString("itemStateChanged"), { OUString("_Click"), nullptr, ApproveType, static_cast<void const *>(&comboBoxList) } }, + { u"itemStateChanged"_ustr, { u"_Click"_ustr, nullptr, ApproveType, static_cast<void const *>(&comboBoxList) } }, - { OUString("itemStateChanged"), { OUString("_Click"), nullptr, ApproveType, static_cast<void const *>(&listBoxList) } }, + { u"itemStateChanged"_ustr, { u"_Click"_ustr, nullptr, ApproveType, static_cast<void const *>(&listBoxList) } }, // changed ooo event - { OUString("changed"), { OUString("_Change"), nullptr, ApproveAll, nullptr } }, + { u"changed"_ustr, { u"_Change"_ustr, nullptr, ApproveAll, nullptr } }, // focusGained ooo event - { OUString("focusGained"), { OUString("_GotFocus"), nullptr, ApproveAll, nullptr } }, + { u"focusGained"_ustr, { u"_GotFocus"_ustr, nullptr, ApproveAll, nullptr } }, // focusLost ooo event - { OUString("focusLost"), { OUString("_LostFocus"), nullptr, ApproveAll, nullptr } }, - { OUString("focusLost"), { OUString("_Exit"), nullptr, ApproveType, static_cast<void const *>(&textCompList) } }, // support VBA TextBox_Exit event + { u"focusLost"_ustr, { u"_LostFocus"_ustr, nullptr, ApproveAll, nullptr } }, + { u"focusLost"_ustr, { u"_Exit"_ustr, nullptr, ApproveType, static_cast<void const *>(&textCompList) } }, // support VBA TextBox_Exit event // adjustmentValueChanged ooo event - { OUString("adjustmentValueChanged"), { OUString("_Scroll"), nullptr, ApproveAll, nullptr } }, - { OUString("adjustmentValueChanged"), { OUString("_Change"), nullptr, ApproveAll, nullptr } }, + { u"adjustmentValueChanged"_ustr, { u"_Scroll"_ustr, nullptr, ApproveAll, nullptr } }, + { u"adjustmentValueChanged"_ustr, { u"_Change"_ustr, nullptr, ApproveAll, nullptr } }, // textChanged ooo event - { OUString("textChanged"), { OUString("_Change"), nullptr, ApproveAll, nullptr } }, + { u"textChanged"_ustr, { u"_Change"_ustr, nullptr, ApproveAll, nullptr } }, // keyReleased ooo event - { OUString("keyReleased"), { OUString("_KeyUp"), ooKeyPressedToVBAKeyUpDown, ApproveAll, nullptr } }, + { u"keyReleased"_ustr, { u"_KeyUp"_ustr, ooKeyPressedToVBAKeyUpDown, ApproveAll, nullptr } }, // mouseReleased ooo event - { OUString("mouseReleased"), { OUString("_Click"), ooMouseEvtToVBAMouseEvt, ApproveType, static_cast<void const *>(&fixedTextList) } }, - { OUString("mouseReleased"), { OUString("_MouseUp"), ooMouseEvtToVBAMouseEvt, ApproveAll, nullptr } }, + { u"mouseReleased"_ustr, { u"_Click"_ustr, ooMouseEvtToVBAMouseEvt, ApproveType, static_cast<void const *>(&fixedTextList) } }, + { u"mouseReleased"_ustr, { u"_MouseUp"_ustr, ooMouseEvtToVBAMouseEvt, ApproveAll, nullptr } }, // mousePressed ooo event - { OUString("mousePressed"), { OUString("_MouseDown"), ooMouseEvtToVBAMouseEvt, ApproveAll, nullptr } }, - { OUString("mousePressed"), { OUString("_DblClick"), ooMouseEvtToVBADblClick, ApproveAll, nullptr } }, + { u"mousePressed"_ustr, { u"_MouseDown"_ustr, ooMouseEvtToVBAMouseEvt, ApproveAll, nullptr } }, + { u"mousePressed"_ustr, { u"_DblClick"_ustr, ooMouseEvtToVBADblClick, ApproveAll, nullptr } }, // mouseMoved ooo event - { OUString("mouseMoved"), { OUString("_MouseMove"), ooMouseEvtToVBAMouseEvt, ApproveAll, nullptr } }, - { OUString("mouseDragged"), { OUString("_MouseMove"), ooMouseEvtToVBAMouseEvt, DenyMouseDrag, nullptr } }, + { u"mouseMoved"_ustr, { u"_MouseMove"_ustr, ooMouseEvtToVBAMouseEvt, ApproveAll, nullptr } }, + { u"mouseDragged"_ustr, { u"_MouseMove"_ustr, ooMouseEvtToVBAMouseEvt, DenyMouseDrag, nullptr } }, // keyPressed ooo event - { OUString("keyPressed"), { OUString("_KeyDown"), ooKeyPressedToVBAKeyUpDown, ApproveAll, nullptr } }, - { OUString("keyPressed"), { OUString("_KeyPress"), ooKeyPressedToVBAKeyPressed, ApproveAll, nullptr } } + { u"keyPressed"_ustr, { u"_KeyDown"_ustr, ooKeyPressedToVBAKeyUpDown, ApproveAll, nullptr } }, + { u"keyPressed"_ustr, { u"_KeyPress"_ustr, ooKeyPressedToVBAKeyPressed, ApproveAll, nullptr } } }; static EventInfoHash& getEventTransInfo() @@ -432,18 +432,18 @@ public: virtual void SAL_CALL insertByName( const OUString&, const Any& ) override { - throw RuntimeException("ReadOnly container" ); + throw RuntimeException(u"ReadOnly container"_ustr ); } virtual void SAL_CALL removeByName( const OUString& ) override { - throw RuntimeException("ReadOnly container" ); + throw RuntimeException(u"ReadOnly container"_ustr ); } // XNameReplace virtual void SAL_CALL replaceByName( const OUString&, const Any& ) override { - throw RuntimeException("ReadOnly container" ); + throw RuntimeException(u"ReadOnly container"_ustr ); } @@ -580,7 +580,7 @@ public: OUString SAL_CALL getImplementationName() override { - return "ooo.vba.EventListener"; + return u"ooo.vba.EventListener"_ustr; } sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override @@ -784,7 +784,7 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) return; lang::EventObject aEvent; evt.Arguments[ 0 ] >>= aEvent; - OUString sName = "UserForm"; + OUString sName = u"UserForm"_ustr; uno::Reference< awt::XDialog > xDlg( aEvent.Source, uno::UNO_QUERY ); if ( !xDlg.is() ) @@ -811,7 +811,7 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) // Userform control ( fired from the api or from event manager ) uno::Reference< beans::XPropertySet > xProps; xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW ); - xProps->getPropertyValue("Name") >>= sName; + xProps->getPropertyValue(u"Name"_ustr) >>= sName; } } //dumpEvent( evt ); @@ -895,7 +895,7 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) OUString url = aMacroResolvedInfo.msResolvedMacro; try { - uno::Any aDummyCaller( OUString("Error") ); + uno::Any aDummyCaller( u"Error"_ustr ); if ( pRet ) { ooo::vba::executeMacro( mpShell, url, aArguments, *pRet, aDummyCaller ); @@ -928,7 +928,7 @@ public: OUString SAL_CALL getImplementationName() override { - return "ooo.vba.VBAToOOEventDesc"; + return u"ooo.vba.VBAToOOEventDesc"_ustr; } sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override |