Difference between revisions of "Documentation/DevGuide/OfficeDev/Implementing a Hyphenator"
m (1 revision(s)) |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 6: | Line 6: | ||
|NextPage=Documentation/DevGuide/OfficeDev/Implementing a Thesaurus | |NextPage=Documentation/DevGuide/OfficeDev/Implementing a Thesaurus | ||
}} | }} | ||
− | {{DISPLAYTITLE:Implementing a Hyphenator}} | + | {{Documentation/DevGuideLanguages|Documentation/DevGuide/OfficeDev/{{SUBPAGENAME}}}} |
+ | {{DISPLAYTITLE:Implementing a Hyphenator}} | ||
A sample implementation of a hyphenator is found in the examples for linguistic. | A sample implementation of a hyphenator is found in the examples for linguistic. | ||
Line 27: | Line 28: | ||
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 | ||
− | + | <syntaxhighlight lang="java"> | |
public XHyphenatedWord hyphenate(...) | public XHyphenatedWord hyphenate(...) | ||
public XHyphenatedWord queryAlternativeSpelling(...) | public XHyphenatedWord queryAlternativeSpelling(...) | ||
public XPossibleHyphens createPossibleHyphens(...)< | public XPossibleHyphens createPossibleHyphens(...)< | ||
− | + | </syntaxhighlight> | |
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 | ||
− | + | <syntaxhighlight lang="java"> | |
public SampleHyphenator() | public SampleHyphenator() | ||
− | + | </syntaxhighlight> | |
at the relevant properties and modify the | at the relevant properties and modify the | ||
− | + | <syntaxhighlight lang="java"> | |
public void propertyChange(...) | public void propertyChange(...) | ||
− | + | </syntaxhighlight> | |
function <!--in the file [SOURCE:OfficeDev/Linguistic/PropChgHelper_Hyph.java]--> accordingly. | function <!--in the file [SOURCE:OfficeDev/Linguistic/PropChgHelper_Hyph.java]--> accordingly. | ||
Line 47: | Line 48: | ||
{{PDL1}} | {{PDL1}} | ||
− | [[Category: Office Development]] | + | |
+ | [[Category:Documentation/Developer's Guide/Office Development]] |
Latest revision as of 12:01, 3 January 2021
- 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). |