LibreOffice
LibreOffice 5.3 SDK API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
XTransliteration Interface Referencepublished

Character conversions like case folding or Hiragana to Katakana. More...

import "XTransliteration.idl";

Inheritance diagram for XTransliteration:
XInterface XExtendedTransliteration Transliteration

Public Member Functions

string getName ()
 Unique ASCII name to identify a module. More...
 
short getType ()
 Return the attribute(s) associated with this transliteration object, as defined in TransliterationType. More...
 
void loadModule ([in] TransliterationModules eModType, [in]::com::sun::star::lang::Locale aLocale)
 Load instance of predefined module - old style method. More...
 
void loadModuleNew ([in] sequence< TransliterationModulesNew > aModType, [in]::com::sun::star::lang::Locale aLocale)
 Load a sequence of instances of predefined modules - supersedes method XTransliteration::loadModule(). More...
 
void loadModuleByImplName ([in] string aImplName, [in]::com::sun::star::lang::Locale aLocale)
 Load instance of UNO registered module. More...
 
void loadModulesByImplNames ([in] sequence< string > aImplNameList, [in]::com::sun::star::lang::Locale aLocale)
 Load a sequence of instances of transliteration modules. More...
 
sequence< string > getAvailableModules ([in]::com::sun::star::lang::Locale aLocale, [in] short nType)
 List the available transliteration modules for a given locale. More...
 
string transliterate ([in] string aInStr, [in] long nStartPos, [in] long nCount, [out] sequence< long > rOffset)
 Transliterate a substring. More...
 
string folding ([in] string aInStr, [in] long nStartPos, [in] long nCount, [out] sequence< long > rOffset)
 
boolean equals ([in] string aStr1, [in] long nPos1, [in] long nCount1, [out] long rMatch1, [in] string aStr2, [in] long nPos2, [in] long nCount2, [out] long rMatch2)
 Match two substrings and find if they are equivalent as per this transliteration. More...
 
sequence< string > transliterateRange ([in] string aStr1, [in] string aStr2)
 Transliterate one set of characters to another. More...
 
long compareSubstring ([in] string aStr1, [in] long nOff1, [in] long nLen1, [in] string aStr2, [in] long nOff2, [in] long nLen2)
 Compare 2 substrings as per this transliteration. More...
 
long compareString ([in] string aStr1, [in] string aStr2)
 Compare 2 strings as per this transliteration. 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

Character conversions like case folding or Hiragana to Katakana.

Transliteration is a character to character conversion but it is not always a one to one mapping between characters. Transliteration modules are primarily used by collation, and search and replace modules to perform approximate search. It can also be used to format the numbers in different numbering systems.

In order to select transliteration modules for different purposes, they are classified with attributes of TransliterationType.

For Western languages there would be three transliteration modules available to compare two mixed case strings: upper to lower, lower to upper, and ignore case.

A typical calling sequence of transliteration is

  1. getAvailableModules()
  2. loadModulesByImplNames()
  3. equals()

or another one is

  1. loadModule()
  2. transliterate()
Developers Guide
OfficeDev - Overview and Using the API - XTransliteration

Member Function Documentation

long compareString ( [in] string  aStr1,
[in] string  aStr2 
)

Compare 2 strings as per this transliteration.

It translates both strings before comparing them.

Returns
1 if the first string is greater than the second string
0 if the first string is equal to the second string
-1 if the first string is less than the second string
long compareSubstring ( [in] string  aStr1,
[in] long  nOff1,
[in] long  nLen1,
[in] string  aStr2,
[in] long  nOff2,
[in] long  nLen2 
)

Compare 2 substrings as per this transliteration.

It translates both substrings before comparing them.

Parameters
aStr1First string.
nOff1Offset (from 0) of the first substring.
nLen1Length (from offset) of the first substring.
aStr2Second string.
nOff2Offset (from 0) of the second substring.
nLen2Length (from offset) of the second substring.
Returns
1 if the first substring is greater than the second substring
0 if the first substring is equal to the second substring
-1 if the first substring is less than the second substring
boolean equals ( [in] string  aStr1,
[in] long  nPos1,
[in] long  nCount1,
[out] long  rMatch1,
[in] string  aStr2,
[in] long  nPos2,
[in] long  nCount2,
[out] long  rMatch2 
)

Match two substrings and find if they are equivalent as per this transliteration.

This method can be called if the object has TransliterationType IGNORE attribute.

