Please view the guidelines
- 1 Documentation of interfaces and data structures
- 2 Spellchecker implementation HOWTO
- 3 Sourcecode directory overview
- 4 Simple sample Implementation
- 5 Interface Diagrams
- 6 Known Bugs
Documentation of interfaces and data structures
There exist also some interface diagrams, which you will found at the end of this document.
Spellchecker implementation HOWTO
Here we are going to describe how to change the spellchecker sample implementation in linguistic/workben in order to provide a spellchecker of your own.
Changes to make in sspellimp.hxx
- Choose a unique service implementation name.
This is the one single thing you need to do in order to distinguish your service implementation from any other.
To do this edit the string returned by SpellChecker::getImplementationName_Static() function.
Changes to make in sspellimp.cxx
- Specify the languages (Locales) supported by your implementation.
To do this edit the code in SpellChecker::getLocales().
- Supply your own version of SpellChecker::GetSpellFailure(...).
This function is used to determine if a word is spelled correctly in a given language.
If the word is OK return -1 otherwise return an appropriate value of the type com::sun::star::linguistic2::SpellFailure.
- Check if you need to edit/remove the IsUpper and HasDigits functions in misc.hxx/cxx
This probably needs to be considered only if you're planning to support non-western languages and need more sophisticated versions of those or don't need them at all.
Don't forget to change the code at the end of SpellChecker::isValid(...) accordingly.
- Supply your own version of SpellChecker::GetProposals(...).
It will be used to provide the return value for the SpellChecker::spell(...) function call if the word was found to be incorrect. The main purpose of it is to provide proposals for how the word might be written correct (that list may be empty though).
- Edit the text in getServiceDisplayName(...)
It should be unique but need not to be. If you are going to develop a set of services (spellchecker, hyphenator and thesaurus) it should be the same for all of them. This text will be displayed in dialogs and the like in order to show a more meaningful text than the service implementation name.
Changes to make in spropehlp.hxx
Nothing needs to be done here.
You may however remove the member variables and functions of class PropertyHelper_Spell which you do not need and apply those changes to the cxx file.
Changes to make in spropehlp.cxx
- Have a look in PropertyHelper_Spell::propertyChange(...).
Set the values of bSCWA and bSWWA to TRUE only for those properties that are relevant to your implementation, thus avoiding to send unnecessary LinguServiceEvents (i.e. avoid to trigger spellchecking in applications if there is no need for it).
Registration of the service implementation
In order for the implementation to be used by OpenOffice you need to register the resulting DLL into the applicat.rdb which can be found in the program subdirectory of your office installation.
For example, if you like to use the sample spellchecker DLL build in the workben directory you need to do the following things:
- Copy the DLL to the program directory of the office installation
- Use the regcomp program to register the DLL into the applicat.rdb
To do this copy the regcomp.exe that should be part of the UDK (Uno Development Kit) to the program directory where you've already copied the DLL to. And typeregcomp -register -r applicat.rdb -c lex614mi.dllat the prompt. where the last argument has to be replaced by the name of your DLL.
Now you should be able to start the office program and have your implementation available.
If you like to deregister the DLL later typeregcomp -revoke -r applicat.rdb -c lex614mi.dllat the prompt.
If you like to be more independent from our code (i.e. if you don't like to make changes in your code when we make changes in ours) you should implement your own versions of the classes, structures and functions you're using found in the linguistic/inc directory.
Sourcecode directory overview
The files in this directory is also used by code that does not belong to this project.
|hyphdta.hxx||Data structures used as return values by the hyphenator.|
|spelldta.hxx||Data structure and function used to build the spellcheckers return values.|
|iprcache.hxx||Spellcache to cache words previously found to be correct.|
|lngprops.hxx||Defines for the property names and handles of the LinguProperties property set.|
|misc.hxx||Defines for service names, various functions and helper classes|
The files in this directory are exclusively used by the linguistic that comes with OpenOffice.
|hyphdsp.hxx, hyphdsp.cxx||Hyphenator dispatcher used by the LinguServiceManager and helper classes.|
|spelldsp.hxx, spelldsp.cxx||Spellchecker dispatcher used by the LinguServiceManager and helper classes.|
|thesdsp.hxx, thesdsp.cxx||Thesaurus dispatcher used by the LinguServiceManager and helper classes.|
|defs.hxx||Classes and structures used by more than one of the other files.|
|lngreg.cxx||Functions used to register the DLL in the applicat.rdb and to access the provided services.|
|dlistimp.hxx, dlistimp.cxx||Implementation of the XDictionaryList/XSearchableDictionaryList interfaces and helper classes and functions.|
|dicimp.hxx, dicimp.cxx||Implementation of the XDictionary and XDictionaryEntry interfaces.|
|hyphdta.cxx||Implementation of data structures used as return values by the hyphenator.|
|spelldta.cxx||Data structure and function used to build the spellcheckers return values.|
|iprcache.cxx||Implementation of a spellcache to cache words previously found to be correct.|
|lngopt.hxx, lngopt.cxx||Implementation of the LinguProperties property set, helper classes like LinguOptions, and access to the configuration data.|
|lngsvcmgr.hxx, lngsvcmgr.cxx||Implementation of the LinguServiceManager service along with helper classes and functions.|
|misc.cxx||Various functions and helper classes|
|makefile.mk||The makefile for this directory.|
Simple sample Implementation
The files in this directory represent a sample implementation for a spellchecker service.
|sspellimp.hxx, sspellimp.cxx||Sample spellchecker implementation|
|sprophelp.hxx, sprophelp.cxx||Helper classes for listening for property changes and to check the optional additional arguments to the spellchecker, used by the spellchecker implementation.|
|sreg.cxx||Functions used to register the dll in the applicat.rdb and to access the provided services.|
|makefile.mk||The makefile for this directory.|
|exports.dxp||Symbol export file for dll.|
|lex.map||Symbol export file for dll.|
Currently the linguistic does not throw exceptions and is expected not to do this!