Implementing a Hyphenator

From Apache OpenOffice Wiki
Jump to: navigation, search



A sample implementation of a hyphenator is found in the examples for linguistic.

The hyphenator implements the following interfaces:

and

Aside from choosing a new service implementation name, the process of implementing the hyphenator is the same as implementing the spell checker, except that you need to implement the com.sun.star.linguistic2.XHyphenator interface instead of the com.sun.star.linguistic2.XSpellChecker interface.

You can choose a different set of languages to be supported. When editing the sample code, modify the hasLocale() and getLocales() methods to reflect the set of languages your implementation supports.

To implement the com.sun.star.linguistic2.XHyphenator interface, modify the functions

  public XHyphenatedWord hyphenate(...)
  public XHyphenatedWord queryAlternativeSpelling(...)
  public XPossibleHyphens createPossibleHyphens(...)<

in the sample hyphenator source file at the stated positions.

Look in the constructor

  public SampleHyphenator()

at the relevant properties and modify the

  public void propertyChange(...)

function accordingly.

The rest, registration and activation is again the same as for the spell checker.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages