2010-10-27 13:11:31 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-15 17:28:16 +00:00
|
|
|
/*
|
|
|
|
* 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 .
|
|
|
|
*/
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2013-10-28 03:35:57 +01:00
|
|
|
#ifndef INCLUDED_DESKTOP_INC_APP_HXX
|
|
|
|
#define INCLUDED_DESKTOP_INC_APP_HXX
|
2002-11-01 08:50:03 +00:00
|
|
|
|
2014-04-13 23:26:48 +02:00
|
|
|
#include <boost/optional.hpp>
|
2012-12-02 12:47:48 +00:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
2002-11-01 08:50:03 +00:00
|
|
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
2015-04-22 09:42:28 +02:00
|
|
|
#include <sal/log.hxx>
|
2001-07-16 11:55:47 +00:00
|
|
|
#include <vcl/svapp.hxx>
|
2003-03-25 12:52:54 +00:00
|
|
|
#include <vcl/timer.hxx>
|
2001-07-16 11:55:47 +00:00
|
|
|
#include <tools/resmgr.hxx>
|
2001-08-09 04:43:13 +00:00
|
|
|
#include <unotools/bootstrap.hxx>
|
2003-03-25 12:52:54 +00:00
|
|
|
#include <com/sun/star/task/XStatusIndicator.hpp>
|
|
|
|
#include <com/sun/star/uno/Reference.h>
|
|
|
|
#include <osl/mutex.hxx>
|
2012-07-26 12:17:09 +02:00
|
|
|
|
2012-11-30 12:13:41 +01:00
|
|
|
namespace com { namespace sun { namespace star { namespace uno {
|
|
|
|
class XComponentContext;
|
|
|
|
} } } }
|
|
|
|
|
2002-11-01 08:50:03 +00:00
|
|
|
namespace desktop
|
|
|
|
{
|
|
|
|
|
2000-09-18 15:18:56 +00:00
|
|
|
/*--------------------------------------------------------------------
|
2001-07-16 11:55:47 +00:00
|
|
|
Description: Application-class
|
2000-09-18 15:18:56 +00:00
|
|
|
--------------------------------------------------------------------*/
|
2002-11-01 08:50:03 +00:00
|
|
|
class CommandLineArgs;
|
2002-11-06 13:32:44 +00:00
|
|
|
class Lockfile;
|
2004-02-03 19:02:17 +00:00
|
|
|
struct ConvertData;
|
2002-11-01 08:50:03 +00:00
|
|
|
class Desktop : public Application
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2011-03-13 16:07:53 -05:00
|
|
|
int doShutdown();
|
2010-11-18 15:28:06 +01:00
|
|
|
|
2001-07-16 11:55:47 +00:00
|
|
|
public:
|
2001-08-07 10:25:00 +00:00
|
|
|
enum BootstrapError
|
|
|
|
{
|
|
|
|
BE_OK,
|
|
|
|
BE_UNO_SERVICEMANAGER,
|
|
|
|
BE_UNO_SERVICE_CONFIG_MISSING,
|
2003-11-07 13:50:48 +00:00
|
|
|
BE_PATHINFO_MISSING,
|
2004-11-09 14:14:48 +00:00
|
|
|
BE_USERINSTALL_FAILED,
|
2006-03-24 12:51:04 +00:00
|
|
|
BE_LANGUAGE_MISSING,
|
|
|
|
BE_USERINSTALL_NOTENOUGHDISKSPACE,
|
2010-06-22 17:08:07 +02:00
|
|
|
BE_USERINSTALL_NOWRITEACCESS,
|
|
|
|
BE_OFFICECONFIG_BROKEN
|
2001-08-07 10:25:00 +00:00
|
|
|
};
|
2005-10-24 17:33:37 +00:00
|
|
|
enum BootstrapStatus
|
|
|
|
{
|
|
|
|
BS_OK,
|
|
|
|
BS_TERMINATE
|
|
|
|
};
|
2001-08-07 10:25:00 +00:00
|
|
|
|
2002-11-01 08:50:03 +00:00
|
|
|
Desktop();
|
2014-04-01 19:18:35 +02:00
|
|
|
virtual ~Desktop();
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual int Main( ) SAL_OVERRIDE;
|
|
|
|
virtual void Init() SAL_OVERRIDE;
|
|
|
|
virtual void InitFinished() SAL_OVERRIDE;
|
|
|
|
virtual void DeInit() SAL_OVERRIDE;
|
|
|
|
virtual bool QueryExit() SAL_OVERRIDE;
|
|
|
|
virtual sal_uInt16 Exception(sal_uInt16 nError) SAL_OVERRIDE;
|
|
|
|
virtual void OverrideSystemSettings( AllSettings& rSettings ) SAL_OVERRIDE;
|
|
|
|
virtual void AppEvent( const ApplicationEvent& rAppEvent ) SAL_OVERRIDE;
|
2001-07-16 11:55:47 +00:00
|
|
|
|
2014-01-24 19:27:41 +11:00
|
|
|
DECL_LINK( OpenClients_Impl, void* );
|
2001-07-06 14:58:45 +00:00
|
|
|
|
2002-11-01 08:50:03 +00:00
|
|
|
static void OpenClients();
|
|
|
|
static void OpenDefault();
|
2003-03-25 12:52:54 +00:00
|
|
|
|
2015-05-08 19:11:38 +02:00
|
|
|
DECL_STATIC_LINK( Desktop, EnableAcceptors_Impl, void*);
|
2003-03-25 12:52:54 +00:00
|
|
|
|
2002-11-01 08:50:03 +00:00
|
|
|
static void HandleAppEvent( const ApplicationEvent& rAppEvent );
|
|
|
|
static ResMgr* GetDesktopResManager();
|
2011-04-01 21:06:41 +01:00
|
|
|
static CommandLineArgs& GetCommandLineArgs();
|
2001-07-06 14:58:45 +00:00
|
|
|
|
2015-04-07 13:16:24 +02:00
|
|
|
static void HandleBootstrapErrors(
|
2014-01-24 19:27:41 +11:00
|
|
|
BootstrapError nError, OUString const & aMessage );
|
2012-09-18 12:40:57 +02:00
|
|
|
void SetBootstrapError(
|
2014-01-24 19:27:41 +11:00
|
|
|
BootstrapError nError, OUString const & aMessage )
|
2001-10-09 11:12:08 +00:00
|
|
|
{
|
|
|
|
if ( m_aBootstrapError == BE_OK )
|
2012-09-18 12:40:57 +02:00
|
|
|
{
|
2014-10-15 15:39:24 +03:00
|
|
|
SAL_INFO("desktop.app", "SetBootstrapError: " << nError << " '" << aMessage << "'");
|
2001-10-09 11:12:08 +00:00
|
|
|
m_aBootstrapError = nError;
|
2012-09-18 12:40:57 +02:00
|
|
|
m_aBootstrapErrorMessage = aMessage;
|
|
|
|
}
|
2004-11-09 14:14:48 +00:00
|
|
|
}
|
2001-08-07 10:25:00 +00:00
|
|
|
|
2005-10-24 17:33:37 +00:00
|
|
|
void SetBootstrapStatus( BootstrapStatus nStatus )
|
|
|
|
{
|
|
|
|
m_aBootstrapStatus = nStatus;
|
|
|
|
}
|
|
|
|
BootstrapStatus GetBootstrapStatus() const
|
|
|
|
{
|
|
|
|
return m_aBootstrapStatus;
|
|
|
|
}
|
|
|
|
|
2014-05-08 11:43:26 +02:00
|
|
|
static bool isCrashReporterEnabled();
|
2003-05-22 07:50:43 +00:00
|
|
|
|
2010-12-03 16:48:50 +00:00
|
|
|
// first-start (ever) related methods
|
2014-05-08 11:43:26 +02:00
|
|
|
static bool CheckExtensionDependencies();
|
2010-04-20 07:59:05 +02:00
|
|
|
|
2012-08-09 13:29:22 +02:00
|
|
|
void SynchronizeExtensionRepositories();
|
2013-04-07 12:06:47 +02:00
|
|
|
void SetSplashScreenText( const OUString& rText );
|
2010-04-20 07:59:05 +02:00
|
|
|
void SetSplashScreenProgress( sal_Int32 );
|
2008-01-29 15:29:39 +00:00
|
|
|
|
2002-11-01 08:50:03 +00:00
|
|
|
// Bootstrap methods
|
2012-09-24 17:41:51 +02:00
|
|
|
static void InitApplicationServiceManager();
|
|
|
|
// throws an exception upon failure
|
2002-11-01 08:50:03 +00:00
|
|
|
|
2012-09-24 17:41:51 +02:00
|
|
|
private:
|
2014-01-24 19:27:41 +11:00
|
|
|
void RegisterServices(
|
|
|
|
css::uno::Reference< css::uno::XComponentContext > const & context);
|
2015-04-07 13:16:24 +02:00
|
|
|
static void DeregisterServices();
|
2002-11-01 08:50:03 +00:00
|
|
|
|
2015-04-07 13:16:24 +02:00
|
|
|
static void CreateTemporaryDirectory();
|
|
|
|
static void RemoveTemporaryDirectory();
|
2002-11-01 08:50:03 +00:00
|
|
|
|
2014-05-08 11:43:26 +02:00
|
|
|
bool InitializeInstallation( const OUString& rAppFilename );
|
2015-04-07 13:16:24 +02:00
|
|
|
static bool InitializeConfiguration();
|
|
|
|
static void FlushConfiguration();
|
|
|
|
static bool InitializeQuickstartMode( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
|
2002-11-01 08:50:03 +00:00
|
|
|
|
2015-04-07 13:16:24 +02:00
|
|
|
static void HandleBootstrapPathErrors( ::utl::Bootstrap::Status, const OUString& aMsg );
|
2013-04-07 12:06:47 +02:00
|
|
|
void StartSetup( const OUString& aParameters );
|
2001-08-07 10:25:00 +00:00
|
|
|
|
2001-10-09 11:12:08 +00:00
|
|
|
// Create a error message depending on bootstrap failure code and an optional file url
|
2015-04-07 13:16:24 +02:00
|
|
|
static OUString CreateErrorMsgString( utl::Bootstrap::FailureCode nFailureCode,
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& aFileURL );
|
2001-10-09 11:12:08 +00:00
|
|
|
|
2011-04-01 21:06:41 +01:00
|
|
|
static void PreloadModuleData( const CommandLineArgs& );
|
2005-10-19 11:19:51 +00:00
|
|
|
static void PreloadConfigurationData();
|
|
|
|
|
2013-04-28 10:36:40 +02:00
|
|
|
css::uno::Reference<css::task::XStatusIndicator> m_rSplashScreen;
|
2003-04-04 16:22:07 +00:00
|
|
|
void OpenSplashScreen();
|
|
|
|
void CloseSplashScreen();
|
|
|
|
|
2015-05-08 19:11:38 +02:00
|
|
|
DECL_STATIC_LINK( Desktop, ImplInitFilterHdl, ConvertData* );
|
2015-05-05 13:11:02 +02:00
|
|
|
DECL_STATIC_LINK_TYPED( Desktop, AsyncInitFirstRun, Timer*, void );
|
2001-08-01 11:09:09 +00:00
|
|
|
/** checks if the office is run the first time
|
|
|
|
<p>If so, <method>DoFirstRunInitializations</method> is called (asynchronously and delayed) and the
|
|
|
|
respective flag in the configuration is reset.</p>
|
|
|
|
*/
|
2002-11-01 08:50:03 +00:00
|
|
|
void CheckFirstRun( );
|
2001-08-01 11:09:09 +00:00
|
|
|
|
|
|
|
/// does initializations which are necessary for the first run of the office
|
2015-04-07 13:16:24 +02:00
|
|
|
static void DoFirstRunInitializations();
|
2001-08-01 11:09:09 +00:00
|
|
|
|
2012-06-07 10:50:18 +02:00
|
|
|
static void ShowBackingComponent(Desktop * progress);
|
|
|
|
|
2014-05-08 11:43:26 +02:00
|
|
|
static bool SaveTasks();
|
2005-11-11 11:28:20 +00:00
|
|
|
|
2014-05-08 11:43:26 +02:00
|
|
|
static bool isUIOnSessionShutdownAllowed();
|
2003-06-10 13:37:19 +00:00
|
|
|
|
2003-03-25 12:52:54 +00:00
|
|
|
// on-demand acceptors
|
2014-01-24 19:27:41 +11:00
|
|
|
static void createAcceptor(const OUString& aDescription);
|
|
|
|
static void enableAcceptors();
|
|
|
|
static void destroyAcceptor(const OUString& aDescription);
|
2003-03-25 12:52:54 +00:00
|
|
|
|
2014-01-24 19:27:41 +11:00
|
|
|
bool m_bCleanedExtensionCache;
|
|
|
|
bool m_bServicesRegistered;
|
|
|
|
BootstrapError m_aBootstrapError;
|
|
|
|
OUString m_aBootstrapErrorMessage;
|
|
|
|
BootstrapStatus m_aBootstrapStatus;
|
2001-07-16 11:55:47 +00:00
|
|
|
|
2012-12-02 12:47:48 +00:00
|
|
|
boost::scoped_ptr<Lockfile> m_xLockfile;
|
2014-01-24 19:27:41 +11:00
|
|
|
Timer m_firstRunTimer;
|
2002-11-06 13:32:44 +00:00
|
|
|
|
2014-01-24 19:27:41 +11:00
|
|
|
static ResMgr* pResMgr;
|
2000-09-18 15:18:56 +00:00
|
|
|
};
|
|
|
|
|
2014-04-13 23:26:48 +02:00
|
|
|
OUString GetURL_Impl(
|
|
|
|
const OUString& rName, boost::optional< OUString > const & cwdUrl );
|
|
|
|
|
2014-06-25 14:57:44 +02:00
|
|
|
OUString ReplaceStringHookProc(const OUString& rStr);
|
|
|
|
|
2002-11-01 08:50:03 +00:00
|
|
|
}
|
|
|
|
|
2014-12-22 19:10:59 +01:00
|
|
|
#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined LIBO_HEADLESS
|
2014-11-20 15:23:18 +02:00
|
|
|
bool fire_glxtest_process();
|
|
|
|
#endif
|
|
|
|
|
2013-10-28 03:35:57 +01:00
|
|
|
#endif // INCLUDED_DESKTOP_INC_APP_HXX
|
2010-10-27 13:11:31 +01:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|