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 156<br />

Page.add(RectangleShape)<br />

This example uses the StarDesktop.CurrentComponent call to determine which document is<br />

open. The document object determined this way returns the first page of the drawing<br />

through the drawPages(0) call.<br />

The Point and Size structures with the point of origin (left hand corner) and the size of the<br />

drawing object are then initialized. The lengths are specified in hundredths of a millimeter.<br />

The program code then uses the Doc.createInstance call to create the rectangle drawing<br />

object as specified by the<br />

com.sun.star.drawing.RectangleShape<br />

service. At the end, the drawing object is assigned to a page using a Page.add call.<br />

Fill Properties<br />

This section describes four services and in each instance the sample program code uses a<br />

rectangle shape element that combines several types of formatting. Fill properties are<br />

combined in the<br />

service.<br />

com.sun.star.drawing.FillProperties<br />

<strong>OpenOffice</strong>.<strong>org</strong> recognizes four main types of formatting for a fill area. The simplest variant<br />

is a single-color fill. The options for defining color gradients and hatches let you create<br />

other colors into play. The fourth variant is the option of projecting existing graphics into<br />

the fill area.<br />

The fill mode of a drawing object is defined using the FillStyle property. The permissible<br />

values are defined in<br />

.<br />

com.sun.star.drawing.FillStyle<br />

Single Color Fills<br />

The main property for single-color fills is:<br />

FillColor (Long)<br />

fill color of area<br />

To use the fill mode, you must the FillStyle property to the SOLID fill mode.<br />

The following example creates a rectangle shape and fills it with red (RGB value 255, 0, 0):<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

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

Saved successfully!

Ooh no, something went wrong!