LCOV - code coverage report
Current view: top level - desktop/inc - app.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 5 10 50.0 %
Date: 2014-11-03 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 <vcl/svapp.hxx>
      27             : #include <vcl/timer.hxx>
      28             : #include <tools/resmgr.hxx>
      29             : #include <unotools/bootstrap.hxx>
      30             : #include <com/sun/star/task/XStatusIndicator.hpp>
      31             : #include <com/sun/star/uno/Reference.h>
      32             : #include <osl/mutex.hxx>
      33             : 
      34             : namespace com { namespace sun { namespace star { namespace uno {
      35             :     class XComponentContext;
      36             : } } } }
      37             : 
      38             : namespace desktop
      39             : {
      40             : 
      41             : /*--------------------------------------------------------------------
      42             :     Description:    Application-class
      43             :  --------------------------------------------------------------------*/
      44             : class CommandLineArgs;
      45             : class Lockfile;
      46             : struct ConvertData;
      47             : class Desktop : public Application
      48             : {
      49             :     int doShutdown();
      50             : 
      51             :     public:
      52             :         enum BootstrapError
      53             :         {
      54             :             BE_OK,
      55             :             BE_UNO_SERVICEMANAGER,
      56             :             BE_UNO_SERVICE_CONFIG_MISSING,
      57             :             BE_PATHINFO_MISSING,
      58             :             BE_USERINSTALL_FAILED,
      59             :             BE_LANGUAGE_MISSING,
      60             :             BE_USERINSTALL_NOTENOUGHDISKSPACE,
      61             :             BE_USERINSTALL_NOWRITEACCESS,
      62             :             BE_OFFICECONFIG_BROKEN
      63             :         };
      64             :         enum BootstrapStatus
      65             :         {
      66             :             BS_OK,
      67             :             BS_TERMINATE
      68             :         };
      69             : 
      70             :                                 Desktop();
      71             :                                 virtual ~Desktop();
      72             :         virtual int             Main( ) SAL_OVERRIDE;
      73             :         virtual void            Init() SAL_OVERRIDE;
      74             :         virtual void            InitFinished() SAL_OVERRIDE;
      75             :         virtual void            DeInit() SAL_OVERRIDE;
      76             :         virtual bool        QueryExit() SAL_OVERRIDE;
      77             :         virtual sal_uInt16      Exception(sal_uInt16 nError) SAL_OVERRIDE;
      78             :         virtual void            OverrideSystemSettings( AllSettings& rSettings ) SAL_OVERRIDE;
      79             :         virtual void            AppEvent( const ApplicationEvent& rAppEvent ) SAL_OVERRIDE;
      80             : 
      81             :         DECL_LINK( OpenClients_Impl, void* );
      82             : 
      83             :         static void             OpenClients();
      84             :         static void             OpenDefault();
      85             : 
      86             :         DECL_LINK( EnableAcceptors_Impl, void*);
      87             : 
      88             :         static void             HandleAppEvent( const ApplicationEvent& rAppEvent );
      89             :         static ResMgr*          GetDesktopResManager();
      90             :         static CommandLineArgs& GetCommandLineArgs();
      91             : 
      92             :         void                    HandleBootstrapErrors(
      93             :                                     BootstrapError nError, OUString const & aMessage );
      94           0 :         void                    SetBootstrapError(
      95             :                                     BootstrapError nError, OUString const & aMessage )
      96             :         {
      97           0 :             if ( m_aBootstrapError == BE_OK )
      98             :             {
      99           0 :                 m_aBootstrapError = nError;
     100           0 :                 m_aBootstrapErrorMessage = aMessage;
     101             :             }
     102           0 :         }
     103             : 
     104         160 :         void                    SetBootstrapStatus( BootstrapStatus nStatus )
     105             :         {
     106         160 :             m_aBootstrapStatus = nStatus;
     107         160 :         }
     108         160 :         BootstrapStatus          GetBootstrapStatus() const
     109             :         {
     110         160 :             return m_aBootstrapStatus;
     111             :         }
     112             : 
     113             :         static bool            isCrashReporterEnabled();
     114             : 
     115             :         // first-start (ever) related methods
     116             :         static bool             CheckExtensionDependencies();
     117             : 
     118             :         void                    SynchronizeExtensionRepositories();
     119             :         void                    SetSplashScreenText( const OUString& rText );
     120             :         void                    SetSplashScreenProgress( sal_Int32 );
     121             : 
     122             :         // Bootstrap methods
     123             :         static void             InitApplicationServiceManager();
     124             :             // throws an exception upon failure
     125             : 
     126             :     private:
     127             :         void                    RegisterServices(
     128             :                                     css::uno::Reference< css::uno::XComponentContext > const & context);
     129             :         void                    DeregisterServices();
     130             : 
     131             :         void                    CreateTemporaryDirectory();
     132             :         void                    RemoveTemporaryDirectory();
     133             : 
     134             :         bool                    InitializeInstallation( const OUString& rAppFilename );
     135             :         bool                    InitializeConfiguration();
     136             :         void                    FlushConfiguration();
     137             :         bool                    InitializeQuickstartMode( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
     138             : 
     139             :         void                    HandleBootstrapPathErrors( ::utl::Bootstrap::Status, const OUString& aMsg );
     140             :         void                    StartSetup( const OUString& aParameters );
     141             : 
     142             :         // Create a error message depending on bootstrap failure code and an optional file url
     143             :         OUString                CreateErrorMsgString( utl::Bootstrap::FailureCode nFailureCode,
     144             :                                                       const OUString& aFileURL );
     145             : 
     146             :         static void             PreloadModuleData( const CommandLineArgs& );
     147             :         static void             PreloadConfigurationData();
     148             : 
     149             :         css::uno::Reference<css::task::XStatusIndicator> m_rSplashScreen;
     150             :         void                    OpenSplashScreen();
     151             :         void                    CloseSplashScreen();
     152             : 
     153             :         void                    EnableOleAutomation();
     154             :                                 DECL_LINK( ImplInitFilterHdl, ConvertData* );
     155             :         DECL_LINK( AsyncInitFirstRun, void* );
     156             :         /** checks if the office is run the first time
     157             :             <p>If so, <method>DoFirstRunInitializations</method> is called (asynchronously and delayed) and the
     158             :             respective flag in the configuration is reset.</p>
     159             :         */
     160             :         void                    CheckFirstRun( );
     161             : 
     162             :         /// does initializations which are necessary for the first run of the office
     163             :         void                    DoFirstRunInitializations();
     164             : 
     165             :         static void             ShowBackingComponent(Desktop * progress);
     166             : 
     167             :         static bool             SaveTasks();
     168             : 
     169             :         static bool             isUIOnSessionShutdownAllowed();
     170             : 
     171             :         // on-demand acceptors
     172             :         static void             createAcceptor(const OUString& aDescription);
     173             :         static void             enableAcceptors();
     174             :         static void             destroyAcceptor(const OUString& aDescription);
     175             : 
     176             :         bool                    m_bCleanedExtensionCache;
     177             :         bool                    m_bServicesRegistered;
     178             :         BootstrapError          m_aBootstrapError;
     179             :         OUString                m_aBootstrapErrorMessage;
     180             :         BootstrapStatus         m_aBootstrapStatus;
     181             : 
     182             :         boost::scoped_ptr<Lockfile> m_xLockfile;
     183             :         Timer                   m_firstRunTimer;
     184             : 
     185             :         static ResMgr*          pResMgr;
     186             : };
     187             : 
     188             : OUString GetURL_Impl(
     189             :     const OUString& rName, boost::optional< OUString > const & cwdUrl );
     190             : 
     191             : OUString ReplaceStringHookProc(const OUString& rStr);
     192             : 
     193             : }
     194             : 
     195             : #endif // INCLUDED_DESKTOP_INC_APP_HXX
     196             : 
     197             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10