Difference between revisions of "Documentation/DevGuide/OfficeDev/Implementing a Hyphenator"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (FINAL VERSION FOR L10N)
 
Line 28: 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
<source lang="java">
+
<syntaxhighlight lang="java">
 
   public XHyphenatedWord hyphenate(...)
 
   public XHyphenatedWord hyphenate(...)
 
   public XHyphenatedWord queryAlternativeSpelling(...)
 
   public XHyphenatedWord queryAlternativeSpelling(...)
 
   public XPossibleHyphens createPossibleHyphens(...)<
 
   public XPossibleHyphens createPossibleHyphens(...)<
</source>
+
</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  
<source lang="java">
+
<syntaxhighlight lang="java">
 
   public SampleHyphenator()  
 
   public SampleHyphenator()  
</source>
+
</syntaxhighlight>
 
at the relevant properties and modify the  
 
at the relevant properties and modify the  
<source lang="java">
+
<syntaxhighlight lang="java">
 
   public void propertyChange(...)  
 
   public void propertyChange(...)  
</source>
+
</syntaxhighlight>
 
function <!--in the file [SOURCE:OfficeDev/Linguistic/PropChgHelper_Hyph.java]--> accordingly.
 
function <!--in the file [SOURCE:OfficeDev/Linguistic/PropChgHelper_Hyph.java]--> accordingly.
  

Latest revision as of 12:01, 3 January 2021



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