Package com.sun.star.lang

Examples of com.sun.star.lang.XMultiComponentFactory


        dcp = dcp.substring(index + 1).trim();
       
        rootOid = dcp.trim().trim();

        XComponentContext ctx = com.sun.star.comp.helper.Bootstrap.createInitialComponentContext( null );
        XMultiComponentFactory smgr = ctx.getServiceManager();
        XMultiServiceFactory oldsmgr =
            UnoRuntime.queryInterface( XMultiServiceFactory.class, smgr );

        // prepare servicemanager
        XSet set = UnoRuntime.queryInterface(XSet.class, smgr);
        Object o = com.sun.star.comp.bridge.TestComponent.__getServiceFactory(
            "com.sun.star.comp.bridge.TestComponent$_TestObject", oldsmgr,null );
        set.insert(o);
       
    XAcceptor xAcceptor = Acceptor.create(ctx);

        while( true )
        {
            System.err.println("waiting for connect...");

            XConnection xConnection = xAcceptor.accept(conDcp);
           
            XBridgeFactory xBridgeFactory = UnoRuntime.queryInterface(
                XBridgeFactory.class,
                smgr.createInstanceWithContext("com.sun.star.bridge.BridgeFactory",ctx));
           
            XBridge xBridge = xBridgeFactory.createBridge(
                "", protDcp, xConnection, new InstanceProvider(ctx));

            if (singleaccept) {
View Full Code Here


    protected TestServiceFactory getTestServiceFactory() throws Exception {
        return new TestServiceFactory() {
                public Object get() throws Exception {
                    XComponentContext context
                        = Bootstrap.createInitialComponentContext(null);
                    XMultiComponentFactory serviceManager
                        = context.getServiceManager();
                    UnoRuntime.queryInterface(XSet.class, serviceManager).
                        insert(new TestService());
                    return serviceManager.createInstanceWithContext(
                        "testtools.servicetests.TestService2", context);
                }

                public void dispose() throws Exception {}
            };
View Full Code Here

    public static final class Server {
        public static void main(String[] arguments) throws Exception {
            XComponentContext context
                = Bootstrap.createInitialComponentContext(null);
            XMultiComponentFactory serviceManager
                = context.getServiceManager();
            UnoRuntime.queryInterface(XSet.class, serviceManager).
                insert(new TestService());
            final Object instance = serviceManager.createInstanceWithContext(
                "testtools.servicetests.TestService2", context);
            XBridgeFactory bridgeFactory
                = UnoRuntime.queryInterface(
                    XBridgeFactory.class,
                    serviceManager.createInstanceWithContext(
                        "com.sun.star.bridge.BridgeFactory", context));
            XConnection connection = Acceptor.create(context).accept(
                CONNECTION_DESCRIPTION);
            bridgeFactory.createBridge(
                "", PROTOCOL_DESCRIPTION, connection,
View Full Code Here

   */
  protected boolean create (String docType, String title, String templateUri, boolean hide)
  throws Exception
  {
    // get the service manager from the office
    XMultiComponentFactory xMCF = getConnection ().getComponentContext ().getServiceManager();

    // create a new instance of the the desktop
    Object oDesktop = xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", getConnection ().getComponentContext ());
    // XDesktop desktop = (XDesktop)(UnoRuntime.queryInterface(com.sun.star.frame.XDesktop.class, oDesktop));

    // Define general document properties (see com.sun.star.document.MediaDescriptor for the possibilities).
    ArrayList<PropertyValue> props = new ArrayList<PropertyValue>();
    if (templateUri != null) {
View Full Code Here

   */
  public boolean openDesktop (String uri, boolean open) throws Exception, MalformedURLException {
    myLog.debug ("open({})", uri);

    // get the service manager from the office
    XMultiComponentFactory xMCF = getConnection ().getComponentContext ().getServiceManager();

    // create a new instance of the the desktop
    Object oDesktop = xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", getConnection ().getComponentContext ());
    XDesktop desktop = (XDesktop)(UnoRuntime.queryInterface(com.sun.star.frame.XDesktop.class, oDesktop));

    XEnumerationAccess components = desktop.getComponents ();
    for (XEnumeration xEnum = components.createEnumeration () ; xEnum.hasMoreElements() ; ) {
      XComponent comp = (XComponent)((Any)(xEnum.nextElement ())).getObject ();
View Full Code Here

  public boolean open (String uri) throws Exception, MalformedURLException
  {
    myLog.debug ("open({})", uri);

    // get the service manager from the office
    XMultiComponentFactory xMCF = getConnection ().getComponentContext ().getServiceManager();

    // create a new instance of the the desktop
    Object oDesktop = xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", getConnection ().getComponentContext ());

    // query the desktop object for the XComponentLoader
    XComponentLoader xCLoader = (XComponentLoader)(UnoRuntime.queryInterface (XComponentLoader.class, oDesktop));

    PropertyValue [] szEmptyArgs = new PropertyValue [0];
View Full Code Here

   *
   */
  public XFunctionAccess getFunctionAccess () throws Exception
  {
    if (myFunctionAccess == null) {
      XMultiComponentFactory xServiceManager = getConnection ().getRemoteServiceManager ();
      Object aFuncInst = xServiceManager.createInstanceWithContext ("com.sun.star.sheet.FunctionAccess", getConnection ().getComponentContext ());
      myFunctionAccess = (com.sun.star.sheet.XFunctionAccess)
        (UnoRuntime.queryInterface (com.sun.star.sheet.XFunctionAccess.class, aFuncInst));
    }
    return myFunctionAccess;
  }
View Full Code Here

    XSingleComponentFactory smgr_fac = (XSingleComponentFactory)UnoRuntime.queryInterface(
            XSingleComponentFactory.class, xImpLoader.activate(
                "com.sun.star.comp.servicemanager.ServiceManager", null, null, null ) );
       
    // Create an instance of the ServiceManager
    XMultiComponentFactory xSMgr = (XMultiComponentFactory)UnoRuntime.queryInterface(
            XMultiComponentFactory.class, smgr_fac.createInstanceWithContext( null ) );
       
    // post init loader
    XInitialization xInit = (XInitialization)UnoRuntime.queryInterface(
            XInitialization.class, xImpLoader );
View Full Code Here

            Process p = Runtime.getRuntime().exec( cmdArray );
            pipe( p.getInputStream(), System.out, "CO> " );
            pipe( p.getErrorStream(), System.err, "CE> " );
           
            // initial service manager
            XMultiComponentFactory xLocalServiceManager =
                xLocalContext.getServiceManager();
            if ( xLocalServiceManager == null )
                throw new BootstrapException( "no initial service manager!" );
           
            // create a URL resolver
View Full Code Here

    // XTestDialogHandler
    public String createDialog( String DialogURL, XModel xModel, XFrame xFrame ) {
      m_xFrame = xFrame;
   
      try {
        XMultiComponentFactory xMCF = m_xCmpCtx.getServiceManager();
        Object obj;

        // If valid we must pass the XModel when creating a DialogProvider object
        if( xModel != null ) {
          Object[] args = new Object[1];
          args[0] = xModel;
                                  
          obj = xMCF.createInstanceWithArgumentsAndContext(
            "com.sun.star.awt.DialogProvider2", args, m_xCmpCtx );
        }
        else {
          obj = xMCF.createInstanceWithContext(
            "com.sun.star.awt.DialogProvider2", m_xCmpCtx );
        }

        XDialogProvider2 xDialogProvider = (XDialogProvider2)
          UnoRuntime.queryInterface( XDialogProvider2.class, obj );
View Full Code Here

TOP

Related Classes of com.sun.star.lang.XMultiComponentFactory

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.