Returns the number of matched code points in any case, even if strings are not equal, for example:
equals( "a", 0, 1, nMatch1, "aaa", 0, 3, nMatch2 )
returns FALSE and nMatch:=1 and nMatch2:=1
equals( "aab", 0, 3, nMatch1, "aaa", 0, 3, nMatch2 )
returns FALSE and nMatch:=2 and nMatch2:=2

Parameters
aStr1First string to match.
nPos1Start position within aStr1.
nCount1Number of code points to use of aStr1.
rMatch1Returns number of matched code points in aStr1.
aStr2Second string to match.
nPos2Start position within aStr2.
nCount2Number of code points to use of aStr2.
rMatch2Returns number of matched code points in aStr2.
Returns
TRUE if the substrings are equal per this transliteration
FALSE else.
string folding ( [in] string  aInStr,
[in] long  nStartPos,
[in] long  nCount,
[out] sequence< long >  rOffset 
)
Deprecated:
For internal use, this method is supported to get the "transliteration", which equals() is based on.
sequence<string> getAvailableModules ( [in] ::com::sun::star::lang::Locale  aLocale,
[in] short  nType 
)

List the available transliteration modules for a given locale.

It can be filtered based on its type.

Parameters
nTypeA bitmask field of values defined in TransliterationType
aLocaleThe locale for which the modules are requested.
string getName ( )

Unique ASCII name to identify a module.

This name is used to get its localized name for menus, dialogs etc. The behavior is undefined for TransliterationType::CASCADE modules.

short getType ( )

Return the attribute(s) associated with this transliteration object, as defined in TransliterationType.

The value is determined by the transliteration modules. For example, for UPPERCASE_LOWERCASE, a ONE_TO_ONE is returned, for IGNORE_CASE, IGNORE is returned.

void loadModule ( [in] TransliterationModules  eModType,
[in] ::com::sun::star::lang::Locale  aLocale 
)

Load instance of predefined module - old style method.

void loadModuleByImplName ( [in] string  aImplName,
[in] ::com::sun::star::lang::Locale  aLocale 
)

Load instance of UNO registered module.

Each transliteration module is registered under a different service name. The convention for the service name is com.sun.star.i18n.Transliteration.l10n.{implName}. The {implName} is a unique name used to identify a module. The implName is used to get a localized name for the transliteration module. The implName is used in locale data to list the available transliteration modules for the locale. There are some transliteration modules that are always available. The names of those modules are listed as enum TransliterationModules names. For modules not listed there it is possible to load them directly by their implName.

Parameters
aImplNameThe module's {implName} under which it is registered with com.sun.star.i18n.Transliteration.l10n.{implName}.
aLocaleThe locale for which the module is requested.
void loadModuleNew ( [in] sequence< TransliterationModulesNew aModType,
[in] ::com::sun::star::lang::Locale  aLocale 
)

Load a sequence of instances of predefined modules - supersedes method XTransliteration::loadModule().

void loadModulesByImplNames ( [in] sequence< string >  aImplNameList,
[in] ::com::sun::star::lang::Locale  aLocale 
)

Load a sequence of instances of transliteration modules.

Output of one module is fed as input to the next module in the sequence. The object created by this call has TransliterationType CASCADE and IGNORE types.

Parameters
aImplNameListOnly IGNORE type modules can be specified.
aLocaleThe locale for which the modules are requested.
string transliterate ( [in] string  aInStr,
[in] long  nStartPos,
[in] long  nCount,
[out] sequence< long >  rOffset 
)

Transliterate a substring.

This method can be called if the object doesn't have TransliterationType IGNORE attribute.

Parameters
aInStrThe input string.
nStartPosStart position within aInStr from where transliteration starts.
nCountNumber of code points to be transliterated.
rOffsetTo find the grapheme of input string corresponding to the grapheme of output string, rOffset provides the offset array whose index is the offset of output string, the element containing the position within the input string before transliteration.
sequence<string> transliterateRange ( [in] string  aStr1,
[in] string  aStr2 
)

Transliterate one set of characters to another.

This method is intended for getting corresponding ranges and can be called if the object has TransliterationType IGNORE attribute.

For example: generic CASE_IGNORE transliterateRange( "a", "i" ) returns {"A","I","a","i"}, transliterateRange( "a", "a" ) returns {"A","A","a","a"}.

Use this transliteration to create regular expressions like [a-i] –> [A-Ia-i].

Returns
String sequence containing corresponding transliterated pairs of characters to represent a range.

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