hatch HatchStyle fillstyle Nicole Scholz How can I set the fillcolour of a shape hatch?

In this example the fillcolour of 3 rectangles is set hatch with using the FillStyle 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 /* colour the rectangle hatch single */ xShapeProps = xrectangle~{%see com.sun.star.beans.XPropertySet%XPropertySet} ohatch = .bsf~new("{%see com.sun.star.drawing.Hatch}") ohatch~Style = bsf.getConstant("{%see com.sun.star.drawing.HatchStyle}", "SINGLE") ohatch~Color = 2554848 ohatch~Distance = 1000 -- distance is 1 centimeter ohatch~Angle = 900 -- angle of 90 degrees /* fill the rectangle */ xShapeProps~setPropertyValue("FillStyle", - bsf.getConstant("{%see com.sun.star.drawing.FillStyle}", "HATCH")) xShapeProps~setPropertyValue("FillHatch", ohatch) /* 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 /* colour the rectangle hatch double */ xShapeProps = xrectangle1~{%see com.sun.star.beans.XPropertySet%XPropertySet} ohatch1 = .bsf~new("{%see com.sun.star.drawing.Hatch}") ohatch1~Style = bsf.getConstant("{%see com.sun.star.drawing.HatchStyle}", "DOUBLE") ohatch1~Color = 13771137 ohatch1~Distance = 50 -- distance is 0.5 millimeter ohatch1~Angle = 0 -- angle of 0 degrees /* fill the rectangle */ xShapeProps~setPropertyValue("FillStyle", - bsf.getConstant("{%see com.sun.star.drawing.FillStyle}", "HATCH")) xShapeProps~setPropertyValue("FillHatch", ohatch1) /* 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, 13000)) xrectangle2~setSize(.bsf~new("{%see com.sun.star.awt.Size}", 5000, 5000)) xDrawPage~add(xrectangle2) -- adds the rectangle to the draw document /* colour the rectangle hatch double */ xShapeProps = xrectangle2~{%see com.sun.star.beans.XPropertySet%XPropertySet} ohatch2 = .bsf~new("{%see com.sun.star.drawing.Hatch}") ohatch2~Style = bsf.getConstant("{%see com.sun.star.drawing.HatchStyle}", "TRIPLE") ohatch2~Color = 2552150 ohatch2~Distance = 500 -- distance is 5 millimeter ohatch2~Angle = 0 -- angle of 0 degrees /* fill the rectangle */ xShapeProps~setPropertyValue("FillStyle", - bsf.getConstant("{%see com.sun.star.drawing.FillStyle}", "HATCH")) xShapeProps~setPropertyValue("FillHatch", ohatch2) ::requires UNO.cls -- get UNO support