Package com.sun.star.container

Examples of com.sun.star.container.XSet


    public static void removeFromServiceManager(
        XMultiComponentFactory serviceManager, Object singleFactory )
        throws com.sun.star.uno.Exception
    {
        XSet set = (XSet ) UnoRuntime.queryInterface( XSet.class, serviceManager );
        set.remove( singleFactory );
       
    }
View Full Code Here


      XImplementationLoader loader = (XImplementationLoader)UnoRuntime.queryInterface(XImplementationLoader.class,
                                              compContext._xMultiServiceFactory.createInstance("com.sun.star.loader.Java"));

      Object serviceManager = compContext._xMultiServiceFactory.createInstance("com.sun.star.lang.ServiceManager");
      XSet serviceManager_xSet = (XSet)UnoRuntime.queryInterface(XSet.class, serviceManager);

      XRegistryKey xRegistryKey = new RegistryKey("ROOT");

      loader.writeRegistryInfo(xRegistryKey, null, componentName);

      String keys[] = xRegistryKey.getKeyNames();
      for(int j = 0; j < keys.length; ++ j) {
        String implName = keys[j].substring(1);
        implName = implName.substring(0, implName.length() - "/UNO/SERVICES".length());

        Object factory = loader.activate(implName, null, componentName, xRegistryKey);
        XSingleServiceFactory xSingleServiceFactory = (XSingleServiceFactory)UnoRuntime.queryInterface(XSingleServiceFactory.class,
                                                         factory);
         
        if (xSingleServiceFactory == null)
          throw new com.sun.star.loader.CannotActivateFactoryException("Can not get factory for " +  implName);
         
        serviceManager_xSet.insert(xSingleServiceFactory);
      }

      return serviceManager;
    }
View Full Code Here

        idx = arg.indexOf(',');
      }
      comps.addElement(arg);

      // now use the XSet interface at the ServiceManager to add the factory of the loader
        XSet xSet = (XSet) UnoRuntime.queryInterface(XSet.class, compContext._xMultiServiceFactory);

      for(int i = 0; i < comps.size(); ++ i) {
        Object object = new CompContext((String)comps.elementAt(i)).getObject();

        XSingleServiceFactory xSingleServiceFactory = (XSingleServiceFactory)UnoRuntime.queryInterface(XSingleServiceFactory.class,
                                                         object);
        if(xSingleServiceFactory == null) {
          XMultiServiceFactory xMultiServiceFactory = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class,
                                                           object);

          if(xMultiServiceFactory != null) {
            String services[] = xMultiServiceFactory.getAvailableServiceNames();
           
            for(int j = 0; j < services.length; ++ j)
              xSet.insert(new DelegatorSingleServiceFactory(xMultiServiceFactory, services[j]));
          }
          else
            System.err.println("warning! -- " + object + " is neither XSingleServiceFactory nor XMultiServiceFactory");
        }
        else
          xSet.insert(xSingleServiceFactory);
      }
    }
