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

Create successful ePaper yourself

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

Editing Drawing Objects 177<br />

Rotating and Shearing Drawing Objects<br />

All of the drawing objects that are described in the previous sections can also be rotated<br />

and sheared using the<br />

service.<br />

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

The service provides the following properties:<br />

RotateAngle (Long)<br />

rotary angle in hundredths of a degree<br />

ShearAngle (Long)<br />

shear angle in hundredths of a degree<br />

The following example creates a rectangle and rotates it by 30 degrees using the<br />

RotateAngle property:<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 = StarDesktop.CurrentComponent<br />

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

RectangleShape =<br />

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

RectangleShape.Size = Size<br />

RectangleShape.Position = Point<br />

RectangleShape.RotateAngle = 3000<br />

Page.add(RectangleShape)<br />

The next example creates the same rectangle as in the previous example, but instead<br />

shears it through 30 degrees using the ShearAngle property.<br />

Dim Doc As Object<br />

Dim Page As Object<br />

Dim RectangleShape As Object

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

Saved successfully!

Ooh no, something went wrong!