21.08.2013 Views

OpenOffice.org BASIC Guide - OpenOffice.org wiki

OpenOffice.org BASIC Guide - OpenOffice.org wiki

OpenOffice.org BASIC Guide - 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<br />

In addition to the FillTransparence property, the com.sun.star.drawing.FillProperties service also provides the<br />

FillTransparenceGradient property. This is used to define a gradient that specifies the transparency of a fill<br />

area.<br />

Line Properties<br />

All drawing objects that can have a border line support the com.sun.star.drawing.LineStyle service. Some of the<br />

properties that this service provides are:<br />

LineStyle (Enum)<br />

line type (default values in accordance with com.sun.star.drawing.LineStyle)<br />

LineColor (Long)<br />

line color<br />

LineTransparence (Short)<br />

line transparency<br />

LineWidth (Long)<br />

line thickness in hundredths of a millimeter<br />

LineJoint (Enum)<br />

transitions to connection points (default values in accordance with com.sun.star.drawing.LineJoint)<br />

The following example creates a rectangle with a solid border (LineStyle = SOLID) that is 5 millimeters thick<br />

(LineWidth) and 50 percent transparent. The right and left-hand edges of the line extend to their points of<br />

intersect with each other (LineJoint = MITER) to form a right-angle.<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 />

Point.x = 1000<br />

Point.y = 1000<br />

Size.Width = 10000<br />

Size.Height = 10000<br />

Doc = ThisComponent<br />

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

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

RectangleShape.Size = Size<br />

RectangleShape.Position = Point<br />

RectangleShape.LineColor = RGB(128,128,128)<br />

RectangleShape.LineTransparence = 50<br />

RectangleShape.LineWidth = 500<br />

RectangleShape.LineJoint = com.sun.star.drawing.LineJoint.MITER<br />

RectangleShape.LineStyle = com.sun.star.drawing.LineStyle.SOLID<br />

Page.add(RectangleShape)<br />

In addition to the listed properties, the com.sun.star.drawing.LineStyle service provides options for drawing<br />

dotted and dashed lines. For more information, see the <strong>OpenOffice</strong>.<strong>org</strong> API reference.<br />

Text Properties (Drawing Objects)<br />

The com.sun.star.style.CharacterProperties and com.sun.star.style.ParagraphProperties<br />

services can format text in drawing objects. These services relate to individual characters and paragraphs and are<br />

described in detail in Text Documents.<br />

The following example inserts text in a rectangle and formats the font com.sun.star.style.CharacterProperties<br />

118 <strong>OpenOffice</strong>.<strong>org</strong> 3.2 <strong>BASIC</strong> <strong>Guide</strong> · March 2010

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

Saved successfully!

Ooh no, something went wrong!