xref: /AOO41X/main/odk/examples/java/Inspector/Introspector.java (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  *  The Contents of this file are made available subject to the terms of
4*cdf0e10cSrcweir  *  the BSD license.
5*cdf0e10cSrcweir  *
6*cdf0e10cSrcweir  *  Copyright 2000, 2010 Oracle and/or its affiliates.
7*cdf0e10cSrcweir  *  All rights reserved.
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  *  Redistribution and use in source and binary forms, with or without
10*cdf0e10cSrcweir  *  modification, are permitted provided that the following conditions
11*cdf0e10cSrcweir  *  are met:
12*cdf0e10cSrcweir  *  1. Redistributions of source code must retain the above copyright
13*cdf0e10cSrcweir  *     notice, this list of conditions and the following disclaimer.
14*cdf0e10cSrcweir  *  2. Redistributions in binary form must reproduce the above copyright
15*cdf0e10cSrcweir  *     notice, this list of conditions and the following disclaimer in the
16*cdf0e10cSrcweir  *     documentation and/or other materials provided with the distribution.
17*cdf0e10cSrcweir  *  3. Neither the name of Sun Microsystems, Inc. nor the names of its
18*cdf0e10cSrcweir  *     contributors may be used to endorse or promote products derived
19*cdf0e10cSrcweir  *     from this software without specific prior written permission.
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22*cdf0e10cSrcweir  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23*cdf0e10cSrcweir  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24*cdf0e10cSrcweir  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25*cdf0e10cSrcweir  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26*cdf0e10cSrcweir  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27*cdf0e10cSrcweir  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28*cdf0e10cSrcweir  *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29*cdf0e10cSrcweir  *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
30*cdf0e10cSrcweir  *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
31*cdf0e10cSrcweir  *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32*cdf0e10cSrcweir  *
33*cdf0e10cSrcweir  *************************************************************************/
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir import com.sun.star.beans.IllegalTypeException;
36*cdf0e10cSrcweir import com.sun.star.beans.MethodConcept;
37*cdf0e10cSrcweir import com.sun.star.beans.NamedValue;
38*cdf0e10cSrcweir import com.sun.star.beans.Property;
39*cdf0e10cSrcweir import com.sun.star.beans.XIntrospection;
40*cdf0e10cSrcweir import com.sun.star.beans.XIntrospectionAccess;
41*cdf0e10cSrcweir import com.sun.star.beans.XPropertySet;
42*cdf0e10cSrcweir import com.sun.star.bridge.UnoUrlResolver;
43*cdf0e10cSrcweir import com.sun.star.bridge.XUnoUrlResolver;
44*cdf0e10cSrcweir import com.sun.star.comp.helper.Bootstrap;
45*cdf0e10cSrcweir import com.sun.star.container.XEnumeration;
46*cdf0e10cSrcweir import com.sun.star.container.XEnumerationAccess;
47*cdf0e10cSrcweir import com.sun.star.container.XHierarchicalNameAccess;
48*cdf0e10cSrcweir import com.sun.star.container.XIndexAccess;
49*cdf0e10cSrcweir import com.sun.star.container.XNameAccess;
50*cdf0e10cSrcweir import com.sun.star.lang.XMultiComponentFactory;
51*cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory;
52*cdf0e10cSrcweir import com.sun.star.lang.XServiceInfo;
53*cdf0e10cSrcweir import com.sun.star.lang.XTypeProvider;
54*cdf0e10cSrcweir import com.sun.star.lib.uno.helper.WeakBase;
55*cdf0e10cSrcweir import com.sun.star.reflection.ParamInfo;
56*cdf0e10cSrcweir import com.sun.star.reflection.TypeDescriptionSearchDepth;
57*cdf0e10cSrcweir import com.sun.star.reflection.XConstantTypeDescription;
58*cdf0e10cSrcweir import com.sun.star.reflection.XConstantsTypeDescription;
59*cdf0e10cSrcweir import com.sun.star.reflection.XIdlClass;
60*cdf0e10cSrcweir import com.sun.star.reflection.XIdlField;
61*cdf0e10cSrcweir import com.sun.star.reflection.XIdlMethod;
62*cdf0e10cSrcweir import com.sun.star.reflection.XIdlReflection;
63*cdf0e10cSrcweir import com.sun.star.reflection.XIndirectTypeDescription;
64*cdf0e10cSrcweir import com.sun.star.reflection.XInterfaceTypeDescription;
65*cdf0e10cSrcweir import com.sun.star.reflection.XInterfaceTypeDescription2;
66*cdf0e10cSrcweir import com.sun.star.reflection.XPropertyTypeDescription;
67*cdf0e10cSrcweir import com.sun.star.reflection.XServiceTypeDescription;
68*cdf0e10cSrcweir import com.sun.star.reflection.XTypeDescription;
69*cdf0e10cSrcweir import com.sun.star.reflection.XTypeDescriptionEnumeration;
70*cdf0e10cSrcweir import com.sun.star.reflection.XTypeDescriptionEnumerationAccess;
71*cdf0e10cSrcweir import com.sun.star.ucb.CommandAbortedException;
72*cdf0e10cSrcweir import com.sun.star.ucb.XSimpleFileAccess;
73*cdf0e10cSrcweir import com.sun.star.uno.AnyConverter;
74*cdf0e10cSrcweir import com.sun.star.uno.Type;
75*cdf0e10cSrcweir import com.sun.star.uno.TypeClass;
76*cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime;
77*cdf0e10cSrcweir import com.sun.star.uno.XComponentContext;
78*cdf0e10cSrcweir import com.sun.star.util.URL;
79*cdf0e10cSrcweir import java.util.List;
80*cdf0e10cSrcweir import java.util.Vector;
81*cdf0e10cSrcweir import javax.swing.JOptionPane;
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir public class Introspector extends WeakBase{
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir     private XIntrospection m_xIntrospection;
86*cdf0e10cSrcweir     private XMultiComponentFactory m_xMultiComponentFactory;
87*cdf0e10cSrcweir     private XComponentContext m_xComponentContext;
88*cdf0e10cSrcweir     private XTypeDescriptionEnumerationAccess m_xTDEnumerationAccess;
89*cdf0e10cSrcweir     private static XComponentContext xOfficeComponentContext;
90*cdf0e10cSrcweir     private XIdlReflection mxIdlReflection;
91*cdf0e10cSrcweir     private URL openHyperlink;
92*cdf0e10cSrcweir     private static Introspector m_oIntrospector = null;
93*cdf0e10cSrcweir     private XSimpleFileAccess xSimpleFileAccess = null;
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir     public static Introspector getIntrospector(){
98*cdf0e10cSrcweir         if (m_oIntrospector == null){
99*cdf0e10cSrcweir             throw new NullPointerException();
100*cdf0e10cSrcweir         }
101*cdf0e10cSrcweir         else{
102*cdf0e10cSrcweir             return m_oIntrospector;
103*cdf0e10cSrcweir         }
104*cdf0e10cSrcweir     }
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir     public static Introspector getIntrospector(XComponentContext _xComponentContext){
107*cdf0e10cSrcweir         if (m_oIntrospector == null){
108*cdf0e10cSrcweir             m_oIntrospector =  new Introspector(_xComponentContext);
109*cdf0e10cSrcweir         }
110*cdf0e10cSrcweir         return m_oIntrospector;
111*cdf0e10cSrcweir     }
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir     /** Creates a new instance of Introspection */
115*cdf0e10cSrcweir     private Introspector(XComponentContext _xComponentContext) {
116*cdf0e10cSrcweir     try{
117*cdf0e10cSrcweir         m_xComponentContext = _xComponentContext;
118*cdf0e10cSrcweir         m_xMultiComponentFactory = m_xComponentContext.getServiceManager();
119*cdf0e10cSrcweir         Object o = m_xMultiComponentFactory.createInstanceWithContext("com.sun.star.beans.Introspection", m_xComponentContext);
120*cdf0e10cSrcweir         m_xIntrospection = ( XIntrospection ) UnoRuntime.queryInterface(XIntrospection.class, o );
121*cdf0e10cSrcweir         Object oCoreReflection = getXMultiComponentFactory().createInstanceWithContext("com.sun.star.reflection.CoreReflection", getXComponentContext());
122*cdf0e10cSrcweir         mxIdlReflection = (XIdlReflection) UnoRuntime.queryInterface(XIdlReflection.class, oCoreReflection);
123*cdf0e10cSrcweir         initTypeDescriptionManager();
124*cdf0e10cSrcweir     }
125*cdf0e10cSrcweir     catch( Exception exception ) {
126*cdf0e10cSrcweir         System.err.println( exception );
127*cdf0e10cSrcweir     }}
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir     protected XComponentContext getXComponentContext(){
131*cdf0e10cSrcweir         return m_xComponentContext;
132*cdf0e10cSrcweir     }
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir     protected XMultiComponentFactory getXMultiComponentFactory(){
136*cdf0e10cSrcweir         return m_xMultiComponentFactory;
137*cdf0e10cSrcweir     }
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir     protected XIntrospectionAccess getXIntrospectionAccess(Object _oUnoComponent){
141*cdf0e10cSrcweir         return m_xIntrospection.inspect(_oUnoComponent);
142*cdf0e10cSrcweir     }
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir     public boolean isContainer(Object _oUnoObject){
146*cdf0e10cSrcweir     boolean bIsContainer = false;
147*cdf0e10cSrcweir     try {
148*cdf0e10cSrcweir         XIntrospectionAccess xIntrospectionAccessObject = getXIntrospectionAccess(_oUnoObject);
149*cdf0e10cSrcweir         if (xIntrospectionAccessObject != null){
150*cdf0e10cSrcweir             XEnumerationAccess xEnumerationAccess = (XEnumerationAccess) UnoRuntime.queryInterface(XEnumerationAccess.class, xIntrospectionAccessObject.queryAdapter( new Type( XEnumerationAccess.class ) ) );
151*cdf0e10cSrcweir             if (xEnumerationAccess != null){
152*cdf0e10cSrcweir                 XEnumeration xEnumeration = xEnumerationAccess.createEnumeration();
153*cdf0e10cSrcweir                 bIsContainer = xEnumeration.hasMoreElements();
154*cdf0e10cSrcweir             }
155*cdf0e10cSrcweir             if (!bIsContainer){
156*cdf0e10cSrcweir                 XIndexAccess xIndexAccess = (XIndexAccess) UnoRuntime.queryInterface( XIndexAccess.class, xIntrospectionAccessObject.queryAdapter(new Type( XIndexAccess.class )));
157*cdf0e10cSrcweir                 if (xIndexAccess != null){
158*cdf0e10cSrcweir                     bIsContainer = (xIndexAccess.getCount() > 0);
159*cdf0e10cSrcweir                 }
160*cdf0e10cSrcweir             }
161*cdf0e10cSrcweir         }
162*cdf0e10cSrcweir     } catch (IllegalTypeException ex) {
163*cdf0e10cSrcweir         ex.printStackTrace(System.out);
164*cdf0e10cSrcweir     }
165*cdf0e10cSrcweir         return bIsContainer;
166*cdf0e10cSrcweir     }
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir     //  add all containers for the given object to the tree under the node
170*cdf0e10cSrcweir     //  parent
171*cdf0e10cSrcweir     public Object[] getUnoObjectsOfContainer(Object _oUnoParentObject) {
172*cdf0e10cSrcweir     Object[] oRetComponents = null;
173*cdf0e10cSrcweir     try {
174*cdf0e10cSrcweir         Vector oRetComponentsVector = new Vector();
175*cdf0e10cSrcweir         XIntrospectionAccess xIntrospectionAccessObject = getXIntrospectionAccess(_oUnoParentObject);
176*cdf0e10cSrcweir         if ( xIntrospectionAccessObject != null ) {
177*cdf0e10cSrcweir             XEnumerationAccess xEnumerationAccess = (XEnumerationAccess) UnoRuntime.queryInterface(XEnumerationAccess.class, xIntrospectionAccessObject.queryAdapter( new Type( XEnumerationAccess.class ) ) );
178*cdf0e10cSrcweir             if ( xEnumerationAccess != null ) {
179*cdf0e10cSrcweir                 XEnumeration xEnumeration = xEnumerationAccess.createEnumeration();
180*cdf0e10cSrcweir                 while ( xEnumeration.hasMoreElements() ) {
181*cdf0e10cSrcweir                     oRetComponentsVector.add(xEnumeration.nextElement());
182*cdf0e10cSrcweir                 }
183*cdf0e10cSrcweir             }
184*cdf0e10cSrcweir             XIndexAccess xIndexAccess = (XIndexAccess) UnoRuntime.queryInterface( XIndexAccess.class, xIntrospectionAccessObject.queryAdapter(new Type( XIndexAccess.class )));
185*cdf0e10cSrcweir             if ( xIndexAccess != null ) {
186*cdf0e10cSrcweir                 XIdlMethod mMethod = xIntrospectionAccessObject.getMethod("getByIndex", com.sun.star.beans.MethodConcept.INDEXCONTAINER);
187*cdf0e10cSrcweir                 for ( int i = 0; i < xIndexAccess.getCount(); i++ ) {
188*cdf0e10cSrcweir                     Object[][] aParamInfo = new Object[1][1];
189*cdf0e10cSrcweir                     aParamInfo[0] = new Integer[] { new Integer(i) };
190*cdf0e10cSrcweir                     oRetComponentsVector.add(mMethod.invoke(_oUnoParentObject, aParamInfo));
191*cdf0e10cSrcweir                 }
192*cdf0e10cSrcweir             }
193*cdf0e10cSrcweir         }
194*cdf0e10cSrcweir         if (oRetComponentsVector != null){
195*cdf0e10cSrcweir             oRetComponents = new Object[oRetComponentsVector.size()];
196*cdf0e10cSrcweir             oRetComponentsVector.toArray(oRetComponents);
197*cdf0e10cSrcweir         }
198*cdf0e10cSrcweir     }
199*cdf0e10cSrcweir     catch( Exception exception ) {
200*cdf0e10cSrcweir         System.err.println( exception );
201*cdf0e10cSrcweir     }
202*cdf0e10cSrcweir     return oRetComponents;
203*cdf0e10cSrcweir     }
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir     protected XIdlMethod[] getMethodsOfInterface(Type _aType){
207*cdf0e10cSrcweir     try{
208*cdf0e10cSrcweir         XIdlClass xIdlClass = mxIdlReflection.forName(_aType.getTypeName());
209*cdf0e10cSrcweir         return xIdlClass.getMethods();
210*cdf0e10cSrcweir     }
211*cdf0e10cSrcweir     catch( Exception e ) {
212*cdf0e10cSrcweir         System.err.println( e );
213*cdf0e10cSrcweir         return null;
214*cdf0e10cSrcweir     }}
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir     protected XIdlField[] getFieldsOfType(Type _aType){
218*cdf0e10cSrcweir     try{
219*cdf0e10cSrcweir         XIdlClass xIdlClass = mxIdlReflection.forName(_aType.getTypeName());
220*cdf0e10cSrcweir         return xIdlClass.getFields();
221*cdf0e10cSrcweir     }
222*cdf0e10cSrcweir     catch( Exception e ) {
223*cdf0e10cSrcweir         System.err.println( e );
224*cdf0e10cSrcweir         return null;
225*cdf0e10cSrcweir     }}
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir     public boolean hasMethods(Object _oUnoObject){
229*cdf0e10cSrcweir         boolean bHasMethods = (getMethods(_oUnoObject).length > 0);
230*cdf0e10cSrcweir         return bHasMethods;
231*cdf0e10cSrcweir     }
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir     //  add all methods for the given object to the tree under the node parent
235*cdf0e10cSrcweir     public XIdlMethod[] getMethods(Object _oUnoParentObject) {
236*cdf0e10cSrcweir     try {
237*cdf0e10cSrcweir         XIntrospectionAccess xIntrospectionAccess = getXIntrospectionAccess(_oUnoParentObject);
238*cdf0e10cSrcweir         if (xIntrospectionAccess != null){
239*cdf0e10cSrcweir             XIdlMethod[] xIdlMethods = xIntrospectionAccess.getMethods(MethodConcept.ALL - MethodConcept.DANGEROUS);
240*cdf0e10cSrcweir             return xIdlMethods;
241*cdf0e10cSrcweir         }
242*cdf0e10cSrcweir     }
243*cdf0e10cSrcweir     catch( Exception e ) {
244*cdf0e10cSrcweir         System.err.println( e );
245*cdf0e10cSrcweir     }
246*cdf0e10cSrcweir     return null;
247*cdf0e10cSrcweir     }
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir     public boolean hasProperties(Object _oUnoObject){
251*cdf0e10cSrcweir         boolean bHasProperties = (getProperties(_oUnoObject).length > 0);
252*cdf0e10cSrcweir         return bHasProperties;
253*cdf0e10cSrcweir     }
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir     protected Property[] getProperties( Object _oUnoParentObject){
257*cdf0e10cSrcweir     try {
258*cdf0e10cSrcweir         XIntrospectionAccess xIntrospectionAccess = getXIntrospectionAccess(_oUnoParentObject);
259*cdf0e10cSrcweir         if (xIntrospectionAccess != null){
260*cdf0e10cSrcweir             Property[] aProperties = xIntrospectionAccess.getProperties(com.sun.star.beans.PropertyConcept.ATTRIBUTES + com.sun.star.beans.PropertyConcept.PROPERTYSET);
261*cdf0e10cSrcweir             return aProperties;
262*cdf0e10cSrcweir         }
263*cdf0e10cSrcweir     }
264*cdf0e10cSrcweir     catch( Exception e ) {
265*cdf0e10cSrcweir         System.err.println( e );
266*cdf0e10cSrcweir     }
267*cdf0e10cSrcweir         return null;
268*cdf0e10cSrcweir     }
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir     protected Property[] getProperties(Object _oUnoObject, String _sServiceName){
272*cdf0e10cSrcweir         Property[] aProperties = getProperties(_oUnoObject);
273*cdf0e10cSrcweir         List aListOfProperties = java.util.Arrays.asList(aProperties);
274*cdf0e10cSrcweir         Vector aPropertiesVector = new Vector(aListOfProperties);
275*cdf0e10cSrcweir         if (aProperties != null){
276*cdf0e10cSrcweir             XPropertyTypeDescription[] xPropertyTypeDescriptions = getPropertyDescriptionsOfService(_sServiceName);
277*cdf0e10cSrcweir             for (int i = aProperties.length - 1; i >= 0; i--){
278*cdf0e10cSrcweir                 if (!hasByName(xPropertyTypeDescriptions, _sServiceName + "." + aProperties[i].Name)){
279*cdf0e10cSrcweir                     aPropertiesVector.remove(i);
280*cdf0e10cSrcweir                 }
281*cdf0e10cSrcweir             }
282*cdf0e10cSrcweir         }
283*cdf0e10cSrcweir         Property[] aRetProperties = new Property[aPropertiesVector.size()];
284*cdf0e10cSrcweir         aPropertiesVector.toArray(aRetProperties);
285*cdf0e10cSrcweir         return aRetProperties;
286*cdf0e10cSrcweir     }
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir 
289*cdf0e10cSrcweir     protected Type[] getInterfaces(Object _oUnoObject, String _sServiceName){
290*cdf0e10cSrcweir         Type[] aTypes = getInterfaces(_oUnoObject);
291*cdf0e10cSrcweir         List aListOfTypes = java.util.Arrays.asList(aTypes);
292*cdf0e10cSrcweir         Vector aTypesVector = new Vector(aListOfTypes);
293*cdf0e10cSrcweir         if (aTypes != null){
294*cdf0e10cSrcweir             XInterfaceTypeDescription[] xInterfaceTypeDescriptions = getInterfaceDescriptionsOfService(_sServiceName);
295*cdf0e10cSrcweir             for (int i = aTypes.length - 1; i >= 0; i--){
296*cdf0e10cSrcweir                 if (!hasByName(xInterfaceTypeDescriptions, aTypes[i].getTypeName())){
297*cdf0e10cSrcweir                     aTypesVector.remove(i);
298*cdf0e10cSrcweir                 }
299*cdf0e10cSrcweir             }
300*cdf0e10cSrcweir         }
301*cdf0e10cSrcweir         Type[] aRetTypes = new Type[aTypesVector.size()];
302*cdf0e10cSrcweir         aTypesVector.toArray(aRetTypes);
303*cdf0e10cSrcweir         return aRetTypes;
304*cdf0e10cSrcweir     }
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir     public boolean hasInterfaces(Object _oUnoObject){
308*cdf0e10cSrcweir         return (getInterfaces(_oUnoObject).length > 0);
309*cdf0e10cSrcweir     }
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir     protected Type[] getInterfaces(Object _oUnoParentObject){
313*cdf0e10cSrcweir         Type[] aTypes = new Type[]{};
314*cdf0e10cSrcweir         XTypeProvider xTypeProvider = ( XTypeProvider ) UnoRuntime.queryInterface( XTypeProvider.class, _oUnoParentObject);
315*cdf0e10cSrcweir         if ( xTypeProvider != null ) {
316*cdf0e10cSrcweir             aTypes = xTypeProvider.getTypes();
317*cdf0e10cSrcweir         }
318*cdf0e10cSrcweir         return aTypes;
319*cdf0e10cSrcweir     }
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir     public static boolean isObjectSequence(Object _oUnoObject){
324*cdf0e10cSrcweir         Type aType = AnyConverter.getType(_oUnoObject);
325*cdf0e10cSrcweir         return aType.getTypeClass().getValue() == TypeClass.SEQUENCE_value;
326*cdf0e10cSrcweir     }
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir     public static boolean isObjectPrimitive(Object _oUnoObject){
330*cdf0e10cSrcweir         boolean breturn = false;
331*cdf0e10cSrcweir         if (_oUnoObject != null){
332*cdf0e10cSrcweir             Type aType = AnyConverter.getType(_oUnoObject);
333*cdf0e10cSrcweir             breturn = isObjectPrimitive(_oUnoObject.getClass(), aType.getTypeClass());
334*cdf0e10cSrcweir         }
335*cdf0e10cSrcweir         return breturn;
336*cdf0e10cSrcweir     }
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir     public static boolean isPrimitive(TypeClass _typeClass){
340*cdf0e10cSrcweir                return (( _typeClass == TypeClass.BOOLEAN )
341*cdf0e10cSrcweir                      || ( _typeClass == TypeClass.BYTE )
342*cdf0e10cSrcweir                      || ( _typeClass == TypeClass.CHAR )
343*cdf0e10cSrcweir                      || ( _typeClass == TypeClass.DOUBLE )
344*cdf0e10cSrcweir                      || ( _typeClass == TypeClass.ENUM )
345*cdf0e10cSrcweir                      || ( _typeClass == TypeClass.FLOAT )
346*cdf0e10cSrcweir                      || ( _typeClass == TypeClass.HYPER )
347*cdf0e10cSrcweir                      || ( _typeClass == TypeClass.LONG )
348*cdf0e10cSrcweir                      || ( _typeClass == TypeClass.SHORT )
349*cdf0e10cSrcweir                      || ( _typeClass == TypeClass.STRING )
350*cdf0e10cSrcweir                      || ( _typeClass == TypeClass.UNSIGNED_HYPER )
351*cdf0e10cSrcweir                      || ( _typeClass == TypeClass.UNSIGNED_LONG )
352*cdf0e10cSrcweir                      || ( _typeClass == TypeClass.UNSIGNED_SHORT ));
353*cdf0e10cSrcweir     }
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir     public static boolean isObjectPrimitive(Class _oUnoClass, TypeClass _typeClass){
356*cdf0e10cSrcweir         return !( ( !_oUnoClass.isPrimitive() ) && ( _typeClass != TypeClass.ARRAY )
357*cdf0e10cSrcweir                                                          && ( _typeClass != TypeClass.BOOLEAN )
358*cdf0e10cSrcweir                                                          && ( _typeClass != TypeClass.BYTE )
359*cdf0e10cSrcweir                                                          && ( _typeClass != TypeClass.CHAR )
360*cdf0e10cSrcweir                                                          && ( _typeClass != TypeClass.DOUBLE )
361*cdf0e10cSrcweir                                                          && ( _typeClass != TypeClass.ENUM )
362*cdf0e10cSrcweir                                                          && ( _typeClass != TypeClass.FLOAT )
363*cdf0e10cSrcweir                                                          && ( _typeClass != TypeClass.HYPER )
364*cdf0e10cSrcweir                                                          && ( _typeClass != TypeClass.LONG )
365*cdf0e10cSrcweir                                                          && ( _typeClass != TypeClass.SHORT )
366*cdf0e10cSrcweir                                                          && ( _typeClass != TypeClass.STRING )
367*cdf0e10cSrcweir                                                          && ( _typeClass != TypeClass.UNSIGNED_HYPER )
368*cdf0e10cSrcweir                                                          && ( _typeClass != TypeClass.UNSIGNED_LONG )
369*cdf0e10cSrcweir                                                          && ( _typeClass != TypeClass.UNSIGNED_SHORT ));
370*cdf0e10cSrcweir     }
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir     protected void initTypeDescriptionManager() {
374*cdf0e10cSrcweir     try {
375*cdf0e10cSrcweir         Object oTypeDescriptionManager = getXComponentContext().getValueByName("/singletons/com.sun.star.reflection.theTypeDescriptionManager");
376*cdf0e10cSrcweir         m_xTDEnumerationAccess = (XTypeDescriptionEnumerationAccess) UnoRuntime.queryInterface(XTypeDescriptionEnumerationAccess.class, oTypeDescriptionManager);
377*cdf0e10cSrcweir     } catch ( java.lang.Exception e) {
378*cdf0e10cSrcweir         System.out.println(System.out);
379*cdf0e10cSrcweir     }}
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir 
382*cdf0e10cSrcweir     protected XTypeDescriptionEnumerationAccess getXTypeDescriptionEnumerationAccess(){
383*cdf0e10cSrcweir         return m_xTDEnumerationAccess;
384*cdf0e10cSrcweir     }
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir     protected XConstantTypeDescription[] getFieldsOfConstantGroup(String _sTypeClass){
388*cdf0e10cSrcweir     XConstantTypeDescription[] xConstantTypeDescriptions = null;
389*cdf0e10cSrcweir     try {
390*cdf0e10cSrcweir         TypeClass[] eTypeClasses = new com.sun.star.uno.TypeClass[1];
391*cdf0e10cSrcweir         eTypeClasses[0] = com.sun.star.uno.TypeClass.CONSTANTS;
392*cdf0e10cSrcweir         XTypeDescriptionEnumeration xTDEnumeration = m_xTDEnumerationAccess.createTypeDescriptionEnumeration(getModuleName(_sTypeClass), eTypeClasses, TypeDescriptionSearchDepth.INFINITE);
393*cdf0e10cSrcweir         while (xTDEnumeration.hasMoreElements()) {
394*cdf0e10cSrcweir             XTypeDescription xTD = xTDEnumeration.nextTypeDescription();
395*cdf0e10cSrcweir             if (xTD.getName().equals(_sTypeClass)){
396*cdf0e10cSrcweir                 XConstantsTypeDescription xConstantsTypeDescription = (XConstantsTypeDescription) UnoRuntime.queryInterface(XConstantsTypeDescription.class, xTD);
397*cdf0e10cSrcweir                 xConstantTypeDescriptions = xConstantsTypeDescription.getConstants();
398*cdf0e10cSrcweir             }
399*cdf0e10cSrcweir             String sName = xTD.getName();
400*cdf0e10cSrcweir         }
401*cdf0e10cSrcweir         return xConstantTypeDescriptions;
402*cdf0e10cSrcweir     } catch ( java.lang.Exception e) {
403*cdf0e10cSrcweir         System.out.println(System.out);
404*cdf0e10cSrcweir     }
405*cdf0e10cSrcweir         return null;
406*cdf0e10cSrcweir     }
407*cdf0e10cSrcweir 
408*cdf0e10cSrcweir     private XServiceTypeDescription getServiceTypeDescription(String _sServiceName, TypeClass _eTypeClass){
409*cdf0e10cSrcweir     try{
410*cdf0e10cSrcweir         if (_sServiceName.length() > 0){
411*cdf0e10cSrcweir             TypeClass[] eTypeClasses = new com.sun.star.uno.TypeClass[2];
412*cdf0e10cSrcweir             eTypeClasses[0] = com.sun.star.uno.TypeClass.SERVICE;
413*cdf0e10cSrcweir             eTypeClasses[1] = _eTypeClass;
414*cdf0e10cSrcweir             XTypeDescriptionEnumeration xTDEnumeration = getXTypeDescriptionEnumerationAccess().createTypeDescriptionEnumeration(Introspector.getModuleName(_sServiceName), eTypeClasses, TypeDescriptionSearchDepth.INFINITE);
415*cdf0e10cSrcweir             while (xTDEnumeration.hasMoreElements()) {
416*cdf0e10cSrcweir                 XTypeDescription xTD = xTDEnumeration.nextTypeDescription();
417*cdf0e10cSrcweir                 if (xTD.getName().equals(_sServiceName)){
418*cdf0e10cSrcweir                     XServiceTypeDescription xServiceTypeDescription = (XServiceTypeDescription) UnoRuntime.queryInterface(XServiceTypeDescription.class, xTD);
419*cdf0e10cSrcweir                     return xServiceTypeDescription;
420*cdf0e10cSrcweir                 }
421*cdf0e10cSrcweir             }
422*cdf0e10cSrcweir         }
423*cdf0e10cSrcweir         return null;
424*cdf0e10cSrcweir     } catch (Exception ex) {
425*cdf0e10cSrcweir         ex.printStackTrace(System.out);
426*cdf0e10cSrcweir         return null;
427*cdf0e10cSrcweir     }}
428*cdf0e10cSrcweir 
429*cdf0e10cSrcweir 
430*cdf0e10cSrcweir     public XPropertyTypeDescription[] getPropertyDescriptionsOfService(String _sServiceName){
431*cdf0e10cSrcweir     try {
432*cdf0e10cSrcweir         XServiceTypeDescription xServiceTypeDescription = getServiceTypeDescription(_sServiceName, com.sun.star.uno.TypeClass.PROPERTY);
433*cdf0e10cSrcweir         if (xServiceTypeDescription != null){
434*cdf0e10cSrcweir             XPropertyTypeDescription[] xPropertyTypeDescriptions = xServiceTypeDescription.getProperties();
435*cdf0e10cSrcweir             return xPropertyTypeDescriptions;
436*cdf0e10cSrcweir         }
437*cdf0e10cSrcweir     } catch ( java.lang.Exception e) {
438*cdf0e10cSrcweir         System.out.println(System.out);
439*cdf0e10cSrcweir     }
440*cdf0e10cSrcweir     return new XPropertyTypeDescription[]{};
441*cdf0e10cSrcweir     }
442*cdf0e10cSrcweir 
443*cdf0e10cSrcweir 
444*cdf0e10cSrcweir     public XTypeDescription getReferencedType(String _sTypeName){
445*cdf0e10cSrcweir     XTypeDescription xTypeDescription = null;
446*cdf0e10cSrcweir     try{
447*cdf0e10cSrcweir         XHierarchicalNameAccess xHierarchicalNameAccess = (XHierarchicalNameAccess) UnoRuntime.queryInterface(XHierarchicalNameAccess.class, m_xTDEnumerationAccess);
448*cdf0e10cSrcweir         if (xHierarchicalNameAccess != null){
449*cdf0e10cSrcweir             if (xHierarchicalNameAccess.hasByHierarchicalName(_sTypeName)){
450*cdf0e10cSrcweir                 XIndirectTypeDescription xIndirectTypeDescription = (XIndirectTypeDescription) UnoRuntime.queryInterface(XIndirectTypeDescription.class, xHierarchicalNameAccess.getByHierarchicalName(_sTypeName));
451*cdf0e10cSrcweir                 if (xIndirectTypeDescription != null){
452*cdf0e10cSrcweir                     xTypeDescription = xIndirectTypeDescription.getReferencedType();
453*cdf0e10cSrcweir                 }
454*cdf0e10cSrcweir             }
455*cdf0e10cSrcweir         }
456*cdf0e10cSrcweir     } catch (Exception ex) {
457*cdf0e10cSrcweir         ex.printStackTrace(System.out);
458*cdf0e10cSrcweir     }
459*cdf0e10cSrcweir         return xTypeDescription;
460*cdf0e10cSrcweir     }
461*cdf0e10cSrcweir 
462*cdf0e10cSrcweir 
463*cdf0e10cSrcweir     public XInterfaceTypeDescription[] getInterfaceDescriptionsOfService(String _sServiceName){
464*cdf0e10cSrcweir     try {
465*cdf0e10cSrcweir         XServiceTypeDescription xServiceTypeDescription = getServiceTypeDescription(_sServiceName, com.sun.star.uno.TypeClass.INTERFACE);
466*cdf0e10cSrcweir         if (xServiceTypeDescription != null){
467*cdf0e10cSrcweir             XInterfaceTypeDescription[] xInterfaceTypeDescriptions = xServiceTypeDescription.getMandatoryInterfaces();
468*cdf0e10cSrcweir             return xInterfaceTypeDescriptions;
469*cdf0e10cSrcweir         }
470*cdf0e10cSrcweir     } catch ( java.lang.Exception e) {
471*cdf0e10cSrcweir         System.out.println(System.out);
472*cdf0e10cSrcweir     }
473*cdf0e10cSrcweir         return new XInterfaceTypeDescription[]{};
474*cdf0e10cSrcweir     }
475*cdf0e10cSrcweir 
476*cdf0e10cSrcweir 
477*cdf0e10cSrcweir     static boolean hasByName(XTypeDescription[] _xTypeDescriptions, String _sTypeName){
478*cdf0e10cSrcweir         for (int i = 0; i < _xTypeDescriptions.length; i++){
479*cdf0e10cSrcweir             if (_xTypeDescriptions[i].getName().equals(_sTypeName)){
480*cdf0e10cSrcweir                 return true;
481*cdf0e10cSrcweir             }
482*cdf0e10cSrcweir         }
483*cdf0e10cSrcweir         return false;
484*cdf0e10cSrcweir     }
485*cdf0e10cSrcweir 
486*cdf0e10cSrcweir 
487*cdf0e10cSrcweir     public static String getModuleName(String _sTypeClass){
488*cdf0e10cSrcweir         int nlastindex = _sTypeClass.lastIndexOf(".");
489*cdf0e10cSrcweir         if (nlastindex > -1){
490*cdf0e10cSrcweir             return _sTypeClass.substring(0, nlastindex);
491*cdf0e10cSrcweir         }
492*cdf0e10cSrcweir         else{
493*cdf0e10cSrcweir             return "";
494*cdf0e10cSrcweir         }
495*cdf0e10cSrcweir     }
496*cdf0e10cSrcweir 
497*cdf0e10cSrcweir 
498*cdf0e10cSrcweir     public static String getShortClassName(String _sClassName){
499*cdf0e10cSrcweir         String sShortClassName = _sClassName;
500*cdf0e10cSrcweir         int nindex = _sClassName.lastIndexOf(".");
501*cdf0e10cSrcweir         if ((nindex < _sClassName.length()) && nindex > -1){
502*cdf0e10cSrcweir             sShortClassName = _sClassName.substring(nindex + 1);
503*cdf0e10cSrcweir         }
504*cdf0e10cSrcweir         return sShortClassName;
505*cdf0e10cSrcweir     }
506*cdf0e10cSrcweir 
507*cdf0e10cSrcweir 
508*cdf0e10cSrcweir 
509*cdf0e10cSrcweir     public static boolean isUnoTypeObject(Object _oUnoObject){
510*cdf0e10cSrcweir         return isOfUnoType(_oUnoObject, "com.sun.star.uno.Type");
511*cdf0e10cSrcweir     }
512*cdf0e10cSrcweir 
513*cdf0e10cSrcweir 
514*cdf0e10cSrcweir     public static boolean isUnoPropertyTypeObject(Object _oUnoObject){
515*cdf0e10cSrcweir         return isOfUnoType(_oUnoObject, "com.sun.star.beans.Property");
516*cdf0e10cSrcweir     }
517*cdf0e10cSrcweir 
518*cdf0e10cSrcweir 
519*cdf0e10cSrcweir     public static boolean isUnoPropertyValueTypeObject(Object _oUnoObject){
520*cdf0e10cSrcweir         return isOfUnoType(_oUnoObject, "com.sun.star.beans.PropertyValue");
521*cdf0e10cSrcweir     }
522*cdf0e10cSrcweir 
523*cdf0e10cSrcweir 
524*cdf0e10cSrcweir     public static boolean isOfUnoType(Object _oUnoObject, String _sTypeName){
525*cdf0e10cSrcweir         boolean bIsUnoObject = false;
526*cdf0e10cSrcweir         if (_oUnoObject != null){
527*cdf0e10cSrcweir             if (_oUnoObject.getClass().isArray()){
528*cdf0e10cSrcweir                 if (!_oUnoObject.getClass().getComponentType().isPrimitive()){
529*cdf0e10cSrcweir                     Object[] oUnoArray = (Object[]) _oUnoObject;
530*cdf0e10cSrcweir                     if (oUnoArray.length > 0){
531*cdf0e10cSrcweir                         bIsUnoObject = ( oUnoArray[0].getClass().getName().equals(_sTypeName));
532*cdf0e10cSrcweir                     }
533*cdf0e10cSrcweir                 }
534*cdf0e10cSrcweir             }
535*cdf0e10cSrcweir         }
536*cdf0e10cSrcweir         else{
537*cdf0e10cSrcweir             bIsUnoObject = (_oUnoObject.getClass().getName().equals(_sTypeName));
538*cdf0e10cSrcweir         }
539*cdf0e10cSrcweir         return bIsUnoObject;
540*cdf0e10cSrcweir     }
541*cdf0e10cSrcweir 
542*cdf0e10cSrcweir 
543*cdf0e10cSrcweir     public String getConstantDisplayString(int _nValue, XConstantTypeDescription[] _xConstantTypeDescription, String _sDisplayString){
544*cdf0e10cSrcweir         String sPrefix = "";
545*cdf0e10cSrcweir         int[] nbits = new int[_xConstantTypeDescription.length];
546*cdf0e10cSrcweir         for (int i = 0; i < _xConstantTypeDescription.length; i++){
547*cdf0e10cSrcweir             short nConstantValue = ((Short) _xConstantTypeDescription[i].getConstantValue()).shortValue();
548*cdf0e10cSrcweir             nbits[i] = _nValue & nConstantValue;
549*cdf0e10cSrcweir             if (nbits[i] > 0){
550*cdf0e10cSrcweir                 _sDisplayString += sPrefix + _xConstantTypeDescription[i].getName();
551*cdf0e10cSrcweir                 sPrefix = " + ";
552*cdf0e10cSrcweir             }
553*cdf0e10cSrcweir         }
554*cdf0e10cSrcweir         return _sDisplayString;
555*cdf0e10cSrcweir     }
556*cdf0e10cSrcweir 
557*cdf0e10cSrcweir 
558*cdf0e10cSrcweir     public static boolean isValid(Object[] _oObject){
559*cdf0e10cSrcweir         if (_oObject != null){
560*cdf0e10cSrcweir             if (_oObject.length > 0){
561*cdf0e10cSrcweir                 return true;
562*cdf0e10cSrcweir             }
563*cdf0e10cSrcweir         }
564*cdf0e10cSrcweir         return false;
565*cdf0e10cSrcweir     }
566*cdf0e10cSrcweir 
567*cdf0e10cSrcweir 
568*cdf0e10cSrcweir     public static boolean isValid(Object _oObject){
569*cdf0e10cSrcweir         if (_oObject != null){
570*cdf0e10cSrcweir             return (!AnyConverter.isVoid(_oObject));
571*cdf0e10cSrcweir         }
572*cdf0e10cSrcweir         return false;
573*cdf0e10cSrcweir     }
574*cdf0e10cSrcweir 
575*cdf0e10cSrcweir 
576*cdf0e10cSrcweir     public static boolean isArray(Object _oObject){
577*cdf0e10cSrcweir         return _oObject.getClass().isArray();
578*cdf0e10cSrcweir     }
579*cdf0e10cSrcweir 
580*cdf0e10cSrcweir 
581*cdf0e10cSrcweir     public boolean hasSupportedServices(Object _oUnoObject){
582*cdf0e10cSrcweir         boolean bHasSupportedServices = false;
583*cdf0e10cSrcweir         XServiceInfo xServiceInfo = ( XServiceInfo ) UnoRuntime.queryInterface( XServiceInfo.class, _oUnoObject);
584*cdf0e10cSrcweir         if ( xServiceInfo != null ){
585*cdf0e10cSrcweir             String[] sSupportedServiceNames = xServiceInfo.getSupportedServiceNames();
586*cdf0e10cSrcweir             bHasSupportedServices = sSupportedServiceNames.length > 0;
587*cdf0e10cSrcweir         }
588*cdf0e10cSrcweir         return bHasSupportedServices;
589*cdf0e10cSrcweir     }
590*cdf0e10cSrcweir 
591*cdf0e10cSrcweir 
592*cdf0e10cSrcweir     public Object getValueOfText(TypeClass aTypeClass, String sText){
593*cdf0e10cSrcweir         Object oReturn = null;
594*cdf0e10cSrcweir         switch (aTypeClass.getValue()){
595*cdf0e10cSrcweir             case TypeClass.CHAR_value:
596*cdf0e10cSrcweir                 break;
597*cdf0e10cSrcweir             case TypeClass.DOUBLE_value:
598*cdf0e10cSrcweir                 oReturn = Double.valueOf(sText);
599*cdf0e10cSrcweir                 break;
600*cdf0e10cSrcweir             case TypeClass.ENUM_value:
601*cdf0e10cSrcweir                 break;
602*cdf0e10cSrcweir             case TypeClass.FLOAT_value:
603*cdf0e10cSrcweir                 oReturn = Float.valueOf(sText);
604*cdf0e10cSrcweir                 break;
605*cdf0e10cSrcweir             case TypeClass.HYPER_value:
606*cdf0e10cSrcweir                 oReturn = Long.valueOf(sText);
607*cdf0e10cSrcweir                 break;
608*cdf0e10cSrcweir             case TypeClass.LONG_value:
609*cdf0e10cSrcweir                 oReturn = Integer.valueOf(sText);
610*cdf0e10cSrcweir                 break;
611*cdf0e10cSrcweir             case TypeClass.SHORT_value:
612*cdf0e10cSrcweir                 oReturn = Byte.valueOf(sText);
613*cdf0e10cSrcweir                 break;
614*cdf0e10cSrcweir             case TypeClass.STRING_value:
615*cdf0e10cSrcweir                 oReturn = sText;
616*cdf0e10cSrcweir                 break;
617*cdf0e10cSrcweir             case TypeClass.UNSIGNED_HYPER_value:
618*cdf0e10cSrcweir                 oReturn = Long.valueOf(sText);
619*cdf0e10cSrcweir                 break;
620*cdf0e10cSrcweir             case TypeClass.UNSIGNED_LONG_value:
621*cdf0e10cSrcweir                 oReturn = Integer.valueOf(sText);
622*cdf0e10cSrcweir                 break;
623*cdf0e10cSrcweir             case TypeClass.UNSIGNED_SHORT_value:
624*cdf0e10cSrcweir                 oReturn = Byte.valueOf(sText);
625*cdf0e10cSrcweir                 break;
626*cdf0e10cSrcweir             default:
627*cdf0e10cSrcweir         }
628*cdf0e10cSrcweir         return oReturn;
629*cdf0e10cSrcweir     }
630*cdf0e10cSrcweir 
631*cdf0e10cSrcweir 
632*cdf0e10cSrcweir     public XSimpleFileAccess getXSimpleFileAccess(){
633*cdf0e10cSrcweir     try {
634*cdf0e10cSrcweir         if (xSimpleFileAccess == null){
635*cdf0e10cSrcweir             Object oSimpleFileAccess = m_xComponentContext.getServiceManager().createInstanceWithContext("com.sun.star.ucb.SimpleFileAccess", m_xComponentContext);
636*cdf0e10cSrcweir             xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, oSimpleFileAccess);
637*cdf0e10cSrcweir         }
638*cdf0e10cSrcweir         return xSimpleFileAccess;
639*cdf0e10cSrcweir     } catch (com.sun.star.uno.Exception ex) {
640*cdf0e10cSrcweir         ex.printStackTrace(System.out);
641*cdf0e10cSrcweir         return null;
642*cdf0e10cSrcweir     }}
643*cdf0e10cSrcweir 
644*cdf0e10cSrcweir 
645*cdf0e10cSrcweir     public boolean isValidSDKInstallationPath(String _sSDKInstallationPath){
646*cdf0e10cSrcweir     boolean bIsValid = false;
647*cdf0e10cSrcweir     try {
648*cdf0e10cSrcweir         String sIDLFolder = Introspector.addToPath(_sSDKInstallationPath, Inspector.sIDLDOCUMENTSUBFOLDER);
649*cdf0e10cSrcweir         String sIndexFile = Introspector.addToPath(_sSDKInstallationPath, "index.html");
650*cdf0e10cSrcweir         if (getXSimpleFileAccess() != null){
651*cdf0e10cSrcweir             bIsValid = (getXSimpleFileAccess().exists(sIDLFolder) && getXSimpleFileAccess().exists(sIndexFile));
652*cdf0e10cSrcweir         }
653*cdf0e10cSrcweir     } catch (com.sun.star.uno.Exception ex) {
654*cdf0e10cSrcweir         ex.printStackTrace(System.out);
655*cdf0e10cSrcweir     }
656*cdf0e10cSrcweir         return bIsValid;
657*cdf0e10cSrcweir     }
658*cdf0e10cSrcweir 
659*cdf0e10cSrcweir 
660*cdf0e10cSrcweir     public static String addToPath(String _sPath, String _sSubPath){
661*cdf0e10cSrcweir         if (!_sPath.endsWith("/")){
662*cdf0e10cSrcweir             _sPath += "/";
663*cdf0e10cSrcweir         }
664*cdf0e10cSrcweir         return _sPath + _sSubPath;
665*cdf0e10cSrcweir     }
666*cdf0e10cSrcweir 
667*cdf0e10cSrcweir }
668