In this example a shadow of a rectangle is painted
by setting the shadow property true.
/* 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}", 7000, 5000))
xDrawPage~add(xrectangle) -- adds the rectangle to the draw document
/* colour the rectangle blue solid and set shadow */
xShapeProps = xrectangle~{%see com.sun.star.beans.XPropertySet%XPropertySet}
xShapeProps~setPropertyValue("Shadow", box("boolean", "True" )) -- set shadow property true
xShapeProps~setPropertyValue("FillColor", box("int", "009ACD"x ~c2d )) -- set fill colour blue
xShapeProps~setPropertyValue("LineColor", box("int", "7B68EE"x ~c2d)) -- set line colour blue
/* 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}", 7000, 5000))
xDrawPage~add(xrectangle1) -- adds the rectangle to the draw document
/* colour the rectangle blue solid and set shadow */
xShapeProps1 = xrectangle1~{%see com.sun.star.beans.XPropertySet%XPropertySet}
xShapeProps1~setPropertyValue("Shadow", box("boolean", "True" ))
xShapeProps1~setPropertyValue("FillColor", box("int", "009ACD"x ~c2d )) -- set fill colour blue
xShapeProps1~setPropertyValue("LineColor", box("int", "7B68EE"x ~c2d)) -- set line colour blue
/* customize shadow */
xShapeProps1~setPropertyValue("ShadowColor", box("int", "000000"x ~c2d )) -- set the shadow colour black
call syssleep 2
/* set the shadow distance */
xShapeProps1~setPropertyValue("ShadowXDistance", box("int","2000"))
xShapeProps1~setPropertyValue("ShadowYDistance", box("int","2000"))
call syssleep 1
xShapeProps1~setPropertyValue("ShadowTransparence", box("int","90")) -- set transparency to 90 per cent
::requires UNO.cls -- get UNO support