line circle rectangle Nicole Scholz How can I draw shapes?

This example draws automatically a line, a circle and a rectangle

/* Retrieve the Desktop object, we need its XComponentLoader interface to load a new document*/ oDesktop = UNO.createDesktop() -- get the UNO Desktop service object xComponentLoader = oDesktop~{%see com.sun.star.frame.XDesktop%XDesktop}~{%see com.sun.star.frame.XComponentLoader%XComponentLoader} -- get componentLoader interface /* open the blank file */ url = "private:factory/sdraw" xDrawComponent = xComponentLoader~loadComponentFromURL(url, "_blank", 0, - .UNO~noProps) /* need document's factory to be able to insert created objects*/ xDocumentFactory = xDrawComponent~{%see com.sun.star.lang.XMultiServiceFactory%XMultiServiceFactory} /* get draw page by index */ xDrawPage = xDrawComponent~{%see com.sun.star.drawing.XDrawPagesSupplier%XDrawPagesSupplier}~getDrawPages~getByIndex(0)~{%see com.sun.star.drawing.XDrawPage%XDrawPage} /* create a line and add it to the shape */ xLine = xDocumentFactory~createInstance("{%see com.sun.star.drawing.LineShape}")~{%see com.sun.star.drawing.XShape%xShape} xLine~setPosition(.bsf~new("{%see com.sun.star.awt.Point}", 1000, 5000)) xLine~setSize(.bsf~new("{%see com.sun.star.awt.Size}", 19000, 0)) xDrawPage~add(xLine) /* create a circle and add it to the shape */ xCircle = xDocumentFactory~createInstance("{%see com.sun.star.drawing.EllipseShape}")~{%see com.sun.star.drawing.XShape%xShape} xCircle~setPosition(.bsf~new("{%see com.sun.star.awt.Point}", 2000, 15000)) xCircle~setSize(.bsf~new("{%see com.sun.star.awt.Size}", 5000, 5000)) xDrawPage~add(xCircle) /* create a rectangle and add it to the shape */ xBox = xDocumentFactory~createInstance("{%see com.sun.star.drawing.RectangleShape}")~{%see com.sun.star.drawing.XShape%xShape} xBox~setPosition(.bsf~new("{%see com.sun.star.awt.Point}", 2000, 8000)) xBox~setSize(.bsf~new("{%see com.sun.star.awt.Size}", 5000, 5000)) xDrawPage~add(xBox) ::requires UNO.cls -- get UNO support