In this example the line joint of 3 rectangles is changed with the LineJoint function.
/* 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}
/* draw a rectangle */
xrectangle = xDocumentFactory~createInstance("{%see com.sun.star.drawing.RectangleShape}")~{%see com.sun.star.drawing.XShape%xshape}
xrectangle~setPosition(.bsf~new("{%see com.sun.star.awt.Point}", 1000, 1000))
xrectangle~setSize(.bsf~new("{%see com.sun.star.awt.Size}", 5000, 5000))
xDrawPage~add(xrectangle) -- adds the rectangle to the draw document
/* change the colour properties */
xShapeProps = xrectangle~{%see com.sun.star.beans.XPropertySet%XPropertySet}
xShapeProps~setPropertyValue("FillColor", box("int", "191970"x ~c2d)) -- set fill colour blue
xShapeProps~setPropertyValue("LineColor", box("int", "48D1CC"x ~c2d)) -- set line colour turquoise
xShapeProps~setPropertyValue("LineWidth", box("int", "200")) -- set line width 20 millimeter
xShapeProps~setPropertyValue("LineJoint", -
bsf.getConstant("{%see com.sun.star.drawing.LineJoint}", "MITER")) -- the lines join at intersections
/* draw a rectangle */
xrectangle1 = xDocumentFactory~createInstance("{%see com.sun.star.drawing.RectangleShape}")~{%see com.sun.star.drawing.XShape%xshape}
xrectangle1~setPosition(.bsf~new("{%see com.sun.star.awt.Point}", 1000, 7000))
xrectangle1~setSize(.bsf~new("{%see com.sun.star.awt.Size}", 5000, 5000))
xDrawPage~add(xrectangle1) -- adds the rectangle to the draw document
/* change the colour properties */
xShapeProps1 = xrectangle1~{%see com.sun.star.beans.XPropertySet%XPropertySet}
xShapeProps1~setPropertyValue("FillColor", box("int", "191970"x ~c2d)) -- set fill colour blue
xShapeProps1~setPropertyValue("LineColor", box("int", "48D1CC"x ~c2d)) -- set line colour turquoise
xShapeProps1~setPropertyValue("LineWidth", box("int", "700")) -- set line width 7 millimeter
xShapeProps1~setPropertyValue("LineTransparence", box("int", "80")) -- set transparency 80 per cent
xShapeProps1~setPropertyValue("LineJoint", -
bsf.getConstant("{%see com.sun.star.drawing.LineJoint}", "BEVEL")) -- edges of the lines are joined by lines
/* draw a rectangle */
xrectangle2 = xDocumentFactory~createInstance("{%see com.sun.star.drawing.RectangleShape}")~{%see com.sun.star.drawing.XShape%xshape}
xrectangle2~setPosition(.bsf~new("{%see com.sun.star.awt.Point}", 1000, 14000))
xrectangle2~setSize(.bsf~new("{%see com.sun.star.awt.Size}", 5000, 5000))
xDrawPage~add(xrectangle2) -- adds the rectangle to the draw document
/* change the colour properties */
xShapeProps2 = xrectangle2~{%see com.sun.star.beans.XPropertySet%XPropertySet}
xShapeProps2~setPropertyValue("FillColor", box("int", "191970"x ~c2d)) --set fill colour blue
xShapeProps2~setPropertyValue("LineColor", box("int", "48D1CC"x ~c2d)) -- set line colour turqoise
xShapeProps2~setPropertyValue("LineWidth", box("int", "1000")) -- set line width 1 centimeter
xShapeProps2~setPropertyValue("LineTransparence", box("int", "50")) -- set transparency 50 per cent
xShapeProps2~setPropertyValue("LineJoint", -
bsf.getConstant("com.sun.star.drawing.LineJoint", "NONE")) -- the joint of the lines is not connected
::requires UNO.cls -- get UNO support