diff options
author | Noel Grandin <noel@peralex.com> | 2013-01-10 14:20:08 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-01-28 08:25:23 +0200 |
commit | b772eb0c728a06bdf72866ef61f800bbf7ec15a9 (patch) | |
tree | 1f4df1da4aa6ba30b3980c0bf60af2407270dca6 | |
parent | 83235caca899ba8088a24b8713ba49f52e4ba8ec (diff) |
fdo#46808, Adapt document::FilterConfigRefresh UNO service to new style
The service already existed, it just did not have an IDL file
Change-Id: I6894a3435159d9f529f2036354e70ee6358fc778
18 files changed, 108 insertions, 88 deletions
diff --git a/filter/source/config/cache/basecontainer.cxx b/filter/source/config/cache/basecontainer.cxx index e829d572a60a..4caefb0ca5c1 100644 --- a/filter/source/config/cache/basecontainer.cxx +++ b/filter/source/config/cache/basecontainer.cxx @@ -22,6 +22,7 @@ #include "constant.hxx" #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> +#include <com/sun/star/document/FilterConfigRefresh.hpp> #include <com/sun/star/uno/Type.h> #include <comphelper/enumhelper.hxx> #include <osl/diagnose.h> @@ -65,7 +66,7 @@ BaseContainer::~BaseContainer() -void BaseContainer::init(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , +void BaseContainer::init(const css::uno::Reference< css::uno::XComponentContext >& rxContext , const ::rtl::OUString& sImplementationName, const css::uno::Sequence< ::rtl::OUString >& lServiceNames , FilterCache::EItemType eType ) @@ -75,11 +76,8 @@ void BaseContainer::init(const css::uno::Reference< css::lang::XMultiServiceFact m_sImplementationName = sImplementationName; m_lServiceNames = lServiceNames ; - m_xSMGR = xSMGR ; m_eType = eType ; - m_xRefreshBroadcaster = css::uno::Reference< css::util::XRefreshable >( - xSMGR->createInstance(SERVICE_FILTERCONFIGREFRESH), - css::uno::UNO_QUERY); + m_xRefreshBroadcaster = css::document::FilterConfigRefresh::create(rxContext); // <- SAFE } diff --git a/filter/source/config/cache/basecontainer.hxx b/filter/source/config/cache/basecontainer.hxx index 19000c80895d..61fb4e90c861 100644 --- a/filter/source/config/cache/basecontainer.hxx +++ b/filter/source/config/cache/basecontainer.hxx @@ -23,7 +23,7 @@ #include <com/sun/star/uno/Exception.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/util/XRefreshable.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XContainerQuery.hpp> #include <com/sun/star/util/XFlushable.hpp> @@ -64,10 +64,6 @@ class BaseContainer : public BaseLock protected: - /** @short reference to an uno service manager, which can be used - to create own needed services. */ - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; - // TODO css::uno::WeakReference< css::util::XRefreshable > m_xRefreshBroadcaster; @@ -144,7 +140,7 @@ class BaseContainer : public BaseLock by this special method. Of course this method must be called first before any other interface method is used. - @param xSMGR + @param rxContext reference to the uno service manager, which created this service instance. @param sImplementationName @@ -159,7 +155,7 @@ class BaseContainer : public BaseLock specify, which sub container of the used filter cache must be wrapped by this container interface. */ - virtual void init(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + virtual void init(const css::uno::Reference< css::uno::XComponentContext >& rxContext , const ::rtl::OUString& sImplementationName, const css::uno::Sequence< ::rtl::OUString >& lServiceNames , FilterCache::EItemType eType ); diff --git a/filter/source/config/cache/cacheupdatelistener.cxx b/filter/source/config/cache/cacheupdatelistener.cxx index 287b07646d18..0455c88259d3 100644 --- a/filter/source/config/cache/cacheupdatelistener.cxx +++ b/filter/source/config/cache/cacheupdatelistener.cxx @@ -23,20 +23,20 @@ #include <com/sun/star/util/XChangesNotifier.hpp> #include <com/sun/star/util/XRefreshable.hpp> +#include <com/sun/star/document/FilterConfigRefresh.hpp> #include <salhelper/singletonref.hxx> #include <unotools/configpaths.hxx> #include <rtl/ustring.hxx> +#include <comphelper/processfactory.hxx> namespace filter{ namespace config{ -CacheUpdateListener::CacheUpdateListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR, - FilterCache &rFilterCache, +CacheUpdateListener::CacheUpdateListener(FilterCache &rFilterCache, const css::uno::Reference< css::uno::XInterface >& xConfigAccess, FilterCache::EItemType eConfigType) : BaseLock() - , m_xSMGR(xSMGR) , m_rCache(rFilterCache) , m_xConfig(xConfigAccess) , m_eConfigType(eConfigType) @@ -91,8 +91,7 @@ void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEven if ( ! m_xConfig.is()) return; - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; - FilterCache::EItemType eType = m_eConfigType; + FilterCache::EItemType eType = m_eConfigType; aLock.clear(); // <- SAFE @@ -173,11 +172,10 @@ void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEven // notify sfx cache about the changed filter cache .-) if (bNotifyRefresh) { - css::uno::Reference< css::util::XRefreshable > xRefreshBroadcaster( - xSMGR->createInstance(SERVICE_FILTERCONFIGREFRESH), - css::uno::UNO_QUERY); - if (xRefreshBroadcaster.is()) - xRefreshBroadcaster->refresh(); + css::uno::Reference< css::uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + css::uno::Reference< css::util::XRefreshable > xRefreshBroadcaster = + css::document::FilterConfigRefresh::create(xContext); + xRefreshBroadcaster->refresh(); } } diff --git a/filter/source/config/cache/cacheupdatelistener.hxx b/filter/source/config/cache/cacheupdatelistener.hxx index b103406c97a9..35fcb4d25565 100644 --- a/filter/source/config/cache/cacheupdatelistener.hxx +++ b/filter/source/config/cache/cacheupdatelistener.hxx @@ -20,7 +20,6 @@ #define __FILTER_CONFIG_CACHEUPDATELISTENER_HXX_ #include "filtercache.hxx" -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/util/XChangesListener.hpp> #include <salhelper/singletonref.hxx> @@ -45,10 +44,6 @@ class CacheUpdateListener : public BaseLock // must be the first one to guarante private: - /** @short reference to an uno service manager, which can be used - to create own needed services. */ - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; - /** @short reference to the singleton(!) filter cache implementation, which should be updated by this thread. */ FilterCache &m_rCache; @@ -77,18 +72,13 @@ class CacheUpdateListener : public BaseLock // must be the first one to guarante @see startListening() - @param xSMGR - reference to a service manager, which can be used to create - own needed uno services. - @param xConfigAccess the configuration access, where this instance should listen for changes. @param eConfigType specify the type of configuration. */ - CacheUpdateListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR, - FilterCache &rFilterCache, + CacheUpdateListener(FilterCache &rFilterCache, const css::uno::Reference< css::uno::XInterface >& xConfigAccess, FilterCache::EItemType eConfigType); diff --git a/filter/source/config/cache/configflush.cxx b/filter/source/config/cache/configflush.cxx index a6371f025663..8f5a441f9dfe 100644 --- a/filter/source/config/cache/configflush.cxx +++ b/filter/source/config/cache/configflush.cxx @@ -134,7 +134,7 @@ void SAL_CALL ConfigFlush::removeRefreshListener(const css::uno::Reference< css: css::uno::Sequence< ::rtl::OUString > ConfigFlush::impl_getSupportedServiceNames() { css::uno::Sequence< ::rtl::OUString > lServiceNames(1); - lServiceNames[0] = SERVICE_FILTERCONFIGREFRESH; + lServiceNames[0] = "com.sun.star.document.FilterConfigRefresh"; return lServiceNames; } diff --git a/filter/source/config/cache/constant.hxx b/filter/source/config/cache/constant.hxx index 07762dc35c4e..3e5692f1c06a 100644 --- a/filter/source/config/cache/constant.hxx +++ b/filter/source/config/cache/constant.hxx @@ -159,7 +159,6 @@ */ #define SERVICE_CONFIGURATIONUPDATEACCESS _FILTER_CONFIG_FROM_ASCII_("com.sun.star.configuration.ConfigurationUpdateAccess" ) #define SERVICE_CONFIGURATIONACCESS _FILTER_CONFIG_FROM_ASCII_("com.sun.star.configuration.ConfigurationAccess" ) -#define SERVICE_FILTERCONFIGREFRESH _FILTER_CONFIG_FROM_ASCII_("com.sun.star.document.FilterConfigRefresh" ) /** @short some configuration paths. */ diff --git a/filter/source/config/cache/contenthandlerfactory.cxx b/filter/source/config/cache/contenthandlerfactory.cxx index 6916c9d33be4..4c7ccfa5e918 100644 --- a/filter/source/config/cache/contenthandlerfactory.cxx +++ b/filter/source/config/cache/contenthandlerfactory.cxx @@ -26,14 +26,16 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <comphelper/enumhelper.hxx> +#include <comphelper/processfactory.hxx> namespace filter{ namespace config{ -ContentHandlerFactory::ContentHandlerFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) +ContentHandlerFactory::ContentHandlerFactory(const css::uno::Reference< css::uno::XComponentContext >& rxContext) + : m_xContext(rxContext) { - BaseContainer::init(xSMGR , + BaseContainer::init(rxContext , ContentHandlerFactory::impl_getImplementationName() , ContentHandlerFactory::impl_getSupportedServiceNames(), FilterCache::E_CONTENTHANDLER ); @@ -109,7 +111,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL ContentHandlerFactory::crea CacheItem aHandler = m_rCache->getItem(FilterCache::E_CONTENTHANDLER, sRealHandler); // create service instance - xHandler = m_xSMGR->createInstance(sRealHandler); + xHandler = m_xContext->getServiceManager()->createInstanceWithContext(sRealHandler, m_xContext); // initialize filter css::uno::Reference< css::lang::XInitialization > xInit(xHandler, css::uno::UNO_QUERY); @@ -164,7 +166,7 @@ css::uno::Sequence< OUString > ContentHandlerFactory::impl_getSupportedServiceNa css::uno::Reference< css::uno::XInterface > SAL_CALL ContentHandlerFactory::impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) { - ContentHandlerFactory* pNew = new ContentHandlerFactory(xSMGR); + ContentHandlerFactory* pNew = new ContentHandlerFactory( comphelper::getComponentContext(xSMGR) ); return css::uno::Reference< css::uno::XInterface >(static_cast< css::lang::XMultiServiceFactory* >(pNew), css::uno::UNO_QUERY); } diff --git a/filter/source/config/cache/contenthandlerfactory.hxx b/filter/source/config/cache/contenthandlerfactory.hxx index 1db718e12064..936b9dcb9db8 100644 --- a/filter/source/config/cache/contenthandlerfactory.hxx +++ b/filter/source/config/cache/contenthandlerfactory.hxx @@ -40,6 +40,8 @@ class ContentHandlerFactory : public ::cppu::ImplInheritanceHelper1< BaseContain //------------------------------------------- // native interface + css::uno::Reference< css::uno::XComponentContext > m_xContext; + public: //--------------------------------------- @@ -48,10 +50,10 @@ class ContentHandlerFactory : public ::cppu::ImplInheritanceHelper1< BaseContain /** @short standard ctor to connect this interface wrapper to the global filter cache instance ... - @param xSMGR + @param rxContext reference to the uno service manager, which created this service instance. */ - ContentHandlerFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + ContentHandlerFactory(const css::uno::Reference< css::uno::XComponentContext >& rxContext); //--------------------------------------- diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx index 19aba9281b6a..7ae937763ae7 100644 --- a/filter/source/config/cache/filtercache.cxx +++ b/filter/source/config/cache/filtercache.cxx @@ -58,7 +58,6 @@ namespace filter{ FilterCache::FilterCache() : BaseLock ( ) - , m_xSMGR (::comphelper::getProcessServiceFactory()) , m_eFillState(E_CONTAINS_NOTHING ) { RTL_LOGFILE_TRACE("{ (as96863) FilterCache lifetime"); @@ -88,8 +87,6 @@ FilterCache* FilterCache::clone() const // They will be created on demand inside the cloned instance, // if they are needed. - pClone->m_xSMGR = m_xSMGR; - pClone->m_lTypes = m_lTypes; pClone->m_lDetectServices = m_lDetectServices; pClone->m_lFilters = m_lFilters; @@ -238,7 +235,7 @@ void FilterCache::load(EFillState eRequired, // and starts a thread, which calls loadAll() at this filter cache. // Note: Its not a leak to create this listener with new here. // It kills itself after working! - /* LateInitListener* pLateInit = */ new LateInitListener(comphelper::getComponentContext(m_xSMGR)); + /* LateInitListener* pLateInit = */ new LateInitListener(comphelper::getProcessComponentContext()); } // ------------------------------------------ @@ -875,13 +872,13 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfig { case E_PROVIDER_TYPES: { - m_xTypesChglisteners.set(new CacheUpdateListener(m_xSMGR, *this, *pConfig, FilterCache::E_TYPE)); + m_xTypesChglisteners.set(new CacheUpdateListener(*this, *pConfig, FilterCache::E_TYPE)); m_xTypesChglisteners->startListening(); } break; case E_PROVIDER_FILTERS: { - m_xFiltersChgListener.set(new CacheUpdateListener(m_xSMGR, *this, *pConfig, FilterCache::E_FILTER)); + m_xFiltersChgListener.set(new CacheUpdateListener(*this, *pConfig, FilterCache::E_FILTER)); m_xFiltersChgListener->startListening(); } break; @@ -952,8 +949,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_createConfigAccess try { css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider( - css::configuration::theDefaultProvider::get( - comphelper::getComponentContext(m_xSMGR))); + css::configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() ) ); ::comphelper::SequenceAsVector< css::uno::Any > lParams; css::beans::NamedValue aParam; @@ -2460,7 +2456,7 @@ sal_Bool FilterCache::impl_isModuleInstalled(const ::rtl::OUString& sModule) { m_xModuleCfg = css::uno::Reference< css::container::XNameAccess >( ::comphelper::ConfigurationHelper::openConfig( - comphelper::getComponentContext(m_xSMGR), + comphelper::getProcessComponentContext(), "org.openoffice.Setup/Office/Factories", ::comphelper::ConfigurationHelper::E_READONLY), css::uno::UNO_QUERY_THROW); diff --git a/filter/source/config/cache/filtercache.hxx b/filter/source/config/cache/filtercache.hxx index dc83f9d49a0c..b72e1c6b23a1 100644 --- a/filter/source/config/cache/filtercache.hxx +++ b/filter/source/config/cache/filtercache.hxx @@ -23,7 +23,6 @@ #include "cacheitem.hxx" #include <com/sun/star/uno/Exception.hpp> #include <com/sun/star/util/URL.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/uno/XInterface.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> @@ -171,11 +170,6 @@ class FilterCache : public BaseLock private: //--------------------------------------- - /** @short reference to an uno service manager, which can be used - to create own needed services. */ - mutable css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; - - //--------------------------------------- /** @short holds the used configuration provider alive, which provides access to the list of types. */ mutable css::uno::Reference< css::uno::XInterface > m_xConfigTypes; diff --git a/filter/source/config/cache/filterfactory.cxx b/filter/source/config/cache/filterfactory.cxx index d4eed05328c7..d55b3c4ab64f 100644 --- a/filter/source/config/cache/filterfactory.cxx +++ b/filter/source/config/cache/filterfactory.cxx @@ -49,9 +49,10 @@ namespace filter{ case_sensitive compare "sort_prop" case sensitive false */ -FilterFactory::FilterFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) +FilterFactory::FilterFactory(const css::uno::Reference< css::uno::XComponentContext >& rxContext) + : m_xContext(rxContext) { - BaseContainer::init(xSMGR , + BaseContainer::init(rxContext , FilterFactory::impl_getImplementationName() , FilterFactory::impl_getSupportedServiceNames(), FilterCache::E_FILTER ); @@ -127,7 +128,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::createInstan // create service instance css::uno::Reference< css::uno::XInterface > xFilter; if (!sFilterService.isEmpty()) - xFilter = m_xSMGR->createInstance(sFilterService); + xFilter = m_xContext->getServiceManager()->createInstanceWithContext(sFilterService, m_xContext); // initialize filter css::uno::Reference< css::lang::XInitialization > xInit(xFilter, css::uno::UNO_QUERY); @@ -478,14 +479,14 @@ OUStringList FilterFactory::impl_getListOfInstalledModules() const { // SAFE -> ---------------------- ::osl::ResettableMutexGuard aLock(m_aLock); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aLock.clear(); // <- SAFE ---------------------- try { css::uno::Reference< css::container::XNameAccess > xModuleConfig( - ::comphelper::ConfigurationHelper::openConfig( comphelper::getComponentContext(xSMGR), + ::comphelper::ConfigurationHelper::openConfig( xContext, CFGPACKAGE_OOO_MODULES, ::comphelper::ConfigurationHelper::E_READONLY), css::uno::UNO_QUERY_THROW); @@ -561,14 +562,14 @@ OUStringList FilterFactory::impl_readSortedFilterListFromConfig(const ::rtl::OUS { // SAFE -> ---------------------- ::osl::ResettableMutexGuard aLock(m_aLock); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aLock.clear(); // <- SAFE ---------------------- try { css::uno::Reference< css::container::XNameAccess > xUISortConfig( - ::comphelper::ConfigurationHelper::openConfig( comphelper::getComponentContext(xSMGR), + ::comphelper::ConfigurationHelper::openConfig( xContext, CFGPACKAGE_TD_UISORT, ::comphelper::ConfigurationHelper::E_READONLY), css::uno::UNO_QUERY_THROW); @@ -614,7 +615,7 @@ css::uno::Sequence< ::rtl::OUString > FilterFactory::impl_getSupportedServiceNam css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) { - FilterFactory* pNew = new FilterFactory(xSMGR); + FilterFactory* pNew = new FilterFactory( comphelper::getComponentContext(xSMGR) ); return css::uno::Reference< css::uno::XInterface >(static_cast< css::lang::XMultiServiceFactory* >(pNew), css::uno::UNO_QUERY); } diff --git a/filter/source/config/cache/filterfactory.hxx b/filter/source/config/cache/filterfactory.hxx index 3010561257af..02ffc825a3f0 100644 --- a/filter/source/config/cache/filterfactory.hxx +++ b/filter/source/config/cache/filterfactory.hxx @@ -41,6 +41,8 @@ class FilterFactory : public ::cppu::ImplInheritanceHelper1< BaseContainer //------------------------------------------- // native interface + css::uno::Reference< css::uno::XComponentContext > m_xContext; + public: //--------------------------------------- @@ -49,10 +51,10 @@ class FilterFactory : public ::cppu::ImplInheritanceHelper1< BaseContainer /** @short standard ctor to connect this interface wrapper to the global filter cache instance ... - @param xSMGR + @param rxContext reference to the uno service manager, which created this service instance. */ - FilterFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + FilterFactory(const css::uno::Reference< css::uno::XComponentContext >& rxContext); //--------------------------------------- diff --git a/filter/source/config/cache/frameloaderfactory.cxx b/filter/source/config/cache/frameloaderfactory.cxx index c3344d9ff499..fa65dcc57b19 100644 --- a/filter/source/config/cache/frameloaderfactory.cxx +++ b/filter/source/config/cache/frameloaderfactory.cxx @@ -25,14 +25,16 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <comphelper/enumhelper.hxx> +#include <comphelper/processfactory.hxx> namespace filter{ namespace config{ -FrameLoaderFactory::FrameLoaderFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) +FrameLoaderFactory::FrameLoaderFactory(const css::uno::Reference< css::uno::XComponentContext >& rxContext) + : m_xContext(rxContext) { - BaseContainer::init(xSMGR , + BaseContainer::init(rxContext , FrameLoaderFactory::impl_getImplementationName() , FrameLoaderFactory::impl_getSupportedServiceNames(), FilterCache::E_FRAMELOADER ); @@ -106,7 +108,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FrameLoaderFactory::createI CacheItem aLoader = m_rCache->getItem(m_eType, sRealLoader); // create service instance - css::uno::Reference< css::uno::XInterface > xLoader = m_xSMGR->createInstance(sRealLoader); + css::uno::Reference< css::uno::XInterface > xLoader = m_xContext->getServiceManager()->createInstanceWithContext(sRealLoader, m_xContext); // initialize filter css::uno::Reference< css::lang::XInitialization > xInit(xLoader, css::uno::UNO_QUERY); @@ -161,7 +163,7 @@ css::uno::Sequence< OUString > FrameLoaderFactory::impl_getSupportedServiceNames css::uno::Reference< css::uno::XInterface > SAL_CALL FrameLoaderFactory::impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) { - FrameLoaderFactory* pNew = new FrameLoaderFactory(xSMGR); + FrameLoaderFactory* pNew = new FrameLoaderFactory( comphelper::getComponentContext(xSMGR) ); return css::uno::Reference< css::uno::XInterface >(static_cast< css::lang::XMultiServiceFactory* >(pNew), css::uno::UNO_QUERY); } diff --git a/filter/source/config/cache/frameloaderfactory.hxx b/filter/source/config/cache/frameloaderfactory.hxx index c361dc2e07f6..38acef126b62 100644 --- a/filter/source/config/cache/frameloaderfactory.hxx +++ b/filter/source/config/cache/frameloaderfactory.hxx @@ -40,6 +40,8 @@ class FrameLoaderFactory : public ::cppu::ImplInheritanceHelper1< BaseContainer //------------------------------------------- // native interface + css::uno::Reference< css::uno::XComponentContext > m_xContext; + public: //--------------------------------------- @@ -48,10 +50,10 @@ class FrameLoaderFactory : public ::cppu::ImplInheritanceHelper1< BaseContainer /** @short standard ctor to connect this interface wrapper to the global filter cache instance ... - @param xSMGR + @param rxContext reference to the uno service manager, which created this service instance. */ - FrameLoaderFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + FrameLoaderFactory(const css::uno::Reference< css::uno::XComponentContext >& rxContext); //--------------------------------------- diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx index ca19fe078c62..f3772e524101 100644 --- a/filter/source/config/cache/typedetection.cxx +++ b/filter/source/config/cache/typedetection.cxx @@ -38,9 +38,10 @@ namespace filter{ namespace config{ -TypeDetection::TypeDetection(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) +TypeDetection::TypeDetection(const css::uno::Reference< css::uno::XComponentContext >& rxContext) + : m_xContext(rxContext) { - BaseContainer::init(xSMGR , + BaseContainer::init(rxContext , TypeDetection::impl_getImplementationName() , TypeDetection::impl_getSupportedServiceNames(), FilterCache::E_TYPE ); @@ -64,7 +65,7 @@ TypeDetection::~TypeDetection() css::util::URL aURL; aURL.Complete = sURL; - css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(comphelper::getComponentContext(m_xSMGR))); + css::uno::Reference< css::util::XURLTransformer > xParser( css::util::URLTransformer::create(m_xContext) ); xParser->parseStrict(aURL); // set std types as minimum requirement first! @@ -248,7 +249,7 @@ struct EqualByName : public std::binary_function<FlatDetectionInfo, FlatDetectio css::util::URL aURL; aURL.Complete = sURL; - css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(comphelper::getComponentContext(m_xSMGR))); + css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(m_xContext)); xParser->parseStrict(aURL); rtl::OUString aSelectedFilter = stlDescriptor.getUnpackedValueOrDefault( @@ -1033,11 +1034,11 @@ void TypeDetection::impl_seekStreamToZero(comphelper::MediaDescriptor& rDescript impl_seekStreamToZero(rDescriptor); css::uno::Reference< css::document::XExtendedFilterDetection > xDetector; - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR; + css::uno::Reference< css::uno::XComponentContext > xContext; // SAFE -> ::osl::ResettableMutexGuard aLock(m_aLock); - xSMGR = m_xSMGR; + xContext = m_xContext; aLock.clear(); // <- SAFE @@ -1050,7 +1051,7 @@ void TypeDetection::impl_seekStreamToZero(comphelper::MediaDescriptor& rDescript // should handle errors during creation of such services more // gracefully .-) xDetector = css::uno::Reference< css::document::XExtendedFilterDetection >( - xSMGR->createInstance(sDetectService), + xContext->getServiceManager()->createInstanceWithContext(sDetectService, xContext), css::uno::UNO_QUERY_THROW); } catch (...) @@ -1107,12 +1108,6 @@ void TypeDetection::impl_seekStreamToZero(comphelper::MediaDescriptor& rDescript ::rtl::OUString TypeDetection::impl_askUserForTypeAndFilterIfAllowed(::comphelper::MediaDescriptor& rDescriptor) { - // SAFE -> - ::osl::ResettableMutexGuard aLock(m_aLock); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; - aLock.clear(); - // <- SAFE - css::uno::Reference< css::task::XInteractionHandler > xInteraction = rDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER(), css::uno::Reference< css::task::XInteractionHandler >()); @@ -1281,7 +1276,7 @@ css::uno::Sequence< OUString > TypeDetection::impl_getSupportedServiceNames() css::uno::Reference< css::uno::XInterface > SAL_CALL TypeDetection::impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) { - TypeDetection* pNew = new TypeDetection(xSMGR); + TypeDetection* pNew = new TypeDetection( comphelper::getComponentContext(xSMGR) ); return css::uno::Reference< css::uno::XInterface >(static_cast< css::document::XTypeDetection* >(pNew), css::uno::UNO_QUERY); } diff --git a/filter/source/config/cache/typedetection.hxx b/filter/source/config/cache/typedetection.hxx index 00537c80481b..c260a5a29b53 100644 --- a/filter/source/config/cache/typedetection.hxx +++ b/filter/source/config/cache/typedetection.hxx @@ -39,6 +39,8 @@ class TypeDetection : public ::cppu::ImplInheritanceHelper1< BaseContainer //------------------------------------------- // native interface + css::uno::Reference< css::uno::XComponentContext > m_xContext; + public: //--------------------------------------- @@ -47,10 +49,10 @@ public: /** @short standard ctor to connect this interface wrapper to the global filter cache instance ... - @param xSMGR + @param rxContext reference to the uno service manager, which created this service instance. */ - TypeDetection(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + TypeDetection(const css::uno::Reference< css::uno::XComponentContext >& rxContext); //--------------------------------------- diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 5f924a49cfb2..5960919e09e4 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -95,6 +95,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/deployment $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/document,\ DocumentProperties \ DocumentRevisionListPersistence \ + FilterConfigRefresh \ GraphicObjectResolver \ OleEmbeddedServerRegistration \ OOXMLDocumentPropertiesImporter \ diff --git a/offapi/com/sun/star/document/FilterConfigRefresh.idl b/offapi/com/sun/star/document/FilterConfigRefresh.idl new file mode 100644 index 000000000000..cd28561058cc --- /dev/null +++ b/offapi/com/sun/star/document/FilterConfigRefresh.idl @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef __com_sun_star_document_FilterConfigRefresh_idl__ +#define __com_sun_star_document_FilterConfigRefresh_idl__ + +#include <com/sun/star/util/XRefreshable.idl> + + +module com { module sun { module star { module document { + + +/** + @since LibreOffice 4.1 + */ +service FilterConfigRefresh : com::sun::star::util::XRefreshable; + + +}; }; }; }; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |