line line colour linestyle Nicole Scholz How can I draw lines and change the linestyle?

In this example 3 lines are created and the LineStyle is set.

/* 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 */ Line = xDocumentFactory~createInstance("{%see com.sun.star.drawing.LineShape}")~{%see com.sun.star.drawing.XShape%xShape} Line~setPosition(.bsf~new("{%see com.sun.star.awt.Point}", 1000, 2000)) Line~setSize(.bsf~new("{%see com.sun.star.awt.Size}", 15000, 0)) xDrawPage~add(Line) xShapeProps = Line~{%see com.sun.star.beans.XPropertySet%XPropertySet} xShapeProps~setPropertyValue("LineStyle", - bsf.getConstant("{%see com.sun.star.drawing.LineStyle}", "DASH")) -- set line style dash /* 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}", 15000, 1000)) xDrawPage~add(xLine) /* create a line and add it to the shape */ xLine1 = xDocumentFactory~createInstance("{%see com.sun.star.drawing.LineShape}")~{%see com.sun.star.drawing.XShape%xShape} xLine1~setPosition(.bsf~new("{%see com.sun.star.awt.Point}", 1000, 10000)) xLine1~setSize(.bsf~new("{%see com.sun.star.awt.Size}", 15000, 0)) xDrawPage~add(xLine1) /* colour the 2nd and the 3rd line green */ call syssleep 1 xShapeProps = xLine~{%see com.sun.star.beans.XPropertySet%XPropertySet} xShapeProps~setPropertyValue("LineColor", box("int", "228B22"x ~c2d)) -- paint the line green xShapeProps~setPropertyValue("LineWidth", box("int", "500")) -- set line width 5 millimeter xShapeProps1 = xLine1~{%see com.sun.star.beans.XPropertySet%XPropertySet} xShapeProps1~setPropertyValue("LineColor", box("int", "228B22"x ~c2d)) -- paint the line green xShapeProps1~setPropertyValue("LineWidth", box("int", "500")) -- set line width 5 millimeter /* set the 3rd line transparent */ call syssleep 1 xShapeProps1~setPropertyValue("LineTransparence", box("int", "80")) -- set transparency 80 per cent ::requires UNO.cls -- get UNO support