Difference between revisions of "Documentation/DevGuide/OfficeDev/Implementing a Hyphenator"
m (1 revision(s)) |
m |
||
Line 27: | Line 27: | ||
To implement the <idl>com.sun.star.linguistic2.XHyphenator</idl> interface, modify the functions | To implement the <idl>com.sun.star.linguistic2.XHyphenator</idl> interface, modify the functions | ||
− | + | <source lang="java"> | |
public XHyphenatedWord hyphenate(...) | public XHyphenatedWord hyphenate(...) | ||
public XHyphenatedWord queryAlternativeSpelling(...) | public XHyphenatedWord queryAlternativeSpelling(...) | ||
public XPossibleHyphens createPossibleHyphens(...)< | public XPossibleHyphens createPossibleHyphens(...)< | ||
− | + | </source> | |
in the sample hyphenator source file at the stated positions. | in the sample hyphenator source file at the stated positions. | ||
Look in the constructor | Look in the constructor | ||
− | + | <source lang="java"> | |
public SampleHyphenator() | public SampleHyphenator() | ||
− | + | </source> | |
at the relevant properties and modify the | at the relevant properties and modify the | ||
− | + | <source lang="java"> | |
public void propertyChange(...) | public void propertyChange(...) | ||
− | + | </source> | |
function <!--in the file [SOURCE:OfficeDev/Linguistic/PropChgHelper_Hyph.java]--> accordingly. | function <!--in the file [SOURCE:OfficeDev/Linguistic/PropChgHelper_Hyph.java]--> accordingly. | ||
Revision as of 16:50, 29 March 2008
- Using Spellchecker
- Using Hyphenator
- Using Thesaurus
- Events
- Implementing a Spell Checker
- Implementing a Hyphenator
- Implementing a Thesaurus
A sample implementation of a hyphenator is found in the examples for linguistic.
The hyphenator implements the following interfaces:
- com.sun.star.linguistic2.XHyphenator
- com.sun.star.linguistic2.XLinguServiceEventBroadcaster
- com.sun.star.lang.XInitialization
- com.sun.star.lang.XServiceDisplayName
- com.sun.star.lang.XServiceInfo
- com.sun.star.lang.XComponent
and
- com.sun.star.lang.XTypeProvider, if you want to access your add-in interfaces from OpenOffice.org Basic, otherwise, this interface is not mandatory.
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). |