LibreOffice LibreOffice 25.2 SDK API Reference

Public Member Functions | List of all members
XSearchable Interface Referencepublished

enables the object to look for specified contents of the object (in particular, for a text range which contains a specific string pattern). More...

`import"XSearchable.idl";`

Inheritance diagram for XSearchable:

## Public Member Functions
com::sun::star::util::XSearchDescriptor | createSearchDescriptor ()
| creates a SearchDescriptor which contains properties that specify a search in this container. More...
com::sun::star::container::XIndexAccess | findAll ([in] com::sun::star::util::XSearchDescriptor xDesc)
| searches the contained texts for all occurrences of whatever is specified. More...
com::sun::star::uno::XInterface | findFirst ([in] com::sun::star::util::XSearchDescriptor xDesc)
| searches the contained texts for the next occurrence of whatever is specified. More...
com::sun::star::uno::XInterface | findNext ([in] com::sun::star::uno::XInterface xStartAt, [in] com::sun::star::util::XSearchDescriptor xDesc)
| searches the contained texts for the next occurrence of whatever is specified. More...
Public Member Functions inherited from XInterface
any | queryInterface ([in] type aType)
| queries for a new interface to an existing UNO object. More...
void | acquire ()
| increases the reference counter by one. More...
void | release ()
| decreases the reference counter by one. More...

## Detailed Description

enables the object to look for specified contents of the object (in particular, for a text range which contains a specific string pattern).

Example: in a com::sun::star::text::TextDocument: set all "search for" to bold using findFirst()/findNext():

xSearchDescr = xDocument.createSearchDescriptor()
xSearchDescr.SearchString = "search for"
xSearchDescr.SearchCaseSensitive = true
xSearchDescr.SearchWords = true
xFound = xDocument.findFirst( xSearchDescr )
do while not IsNull(xFound)
xFound.CharWeight = com.sun.star.awt.FontWeight.BOLD
xFound = xDocument.findNext( xFound.End, xSearchDescr )
loop

Developers Guide
  Text Documents - Navigating - Search and Replace

## Member Function Documentation

## ◆ createSearchDescriptor()

com::sun::star::util::XSearchDescriptor createSearchDescriptor | ( |  | ) |

creates a SearchDescriptor which contains properties that specify a search in this container.

See also
  SearchDescriptor

## ◆ findAll()

com::sun::star::container::XIndexAccess findAll | ( | [in] com::sun::star::util::XSearchDescriptor | xDesc | ) |

searches the contained texts for all occurrences of whatever is specified.

See also
  SearchDescriptor

## ◆ findFirst()

com::sun::star::uno::XInterface findFirst | ( | [in] com::sun::star::util::XSearchDescriptor | xDesc | ) |

searches the contained texts for the next occurrence of whatever is specified.

Returns
  the position within the component, e.g. a com::sun::star::text::XTextRange which determines the found elements.

See also
  SearchDescriptor

## ◆ findNext()

com::sun::star::uno::XInterface findNext | ( | [in] com::sun::star::uno::XInterface | xStartAt,
|  | [in] com::sun::star::util::XSearchDescriptor | xDesc
| ) |  |

searches the contained texts for the next occurrence of whatever is specified.

Parameters

  xStartAt | represents a position within the component at which the search continues. This position is returned by XSearchable::findFirst() or the previous XSearchable::findNext().
  xDesc | the descriptor used for searching.

See also
  SearchDescriptor

The documentation for this interface was generated from the following file:

- com/sun/star/util/XSearchable.idl