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.
Doc.Text.insertControlCharacter(Cursor, _<br />
com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)<br />
Editing Text Documents<br />
The False parameter in the call of the insertControlCharacter method ensures that the area currently<br />
highlighted by the TextCursor remains after the insert operation. If the True parameter is passed here, then<br />
insertControlCharacter replaces the current text.<br />
Searching for Text Portions<br />
In many instances, it is the case that a text is to be searched for a particular term and the corresponding point<br />
needs to be edited. All <strong>OpenOffice</strong>.<strong>org</strong> documents provide a special interface for this purpose, and this interface<br />
always functions in accordance with the same principle: Before a search process, what is commonly referred to as<br />
a SearchDescriptor must first be created. This defines what <strong>OpenOffice</strong>.<strong>org</strong> searches for in a document. A<br />
SearchDescriptor is an object which supports the com.sun.star.util. SearchDescriptor service and<br />
can be created by means of the createSearchDescriptor method of a document:<br />
Dim SearchDesc As Object<br />
SearchDesc = Doc.createSearchDescriptor<br />
Once the SearchDescriptor has been created, it receives the text to be searched for:<br />
SearchDesc.searchString="any text"<br />
In terms of its function, the SearchDescriptor is best compared with the search dialog from <strong>OpenOffice</strong>.<strong>org</strong>.<br />
In a similar way to the search window, the settings needed for a search can be set in the SearchDescriptor<br />
object.<br />
The properties are provided by the com.sun.star.util.SearchDescriptor service:<br />
SearchBackwards (Boolean)<br />
searches through the text backward rather than forward.<br />
SearchCaseSensitive (Boolean)<br />
takes uppercase and lowercase characters into consideration during the search.<br />
SearchRegularExpression (Boolean)<br />
treats the search expression like a regular expression.<br />
SearchStyles (Boolean)<br />
searches through the text for the specified paragraph template.<br />
SearchWords (Boolean)<br />
only searches for complete words.<br />
The <strong>OpenOffice</strong>.<strong>org</strong> SearchSimilarity (or “fuzzy match”) function is also available in <strong>OpenOffice</strong>.<strong>org</strong> Basic.<br />
With this function, <strong>OpenOffice</strong>.<strong>org</strong> searches for an expression that may be similar to but not exactly the same as<br />
the search expression. The number of additional, deleted and modified characters for these expressions can be<br />
defined individually. Here are the associated properties of the com.sun.star.util.SearchDescriptor<br />
service:<br />
SearchSimilarity (Boolean)<br />
performs a similarity search.<br />
SearchSimilarityAdd (Short)<br />
number of characters which may be added for a similarity search.<br />
SearchSimilarityExchange (Short)<br />
number of characters which may be replaced as part of a similarity search.<br />
SearchSimilarityRemove (Short)<br />
number of characters which may be removed as part of a similarity search.<br />
SearchSimilarityRelax (Boolean)<br />
takes all deviation rules into consideration at the same time for the search expression.<br />
Chapter 6 · Text Documents 79