// the following code will demonstrate how to
// make a selection that contains our new created ControlShape
XModel xModel = (XModel)UnoRuntime.queryInterface( XModel.class,
xComponent );
XController xController = xModel.getCurrentController();
XSelectionSupplier xSelectionSupplier =(XSelectionSupplier)
UnoRuntime.queryInterface( XSelectionSupplier.class, xController );
// take care to use the global service factory only and not the one
// that is provided by the component if you create the ShapeColletion
XShapes xSelection = (XShapes)UnoRuntime.queryInterface( XShapes.class,
xOfficeContext.getServiceManager().createInstanceWithContext(
"com.sun.star.drawing.ShapeCollection", xOfficeContext ) );
xSelection.add( xShape );
xSelectionSupplier.select( xSelection );
}
catch( java.lang.Exception ex )
{
System.out.println( ex );
}