summaryrefslogtreecommitdiff
path: root/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'lingucomponent/source/thesaurus/libnth/nthesimp.cxx')
-rw-r--r--lingucomponent/source/thesaurus/libnth/nthesimp.cxx483
1 files changed, 236 insertions, 247 deletions
diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
index bd6afffdbd6a..02d469514593 100644
--- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
+++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
@@ -28,9 +28,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_lingucomponent.hxx"
-// include <stdio.h>
#include <com/sun/star/uno/Reference.h>
-
#include <cppuhelper/factory.hxx> // helper for factories
#include <com/sun/star/registry/XRegistryKey.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -43,6 +41,8 @@
#include <rtl/string.hxx>
#include <rtl/ustrbuf.hxx>
+#include <rtl/textenc.h>
+
#include "nthesimp.hxx"
#include <linguistic/misc.hxx>
#include <linguistic/lngprops.hxx>
@@ -100,23 +100,27 @@ Thesaurus::Thesaurus() :
aTEncs = NULL;
aTLocs = NULL;
aTNames = NULL;
- numthes = 0;
+ numthes = 0;
}
Thesaurus::~Thesaurus()
{
- if (aThes) {
- for (int i = 0; i < numthes; i++) {
+ if (aThes)
+ {
+ for (int i = 0; i < numthes; i++)
+ {
if (aThes[i]) delete aThes[i];
aThes[i] = NULL;
}
delete[] aThes;
}
aThes = NULL;
- if (aCharSetInfo) {
- for (int i = 0; i < numthes; i++) {
+ if (aCharSetInfo)
+ {
+ for (int i = 0; i < numthes; i++)
+ {
if (aCharSetInfo[i]) delete aCharSetInfo[i];
aCharSetInfo[i] = NULL;
}
@@ -244,7 +248,7 @@ Sequence< Locale > SAL_CALL Thesaurus::getLocales()
for (sal_Int32 i = 0; i < nLocales; ++i)
{
aThes[k] = NULL;
- aTEncs[k] = 0;
+ aTEncs[k] = RTL_TEXTENCODING_DONTKNOW;
aTLocs[k] = MsLangId::convertLanguageToLocale(
MsLangId::convertIsoStringToLanguage( aDictIt->aLocaleNames[i] ));
aCharSetInfo[k] = new CharClass( aTLocs[k] );
@@ -302,28 +306,28 @@ sal_Bool SAL_CALL Thesaurus::hasLocale(const Locale& rLocale)
}
-Sequence < Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL
- Thesaurus::queryMeanings( const OUString& qTerm, const Locale& rLocale,
- const PropertyValues& rProperties)
- throw(IllegalArgumentException, RuntimeException)
+Sequence < Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryMeanings(
+ const OUString& qTerm, const Locale& rLocale,
+ const PropertyValues& rProperties)
+ throw(IllegalArgumentException, RuntimeException)
{
- MutexGuard aGuard( GetLinguMutex() );
+ MutexGuard aGuard( GetLinguMutex() );
- uno::Sequence< Reference< XMeaning > > aMeanings( 1 );
- uno::Sequence< Reference< XMeaning > > noMeanings( 0 );
- uno::Reference< XLinguServiceManager > xLngSvcMgr( GetLngSvcMgr_Impl() );
- uno::Reference< XSpellChecker1 > xSpell;
+ uno::Sequence< Reference< XMeaning > > aMeanings( 1 );
+ uno::Sequence< Reference< XMeaning > > noMeanings( 0 );
+ uno::Reference< XLinguServiceManager > xLngSvcMgr( GetLngSvcMgr_Impl() );
+ uno::Reference< XSpellChecker1 > xSpell;
- OUString rTerm(qTerm);
- OUString pTerm(qTerm);
- sal_uInt16 ct = CAPTYPE_UNKNOWN;
- sal_Int32 stem = 0;
- sal_Int32 stem2 = 0;
+ OUString rTerm(qTerm);
+ OUString pTerm(qTerm);
+ sal_uInt16 ct = CAPTYPE_UNKNOWN;
+ sal_Int32 stem = 0;
+ sal_Int32 stem2 = 0;
- INT16 nLanguage = LocaleToLanguage( rLocale );
+ INT16 nLanguage = LocaleToLanguage( rLocale );
- if (nLanguage == LANGUAGE_NONE || !rTerm.getLength())
- return noMeanings;
+ if (nLanguage == LANGUAGE_NONE || !rTerm.getLength())
+ return noMeanings;
if (!hasLocale( rLocale ))
#ifdef LINGU_EXCEPTIONS
@@ -332,195 +336,202 @@ Sequence < Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL
return noMeanings;
#endif
- if (prevTerm == qTerm && prevLocale == nLanguage) return prevMeanings;
+ if (prevTerm == qTerm && prevLocale == nLanguage)
+ return prevMeanings;
- mentry * pmean = NULL;
+ mentry * pmean = NULL;
sal_Int32 nmean = 0;
- PropertyHelper_Thes &rHelper = GetPropHelper();
- rHelper.SetTmpPropVals( rProperties );
+ PropertyHelper_Thes &rHelper = GetPropHelper();
+ rHelper.SetTmpPropVals( rProperties );
- MyThes * pTH = NULL;
- rtl_TextEncoding aEnc = 0;
- CharClass * pCC = NULL;
+ MyThes * pTH = NULL;
+ rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
+ CharClass * pCC = NULL;
- // find the first thesaurus that matches the locale
- for (int i =0; i < numthes; i++) {
- if (rLocale == aTLocs[i])
+ // find the first thesaurus that matches the locale
+ for (int i =0; i < numthes; i++)
+ {
+ if (rLocale == aTLocs[i])
+ {
+ // open up and intialize this thesaurus if need be
+ if (!aThes[i])
{
- // open up and intialize this thesaurus if need be
- if (!aThes[i])
- {
- OUString datpath = aTNames[i] + A2OU(".dat");
- OUString idxpath = aTNames[i] + A2OU(".idx");
- OUString ndat;
- OUString nidx;
- osl::FileBase::getSystemPathFromFileURL(datpath,ndat);
- osl::FileBase::getSystemPathFromFileURL(idxpath,nidx);
- OString aTmpidx(OU2ENC(nidx,osl_getThreadTextEncoding()));
- OString aTmpdat(OU2ENC(ndat,osl_getThreadTextEncoding()));
+ OUString datpath = aTNames[i] + A2OU(".dat");
+ OUString idxpath = aTNames[i] + A2OU(".idx");
+ OUString ndat;
+ OUString nidx;
+ osl::FileBase::getSystemPathFromFileURL(datpath,ndat);
+ osl::FileBase::getSystemPathFromFileURL(idxpath,nidx);
+ OString aTmpidx(OU2ENC(nidx,osl_getThreadTextEncoding()));
+ OString aTmpdat(OU2ENC(ndat,osl_getThreadTextEncoding()));
#if defined(WNT)
- // workaround for Windows specifc problem that the
- // path length in calls to 'fopen' is limted to somewhat
- // about 120+ characters which will usually be exceed when
- // using dictionaries as extensions.
- aTmpidx = Win_GetShortPathName( nidx );
- aTmpdat = Win_GetShortPathName( ndat );
+ // workaround for Windows specifc problem that the
+ // path length in calls to 'fopen' is limted to somewhat
+ // about 120+ characters which will usually be exceed when
+ // using dictionaries as extensions.
+ aTmpidx = Win_GetShortPathName( nidx );
+ aTmpdat = Win_GetShortPathName( ndat );
#endif
- aThes[i] = new MyThes(aTmpidx.getStr(),aTmpdat.getStr());
- if (aThes[i]) {
- const char * enc_string = aThes[i]->get_th_encoding();
- if (!enc_string) {
- aTEncs[i] = rtl_getTextEncodingFromUnixCharset("ISO8859-1");
- } else {
- aTEncs[i] = rtl_getTextEncodingFromUnixCharset(enc_string);
- if (aTEncs[i] == RTL_TEXTENCODING_DONTKNOW) {
- if (strcmp("ISCII-DEVANAGARI", enc_string) == 0) {
- aTEncs[i] = RTL_TEXTENCODING_ISCII_DEVANAGARI;
- } else if (strcmp("UTF-8", enc_string) == 0) {
- aTEncs[i] = RTL_TEXTENCODING_UTF8;
- }
- }
- }
- }
- }
- pTH = aThes[i];
- aEnc = aTEncs[i];
- pCC = aCharSetInfo[i];
-
- if (pTH)
- break;
+ aThes[i] = new MyThes(aTmpidx.getStr(),aTmpdat.getStr());
+ if (aThes[i])
+ aTEncs[i] = getTextEncodingFromCharset(aThes[i]->get_th_encoding());
+ }
+ pTH = aThes[i];
+ eEnc = aTEncs[i];
+ pCC = aCharSetInfo[i];
+
+ if (pTH)
+ break;
}
}
- while (pTH) {
- // convert word to all lower case for searching
- if (!stem) ct = capitalType(rTerm, pCC);
- OUString nTerm(makeLowerCase(rTerm, pCC));
- OString aTmp( OU2ENC(nTerm, aEnc) );
- nmean = pTH->Lookup(aTmp.getStr(),aTmp.getLength(),&pmean);
+ // we don't want to work with a default text encoding since following incorrect
+ // results may occur only for specific text and thus may be hard to notice.
+ // Thus better always make a clean exit here if the text encoding is in question.
+ // Hopefully something not working at all will raise proper attention quickly. ;-)
+ DBG_ASSERT( eEnc != RTL_TEXTENCODING_DONTKNOW, "failed to get text encoding! (maybe incorrect encoding string in file)" );
+ if (eEnc == RTL_TEXTENCODING_DONTKNOW)
+ return noMeanings;
- if (nmean) aMeanings.realloc( nmean );
+ while (pTH)
+ {
+ // convert word to all lower case for searching
+ if (!stem)
+ ct = capitalType(rTerm, pCC);
+ OUString nTerm(makeLowerCase(rTerm, pCC));
+ OString aTmp( OU2ENC(nTerm, eEnc) );
+ nmean = pTH->Lookup(aTmp.getStr(),aTmp.getLength(),&pmean);
- mentry * pe = pmean;
- OUString codeTerm = qTerm;
- Reference< XSpellAlternatives > xTmpRes2;
+ if (nmean)
+ aMeanings.realloc( nmean );
- if (stem) {
- xTmpRes2 = xSpell->spell( A2OU("<?xml?><query type='analyze'><word>") +
+ mentry * pe = pmean;
+ OUString codeTerm = qTerm;
+ Reference< XSpellAlternatives > xTmpRes2;
+
+ if (stem)
+ {
+ xTmpRes2 = xSpell->spell( A2OU("<?xml?><query type='analyze'><word>") +
pTerm + A2OU("</word></query>"), nLanguage, rProperties );
- if (xTmpRes2.is()) {
- Sequence<OUString>seq = xTmpRes2->getAlternatives();
- if (seq.getLength() > 0) {
+ if (xTmpRes2.is())
+ {
+ Sequence<OUString>seq = xTmpRes2->getAlternatives();
+ if (seq.getLength() > 0)
+ {
codeTerm = seq[0];
stem2 = 1;
- }
+ }
#if 0
- OString o = OUStringToOString(codeTerm, rtl_getTextEncodingFromUnixCharset("UTF-8"));
- fprintf(stderr, "CODETERM: %s\n", o.pData->buffer);
+ OString o = OUStringToOString(codeTerm, RTL_TEXTENCODING_UTF8);
+ fprintf(stderr, "CODETERM: %s\n", o.pData->buffer);
#endif
- }
- }
-
- for (int j = 0; j < nmean; j++) {
- int count = pe->count;
- if (count) {
- Sequence< OUString > aStr( count );
- OUString *pStr = aStr.getArray();
-
- for (int i=0; i < count; i++) {
- OUString sTerm(pe->psyns[i],strlen(pe->psyns[i]),aEnc );
- sal_Int32 catpos = sTerm.indexOf('(');
- sal_Int32 catpos2 = 0;
- OUString catst;
- OUString catst2;
- if (catpos > 2) {
- // remove category name for affixation and casing
- catst = A2OU(" ") + sTerm.copy(catpos);
- sTerm = sTerm.copy(0, catpos);
- sTerm = sTerm.trim();
- }
- // generate synonyms with affixes
- if (stem && stem2) {
- Reference< XSpellAlternatives > xTmpRes;
- xTmpRes = xSpell->spell( A2OU("<?xml?><query type='generate'><word>") +
- sTerm + A2OU("</word>") + codeTerm + A2OU("</query>"), nLanguage, rProperties );
- if (xTmpRes.is()) {
- Sequence<OUString>seq = xTmpRes->getAlternatives();
- for (int k = 0; k < seq.getLength(); k++) {
- OString o = OUStringToOString(seq[k], rtl_getTextEncodingFromUnixCharset("UTF-8"));
- }
- if (seq.getLength() > 0) sTerm = seq[0];
- }
- }
- if (catpos2) sTerm = catst2 + sTerm;
-
- sal_uInt16 ct1 = capitalType(sTerm, pCC);
- if (CAPTYPE_MIXED == ct1)
- ct = ct1;
- OUString cTerm;
- switch (ct) {
- case CAPTYPE_ALLCAP:
- {
- cTerm = makeUpperCase(sTerm, pCC);
- break;
- }
- case CAPTYPE_INITCAP:
- {
- cTerm = makeInitCap(sTerm, pCC);
- break;
- }
- default:
- {
- cTerm = sTerm;
- break;
- }
- }
- OUString aAlt( cTerm + catst);
- pStr[i] = aAlt;
- }
+ }
+ }
+
+ for (int j = 0; j < nmean; j++)
+ {
+ int count = pe->count;
+ if (count)
+ {
+ Sequence< OUString > aStr( count );
+ OUString *pStr = aStr.getArray();
+
+ for (int i=0; i < count; i++)
+ {
+ OUString sTerm(pe->psyns[i],strlen(pe->psyns[i]),eEnc );
+ sal_Int32 catpos = sTerm.indexOf('(');
+ sal_Int32 catpos2 = 0;
+ OUString catst;
+ OUString catst2;
+ if (catpos > 2)
+ {
+ // remove category name for affixation and casing
+ catst = A2OU(" ") + sTerm.copy(catpos);
+ sTerm = sTerm.copy(0, catpos);
+ sTerm = sTerm.trim();
+ }
+ // generate synonyms with affixes
+ if (stem && stem2)
+ {
+ Reference< XSpellAlternatives > xTmpRes;
+ xTmpRes = xSpell->spell( A2OU("<?xml?><query type='generate'><word>") +
+ sTerm + A2OU("</word>") + codeTerm + A2OU("</query>"), nLanguage, rProperties );
+ if (xTmpRes.is())
+ {
+ Sequence<OUString>seq = xTmpRes->getAlternatives();
+ if (seq.getLength() > 0)
+ sTerm = seq[0];
+ }
+ }
+ if (catpos2)
+ sTerm = catst2 + sTerm;
+
+ sal_uInt16 ct1 = capitalType(sTerm, pCC);
+ if (CAPTYPE_MIXED == ct1)
+ ct = ct1;
+ OUString cTerm;
+ switch (ct)
+ {
+ case CAPTYPE_ALLCAP:
+ cTerm = makeUpperCase(sTerm, pCC);
+ break;
+ case CAPTYPE_INITCAP:
+ cTerm = makeInitCap(sTerm, pCC);
+ break;
+ default:
+ cTerm = sTerm;
+ break;
+ }
+ OUString aAlt( cTerm + catst);
+ pStr[i] = aAlt;
+ }
#if 0
- Meaning * pMn = new Meaning(rTerm,nLanguage,rHelper);
+ Meaning * pMn = new Meaning(rTerm,nLanguage,rHelper);
#endif
- Meaning * pMn = new Meaning(rTerm,nLanguage);
- OUString dTerm(pe->defn,strlen(pe->defn),aEnc );
- pMn->SetMeaning(dTerm);
- pMn->SetSynonyms(aStr);
- Reference<XMeaning>* pMeaning = aMeanings.getArray();
- pMeaning[j] = pMn;
- }
- pe++;
- }
- pTH->CleanUpAfterLookup(&pmean,nmean);
-
- if (nmean) {
+ Meaning * pMn = new Meaning(rTerm,nLanguage);
+ OUString dTerm(pe->defn,strlen(pe->defn),eEnc );
+ pMn->SetMeaning(dTerm);
+ pMn->SetSynonyms(aStr);
+ Reference<XMeaning>* pMeaning = aMeanings.getArray();
+ pMeaning[j] = pMn;
+ }
+ pe++;
+ }
+ pTH->CleanUpAfterLookup(&pmean,nmean);
+
+ if (nmean)
+ {
prevTerm = qTerm;
prevMeanings = aMeanings;
prevLocale = nLanguage;
return aMeanings;
- }
+ }
- if (stem || !xLngSvcMgr.is()) return noMeanings;
+ if (stem || !xLngSvcMgr.is())
+ return noMeanings;
stem = 1;
xSpell = uno::Reference< XSpellChecker1 >( xLngSvcMgr->getSpellChecker(), UNO_QUERY );
- if (!xSpell.is() || !xSpell->isValid( A2OU(SPELLML_SUPPORT), nLanguage, rProperties )) {
+ if (!xSpell.is() || !xSpell->isValid( A2OU(SPELLML_SUPPORT), nLanguage, rProperties ))
return noMeanings;
- }
Reference< XSpellAlternatives > xTmpRes;
xTmpRes = xSpell->spell( A2OU("<?xml?><query type='stem'><word>") +
rTerm + A2OU("</word></query>"), nLanguage, rProperties );
- if (xTmpRes.is()) {
+ if (xTmpRes.is())
+ {
Sequence<OUString>seq = xTmpRes->getAlternatives();
#if 0
- for (int i = 0; i < seq.getLength(); i++) {
- OString o = OUStringToOString(seq[i], rtl_getTextEncodingFromUnixCharset("UTF-8"));
+ for (int i = 0; i < seq.getLength(); i++)
+ {
+ OString o = OUStringToOString(seq[i], RTL_TEXTENCODING_UTF8);
fprintf(stderr, "%d: %s\n", i + 1, o.pData->buffer);
}
#endif
- if (seq.getLength() > 0) {
+ if (seq.getLength() > 0)
+ {
rTerm = seq[0]; // XXX Use only the first stem
continue;
}
@@ -529,17 +540,21 @@ Sequence < Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL
// stem the last word of the synonym (for categories after affixation)
rTerm = rTerm.trim();
sal_Int32 pos = rTerm.lastIndexOf(' ');
- if (!pos) return noMeanings;
+ if (!pos)
+ return noMeanings;
xTmpRes = xSpell->spell( A2OU("<?xml?><query type='stem'><word>") +
rTerm.copy(pos + 1) + A2OU("</word></query>"), nLanguage, rProperties );
- if (xTmpRes.is()) {
+ if (xTmpRes.is())
+ {
Sequence<OUString>seq = xTmpRes->getAlternatives();
- if (seq.getLength() > 0) {
+ if (seq.getLength() > 0)
+ {
pTerm = rTerm.copy(pos + 1);
rTerm = rTerm.copy(0, pos + 1) + seq[0];
-#if 0
- for (int i = 0; i < seq.getLength(); i++) {
- OString o = OUStringToOString(seq[i], rtl_getTextEncodingFromUnixCharset("UTF-8"));
+#if 0
+ for (int i = 0; i < seq.getLength(); i++)
+ {
+ OString o = OUStringToOString(seq[i], RTL_TEXTENCODING_UTF8);
fprintf(stderr, "%d: %s\n", i + 1, o.pData->buffer);
}
#endif
@@ -547,12 +562,11 @@ Sequence < Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL
}
}
break;
- }
+ }
return noMeanings;
}
-
Reference< XInterface > SAL_CALL Thesaurus_CreateInstance(
const Reference< XMultiServiceFactory > & /*rSMgr*/ )
throw(Exception)
@@ -562,8 +576,7 @@ Reference< XInterface > SAL_CALL Thesaurus_CreateInstance(
}
-OUString SAL_CALL
- Thesaurus::getServiceDisplayName( const Locale& /*rLocale*/ )
+OUString SAL_CALL Thesaurus::getServiceDisplayName( const Locale& /*rLocale*/ )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -571,8 +584,7 @@ OUString SAL_CALL
}
-void SAL_CALL
- Thesaurus::initialize( const Sequence< Any >& rArguments )
+void SAL_CALL Thesaurus::initialize( const Sequence< Any >& rArguments )
throw(Exception, RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -603,24 +615,26 @@ void SAL_CALL
sal_uInt16 SAL_CALL Thesaurus::capitalType(const OUString& aTerm, CharClass * pCC)
{
sal_Int32 tlen = aTerm.getLength();
- if ((pCC) && (tlen)) {
- String aStr(aTerm);
- sal_Int32 nc = 0;
- for (USHORT tindex = 0; tindex < tlen; tindex++) {
- if (pCC->getCharacterType(aStr,tindex) &
- ::com::sun::star::i18n::KCharacterType::UPPER) nc++;
- }
-
- if (nc == 0) return (sal_uInt16) CAPTYPE_NOCAP;
-
- if (nc == tlen) return (sal_uInt16) CAPTYPE_ALLCAP;
+ if ((pCC) && (tlen))
+ {
+ String aStr(aTerm);
+ sal_Int32 nc = 0;
+ for (USHORT tindex = 0; tindex < tlen; tindex++)
+ {
+ if (pCC->getCharacterType(aStr,tindex) &
+ ::com::sun::star::i18n::KCharacterType::UPPER) nc++;
+ }
- if ((nc == 1) && (pCC->getCharacterType(aStr,0) &
- ::com::sun::star::i18n::KCharacterType::UPPER))
- return (sal_uInt16) CAPTYPE_INITCAP;
+ if (nc == 0)
+ return (sal_uInt16) CAPTYPE_NOCAP;
+ if (nc == tlen)
+ return (sal_uInt16) CAPTYPE_ALLCAP;
+ if ((nc == 1) && (pCC->getCharacterType(aStr,0) &
+ ::com::sun::star::i18n::KCharacterType::UPPER))
+ return (sal_uInt16) CAPTYPE_INITCAP;
- return (sal_uInt16) CAPTYPE_MIXED;
- }
+ return (sal_uInt16) CAPTYPE_MIXED;
+ }
return (sal_uInt16) CAPTYPE_UNKNOWN;
}
@@ -628,38 +642,40 @@ sal_uInt16 SAL_CALL Thesaurus::capitalType(const OUString& aTerm, CharClass * pC
OUString SAL_CALL Thesaurus::makeLowerCase(const OUString& aTerm, CharClass * pCC)
{
- if (pCC)
- return pCC->toLower_rtl(aTerm, 0, aTerm.getLength());
- return aTerm;
+ if (pCC)
+ return pCC->toLower_rtl(aTerm, 0, aTerm.getLength());
+ return aTerm;
}
OUString SAL_CALL Thesaurus::makeUpperCase(const OUString& aTerm, CharClass * pCC)
{
- if (pCC)
- return pCC->toUpper_rtl(aTerm, 0, aTerm.getLength());
- return aTerm;
+ if (pCC)
+ return pCC->toUpper_rtl(aTerm, 0, aTerm.getLength());
+ return aTerm;
}
OUString SAL_CALL Thesaurus::makeInitCap(const OUString& aTerm, CharClass * pCC)
{
- sal_Int32 tlen = aTerm.getLength();
- if ((pCC) && (tlen)) {
- OUString bTemp = aTerm.copy(0,1);
- if (tlen > 1)
- return ( pCC->toUpper_rtl(bTemp, 0, 1)
- + pCC->toLower_rtl(aTerm,1,(tlen-1)) );
+ sal_Int32 tlen = aTerm.getLength();
+ if ((pCC) && (tlen))
+ {
+ OUString bTemp = aTerm.copy(0,1);
+ if (tlen > 1)
+ {
+ return ( pCC->toUpper_rtl(bTemp, 0, 1)
+ + pCC->toLower_rtl(aTerm,1,(tlen-1)) );
+ }
- return pCC->toUpper_rtl(bTemp, 0, 1);
+ return pCC->toUpper_rtl(bTemp, 0, 1);
}
- return aTerm;
+ return aTerm;
}
-void SAL_CALL
- Thesaurus::dispose()
+void SAL_CALL Thesaurus::dispose()
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -673,8 +689,7 @@ void SAL_CALL
}
-void SAL_CALL
- Thesaurus::addEventListener( const Reference< XEventListener >& rxListener )
+void SAL_CALL Thesaurus::addEventListener( const Reference< XEventListener >& rxListener )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -684,8 +699,7 @@ void SAL_CALL
}
-void SAL_CALL
- Thesaurus::removeEventListener( const Reference< XEventListener >& rxListener )
+void SAL_CALL Thesaurus::removeEventListener( const Reference< XEventListener >& rxListener )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -739,31 +753,6 @@ Sequence< OUString > Thesaurus::getSupportedServiceNames_Static()
return aSNS;
}
-
-sal_Bool SAL_CALL Thesaurus_writeInfo(
- void * /*pServiceManager*/, registry::XRegistryKey * pRegistryKey )
-{
- try
- {
- String aImpl( '/' );
- aImpl += Thesaurus::getImplementationName_Static().getStr();
- aImpl.AppendAscii( "/UNO/SERVICES" );
- Reference< registry::XRegistryKey > xNewKey =
- pRegistryKey->createKey( aImpl );
- Sequence< OUString > aServices =
- Thesaurus::getSupportedServiceNames_Static();
- for( INT32 i = 0; i < aServices.getLength(); i++ )
- xNewKey->createKey( aServices.getConstArray()[i] );
-
- return sal_True;
- }
- catch(Exception &)
- {
- return sal_False;
- }
-}
-
-
void * SAL_CALL Thesaurus_getFactory( const sal_Char * pImplName,
XMultiServiceFactory * pServiceManager, void * )
{