Package com.sun.star.uno

Examples of com.sun.star.uno.XComponentContext


                                            XDerived.class, test2Aa);

                                    Hashtable params = new Hashtable();
                                    params.put("UNO_TYPES", unoTypes);
                                    params.put("UNO_SERVICES", unoServices);
                                    XComponentContext context = Bootstrap.
                                       defaultBootstrap_InitialComponentContext(
                                            null, params);
                                    XMultiComponentFactory factory
                                        = context.getServiceManager();
                                    XImplementationLoader loader
                                        = (XImplementationLoader)
                                        UnoRuntime.queryInterface(
                                            XImplementationLoader.class,
                                            factory.createInstanceWithContext(
View Full Code Here


       private XToolkit queryAWTToolkit()
               throws com.sun.star.uno.Exception
       {
      // Create a UNO toolkit.
      XMultiComponentFactory  compfactory;
      XComponentContext xContext = mConnection.getComponentContext();
      if ( xContext != null )
      {
        compfactory     = mConnection.getComponentContext().getServiceManager();
        XMultiServiceFactory    factory;
        factory = (XMultiServiceFactory)UnoRuntime.queryInterface(
View Full Code Here

                    {
                        throw new com.sun.star.uno.RuntimeException(
                            "service manager does not support XPropertySet!",
                            this );
                    }
                    XComponentContext xContext = (XComponentContext)
                        AnyConverter.toObject(
                            new Type( XComponentContext.class ),
                            xProps.getPropertyValue( "DefaultContext" ) );
                    m_xMacroExpander = (XMacroExpander)AnyConverter.toObject(
                        new Type( XMacroExpander.class ),
                        xContext.getValueByName(
                            "/singletons/com.sun.star.util.theMacroExpander" )
                        );
                }
                // decode uric class chars
                String macro = URLDecoder.decode(
View Full Code Here

    protected XMultiServiceFactory connectAwareGetServiceFactory() throws com.sun.star.uno.Exception,
            com.sun.star.uno.RuntimeException,
            Exception {

        // Get component context
        XComponentContext xComponentContext =
                com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(null);

        // instantiate connector service
        Object x = xComponentContext.getServiceManager().createInstanceWithContext(
                "com.sun.star.connection.Connector", xComponentContext);

        XConnector xConnector = (XConnector) UnoRuntime.queryInterface(XConnector.class, x);

        String a[] = parseUnoUrl(sConnectionString);
        if (null == a) {
            throw new com.sun.star.uno.Exception("Couldn't parse uno-url " + sConnectionString);
        }

        // connect using the connection string part of the uno-url only.
        m_Connection = xConnector.connect(a[0]);

        x = xComponentContext.getServiceManager().createInstanceWithContext(
                "com.sun.star.bridge.BridgeFactory", xComponentContext);

        XBridgeFactory xBridgeFactory = (XBridgeFactory) UnoRuntime.queryInterface(
                XBridgeFactory.class, x);
View Full Code Here

            String stringUrl = "file:///" + stringDocumentName;
           
            /* Bootstraps a component context with the jurt base components
               registered. Component context to be granted to a component for running.
               Arbitrary values can be retrieved from the context. */
            XComponentContext xcomponentcontext =
                com.sun.star.comp.helper.Bootstrap.createInitialComponentContext( null );
           
            /* Gets the service manager instance to be used (or null). This method has
               been added for convenience, because the service manager is a often used
               object. */
            XMultiComponentFactory xmulticomponentfactory =
                xcomponentcontext.getServiceManager();
     
            /* Creates an instance of the component UnoUrlResolver which
               supports the services specified by the factory. */
            Object objectUrlResolver =
                xmulticomponentfactory.createInstanceWithContext(
View Full Code Here

        com.sun.star.uno.RuntimeException,
        com.sun.star.connection.NoConnectException,
        Exception {

        // Get component context
        final XComponentContext xcomponentcontext = com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(
            null);

        // initial serviceManager
        final XMultiComponentFactory xLocalServiceManager = xcomponentcontext.getServiceManager();

        // create a connector, so that it can contact the office
//        XUnoUrlResolver urlResolver = UnoUrlResolver.create(xcomponentcontext);
        final Object xUrlResolver = xLocalServiceManager.createInstanceWithContext(
            "com.sun.star.bridge.UnoUrlResolver", xcomponentcontext);
View Full Code Here

            // bootstrap UNO.
            String unorcName = getUnorcName(param);
            Hashtable env = new Hashtable();
            env.put("SYSBINDIR", getSysBinDir(param));

            XComponentContext xContext = null;
            try {
                xContext = Bootstrap.defaultBootstrap_InitialComponentContext(
                                                                 unorcName, env);
            }
            catch(Exception e) {
                e.printStackTrace();
                System.out.println("Could not get XComponentContext. Maybe you must add program folder to LD_LIBRARY_PATH");
                return null;
            }
            XMultiComponentFactory xMCF = xContext.getServiceManager();
            xMSF = (XMultiServiceFactory)UnoRuntime.queryInterface(
                                XMultiServiceFactory.class, xMCF);
        }
        return xMSF;
    }
View Full Code Here

            XMultiServiceFactory xMSF = (XMultiServiceFactory) param.getMSF();
            assure("could not create MultiServiceFactory.", xMSF != null);
            XPropertySet xPropertySet = (XPropertySet)
                UnoRuntime.queryInterface(XPropertySet.class, xMSF);
            Object defaultCtx = xPropertySet.getPropertyValue("DefaultContext");
            XComponentContext xContext = (XComponentContext)
                UnoRuntime.queryInterface(XComponentContext.class, defaultCtx);
            assure("could not get component context.", xContext != null);

            String temp = util.utils.getOfficeTemp/*Dir*/(xMSF);
            log.println("tempdir: " + temp);
View Full Code Here

import com.sun.star.uno.XComponentContext;

public class _ServiceManager extends MultiPropertyTest {

    public void _DefaultContext() {
        XComponentContext get = null;
        boolean res = false;
        try {
            get = (XComponentContext)AnyConverter.toObject(new Type(XComponentContext.class), oObj.getPropertyValue("DefaultContext"));
            res = get != null;
        } catch (com.sun.star.lang.IllegalArgumentException iae) {
View Full Code Here

    }

   
   
    public static XMultiComponentFactory getMultiComponentFactory() throws com.sun.star.uno.Exception, RuntimeException, java.lang.Exception{
        XComponentContext xcomponentcontext = Bootstrap.createInitialComponentContext(null);
        // initial serviceManager
        return xcomponentcontext.getServiceManager();
    }
View Full Code Here

TOP

Related Classes of com.sun.star.uno.XComponentContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.