LibreOffice LibreOffice 26.2 SDK API Reference

Public Member Functions | List of all members
XTextRangeCompare Interface Referencepublished

compares the positions of two TextRanges within a Text. More...

`import"XTextRangeCompare.idl";`

Inheritance diagram for XTextRangeCompare:

## Public Member Functions
short | compareRegionStarts ([in] XTextRange xR1, [in] XTextRange xR2) raises ( com::sun::star::lang::IllegalArgumentException )
short | compareRegionEnds ([in] XTextRange xR1, [in] XTextRange xR2) raises ( com::sun::star::lang::IllegalArgumentException )
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

compares the positions of two TextRanges within a Text.

Only TextRange instances within the same Text can be compared.

## Member Function Documentation

## ◆ compareRegionEnds()

short compareRegionEnds | ( | [in] XTextRange | xR1,
|  | [in] XTextRange | xR2
| ) |  |
raises | ( | com::sun::star::lang::IllegalArgumentException
| ) |  |

Returns
  1, if xR1 ends before xR2, 0, if xR1 ends at the same position as xR2 and -1, if xR1 ends behind xR2. Note that the sign of the return value might be the opposite of what you would expect if you are used to other comparison operations such as the XCollator interface, strcmp in C, the <=> operator in C++ or the compareTo method in Java.

Exceptions

  com::sun::star::lang::IllegalArgumentException | if either xR1 or xR2 is not within this text.

## ◆ compareRegionStarts()

short compareRegionStarts | ( | [in] XTextRange | xR1,
|  | [in] XTextRange | xR2
| ) |  |
raises | ( | com::sun::star::lang::IllegalArgumentException
| ) |  |

Returns
  1 if xR1 starts before xR2, 0 if xR1 starts at the same position as xR2 and -1 if xR1 starts behind xR2. Note that the sign of the return value might be the opposite of what you would expect if you are used to other comparison operations such as the XCollator interface, strcmp in C, the <=> operator in C++ or the compareTo method in Java.

Exceptions

  com::sun::star::lang::IllegalArgumentException | if either xR1 or xR2 is not within this text.

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

- com/sun/star/text/XTextRangeCompare.idl