/*
 * MRIforOOo_call.java
 *
 * Created on 2011.05.17 - 14:52:31
 *
 */

package com.example;

import com.sun.star.beans.XIntrospection;
import com.sun.star.uno.XComponentContext;
import com.sun.star.comp.helper.Bootstrap;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.uno.UnoRuntime;

public class MRIforOOo_call {
    
    /** Creates a new instance of MRIforOOo_call */
    public MRIforOOo_call() {
    }

    public static void main(String[] args) {
        try {
            // get the remote office component context
            XComponentContext xContext = Bootstrap.bootstrap();
            if (xContext == null) {
                System.err.println("ERROR: Could not bootstrap default Office.");
            }
            XMultiComponentFactory xMultComponentFactory = xContext.getServiceManager();
            Object desktop = xMultComponentFactory.createInstanceWithContext("com.sun.star.frame.Desktop", xContext);
            Object oMRI = xMultComponentFactory.createInstanceWithContext("mytools.Mri", xContext);
            XIntrospection xIntrospection = (XIntrospection) UnoRuntime.queryInterface(XIntrospection.class, oMRI);
            xIntrospection.inspect(desktop);
        }
        catch (java.lang.Exception e){
            e.printStackTrace();
        }
        finally {
            System.exit( 0 );
        }
    }
    
}
