diff options
author | Noel Grandin <noel@peralex.com> | 2013-05-30 15:57:26 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-06-03 10:00:01 +0200 |
commit | 1f79707438d84ba639a2c601ae9d25c4647d37f6 (patch) | |
tree | a52374a4ce43de7d0814325bf72074f3998e3598 | |
parent | d7fa9ca787ee0ec5d0b9f2989f547ff37791afc6 (diff) |
fdo#46808, Convert office::Quickstart service to new style
Service already existed, just needed an IDL file.
Change-Id: Ief5563e53c7331b65dd429079180c4eed2f2c071
-rw-r--r-- | cui/source/options/optgdlg.cxx | 16 | ||||
-rw-r--r-- | desktop/source/app/app.cxx | 28 | ||||
-rw-r--r-- | desktop/source/app/appfirststart.cxx | 8 | ||||
-rw-r--r-- | extensions/source/update/check/updatecheck.cxx | 30 | ||||
-rw-r--r-- | extensions/source/update/check/updatecheck.hxx | 8 | ||||
-rw-r--r-- | framework/source/services/license.cxx | 12 | ||||
-rw-r--r-- | offapi/UnoApi_offapi.mk | 3 | ||||
-rw-r--r-- | offapi/com/sun/star/office/Quickstart.idl | 51 |
8 files changed, 69 insertions, 87 deletions
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 18fe2b0f3715..cc0824c82b62 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -80,6 +80,7 @@ #include <com/sun/star/container/XContentEnumerationAccess.hpp> #include <com/sun/star/container/XSet.hpp> #include <com/sun/star/i18n/ScriptType.hpp> +#include <com/sun/star/office/Quickstart.hpp> #include <vcl/svapp.hxx> @@ -1267,18 +1268,9 @@ sal_Bool OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet ) // tell quickstarter to stop being a veto listener - Reference< XMultiServiceFactory > theMSF( - comphelper::getProcessServiceFactory()); - Reference< XInitialization > xInit(theMSF->createInstance( - OUString("com.sun.star.office.Quickstart")), UNO_QUERY); - if (xInit.is()) - { - Sequence< Any > args(3); - args[0] = makeAny(sal_False); // will be ignored - args[1] = makeAny(sal_False); // will be ignored - args[2] = makeAny(sal_False); // disable veto - xInit->initialize(args); - } + Reference< XComponentContext > xContext( + comphelper::getProcessComponentContext()); + css::office::Quickstart::createAndSetVeto(xContext, false, false, false/*DisableVeto*/); } } catch (const Exception& e) diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 3f37a987e3b4..374a239af97f 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -71,6 +71,7 @@ #include <com/sun/star/frame/XUIControllerRegistration.hpp> #include <com/sun/star/frame/ToolbarControllerFactory.hpp> #include <com/sun/star/frame/PopupMenuControllerFactory.hpp> +#include <com/sun/star/office/Quickstart.hpp> #include <toolkit/unohlp.hxx> #include <comphelper/configuration.hxx> @@ -1916,11 +1917,7 @@ sal_Bool Desktop::InitializeQuickstartMode( const Reference< XComponentContext > if ( bQuickstart ) #endif { - Sequence< Any > aSeq( 1 ); - aSeq[0] <<= bQuickstart; - Reference < XComponent > xQuickstart( - rxContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.office.Quickstart", aSeq, rxContext), - UNO_QUERY ); + css::office::Quickstart::createStart(rxContext, bQuickstart); } return sal_True; } @@ -2725,15 +2722,8 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) // NOTICE: The quickstart service must be initialized inside the "main thread", so we use the // application events to do this (they are executed inside main thread)!!! // Don't start quickstart service if the user specified "--invisible" on the command line! - sal_Bool bQuickstart( sal_True ); - Sequence< Any > aSeq( 1 ); - aSeq[0] <<= bQuickstart; - Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - Reference < XInitialization > xQuickstart( xContext->getServiceManager()->createInstanceWithContext("com.sun.star.office.Quickstart", xContext), - UNO_QUERY ); - if ( xQuickstart.is() ) - xQuickstart->initialize( aSeq ); + css::office::Quickstart::createStart(xContext, true/*Quickstart*/); } break; case ApplicationEvent::TYPE_SHOWDIALOG: @@ -2931,18 +2921,8 @@ void Desktop::CheckFirstRun( ) { if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("RunQuickstartAtFirstStart"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) { - sal_Bool bQuickstart( sal_True ); - sal_Bool bAutostart( sal_True ); - Sequence< Any > aSeq( 2 ); - aSeq[0] <<= bQuickstart; - aSeq[1] <<= bAutostart; - css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - Reference < XInitialization > xQuickstart( - xContext->getServiceManager()->createInstanceWithContext("com.sun.star.office.Quickstart", xContext), - UNO_QUERY ); - if ( xQuickstart.is() ) - xQuickstart->initialize( aSeq ); + css::office::Quickstart::createAutoStart(xContext, true/*Quickstart*/, true/*bAutostart*/); RegCloseKey( hKey ); } } diff --git a/desktop/source/app/appfirststart.cxx b/desktop/source/app/appfirststart.cxx index 97ca6e149e6d..a5e3e32c9047 100644 --- a/desktop/source/app/appfirststart.cxx +++ b/desktop/source/app/appfirststart.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/util/XChangesBatch.hpp> +#include <com/sun/star/office/Quickstart.hpp> #include "app.hxx" @@ -67,15 +68,10 @@ void Desktop::DoRestartActionsIfNecessary( sal_Bool bQuickStart ) xPSet->setPropertyValue( sPropName, makeAny( sal_False ) ); Reference< util::XChangesBatch >( xPSet, UNO_QUERY_THROW )->commitChanges(); - Sequence< Any > aSeq( 1 ); sal_Bool bQuickstart = shouldLaunchQuickstart(); - aSeq[0] <<= bQuickstart; css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - Reference < XInitialization > xQuickstart( - xContext->getServiceManager()->createInstanceWithContext("com.sun.star.office.Quickstart", xContext), - UNO_QUERY_THROW ); - xQuickstart->initialize( aSeq ); + css::office::Quickstart::createStart(xContext, bQuickstart); } } catch( const uno::Exception& ) diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx index 380217ca19ed..52e0e628d998 100644 --- a/extensions/source/update/check/updatecheck.cxx +++ b/extensions/source/update/check/updatecheck.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/DispatchResultEvent.hpp> #include <com/sun/star/frame/DispatchResultState.hpp> +#include <com/sun/star/office/Quickstart.hpp> #include <com/sun/star/system/SystemShellExecute.hpp> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <com/sun/star/task/XJob.hpp> @@ -710,13 +711,9 @@ ShutdownThread::run() m_aCondition.wait(&tv); // Tell QuickStarter not to veto .. - uno::Reference< beans::XFastPropertySet > xQuickStarter( - UpdateCheck::createService("com.sun.star.office.Quickstart", m_xContext), - uno::UNO_QUERY - ); + uno::Reference< css::beans::XFastPropertySet > xQuickStarter = css::office::Quickstart::createDefault(m_xContext); - if (xQuickStarter.is()) - xQuickStarter->setFastPropertyValue(0, uno::makeAny(false)); + xQuickStarter->setFastPropertyValue(0, uno::makeAny(false)); // Shutdown the office uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(m_xContext); @@ -1570,27 +1567,6 @@ UpdateCheck::getInteractionHandler() const //------------------------------------------------------------------------------ -uno::Reference< uno::XInterface > -UpdateCheck::createService(const OUString& rServiceName, - const uno::Reference<uno::XComponentContext>& xContext) -{ - if( !xContext.is() ) - throw uno::RuntimeException( - "UpdateCheckConfig: empty component context", - uno::Reference< uno::XInterface >() ); - - const uno::Reference< lang::XMultiComponentFactory > xServiceManager(xContext->getServiceManager()); - - if( !xServiceManager.is() ) - throw uno::RuntimeException( - "UpdateCheckConfig: unable to obtain service manager from component context", - uno::Reference< uno::XInterface >() ); - - return xServiceManager->createInstanceWithContext(rServiceName, xContext); -} - -//------------------------------------------------------------------------------ - bool UpdateCheck::isDialogShowing() const { diff --git a/extensions/source/update/check/updatecheck.hxx b/extensions/source/update/check/updatecheck.hxx index 9ae38d8132d3..8d40c32f85dc 100644 --- a/extensions/source/update/check/updatecheck.hxx +++ b/extensions/source/update/check/updatecheck.hxx @@ -66,14 +66,6 @@ public: void initialize(const com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue>& rValues, const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>& xContext); - /* Returns an instance of the specified service obtained from the specified - * component context - */ - - static com::sun::star::uno::Reference< com::sun::star::uno::XInterface > createService( - const OUString& aServiceName, - const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>& xContext); - // Update internal update info member void setUpdateInfo(const UpdateInfo& aInfo); diff --git a/framework/source/services/license.cxx b/framework/source/services/license.cxx index 689917006e03..9600598ae2dc 100644 --- a/framework/source/services/license.cxx +++ b/framework/source/services/license.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/util/XChangesBatch.hpp> +#include <com/sun/star/office/Quickstart.hpp> #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/lang/XComponent.hpp> @@ -293,18 +294,9 @@ css::uno::Any SAL_CALL License::execute(const css::uno::Sequence< css::beans::Na Reference< XChangesBatch >(pset, UNO_QUERY_THROW)->commitChanges(); // enable quickstarter - sal_Bool bQuickstart( sal_True ); - sal_Bool bAutostart( sal_True ); - Sequence< Any > aSeq( 2 ); - aSeq[0] <<= bQuickstart; - aSeq[1] <<= bAutostart; Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - Reference < XInitialization > xQuickstart( - xContext->getServiceManager()->createInstanceWithContext("com.sun.star.office.Quickstart", xContext), - UNO_QUERY ); - if ( xQuickstart.is() ) - xQuickstart->initialize( aSeq ); + css::office::Quickstart::createAutoStart(xContext, true/*Quickstart*/, true/*Autostart*/); aRet <<= sal_True; } diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 4c1e9974d0b9..4aee919198a4 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -262,6 +262,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/media,\ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/mozilla,\ MozillaBootstrap \ )) +$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/office,\ + Quickstart \ +)) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/oox,\ PowerPointExport \ )) diff --git a/offapi/com/sun/star/office/Quickstart.idl b/offapi/com/sun/star/office/Quickstart.idl new file mode 100644 index 000000000000..0c45c82e432a --- /dev/null +++ b/offapi/com/sun/star/office/Quickstart.idl @@ -0,0 +1,51 @@ +/* -*- 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_office_Quickstart_idl__ +#define __com_sun_star_office_Quickstart_idl__ + +#include <com/sun/star/beans/XFastPropertySet.idl> + + +module com { module sun { module star { module office { + + +/** + @since LibreOffice 4.2 + */ +service Quickstart : com::sun::star::beans::XFastPropertySet +{ + createDefault(); + + /** + The first two parameters are ignored + */ + createAndSetVeto([in] boolean p1, [in] boolean p2, [in] boolean DisableVeto); + + createStart([in] boolean bQuickstart); + + createAutoStart([in] boolean bQuickstart, [in] boolean bAutostart); +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |