LibreOffice
LibreOffice 24.2 SDK API Reference
|
contains the base routines for iteration in Unicode string. More...
import"XBreakIterator.idl";
Public Member Functions | |
long | nextCharacters ([in] string aText, [in] long nStartPos, [in] ::com::sun::star::lang::Locale aLocale, [in] short nCharacterIteratorMode, [in] long nCount, [out] long nDone) |
Traverses specified number of characters/cells in Text from nStartPos forwards. More... | |
long | previousCharacters ([in] string aText, [in] long nStartPos, [in] ::com::sun::star::lang::Locale aLocale, [in] short nCharacterIteratorMode, [in] long nCount, [out] long nDone) |
Traverses specified number of characters/cells in Text from nStartPos backwards. More... | |
Boundary | nextWord ([in] string aText, [in] long nStartPos, [in] ::com::sun::star::lang::Locale aLocale, [in] short nWordType) |
Traverses one word in Text from nStartPos forwards. More... | |
Boundary | previousWord ([in] string aText, [in] long nStartPos, [in] ::com::sun::star::lang::Locale aLocale, [in] short nWordType) |
Traverses one word in Text from nStartPos backwards. More... | |
Boundary | getWordBoundary ([in] string aText, [in] long nPos, [in] ::com::sun::star::lang::Locale aLocale, [in] short nWordType, [in] boolean bPreferForward) |
Identifies StartPos and EndPos of current word. More... | |
short | getWordType ([in] string aText, [in] long nPos, [in] ::com::sun::star::lang::Locale aLocale) |
boolean | isBeginWord ([in] string aText, [in] long nPos, [in] ::com::sun::star::lang::Locale aLocale, [in] short nWordType) |
If a word starts at position nPos. More... | |
boolean | isEndWord ([in] string aText, [in] long nPos, [in] ::com::sun::star::lang::Locale aLocale, [in] short nWordType) |
If a word ends at position nPos. More... | |
long | beginOfSentence ([in] string aText, [in] long nStartPos, [in] ::com::sun::star::lang::Locale aLocale) |
Traverses in Text from nStartPos to the start of a sentence. More... | |
long | endOfSentence ([in] string aText, [in] long nStartPos, [in] ::com::sun::star::lang::Locale aLocale) |
Traverses in Text from nStartPos to the end of a sentence. More... | |
LineBreakResults | getLineBreak ([in] string aText, [in] long nStartPos, [in] ::com::sun::star::lang::Locale aLocale, [in] long nMinBreakPos, [in] LineBreakHyphenationOptions aHyphOptions, [in] LineBreakUserOptions aUserOptions) |
Calculate the line break position in the Text from the specified nStartPos. More... | |
long | beginOfScript ([in] string aText, [in] long nStartPos, [in] short nScriptType) |
Traverses in Text from nStartPos to the beginning of the specified script type. More... | |
long | endOfScript ([in] string aText, [in] long nStartPos, [in] short nScriptType) |
Traverses in Text from nStartPos to the end of the specified script type. More... | |
long | nextScript ([in] string aText, [in] long nStartPos, [in] short nScriptType) |
Traverses in Text from nStartPos to the next start of the specified script type. More... | |
long | previousScript ([in] string aText, [in] long nStartPos, [in] short nScriptType) |
Traverses in Text from nStartPos to the previous start of the specified script type. More... | |
short | getScriptType ([in] string aText, [in] long nPos) |
Get the script type of the character at position nPos. More... | |
long | beginOfCharBlock ([in] string aText, [in] long nStartPos, [in] ::com::sun::star::lang::Locale aLocale, [in] short nCharType) |
Traverses in Text from nStartPos to the beginning of the specified character type. More... | |
long | endOfCharBlock ([in] string aText, [in] long nStartPos, [in] ::com::sun::star::lang::Locale aLocale, [in] short nCharType) |
Traverses in Text from nStartPos to the end of the specified character type. More... | |
long | nextCharBlock ([in] string aText, [in] long nStartPos, [in] ::com::sun::star::lang::Locale aLocale, [in] short nCharType) |
Traverses in Text from nStartPos to the next start of the specified character type. More... | |
long | previousCharBlock ([in] string aText, [in] long nStartPos, [in] ::com::sun::star::lang::Locale aLocale, [in] short nCharType) |
Traverses in Text from nStartPos to the previous start of the specified character type. 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... | |
contains the base routines for iteration in Unicode string.
Iterates over characters, words, sentences and line breaks.
Assumption: StartPos is inclusive and EndPos is exclusive.
long beginOfCharBlock | ( | [in] string | aText, |
[in] long | nStartPos, | ||
[in] ::com::sun::star::lang::Locale | aLocale, | ||
[in] short | nCharType | ||
) |
Traverses in Text from nStartPos to the beginning of the specified character type.
aText | The input text. |
nStartPos | The start index in aText. |
aLocale | The locale of the character preceding nStartPos. |
nCharType | One of CharType |
long beginOfScript | ( | [in] string | aText, |
[in] long | nStartPos, | ||
[in] short | nScriptType | ||
) |
Traverses in Text from nStartPos to the beginning of the specified script type.
aText | The input text. |
nStartPos | The start index in aText. |
nScriptType | One of ScriptType. |
long beginOfSentence | ( | [in] string | aText, |
[in] long | nStartPos, | ||
[in] ::com::sun::star::lang::Locale | aLocale | ||
) |
Traverses in Text from nStartPos to the start of a sentence.
aText | The input text. |
nStartPos | The start index in aText. |
aLocale | The locale of the character preceding nStartPos. |
long endOfCharBlock | ( | [in] string | aText, |
[in] long | nStartPos, | ||
[in] ::com::sun::star::lang::Locale | aLocale, | ||
[in] short | nCharType | ||
) |
Traverses in Text from nStartPos to the end of the specified character type.
aText | The input text. |
nStartPos | The start index in aText. |
aLocale | The locale of the character preceding nStartPos. |
nCharType | One of CharType |
long endOfScript | ( | [in] string | aText, |
[in] long | nStartPos, | ||
[in] short | nScriptType | ||
) |
Traverses in Text from nStartPos to the end of the specified script type.
aText | The input text. |
nStartPos | The start index in aText. |
nScriptType | One of ScriptType. |
long endOfSentence | ( | [in] string | aText, |
[in] long | nStartPos, | ||
[in] ::com::sun::star::lang::Locale | aLocale | ||
) |
Traverses in Text from nStartPos to the end of a sentence.
aText | The input text. |
nStartPos | The start index in aText. |
aLocale | The locale of the character preceding nStartPos. |
LineBreakResults getLineBreak | ( | [in] string | aText, |
[in] long | nStartPos, | ||
[in] ::com::sun::star::lang::Locale | aLocale, | ||
[in] long | nMinBreakPos, | ||
[in] LineBreakHyphenationOptions | aHyphOptions, | ||
[in] LineBreakUserOptions | aUserOptions | ||
) |
Calculate the line break position in the Text from the specified nStartPos.
aText | The input text. |
nStartPos | The start index in aText. |
aLocale | The locale of the character preceding nStartPos. |
nMinBreakPos | Defines a minimum break position for hyphenated line break. When the position for hyphenated line break is less than nMinBreakPos, break position in LineBreakResults is set to -1. |
aHyphOptions | Defines if the hyphenator is to be used. |
aUserOptions | Defines how to handle hanging punctuations and forbidden characters at the start/end of a line. |
short getScriptType | ( | [in] string | aText, |
[in] long | nPos | ||
) |
Get the script type of the character at position nPos.
aText | The input text. |
nPos | The index in aText. |
Boundary getWordBoundary | ( | [in] string | aText, |
[in] long | nPos, | ||
[in] ::com::sun::star::lang::Locale | aLocale, | ||
[in] short | nWordType, | ||
[in] boolean | bPreferForward | ||
) |
Identifies StartPos and EndPos of current word.
If nPos is the boundary of a word, it is StartPos of one word and EndPos of previous word. In this situation, the outcome of the algorithm can be indeterminate. In this situation the bPreferForward flag is used. If bPreferForward == FALSE
, nPos is considered to be the end of the word and we look backwards for beginning of word, otherwise nPos is considered to be the start of the next word and we look forwards for the end of the word.
aText | The input text. |
nPos | The start index in aText. |
aLocale | The locale of the character preceding nStartPos. |
nWordType | One of WordType. |
bPreferForward | If TRUE , nPos should be considered the start of the next word and search proceeds forwards. If FALSE , nPos should be considered the end of the current word, and search proceeds backwards. |
short getWordType | ( | [in] string | aText, |
[in] long | nPos, | ||
[in] ::com::sun::star::lang::Locale | aLocale | ||
) |
This method is mis-defined, since WordType is not an attribute of a word, but a way to break words, like excluding or including tail spaces for spell checker or cursor traveling. It returns 0 always.
boolean isBeginWord | ( | [in] string | aText, |
[in] long | nPos, | ||
[in] ::com::sun::star::lang::Locale | aLocale, | ||
[in] short | nWordType | ||
) |
If a word starts at position nPos.
It is possible that both of this method and following method isEndWord all return TRUE
, since StartPos of a word is inclusive while EndPos of a word is exclusive.
boolean isEndWord | ( | [in] string | aText, |
[in] long | nPos, | ||
[in] ::com::sun::star::lang::Locale | aLocale, | ||
[in] short | nWordType | ||
) |
If a word ends at position nPos.
long nextCharacters | ( | [in] string | aText, |
[in] long | nStartPos, | ||
[in] ::com::sun::star::lang::Locale | aLocale, | ||
[in] short | nCharacterIteratorMode, | ||
[in] long | nCount, | ||
[out] long | nDone | ||
) |
Traverses specified number of characters/cells in Text from nStartPos forwards.
CharacterIteratorMode can be cell based or character based. A cell is made of more than one character.
aText | The input text. |
nStartPos | The start index in aText. |
aLocale | The locale of the character preceding nStartPos. |
nCharacterIteratorMode | A constant from CharacterIteratorMode |
nCount | Number of characters to traverse, it should not be less than 0. If you want to traverse in the opposite direction use XBreakIterator::previousCharacters() instead. |
nDone | Out parameter to receive the number of cells/Unicode characters traversed. |
long nextCharBlock | ( | [in] string | aText, |
[in] long | nStartPos, | ||
[in] ::com::sun::star::lang::Locale | aLocale, | ||
[in] short | nCharType | ||
) |
Traverses in Text from nStartPos to the next start of the specified character type.
aText | The input text. |
nStartPos | The start index in aText. |
aLocale | The locale of the character preceding nStartPos. |
nCharType | One of CharType |
long nextScript | ( | [in] string | aText, |
[in] long | nStartPos, | ||
[in] short | nScriptType | ||
) |
Traverses in Text from nStartPos to the next start of the specified script type.
aText | The input text. |
nStartPos | The start index in aText. |
nScriptType | One of ScriptType. |
Boundary nextWord | ( | [in] string | aText, |
[in] long | nStartPos, | ||
[in] ::com::sun::star::lang::Locale | aLocale, | ||
[in] short | nWordType | ||
) |
Traverses one word in Text from nStartPos forwards.
aText | The input text. |
nStartPos | The start index in aText. |
aLocale | The locale of the character preceding nStartPos. |
nWordType | One of WordType, specifies the type of traveling. |
long previousCharacters | ( | [in] string | aText, |
[in] long | nStartPos, | ||
[in] ::com::sun::star::lang::Locale | aLocale, | ||
[in] short | nCharacterIteratorMode, | ||
[in] long | nCount, | ||
[out] long | nDone | ||
) |
Traverses specified number of characters/cells in Text from nStartPos backwards.
CharacterIteratorMode can be cell based or character based. A cell is made of more than one character.
aText | The input text. |
nStartPos | The start index in aText. |
aLocale | The locale of the character preceding nStartPos. |
nCharacterIteratorMode | A constant from CharacterIteratorMode |
nCount | Number of characters to traverse, it should not be less than 0. If you want to traverse in the opposite direction use XBreakIterator::nextCharacters() instead. |
nDone | Out parameter to receive the number of cells/Unicode characters traversed. |
long previousCharBlock | ( | [in] string | aText, |
[in] long | nStartPos, | ||
[in] ::com::sun::star::lang::Locale | aLocale, | ||
[in] short | nCharType | ||
) |
Traverses in Text from nStartPos to the previous start of the specified character type.
aText | The input text. |
nStartPos | The start index in aText. |
aLocale | The locale of the character preceding nStartPos. |
nCharType | One of CharType |
long previousScript | ( | [in] string | aText, |
[in] long | nStartPos, | ||
[in] short | nScriptType | ||
) |
Traverses in Text from nStartPos to the previous start of the specified script type.
aText | The input text. |
nStartPos | The start index in aText. |
nScriptType | One of ScriptType. |
Boundary previousWord | ( | [in] string | aText, |
[in] long | nStartPos, | ||
[in] ::com::sun::star::lang::Locale | aLocale, | ||
[in] short | nWordType | ||
) |
Traverses one word in Text from nStartPos backwards.
aText | The input text. |
nStartPos | The start index in aText. |
aLocale | The locale of the character preceding nStartPos. |
If the previous character is a space character and nWordType indicates spaces should be skipped, and if the first non-space character is an Asian character, then, since Asian word break needs language specific wordbreak dictionaries, the method will return -1 in Boundary::endPos() and the position after the Asian character (i.e. the space character) in Boundary::startPos(). The caller then has to call this method again with a correct aLocale referring to the Asian character, which is then the previous character of the space character where nStartPos points to.
Note that the OpenOffice.org 1.0 / StarOffice 6.0 / StarSuite 6.0 i18n framework doesn't behave like this and mixed Western/CJK text may lead to wrong word iteration. This is fixed in later versions.
nWordType | One of WordType, specifies the type of traveling. |