[Libreoffice] OOo issue 101224. could it be a LibO easy hack?

Jan Holesovsky kendy at suse.cz
Fri Jan 6 01:15:15 PST 2012

Hi Tommy,

On 2012-01-06 at 08:52 +0100, Tommy wrote:

> there's however the vast majority of words that have exactly the same
> spelling... let's take an example: “yellow” which is the same in England,  
> USA,
> South Africa, Australia, Canada etc. etc.
> if you come with a typing error like “yrllow” you should set an autocorrect
> entry in each of the localized english .dat files... it would be too time
> consuming...
> It would be much user friendly and time saving to have a “non localized”  
> acor-
> en.dat file whose entries are shared by all english subtypes.
> I'm not asking to merge the GB and US acor.dat files...
> I'm asking to add an additional “non localized” database.
> This would have the advantage to handle autocorrection of the vast  
> majority of
> common spelling english words regardless of the regional language subtype  
> of
> documents.

The code you want to play with is editeng/source/misc/svxacorr.cxx .

You probably want to tweak SvxAutoCorrect::SearchWordsInList() so that
it fallbacks to 'en' in case the word is not found in 'en_US', or
something like that; but you will have to tweak some code around that
probably too, in order to load the shared acor_XY.dat in addition to
acor_XY_AB.dat, etc.

I don't think it is hard; but some constructs used in that piece of code
are not too obvious, my favorite is this condition:

    else if( ( FStatHelper::IsDocument( sUserDirFile ) ||
                FStatHelper::IsDocument( sShareDirFile =
                              GetAutoCorrFileName( eLang, sal_False, sal_False ) ) ) ||
        ( sShareDirFile = sUserDirFile, bNewFile ))


More information about the LibreOffice mailing list