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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The Structure of Drawings 155<br />

The following example sets the page size of a drawing document which has just been<br />

opened to 20 x 20 centimeters with a page margin of 0.5 centimeters:<br />

Dim Doc As Object<br />

Dim Page As Object<br />

Doc = StarDesktop.CurrentComponent<br />

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

Page.BorderLeft = 500<br />

Page.BorderRight = 500<br />

Page.BorderTop = 500<br />

Page.BorderBottom = 500<br />

Page.Width = 20000<br />

Page.Height = 20000<br />

Elementary Properties of Drawing Objects<br />

Drawing objects include shapes (rectangles, circles, and so on), lines, and text objects. All<br />

of these share a number of common features and support the com.sun.star.drawing.Shape<br />

service. This service defines the Size and Position properties of a drawing object.<br />

<strong>OpenOffice</strong>.<strong>org</strong> Basic also offers several other services through which you can modify such<br />

properties, as formatting or apply fills. The formatting options that are available depend on<br />

the type of drawing object.<br />

The following example creates and inserts a rectangle in a drawing document:<br />

Dim Doc As Object<br />

Dim Page As Object<br />

Dim RectangleShape As Object<br />

Dim Point As New com.sun.star.awt.Point<br />

Dim Size As New com.sun.star.awt.Size<br />

Doc = StarDesktop.CurrentComponent<br />

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

Point.x = 1000<br />

Point.y = 1000<br />

Size.Width = 10000<br />

Size.Height = 10000<br />

RectangleShape =<br />

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

RectangleShape.Size = Size<br />

RectangleShape.Position = Point

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

Saved successfully!

Ooh no, something went wrong!