diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-18 10:58:02 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-29 17:32:55 +0100 |
commit | 39c556da3180bc507d9fae5e26bcdf81ea193938 (patch) | |
tree | 4d4e1e6ae7571db9c14a0df0cc015f73f27db33c /svx/source | |
parent | 7f4e5c8c6f293782fa772c7cf6ad7f8e5992db8b (diff) |
fdo#46808, Create new-style frame::AutoRecovery service
The service already existed, it just did not have an IDL file.
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/dialog/docrecovery.cxx | 31 | ||||
-rw-r--r-- | svx/source/inc/docrecovery.hxx | 9 | ||||
-rw-r--r-- | svx/source/unodraw/recoveryui.cxx | 4 |
3 files changed, 22 insertions, 22 deletions
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index 553a4af49e77..ba62dd19e5e8 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -53,6 +53,7 @@ #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/util/URL.hpp> #include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/frame/AutoRecovery.hpp> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/ui/dialogs/FolderPicker.hpp> @@ -134,9 +135,9 @@ short TabDialog4Recovery::Execute() } //=============================================== -RecoveryCore::RecoveryCore(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , - sal_Bool bUsedForSaving) - : m_xSMGR ( xSMGR ) +RecoveryCore::RecoveryCore(const css::uno::Reference< css::uno::XComponentContext >& rxContext, + sal_Bool bUsedForSaving) + : m_xContext ( rxContext ) , m_pListener ( 0 ) , m_bListenForSaving(bUsedForSaving) { @@ -150,9 +151,9 @@ RecoveryCore::~RecoveryCore() } //=============================================== -css::uno::Reference< css::lang::XMultiServiceFactory > RecoveryCore::getSMGR() +css::uno::Reference< css::uno::XComponentContext > RecoveryCore::getComponentContext() { - return m_xSMGR; + return m_xContext; } //=============================================== @@ -576,14 +577,14 @@ void RecoveryCore::impl_startListening() // listening already initialized ? if (m_xRealCore.is()) return; - m_xRealCore = css::uno::Reference< css::frame::XDispatch >(m_xSMGR->createInstance(SERVICENAME_RECOVERYCORE), css::uno::UNO_QUERY_THROW); + m_xRealCore = css::frame::AutoRecovery::create(m_xContext); css::util::URL aURL; if (m_bListenForSaving) aURL.Complete = RECOVERY_CMD_DO_EMERGENCY_SAVE; else aURL.Complete = RECOVERY_CMD_DO_RECOVERY; - 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); /* Note: addStatusListener() call us synchronous back ... so we @@ -603,7 +604,7 @@ void RecoveryCore::impl_stopListening() aURL.Complete = RECOVERY_CMD_DO_EMERGENCY_SAVE; else aURL.Complete = RECOVERY_CMD_DO_RECOVERY; - 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); m_xRealCore->removeStatusListener(static_cast< css::frame::XStatusListener* >(this), aURL); @@ -616,7 +617,7 @@ css::util::URL RecoveryCore::impl_getParsedURL(const ::rtl::OUString& sURL) 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); return aURL; @@ -833,8 +834,8 @@ SaveProgressDialog::SaveProgressDialog(Window* pParent, , m_pCore ( pCore ) { FreeResource(); - PluginProgress* pProgress = new PluginProgress( &m_aProgrParent, pCore->getSMGR() ); - m_xProgress = css::uno::Reference< css::task::XStatusIndicator >(static_cast< css::task::XStatusIndicator* >(pProgress), css::uno::UNO_QUERY_THROW); + PluginProgress* pProgress = new PluginProgress( &m_aProgrParent, css::uno::Reference<css::lang::XMultiServiceFactory>(pCore->getComponentContext()->getServiceManager(), css::uno::UNO_QUERY_THROW) ); + m_xProgress = css::uno::Reference< css::task::XStatusIndicator >(static_cast< css::task::XStatusIndicator* >(pProgress), css::uno::UNO_QUERY_THROW); } //=============================================== @@ -1036,7 +1037,7 @@ RecoveryDialog::RecoveryDialog(Window* pParent, sal_Bool bCrashRepEnabled( sal_False ); css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey( - comphelper::getComponentContext(pCore->getSMGR()), + pCore->getComponentContext(), CFG_PACKAGE_RECOVERY, CFG_PATH_CRASHREPORTER, CFG_ENTRY_ENABLED, @@ -1044,8 +1045,8 @@ RecoveryDialog::RecoveryDialog(Window* pParent, aVal >>= bCrashRepEnabled; m_bRecoveryOnly = !bCrashRepEnabled; - PluginProgress* pProgress = new PluginProgress( &m_aProgrParent, pCore->getSMGR() ); - m_xProgress = css::uno::Reference< css::task::XStatusIndicator >(static_cast< css::task::XStatusIndicator* >(pProgress), css::uno::UNO_QUERY_THROW); + PluginProgress* pProgress = new PluginProgress( &m_aProgrParent, css::uno::Reference<css::lang::XMultiServiceFactory>(pCore->getComponentContext()->getServiceManager(), css::uno::UNO_QUERY_THROW) ); + m_xProgress = css::uno::Reference< css::task::XStatusIndicator >(static_cast< css::task::XStatusIndicator* >(pProgress), css::uno::UNO_QUERY_THROW); const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); Wallpaper aBackground( rStyleSettings.GetWindowColor() ); @@ -1549,7 +1550,7 @@ IMPL_LINK_NOARG(BrokenRecoveryDialog, SaveButtonHdl) void BrokenRecoveryDialog::impl_askForSavePath() { css::uno::Reference< css::ui::dialogs::XFolderPicker2 > xFolderPicker = - css::ui::dialogs::FolderPicker::create(::comphelper::getComponentContext(m_pCore->getSMGR())); + css::ui::dialogs::FolderPicker::create( m_pCore->getComponentContext() ); INetURLObject aURL(m_sSavePath, INET_PROT_FILE); xFolderPicker->setDisplayDirectory(aURL.GetMainURL(INetURLObject::NO_DECODE)); diff --git a/svx/source/inc/docrecovery.hxx b/svx/source/inc/docrecovery.hxx index 5c3b2f01c43f..213196005e9b 100644 --- a/svx/source/inc/docrecovery.hxx +++ b/svx/source/inc/docrecovery.hxx @@ -60,7 +60,6 @@ #define RECOVERY_CMD_DO_ENTRY_CLEANUP rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.autorecovery:/doEntryCleanUp" )) #define SERVICENAME_PROGRESSFACTORY rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.StatusIndicatorFactory")) -#define SERVICENAME_RECOVERYCORE rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.AutoRecovery" )) #define SERVICENAME_DESKTOP rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) #define PROP_PARENTWINDOW rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Window" )) @@ -213,7 +212,7 @@ class RecoveryCore : public ::cppu::WeakImplHelper1< css::frame::XStatusListener private: /// TODO - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + css::uno::Reference< css::uno::XComponentContext > m_xContext; /// TODO css::uno::Reference< css::frame::XDispatch > m_xRealCore; @@ -242,8 +241,8 @@ class RecoveryCore : public ::cppu::WeakImplHelper1< css::frame::XStatusListener //--------------------------------------- /** @short TODO */ - RecoveryCore(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , - sal_Bool bUsedForSaving); + RecoveryCore(const css::uno::Reference< css::uno::XComponentContext >& rxContext, + sal_Bool bUsedForSaving); //--------------------------------------- /** @short TODO */ @@ -251,7 +250,7 @@ class RecoveryCore : public ::cppu::WeakImplHelper1< css::frame::XStatusListener //--------------------------------------- /** @short TODO */ - virtual css::uno::Reference< css::lang::XMultiServiceFactory > getSMGR(); + virtual css::uno::Reference< css::uno::XComponentContext > getComponentContext(); //--------------------------------------- /** @short TODO */ diff --git a/svx/source/unodraw/recoveryui.cxx b/svx/source/unodraw/recoveryui.cxx index 6d72a8dd6887..5da4fbd6e37b 100644 --- a/svx/source/unodraw/recoveryui.cxx +++ b/svx/source/unodraw/recoveryui.cxx @@ -262,7 +262,7 @@ RecoveryUI::EJob RecoveryUI::impl_classifyJob(const css::util::URL& aURL) sal_Bool RecoveryUI::impl_doEmergencySave() { // create core service, which implements the real "emergency save" algorithm. - svxdr::RecoveryCore* pCore = new svxdr::RecoveryCore(m_xSMGR, sal_True); + svxdr::RecoveryCore* pCore = new svxdr::RecoveryCore(comphelper::getComponentContext(m_xSMGR), sal_True); css::uno::Reference< css::frame::XStatusListener > xCore(pCore); // create all needed dialogs for this operation @@ -300,7 +300,7 @@ void RecoveryUI::impl_doRecovery() bRecoveryOnly = !bCrashRepEnabled; // create core service, which implements the real "emergency save" algorithm. - svxdr::RecoveryCore* pCore = new svxdr::RecoveryCore(m_xSMGR, sal_False); + svxdr::RecoveryCore* pCore = new svxdr::RecoveryCore(comphelper::getComponentContext(m_xSMGR), sal_False); css::uno::Reference< css::frame::XStatusListener > xCore(pCore); // create all needed dialogs for this operation |