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 StarDesktop<br />

Doc.Printer = PrinterProperties()<br />

The example defines an object named PaperSize with the com.sun.star.awt.Size type. This is needed to specify<br />

the paper size. Furthermore, it creates a data field for two PropertyValue entries named PrinterProperties.<br />

This data field is then initialized with the values to be set and assigned the Printer property. From the<br />

standpoint of UNO, the printer is not a real property but an imitated one.<br />

Styles and Templates<br />

Styles<br />

Styles are named lists containing formatting attributes. They work in all applications of <strong>OpenOffice</strong>.<strong>org</strong> and help<br />

to significantly simplify formatting. If the user changes one of the attributes of a style, then <strong>OpenOffice</strong>.<strong>org</strong><br />

automatically adjusts all document sections depending on the attribute. The user can therefore, for example,<br />

change the font type of all level one headers by means of a central modification in the document.<br />

Style Types<br />

Depending on the relevant document types, <strong>OpenOffice</strong>.<strong>org</strong> recognizes a whole range of different types of styles.<br />

<strong>OpenOffice</strong>.<strong>org</strong> Writer supports the following types of styles:<br />

Character styles<br />

Paragraph styles<br />

Frame styles<br />

Page styles<br />

Numbering styles<br />

<strong>OpenOffice</strong>.<strong>org</strong> Calc supports the following types of styles:<br />

Cell styles<br />

Page styles<br />

<strong>OpenOffice</strong>.<strong>org</strong> Impress supports the following types of styles:<br />

Character element styles<br />

Presentation styles<br />

In <strong>OpenOffice</strong>.<strong>org</strong> terminology, the different types of styles are called StyleFamilies in accordance with the<br />

com.sun.star.style.StyleFamily service on which they are based. The StyleFamilies are accessed by means of<br />

the document object:<br />

Dim Doc As Object<br />

Dim Sheet As Object<br />

Dim StyleFamilies As Object<br />

Dim CellStyles As Object<br />

Doc = ThisComponent<br />

StyleFamilies = Doc.StyleFamilies<br />

CellStyles = StyleFamilies.getByName("CellStyles")<br />

The example uses the StyleFamilies property of a spreadsheet document to establish a list containing all<br />

available cell styles.<br />

The individual styles can be accessed directly by means of an index:<br />

Dim Doc As Object<br />

Dim Sheet As Object<br />

Dim StyleFamilies As Object<br />

Dim CellStyles As Object<br />

Dim CellStyle As Object<br />

Dim I As Integer<br />

66 <strong>OpenOffice</strong>.<strong>org</strong> 3.2 <strong>BASIC</strong> <strong>Guide</strong> · March 2010

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

Saved successfully!

Ooh no, something went wrong!