diff options
-rw-r--r-- | desktop/source/app/app.cxx | 8 | ||||
-rw-r--r-- | framework/inc/services.h | 1 | ||||
-rw-r--r-- | framework/source/services/autorecovery.cxx | 2 | ||||
-rw-r--r-- | framework/source/services/sessionlistener.cxx | 11 | ||||
-rw-r--r-- | offapi/UnoApi_offapi.mk | 1 | ||||
-rw-r--r-- | offapi/com/sun/star/frame/AutoRecovery.idl | 37 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshowimpl.cxx | 8 | ||||
-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 |
10 files changed, 73 insertions, 39 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index cff9f8ed65e6..ae9b3571bed4 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -43,6 +43,7 @@ #include "migration.hxx" #include <svtools/javacontext.hxx> +#include <com/sun/star/frame/AutoRecovery.hpp> #include <com/sun/star/frame/GlobalEventBroadcaster.hpp> #include <com/sun/star/frame/XSessionManagerListener.hpp> #include <com/sun/star/frame/XSynchronousDispatch.hpp> @@ -2357,11 +2358,8 @@ void Desktop::OpenClients() { try { - Reference< XDispatch > xRecovery( - ::comphelper::getProcessServiceFactory()->createInstance( OUString("com.sun.star.frame.AutoRecovery") ), - ::com::sun::star::uno::UNO_QUERY_THROW ); - - Reference< css::util::XURLTransformer > xParser( css::util::URLTransformer::create(::comphelper::getProcessComponentContext()) ); + Reference< XDispatch > xRecovery = css::frame::AutoRecovery::create( ::comphelper::getProcessComponentContext() ); + Reference< css::util::XURLTransformer > xParser = css::util::URLTransformer::create( ::comphelper::getProcessComponentContext() ); css::util::URL aCmd; aCmd.Complete = ::rtl::OUString("vnd.sun.star.autorecovery:/disableRecovery"); diff --git a/framework/inc/services.h b/framework/inc/services.h index da5ade37193e..ccb8bfb0e2b1 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -75,7 +75,6 @@ namespace framework{ #define SERVICENAME_TOOLBARFACTORY DECLARE_ASCII("com.sun.star.ui.ToolBarFactory" ) #define SERVICENAME_TOOLBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.ToolBarControllerFactory" ) #define SERVICENAME_LICENSE SERVICENAME_JOB -#define SERVICENAME_AUTORECOVERY DECLARE_ASCII("com.sun.star.frame.AutoRecovery" ) #define SERVICENAME_STATUSBARFACTORY DECLARE_ASCII("com.sun.star.ui.StatusBarFactory" ) #define SERVICENAME_UICATEGORYDESCRIPTION DECLARE_ASCII("com.sun.star.ui.UICategoryDescription" ) #define SERVICENAME_STATUSBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.StatusbarControllerFactory" ) diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index d6928eb28533..893c935eb542 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -427,7 +427,7 @@ DEFINE_XTYPEPROVIDER_6(AutoRecovery , //----------------------------------------------- DEFINE_XSERVICEINFO_ONEINSTANCESERVICE(AutoRecovery , ::cppu::OWeakObject , - SERVICENAME_AUTORECOVERY , + DECLARE_ASCII("com.sun.star.frame.AutoRecovery"), IMPLEMENTATIONNAME_AUTORECOVERY) //----------------------------------------------- diff --git a/framework/source/services/sessionlistener.cxx b/framework/source/services/sessionlistener.cxx index abe3761ec46d..5b573c6b8e93 100644 --- a/framework/source/services/sessionlistener.cxx +++ b/framework/source/services/sessionlistener.cxx @@ -45,6 +45,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyState.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/AutoRecovery.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> @@ -144,8 +145,8 @@ void SessionListener::StoreSession( sal_Bool bAsync ) // on stop event m_rSessionManager->saveDone(this); in case of asynchronous call // in case of synchronous call the caller should do saveDone() call himself! - css::uno::Reference< XDispatch > xDispatch(m_xSMGR->createInstance(SERVICENAME_AUTORECOVERY), UNO_QUERY_THROW); - css::uno::Reference< XURLTransformer > xURLTransformer(URLTransformer::create(::comphelper::getComponentContext(m_xSMGR))); + css::uno::Reference< XDispatch > xDispatch = css::frame::AutoRecovery::create( ::comphelper::getComponentContext(m_xSMGR) ); + css::uno::Reference< XURLTransformer > xURLTransformer = URLTransformer::create( ::comphelper::getComponentContext(m_xSMGR) ); URL aURL; aURL.Complete = OUString("vnd.sun.star.autorecovery:/doSessionSave"); xURLTransformer->parseStrict(aURL); @@ -177,8 +178,8 @@ void SessionListener::QuitSessionQuietly() // xd->dispatch("vnd.sun.star.autorecovery:/doSessionQuietQuit, async=false // it is done synchronously to avoid conflict with normal quit process - css::uno::Reference< XDispatch > xDispatch(m_xSMGR->createInstance(SERVICENAME_AUTORECOVERY), UNO_QUERY_THROW); - css::uno::Reference< XURLTransformer > xURLTransformer(URLTransformer::create(::comphelper::getComponentContext(m_xSMGR))); + css::uno::Reference< XDispatch > xDispatch = css::frame::AutoRecovery::create( ::comphelper::getComponentContext(m_xSMGR) ); + css::uno::Reference< XURLTransformer > xURLTransformer = URLTransformer::create( ::comphelper::getComponentContext(m_xSMGR) ); URL aURL; aURL.Complete = OUString("vnd.sun.star.autorecovery:/doSessionQuietQuit"); xURLTransformer->parseStrict(aURL); @@ -257,7 +258,7 @@ sal_Bool SAL_CALL SessionListener::doRestore() ResetableGuard aGuard(m_aLock); m_bRestored = sal_False; try { - css::uno::Reference< XDispatch > xDispatch(m_xSMGR->createInstance(SERVICENAME_AUTORECOVERY), UNO_QUERY_THROW); + css::uno::Reference< XDispatch > xDispatch = css::frame::AutoRecovery::create( ::comphelper::getComponentContext(m_xSMGR) ); URL aURL; aURL.Complete = OUString("vnd.sun.star.autorecovery:/doSessionRestore"); diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index e8ca1fdabdee..7de5d775a93d 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -131,6 +131,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/form/runti FormOperations \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/frame,\ + AutoRecovery \ DispatchHelper \ DispatchRecorderSupplier \ DocumentTemplates \ diff --git a/offapi/com/sun/star/frame/AutoRecovery.idl b/offapi/com/sun/star/frame/AutoRecovery.idl new file mode 100644 index 000000000000..c7cd71b4f6b0 --- /dev/null +++ b/offapi/com/sun/star/frame/AutoRecovery.idl @@ -0,0 +1,37 @@ +/* -*- 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_frame_AutoRecovery_idl__ +#define __com_sun_star_frame_AutoRecovery_idl__ + +#include <com/sun/star/frame/XDispatch.idl> + +module com { module sun { module star { module frame { + +/** + + @since LibreOffice 3.7 + */ +service AutoRecovery : XDispatch; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 2cc9d30f8bf2..e0d3c9aa17ca 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -26,7 +26,8 @@ * ************************************************************************/ -#include "com/sun/star/frame/XComponentLoader.hpp" +#include <com/sun/star/frame/AutoRecovery.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/document/XEventsSupplier.hpp> #include <com/sun/star/drawing/XMasterPageTarget.hpp> @@ -2852,7 +2853,6 @@ void SlideshowImpl::setAutoSaveState( bool bOn) { try { - uno::Reference<lang::XMultiServiceFactory> xFac( ::comphelper::getProcessServiceFactory() ); uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); uno::Reference< util::XURLTransformer > xParser(util::URLTransformer::create(xContext)); @@ -2864,9 +2864,7 @@ void SlideshowImpl::setAutoSaveState( bool bOn) aArgs[0].Name = "AutoSaveState"; aArgs[0].Value <<= bOn ? sal_True : sal_False; - uno::Reference< frame::XDispatch > xAutoSave( - xFac->createInstance( "com.sun.star.frame.AutoRecovery" ), - uno::UNO_QUERY_THROW); + uno::Reference< frame::XDispatch > xAutoSave = frame::AutoRecovery::create(xContext); xAutoSave->dispatch(aURL, aArgs); } catch( Exception& ) 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 |