xDesktop=uno.createDesktop() -- bootstrap & get access to XDesktop xcl=xDesktop~XComponentLoader -- get XComponentLoader interface uri="private:factory/sdraw" -- new sdraw document doc=xcl~loadComponentFromURL(uri,"_blank",0,.uno~noProps) xsf=doc~XMultiServiceFactory -- get the service manager (factory) -- get access to the first draw page xDrawPage = doc~XDrawPagesSupplier~getDrawPages~getByIndex(0)~XDrawPage -- create a Ellipse shapes and determine their position and size head=xsf~createInstance("com.sun.star.drawing.EllipseShape") ~xShape head~setPosition(.bsf~new("com.sun.star.awt.Point", 5500, 2200)) head~setSize(.bsf~new("com.sun.star.awt.Size", 10000, 10000)) eyeLeft=xsf~createInstance("com.sun.star.drawing.EllipseShape") ~xShape eyeLeft~setPosition(.bsf~new("com.sun.star.awt.Point", 7500, 5000)) eyeLeft~setSize(.bsf~new("com.sun.star.awt.Size", 2000, 2000)) eyeRight=xsf~createInstance("com.sun.star.drawing.EllipseShape") ~xShape eyeRight~setPosition(.bsf~new("com.sun.star.awt.Point", 11500, 5000)) eyeRight~setSize(.bsf~new("com.sun.star.awt.Size", 2000, 2000)) mouth=xsf~createInstance("com.sun.star.drawing.EllipseShape") ~xShape mouth~setPosition(.bsf~new("com.sun.star.awt.Point", 8000, 8000)) mouth~setSize(.bsf~new("com.sun.star.awt.Size", 5000, 2000)) text=xsf~createInstance("com.sun.star.drawing.TextShape") ~xShape text~setPosition(.bsf~new("com.sun.star.awt.Point", 8750, 13000)) text~setSize(.bsf~new("com.sun.star.awt.Size", 5000, 2000)) xDrawPage~add(head) -- add new shape to first draw page xDrawPage~add(eyeLeft) xDrawPage~add(eyeRight) xDrawPage~add(mouth) xDrawPage~add(text) cr="0d"x -- ASCII carriage return char text~XText~setString("You again?!") ::requires UNO.CLS -- get UNO support