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 "dp_misc.h"
21 : #include "com/sun/star/uno/Exception.hpp"
22 : #include "com/sun/star/uno/XComponentContext.hpp"
23 : #include "com/sun/star/ucb/XCommandEnvironment.hpp"
24 : #include "com/sun/star/deployment/XPackage.hpp"
25 : #include "tools/resmgr.hxx"
26 : #include "rtl/ustring.hxx"
27 : #include "unotools/configmgr.hxx"
28 : #include <i18nlangtag/languagetag.hxx>
29 :
30 : #define APP_NAME "unopkg"
31 :
32 : namespace unopkg {
33 :
34 : struct DeploymentResMgr : public rtl::StaticWithInit< ResMgr *, DeploymentResMgr >
35 : {
36 0 : ResMgr * operator () () {
37 : return ResMgr::CreateResMgr(
38 0 : "deployment", LanguageTag( utl::ConfigManager::getLocale() ) );
39 : }
40 : };
41 :
42 : struct OptionInfo
43 : {
44 : char const * m_name;
45 : sal_uInt32 m_name_length;
46 : sal_Unicode m_short_option;
47 : bool m_has_argument;
48 : };
49 :
50 0 : struct LockFileException : public css::uno::Exception
51 : {
52 0 : LockFileException(OUString const & sMessage) :
53 0 : css::uno::Exception(sMessage, css::uno::Reference< css::uno::XInterface > ()) {}
54 : };
55 :
56 :
57 : OUString toString( OptionInfo const * info );
58 :
59 :
60 : OptionInfo const * getOptionInfo(
61 : OptionInfo const * list,
62 : OUString const & opt, sal_Unicode copt = '\0' );
63 :
64 :
65 : bool isOption( OptionInfo const * option_info, sal_uInt32 * pIndex );
66 :
67 :
68 : bool readArgument(
69 : OUString * pValue, OptionInfo const * option_info,
70 : sal_uInt32 * pIndex );
71 :
72 :
73 0 : inline bool readOption(
74 : bool * flag, OptionInfo const * option_info, sal_uInt32 * pIndex )
75 : {
76 0 : if (isOption( option_info, pIndex )) {
77 : OSL_ASSERT( flag != 0 );
78 0 : *flag = true;
79 0 : return true;
80 : }
81 0 : return false;
82 : }
83 :
84 :
85 : /** checks if an argument is a bootstrap variable. These start with -env:. For example
86 : -env:UNO_JAVA_JFW_USER_DATA=file:///d:/user
87 : */
88 : bool isBootstrapVariable(sal_uInt32 * pIndex);
89 :
90 : OUString const & getExecutableDir();
91 :
92 :
93 : OUString const & getProcessWorkingDir();
94 :
95 :
96 : OUString makeAbsoluteFileUrl(
97 : OUString const & sys_path, OUString const & base_url,
98 : bool throw_exc = true );
99 :
100 :
101 :
102 :
103 : css::uno::Reference<css::ucb::XCommandEnvironment> createCmdEnv(
104 : css::uno::Reference<css::uno::XComponentContext> const & xContext,
105 : OUString const & logFile,
106 : bool option_force_overwrite,
107 : bool option_verbose,
108 : bool option_suppressLicense);
109 :
110 : void printf_packages(
111 : ::std::vector<
112 : css::uno::Reference<css::deployment::XPackage> > const & allExtensions,
113 : ::std::vector<bool> const & vecUnaccepted,
114 : css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv,
115 : sal_Int32 level = 0 );
116 :
117 :
118 :
119 :
120 : css::uno::Reference<css::uno::XComponentContext> getUNO(
121 : bool verbose, bool shared, bool bGui,
122 : css::uno::Reference<css::uno::XComponentContext> & out_LocalComponentContext);
123 :
124 : }
125 :
126 :
127 :
128 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|