21.08.2013 Views

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The Structure of Drawings 172<br />

Coordinates(2).y = 5000<br />

PolyPolygonShape.PolyPolygon = Array(Coordinates())<br />

Since the points of a polygon are defined as absolute values, you do not need to specify the<br />

size or the start position of a polygon. Instead, you need to create an array of the points,<br />

package this array in a second array (using the Array(Coordinates()) call), and then assign<br />

this array to the polygon. Before the corresponding call can be made, the polygon must be<br />

inserted into the document.<br />

The double array in the definition allows you to create complex shapes by merging several<br />

polygons. For example, you can create a rectangle and then insert another rectangle inside<br />

it to create a hole in the original rectangle:<br />

Dim Doc As Object<br />

Dim Page As Object<br />

Dim PolyPolygonShape As Object<br />

Dim PolyPolygon As Variant<br />

Dim Square1(3) As New com.sun.star.awt.Point<br />

Dim Square2(3) As New com.sun.star.awt.Point<br />

Dim Square3(3) As New com.sun.star.awt.Point<br />

Doc = StarDesktop.CurrentComponent<br />

Page = Doc.drawPages(0)<br />

PolyPolygonShape =<br />

Doc.createInstance("com.sun.star.drawing.PolyPolygonShape")<br />

Page.add(PolyPolygonShape) ' Page.add must take place before the<br />

coordinates are set<br />

Square1(0).x = 5000<br />

Square1(1).x = 10000<br />

Square1(2).x = 10000<br />

Square1(3).x = 5000<br />

Square1(0).y = 5000<br />

Square1(1).y = 5000<br />

Square1(2).y = 10000<br />

Square1(3).y = 10000<br />

Square2(0).x = 6500<br />

Square2(1).x = 8500<br />

Square2(2).x = 8500<br />

Square2(3).x = 6500<br />

Square2(0).y = 6500<br />

Square2(1).y = 6500<br />

Square2(2).y = 8500

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!