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.

RectangleShape.Position = Point<br />

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

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

Page.add(RectangleShape)<br />

Color Gradient<br />

If you set the FillStyle property to GRADIENT, you can apply a color gradient to any fill area of a<br />

<strong>OpenOffice</strong>.<strong>org</strong> document.<br />

The Structure of Drawings<br />

If you want to apply a predefined color gradient, you can assign the associated name of the<br />

FillTransparenceGradientName property. To define your own color gradient, you need to complete a<br />

com.sun.star.awt.Gradient structure to assign the FillGradient property. This property provides the following<br />

options:<br />

Style (Enum)<br />

type of gradient, for example, linear or radial (default values in accordance with<br />

com.sun.star.awt.GradientStyle)<br />

StartColor (Long)<br />

start color of color gradient<br />

EndColor (Long)<br />

end color of color gradient<br />

Angle (Short)<br />

angle of color gradient in tenths of a degree<br />

XOffset (Short)<br />

X-coordinate at which the color gradient starts, specified in hundredths of a millimeter<br />

YOffset (Short)<br />

Y-coordinate at which the color gradient begins, specified in hundredths of a millimeter<br />

StartIntensity (Short)<br />

intensity of StartColor as a percentage (in <strong>OpenOffice</strong>.<strong>org</strong> Basic, you can also specify values higher than<br />

100 percent)<br />

EndIntensity (Short)<br />

intensity of EndColor as a percentage (in <strong>OpenOffice</strong>.<strong>org</strong> Basic, you can also specify values higher than<br />

100 percent)<br />

StepCount (Short)<br />

number of color graduations which <strong>OpenOffice</strong>.<strong>org</strong> is to calculate for the gradients<br />

The following example demonstrates the use of color gradients with the aid of the com.sun.star.awt.Gradient<br />

structure:<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 />

Dim Gradient As New com.sun.star.awt.Gradient<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 />

Chapter 8 · Drawings and Presentations 115

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

Saved successfully!

Ooh no, something went wrong!