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 // MARKER(update_precomp.py): autogen include statement, do not remove
23 #include "precompiled_cppuhelper.hxx"
24 
25 // The only purpose of this file is to workaround a problem in UNO:
26 // Cppumaker and its brethren emit different implementations for
27 // the same symbol by design (!) which is quite... unfortunate
28 // and can confuse the heck out of dynamic linkers, debuggers, etc.
29 //
30 // For bootstrapping the comprehensive descriptions of some UNO types are needed.
31 // The mechanism in this file makes sure that these comprehensive type
32 // descriptions are used to prime the so-called "WeakMap".
33 //
34 // TODO: change cppumaker and its brethren to use different symbol names
35 //       for different implementations. In particular "cppu_detail_getUnoType"
36 //       should be divided into full, weak and mini implementations.
37 
38 // Types that are candidates for this special workaround are the ones mentioned
39 // by the exceptions thrown from implbase_ex.cxx's __queryDeepNoXInterface()
40 // that also need to added to the makefile's UNOTYPES define
41 
42 #define cppu_detail_getUnoType cppu_full_getUnoType
43 #define InitTypeDesc(T) {(void)cppu_full_getUnoType(static_cast< T * >(NULL));}
44 
45 // NOTE: the cppuhelper part in the include paths below ensures that the type descriptions
46 // are comprehensive descriptions and not some weak descriptions e.g. from solver
47 #include "cppuhelper/com/sun/star/lang/XComponent.hpp"
48 #include "cppuhelper/com/sun/star/lang/XInitialization.hpp"
49 #include "cppuhelper/com/sun/star/lang/XSingleServiceFactory.hpp"
50 #include "cppuhelper/com/sun/star/lang/XSingleComponentFactory.hpp"
51 #include "cppuhelper/com/sun/star/lang/XMultiServiceFactory.hpp"
52 #include "cppuhelper/com/sun/star/lang/XMultiComponentFactory.hpp"
53 #include "cppuhelper/com/sun/star/lang/XServiceInfo.hpp"
54 #include "cppuhelper/com/sun/star/lang/XEventListener.hpp"
55 #include "cppuhelper/com/sun/star/lang/XTypeProvider.hpp"
56 #include "cppuhelper/com/sun/star/lang/XUnoTunnel.hpp"
57 #include "cppuhelper/com/sun/star/lang/DisposedException.hpp"
58 #include "cppuhelper/com/sun/star/uno/DeploymentException.hpp"
59 #include "cppuhelper/com/sun/star/uno/XWeak.hpp"
60 #include "cppuhelper/com/sun/star/uno/XCurrentContext.hpp"
61 #include "cppuhelper/com/sun/star/uno/XComponentContext.hpp"
62 #include "cppuhelper/com/sun/star/uno/RuntimeException.hpp"
63 #include "cppuhelper/com/sun/star/util/XMacroExpander.hpp"
64 #include "cppuhelper/com/sun/star/beans/PropertyValue.hpp"
65 #include "cppuhelper/com/sun/star/beans/XPropertySet.hpp"
66 #include "cppuhelper/com/sun/star/beans/XMultiPropertySet.hpp"
67 #include "cppuhelper/com/sun/star/container/XContentEnumerationAccess.hpp"
68 #include "cppuhelper/com/sun/star/container/XEnumerationAccess.hpp"
69 #include "cppuhelper/com/sun/star/container/XEnumeration.hpp"
70 #include "cppuhelper/com/sun/star/container/XNameAccess.hpp"
71 #include "cppuhelper/com/sun/star/container/XNameReplace.hpp"
72 #include "cppuhelper/com/sun/star/container/XNameContainer.hpp"
73 #include "cppuhelper/com/sun/star/container/XHierarchicalNameAccess.hpp"
74 #include "cppuhelper/com/sun/star/container/XSet.hpp"
75 #include "cppuhelper/com/sun/star/bridge/XUnoUrlResolver.hpp"
76 #include "cppuhelper/com/sun/star/io/IOException.hpp"
77 #include "cppuhelper/com/sun/star/io/FilePermission.hpp"
78 #include "cppuhelper/com/sun/star/security/RuntimePermission.hpp"
79 #include "cppuhelper/com/sun/star/loader/XImplementationLoader.hpp"
80 #include "cppuhelper/com/sun/star/security/XAccessController.hpp"
81 #include "cppuhelper/com/sun/star/registry/XRegistryKey.hpp"
82 #include "cppuhelper/com/sun/star/registry/XSimpleRegistry.hpp"
83 #include "cppuhelper/com/sun/star/reflection/XTypeDescription.hpp"
84 #include "cppuhelper/com/sun/star/reflection/XEnumTypeDescription.hpp"
85 #include "cppuhelper/com/sun/star/reflection/XArrayTypeDescription.hpp"
86 #include "cppuhelper/com/sun/star/reflection/XStructTypeDescription.hpp"
87 #include "cppuhelper/com/sun/star/reflection/XUnionTypeDescription.hpp"
88 #include "cppuhelper/com/sun/star/reflection/XCompoundTypeDescription.hpp"
89 #include "cppuhelper/com/sun/star/reflection/XIndirectTypeDescription.hpp"
90 #include "cppuhelper/com/sun/star/reflection/XInterfaceTypeDescription.hpp"
91 #include "cppuhelper/com/sun/star/reflection/XInterfaceMemberTypeDescription.hpp"
92 #include "cppuhelper/com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp"
93 #include "cppuhelper/com/sun/star/reflection/XMethodParameter.hpp"
94 
primeWeakMap(void)95 void primeWeakMap( void)
96 {
97 	InitTypeDesc( com::sun::star::lang::XComponent );
98 	InitTypeDesc( com::sun::star::lang::XInitialization );
99 	InitTypeDesc( com::sun::star::lang::XSingleServiceFactory );
100 	InitTypeDesc( com::sun::star::lang::XSingleComponentFactory );
101 	InitTypeDesc( com::sun::star::lang::XMultiServiceFactory );
102 	InitTypeDesc( com::sun::star::lang::XMultiComponentFactory );
103 	InitTypeDesc( com::sun::star::lang::XServiceInfo );
104 	InitTypeDesc( com::sun::star::lang::XEventListener );
105 	InitTypeDesc( com::sun::star::lang::XTypeProvider );
106 	InitTypeDesc( com::sun::star::lang::XUnoTunnel );
107 	InitTypeDesc( com::sun::star::lang::DisposedException );
108 	InitTypeDesc( com::sun::star::uno::XWeak );
109 	InitTypeDesc( com::sun::star::uno::DeploymentException );
110 	InitTypeDesc( com::sun::star::uno::XCurrentContext );
111 	InitTypeDesc( com::sun::star::uno::XComponentContext );
112 	InitTypeDesc( com::sun::star::uno::RuntimeException );
113 	InitTypeDesc( com::sun::star::util::XMacroExpander );
114 	InitTypeDesc( com::sun::star::beans::PropertyState );
115 	InitTypeDesc( com::sun::star::beans::PropertyValue );
116 	InitTypeDesc( com::sun::star::beans::XPropertySet );
117 	InitTypeDesc( com::sun::star::beans::XMultiPropertySet );
118 	InitTypeDesc( com::sun::star::container::XElementAccess );
119 	InitTypeDesc( com::sun::star::container::XEnumeration );
120 	InitTypeDesc( com::sun::star::container::XEnumerationAccess );
121 	InitTypeDesc( com::sun::star::container::XContentEnumerationAccess );
122 	InitTypeDesc( com::sun::star::container::XHierarchicalNameAccess );
123 	InitTypeDesc( com::sun::star::container::XNameAccess );
124 	InitTypeDesc( com::sun::star::container::XNameReplace );
125 	InitTypeDesc( com::sun::star::container::XNameContainer );
126 	InitTypeDesc( com::sun::star::container::XSet );
127 	InitTypeDesc( com::sun::star::io::IOException );
128 	InitTypeDesc( com::sun::star::io::FilePermission );
129 	InitTypeDesc( com::sun::star::security::XAccessController );
130 	InitTypeDesc( com::sun::star::security::RuntimePermission);
131 	InitTypeDesc( com::sun::star::loader::XImplementationLoader );
132 	InitTypeDesc( com::sun::star::bridge::XUnoUrlResolver );
133 	InitTypeDesc( com::sun::star::registry::XRegistryKey );
134 	InitTypeDesc( com::sun::star::registry::XSimpleRegistry );
135 	InitTypeDesc( com::sun::star::reflection::XTypeDescription );
136 	InitTypeDesc( com::sun::star::reflection::XEnumTypeDescription );
137 	InitTypeDesc( com::sun::star::reflection::XArrayTypeDescription );
138 	InitTypeDesc( com::sun::star::reflection::XStructTypeDescription );
139 	InitTypeDesc( com::sun::star::reflection::XUnionTypeDescription );
140 	InitTypeDesc( com::sun::star::reflection::XCompoundTypeDescription );
141 	InitTypeDesc( com::sun::star::reflection::XIndirectTypeDescription );
142 	InitTypeDesc( com::sun::star::reflection::XInterfaceTypeDescription );
143 	InitTypeDesc( com::sun::star::reflection::XInterfaceMemberTypeDescription );
144 	InitTypeDesc( com::sun::star::reflection::XInterfaceMethodTypeDescription );
145 	InitTypeDesc( com::sun::star::reflection::XMethodParameter );
146 }
147 
148