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 : #ifndef INCLUDED_CPPUHELPER_COMPONENT_CONTEXT_HXX
20 : #define INCLUDED_CPPUHELPER_COMPONENT_CONTEXT_HXX
21 :
22 : #include <com/sun/star/uno/XComponentContext.hpp>
23 : #include <com/sun/star/lang/XSingleComponentFactory.hpp>
24 : #include <cppuhelper/cppuhelperdllapi.h>
25 :
26 :
27 : namespace cppu
28 : {
29 :
30 : /** Context entries init struct calling createComponentContext().
31 : */
32 94136 : struct ContextEntry_Init
33 : {
34 : /** late init denotes a object that will be raised when first get() is calling for it
35 :
36 : The context implementation expects either a com::sun::star::lang::XSingleComponentFactory
37 : object as value (to instanciate the object) or a string as value for raising
38 : a service via the used service manager.
39 : */
40 : bool bLateInitService;
41 : /** name of context value
42 : */
43 : ::rtl::OUString name;
44 : /** context value
45 : */
46 : ::com::sun::star::uno::Any value;
47 :
48 : /** Default ctor.
49 : */
50 14655 : inline ContextEntry_Init()
51 14655 : : bLateInitService( false )
52 14655 : {}
53 : /** Ctor.
54 :
55 : @param name_
56 : name of entry
57 : @param value_
58 : value of entry
59 : @param bLateInitService_
60 : whether this entry is a late-init named object entry
61 : (value is object factory or service string)
62 : */
63 13991 : inline ContextEntry_Init(
64 : ::rtl::OUString const & name_,
65 : ::com::sun::star::uno::Any const & value_,
66 : bool bLateInitService_ = false )
67 : : bLateInitService( bLateInitService_ ),
68 : name( name_ ),
69 13991 : value( value_ )
70 13991 : {}
71 : };
72 :
73 : /** Creates a component context with the given entries.
74 :
75 : @param pEntries array of entries
76 : @param nEntries number of entries
77 : @param xDelegate delegation to further context, if value was not found
78 : @return new context object
79 : */
80 : CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
81 : SAL_CALL createComponentContext(
82 : ContextEntry_Init const * pEntries, sal_Int32 nEntries,
83 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xDelegate =
84 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() );
85 :
86 : }
87 :
88 : #endif
89 :
90 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|