LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/desktop/source/app - sofficemain.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 11 20 55.0 %
Date: 2013-07-09 Functions: 3 3 100.0 %
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             : #include "sal/config.h"
      21             : 
      22             : #include "desktopdllapi.h"
      23             : 
      24             : #include "app.hxx"
      25             : #include "exithelper.h"
      26             : #include "cmdlineargs.hxx"
      27             : #include "cmdlinehelp.hxx"
      28             : 
      29             : #include <rtl/bootstrap.hxx>
      30             : #include <tools/extendapplicationenvironment.hxx>
      31             : 
      32             : 
      33             : #ifdef ANDROID
      34             : #  include <jni.h>
      35             : #  include <android/log.h>
      36             : #  include <salhelper/thread.hxx>
      37             : 
      38             : #  define LOGTAG "LibreOffice/sofficemain"
      39             : #  define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, LOGTAG, __VA_ARGS__))
      40             : #endif
      41             : 
      42             : int SVMain();
      43             : 
      44          83 : extern "C" int DESKTOP_DLLPUBLIC soffice_main()
      45             : {
      46             : #if defined ANDROID
      47             :     try {
      48             :         rtl::Bootstrap::setIniFilename("file:///assets/program/lofficerc");
      49             : #endif
      50          83 :     tools::extendApplicationEnvironment();
      51             : 
      52             :     SAL_INFO("desktop.app", "PERFORMANCE - enter Main()" );
      53             : 
      54          83 :     desktop::Desktop aDesktop;
      55             :     // This string is used during initialization of the Gtk+ VCL module
      56          83 :     aDesktop.SetAppName( OUString("soffice") );
      57             : #ifdef UNX
      58             :     // handle --version and --help already here, otherwise they would be handled
      59             :     // after VCL initialization that might fail if $DISPLAY is not set
      60          83 :     const desktop::CommandLineArgs& rCmdLineArgs = aDesktop.GetCommandLineArgs();
      61         166 :     OUString aUnknown( rCmdLineArgs.GetUnknown() );
      62          83 :     if ( !aUnknown.isEmpty() )
      63             :     {
      64           0 :         desktop::Desktop::InitApplicationServiceManager();
      65           0 :         desktop::displayCmdlineHelp( aUnknown );
      66           0 :         return EXIT_FAILURE;
      67             :     }
      68          83 :     if ( rCmdLineArgs.IsHelp() )
      69             :     {
      70           0 :         desktop::Desktop::InitApplicationServiceManager();
      71           0 :         desktop::displayCmdlineHelp( OUString() );
      72           0 :         return EXIT_SUCCESS;
      73             :     }
      74          83 :     if ( rCmdLineArgs.IsVersion() )
      75             :     {
      76           0 :         desktop::Desktop::InitApplicationServiceManager();
      77           0 :         desktop::displayVersion();
      78           0 :         return EXIT_SUCCESS;
      79             :     }
      80             : #endif
      81         166 :     return SVMain();
      82             : #if defined ANDROID
      83             :     } catch (const ::com::sun::star::uno::Exception &e) {
      84             :         LOGI("Unhandled UNO exception: '%s'",
      85             :              OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
      86             :         throw; // to get exception type printed
      87             :     }
      88             : #endif
      89         249 : }
      90             : 
      91             : #if defined(ANDROID) || defined(IOS)
      92             : 
      93             : #ifdef ANDROID
      94             : extern "C" SAL_JNI_EXPORT void JNICALL
      95             : Java_org_libreoffice_android_AppSupport_runMain(JNIEnv* /* env */,
      96             :                                                 jobject /* clazz */)
      97             : #else
      98             : extern "C"
      99             : void
     100             : lo_runMain()
     101             : #endif
     102             : {
     103             :     int nRet;
     104             :     do {
     105             :         nRet = soffice_main();
     106             : #ifdef ANDROID
     107             :         LOGI("soffice_main returned %d", nRet);
     108             : #endif
     109             :     } while (nRet == EXITHELPER_NORMAL_RESTART ||
     110             :              nRet == EXITHELPER_CRASH_WITH_RESTART); // pretend to re-start.
     111             : 
     112             : }
     113             : 
     114             : #endif
     115             : 
     116             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10