1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _CPPUHELPER_COMPONENT_CONTEXT_HXX_ 24 #define _CPPUHELPER_COMPONENT_CONTEXT_HXX_ 25 26 #include <com/sun/star/uno/XComponentContext.hpp> 27 #include <com/sun/star/lang/XSingleComponentFactory.hpp> 28 29 30 namespace cppu 31 { 32 33 /** Context entries init struct calling createComponentContext(). 34 */ 35 struct ContextEntry_Init 36 { 37 /** late init denotes a object that will be raised when first get() is calling for it 38 39 The context implementation expects either a ::com::sun::star::lang::XSingleComponentFactory 40 object as value (to instanciate the object) or a string as value for raising 41 a service via the used service manager. 42 */ 43 bool bLateInitService; 44 /** name of context value 45 */ 46 ::rtl::OUString name; 47 /** context value 48 */ 49 ::com::sun::star::uno::Any value; 50 51 /** Default ctor. 52 */ 53 inline ContextEntry_Init() SAL_THROW( () ) 54 : bLateInitService( false ) 55 {} 56 /** Ctor. 57 58 @param name_ 59 name of entry 60 @param value_ 61 value of entry 62 @param bLateInitService_ 63 whether this entry is a late-init named object entry 64 (value is object factory or service string) 65 */ ContextEntry_Initcppu::ContextEntry_Init66 inline ContextEntry_Init( 67 ::rtl::OUString const & name_, 68 ::com::sun::star::uno::Any const & value_, 69 bool bLateInitService_ = false ) SAL_THROW( () ) 70 : bLateInitService( bLateInitService_ ), 71 name( name_ ), 72 value( value_ ) 73 {} 74 }; 75 76 /** Creates a component context with the given entries. 77 78 @param pEntries array of entries 79 @param nEntries number of entries 80 @param xDelegate delegation to further context, if value was not found 81 @return new context object 82 */ 83 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > 84 SAL_CALL createComponentContext( 85 ContextEntry_Init const * pEntries, sal_Int32 nEntries, 86 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xDelegate = 87 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() ) 88 SAL_THROW( () ); 89 90 } 91 92 #endif 93