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

Create successful ePaper yourself

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

The lines are dark gray (Color) and are spaced is 0.2 millimeters (Distance) apart.<br />

Bitmaps<br />

The Structure of Drawings<br />

To use bitmap projection as a fill, you must set the FillStyle property to BITMAP. If the bitmap is already<br />

available in <strong>OpenOffice</strong>.<strong>org</strong>, you just need to specify its name in the FillBitMapName property and its display<br />

style (simple, tiled, or elongated) in the FillBitmapMode property (default values in accordance with<br />

com.sun.star.drawing.BitmapMode).<br />

If you want to use an external bitmap file, you can specify its URL in the FillBitmapURL property.<br />

The following example creates a rectangle and tiles the Sky bitmap that is available in <strong>OpenOffice</strong>.<strong>org</strong> to fill the<br />

area of the rectangle:<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.FillStyle = com.sun.star.drawing.FillStyle.BITMAP<br />

RectangleShape.FillBitmapName = "Sky"<br />

RectangleShape.FillBitmapMode = com.sun.star.drawing.BitmapMode.REPEAT<br />

Page.add(RectangleShape)<br />

Transparency<br />

You can adjust the transparency of any fill that you apply. The simplest way to change the transparency of a<br />

drawing element is to use the FillTransparence property.<br />

The following example creates a red rectangle with a transparency of 50 percent.<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.FillStyle = com.sun.star.drawing.FillStyle.SOLID<br />

RectangleShape.FillTransparence = 50<br />

RectangleShape.FillColor = RGB(255,0,0)<br />

Page.add(RectangleShape)<br />

To make the fill transparent, set the FillTransparence property to 100.<br />

Chapter 8 · Drawings and Presentations 117

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

Saved successfully!

Ooh no, something went wrong!