diff options
-rw-r--r-- | basctl/source/basicide/scriptdocument.cxx | 15 | ||||
-rw-r--r-- | comphelper/source/misc/mediadescriptor.cxx | 9 | ||||
-rw-r--r-- | framework/inc/dispatch/popupmenudispatcher.hxx | 4 | ||||
-rw-r--r-- | framework/source/dispatch/popupmenudispatcher.cxx | 75 | ||||
-rw-r--r-- | scripting/source/basprov/basprov.cxx | 65 | ||||
-rw-r--r-- | scripting/source/dlgprov/dlgprov.cxx | 21 | ||||
-rw-r--r-- | scripting/source/protocolhandler/scripthandler.cxx | 19 | ||||
-rw-r--r-- | scripting/source/provider/MasterScriptProvider.cxx | 14 | ||||
-rw-r--r-- | scripting/source/provider/URIHelper.cxx | 7 | ||||
-rw-r--r-- | sfx2/source/appl/app.cxx | 36 | ||||
-rw-r--r-- | sfx2/source/doc/DocumentMetadataAccess.cxx | 11 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 45 | ||||
-rw-r--r-- | sw/source/core/fields/macrofld.cxx | 23 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldmgr.cxx | 22 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/databases.cxx | 17 | ||||
-rw-r--r-- | xmlhelp/source/treeview/tvread.cxx | 14 | ||||
-rw-r--r-- | xmloff/source/core/RDFaExportHelper.cxx | 10 | ||||
-rw-r--r-- | xmloff/source/transform/EventOASISTContext.cxx | 62 |
18 files changed, 198 insertions, 271 deletions
diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx index 0e1fa088ed43..3826f5a31783 100644 --- a/basctl/source/basicide/scriptdocument.cxx +++ b/basctl/source/basicide/scriptdocument.cxx @@ -25,7 +25,7 @@ #include "doceventnotifier.hxx" #include "documentenumeration.hxx" -#include <com/sun/star/uri/XUriReferenceFactory.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> #include <com/sun/star/util/XMacroExpander.hpp> #include <com/sun/star/document/MacroExecMode.hpp> #include <com/sun/star/frame/XStorable.hpp> @@ -88,6 +88,7 @@ namespace basctl using ::com::sun::star::uno::makeAny; using ::com::sun::star::script::XLibraryContainer2; using ::com::sun::star::lang::XMultiServiceFactory; + using ::com::sun::star::uri::UriReferenceFactory; using ::com::sun::star::uri::XUriReferenceFactory; using ::com::sun::star::uri::XUriReference; using ::com::sun::star::uno::XComponentContext; @@ -934,14 +935,8 @@ namespace basctl if ( !xLibContainer->hasByName( _rLibName ) || !xLibContainer->isLibraryLink( _rLibName ) ) return false; OUString aFileURL; - Reference< XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); - Reference< XUriReferenceFactory > xUriFac; - if ( xMSF.is() ) - { - xUriFac.set( - xMSF->createInstance( "com.sun.star.uri.UriReferenceFactory" ), - UNO_QUERY_THROW ); - } + Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + Reference< XUriReferenceFactory > xUriFac = UriReferenceFactory::create(xContext); OUString aLinkURL( xLibContainer->getLibraryLinkURL( _rLibName ) ); Reference< XUriReference > xUriRef( xUriFac->parse( aLinkURL ), UNO_QUERY_THROW ); @@ -958,8 +953,6 @@ namespace basctl { OUString aDecodedURL( aAuthority.copy( sizeof ( "vnd.sun.star.expand:" ) - 1 ) ); aDecodedURL = ::rtl::Uri::decode( aDecodedURL, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); - Reference< XComponentContext > xContext( - comphelper::getComponentContext( xMSF ) ); Reference< XMacroExpander > xMacroExpander( xContext->getValueByName( "/singletons/com.sun.star.util.theMacroExpander" ), diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx index dd91d9e716b5..84d3331da4ea 100644 --- a/comphelper/source/misc/mediadescriptor.cxx +++ b/comphelper/source/misc/mediadescriptor.cxx @@ -34,7 +34,7 @@ #include <com/sun/star/ucb/UnsupportedDataSinkException.hpp> #include <com/sun/star/ucb/CommandFailedException.hpp> #include <com/sun/star/task/XInteractionAbort.hpp> -#include <com/sun/star/uri/XUriReferenceFactory.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> #include <com/sun/star/uri/XUriReference.hpp> #include <com/sun/star/ucb/PostCommandArgument2.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -705,13 +705,12 @@ sal_Bool MediaDescriptor::impl_openStreamWithURL( const ::rtl::OUString& sURL, s it parses the URL in another way. It's main part isnt enough and it's complete part contains the jumpmark (fragment) parameter ... */ - static ::rtl::OUString SERVICENAME_URIREFERENCEFACTORY( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.uri.UriReferenceFactory" )); try { - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - css::uno::Reference< css::uri::XUriReferenceFactory > xUriFactory(xSMGR->createInstance(SERVICENAME_URIREFERENCEFACTORY), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::uri::XUriReference > xUriRef = xUriFactory->parse(sURL); + css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + css::uno::Reference< css::uri::XUriReferenceFactory > xUriFactory = css::uri::UriReferenceFactory::create(xContext);; + css::uno::Reference< css::uri::XUriReference > xUriRef = xUriFactory->parse(sURL); if (xUriRef.is()) { xUriRef->clearFragment(); diff --git a/framework/inc/dispatch/popupmenudispatcher.hxx b/framework/inc/dispatch/popupmenudispatcher.hxx index b534a0797d13..f1ee756e09cc 100644 --- a/framework/inc/dispatch/popupmenudispatcher.hxx +++ b/framework/inc/dispatch/popupmenudispatcher.hxx @@ -94,7 +94,7 @@ class PopupMenuDispatcher : // interfaces public: // constructor / destructor - PopupMenuDispatcher( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + PopupMenuDispatcher( const css::uno::Reference< css::uno::XComponentContext >& xContext ); // XInterface, XTypeProvider, XServiceInfo FWK_DECLARE_XINTERFACE @@ -146,7 +146,7 @@ class PopupMenuDispatcher : // interfaces css::uno::WeakReference< css::frame::XFrame > m_xWeakFrame ; /// css::uno::WeakReference to frame (Don't use a hard css::uno::Reference. Owner can't delete us then!) css::uno::Reference< css::container::XNameAccess > m_xPopupCtrlQuery ; /// reference to query for popup controller css::uno::Reference< css::uri::XUriReferenceFactory > m_xUriRefFactory ; /// reference to the uri reference factory - css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// factory shared with our owner to create new services! + css::uno::Reference< css::uno::XComponentContext > m_xContext ; /// factory shared with our owner to create new services! IMPL_ListenerHashContainer m_aListenerContainer; /// hash table for listener at specified URLs sal_Bool m_bAlreadyDisposed ; /// Protection against multiple disposing calls. sal_Bool m_bActivateListener ; /// dispatcher is listener for frame activation diff --git a/framework/source/dispatch/popupmenudispatcher.cxx b/framework/source/dispatch/popupmenudispatcher.cxx index 9e7b210900fc..c13e80f47c7d 100644 --- a/framework/source/dispatch/popupmenudispatcher.cxx +++ b/framework/source/dispatch/popupmenudispatcher.cxx @@ -43,7 +43,9 @@ #include <com/sun/star/lang/WrappedTargetException.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> +#include <comphelper/componentcontext.hxx> #include <ucbhelper/content.hxx> #include <osl/mutex.hxx> #include <rtl/ustrbuf.hxx> @@ -70,12 +72,12 @@ const sal_Int32 PROTOCOL_LENGTH = 19; // constructor //***************************************************************************************************************** PopupMenuDispatcher::PopupMenuDispatcher( - const uno::Reference< XMultiServiceFactory >& xFactory ) + const uno::Reference< XComponentContext >& xContext ) // Init baseclasses first : ThreadHelpBase ( &Application::GetSolarMutex() ) , OWeakObject ( ) // Init member - , m_xFactory ( xFactory ) + , m_xContext ( xContext ) , m_aListenerContainer ( m_aLock.getShareableOslMutex() ) , m_bAlreadyDisposed ( sal_False ) , m_bActivateListener ( sal_False ) @@ -116,10 +118,61 @@ DEFINE_XTYPEPROVIDER_7 ( PopupMenuDispatcher , XFrameActionListener ) -DEFINE_XSERVICEINFO_MULTISERVICE( PopupMenuDispatcher , - ::cppu::OWeakObject , - SERVICENAME_PROTOCOLHANDLER , - IMPLEMENTATIONNAME_POPUPMENUDISPATCHER ) +::rtl::OUString SAL_CALL PopupMenuDispatcher::getImplementationName() throw( css::uno::RuntimeException ) +{ + return impl_getStaticImplementationName(); +} + +sal_Bool SAL_CALL PopupMenuDispatcher::supportsService( const ::rtl::OUString& sServiceName ) + throw( css::uno::RuntimeException ) +{ + return ::comphelper::findValue(getSupportedServiceNames(), sServiceName, sal_True).getLength() != 0; +} + +css::uno::Sequence< ::rtl::OUString > SAL_CALL PopupMenuDispatcher::getSupportedServiceNames() + throw( css::uno::RuntimeException ) +{ + return impl_getStaticSupportedServiceNames(); +} + +css::uno::Sequence< ::rtl::OUString > PopupMenuDispatcher::impl_getStaticSupportedServiceNames() +{ + css::uno::Sequence< ::rtl::OUString > seqServiceNames( 1 ); + seqServiceNames.getArray() [0] = SERVICENAME_PROTOCOLHANDLER; + return seqServiceNames; +} + +::rtl::OUString PopupMenuDispatcher::impl_getStaticImplementationName() +{ + return IMPLEMENTATIONNAME_POPUPMENUDISPATCHER; +} + +css::uno::Reference< css::uno::XInterface > +SAL_CALL PopupMenuDispatcher::impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) +throw( css::uno::Exception ) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework","Ocke.Janssen@sun.com",U2B(IMPLEMENTATIONNAME_POPUPMENUDISPATCHER).getStr()); + /* create new instance of service */ + PopupMenuDispatcher* pClass = new PopupMenuDispatcher( comphelper::getComponentContext(xServiceManager) ); + /* hold it alive by increasing his ref count!!! */ + css::uno::Reference< css::uno::XInterface > xService( static_cast< ::cppu::OWeakObject* >(pClass), css::uno::UNO_QUERY ); + /* initialize new service instance ... he can use his own refcount ... we hold it! */ + pClass->impl_initService(); + /* return new created service as reference */ + return xService; +} + +css::uno::Reference< css::lang::XSingleServiceFactory > +PopupMenuDispatcher::impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) +{ + css::uno::Reference< css::lang::XSingleServiceFactory > xReturn ( + cppu::createSingleFactory ( xServiceManager, + PopupMenuDispatcher::impl_getStaticImplementationName() , + PopupMenuDispatcher::impl_createInstance , + PopupMenuDispatcher::impl_getStaticSupportedServiceNames() ) + ); + return xReturn; +} DEFINE_INIT_SERVICE(PopupMenuDispatcher, { @@ -333,7 +386,7 @@ SAL_CALL PopupMenuDispatcher::disposing( const EventObject& ) throw( RuntimeExce } // Forget our factory. - m_xFactory = uno::Reference< XMultiServiceFactory >(); + m_xContext = uno::Reference< XComponentContext >(); } } @@ -379,13 +432,7 @@ void PopupMenuDispatcher::impl_CreateUriRefFactory() { if ( !m_xUriRefFactory.is() ) { - rtl::OUString aUriRefFactoryService( - RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.uri.UriReferenceFactory" )); - - m_xUriRefFactory = css::uno::Reference< css::uri::XUriReferenceFactory >( - m_xFactory->createInstance( aUriRefFactoryService ), - css::uno::UNO_QUERY); - + m_xUriRefFactory = css::uri::UriReferenceFactory::create( m_xContext ); } } diff --git a/scripting/source/basprov/basprov.cxx b/scripting/source/basprov/basprov.cxx index bf4a449e1a13..750394524161 100644 --- a/scripting/source/basprov/basprov.cxx +++ b/scripting/source/basprov/basprov.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/script/browse/BrowseNodeTypes.hpp> #include <com/sun/star/script/provider/ScriptFrameworkErrorType.hpp> #include <com/sun/star/document/XEmbeddedScripts.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> #include <cppuhelper/implementationentry.hxx> #include <rtl/uri.hxx> @@ -135,40 +136,31 @@ namespace basprov ::rtl::OUString aFileURL; if ( m_xContext.is() ) { - Reference< uri::XUriReferenceFactory > xUriFac; - Reference< lang::XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() ); - if ( xSMgr.is() ) - { - xUriFac.set( xSMgr->createInstanceWithContext( ::rtl::OUString( - "com.sun.star.uri.UriReferenceFactory" ), m_xContext ), UNO_QUERY ); - } + Reference< uri::XUriReferenceFactory > xUriFac( uri::UriReferenceFactory::create( m_xContext ) ); - if ( xUriFac.is() ) - { - ::rtl::OUString aLinkURL( xLibContainer->getLibraryLinkURL( rLibName ) ); - Reference< uri::XUriReference > xUriRef( xUriFac->parse( aLinkURL ), UNO_QUERY ); + ::rtl::OUString aLinkURL( xLibContainer->getLibraryLinkURL( rLibName ) ); + Reference< uri::XUriReference > xUriRef( xUriFac->parse( aLinkURL ), UNO_QUERY ); - if ( xUriRef.is() ) + if ( xUriRef.is() ) + { + ::rtl::OUString aScheme = xUriRef->getScheme(); + if ( aScheme.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("file")) ) { - ::rtl::OUString aScheme = xUriRef->getScheme(); - if ( aScheme.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("file")) ) + aFileURL = aLinkURL; + } + else if ( aScheme.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.pkg")) ) + { + ::rtl::OUString aAuthority = xUriRef->getAuthority(); + if ( aAuthority.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.expand:" ) ) ) { - aFileURL = aLinkURL; - } - else if ( aScheme.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.pkg")) ) - { - ::rtl::OUString aAuthority = xUriRef->getAuthority(); - if ( aAuthority.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.expand:" ) ) ) - { - ::rtl::OUString aDecodedURL( aAuthority.copy( sizeof ( "vnd.sun.star.expand:" ) - 1 ) ); - aDecodedURL = ::rtl::Uri::decode( aDecodedURL, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); - Reference<util::XMacroExpander> xMacroExpander( - m_xContext->getValueByName( - ::rtl::OUString("/singletons/com.sun.star.util.theMacroExpander") ), - UNO_QUERY ); - if ( xMacroExpander.is() ) - aFileURL = xMacroExpander->expandMacros( aDecodedURL ); - } + ::rtl::OUString aDecodedURL( aAuthority.copy( sizeof ( "vnd.sun.star.expand:" ) - 1 ) ); + aDecodedURL = ::rtl::Uri::decode( aDecodedURL, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); + Reference<util::XMacroExpander> xMacroExpander( + m_xContext->getValueByName( + ::rtl::OUString("/singletons/com.sun.star.util.theMacroExpander") ), + UNO_QUERY ); + if ( xMacroExpander.is() ) + aFileURL = xMacroExpander->expandMacros( aDecodedURL ); } } } @@ -325,18 +317,7 @@ namespace basprov SolarMutexGuard aGuard; Reference< provider::XScript > xScript; - Reference< lang::XMultiComponentFactory > xMcFac ( m_xContext->getServiceManager() ); - Reference< uri::XUriReferenceFactory > xFac ( - xMcFac->createInstanceWithContext( rtl::OUString( - "com.sun.star.uri.UriReferenceFactory"), m_xContext ) , UNO_QUERY ); - - if ( !xFac.is() ) - { - throw provider::ScriptFrameworkErrorException( - OUSTR( "Failed to instantiate UriReferenceFactory" ), Reference< XInterface >(), - scriptURI, OUSTR("Basic"), - provider::ScriptFrameworkErrorType::UNKNOWN ); - } + Reference< uri::XUriReferenceFactory > xFac ( uri::UriReferenceFactory::create( m_xContext ) ); Reference< uri::XUriReference > uriRef( xFac->parse( scriptURI ), UNO_QUERY ); diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx index 2c55c323fa8e..e1703f47665c 100644 --- a/scripting/source/dlgprov/dlgprov.cxx +++ b/scripting/source/dlgprov/dlgprov.cxx @@ -44,7 +44,7 @@ #include <comphelper/namedvaluecollection.hxx> #include <com/sun/star/uri/XUriReference.hpp> -#include <com/sun/star/uri/XUriReferenceFactory.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> #include <com/sun/star/uri/XVndSunStarScriptUrl.hpp> #include <com/sun/star/uri/XVndSunStarExpandUrl.hpp> #include <com/sun/star/util/XMacroExpander.hpp> @@ -285,25 +285,8 @@ static ::rtl::OUString aResourceResolverPropName("ResourceResolver"); // parse URL // TODO: use URL parsing class // TODO: decoding of location - Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager(), UNO_QUERY ); - if ( !xSMgr.is() ) - { - throw RuntimeException( - ::rtl::OUString( "DialogProviderImpl::getDialogModel: Couldn't instantiate MultiComponent factory" ), - Reference< XInterface >() ); - } - - Reference< uri::XUriReferenceFactory > xFac ( - xSMgr->createInstanceWithContext( rtl::OUString( - "com.sun.star.uri.UriReferenceFactory"), m_xContext ) , UNO_QUERY ); - - if ( !xFac.is() ) - { - throw RuntimeException( - ::rtl::OUString("DialogProviderImpl::getDialogModel(), could not instatiate UriReferenceFactory."), - Reference< XInterface >() ); - } + Reference< uri::XUriReferenceFactory > xFac ( uri::UriReferenceFactory::create( m_xContext ) ); // i75778: Support non-script URLs Reference< io::XInputStream > xInput; diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx index 4151a56c4179..faa25bb3613e 100644 --- a/scripting/source/protocolhandler/scripthandler.cxx +++ b/scripting/source/protocolhandler/scripthandler.cxx @@ -49,7 +49,7 @@ #include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/uri/XUriReference.hpp" -#include "com/sun/star/uri/XUriReferenceFactory.hpp" +#include "com/sun/star/uri/UriReferenceFactory.hpp" #include "com/sun/star/uri/XVndSunStarScriptUrl.hpp" using namespace ::com::sun::star; @@ -102,19 +102,14 @@ Reference< XDispatch > SAL_CALL ScriptProtocolHandler::queryDispatch( Reference< XDispatch > xDispatcher; // get scheme of url - Reference< uri::XUriReferenceFactory > xFac ( - m_xFactory->createInstance( rtl::OUString( - "com.sun.star.uri.UriReferenceFactory") ) , UNO_QUERY ); - if ( xFac.is() ) + Reference< uri::XUriReferenceFactory > xFac = uri::UriReferenceFactory::create( comphelper::getComponentContext(m_xFactory) ); + Reference< uri::XUriReference > uriRef( + xFac->parse( aURL.Complete ), UNO_QUERY ); + if ( uriRef.is() ) { - Reference< uri::XUriReference > uriRef( - xFac->parse( aURL.Complete ), UNO_QUERY ); - if ( uriRef.is() ) + if ( uriRef->getScheme().equals( ::rtl::OUString::createFromAscii( ::scripting_protocolhandler::MYSCHEME ) ) ) { - if ( uriRef->getScheme().equals( ::rtl::OUString::createFromAscii( ::scripting_protocolhandler::MYSCHEME ) ) ) - { - xDispatcher = this; - } + xDispatcher = this; } } diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx index ff034699700d..4362330c7b6b 100644 --- a/scripting/source/provider/MasterScriptProvider.cxx +++ b/scripting/source/provider/MasterScriptProvider.cxx @@ -31,7 +31,7 @@ #include <com/sun/star/document/XScriptInvocationContext.hpp> #include <com/sun/star/uri/XUriReference.hpp> -#include <com/sun/star/uri/XUriReferenceFactory.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> #include <com/sun/star/uri/XVndSunStarScriptUrl.hpp> #include <com/sun/star/deployment/XPackage.hpp> @@ -259,17 +259,7 @@ throw ( provider::ScriptFrameworkErrorException, // need to get the language from the string - Reference< uri::XUriReferenceFactory > xFac ( - m_xMgr->createInstanceWithContext( rtl::OUString( - "com.sun.star.uri.UriReferenceFactory"), m_xContext ) , UNO_QUERY ); - if ( !xFac.is() ) - { - ::rtl::OUString message("Failed to instantiate UriReferenceFactory"); - throw provider::ScriptFrameworkErrorException( - message, Reference< XInterface >(), - scriptURI, ::rtl::OUString(), - provider::ScriptFrameworkErrorType::UNKNOWN ); - } + Reference< uri::XUriReferenceFactory > xFac ( uri::UriReferenceFactory::create( m_xContext ) ); Reference< uri::XUriReference > uriRef( xFac->parse( scriptURI ), UNO_QUERY ); diff --git a/scripting/source/provider/URIHelper.cxx b/scripting/source/provider/URIHelper.cxx index 7ef545fe6c2b..ec7ba77551ac 100644 --- a/scripting/source/provider/URIHelper.cxx +++ b/scripting/source/provider/URIHelper.cxx @@ -19,6 +19,7 @@ #include <com/sun/star/uri/XVndSunStarScriptUrl.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> #include <rtl/ustrbuf.hxx> #include "URIHelper.hxx" @@ -67,11 +68,7 @@ ScriptingFrameworkURIHelper::ScriptingFrameworkURIHelper( try { - m_xUriReferenceFactory = uno::Reference< uri::XUriReferenceFactory >( - xContext->getServiceManager()->createInstanceWithContext( - OUString( - "com.sun.star.uri.UriReferenceFactory"), - xContext ), uno::UNO_QUERY_THROW ); + m_xUriReferenceFactory = uri::UriReferenceFactory::create( xContext ); } catch (uno::Exception&) { diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index a4ffed8510e7..f5862426afe0 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -56,7 +56,7 @@ #include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <comphelper/processfactory.hxx> -#include <com/sun/star/uri/XUriReferenceFactory.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> #include <com/sun/star/uri/XVndSunStarScriptUrl.hpp> #include <basic/basmgr.hxx> #include <toolkit/helper/vclunohelper.hxx> @@ -527,35 +527,29 @@ sal_Bool SfxApplication::IsXScriptURL( const String& rScriptURL ) (void) rScriptURL; #else ::com::sun::star::uno::Reference - < ::com::sun::star::lang::XMultiServiceFactory > xSMgr = - ::comphelper::getProcessServiceFactory(); + < ::com::sun::star::uno::XComponentContext > xContext = + ::comphelper::getProcessComponentContext(); ::com::sun::star::uno::Reference < ::com::sun::star::uri::XUriReferenceFactory > - xFactory( xSMgr->createInstance( - ::rtl::OUString( - "com.sun.star.uri.UriReferenceFactory" ) ), - ::com::sun::star::uno::UNO_QUERY ); + xFactory = ::com::sun::star::uri::UriReferenceFactory::create( xContext ); - if ( xFactory.is() ) + try { - try - { - ::com::sun::star::uno::Reference - < ::com::sun::star::uri::XVndSunStarScriptUrl > - xUrl( xFactory->parse( rScriptURL ), - ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Reference + < ::com::sun::star::uri::XVndSunStarScriptUrl > + xUrl( xFactory->parse( rScriptURL ), + ::com::sun::star::uno::UNO_QUERY ); - if ( xUrl.is() ) - { - result = sal_True; - } - } - catch (const ::com::sun::star::uno::RuntimeException&) + if ( xUrl.is() ) { - // ignore, will just return FALSE + result = sal_True; } } + catch (const ::com::sun::star::uno::RuntimeException&) + { + // ignore, will just return FALSE + } #endif return result; } diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx index f2fbf52ae512..8ee9bfdc27b6 100644 --- a/sfx2/source/doc/DocumentMetadataAccess.cxx +++ b/sfx2/source/doc/DocumentMetadataAccess.cxx @@ -61,7 +61,7 @@ #include <unotools/ucbhelper.hxx> #include <com/sun/star/uri/XUriReference.hpp> -#include <com/sun/star/uri/XUriReferenceFactory.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> #include <com/sun/star/uri/XVndSunStarPkgUrlReferenceFactory.hpp> @@ -147,13 +147,8 @@ uno::Reference<rdf::XURI> createBaseURI( } } - const uno::Reference<lang::XMultiComponentFactory> xServiceFactory( - i_xContext->getServiceManager(), uno::UNO_SET_THROW); - const uno::Reference<uri::XUriReferenceFactory> xUriFactory( - xServiceFactory->createInstanceWithContext( - ::rtl::OUString( - "com.sun.star.uri.UriReferenceFactory"), i_xContext), - uno::UNO_QUERY_THROW); + const uno::Reference<uri::XUriReferenceFactory> xUriFactory = + uri::UriReferenceFactory::create( i_xContext); uno::Reference< uri::XUriReference > xBaseURI; const uno::Reference< uri::XUriReference > xPkgURI( diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index d9ed89314e47..09e1d55a63bd 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -56,7 +56,7 @@ #include <com/sun/star/frame/XDispatchRecorderSupplier.hpp> #include <com/sun/star/document/UpdateDocMode.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/uri/XUriReferenceFactory.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> #include <com/sun/star/uri/XVndSunStarScriptUrl.hpp> #include <com/sun/star/embed/XStorage.hpp> #include <com/sun/star/embed/EmbedStates.hpp> @@ -2620,29 +2620,26 @@ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const ::rtl::OUString& sMacro ) String aModuleName; String aMacroName; String aLocation; - Reference< XMultiServiceFactory > xSMgr = ::comphelper::getProcessServiceFactory(); - Reference< com::sun::star::uri::XUriReferenceFactory > xFactory( xSMgr->createInstance( - ::rtl::OUString("com.sun.star.uri.UriReferenceFactory") ), UNO_QUERY ); - if ( xFactory.is() ) - { - Reference< com::sun::star::uri::XVndSunStarScriptUrl > xUrl( xFactory->parse( aScriptURL ), UNO_QUERY ); - if ( xUrl.is() ) - { - // get name - ::rtl::OUString aName = xUrl->getName(); - sal_Unicode cTok = '.'; - sal_Int32 nIndex = 0; - aLibName = aName.getToken( 0, cTok, nIndex ); - if ( nIndex != -1 ) - aModuleName = aName.getToken( 0, cTok, nIndex ); - if ( nIndex != -1 ) - aMacroName = aName.getToken( 0, cTok, nIndex ); - - // get location - ::rtl::OUString aLocKey("location"); - if ( xUrl->hasParameter( aLocKey ) ) - aLocation = xUrl->getParameter( aLocKey ); - } + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + Reference< com::sun::star::uri::XUriReferenceFactory > xFactory = + com::sun::star::uri::UriReferenceFactory::create( xContext ); + Reference< com::sun::star::uri::XVndSunStarScriptUrl > xUrl( xFactory->parse( aScriptURL ), UNO_QUERY ); + if ( xUrl.is() ) + { + // get name + ::rtl::OUString aName = xUrl->getName(); + sal_Unicode cTok = '.'; + sal_Int32 nIndex = 0; + aLibName = aName.getToken( 0, cTok, nIndex ); + if ( nIndex != -1 ) + aModuleName = aName.getToken( 0, cTok, nIndex ); + if ( nIndex != -1 ) + aMacroName = aName.getToken( 0, cTok, nIndex ); + + // get location + ::rtl::OUString aLocKey("location"); + if ( xUrl->hasParameter( aLocKey ) ) + aLocation = xUrl->getParameter( aLocKey ); } BasicManager* pBasMgr = 0; diff --git a/sw/source/core/fields/macrofld.cxx b/sw/source/core/fields/macrofld.cxx index d8cd5356ab61..08140f7b9ac4 100644 --- a/sw/source/core/fields/macrofld.cxx +++ b/sw/source/core/fields/macrofld.cxx @@ -32,7 +32,7 @@ #include <docufld.hxx> #include <unofldmid.h> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/uri/XUriReferenceFactory.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> #include <com/sun/star/uri/XVndSunStarScriptUrl.hpp> #include <comphelper/processfactory.hxx> @@ -235,23 +235,18 @@ void SwMacroField::CreateMacroString( sal_Bool SwMacroField::isScriptURL( const String& str ) { - uno::Reference< lang::XMultiServiceFactory > xSMgr = - ::comphelper::getProcessServiceFactory(); + uno::Reference< uno::XComponentContext > xContext = + ::comphelper::getProcessComponentContext(); uno::Reference< uri::XUriReferenceFactory > - xFactory( xSMgr->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.uri.UriReferenceFactory")) ), uno::UNO_QUERY ); + xFactory = uri::UriReferenceFactory::create( xContext ); - if ( xFactory.is() ) - { - uno::Reference< uri::XVndSunStarScriptUrl > - xUrl( xFactory->parse( str ), uno::UNO_QUERY ); + uno::Reference< uri::XVndSunStarScriptUrl > + xUrl( xFactory->parse( str ), uno::UNO_QUERY ); - if ( xUrl.is() ) - { - return sal_True; - } + if ( xUrl.is() ) + { + return sal_True; } return sal_False; } diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx index 3312a6a7b7bb..bd5df73d0ecf 100644 --- a/sw/source/ui/fldui/fldmgr.cxx +++ b/sw/source/ui/fldui/fldmgr.cxx @@ -39,7 +39,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/sdbc/XConnection.hpp> #include <com/sun/star/sdbc/XDataSource.hpp> -#include <com/sun/star/uri/XUriReferenceFactory.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> #include <com/sun/star/uri/XVndSunStarScriptUrl.hpp> #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> @@ -1695,22 +1695,18 @@ void SwFldMgr::SetMacroPath(const String& rPath) // try to set sMacroName member variable by parsing the macro path // using the new URI parsing services - Reference< XMultiServiceFactory > xSMgr = - ::comphelper::getProcessServiceFactory(); + Reference< XComponentContext > xContext = + ::comphelper::getProcessComponentContext(); Reference< uri::XUriReferenceFactory > - xFactory( xSMgr->createInstance( - ::rtl::OUString( "com.sun.star.uri.UriReferenceFactory" ) ), UNO_QUERY ); + xFactory = uri::UriReferenceFactory::create( xContext ); - if ( xFactory.is() ) - { - Reference< uri::XVndSunStarScriptUrl > - xUrl( xFactory->parse( sMacroPath ), UNO_QUERY ); + Reference< uri::XVndSunStarScriptUrl > + xUrl( xFactory->parse( sMacroPath ), UNO_QUERY ); - if ( xUrl.is() ) - { - sMacroName = xUrl->getName(); - } + if ( xUrl.is() ) + { + sMacroName = xUrl->getName(); } } diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 8537685ae278..342923d341f9 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -53,7 +53,7 @@ #include <com/sun/star/frame/XConfigManager.hpp> #include <com/sun/star/ucb/SimpleFileAccess.hpp> #include <com/sun/star/util/XMacroExpander.hpp> -#include <com/sun/star/uri/XUriReferenceFactory.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> #include <com/sun/star/uri/XVndSunStarExpandUrl.hpp> #include <com/sun/star/script/XInvocation.hpp> #include <comphelper/locale.hxx> @@ -94,22 +94,9 @@ rtl::OUString Databases::expandURL( const rtl::OUString& aURL, Reference< uno::X static Reference< util::XMacroExpander > xMacroExpander; static Reference< uri::XUriReferenceFactory > xFac; - if( !xContext.is() ) - return rtl::OUString(); - if( !xMacroExpander.is() || !xFac.is() ) { - Reference< XMultiComponentFactory > xSMgr( xContext->getServiceManager(), UNO_QUERY ); - - xFac = Reference< uri::XUriReferenceFactory >( - xSMgr->createInstanceWithContext( rtl::OUString( - "com.sun.star.uri.UriReferenceFactory"), xContext ) , UNO_QUERY ); - if( !xFac.is() ) - { - throw RuntimeException( - ::rtl::OUString( "Databases::expand(), could not instatiate UriReferenceFactory." ), - Reference< XInterface >() ); - } + xFac = uri::UriReferenceFactory::create( xContext ); xMacroExpander = Reference< util::XMacroExpander >( xContext->getValueByName( diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index 387ba141d436..52d1e4abacc5 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -40,7 +40,7 @@ #include <comphelper/processfactory.hxx> #include "com/sun/star/deployment/thePackageManagerFactory.hpp" #include <com/sun/star/util/XMacroExpander.hpp> -#include <com/sun/star/uri/XUriReferenceFactory.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> #include <com/sun/star/uri/XVndSunStarExpandUrl.hpp> #include <comphelper/locale.hxx> #include <comphelper/string.hxx> @@ -1292,17 +1292,7 @@ rtl::OUString TreeFileIterator::expandURL( const rtl::OUString& aURL ) if( !xMacroExpander.is() || !xFac.is() ) { - Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager(), UNO_QUERY ); - - xFac = Reference< uri::XUriReferenceFactory >( - xSMgr->createInstanceWithContext( rtl::OUString( - "com.sun.star.uri.UriReferenceFactory"), m_xContext ) , UNO_QUERY ); - if( !xFac.is() ) - { - throw RuntimeException( - ::rtl::OUString( "Databases::expand(), could not instatiate UriReferenceFactory." ), - Reference< XInterface >() ); - } + xFac = uri::UriReferenceFactory::create( m_xContext ); xMacroExpander = Reference< util::XMacroExpander >( m_xContext->getValueByName( diff --git a/xmloff/source/core/RDFaExportHelper.cxx b/xmloff/source/core/RDFaExportHelper.cxx index 4a9d39ba15ec..e74cdaff3516 100644 --- a/xmloff/source/core/RDFaExportHelper.cxx +++ b/xmloff/source/core/RDFaExportHelper.cxx @@ -38,7 +38,7 @@ #include <comphelper/stl_types.hxx> #include <com/sun/star/uri/XUriReference.hpp> -#include <com/sun/star/uri/XUriReferenceFactory.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> #include <com/sun/star/rdf/Statement.hpp> #include <com/sun/star/rdf/URIs.hpp> #include <com/sun/star/rdf/URI.hpp> @@ -99,12 +99,8 @@ getRelativeReference(SvXMLExport const& rExport, ::rtl::OUString const& rURI) uno::Reference<uno::XComponentContext> const xContext( rExport.GetComponentContext()); - uno::Reference<lang::XMultiComponentFactory> const xServiceFactory( - xContext->getServiceManager(), uno::UNO_SET_THROW); - uno::Reference<uri::XUriReferenceFactory> const xUriFactory( - xServiceFactory->createInstanceWithContext( - ::rtl::OUString( "com.sun.star.uri.UriReferenceFactory"), xContext), - uno::UNO_QUERY_THROW); + uno::Reference<uri::XUriReferenceFactory> const xUriFactory = + uri::UriReferenceFactory::create( xContext ); uno::Reference< uri::XUriReference > const xBaseURI( xUriFactory->parse(baseURI), uno::UNO_SET_THROW ); diff --git a/xmloff/source/transform/EventOASISTContext.cxx b/xmloff/source/transform/EventOASISTContext.cxx index 07b9487756a0..dc68e1881178 100644 --- a/xmloff/source/transform/EventOASISTContext.cxx +++ b/xmloff/source/transform/EventOASISTContext.cxx @@ -37,7 +37,7 @@ #ifndef OASIS_FILTER_OOO_1X // Used to parse Scripting Framework URLs -#include <com/sun/star/uri/XUriReferenceFactory.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> #include <com/sun/star/uri/XVndSunStarScriptUrl.hpp> #include <comphelper/processfactory.hxx> #endif @@ -197,52 +197,44 @@ bool ParseURL( #ifdef OASIS_FILTER_OOO_1X return ParseURLAsString( rAttrValue, pName, pLocation ); #else - Reference< com::sun::star::lang::XMultiServiceFactory > - xSMgr = ::comphelper::getProcessServiceFactory(); + Reference< com::sun::star::uno::XComponentContext > + xContext = ::comphelper::getProcessComponentContext(); - Reference< com::sun::star::uri::XUriReferenceFactory > - xFactory( xSMgr->createInstance( OUString( - "com.sun.star.uri.UriReferenceFactory" ) ), UNO_QUERY ); + Reference< com::sun::star::uri::XUriReferenceFactory > xFactory = + com::sun::star::uri::UriReferenceFactory::create(xContext); - if ( xFactory.is() ) - { - Reference< com::sun::star::uri::XVndSunStarScriptUrl > xUrl ( - xFactory->parse( rAttrValue ), UNO_QUERY ); + Reference< com::sun::star::uri::XVndSunStarScriptUrl > xUrl ( + xFactory->parse( rAttrValue ), UNO_QUERY ); - if ( xUrl.is() ) + if ( xUrl.is() ) + { + OUString aLanguageKey = GetXMLToken( XML_LANGUAGE ); + if ( xUrl.is() && xUrl->hasParameter( aLanguageKey ) ) { - OUString aLanguageKey = GetXMLToken( XML_LANGUAGE ); - if ( xUrl.is() && xUrl->hasParameter( aLanguageKey ) ) - { - OUString aLanguage = xUrl->getParameter( aLanguageKey ); + OUString aLanguage = xUrl->getParameter( aLanguageKey ); - if ( aLanguage.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("basic")) ) - { - *pName = xUrl->getName(); + if ( aLanguage.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("basic")) ) + { + *pName = xUrl->getName(); - OUString tmp = - xUrl->getParameter( GetXMLToken( XML_LOCATION ) ); + OUString tmp = + xUrl->getParameter( GetXMLToken( XML_LOCATION ) ); - OUString doc = GetXMLToken( XML_DOCUMENT ); + OUString doc = GetXMLToken( XML_DOCUMENT ); - if ( tmp.equalsIgnoreAsciiCase( doc ) ) - { - *pLocation = doc; - } - else - { - *pLocation = GetXMLToken( XML_APPLICATION ); - } - return sal_True; + if ( tmp.equalsIgnoreAsciiCase( doc ) ) + { + *pLocation = doc; } + else + { + *pLocation = GetXMLToken( XML_APPLICATION ); + } + return sal_True; } } - return sal_False; - } - else - { - return ParseURLAsString( rAttrValue, pName, pLocation ); } + return sal_False; #endif } |