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.

Editing Drawing Objects 178<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.ShearAngle = 3000<br />

Page.add(RectangleShape)<br />

Searching and Replacing<br />

As in text documents, drawing documents provide a function for searching and replace.<br />

This function is similar to the one that is used in text documents as described in Text<br />

Documents. However, in drawing documents the descriptor objects for searching and<br />

replacing are not created directly through the document object, but rather through the<br />

associated character level. The following example outlines the replacement process within<br />

a drawing:<br />

Dim Doc As Object<br />

Dim Page As Object<br />

Dim ReplaceDescriptor As Object<br />

Dim I As Integer<br />

Doc = StarDesktop.CurrentComponent<br />

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

ReplaceDescriptor = Page.createReplaceDescriptor()<br />

ReplaceDescriptor.SearchString = "is"<br />

ReplaceDescriptor.ReplaceString = "was"<br />

For I = 0 to Doc.drawPages.Count - 1<br />

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

Page.ReplaceAll(ReplaceDescriptor)<br />

Next I

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

Saved successfully!

Ooh no, something went wrong!