fdo#56443 allow different name for .dic and .aff files
For example, de_CH_frami.dic and de_AT_frami.dic use de_DE_frami.aff. Change-Id: I1d3770ad871b4714f7e595e1cd13f5fd7f224a1f
This commit is contained in:
parent
f464bb21c8
commit
cb56ab9bca
@ -66,7 +66,8 @@ SpellChecker::SpellChecker() :
|
|||||||
aDicts(NULL),
|
aDicts(NULL),
|
||||||
aDEncs(NULL),
|
aDEncs(NULL),
|
||||||
aDLocs(NULL),
|
aDLocs(NULL),
|
||||||
aDNames(NULL),
|
aDAffNames(NULL),
|
||||||
|
aDDicNames(NULL),
|
||||||
numdict(0),
|
numdict(0),
|
||||||
aEvtListeners(GetLinguMutex()),
|
aEvtListeners(GetLinguMutex()),
|
||||||
pPropHelper(NULL),
|
pPropHelper(NULL),
|
||||||
@ -86,7 +87,8 @@ SpellChecker::~SpellChecker()
|
|||||||
}
|
}
|
||||||
delete[] aDEncs;
|
delete[] aDEncs;
|
||||||
delete[] aDLocs;
|
delete[] aDLocs;
|
||||||
delete[] aDNames;
|
delete[] aDAffNames;
|
||||||
|
delete[] aDDicNames;
|
||||||
if (pPropHelper)
|
if (pPropHelper)
|
||||||
{
|
{
|
||||||
pPropHelper->RemoveAsPropListener();
|
pPropHelper->RemoveAsPropListener();
|
||||||
@ -183,7 +185,8 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
|
|||||||
aDicts = new Hunspell* [numdict];
|
aDicts = new Hunspell* [numdict];
|
||||||
aDEncs = new rtl_TextEncoding [numdict];
|
aDEncs = new rtl_TextEncoding [numdict];
|
||||||
aDLocs = new Locale [numdict];
|
aDLocs = new Locale [numdict];
|
||||||
aDNames = new OUString [numdict];
|
aDAffNames = new OUString [numdict];
|
||||||
|
aDDicNames = new OUString [numdict];
|
||||||
k = 0;
|
k = 0;
|
||||||
for (aDictIt = aDics.begin(); aDictIt != aDics.end(); ++aDictIt)
|
for (aDictIt = aDics.begin(); aDictIt != aDics.end(); ++aDictIt)
|
||||||
{
|
{
|
||||||
@ -201,13 +204,16 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
|
|||||||
aDicts[k] = NULL;
|
aDicts[k] = NULL;
|
||||||
aDEncs[k] = RTL_TEXTENCODING_DONTKNOW;
|
aDEncs[k] = RTL_TEXTENCODING_DONTKNOW;
|
||||||
aDLocs[k] = LanguageTag::convertToLocale( aLocaleNames[i] );
|
aDLocs[k] = LanguageTag::convertToLocale( aLocaleNames[i] );
|
||||||
// also both files have to be in the same directory and the
|
if ((aDictIt->aLocations[0]).endsWith(".aff"))
|
||||||
// file names must only differ in the extension (.aff/.dic).
|
{
|
||||||
// Thus we use the first location only and strip the extension part.
|
aDAffNames[k] = aDictIt->aLocations[0];
|
||||||
OUString aLocation = aDictIt->aLocations[0];
|
aDDicNames[k] = aDictIt->aLocations[1];
|
||||||
sal_Int32 nPos = aLocation.lastIndexOf( '.' );
|
}
|
||||||
aLocation = aLocation.copy( 0, nPos );
|
else
|
||||||
aDNames[k] = aLocation;
|
{
|
||||||
|
aDAffNames[k] = aDictIt->aLocations[1];
|
||||||
|
aDDicNames[k] = aDictIt->aLocations[0];
|
||||||
|
}
|
||||||
|
|
||||||
++k;
|
++k;
|
||||||
}
|
}
|
||||||
@ -225,8 +231,10 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
|
|||||||
aDEncs = NULL;
|
aDEncs = NULL;
|
||||||
delete[] aDLocs;
|
delete[] aDLocs;
|
||||||
aDLocs = NULL;
|
aDLocs = NULL;
|
||||||
delete[] aDNames;
|
delete[] aDAffNames;
|
||||||
aDNames = NULL;
|
delete[] aDDicNames;
|
||||||
|
aDAffNames = NULL;
|
||||||
|
aDDicNames = NULL;
|
||||||
aSuppLocales.realloc(0);
|
aSuppLocales.realloc(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -303,18 +311,16 @@ sal_Int16 SpellChecker::GetSpellFailure( const OUString &rWord, const Locale &rL
|
|||||||
{
|
{
|
||||||
if (!aDicts[i])
|
if (!aDicts[i])
|
||||||
{
|
{
|
||||||
OUString dicpath = aDNames[i] + ".dic";
|
|
||||||
OUString affpath = aDNames[i] + ".aff";
|
|
||||||
OUString dict;
|
OUString dict;
|
||||||
OUString aff;
|
OUString aff;
|
||||||
osl::FileBase::getSystemPathFromFileURL(dicpath,dict);
|
osl::FileBase::getSystemPathFromFileURL(aDDicNames[i],dict);
|
||||||
osl::FileBase::getSystemPathFromFileURL(affpath,aff);
|
osl::FileBase::getSystemPathFromFileURL(aDAffNames[i],aff);
|
||||||
OString aTmpaff(OU2ENC(aff,osl_getThreadTextEncoding()));
|
OString aTmpaff(OU2ENC(aff,osl_getThreadTextEncoding()));
|
||||||
OString aTmpdict(OU2ENC(dict,osl_getThreadTextEncoding()));
|
OString aTmpdict(OU2ENC(dict,osl_getThreadTextEncoding()));
|
||||||
|
|
||||||
#if defined(WNT)
|
#if defined(WNT)
|
||||||
// workaround for Windows specifc problem that the
|
// workaround for Windows specific problem that the
|
||||||
// path length in calls to 'fopen' is limted to somewhat
|
// path length in calls to 'fopen' is limited to somewhat
|
||||||
// about 120+ characters which will usually be exceed when
|
// about 120+ characters which will usually be exceed when
|
||||||
// using dictionaries as extensions.
|
// using dictionaries as extensions.
|
||||||
aTmpaff = Win_GetShortPathName( aff );
|
aTmpaff = Win_GetShortPathName( aff );
|
||||||
|
@ -63,7 +63,8 @@ class SpellChecker :
|
|||||||
Hunspell ** aDicts;
|
Hunspell ** aDicts;
|
||||||
rtl_TextEncoding * aDEncs;
|
rtl_TextEncoding * aDEncs;
|
||||||
Locale * aDLocs;
|
Locale * aDLocs;
|
||||||
OUString * aDNames;
|
OUString * aDAffNames;
|
||||||
|
OUString * aDDicNames;
|
||||||
sal_Int32 numdict;
|
sal_Int32 numdict;
|
||||||
|
|
||||||
::cppu::OInterfaceContainerHelper aEvtListeners;
|
::cppu::OInterfaceContainerHelper aEvtListeners;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user