View Full Code Here

      XComponent xcomponent = xcomponentloader.loadComponentFromURL(
      "private:factory/scalc", "_blank", 0,
      new PropertyValue[0] );
     
      // Querying for the interface XSet on the XMultiServiceFactory
      XSet xsetMultiComponentFactory = ( XSet ) UnoRuntime.queryInterface(
      XSet.class, xmulticomponentfactory );
     
      // Getting the single service factory of the instance inspector
      XSingleServiceFactory xsingleservicefactoryInstanceInspector =
      InstanceInspector.__getServiceFactory(
      "InstanceInspector$_InstanceInspector", ( XMultiServiceFactory )
      UnoRuntime.queryInterface( XMultiServiceFactory.class,
      xmulticomponentfactory ), null );
     
      // Inserting the single service factory into the multi service factory
      // Only for this example, so this example is independent of deplying the
      // InstanceInspector component in your office.
      xsetMultiComponentFactory.insert( xsingleservicefactoryInstanceInspector );
     
      // Creating an instance of the instance inspector with arguments
      Object objectInstanceInspector =
      xmulticomponentfactory.createInstanceWithArgumentsAndContext(
      "org.OpenOffice.InstanceInspector",
      new Object[]{ xmulticomponentfactory }, xcomponentcontext );
     
      // Create a new instance inspector
      XInstanceInspector xinstanceinspector = ( XInstanceInspector )
      UnoRuntime.queryInterface( XInstanceInspector.class,
      objectInstanceInspector );
     
      // Inspect the calc
      xinstanceinspector.inspect( xcomponent );
     
      // Remove instance inspector from the container
      xsetMultiComponentFactory.remove( xsingleservicefactoryInstanceInspector );   

      System.out.println("\nPlease inspect the new spreadsheet document component." +
                         " Press RETURN to exit");
      DataInputStream inputStream = new DataInputStream(System.in);
      inputStream.read();
View Full Code Here

            XPropertySet xProps = (XPropertySet)UnoRuntime.queryInterface(
                XPropertySet.class, xMgr );
            XComponentContext xContext = (XComponentContext)AnyConverter.toObject(
                new Type( XComponentContext.class ), xProps.getPropertyValue( "DefaultContext" ) );
            // insert java loader
            XSet xSet = (XSet)AnyConverter.toObject(
                new Type( XSet.class ), xContext.getServiceManager() );
            xSet.insert( new com.sun.star.comp.loader.JavaLoaderFactory( xMgr ) );
            // get rdb of smgr
            XSimpleRegistry xRDB = (XSimpleRegistry)AnyConverter.toObject(
                new Type( XSimpleRegistry.class ), xProps.getPropertyValue( "Registry" ) );
            // register impl
            XImplementationRegistration xImpReg =
View Full Code Here

            // Querying for the interface XSpreadsheetDocument on XComponent
            XSpreadsheetDocument xspreadsheetdocument = ( XSpreadsheetDocument )
            UnoRuntime.queryInterface( XSpreadsheetDocument.class, xcomponent );
           
            // Querying for the interface XSet on the XMultiComponentFactory
            XSet xsetMultiComponentFactory = ( XSet ) UnoRuntime.queryInterface(
            XSet.class, xmulticomponentfactory );
           
            // Getting the XSingleServiceFactory for the ToDo component
            XSingleServiceFactory xsingleservicefactoryToDo =
            ToDo.__getServiceFactory( "ToDo$_ToDo", ( XMultiServiceFactory )
            UnoRuntime.queryInterface( XMultiServiceFactory.class,
            xmulticomponentfactory ), null );
           
            // Inserting the XSingleServiceFactory into the container
            xsetMultiComponentFactory.insert( xsingleservicefactoryToDo );
           
            // Creating an instance of the ToDo component
            Object objectToDo =
            xmulticomponentfactory.createInstanceWithContext(
            "org.openoffice.ToDo", xcomponentcontext );
           
            if ( objectToDo != null ) {
                // Querying for the interface XToDo
                XToDo xToDo = ( XToDo )
                UnoRuntime.queryInterface( XToDo.class, objectToDo );
               
                // Recalculate the spreadsheet
                xToDo.recalc( xspreadsheetdocument );
            }
           
            // Removing the XSingleServiceFactory of ToDo from the container
            xsetMultiComponentFactory.remove( xsingleservicefactoryToDo );
           
            System.exit(0);
        }
        catch( Exception exception ) {
            System.err.println( exception );
View Full Code Here

    Object[] iniargs = { xMultiFac };  
    xInit.initialize( iniargs );
   

    // now use the XSet interface at the ServiceManager to add the factory of the loader
    XSet xSet = (XSet) UnoRuntime.queryInterface(XSet.class, xMultiFac);

    // Get the factory of the loader       
    XSingleServiceFactory xSingleServiceFactory = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class,
                                                    xImpLoader.activate("com.sun.star.comp.loader.JavaLoader", null, null, null));

    // add the javaloader
    xSet.insert(xSingleServiceFactory);
   
    // add the service manager
    xSet.insert(xManagerFac);

    // Get the factory of the URLResolver       
    xSingleServiceFactory = (XSingleServiceFactory)UnoRuntime.queryInterface(XSingleServiceFactory.class,
                                         xImpLoader.activate("com.sun.star.comp.urlresolver.UrlResolver", null, null, null));
    xSet.insert(xSingleServiceFactory);

    // add the bridgefactory
    xSingleServiceFactory = (XSingleServiceFactory)UnoRuntime.queryInterface(XSingleServiceFactory.class,
                                         xImpLoader.activate("com.sun.star.comp.bridgefactory.BridgeFactory", null, null, null));
    xSet.insert(xSingleServiceFactory);

    // add the connector
    xSingleServiceFactory = (XSingleServiceFactory)UnoRuntime.queryInterface(XSingleServiceFactory.class,
                                         xImpLoader.activate("com.sun.star.comp.connections.Connector", null, null, null));
    xSet.insert(xSingleServiceFactory);
   
    // add the acceptor
    xSingleServiceFactory = (XSingleServiceFactory)UnoRuntime.queryInterface(XSingleServiceFactory.class,
                                         xImpLoader.activate("com.sun.star.comp.connections.Acceptor", null, null, null));
    xSet.insert(xSingleServiceFactory);

    return xMultiFac;
  }
