LibreOffice Module desktop (master)
1
desktop
source
app
sofficemain.cxx
Go to the documentation of this file.
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
#include <config_features.h>
22
23
#include <
desktop/dllapi.h
>
24
25
#include <app.hxx>
26
#include "
cmdlineargs.hxx
"
27
#include "
cmdlinehelp.hxx
"
28
29
// needed before sal/main.h to avoid redefinition of macros
30
#include <prewin.h>
31
32
#include <rtl/bootstrap.hxx>
33
#include <
sal/log.hxx
>
34
#include <
sal/main.h
>
35
#include <
tools/extendapplicationenvironment.hxx
>
36
#include <
vcl/svmain.hxx
>
37
38
#if HAVE_FEATURE_BREAKPAD
39
#include <
desktop/crashreport.hxx
>
40
#endif
41
42
#include <postwin.h>
43
44
#ifdef ANDROID
45
# include <jni.h>
46
# include <android/log.h>
47
# include <
salhelper/thread.hxx
>
48
49
# define LOGTAG "LibreOffice/sofficemain"
50
# define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, LOGTAG, __VA_ARGS__))
51
#endif
52
53
extern
"C"
int
DESKTOP_DLLPUBLIC
soffice_main
()
54
{
55
sal_detail_initialize
(sal::detail::InitializeSoffice,
nullptr
);
56
57
#if HAVE_FEATURE_BREAKPAD
58
CrashReporter::installExceptionHandler();
59
#endif
60
61
#if defined ANDROID
62
try
{
63
rtl::Bootstrap::setIniFilename(
"file:///assets/program/lofficerc"
);
64
#endif
65
tools::extendApplicationEnvironment
();
66
67
desktop::Desktop
aDesktop;
68
// This string is used during initialization of the Gtk+ VCL module
69
Application::SetAppName
(
"soffice"
);
70
71
// handle --version and --help already here, otherwise they would be handled
72
// after VCL initialization that might fail if $DISPLAY is not set
73
const
desktop::CommandLineArgs
& rCmdLineArgs =
desktop::Desktop::GetCommandLineArgs
();
74
const
OUString& aUnknown( rCmdLineArgs.
GetUnknown
() );
75
if
( !aUnknown.isEmpty() )
76
{
77
desktop::Desktop::InitApplicationServiceManager
();
78
desktop::displayCmdlineHelp
( aUnknown );
79
return
EXIT_FAILURE;
80
}
81
if
( rCmdLineArgs.
IsHelp
() )
82
{
83
desktop::Desktop::InitApplicationServiceManager
();
84
desktop::displayCmdlineHelp
( OUString() );
85
return
EXIT_SUCCESS;
86
}
87
if
( rCmdLineArgs.
IsVersion
() )
88
{
89
desktop::Desktop::InitApplicationServiceManager
();
90
desktop::displayVersion
();
91
return
EXIT_SUCCESS;
92
}
93
94
return
SVMain
();
95
#if defined ANDROID
96
}
catch
(
const
css::uno::Exception &e) {
97
LOGI
(
"Unhandled UNO exception: '%s'"
,
98
OUStringToOString
(e.Message, RTL_TEXTENCODING_UTF8).getStr());
99
throw
;
// to get exception type printed
100
}
101
#endif
102
}
103
104
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
LOGI
#define LOGI(...)
Application::SetAppName
static void SetAppName(const OUString &rUniqueName)
desktop::CommandLineArgs
Definition:
cmdlineargs.hxx:33
desktop::CommandLineArgs::IsHelp
bool IsHelp() const
Definition:
cmdlineargs.hxx:73
desktop::CommandLineArgs::GetUnknown
const OUString & GetUnknown() const
Definition:
cmdlineargs.hxx:96
desktop::CommandLineArgs::IsVersion
bool IsVersion() const
Definition:
cmdlineargs.hxx:89
desktop::Desktop
Definition:
app.hxx:47
desktop::Desktop::InitApplicationServiceManager
static void InitApplicationServiceManager()
Definition:
appinit.cxx:63
desktop::Desktop::GetCommandLineArgs
static CommandLineArgs & GetCommandLineArgs()
Definition:
app.cxx:393
cmdlineargs.hxx
cmdlinehelp.hxx
config.h
crashreport.hxx
dllapi.h
DESKTOP_DLLPUBLIC
#define DESKTOP_DLLPUBLIC
Definition:
dllapi.h:19
extendapplicationenvironment.hxx
log.hxx
main.h
sal_detail_initialize
SAL_DLLPUBLIC void SAL_CALL sal_detail_initialize(int argc, char **argv)
desktop::displayVersion
void displayVersion()
Definition:
cmdlinehelp.cxx:255
desktop::displayCmdlineHelp
void displayCmdlineHelp(OUString const &unknown)
Definition:
cmdlinehelp.cxx:237
OUStringToOString
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
tools::extendApplicationEnvironment
void extendApplicationEnvironment()
soffice_main
int DESKTOP_DLLPUBLIC soffice_main()
Definition:
sofficemain.cxx:53
svmain.hxx
SVMain
VCL_DLLPUBLIC int SVMain()
thread.hxx
Generated on Sun Jul 30 2023 04:27:00 for LibreOffice Module desktop (master) by
1.9.3