Package com.sun.star.container

Examples of com.sun.star.container.XSet


            XPropertySet xProps = 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


        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 )
        {
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

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

    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

            // 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. */
      XMultiComponentFactory xmulticomponentfactory =
      xcomponentcontext.getServiceManager();
     
      // Querying for the interface XSet on XMultiComponentFactory
      XSet xsetMultiComponentFactory = ( XSet ) UnoRuntime.queryInterface(
          XSet.class, xmulticomponentfactory );
     
      // Getting the XSingleServiceFactory for the Car component
      XSingleServiceFactory xsingleservicefactoryCar =
      Car.__getServiceFactory( "Car$_Car", ( XMultiServiceFactory )
          UnoRuntime.queryInterface( XMultiServiceFactory.class,
                                     xmulticomponentfactory ), null );
     
      // Inserting the XSingleServiceFactory into the container
      xsetMultiComponentFactory.insert( xsingleservicefactoryCar );
     
      // Creating an instance of the Car component
      Object objectCar = xmulticomponentfactory.createInstanceWithContext(
      "org.OpenOffice.Car", xcomponentcontext );
     
      // Querying for the interface XAccelerationControl
      XAccelerationControl xaccelerationcontrol = ( XAccelerationControl )
      UnoRuntime.queryInterface( XAccelerationControl.class, objectCar );
     
      // Print the current speed
      System.out.println( "Current speed: " + Car._Car.getCurrentSpeed() );
     
      // Speed up
      xaccelerationcontrol.speedUp( 123.55 );
     
      // Print the current speed
      System.out.println( "Current speed: " + Car._Car.getCurrentSpeed() );
     
      // Slow down
      xaccelerationcontrol.slowDown( 112.43 );
     
      // Print the current speed
      System.out.println( "Current speed: " + Car._Car.getCurrentSpeed() );
     
      // Querying for the interface XDrivingDirection
      XDrivingDirection xdrivingdirection = ( XDrivingDirection )
      UnoRuntime.queryInterface( XDrivingDirection.class, objectCar );
     
      // Print the current angle
      System.out.println( "Current angle: " + Car._Car.getCurrentAngle() );
     
      // Changing the direction
      xdrivingdirection.turnLeft( 100 );
     
      // Print the current angle
      System.out.println( "Current angle: " + Car._Car.getCurrentAngle() );
     
      xdrivingdirection.turnRight( 150 );
     
      // Print the current angle
      System.out.println( "Current angle: " + Car._Car.getCurrentAngle() );
     
      // Querying for the interface XPropertySet
      XPropertySet xpropertysetCar = ( XPropertySet )
      UnoRuntime.queryInterface( XPropertySet.class, objectCar );
     
      // Setting the number of seats
      xpropertysetCar.setPropertyValue( "Seats", new Short( ( short ) 5 ) );
     
      // Print the number of seats
      System.out.println( "Number of seats: " +
      xpropertysetCar.getPropertyValue( "Seats" ) );
     
      // Setting the color of the car
      xpropertysetCar.setPropertyValue( "Color", new Long( ( long ) 232 ) );
     
      // Print the color of the car
      System.out.println( "Color of the car: " +
      xpropertysetCar.getPropertyValue( "Color" ) );
     
      // Get properties from the car.
      XPropertySetInfo xpropertysetinfo = xpropertysetCar.getPropertySetInfo();
     
      // Print the number of the color of the car.
      System.out.println( "Color of the car: " +
      xpropertysetinfo.getPropertyByName( "Color" ).Attributes );

      // Removing the XSingleServiceFactory of Car from the container
      xsetMultiComponentFactory.remove( xsingleservicefactoryCar );
     
      System.exit(0);
    }
    catch( Exception exception ) {
      System.err.println( exception );
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
      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

         object. */
      XMultiComponentFactory xmulticomponentfactory =
      xcomponentcontext.getServiceManager();
     
      // Querying for the interface XSet on XMultiComponentFactory
      XSet xsetMultiServiceFactory = ( XSet ) UnoRuntime.queryInterface(
      XSet.class, xmulticomponentfactory );
     
      // Getting the XSingleServiceFactory for the minimal component
      XSingleServiceFactory xsingleservicefactoryMinimalComponent =
      MinimalComponent.__getServiceFactory(
      "MinimalComponent$MinimalComponentImplementation",
      ( XMultiServiceFactory ) UnoRuntime.queryInterface(
      XMultiServiceFactory.class, xmulticomponentfactory ),
      null );
     
      // Inserting the XSingleServiceFactory into the container
      xsetMultiServiceFactory.insert( xsingleservicefactoryMinimalComponent );
     
      // Creating an instance of the minimal component
      Object objectMinimalComponent =
      xmulticomponentfactory.createInstanceWithContext(
      "org.OpenOffice.MinimalComponent", xcomponentcontext );
     
      XServiceInfo xserviceinfoMinimalComponent = ( XServiceInfo )
      UnoRuntime.queryInterface( XServiceInfo.class,
      objectMinimalComponent );
     
      System.out.println( "\nXServiceInfo is used to get the implementation name:\n    -> " +
                          xserviceinfoMinimalComponent.getImplementationName() +
                          "\nOk");
     
      // Removing the XSingleServiceFactory of the minimal Component from the container
      xsetMultiServiceFactory.remove( xsingleservicefactoryMinimalComponent );
     
      xcomponentcontext = null;
     
      System.exit(0);
    }
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

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.