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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Overview of Central Interfaces<br />

com.sun.star.container.XEnumeration and XenumerationAccess<br />

Interfaces<br />

The basic object must provide the XEnumerationAccess interface, which contains only a createEnumeration<br />

method. This returns an auxiliary object, which in turn provides the XEnumeration interface with the<br />

hasMoreElements and nextElement methods. Through these, you then have access to the subordinate objects.<br />

The following example steps through all the paragraphs of a text:<br />

Dim ParagraphEnumeration As Object<br />

Dim Paragraph As Object<br />

ParagraphEnumeration = Textdoc.Text.createEnumeration<br />

While ParagraphEnumeration.hasMoreElements()<br />

Paragraph = ParagraphEnumeration.nextElement()<br />

Wend<br />

The example first creates a ParagraphEnumeration auxiliary object. This gradually returns the individual<br />

paragraphs of the text in a loop. The loop is terminated as soon as the hasMoreElements method returns the<br />

False value, signaling that the end of the text has been reached.<br />

Chapter 4 · Introduction to the API 57

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

Saved successfully!

Ooh no, something went wrong!