1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 // Use UNICODE Windows and C API.
25 #pragma warning(push, 1)
34 #include "native_share.h"
36 #include "rtl/bootstrap.hxx"
37 #include "com/sun/star/uno/XComponentContext.hpp"
38 #include "cppuhelper/bootstrap.hxx"
41 using namespace ::com::sun::star
;
42 using namespace ::com::sun::star::uno
;
49 /** Bootstrapping native UNO.
51 Bootstrapping requires the existence of many libraries which are contained
52 in an URE installation. To find and load these libraries the Windows
53 registry keys HKEY_CURRENT_USER\Software\LibreOffice\Layer\URE\1
54 and HKEY_LOCAL_MACHINE\Software\LibreOffice\Layer\URE\1 are examined.
55 These contain a named value UREINSTALLLOCATION which holds a path to the URE
58 public ref
class Bootstrap sealed
64 /** Bootstraps the initial component context from a native UNO installation.
66 @see cppuhelper/bootstrap.hxx:defaultBootstrap_InitialComponentContext()
68 static ::unoidl::com::sun::star::uno::XComponentContext
^
69 defaultBootstrap_InitialComponentContext();
71 /** Bootstraps the initial component context from a native UNO installation.
74 a file URL of an ini file, e.g. uno.ini/unorc. (The ini file must
75 reside next to the cppuhelper library)
76 @param bootstrap_parameters
77 bootstrap parameters (maybe null)
79 @see cppuhelper/bootstrap.hxx:defaultBootstrap_InitialComponentContext()
81 static ::unoidl::com::sun::star::uno::XComponentContext
^
82 defaultBootstrap_InitialComponentContext(
83 ::System::String
^ ini_file
,
84 ::System::Collections::IDictionaryEnumerator
^
85 bootstrap_parameters
);
87 /** Bootstraps the initial component context from a native UNO installation.
89 @see cppuhelper/bootstrap.hxx:bootstrap()
91 static ::unoidl::com::sun::star::uno::XComponentContext
^
96 ::unoidl::com::sun::star::uno::XComponentContext
^
97 Bootstrap::defaultBootstrap_InitialComponentContext(
98 ::System::String
^ ini_file
,
99 ::System::Collections::IDictionaryEnumerator
^ bootstrap_parameters
)
101 if (nullptr != bootstrap_parameters
)
103 bootstrap_parameters
->Reset();
104 while (bootstrap_parameters
->MoveNext())
107 String_to_ustring( safe_cast
< ::System::String
^ >(
108 bootstrap_parameters
->Key
) ) );
110 String_to_ustring( safe_cast
< ::System::String
^ >(
111 bootstrap_parameters
->Value
) ) );
113 ::rtl::Bootstrap::set( key
, value
);
117 // bootstrap native uno
118 Reference
< XComponentContext
> xContext
;
119 if (nullptr == ini_file
)
121 xContext
= ::cppu::defaultBootstrap_InitialComponentContext();
125 xContext
= ::cppu::defaultBootstrap_InitialComponentContext(
126 String_to_ustring( safe_cast
< ::System::String
^ >( ini_file
) ) );
129 return safe_cast
< ::unoidl::com::sun::star::uno::XComponentContext
^ >(
130 to_cli( xContext
) );
134 ::unoidl::com::sun::star::uno::XComponentContext
^
135 Bootstrap::defaultBootstrap_InitialComponentContext()
137 return defaultBootstrap_InitialComponentContext( nullptr, nullptr );
140 ::unoidl::com::sun::star::uno::XComponentContext
^ Bootstrap::bootstrap()
142 Reference
<XComponentContext
> xContext
= ::cppu::bootstrap();
143 return safe_cast
< ::unoidl::com::sun::star::uno::XComponentContext
^ >(
144 to_cli( xContext
) );
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */