diff options
author | Noel Grandin <noel@peralex.com> | 2013-02-25 16:09:10 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-03-04 14:22:34 +0200 |
commit | dc00ad1e823e3b36619cd04c7e4d169362e199b3 (patch) | |
tree | 5650e5891532dde51346d8bf5e7703569712f025 /framework | |
parent | fdo#46808, convert task::StatusIndicatorFactory to new style (diff) | |
download | core-dc00ad1e823e3b36619cd04c7e4d169362e199b3.tar.gz core-dc00ad1e823e3b36619cd04c7e4d169362e199b3.zip |
fdo#46808, Use service constructor for task::InteractionHandler
a lot of code was loading the service using it's implementation name,
which is why this got missed earlier.
Change-Id: I0b150bc9383a1a3a09ab905c4ddb7f914e69638d
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/framework/preventduplicateinteraction.hxx | 5 | ||||
-rw-r--r-- | framework/inc/services.h | 1 | ||||
-rw-r--r-- | framework/source/fwe/interaction/preventduplicateinteraction.cxx | 12 | ||||
-rw-r--r-- | framework/source/inc/loadenv/loadenv.hxx | 9 | ||||
-rw-r--r-- | framework/source/loadenv/loadenv.cxx | 7 | ||||
-rw-r--r-- | framework/source/services/autorecovery.cxx | 2 |
6 files changed, 15 insertions, 21 deletions
diff --git a/framework/inc/framework/preventduplicateinteraction.hxx b/framework/inc/framework/preventduplicateinteraction.hxx index 559f6b4a7495..2d058c231777 100644 --- a/framework/inc/framework/preventduplicateinteraction.hxx +++ b/framework/inc/framework/preventduplicateinteraction.hxx @@ -26,7 +26,6 @@ #include <com/sun/star/task/XInteractionHandler2.hpp> #include <com/sun/star/task/XInteractionRequest.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <cppuhelper/implbase1.hxx> @@ -92,7 +91,7 @@ class FWE_DLLPUBLIC PreventDuplicateInteraction : private ThreadHelpBase2 private: /// Used to create needed uno services at runtime. - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > m_xContext; /** The outside interaction handler, which is used to handle every incoming interaction, if it's not blocked. */ @@ -160,7 +159,7 @@ class FWE_DLLPUBLIC PreventDuplicateInteraction : private ThreadHelpBase2 @threadsafe not neccessary */ - PreventDuplicateInteraction(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + PreventDuplicateInteraction(const css::uno::Reference< css::uno::XComponentContext >& rxContext); //_________________________________ /** diff --git a/framework/inc/services.h b/framework/inc/services.h index 28f8b6d70bad..6fb4b45c723e 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -77,7 +77,6 @@ namespace framework{ #define IMPLEMENTATIONNAME_DISPATCHRECORDERSUPPLIER DECLARE_ASCII("com.sun.star.comp.framework.DispatchRecorderSupplier") #define IMPLEMENTATIONNAME_MAILTODISPATCHER DECLARE_ASCII("com.sun.star.comp.framework.MailToDispatcher" ) #define IMPLEMENTATIONNAME_SERVICEHANDLER DECLARE_ASCII("com.sun.star.comp.framework.ServiceHandler" ) -#define IMPLEMENTATIONNAME_UIINTERACTIONHANDLER DECLARE_ASCII("com.sun.star.comp.uui.UUIInteractionHandler" ) #define IMPLEMENTATIONNAME_SUBSTITUTEPATHVARIABLES DECLARE_ASCII("com.sun.star.comp.framework.PathSubstitution" ) #define IMPLEMENTATIONNAME_PATHSETTINGS DECLARE_ASCII("com.sun.star.comp.framework.PathSettings" ) #define IMPLEMENTATIONNAME_JOBDISPATCH DECLARE_ASCII("com.sun.star.comp.framework.jobs.JobDispatch" ) diff --git a/framework/source/fwe/interaction/preventduplicateinteraction.cxx b/framework/source/fwe/interaction/preventduplicateinteraction.cxx index eeddfd7717b2..0ccb88d805f5 100644 --- a/framework/source/fwe/interaction/preventduplicateinteraction.cxx +++ b/framework/source/fwe/interaction/preventduplicateinteraction.cxx @@ -19,16 +19,15 @@ #include "framework/preventduplicateinteraction.hxx" +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/task/XInteractionAbort.hpp> #include <com/sun/star/task/XInteractionRetry.hpp> namespace framework{ -#define IMPLEMENTATIONNAME_UIINTERACTIONHANDLER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.uui.UUIInteractionHandler")) - -PreventDuplicateInteraction::PreventDuplicateInteraction(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) +PreventDuplicateInteraction::PreventDuplicateInteraction(const css::uno::Reference< css::uno::XComponentContext >& rxContext) : ThreadHelpBase2() - , m_xSMGR(xSMGR) + , m_xContext(rxContext) { } @@ -55,13 +54,10 @@ void PreventDuplicateInteraction::useDefaultUUIHandler() { // SAFE -> ::osl::ResettableMutexGuard aLock(m_aLock); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; aLock.clear(); // <- SAFE - css::uno::Reference< css::task::XInteractionHandler > xHandler( - xSMGR->createInstance(IMPLEMENTATIONNAME_UIINTERACTIONHANDLER), - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::task::XInteractionHandler > xHandler( css::task::InteractionHandler::createWithParent( m_xContext, 0 ), css::uno::UNO_QUERY_THROW ); // SAFE -> aLock.reset(); diff --git a/framework/source/inc/loadenv/loadenv.hxx b/framework/source/inc/loadenv/loadenv.hxx index b82f0aba027f..c76877f2d09a 100644 --- a/framework/source/inc/loadenv/loadenv.hxx +++ b/framework/source/inc/loadenv/loadenv.hxx @@ -24,17 +24,16 @@ #include <loadenv/actionlockguard.hxx> #include <threadhelp/threadhelpbase.hxx> +#include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/XFrameLoader.hpp> #include <com/sun/star/frame/XLoadEventListener.hpp> #include <com/sun/star/frame/XDispatchResultListener.hpp> #include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/util/URL.hpp> - -#include <com/sun/star/lang/IllegalArgumentException.hpp> - #include <com/sun/star/io/IOException.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/util/URL.hpp> #include <comphelper/mediadescriptor.hxx> #include <comphelper/sequenceashashmap.hxx> @@ -370,7 +369,7 @@ public: /** TODO document me ... */ static void initializeUIDefaults( - const css::uno::Reference< css::lang::XMultiServiceFactory >& i_rSMGR, + const css::uno::Reference< css::uno::XComponentContext >& i_rxContext, ::comphelper::MediaDescriptor& io_lMediaDescriptor, const bool _bUIMode, QuietInteraction** o_ppQuiteInteraction diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 332f3c911fb2..3b0f4cbe9160 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -37,6 +37,7 @@ #include "officecfg/Office/Common.hxx" #include <com/sun/star/task/ErrorCodeRequest.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/uno/RuntimeException.hpp> #include <com/sun/star/frame/DispatchResultState.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> @@ -293,7 +294,7 @@ void LoadEnv::initializeLoading(const ::rtl::OUString& ( m_lMediaDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_PREVIEW(), sal_False ) == sal_False ); initializeUIDefaults( - m_xSMGR, + comphelper::getComponentContext(m_xSMGR), m_lMediaDescriptor, bUIMode, &m_pQuietInteraction @@ -304,7 +305,7 @@ void LoadEnv::initializeLoading(const ::rtl::OUString& } -void LoadEnv::initializeUIDefaults( const css::uno::Reference< css::lang::XMultiServiceFactory >& i_rSMGR, +void LoadEnv::initializeUIDefaults( const css::uno::Reference< css::uno::XComponentContext >& i_rxContext, ::comphelper::MediaDescriptor& io_lMediaDescriptor, const bool i_bUIMode, QuietInteraction** o_ppQuietInteraction ) { @@ -318,7 +319,7 @@ void LoadEnv::initializeUIDefaults( const css::uno::Reference< css::lang::XMulti nUpdateMode = css::document::UpdateDocMode::ACCORDING_TO_CONFIG; try { - xInteractionHandler = css::uno::Reference< css::task::XInteractionHandler >(i_rSMGR->createInstance(IMPLEMENTATIONNAME_UIINTERACTIONHANDLER), css::uno::UNO_QUERY); + xInteractionHandler.set( css::task::InteractionHandler::createWithParent( i_rxContext, 0 ), css::uno::UNO_QUERY_THROW ); } catch(const css::uno::RuntimeException&) {throw;} catch(const css::uno::Exception& ) { } diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 6248ae18225d..e6f35e8edb04 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -2523,7 +2523,7 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa else continue; // TODO ERROR! - LoadEnv::initializeUIDefaults( m_xSMGR, lDescriptor, true, NULL ); + LoadEnv::initializeUIDefaults( comphelper::getComponentContext(m_xSMGR), lDescriptor, true, NULL ); // <- SAFE ------------------------------ aWriteLock.unlock(); |