OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
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 Example 1, the page is accessed by its number (counting begins at 0). In the second example, the page is<br />
accessed by its name and the getByName method.<br />
Properties of a page<br />
The preceding call returns a page object that supports the com.sun.star.drawing.DrawPage service. The<br />
service recognizes the following properties:<br />
BorderLeft (Long)<br />
left-hand border in hundredths of a millimeter<br />
BorderRight (Long)<br />
right-hand border in hundredths of a millimeter<br />
BorderTop (Long)<br />
top border in hundredths of a millimeter<br />
BorderBottom (Long)<br />
bottom border in hundredths of a millimeter<br />
Width (Long)<br />
page width in hundredths of a millimeter<br />
Height (Long)<br />
page height in hundredths of a millimeter<br />
Number (Short)<br />
number of pages (numbering begins at 1), read-only<br />
Orientation (Enum)<br />
page orientation (in accordance with com.sun.star.view.PaperOrientation enumeration)<br />
If these settings are changed, then all of the pages in the document are affected.<br />
The following example sets the page size of a drawing document which has just been opened to 20 x 20<br />
centimeters with a page margin of 0.5 centimeters:<br />
Dim Doc As Object<br />
Dim Page As Object<br />
Doc = ThisComponent<br />
Page = Doc.DrawPages(0)<br />
Page.BorderLeft = 500<br />
Page.BorderRight = 500<br />
Page.BorderTop = 500<br />
Page.BorderBottom = 500<br />
Page.Width = 20000<br />
Page.Height = 20000<br />
Renaming Pages<br />
Warning – If a new page is inserted in a drawing document of several pages, all subsequent pages which have<br />
not been renamed will automatically see their default name change, e.g. Slide 3 will be changed into Slide 4, etc.<br />
This automatic renaming works also in reverse when a page is deleted.<br />
The only way to have a fixed page name is to rename the page, by the user interface or by programming.<br />
A page provides methods getName and setName to read and modify its name. Basic can handle both methods<br />
like a property Name. Here we rename the first page of the drawing document.<br />
Dim Doc As Object<br />
Dim Page As Object<br />
112 <strong>OpenOffice</strong>.<strong>org</strong> 3.2 <strong>BASIC</strong> <strong>Guide</strong> · March 2010