Kaydet (Commit) 1f797074 authored tarafından Noel Grandin's avatar Noel Grandin

fdo#46808, Convert office::Quickstart service to new style

Service already existed, just needed an IDL file.

Change-Id: Ief5563e53c7331b65dd429079180c4eed2f2c071
üst d7fa9ca7
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
#include <com/sun/star/container/XContentEnumerationAccess.hpp> #include <com/sun/star/container/XContentEnumerationAccess.hpp>
#include <com/sun/star/container/XSet.hpp> #include <com/sun/star/container/XSet.hpp>
#include <com/sun/star/i18n/ScriptType.hpp> #include <com/sun/star/i18n/ScriptType.hpp>
#include <com/sun/star/office/Quickstart.hpp>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
...@@ -1267,18 +1268,9 @@ sal_Bool OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet ) ...@@ -1267,18 +1268,9 @@ sal_Bool OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet )
// tell quickstarter to stop being a veto listener // tell quickstarter to stop being a veto listener
Reference< XMultiServiceFactory > theMSF( Reference< XComponentContext > xContext(
comphelper::getProcessServiceFactory()); comphelper::getProcessComponentContext());
Reference< XInitialization > xInit(theMSF->createInstance( css::office::Quickstart::createAndSetVeto(xContext, false, false, false/*DisableVeto*/);
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);
}
} }
} }
catch (const Exception& e) catch (const Exception& e)
......
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
#include <com/sun/star/frame/XUIControllerRegistration.hpp> #include <com/sun/star/frame/XUIControllerRegistration.hpp>
#include <com/sun/star/frame/ToolbarControllerFactory.hpp> #include <com/sun/star/frame/ToolbarControllerFactory.hpp>
#include <com/sun/star/frame/PopupMenuControllerFactory.hpp> #include <com/sun/star/frame/PopupMenuControllerFactory.hpp>
#include <com/sun/star/office/Quickstart.hpp>
#include <toolkit/unohlp.hxx> #include <toolkit/unohlp.hxx>
#include <comphelper/configuration.hxx> #include <comphelper/configuration.hxx>
...@@ -1916,11 +1917,7 @@ sal_Bool Desktop::InitializeQuickstartMode( const Reference< XComponentContext > ...@@ -1916,11 +1917,7 @@ sal_Bool Desktop::InitializeQuickstartMode( const Reference< XComponentContext >
if ( bQuickstart ) if ( bQuickstart )
#endif #endif
{ {
Sequence< Any > aSeq( 1 ); css::office::Quickstart::createStart(rxContext, bQuickstart);
aSeq[0] <<= bQuickstart;
Reference < XComponent > xQuickstart(
rxContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.office.Quickstart", aSeq, rxContext),
UNO_QUERY );
} }
return sal_True; return sal_True;
} }
...@@ -2725,15 +2722,8 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) ...@@ -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 // 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)!!! // 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! // 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< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
Reference < XInitialization > xQuickstart( xContext->getServiceManager()->createInstanceWithContext("com.sun.star.office.Quickstart", xContext), css::office::Quickstart::createStart(xContext, true/*Quickstart*/);
UNO_QUERY );
if ( xQuickstart.is() )
xQuickstart->initialize( aSeq );
} }
break; break;
case ApplicationEvent::TYPE_SHOWDIALOG: case ApplicationEvent::TYPE_SHOWDIALOG:
...@@ -2931,18 +2921,8 @@ void Desktop::CheckFirstRun( ) ...@@ -2931,18 +2921,8 @@ void Desktop::CheckFirstRun( )
{ {
if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("RunQuickstartAtFirstStart"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) ) 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(); css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
Reference < XInitialization > xQuickstart( css::office::Quickstart::createAutoStart(xContext, true/*Quickstart*/, true/*bAutostart*/);
xContext->getServiceManager()->createInstanceWithContext("com.sun.star.office.Quickstart", xContext),
UNO_QUERY );
if ( xQuickstart.is() )
xQuickstart->initialize( aSeq );
RegCloseKey( hKey ); RegCloseKey( hKey );
} }
} }
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/util/XChangesBatch.hpp> #include <com/sun/star/util/XChangesBatch.hpp>
#include <com/sun/star/office/Quickstart.hpp>
#include "app.hxx" #include "app.hxx"
...@@ -67,15 +68,10 @@ void Desktop::DoRestartActionsIfNecessary( sal_Bool bQuickStart ) ...@@ -67,15 +68,10 @@ void Desktop::DoRestartActionsIfNecessary( sal_Bool bQuickStart )
xPSet->setPropertyValue( sPropName, makeAny( sal_False ) ); xPSet->setPropertyValue( sPropName, makeAny( sal_False ) );
Reference< util::XChangesBatch >( xPSet, UNO_QUERY_THROW )->commitChanges(); Reference< util::XChangesBatch >( xPSet, UNO_QUERY_THROW )->commitChanges();
Sequence< Any > aSeq( 1 );
sal_Bool bQuickstart = shouldLaunchQuickstart(); sal_Bool bQuickstart = shouldLaunchQuickstart();
aSeq[0] <<= bQuickstart;
css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
Reference < XInitialization > xQuickstart( css::office::Quickstart::createStart(xContext, bQuickstart);
xContext->getServiceManager()->createInstanceWithContext("com.sun.star.office.Quickstart", xContext),
UNO_QUERY_THROW );
xQuickstart->initialize( aSeq );
} }
} }
catch( const uno::Exception& ) catch( const uno::Exception& )
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/DispatchResultEvent.hpp> #include <com/sun/star/frame/DispatchResultEvent.hpp>
#include <com/sun/star/frame/DispatchResultState.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/SystemShellExecute.hpp>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
#include <com/sun/star/task/XJob.hpp> #include <com/sun/star/task/XJob.hpp>
...@@ -710,13 +711,9 @@ ShutdownThread::run() ...@@ -710,13 +711,9 @@ ShutdownThread::run()
m_aCondition.wait(&tv); m_aCondition.wait(&tv);
// Tell QuickStarter not to veto .. // Tell QuickStarter not to veto ..
uno::Reference< beans::XFastPropertySet > xQuickStarter( uno::Reference< css::beans::XFastPropertySet > xQuickStarter = css::office::Quickstart::createDefault(m_xContext);
UpdateCheck::createService("com.sun.star.office.Quickstart", m_xContext),
uno::UNO_QUERY
);
if (xQuickStarter.is()) xQuickStarter->setFastPropertyValue(0, uno::makeAny(false));
xQuickStarter->setFastPropertyValue(0, uno::makeAny(false));
// Shutdown the office // Shutdown the office
uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(m_xContext); uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(m_xContext);
...@@ -1570,27 +1567,6 @@ UpdateCheck::getInteractionHandler() const ...@@ -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 bool
UpdateCheck::isDialogShowing() const UpdateCheck::isDialogShowing() const
{ {
......
...@@ -66,14 +66,6 @@ public: ...@@ -66,14 +66,6 @@ public:
void initialize(const com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue>& rValues, 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); 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 // Update internal update info member
void setUpdateInfo(const UpdateInfo& aInfo); void setUpdateInfo(const UpdateInfo& aInfo);
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/util/XChangesBatch.hpp> #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/beans/NamedValue.hpp>
#include <com/sun/star/lang/XComponent.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 ...@@ -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(); Reference< XChangesBatch >(pset, UNO_QUERY_THROW)->commitChanges();
// enable quickstarter // 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< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
Reference < XInitialization > xQuickstart( css::office::Quickstart::createAutoStart(xContext, true/*Quickstart*/, true/*Autostart*/);
xContext->getServiceManager()->createInstanceWithContext("com.sun.star.office.Quickstart", xContext),
UNO_QUERY );
if ( xQuickstart.is() )
xQuickstart->initialize( aSeq );
aRet <<= sal_True; aRet <<= sal_True;
} }
......
...@@ -262,6 +262,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/media,\ ...@@ -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,\ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/mozilla,\
MozillaBootstrap \ 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,\ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/oox,\
PowerPointExport \ PowerPointExport \
)) ))
......
/* -*- 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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment