// And set the AnchorTypes of both shapes to 'AT_PARAGRAPH'
xRectProps.setPropertyValue ( "AnchorType", TextContentAnchorType.AT_PARAGRAPH );
xEllipseProps.setPropertyValue ( "AnchorType", TextContentAnchorType.AT_PARAGRAPH );
// Access the XDrawPageSupplier interface of the document
XDrawPageSupplier xDrawPageSupplier = ( XDrawPageSupplier) UnoRuntime.queryInterface (
XDrawPageSupplier.class, mxDoc );
// Get the XShapes interface of the draw page
XShapes xShapes = ( XShapes ) UnoRuntime.queryInterface (
XShapes.class, xDrawPageSupplier.getDrawPage () );
// Add both shapes
xShapes.add ( xEllipse );
xShapes.add ( xRect );