Kaydet (Commit) 76661491 authored tarafından Andras Timar's avatar Andras Timar

Revert "fdo#56443 allow different name for .dic and .aff files"

This reverts commit cb56ab9b.
üst 22115840
...@@ -66,8 +66,7 @@ SpellChecker::SpellChecker() : ...@@ -66,8 +66,7 @@ SpellChecker::SpellChecker() :
aDicts(NULL), aDicts(NULL),
aDEncs(NULL), aDEncs(NULL),
aDLocs(NULL), aDLocs(NULL),
aDAffNames(NULL), aDNames(NULL),
aDDicNames(NULL),
numdict(0), numdict(0),
aEvtListeners(GetLinguMutex()), aEvtListeners(GetLinguMutex()),
pPropHelper(NULL), pPropHelper(NULL),
...@@ -87,8 +86,7 @@ SpellChecker::~SpellChecker() ...@@ -87,8 +86,7 @@ SpellChecker::~SpellChecker()
} }
delete[] aDEncs; delete[] aDEncs;
delete[] aDLocs; delete[] aDLocs;
delete[] aDAffNames; delete[] aDNames;
delete[] aDDicNames;
if (pPropHelper) if (pPropHelper)
{ {
pPropHelper->RemoveAsPropListener(); pPropHelper->RemoveAsPropListener();
...@@ -185,8 +183,7 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales() ...@@ -185,8 +183,7 @@ 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];
aDAffNames = new OUString [numdict]; aDNames = 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)
{ {
...@@ -204,16 +201,13 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales() ...@@ -204,16 +201,13 @@ 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] );
if ((aDictIt->aLocations[0]).endsWith(".aff")) // also both files have to be in the same directory and the
{ // file names must only differ in the extension (.aff/.dic).
aDAffNames[k] = aDictIt->aLocations[0]; // Thus we use the first location only and strip the extension part.
aDDicNames[k] = aDictIt->aLocations[1]; OUString aLocation = aDictIt->aLocations[0];
} sal_Int32 nPos = aLocation.lastIndexOf( '.' );
else aLocation = aLocation.copy( 0, nPos );
{ aDNames[k] = aLocation;
aDAffNames[k] = aDictIt->aLocations[1];
aDDicNames[k] = aDictIt->aLocations[0];
}
++k; ++k;
} }
...@@ -231,10 +225,8 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales() ...@@ -231,10 +225,8 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
aDEncs = NULL; aDEncs = NULL;
delete[] aDLocs; delete[] aDLocs;
aDLocs = NULL; aDLocs = NULL;
delete[] aDAffNames; delete[] aDNames;
delete[] aDDicNames; aDNames = NULL;
aDAffNames = NULL;
aDDicNames = NULL;
aSuppLocales.realloc(0); aSuppLocales.realloc(0);
} }
} }
...@@ -311,16 +303,18 @@ sal_Int16 SpellChecker::GetSpellFailure( const OUString &rWord, const Locale &rL ...@@ -311,16 +303,18 @@ 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(aDDicNames[i],dict); osl::FileBase::getSystemPathFromFileURL(dicpath,dict);
osl::FileBase::getSystemPathFromFileURL(aDAffNames[i],aff); osl::FileBase::getSystemPathFromFileURL(affpath,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 specific problem that the // workaround for Windows specifc problem that the
// path length in calls to 'fopen' is limited to somewhat // path length in calls to 'fopen' is limted 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,8 +63,7 @@ class SpellChecker : ...@@ -63,8 +63,7 @@ class SpellChecker :
Hunspell ** aDicts; Hunspell ** aDicts;
rtl_TextEncoding * aDEncs; rtl_TextEncoding * aDEncs;
Locale * aDLocs; Locale * aDLocs;
OUString * aDAffNames; OUString * aDNames;
OUString * aDDicNames;
sal_Int32 numdict; sal_Int32 numdict;
::cppu::OInterfaceContainerHelper aEvtListeners; ::cppu::OInterfaceContainerHelper aEvtListeners;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment