interface XBreakIterator in module com::sun::star::i18n::

(Global Index)

Syntax

interface XBreakIterator : com::sun::star::uno::XInterface ;

Description

contains the base routines for iteration in Unicode string. Iterates over Characters, Words, Sentences and Linebreaks.

There also exists a specific BreakIterator for asian languages

Assumption - StartPos is inclusive and EndPos is exclusive.

Method Summary

nextCharacters Traverses specfied number of characters in Text from the StartPos to the right. CharacterIteratorMode can be cell based or character based. A cell is made of more than one character.

previousCharacters Traverses specfied number of characters in Text from the StartPos to the left. CharacterIteratorMode can be cell based or character based. A cell is made of more than one character.

nextWord Traverses one word in Text from the StartPos to the right. The WordType specify the type of travelling.

previousWord Traverses one word in Text from the StartPos to the left. The WordType specify the type of travelling.

getWordBoundary 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 sitution, bPreferForward flag is used, if bPreferForward == 0, nPos is considered end of word and looks for beginning of word on left otherwise nPos is considered beginning of next word and looks right for end of the word.

getWordType

isBeginWord

isEndWord

beginOfSentence Traverses in Text from the StartPos to the start of a sentence.

endOfSentence Traverses in Text from the StartPos to the end of a sentence.

getLineBreak calculate the linebreak position in the Text from the specified StartPos. LineBreakHyphenationOptions defines if the hyphenator is to be used. The LineBreakUserOptions defines, how to handle hanging punctuations, the forbidden character at the start/end of a line.

beginOfScript

endOfScript

nextScript

previousScript

getScriptType

beginOfCharBlock Traverses in Text from the StartPos to the beginning of the specified character type.

endOfCharBlock Traverses in Text from the StartPos to the end of the specified character type.

nextCharBlock Traverses in Text from the StartPos to the next start of the specified character type.

previousCharBlock Traverses in Text from the StartPos to the previous start of the specified character type.

Known Services Which Export this Interface

com::sun::star::i18n::zh_CNBreakIterator

com::sun::star::i18n::BreakIterator

com::sun::star::i18n::CJKBreakIterator

com::sun::star::i18n::zh_TWBreakIterator

com::sun::star::i18n::ja_JPBreakIterator

Method Details



nextCharacters

Syntax

long nextCharacters (
string Text,
long nStartPos,
com::sun::star::lang::Locale rLocale,
short nCharacterIteratorMode,
long nCount,
long nDone );

Description

Traverses specfied number of characters in Text from the StartPos to the right. CharacterIteratorMode can be cell based or character based. A cell is made of more than one character.


previousCharacters

Syntax

long previousCharacters (
string Text,
long nStartPos,
com::sun::star::lang::Locale nLocale,
short nCharacterIteratorMode,
long nCount,
long nDone );

Description

Traverses specfied number of characters in Text from the StartPos to the left. CharacterIteratorMode can be cell based or character based. A cell is made of more than one character.


nextWord

Syntax

com::sun::star::i18n::Boundary nextWord (
string Text,
long nStartPos,
com::sun::star::lang::Locale nLocale,
short WordType );

Description

Traverses one word in Text from the StartPos to the right. The WordType specify the type of travelling.

Returns

the Boundary of the found word. Normally used for the CTRL-Right.

previousWord

Syntax

com::sun::star::i18n::Boundary previousWord (
string Text,
long nStartPos,
com::sun::star::lang::Locale nLocale,
short WordType );

Description

Traverses one word in Text from the StartPos to the left. The WordType specify the type of travelling.

Returns

the Boundary of the found word. Normally used for the CTRL-Right.

getWordBoundary

Syntax

com::sun::star::i18n::Boundary getWordBoundary (
string Text,
long nPos,
com::sun::star::lang::Locale nLocale,
short WordType,
boolean bPreferForward );

Description

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 sitution, bPreferForward flag is used, if bPreferForward == 0, nPos is considered end of word and looks for beginning of word on left otherwise nPos is considered beginning of next word and looks right for end of the word.


getWordType

Syntax

short getWordType (
string Text,
long nPos,
com::sun::star::lang::Locale nLocale );

Returns

the kind of word that starts at the specified position.

isBeginWord

Syntax

boolean isBeginWord (
string Text,
long nPos,
com::sun::star::lang::Locale nLocale,
short WordType );

Returns

true if at the specified position starts a word

isEndWord

Syntax

boolean isEndWord (
string Text,
long nPos,
com::sun::star::lang::Locale nLocale,
short WordType );

Returns

true if at the specified position ends a word

beginOfSentence

Syntax

long beginOfSentence (
string Text,
long nStartPos,
com::sun::star::lang::Locale nLocale );

Description

Traverses in Text from the StartPos to the start of a sentence.

Returns

the position where the sentence starts

endOfSentence

Syntax

long endOfSentence (
string Text,
long nStartPos,
com::sun::star::lang::Locale nLocale );

Description

Traverses in Text from the StartPos to the end of a sentence.

Returns

the position where the sentence ends

getLineBreak

Syntax

com::sun::star::i18n::LineBreakResults getLineBreak (
string Text,
long nStartPos,
com::sun::star::lang::Locale nLocale,
long nMinBreakPos,
com::sun::star::i18n::LineBreakHyphenationOptions hOptions,
com::sun::star::i18n::LineBreakUserOptions bOptions );

Description

calculate the linebreak position in the Text from the specified StartPos. LineBreakHyphenationOptions defines if the hyphenator is to be used. The LineBreakUserOptions defines, how to handle hanging punctuations, the forbidden character at the start/end of a line.

Returns

LineBreakResults , which contains the break position of the word and which kind of break it is.

beginOfScript

Syntax

long beginOfScript (
string Text,
long nStartPos,
short ScriptType );

Returns

the position where the specified skipt starts.

endOfScript

Syntax

long endOfScript (
string Text,
long nStartPos,
short ScriptType );

Returns

the position where the specified skipt ends.

nextScript

Syntax

long nextScript (
string Text,
long nStartPos,
short ScriptType );

Returns

the position where the next specified skipt starts.

previousScript

Syntax

long previousScript (
string Text,
long nStartPos,
short ScriptType );

Returns

the position where the previous specified skipt starts.

getScriptType

Syntax

short getScriptType (
string Text,
long nPos );

Returns

the scipts type of the current position.

beginOfCharBlock

Syntax

long beginOfCharBlock (
string Text,
long nStartPos,
com::sun::star::lang::Locale nLocale,
short CharType );

Description

Traverses in Text from the StartPos to the beginning of the specified character type.

Returns

the position where the character type starts

endOfCharBlock

Syntax

long endOfCharBlock (
string Text,
long nStartPos,
com::sun::star::lang::Locale nLocale,
short CharType );

Description

Traverses in Text from the StartPos to the end of the specified character type.

Returns

the position where the character type ends

nextCharBlock

Syntax

long nextCharBlock (
string Text,
long nStartPos,
com::sun::star::lang::Locale nLocale,
short CharType );

Description

Traverses in Text from the StartPos to the next start of the specified character type.

Returns

the position where the next character type starts

previousCharBlock

Syntax

long previousCharBlock (
string Text,
long nStartPos,
com::sun::star::lang::Locale nLocale,
short CharType );

Description

Traverses in Text from the StartPos to the previous start of the specified character type.

Returns

the position where the previous character type starts
Top of Page