View Full Code Here

            oFilter = new Filter();
            oDocumentHandler = new DocumentHandler();
      oThreadRunner = new ThreadRunner(xMSF);
            oCeptor = new DispatchProviderInterceptor() ;
            oAttributeList = new AttributeList();
            XSet xMSFSet = (XSet)UnoRuntime.queryInterface(XSet.class, xMSF);

            try {
                xMSFSet.insert(oHandler);
                xMSFSet.insert(oConnector);
                xMSFSet.insert(oFilter);
                xMSFSet.insert(oDocumentHandler);
    xMSFSet.insert(oThreadRunner);
                xMSFSet.insert(oCeptor);
                xMSFSet.insert(oAttributeList);
            } catch (ElementExistException e) {
                System.out.println(e.toString());
            } catch (IllegalArgumentException e) {
                System.out.println(e.toString());
            }
View Full Code Here

        try {
            if (oHandler != null) {
                oHandler.dispose();
            }
            if (MSF != null) {
                XSet xMSFSet = (XSet)UnoRuntime.queryInterface(XSet.class, MSF);
                xMSFSet.remove(oHandler);
                xMSFSet.remove(oFilter);
                xMSFSet.remove(oConnector);
                xMSFSet.remove(oDocumentHandler);
    xMSFSet.remove(oThreadRunner);
                xMSFSet.remove(oAttributeList);
            }
        } catch (Exception e){
            System.out.println(e.toString());
        }
View Full Code Here

        try
        {
            // at our service factory, insert a new factory for our CallbackComponent
            // this will allow the Basic code in our test documents to call back into this test case
            // here, by just instantiating this service
            final XSet globalFactory = (XSet) UnoRuntime.queryInterface(
                    XSet.class, getORB());
            m_callbackFactory = new CallbackComponentFactory();
            globalFactory.insert(m_callbackFactory);

            // register ourself as listener at the global event broadcaster
            final XDocumentEventBroadcaster broadcaster = (XDocumentEventBroadcaster) UnoRuntime.queryInterface(
                    XDocumentEventBroadcaster.class, getORB().createInstance("com.sun.star.frame.GlobalEventBroadcaster"));
            broadcaster.addDocumentEventListener(this);
View Full Code Here

TOP

Related Classes of com.sun.star.container.XSet

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.