1*34dd1e25SAndrew Rist /**************************************************************
2*34dd1e25SAndrew Rist  *
3*34dd1e25SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*34dd1e25SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*34dd1e25SAndrew Rist  * distributed with this work for additional information
6*34dd1e25SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*34dd1e25SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*34dd1e25SAndrew Rist  * "License"); you may not use this file except in compliance
9*34dd1e25SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*34dd1e25SAndrew Rist  *
11*34dd1e25SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*34dd1e25SAndrew Rist  *
13*34dd1e25SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*34dd1e25SAndrew Rist  * software distributed under the License is distributed on an
15*34dd1e25SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*34dd1e25SAndrew Rist  * KIND, either express or implied.  See the License for the
17*34dd1e25SAndrew Rist  * specific language governing permissions and limitations
18*34dd1e25SAndrew Rist  * under the License.
19*34dd1e25SAndrew Rist  *
20*34dd1e25SAndrew Rist  *************************************************************/
21*34dd1e25SAndrew Rist 
22*34dd1e25SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir import com.sun.star.beans.PropertyValue;
25cdf0e10cSrcweir import com.sun.star.frame.FrameSearchFlag;
26cdf0e10cSrcweir import com.sun.star.frame.XDesktop;
27cdf0e10cSrcweir import com.sun.star.frame.XDispatch;
28cdf0e10cSrcweir import com.sun.star.frame.XDispatchProvider;
29cdf0e10cSrcweir import com.sun.star.frame.XFrame;
30cdf0e10cSrcweir import com.sun.star.lang.XMultiComponentFactory;
31cdf0e10cSrcweir import com.sun.star.lang.XServiceInfo;
32cdf0e10cSrcweir import com.sun.star.reflection.TypeDescriptionSearchDepth;
33cdf0e10cSrcweir import com.sun.star.reflection.XServiceTypeDescription;
34cdf0e10cSrcweir import com.sun.star.reflection.XTypeDescription;
35cdf0e10cSrcweir import com.sun.star.reflection.XTypeDescriptionEnumeration;
36cdf0e10cSrcweir import com.sun.star.reflection.XTypeDescriptionEnumerationAccess;
37cdf0e10cSrcweir import com.sun.star.uno.AnyConverter;
38cdf0e10cSrcweir import com.sun.star.uno.Type;
39cdf0e10cSrcweir import com.sun.star.uno.TypeClass;
40cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime;
41cdf0e10cSrcweir import com.sun.star.uno.XComponentContext;
42cdf0e10cSrcweir import com.sun.star.util.URL;
43cdf0e10cSrcweir import com.sun.star.util.XURLTransformer;
44cdf0e10cSrcweir import java.util.List;
45cdf0e10cSrcweir import java.util.Vector;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir public class UnoNode{
48cdf0e10cSrcweir 
49cdf0e10cSrcweir     String sPath = null;
50cdf0e10cSrcweir     Object m_oUnoObject;
51cdf0e10cSrcweir     private XMultiComponentFactory m_xMultiComponentFactory;
52cdf0e10cSrcweir     private XComponentContext m_xComponentContext;
53cdf0e10cSrcweir     private Object[] m_oParamObjects = null;
54cdf0e10cSrcweir     private int m_nNodeType = XUnoNode.nOTHERS;
55cdf0e10cSrcweir     private Type aType = null;
56cdf0e10cSrcweir     private String sLabel = "";
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 
60cdf0e10cSrcweir     /** Creates a new instance of UnoNode */
UnoNode(Object _oUnoObject)61cdf0e10cSrcweir     public UnoNode(Object _oUnoObject) {
62cdf0e10cSrcweir         m_xComponentContext = Introspector.getIntrospector().getXComponentContext();
63cdf0e10cSrcweir         m_xMultiComponentFactory = m_xComponentContext.getServiceManager();
64cdf0e10cSrcweir         m_oUnoObject = _oUnoObject;
65cdf0e10cSrcweir     }
66cdf0e10cSrcweir 
UnoNode(Object _oUnoObject, Type _aType)67cdf0e10cSrcweir     public UnoNode(Object _oUnoObject, Type _aType) {
68cdf0e10cSrcweir         this(_oUnoObject);
69cdf0e10cSrcweir         aType = _aType;
70cdf0e10cSrcweir         m_nNodeType = XUnoNode.nINTERFACE;
71cdf0e10cSrcweir     }
72cdf0e10cSrcweir 
getUnoObject()73cdf0e10cSrcweir     public Object getUnoObject(){
74cdf0e10cSrcweir         return m_oUnoObject;
75cdf0e10cSrcweir     }
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 
getXComponentContext()78cdf0e10cSrcweir     protected XComponentContext getXComponentContext(){
79cdf0e10cSrcweir         return m_xComponentContext;
80cdf0e10cSrcweir     }
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 
getXMultiComponentFactory()83cdf0e10cSrcweir     protected XMultiComponentFactory getXMultiComponentFactory(){
84cdf0e10cSrcweir         return m_xMultiComponentFactory;
85cdf0e10cSrcweir     }
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 
getXTypeDescriptionEnumerationAccess()88cdf0e10cSrcweir     private static XTypeDescriptionEnumerationAccess getXTypeDescriptionEnumerationAccess(){
89cdf0e10cSrcweir        return Introspector.getIntrospector().getXTypeDescriptionEnumerationAccess();
90cdf0e10cSrcweir     }
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 
getAnchor()93cdf0e10cSrcweir     public String getAnchor(){
94cdf0e10cSrcweir         return "";
95cdf0e10cSrcweir     }
96cdf0e10cSrcweir 
getNodeType()97cdf0e10cSrcweir     public int getNodeType(){
98cdf0e10cSrcweir         return m_nNodeType;
99cdf0e10cSrcweir     }
100cdf0e10cSrcweir 
setNodeType(int _nNodeType)101cdf0e10cSrcweir     public void setNodeType(int _nNodeType){
102cdf0e10cSrcweir         m_nNodeType = _nNodeType;
103cdf0e10cSrcweir     }
104cdf0e10cSrcweir 
getClassName()105cdf0e10cSrcweir     public String getClassName(){
106cdf0e10cSrcweir         String sClassName = "";
107cdf0e10cSrcweir         if (m_nNodeType == XUnoNode.nINTERFACE){
108cdf0e10cSrcweir             sClassName = aType.getTypeName();
109cdf0e10cSrcweir         }
110cdf0e10cSrcweir         else if(m_nNodeType == XUnoNode.nSERVICE){
111cdf0e10cSrcweir             sClassName = sLabel;
112cdf0e10cSrcweir         }
113cdf0e10cSrcweir         return sClassName;
114cdf0e10cSrcweir     }
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 
getUnoType()117cdf0e10cSrcweir     public Type getUnoType(){
118cdf0e10cSrcweir         return aType;
119cdf0e10cSrcweir     }
120cdf0e10cSrcweir 
setLabel(String _sLabel)121cdf0e10cSrcweir     protected void  setLabel(String _sLabel){
122cdf0e10cSrcweir         sLabel = _sLabel;
123cdf0e10cSrcweir     }
124cdf0e10cSrcweir 
openIdlDescription(String _sIDLUrl, String _sClassName, String _sAnchor)125cdf0e10cSrcweir     public void openIdlDescription(String _sIDLUrl, String _sClassName, String _sAnchor){
126cdf0e10cSrcweir     try{
127cdf0e10cSrcweir         String sIDLUrl = _sIDLUrl;
128cdf0e10cSrcweir         String sAnchor = ""; // TODO find out how the Anchor may be set at the html file;  //_sAnchor;
129cdf0e10cSrcweir         boolean bExists = Introspector.getIntrospector().getXSimpleFileAccess().exists(sIDLUrl);
130cdf0e10cSrcweir         if (sIDLUrl.equals("") || (!bExists)){
131cdf0e10cSrcweir             sIDLUrl = "http://api.openoffice.org/" + Inspector.sIDLDOCUMENTSUBFOLDER;
132cdf0e10cSrcweir         }
133cdf0e10cSrcweir         if (!sIDLUrl.endsWith("/")){
134cdf0e10cSrcweir             sIDLUrl += "/";
135cdf0e10cSrcweir         }
136cdf0e10cSrcweir         if (_sClassName.equals("")){
137cdf0e10cSrcweir             sIDLUrl += "com/sun/star/module-ix";
138cdf0e10cSrcweir             sAnchor = "";
139cdf0e10cSrcweir         }
140cdf0e10cSrcweir         else{
141cdf0e10cSrcweir             sIDLUrl += _sClassName.replace('.', '/');
142cdf0e10cSrcweir         }
143cdf0e10cSrcweir         if (sAnchor != null){
144cdf0e10cSrcweir             if (!sAnchor.equals("")){
145cdf0e10cSrcweir                 sIDLUrl += "#" + sAnchor;
146cdf0e10cSrcweir             }
147cdf0e10cSrcweir         }
148cdf0e10cSrcweir         sIDLUrl += ".html";
149cdf0e10cSrcweir         URL openHyperlink = getDispatchURL(".uno:OpenHyperlink");
150cdf0e10cSrcweir         PropertyValue pv = new PropertyValue();
151cdf0e10cSrcweir         pv.Name = "URL";
152cdf0e10cSrcweir         pv.Value = sIDLUrl;
153cdf0e10cSrcweir         getXDispatcher(openHyperlink).dispatch(openHyperlink, new PropertyValue[] {pv});
154cdf0e10cSrcweir     } catch(Exception exception) {
155cdf0e10cSrcweir         exception.printStackTrace(System.out);
156cdf0e10cSrcweir     }}
157cdf0e10cSrcweir 
158cdf0e10cSrcweir 
getDispatchURL(String _sURL)159cdf0e10cSrcweir     private com.sun.star.util.URL getDispatchURL(String _sURL){
160cdf0e10cSrcweir         try {
161cdf0e10cSrcweir             Object oTransformer = getXMultiComponentFactory().createInstanceWithContext("com.sun.star.util.URLTransformer", getXComponentContext());
162cdf0e10cSrcweir             XURLTransformer xTransformer = (XURLTransformer) UnoRuntime.queryInterface(XURLTransformer.class, oTransformer);
163cdf0e10cSrcweir             com.sun.star.util.URL[] oURL = new com.sun.star.util.URL[1];
164cdf0e10cSrcweir             oURL[0] = new com.sun.star.util.URL();
165cdf0e10cSrcweir             oURL[0].Complete = _sURL;
166cdf0e10cSrcweir             xTransformer.parseStrict(oURL);
167cdf0e10cSrcweir         return oURL[0];
168cdf0e10cSrcweir         } catch (Exception e) {
169cdf0e10cSrcweir             e.printStackTrace(System.out);
170cdf0e10cSrcweir         }
171cdf0e10cSrcweir         return null;
172cdf0e10cSrcweir     }
173cdf0e10cSrcweir 
174cdf0e10cSrcweir 
getCurrentFrame()175cdf0e10cSrcweir     private XFrame getCurrentFrame(){
176cdf0e10cSrcweir     try{
177cdf0e10cSrcweir         Object oDesktop = getXMultiComponentFactory().createInstanceWithContext("com.sun.star.frame.Desktop", getXComponentContext());
178cdf0e10cSrcweir         XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, oDesktop);
179cdf0e10cSrcweir         return xDesktop.getCurrentFrame();
180cdf0e10cSrcweir     } catch (Exception e) {
181cdf0e10cSrcweir         e.printStackTrace(System.out);
182cdf0e10cSrcweir         return null;
183cdf0e10cSrcweir     }}
184cdf0e10cSrcweir 
185cdf0e10cSrcweir 
getXDispatcher(com.sun.star.util.URL oURL)186cdf0e10cSrcweir     private XDispatch getXDispatcher(com.sun.star.util.URL oURL) {
187cdf0e10cSrcweir     try {
188cdf0e10cSrcweir         com.sun.star.util.URL[] oURLArray = new com.sun.star.util.URL[1];
189cdf0e10cSrcweir         oURLArray[0] = oURL;
190cdf0e10cSrcweir         XDispatchProvider xDispatchProvider = (XDispatchProvider) UnoRuntime.queryInterface(XDispatchProvider.class, getCurrentFrame());
191cdf0e10cSrcweir         XDispatch xDispatch = xDispatchProvider.queryDispatch(oURLArray[0], "_top", FrameSearchFlag.ALL); // "_self"
192cdf0e10cSrcweir         return xDispatch;
193cdf0e10cSrcweir     } catch (Exception e) {
194cdf0e10cSrcweir         e.printStackTrace(System.out);
195cdf0e10cSrcweir         return null;
196cdf0e10cSrcweir     }}
197cdf0e10cSrcweir 
198cdf0e10cSrcweir 
loadArgs(String url)199cdf0e10cSrcweir     private PropertyValue[] loadArgs(String url) {
200cdf0e10cSrcweir         PropertyValue pv = new PropertyValue();
201cdf0e10cSrcweir         pv.Name = "URL";
202cdf0e10cSrcweir         pv.Value = url;
203cdf0e10cSrcweir         return new PropertyValue[] {pv};
204cdf0e10cSrcweir     }
205cdf0e10cSrcweir 
206cdf0e10cSrcweir 
207cdf0e10cSrcweir 
isFilterApplicable(String _sFilter, String _sName)208cdf0e10cSrcweir     public boolean isFilterApplicable(String _sFilter, String _sName){
209cdf0e10cSrcweir         boolean bFilterDoesApply = true;
210cdf0e10cSrcweir         if (_sFilter.length() > 0){
211cdf0e10cSrcweir             if (_sName.indexOf(_sFilter) == -1){
212cdf0e10cSrcweir                 bFilterDoesApply = false;
213cdf0e10cSrcweir             }
214cdf0e10cSrcweir         }
215cdf0e10cSrcweir         return bFilterDoesApply;
216cdf0e10cSrcweir     }
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 
219cdf0e10cSrcweir //    public static String getServiceDescription(Object _oUnoObject){
220cdf0e10cSrcweir //        String sClassName = "";
221cdf0e10cSrcweir //        XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, _oUnoObject);
222cdf0e10cSrcweir //        if (xServiceInfo != null){
223cdf0e10cSrcweir //            String[] sChildServiceNames = removeMandatoryServiceNames(xServiceInfo.getSupportedServiceNames());
224cdf0e10cSrcweir //            if (sChildServiceNames.length > 0){
225cdf0e10cSrcweir //                sClassName = sChildServiceNames[0];
226cdf0e10cSrcweir //            }
227cdf0e10cSrcweir //        }
228cdf0e10cSrcweir //        return sClassName;
229cdf0e10cSrcweir //    }
230cdf0e10cSrcweir 
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 
getMandatoryServiceNames(String _sServiceName)233cdf0e10cSrcweir     private static String[] getMandatoryServiceNames(String _sServiceName){
234cdf0e10cSrcweir     String[] sMandatoryServiceNames  = new String[]{};
235cdf0e10cSrcweir     try {
236cdf0e10cSrcweir         TypeClass[] eTypeClasses = new com.sun.star.uno.TypeClass[1];
237cdf0e10cSrcweir         eTypeClasses[0] = com.sun.star.uno.TypeClass.SERVICE;
238cdf0e10cSrcweir         XTypeDescriptionEnumeration xTDEnumeration = getXTypeDescriptionEnumerationAccess().createTypeDescriptionEnumeration(Introspector.getModuleName(_sServiceName), eTypeClasses, TypeDescriptionSearchDepth.INFINITE);
239cdf0e10cSrcweir         while (xTDEnumeration.hasMoreElements()) {
240cdf0e10cSrcweir             XTypeDescription xTD = xTDEnumeration.nextTypeDescription();
241cdf0e10cSrcweir             if (xTD.getName().equals(_sServiceName)){
242cdf0e10cSrcweir                 XServiceTypeDescription xServiceTypeDescription = (XServiceTypeDescription) UnoRuntime.queryInterface(XServiceTypeDescription.class, xTD);
243cdf0e10cSrcweir                 XServiceTypeDescription[] xMandatoryServiceTypeDescriptions =  xServiceTypeDescription.getMandatoryServices();
244cdf0e10cSrcweir                 int nlength = xMandatoryServiceTypeDescriptions.length;
245cdf0e10cSrcweir                 sMandatoryServiceNames  = new String[nlength];
246cdf0e10cSrcweir                 for (int i = 0; i < nlength; i++){
247cdf0e10cSrcweir                     sMandatoryServiceNames[i] = xMandatoryServiceTypeDescriptions[i].getName();
248cdf0e10cSrcweir                 }
249cdf0e10cSrcweir 
250cdf0e10cSrcweir             }
251cdf0e10cSrcweir         }
252cdf0e10cSrcweir     } catch ( java.lang.Exception e) {
253cdf0e10cSrcweir         System.out.println(System.out);
254cdf0e10cSrcweir     }
255cdf0e10cSrcweir         return sMandatoryServiceNames;
256cdf0e10cSrcweir     }
257cdf0e10cSrcweir 
258cdf0e10cSrcweir 
removeMandatoryServiceNames(String[] _sServiceNames)259cdf0e10cSrcweir     private static String[] removeMandatoryServiceNames(String[] _sServiceNames){
260cdf0e10cSrcweir     try{
261cdf0e10cSrcweir         List aList = java.util.Arrays.asList(_sServiceNames);
262cdf0e10cSrcweir         Vector aVector = new Vector(aList);
263cdf0e10cSrcweir         for (int n = 0; n < _sServiceNames.length; n++){
264cdf0e10cSrcweir             String[] sDelServiceNames = getMandatoryServiceNames(_sServiceNames[n]);
265cdf0e10cSrcweir             for (int m = 0; m < sDelServiceNames.length; m++){
266cdf0e10cSrcweir                 if (aVector.contains(sDelServiceNames[m])){
267cdf0e10cSrcweir                     int nIndex = aVector.indexOf(sDelServiceNames[m]);
268cdf0e10cSrcweir                     aVector.remove(nIndex);
269cdf0e10cSrcweir                 }
270cdf0e10cSrcweir             }
271cdf0e10cSrcweir         }
272cdf0e10cSrcweir         String[] sRetArray = new String[aVector.size()];
273cdf0e10cSrcweir         aVector.toArray(sRetArray);
274cdf0e10cSrcweir         return sRetArray;
275cdf0e10cSrcweir     } catch (java.lang.Exception exception) {
276cdf0e10cSrcweir         exception.printStackTrace(System.out);
277cdf0e10cSrcweir     }
278cdf0e10cSrcweir         return new String[]{};
279cdf0e10cSrcweir     }
280cdf0e10cSrcweir 
281cdf0e10cSrcweir 
getDisplayValueOfPrimitiveType(Object _objectElement)282cdf0e10cSrcweir     public  static String getDisplayValueOfPrimitiveType(Object _objectElement){
283cdf0e10cSrcweir     String sValue ="";
284cdf0e10cSrcweir     try{
285cdf0e10cSrcweir         if (AnyConverter.isString(_objectElement)){
286cdf0e10cSrcweir             sValue = AnyConverter.toString(_objectElement);
287cdf0e10cSrcweir         }
288cdf0e10cSrcweir         else if (AnyConverter.isBoolean(_objectElement)){
289cdf0e10cSrcweir             sValue += AnyConverter.toBoolean(_objectElement);
290cdf0e10cSrcweir         }
291cdf0e10cSrcweir         else if (AnyConverter.isByte(_objectElement)){
292cdf0e10cSrcweir             sValue += AnyConverter.toByte(_objectElement);
293cdf0e10cSrcweir         }
294cdf0e10cSrcweir         else if (AnyConverter.isChar(_objectElement)){
295cdf0e10cSrcweir             sValue += AnyConverter.toChar(_objectElement);
296cdf0e10cSrcweir         }
297cdf0e10cSrcweir         else if (AnyConverter.isDouble(_objectElement)){
298cdf0e10cSrcweir             sValue += AnyConverter.toDouble(_objectElement);
299cdf0e10cSrcweir         }
300cdf0e10cSrcweir         else if (AnyConverter.isFloat(_objectElement)){
301cdf0e10cSrcweir             sValue += AnyConverter.toFloat(_objectElement);
302cdf0e10cSrcweir         }
303cdf0e10cSrcweir         else if (AnyConverter.isInt(_objectElement)){
304cdf0e10cSrcweir             sValue += AnyConverter.toInt(_objectElement);
305cdf0e10cSrcweir         }
306cdf0e10cSrcweir         else if (AnyConverter.isLong(_objectElement)){
307cdf0e10cSrcweir             sValue += AnyConverter.toLong(_objectElement);
308cdf0e10cSrcweir         }
309cdf0e10cSrcweir         else if (AnyConverter.isShort(_objectElement)){
310cdf0e10cSrcweir             sValue += AnyConverter.toShort(_objectElement);
311cdf0e10cSrcweir         }
312cdf0e10cSrcweir     }
313cdf0e10cSrcweir     catch( Exception e ) {
314cdf0e10cSrcweir         System.err.println( e );
315cdf0e10cSrcweir     }
316cdf0e10cSrcweir         return sValue;
317cdf0e10cSrcweir     }
318cdf0e10cSrcweir 
getDisplayValuesofPrimitiveArray(Object _oUnoObject)319cdf0e10cSrcweir     protected static String[] getDisplayValuesofPrimitiveArray(Object _oUnoObject){
320cdf0e10cSrcweir     String[] sDisplayValues = null;
321cdf0e10cSrcweir     try{
322cdf0e10cSrcweir         Type aType = AnyConverter.getType(_oUnoObject);
323cdf0e10cSrcweir         TypeClass aTypeClass = aType.getTypeClass();
324cdf0e10cSrcweir         int nTypeValue = aTypeClass.getValue();
325cdf0e10cSrcweir         if (nTypeValue == TypeClass.SEQUENCE_value){
326cdf0e10cSrcweir             nTypeValue = (sequenceComponentType(aType)).getTypeClass().getValue();
327cdf0e10cSrcweir         }
328cdf0e10cSrcweir         switch (nTypeValue){
329cdf0e10cSrcweir             case TypeClass.BOOLEAN_value:
330cdf0e10cSrcweir                 boolean[] bBooleans = (boolean[]) AnyConverter.toArray(_oUnoObject);
331cdf0e10cSrcweir                 sDisplayValues = new String[bBooleans.length];
332cdf0e10cSrcweir                 for (int i = 0; i < bBooleans.length; i++){
333cdf0e10cSrcweir                     sDisplayValues[i] = Boolean.toString(bBooleans[i]);
334cdf0e10cSrcweir                 }
335cdf0e10cSrcweir                 break;
336cdf0e10cSrcweir             case TypeClass.BYTE_value:
337cdf0e10cSrcweir                 byte[] bBytes = (byte[]) AnyConverter.toArray(_oUnoObject);
338cdf0e10cSrcweir                 sDisplayValues = new String[bBytes.length];
339cdf0e10cSrcweir                 for (int i = 0; i < bBytes.length; i++){
340cdf0e10cSrcweir                     sDisplayValues[i] = "" + bBytes[i];
341cdf0e10cSrcweir                 }
342cdf0e10cSrcweir                 break;
343cdf0e10cSrcweir             case TypeClass.DOUBLE_value:
344cdf0e10cSrcweir                 double[] fdoubles = (double[]) AnyConverter.toArray(_oUnoObject);
345cdf0e10cSrcweir                 sDisplayValues = new String[fdoubles.length];
346cdf0e10cSrcweir                 for (int i = 0; i < fdoubles.length; i++){
347cdf0e10cSrcweir                     sDisplayValues[i] = String.valueOf(fdoubles[i]);
348cdf0e10cSrcweir                 }
349cdf0e10cSrcweir                 break;
350cdf0e10cSrcweir             case TypeClass.FLOAT_value:
351cdf0e10cSrcweir                 float[] ffloats = (float[]) AnyConverter.toArray(_oUnoObject);
352cdf0e10cSrcweir                 sDisplayValues = new String[ffloats.length];
353cdf0e10cSrcweir                 for (int i = 0; i < ffloats.length; i++){
354cdf0e10cSrcweir                     sDisplayValues[i] = String.valueOf(ffloats[i]);
355cdf0e10cSrcweir                 }
356cdf0e10cSrcweir                 break;
357cdf0e10cSrcweir             case TypeClass.LONG_value:
358cdf0e10cSrcweir                 int[] nints = (int[]) AnyConverter.toArray(_oUnoObject);
359cdf0e10cSrcweir                 sDisplayValues = new String[nints.length];
360cdf0e10cSrcweir                 for (int i = 0; i < nints.length; i++){
361cdf0e10cSrcweir                     sDisplayValues[i] = String.valueOf(nints[i]);
362cdf0e10cSrcweir                 }
363cdf0e10cSrcweir                 break;
364cdf0e10cSrcweir             case TypeClass.HYPER_value:
365cdf0e10cSrcweir                 long[] nlongs = (long[]) AnyConverter.toArray(_oUnoObject);
366cdf0e10cSrcweir                 sDisplayValues = new String[nlongs.length];
367cdf0e10cSrcweir                 for (int i = 0; i < nlongs.length; i++){
368cdf0e10cSrcweir                     sDisplayValues[i] = String.valueOf(nlongs[i]);
369cdf0e10cSrcweir                 }
370cdf0e10cSrcweir                 break;
371cdf0e10cSrcweir             case TypeClass.SHORT_value:
372cdf0e10cSrcweir                 short[] nShorts = (short[]) AnyConverter.toArray(_oUnoObject);
373cdf0e10cSrcweir                 sDisplayValues = new String[nShorts.length];
374cdf0e10cSrcweir                 for (int i = 0; i < nShorts.length; i++){
375cdf0e10cSrcweir                     sDisplayValues[i] = "" +  nShorts[i];
376cdf0e10cSrcweir                 }
377cdf0e10cSrcweir                 break;
378cdf0e10cSrcweir             case TypeClass.CHAR_value:
379cdf0e10cSrcweir                 break;
380cdf0e10cSrcweir             default:
381cdf0e10cSrcweir                 System.out.println("Value could not be retrieved: " + aType.getTypeClass().getClass().getName());
382cdf0e10cSrcweir             }
383cdf0e10cSrcweir         return sDisplayValues;
384cdf0e10cSrcweir     }
385cdf0e10cSrcweir     catch( Exception e ) {
386cdf0e10cSrcweir         System.err.println( e );
387cdf0e10cSrcweir         return null;
388cdf0e10cSrcweir     }}
389cdf0e10cSrcweir 
390cdf0e10cSrcweir 
sequenceComponentType(Type sequenceType)391cdf0e10cSrcweir     private static Type sequenceComponentType(Type sequenceType) {
392cdf0e10cSrcweir //        assert sequenceType.getTypeClass() == TypeClass.SEQUENCE;
393cdf0e10cSrcweir         String n = sequenceType.getTypeName();
394cdf0e10cSrcweir         final String PREFIX = "[]";
395cdf0e10cSrcweir //        assert n.startsWith(PREFIX);
396cdf0e10cSrcweir         return new Type(n.substring(PREFIX.length()));
397cdf0e10cSrcweir     }
398cdf0e10cSrcweir 
399cdf0e10cSrcweir 
getNodeDescription(Object _oUnoObject, int _nIndex)400cdf0e10cSrcweir     public static String getNodeDescription(Object _oUnoObject, int _nIndex){
401cdf0e10cSrcweir         return getNodeDescription(_oUnoObject) + "[" + (_nIndex + 1) + "]";
402cdf0e10cSrcweir     }
403cdf0e10cSrcweir 
404cdf0e10cSrcweir 
getNodeDescription(Object _oUnoObject)405cdf0e10cSrcweir     public static String getNodeDescription(Object _oUnoObject){
406cdf0e10cSrcweir         XServiceInfo xServiceInfo = ( XServiceInfo ) UnoRuntime.queryInterface( XServiceInfo.class, _oUnoObject );
407cdf0e10cSrcweir         if ( xServiceInfo != null ) {
408cdf0e10cSrcweir             return xServiceInfo.getImplementationName();
409cdf0e10cSrcweir         }
410cdf0e10cSrcweir         String sClassName = _oUnoObject.getClass().getName();
411cdf0e10cSrcweir         if (Introspector.getIntrospector().isObjectPrimitive(_oUnoObject)){         //super.isO{sObjectClassName.equals("java.lang.String"))issClassName.equals("java.lang.String"))
412cdf0e10cSrcweir             return _oUnoObject.toString();
413cdf0e10cSrcweir         }
414cdf0e10cSrcweir         else{
415cdf0e10cSrcweir             return _oUnoObject.getClass().getName();
416cdf0e10cSrcweir         }
417cdf0e10cSrcweir     }
418cdf0e10cSrcweir 
setParameterObjects(Object[] _oParamObjects)419cdf0e10cSrcweir     public void setParameterObjects(Object[] _oParamObjects){
420cdf0e10cSrcweir         m_oParamObjects = _oParamObjects;
421cdf0e10cSrcweir     }
422cdf0e10cSrcweir 
getParameterObjects()423cdf0e10cSrcweir     public Object[] getParameterObjects(){
424cdf0e10cSrcweir         return m_oParamObjects;
425cdf0e10cSrcweir     }
426cdf0e10cSrcweir }
427