LCOV - code coverage report
Current view: top level - desktop/inc - app.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 5 10 50.0 %
Date: 2015-06-13 12:38:46 Functions: 2 3 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_DESKTOP_INC_APP_HXX
      21             : #define INCLUDED_DESKTOP_INC_APP_HXX
      22             : 
      23             : #include <boost/optional.hpp>
      24             : #include <boost/scoped_ptr.hpp>
      25             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      26             : #include <sal/log.hxx>
      27             : #include <vcl/svapp.hxx>
      28             : #include <vcl/timer.hxx>
      29             : #include <tools/resmgr.hxx>
      30             : #include <unotools/bootstrap.hxx>
      31             : #include <com/sun/star/task/XStatusIndicator.hpp>
      32             : #include <com/sun/star/uno/Reference.h>
      33             : #include <osl/mutex.hxx>
      34             : 
      35             : namespace com { namespace sun { namespace star { namespace uno {
      36             :     class XComponentContext;
      37             : } } } }
      38             : 
      39             : namespace desktop
      40             : {
      41             : 
      42             : /*--------------------------------------------------------------------
      43             :     Description:    Application-class
      44             :  --------------------------------------------------------------------*/
      45             : class CommandLineArgs;
      46             : class Lockfile;
      47             : struct ConvertData;
      48             : class Desktop : public Application
      49             : {
      50             :     int doShutdown();
      51             : 
      52             :     public:
      53             :         enum BootstrapError
      54             :         {
      55             :             BE_OK,
      56             :             BE_UNO_SERVICEMANAGER,
      57             :             BE_UNO_SERVICE_CONFIG_MISSING,
      58             :             BE_PATHINFO_MISSING,
      59             :             BE_USERINSTALL_FAILED,
      60             :             BE_LANGUAGE_MISSING,
      61             :             BE_USERINSTALL_NOTENOUGHDISKSPACE,
      62             :             BE_USERINSTALL_NOWRITEACCESS,
      63             :             BE_OFFICECONFIG_BROKEN
      64             :         };
      65             :         enum BootstrapStatus
      66             :         {
      67             :             BS_OK,
      68             :             BS_TERMINATE
      69             :         };
      70             : 
      71             :                                 Desktop();
      72             :                                 virtual ~Desktop();
      73             :         virtual int             Main( ) SAL_OVERRIDE;
      74             :         virtual void            Init() SAL_OVERRIDE;
      75             :         virtual void            InitFinished() SAL_OVERRIDE;
      76             :         virtual void            DeInit() SAL_OVERRIDE;
      77             :         virtual bool        QueryExit() SAL_OVERRIDE;
      78             :         virtual sal_uInt16      Exception(sal_uInt16 nError) SAL_OVERRIDE;
      79             :         virtual void            OverrideSystemSettings( AllSettings& rSettings ) SAL_OVERRIDE;
      80             :         virtual void            AppEvent( const ApplicationEvent& rAppEvent ) SAL_OVERRIDE;
      81             : 
      82             :         DECL_LINK( OpenClients_Impl, void* );
      83             : 
      84             :         static void             OpenClients();
      85             :         static void             OpenDefault();
      86             : 
      87             :         DECL_STATIC_LINK( Desktop, EnableAcceptors_Impl, void*);
      88             : 
      89             :         static void             HandleAppEvent( const ApplicationEvent& rAppEvent );
      90             :         static ResMgr*          GetDesktopResManager();
      91             :         static CommandLineArgs& GetCommandLineArgs();
      92             : 
      93             :         static void             HandleBootstrapErrors(
      94             :                                     BootstrapError nError, OUString const & aMessage );
      95           0 :         void                    SetBootstrapError(
      96             :                                     BootstrapError nError, OUString const & aMessage )
      97             :         {
      98           0 :             if ( m_aBootstrapError == BE_OK )
      99             :             {
     100             :                 SAL_INFO("desktop.app", "SetBootstrapError: " << nError << " '" << aMessage << "'");
     101           0 :                 m_aBootstrapError = nError;
     102           0 :                 m_aBootstrapErrorMessage = aMessage;
     103             :             }
     104           0 :         }
     105             : 
     106         116 :         void                    SetBootstrapStatus( BootstrapStatus nStatus )
     107             :         {
     108         116 :             m_aBootstrapStatus = nStatus;
     109         116 :         }
     110         116 :         BootstrapStatus          GetBootstrapStatus() const
     111             :         {
     112         116 :             return m_aBootstrapStatus;
     113             :         }
     114             : 
     115             :         static bool            isCrashReporterEnabled();
     116             : 
     117             :         // first-start (ever) related methods
     118             :         static bool             CheckExtensionDependencies();
     119             : 
     120             :         void                    SynchronizeExtensionRepositories();
     121             :         void                    SetSplashScreenText( const OUString& rText );
     122             :         void                    SetSplashScreenProgress( sal_Int32 );
     123             : 
     124             :         // Bootstrap methods
     125             :         static void             InitApplicationServiceManager();
     126             :             // throws an exception upon failure
     127             : 
     128             :     private:
     129             :         void                    RegisterServices(
     130             :                                     css::uno::Reference< css::uno::XComponentContext > const & context);
     131             :         static void             DeregisterServices();
     132             : 
     133             :         static void             CreateTemporaryDirectory();
     134             :         static void             RemoveTemporaryDirectory();
     135             : 
     136             :         bool                    InitializeInstallation( const OUString& rAppFilename );
     137             :         static bool             InitializeConfiguration();
     138             :         static void             FlushConfiguration();
     139             :         static bool             InitializeQuickstartMode( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
     140             : 
     141             :         static void             HandleBootstrapPathErrors( ::utl::Bootstrap::Status, const OUString& aMsg );
     142             :         void                    StartSetup( const OUString& aParameters );
     143             : 
     144             :         // Create a error message depending on bootstrap failure code and an optional file url
     145             :         static OUString         CreateErrorMsgString( utl::Bootstrap::FailureCode nFailureCode,
     146             :                                                       const OUString& aFileURL );
     147             : 
     148             :         static void             PreloadModuleData( const CommandLineArgs& );
     149             :         static void             PreloadConfigurationData();
     150             : 
     151             :         css::uno::Reference<css::task::XStatusIndicator> m_rSplashScreen;
     152             :         void                    OpenSplashScreen();
     153             :         void                    CloseSplashScreen();
     154             : 
     155             :         DECL_STATIC_LINK( Desktop, ImplInitFilterHdl, ConvertData* );
     156             :         DECL_STATIC_LINK_TYPED( Desktop, AsyncInitFirstRun, Timer*, void );
     157             :         /** checks if the office is run the first time
     158             :             <p>If so, <method>DoFirstRunInitializations</method> is called (asynchronously and delayed) and the
     159             :             respective flag in the configuration is reset.</p>
     160             :         */
     161             :         void                    CheckFirstRun( );
     162             : 
     163             :         /// does initializations which are necessary for the first run of the office
     164             :         static void             DoFirstRunInitializations();
     165             : 
     166             :         static void             ShowBackingComponent(Desktop * progress);
     167             : 
     168             :         static bool             SaveTasks();
     169             : 
     170             :         static bool             isUIOnSessionShutdownAllowed();
     171             : 
     172             :         // on-demand acceptors
     173             :         static void             createAcceptor(const OUString& aDescription);
     174             :         static void             enableAcceptors();
     175             :         static void             destroyAcceptor(const OUString& aDescription);
     176             : 
     177             :         bool                    m_bCleanedExtensionCache;
     178             :         bool                    m_bServicesRegistered;
     179             :         BootstrapError          m_aBootstrapError;
     180             :         OUString                m_aBootstrapErrorMessage;
     181             :         BootstrapStatus         m_aBootstrapStatus;
     182             : 
     183             :         boost::scoped_ptr<Lockfile> m_xLockfile;
     184             :         Timer                   m_firstRunTimer;
     185             : 
     186             :         static ResMgr*          pResMgr;
     187             : };
     188             : 
     189             : OUString GetURL_Impl(
     190             :     const OUString& rName, boost::optional< OUString > const & cwdUrl );
     191             : 
     192             : OUString ReplaceStringHookProc(const OUString& rStr);
     193             : 
     194             : }
     195             : 
     196             : #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined LIBO_HEADLESS
     197             : bool fire_glxtest_process();
     198             : #endif
     199             : 
     200             : #endif // INCLUDED_DESKTOP_INC_APP_HXX
     201             : 
     202             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11