summaryrefslogtreecommitdiff
path: root/lingucomponent
diff options
context:
space:
mode:
authorXiaofei Zhang <Zhangxiaofei@openoffice.org>2010-11-10 13:50:33 +0800
committerXiaofei Zhang <Zhangxiaofei@openoffice.org>2010-11-10 13:50:33 +0800
commitecf66d8aa3b1792e53d8b691a7b679fd47133ac9 (patch)
tree3e08d97c782594c74bc2e88c552150f71e016e5e /lingucomponent
parent16ae4c1524769458f6d205430e7dcb8fc4ae333b (diff)
parent8373a5b7946d6731609f989f1aa4a762ed70854a (diff)
removetooltypes01: #i112600# resync to DEV300_m92; remove tooltypes from xmloff, linguistic, vcl, svtools, accessibility, fpicker, uui and framework
Diffstat (limited to 'lingucomponent')
-rw-r--r--lingucomponent/prj/build.lst5
-rw-r--r--lingucomponent/prj/d.lst5
-rw-r--r--lingucomponent/source/hyphenator/altlinuxhyph/hyphen/exports.dxp1
-rw-r--r--lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hreg.cxx9
-rw-r--r--lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphen.component34
-rwxr-xr-xlingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx866
-rw-r--r--lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.hxx94
-rw-r--r--lingucomponent/source/hyphenator/altlinuxhyph/hyphen/makefile.mk8
-rw-r--r--lingucomponent/source/languageguessing/guesslang.component34
-rw-r--r--lingucomponent/source/languageguessing/guesslang.cxx7
-rw-r--r--lingucomponent/source/languageguessing/makefile.mk8
-rw-r--r--lingucomponent/source/lingutil/lingutil.cxx21
-rw-r--r--lingucomponent/source/lingutil/lingutil.hxx8
-rw-r--r--lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component34
-rw-r--r--lingucomponent/source/spellcheck/macosxspell/macreg.cxx9
-rw-r--r--lingucomponent/source/spellcheck/macosxspell/macspellimp.cxx26
-rw-r--r--lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx93
-rw-r--r--lingucomponent/source/spellcheck/macosxspell/makefile.mk8
-rw-r--r--lingucomponent/source/spellcheck/spell/exports.dxp1
-rw-r--r--lingucomponent/source/spellcheck/spell/makefile.mk8
-rw-r--r--lingucomponent/source/spellcheck/spell/spell.component34
-rw-r--r--lingucomponent/source/spellcheck/spell/sreg.cxx9
-rw-r--r--lingucomponent/source/spellcheck/spell/sspellimp.cxx326
-rw-r--r--lingucomponent/source/spellcheck/spell/sspellimp.hxx90
-rw-r--r--lingucomponent/source/thesaurus/libnth/exports.dxp1
-rw-r--r--lingucomponent/source/thesaurus/libnth/lnth.component34
-rw-r--r--lingucomponent/source/thesaurus/libnth/makefile.mk8
-rw-r--r--lingucomponent/source/thesaurus/libnth/nthesdta.hxx22
-rw-r--r--lingucomponent/source/thesaurus/libnth/nthesimp.cxx483
-rw-r--r--lingucomponent/source/thesaurus/libnth/nthesimp.hxx53
-rw-r--r--lingucomponent/source/thesaurus/libnth/ntreg.cxx9
-rw-r--r--lingucomponent/source/thesaurus/mythes/Makefile39
-rw-r--r--lingucomponent/source/thesaurus/mythes/README60
-rw-r--r--lingucomponent/source/thesaurus/mythes/checkme.lst4
-rw-r--r--lingucomponent/source/thesaurus/mythes/data_layout.txt131
-rw-r--r--lingucomponent/source/thesaurus/mythes/example.cxx128
-rw-r--r--lingucomponent/source/thesaurus/mythes/license.readme34
-rw-r--r--lingucomponent/source/thesaurus/mythes/makefile.mk59
-rw-r--r--lingucomponent/source/thesaurus/mythes/mythes.cxx403
-rw-r--r--lingucomponent/source/thesaurus/mythes/mythes.hxx76
40 files changed, 1152 insertions, 2130 deletions
diff --git a/lingucomponent/prj/build.lst b/lingucomponent/prj/build.lst
index 138e5858f70e..15ee595c67c0 100644
--- a/lingucomponent/prj/build.lst
+++ b/lingucomponent/prj/build.lst
@@ -1,9 +1,8 @@
-lc lingucomponent : linguistic libtextcat svl HYPHEN:hyphen HUNSPELL:hunspell NULL
+lc lingucomponent : linguistic LIBTEXTCAT:libtextcat LIBTEXTCATDATA:libtextcat svl HYPHEN:hyphen HUNSPELL:hunspell MYTHES:mythes NULL
lc lingucomponent usr1 - all lc_mkout NULL
lc lingucomponent\inc nmake - all lc_inc NULL
lc lingucomponent\source\lingutil nmake - all lc_util lc_inc NULL
-lc lingucomponent\source\thesaurus\mythes nmake - all lc_mythes lc_util lc_inc NULL
-lc lingucomponent\source\thesaurus\libnth nmake - all lc_libnth lc_mythes lc_util lc_inc NULL
+lc lingucomponent\source\thesaurus\libnth nmake - all lc_libnth lc_util lc_inc NULL
lc lingucomponent\source\spellcheck\spell nmake - all lc_libspell lc_util lc_inc NULL
lc lingucomponent\source\hyphenator\altlinuxhyph\hyphen nmake - all lc_libhyphen lc_util lc_inc NULL
lc lingucomponent\source\languageguessing nmake - all lc_languageguessing lc_util lc_inc NULL
diff --git a/lingucomponent/prj/d.lst b/lingucomponent/prj/d.lst
index 666ee38d5b1d..4760a299c84d 100644
--- a/lingucomponent/prj/d.lst
+++ b/lingucomponent/prj/d.lst
@@ -46,3 +46,8 @@ mkdir: %_DEST%\xml%_EXT%\registry\data\org\openoffice
mkdir: %_DEST%\xml%_EXT%\registry\data\org\openoffice\Office
..\config\*.xcu %_DEST%\xml%_EXT%\registry\data\org\openoffice\Office\*.xcu
+..\%__SRC%\misc\MacOSXSpell.component %_DEST%\xml%_EXT%\MacOSXSpell.component
+..\%__SRC%\misc\guesslang.component %_DEST%\xml%_EXT%\guesslang.component
+..\%__SRC%\misc\hyphen.component %_DEST%\xml%_EXT%\hyphen.component
+..\%__SRC%\misc\lnth.component %_DEST%\xml%_EXT%\lnth.component
+..\%__SRC%\misc\spell.component %_DEST%\xml%_EXT%\spell.component
diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/exports.dxp b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/exports.dxp
index b0f85bf7bebf..a9861e3ffc0c 100644
--- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/exports.dxp
+++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/exports.dxp
@@ -1,3 +1,2 @@
component_getFactory
component_getImplementationEnvironment
-component_writeInfo
diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hreg.cxx b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hreg.cxx
index 448ecc529bf0..9d975a83b8ef 100644
--- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hreg.cxx
+++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hreg.cxx
@@ -42,9 +42,6 @@ using namespace com::sun::star::registry;
// declaration of external RegEntry-functions defined by the service objects
//
-extern sal_Bool SAL_CALL Hyphenator_writeInfo(
- void * /*pServiceManager*/, XRegistryKey * pRegistryKey );
-
extern void * SAL_CALL Hyphenator_getFactory(
const sal_Char * pImplName,
XMultiServiceFactory * pServiceManager,
@@ -57,12 +54,6 @@ extern void * SAL_CALL Hyphenator_getFactory(
extern "C"
{
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, XRegistryKey * pRegistryKey )
-{
- return Hyphenator_writeInfo( pServiceManager, pRegistryKey );
-}
-
void SAL_CALL component_getImplementationEnvironment(
const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
{
diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphen.component b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphen.component
new file mode 100644
index 000000000000..aeae4c577b98
--- /dev/null
+++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphen.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="org.openoffice.lingu.LibHnjHyphenator">
+ <service name="com.sun.star.linguistic2.Hyphenator"/>
+ </implementation>
+</component>
diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
index 3b0871cc36b6..5d040be72cb9 100755
--- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
@@ -32,7 +32,6 @@
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
-//#include <com/sun/star/linguistic2/SpellFailure.hpp>
#include <cppuhelper/factory.hxx> // helper for factories
#include <com/sun/star/registry/XRegistryKey.hpp>
#include <i18npool/mslangid.hxx>
@@ -43,15 +42,12 @@
#include <osl/mutex.hxx>
#include <hyphen.h>
-
-#ifndef _HYPHENIMP_HXX
#include <hyphenimp.hxx>
-#endif
#include <linguistic/hyphdta.hxx>
#include <rtl/ustring.hxx>
-
#include <rtl/ustrbuf.hxx>
+#include <rtl/textenc.h>
#include <linguistic/lngprops.hxx>
#include <unotools/pathoptions.hxx>
@@ -97,9 +93,8 @@ Hyphenator::Hyphenator() :
{
bDisposing = FALSE;
pPropHelper = NULL;
- aDicts = NULL;
- numdict = 0;
-
+ aDicts = NULL;
+ numdict = 0;
}
@@ -108,21 +103,22 @@ Hyphenator::~Hyphenator()
if (pPropHelper)
pPropHelper->RemoveAsPropListener();
- if ((numdict) && (aDicts)) {
- for (int i=0; i < numdict; i++) {
+ if ((numdict) && (aDicts))
+ {
+ for (int i=0; i < numdict; i++)
+ {
if (aDicts[i].apCC) delete aDicts[i].apCC;
aDicts[i].apCC = NULL;
- }
+ }
}
- if (aDicts) delete[] aDicts;
+ if (aDicts) delete[] aDicts;
aDicts = NULL;
- numdict = 0;
+ numdict = 0;
}
PropertyHelper_Hyphen & Hyphenator::GetPropHelper_Impl()
{
-
if (!pPropHelper)
{
Reference< XPropertySet > xPropSet( GetLinguProperties(), UNO_QUERY );
@@ -212,12 +208,7 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales()
// add dictionary information
aDicts = new HDInfo[numdict];
-/*
- aTEncs = new rtl_TextEncoding [numdict];
- aTLocs = new Locale [numdict];
- aTNames = new OUString [numdict];
- aCharSetInfo = new CharClass* [numdict];
-*/
+
k = 0;
for (aDictIt = aDics.begin(); aDictIt != aDics.end(); ++aDictIt)
{
@@ -233,7 +224,7 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales()
for (sal_Int32 i = 0; i < nLocales; ++i)
{
aDicts[k].aPtr = NULL;
- aDicts[k].aEnc = 0;
+ aDicts[k].eEnc = RTL_TEXTENCODING_DONTKNOW;
aDicts[k].aLoc = MsLangId::convertLanguageToLocale(
MsLangId::convertIsoStringToLanguage( aDictIt->aLocaleNames[i] ));
aDicts[k].apCC = new CharClass( aDicts[k].aLoc );
@@ -288,240 +279,268 @@ sal_Bool SAL_CALL Hyphenator::hasLocale(const Locale& rLocale)
}
-Reference< XHyphenatedWord > SAL_CALL
-Hyphenator::hyphenate( const ::rtl::OUString& aWord,
- const ::com::sun::star::lang::Locale& aLocale,
- sal_Int16 nMaxLeading,
- const ::com::sun::star::beans::PropertyValues& aProperties )
- throw (com::sun::star::uno::RuntimeException,
- com::sun::star::lang::IllegalArgumentException)
+Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const ::rtl::OUString& aWord,
+ const ::com::sun::star::lang::Locale& aLocale,
+ sal_Int16 nMaxLeading,
+ const ::com::sun::star::beans::PropertyValues& aProperties )
+ throw (com::sun::star::uno::RuntimeException, com::sun::star::lang::IllegalArgumentException)
{
int nHyphenationPos = -1;
- int nHyphenationPosAlt = -1;
- int nHyphenationPosAltHyph = -1;
+ int nHyphenationPosAlt = -1;
+ int nHyphenationPosAltHyph = -1;
int wordlen;
char *hyphens;
- char *lcword;
- int k = 0;
+ char *lcword;
+ int k = 0;
- PropertyHelper_Hyphen & rHelper = GetPropHelper();
- rHelper.SetTmpPropVals(aProperties);
+ PropertyHelper_Hyphen & rHelper = GetPropHelper();
+ rHelper.SetTmpPropVals(aProperties);
sal_Int16 minTrail = rHelper.GetMinTrailing();
sal_Int16 minLead = rHelper.GetMinLeading();
sal_Int16 minLen = rHelper.GetMinWordLength();
HyphenDict *dict = NULL;
- rtl_TextEncoding aEnc = 0;
- CharClass * pCC = NULL;
+ rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
+ CharClass * pCC = NULL;
Reference< XHyphenatedWord > xRes;
- k = -1;
- for (int j = 0; j < numdict; j++)
- if (aLocale == aDicts[j].aLoc) k = j;
-
-
- // if we have a hyphenation dictionary matching this locale
- if (k != -1) {
+ k = -1;
+ for (int j = 0; j < numdict; j++)
+ {
+ if (aLocale == aDicts[j].aLoc)
+ k = j;
+ }
+ // if we have a hyphenation dictionary matching this locale
+ if (k != -1)
+ {
// if this dictinary has not been loaded yet do that
- if (!aDicts[k].aPtr) {
-
- OUString DictFN = aDicts[k].aName + A2OU(".dic");
- OUString dictpath;
+ if (!aDicts[k].aPtr)
+ {
+ OUString DictFN = aDicts[k].aName + A2OU(".dic");
+ OUString dictpath;
- osl::FileBase::getSystemPathFromFileURL( DictFN, dictpath );
- OString sTmp( OU2ENC( dictpath, osl_getThreadTextEncoding() ) );
+ osl::FileBase::getSystemPathFromFileURL( DictFN, dictpath );
+ OString sTmp( OU2ENC( dictpath, 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.
- sTmp = Win_GetShortPathName( dictpath );
+ // 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.
+ sTmp = Win_GetShortPathName( dictpath );
#endif
- if ( ( dict = hnj_hyphen_load ( sTmp.getStr()) ) == NULL )
- {
- fprintf(stderr, "Couldn't find file %s\n", OU2ENC(dictpath, osl_getThreadTextEncoding()) );
- return NULL;
- }
- aDicts[k].aPtr = dict;
- aDicts[k].aEnc = rtl_getTextEncodingFromUnixCharset(dict->cset);
- if (aDicts[k].aEnc == RTL_TEXTENCODING_DONTKNOW) {
- if (strcmp("ISCII-DEVANAGARI", dict->cset) == 0) {
- aDicts[k].aEnc = RTL_TEXTENCODING_ISCII_DEVANAGARI;
- } else if (strcmp("UTF-8", dict->cset) == 0) {
- aDicts[k].aEnc = RTL_TEXTENCODING_UTF8;
- }
- }
+ if ( ( dict = hnj_hyphen_load ( sTmp.getStr()) ) == NULL )
+ {
+ fprintf(stderr, "Couldn't find file %s\n", OU2ENC(dictpath, osl_getThreadTextEncoding()) );
+ return NULL;
+ }
+ aDicts[k].aPtr = dict;
+ aDicts[k].eEnc = getTextEncodingFromCharset(dict->cset);
}
- // other wise hyphenate the word with that dictionary
- dict = aDicts[k].aPtr;
- aEnc = aDicts[k].aEnc;
- pCC = aDicts[k].apCC;
+ // other wise hyphenate the word with that dictionary
+ dict = aDicts[k].aPtr;
+ eEnc = aDicts[k].eEnc;
+ pCC = aDicts[k].apCC;
- sal_uInt16 ct = CAPTYPE_UNKNOWN;
- ct = capitalType(aWord, pCC);
+ // 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 NULL;
- // first convert any smart quotes or apostrophes to normal ones
+ sal_uInt16 ct = CAPTYPE_UNKNOWN;
+ ct = capitalType(aWord, pCC);
+
+ // first convert any smart quotes or apostrophes to normal ones
OUStringBuffer rBuf(aWord);
- sal_Int32 nc = rBuf.getLength();
- sal_Unicode ch;
- for (sal_Int32 ix=0; ix < nc; ix++) {
+ sal_Int32 nc = rBuf.getLength();
+ sal_Unicode ch;
+ for (sal_Int32 ix=0; ix < nc; ix++)
+ {
ch = rBuf.charAt(ix);
- if ((ch == 0x201C) || (ch == 0x201D)) rBuf.setCharAt(ix,(sal_Unicode)0x0022);
- if ((ch == 0x2018) || (ch == 0x2019)) rBuf.setCharAt(ix,(sal_Unicode)0x0027);
- }
- OUString nWord(rBuf.makeStringAndClear());
+ if ((ch == 0x201C) || (ch == 0x201D))
+ rBuf.setCharAt(ix,(sal_Unicode)0x0022);
+ if ((ch == 0x2018) || (ch == 0x2019))
+ rBuf.setCharAt(ix,(sal_Unicode)0x0027);
+ }
+ OUString nWord(rBuf.makeStringAndClear());
- // now convert word to all lowercase for pattern recognition
- OUString nTerm(makeLowerCase(nWord, pCC));
+ // now convert word to all lowercase for pattern recognition
+ OUString nTerm(makeLowerCase(nWord, pCC));
- // now convert word to needed encoding
- OString encWord(OU2ENC(nTerm,aEnc));
+ // now convert word to needed encoding
+ OString encWord(OU2ENC(nTerm,eEnc));
wordlen = encWord.getLength();
- lcword = new char[wordlen + 1];
+ lcword = new char[wordlen + 1];
hyphens = new char[wordlen + 5];
- char ** rep = NULL; // replacements of discretionary hyphenation
- int * pos = NULL; // array of [hyphenation point] minus [deletion position]
- int * cut = NULL; // length of deletions in original word
-
- // copy converted word into simple char buffer
- strcpy(lcword,encWord.getStr());
-
- // now strip off any ending periods
- int n = wordlen-1;
- while((n >=0) && (lcword[n] == '.')) n--;
- n++;
- if (n > 0) {
- if (hnj_hyphen_hyphenate3(dict, lcword, n, hyphens, NULL, &rep, &pos, &cut,
- minLead, minTrail, Max(dict->clhmin, Max(dict->clhmin, 2) + Max(0, minLead - Max(dict->lhmin, 2))),
- Max(dict->crhmin, Max(dict->crhmin, 2) + Max(0, minTrail - Max(dict->rhmin, 2)))))
- {
- //whoops something did not work
- delete[] hyphens;
- delete[] lcword;
- if (rep) {
- for(int j = 0; j < n; j++) {
+ char ** rep = NULL; // replacements of discretionary hyphenation
+ int * pos = NULL; // array of [hyphenation point] minus [deletion position]
+ int * cut = NULL; // length of deletions in original word
+
+ // copy converted word into simple char buffer
+ strcpy(lcword,encWord.getStr());
+
+ // now strip off any ending periods
+ int n = wordlen-1;
+ while((n >=0) && (lcword[n] == '.'))
+ n--;
+ n++;
+ if (n > 0)
+ {
+ const bool bFailed = 0 != hnj_hyphen_hyphenate3( dict, lcword, n, hyphens, NULL,
+ &rep, &pos, &cut, minLead, minTrail,
+ Max(dict->clhmin, Max(dict->clhmin, 2) + Max(0, minLead - Max(dict->lhmin, 2))),
+ Max(dict->crhmin, Max(dict->crhmin, 2) + Max(0, minTrail - Max(dict->rhmin, 2))) );
+ if (bFailed)
+ {
+ //whoops something did not work
+ delete[] hyphens;
+ delete[] lcword;
+ if (rep)
+ {
+ for(int j = 0; j < n; j++)
+ {
if (rep[j]) free(rep[j]);
}
free(rep);
- }
- if (pos) free(pos);
- if (cut) free(cut);
- return NULL;
- }
+ }
+ if (pos) free(pos);
+ if (cut) free(cut);
+ return NULL;
}
+ }
- // now backfill hyphens[] for any removed trailing periods
- for (int c = n; c < wordlen; c++) hyphens[c] = '0';
- hyphens[wordlen] = '\0';
+ // now backfill hyphens[] for any removed trailing periods
+ for (int c = n; c < wordlen; c++) hyphens[c] = '0';
+ hyphens[wordlen] = '\0';
INT32 Leading = GetPosInWordToCheck( aWord, nMaxLeading );
for (INT32 i = 0; i < n; i++)
{
- int leftrep = 0;
- BOOL hit = (n >= minLen);
- if (!rep || !rep[i] || (i >= n)) {
- hit = hit && (hyphens[i]&1) && (i < Leading);
- hit = hit && (i >= (minLead-1) );
- hit = hit && ((n - i - 1) >= minTrail);
- } else {
- // calculate change character length before hyphenation point signed with '='
- for (char * c = rep[i]; *c && (*c != '='); c++) {
- if (aEnc == RTL_TEXTENCODING_UTF8) {
- if (((unsigned char) *c) >> 6 != 2) leftrep++;
- } else leftrep++;
+ int leftrep = 0;
+ BOOL hit = (n >= minLen);
+ if (!rep || !rep[i] || (i >= n))
+ {
+ hit = hit && (hyphens[i]&1) && (i < Leading);
+ hit = hit && (i >= (minLead-1) );
+ hit = hit && ((n - i - 1) >= minTrail);
+ }
+ else
+ {
+ // calculate change character length before hyphenation point signed with '='
+ for (char * c = rep[i]; *c && (*c != '='); c++)
+ {
+ if (eEnc == RTL_TEXTENCODING_UTF8)
+ {
+ if (((unsigned char) *c) >> 6 != 2)
+ leftrep++;
}
- hit = hit && (hyphens[i]&1) && ((i + leftrep - pos[i]) < Leading);
- hit = hit && ((i + leftrep - pos[i]) >= (minLead-1) );
- hit = hit && ((n - i - 1 + sal::static_int_cast< sal_sSize >(strlen(rep[i])) - leftrep - 1) >= minTrail);
+ else
+ leftrep++;
}
- if (hit) {
- nHyphenationPos = i;
- if (rep && (i < n) && rep[i]) {
- nHyphenationPosAlt = i - pos[i];
- nHyphenationPosAltHyph = i + leftrep - pos[i];
- }
+ hit = hit && (hyphens[i]&1) && ((i + leftrep - pos[i]) < Leading);
+ hit = hit && ((i + leftrep - pos[i]) >= (minLead-1) );
+ hit = hit && ((n - i - 1 + sal::static_int_cast< sal_sSize >(strlen(rep[i])) - leftrep - 1) >= minTrail);
+ }
+ if (hit)
+ {
+ nHyphenationPos = i;
+ if (rep && (i < n) && rep[i])
+ {
+ nHyphenationPosAlt = i - pos[i];
+ nHyphenationPosAltHyph = i + leftrep - pos[i];
}
- }
-
- if (nHyphenationPos == -1) {
- xRes = NULL;
- } else {
- if (rep && rep[nHyphenationPos]) {
- // remove equal sign
- char * s = rep[nHyphenationPos];
- int eq = 0;
- for (; *s; s++) {
- if (*s == '=') eq = 1;
- if (eq) *s = *(s + 1);
- }
- OUString repHyphlow(rep[nHyphenationPos], strlen(rep[nHyphenationPos]), aEnc);
- OUString repHyph;
- switch (ct) {
- case CAPTYPE_ALLCAP:
- {
- repHyph = makeUpperCase(repHyphlow, pCC);
- break;
- }
- case CAPTYPE_INITCAP:
- {
- if (nHyphenationPosAlt == 0) {
- repHyph = makeInitCap(repHyphlow, pCC);
- } else {
- repHyph = repHyphlow;
- }
- break;
- }
- default:
- {
- repHyph = repHyphlow;
- break;
- }
}
+ }
+
+ if (nHyphenationPos == -1)
+ {
+ xRes = NULL;
+ }
+ else
+ {
+ if (rep && rep[nHyphenationPos])
+ {
+ // remove equal sign
+ char * s = rep[nHyphenationPos];
+ int eq = 0;
+ for (; *s; s++)
+ {
+ if (*s == '=') eq = 1;
+ if (eq) *s = *(s + 1);
+ }
+ OUString repHyphlow(rep[nHyphenationPos], strlen(rep[nHyphenationPos]), eEnc);
+ OUString repHyph;
+ switch (ct)
+ {
+ case CAPTYPE_ALLCAP:
+ {
+ repHyph = makeUpperCase(repHyphlow, pCC);
+ break;
+ }
+ case CAPTYPE_INITCAP:
+ {
+ if (nHyphenationPosAlt == 0)
+ repHyph = makeInitCap(repHyphlow, pCC);
+ else
+ repHyph = repHyphlow;
+ break;
+ }
+ default:
+ {
+ repHyph = repHyphlow;
+ break;
+ }
+ }
- // handle shortening
- INT16 nPos = (INT16) ((nHyphenationPosAltHyph < nHyphenationPos) ?
- nHyphenationPosAltHyph : nHyphenationPos);
- // dicretionary hyphenation
+ // handle shortening
+ INT16 nPos = (INT16) ((nHyphenationPosAltHyph < nHyphenationPos) ?
+ nHyphenationPosAltHyph : nHyphenationPos);
+ // dicretionary hyphenation
xRes = new HyphenatedWord( aWord, LocaleToLanguage( aLocale ), nPos,
- aWord.replaceAt(nHyphenationPosAlt + 1, cut[nHyphenationPos], repHyph),
- (INT16) nHyphenationPosAltHyph);
- } else {
+ aWord.replaceAt(nHyphenationPosAlt + 1, cut[nHyphenationPos], repHyph),
+ (INT16) nHyphenationPosAltHyph);
+ }
+ else
+ {
xRes = new HyphenatedWord( aWord, LocaleToLanguage( aLocale ),
- (INT16)nHyphenationPos, aWord, (INT16) nHyphenationPos);
- }
+ (INT16)nHyphenationPos, aWord, (INT16) nHyphenationPos);
+ }
}
- delete[] lcword;
+ delete[] lcword;
delete[] hyphens;
- if (rep) {
- for(int j = 0; j < n; j++) {
- if (rep[j]) free(rep[j]);
- }
- free(rep);
+ if (rep)
+ {
+ for(int j = 0; j < n; j++)
+ {
+ if (rep[j]) free(rep[j]);
}
- if (pos) free(pos);
- if (cut) free(cut);
+ free(rep);
+ }
+ if (pos) free(pos);
+ if (cut) free(cut);
return xRes;
}
- return NULL;
+ return NULL;
}
-Reference < XHyphenatedWord > SAL_CALL
- Hyphenator::queryAlternativeSpelling( const ::rtl::OUString& /*aWord*/,
- const ::com::sun::star::lang::Locale& /*aLocale*/,
- sal_Int16 /*nIndex*/,
- const ::com::sun::star::beans::PropertyValues& /*aProperties*/ )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException)
+Reference < XHyphenatedWord > SAL_CALL Hyphenator::queryAlternativeSpelling(
+ const ::rtl::OUString& /*aWord*/,
+ const ::com::sun::star::lang::Locale& /*aLocale*/,
+ sal_Int16 /*nIndex*/,
+ const ::com::sun::star::beans::PropertyValues& /*aProperties*/ )
+ throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
/* alternative spelling isn't supported by tex dictionaries */
/* XXX: OOo's extended libhjn algorithm can support alternative spellings with extended TeX dic. */
@@ -529,251 +548,262 @@ Reference < XHyphenatedWord > SAL_CALL
return NULL;
}
-Reference< XPossibleHyphens > SAL_CALL
- Hyphenator::createPossibleHyphens( const ::rtl::OUString& aWord,
- const ::com::sun::star::lang::Locale& aLocale,
- const ::com::sun::star::beans::PropertyValues& aProperties )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException)
-
+Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const ::rtl::OUString& aWord,
+ const ::com::sun::star::lang::Locale& aLocale,
+ const ::com::sun::star::beans::PropertyValues& aProperties )
+ throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
- int wordlen;
- char *hyphens;
- char *lcword;
- int k;
+ int wordlen;
+ char *hyphens;
+ char *lcword;
+ int k;
- PropertyHelper_Hyphen & rHelper = GetPropHelper();
- rHelper.SetTmpPropVals(aProperties);
- sal_Int16 minTrail = rHelper.GetMinTrailing();
- sal_Int16 minLead = rHelper.GetMinLeading();
+ PropertyHelper_Hyphen & rHelper = GetPropHelper();
+ rHelper.SetTmpPropVals(aProperties);
+ sal_Int16 minTrail = rHelper.GetMinTrailing();
+ sal_Int16 minLead = rHelper.GetMinLeading();
- HyphenDict *dict = NULL;
- rtl_TextEncoding aEnc = 0;
- CharClass* pCC = NULL;
+ HyphenDict *dict = NULL;
+ rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
+ CharClass* pCC = NULL;
- Reference< XPossibleHyphens > xRes;
+ Reference< XPossibleHyphens > xRes;
- k = -1;
- for (int j = 0; j < numdict; j++)
- if (aLocale == aDicts[j].aLoc) k = j;
+ k = -1;
+ for (int j = 0; j < numdict; j++)
+ {
+ if (aLocale == aDicts[j].aLoc) k = j;
+ }
+ // if we have a hyphenation dictionary matching this locale
+ if (k != -1)
+ {
+ // if this dictioanry has not been loaded yet do that
+ if (!aDicts[k].aPtr)
+ {
+ OUString DictFN = aDicts[k].aName + A2OU(".dic");
+ OUString dictpath;
- // if we have a hyphenation dictionary matching this locale
- if (k != -1) {
+ osl::FileBase::getSystemPathFromFileURL( DictFN, dictpath );
+ OString sTmp( OU2ENC( dictpath, osl_getThreadTextEncoding() ) );
- // if this dictioanry has not been loaded yet do that
- if (!aDicts[k].aPtr) {
+#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.
+ sTmp = Win_GetShortPathName( dictpath );
+#endif
- OUString DictFN = aDicts[k].aName + A2OU(".dic");
- OUString dictpath;
+ if ( ( dict = hnj_hyphen_load ( sTmp.getStr()) ) == NULL )
+ {
+ fprintf(stderr, "Couldn't find file %s and %s\n", sTmp.getStr(), OU2ENC(dictpath, osl_getThreadTextEncoding()) );
+ return NULL;
+ }
+ aDicts[k].aPtr = dict;
+ aDicts[k].eEnc = getTextEncodingFromCharset(dict->cset);
+ }
- osl::FileBase::getSystemPathFromFileURL( DictFN, dictpath );
- OString sTmp( OU2ENC( dictpath, osl_getThreadTextEncoding() ) );
+ // other wise hyphenate the word with that dictionary
+ dict = aDicts[k].aPtr;
+ eEnc = aDicts[k].eEnc;
+ pCC = aDicts[k].apCC;
-#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.
- sTmp = Win_GetShortPathName( dictpath );
-#endif
+ // 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 NULL;
- if ( ( dict = hnj_hyphen_load ( sTmp.getStr()) ) == NULL )
+ // first handle smart quotes both single and double
+ OUStringBuffer rBuf(aWord);
+ sal_Int32 nc = rBuf.getLength();
+ sal_Unicode ch;
+ for (sal_Int32 ix=0; ix < nc; ix++)
{
- fprintf(stderr, "Couldn't find file %s and %s\n", sTmp.getStr(), OU2ENC(dictpath, osl_getThreadTextEncoding()) );
- return NULL;
+ ch = rBuf.charAt(ix);
+ if ((ch == 0x201C) || (ch == 0x201D))
+ rBuf.setCharAt(ix,(sal_Unicode)0x0022);
+ if ((ch == 0x2018) || (ch == 0x2019))
+ rBuf.setCharAt(ix,(sal_Unicode)0x0027);
}
- aDicts[k].aPtr = dict;
- aDicts[k].aEnc = rtl_getTextEncodingFromUnixCharset(dict->cset);
- if (aDicts[k].aEnc == RTL_TEXTENCODING_DONTKNOW) {
- if (strcmp("ISCII-DEVANAGARI", dict->cset) == 0) {
- aDicts[k].aEnc = RTL_TEXTENCODING_ISCII_DEVANAGARI;
- } else if (strcmp("UTF-8", dict->cset) == 0) {
- aDicts[k].aEnc = RTL_TEXTENCODING_UTF8;
+ OUString nWord(rBuf.makeStringAndClear());
+
+ // now convert word to all lowercase for pattern recognition
+ OUString nTerm(makeLowerCase(nWord, pCC));
+
+ // now convert word to needed encoding
+ OString encWord(OU2ENC(nTerm,eEnc));
+
+ wordlen = encWord.getLength();
+ lcword = new char[wordlen+1];
+ hyphens = new char[wordlen+5];
+ char ** rep = NULL; // replacements of discretionary hyphenation
+ int * pos = NULL; // array of [hyphenation point] minus [deletion position]
+ int * cut = NULL; // length of deletions in original word
+
+ // copy converted word into simple char buffer
+ strcpy(lcword,encWord.getStr());
+
+ // first remove any trailing periods
+ int n = wordlen-1;
+ while((n >=0) && (lcword[n] == '.'))
+ n--;
+ n++;
+ // fprintf(stderr,"hyphenate... %s\n",lcword); fflush(stderr);
+ if (n > 0)
+ {
+ const bool bFailed = 0 != hnj_hyphen_hyphenate3(dict, lcword, n, hyphens, NULL,
+ &rep, &pos, &cut, minLead, minTrail,
+ Max(dict->clhmin, Max(dict->clhmin, 2) + Max(0, minLead - Max(dict->lhmin, 2))),
+ Max(dict->crhmin, Max(dict->crhmin, 2) + Max(0, minTrail - Max(dict->rhmin, 2))) );
+ if (bFailed)
+ {
+ delete[] hyphens;
+ delete[] lcword;
+
+ if (rep)
+ {
+ for(int j = 0; j < n; j++)
+ {
+ if (rep[j]) free(rep[j]);
+ }
+ free(rep);
+ }
+ if (pos) free(pos);
+ if (cut) free(cut);
+
+ return NULL;
}
- }
- }
-
- // other wise hyphenate the word with that dictionary
- dict = aDicts[k].aPtr;
- aEnc = aDicts[k].aEnc;
- pCC = aDicts[k].apCC;
-
- // first handle smart quotes both single and double
- OUStringBuffer rBuf(aWord);
- sal_Int32 nc = rBuf.getLength();
- sal_Unicode ch;
- for (sal_Int32 ix=0; ix < nc; ix++) {
- ch = rBuf.charAt(ix);
- if ((ch == 0x201C) || (ch == 0x201D)) rBuf.setCharAt(ix,(sal_Unicode)0x0022);
- if ((ch == 0x2018) || (ch == 0x2019)) rBuf.setCharAt(ix,(sal_Unicode)0x0027);
- }
- OUString nWord(rBuf.makeStringAndClear());
-
- // now convert word to all lowercase for pattern recognition
- OUString nTerm(makeLowerCase(nWord, pCC));
-
- // now convert word to needed encoding
- OString encWord(OU2ENC(nTerm,aEnc));
-
- wordlen = encWord.getLength();
- lcword = new char[wordlen+1];
- hyphens = new char[wordlen+5];
- char ** rep = NULL; // replacements of discretionary hyphenation
- int * pos = NULL; // array of [hyphenation point] minus [deletion position]
- int * cut = NULL; // length of deletions in original word
-
- // copy converted word into simple char buffer
- strcpy(lcword,encWord.getStr());
-
- // first remove any trailing periods
- int n = wordlen-1;
- while((n >=0) && (lcword[n] == '.')) n--;
- n++;
- // fprintf(stderr,"hyphenate... %s\n",lcword); fflush(stderr);
- if (n > 0) {
- if (hnj_hyphen_hyphenate3(dict, lcword, n, hyphens, NULL, &rep, &pos, &cut,
- minLead, minTrail, Max(dict->clhmin, Max(dict->clhmin, 2) + Max(0, minLead - Max(dict->lhmin, 2))),
- Max(dict->crhmin, Max(dict->crhmin, 2) + Max(0, minTrail - Max(dict->rhmin, 2)))))
- {
- delete[] hyphens;
- delete[] lcword;
-
- if (rep) {
- for(int j = 0; j < n; j++) {
- if (rep[j]) free(rep[j]);
- }
- free(rep);
- }
- if (pos) free(pos);
- if (cut) free(cut);
-
- return NULL;
- }
- }
- // now backfill hyphens[] for any removed periods
- for (int c = n; c < wordlen; c++) hyphens[c] = '0';
- hyphens[wordlen] = '\0';
- // fprintf(stderr,"... %s\n",hyphens); fflush(stderr);
-
- INT16 nHyphCount = 0;
- INT16 i;
-
- for ( i = 0; i < encWord.getLength(); i++)
- if (hyphens[i]&1 && (!rep || !rep[i]))
- nHyphCount++;
-
- Sequence< INT16 > aHyphPos(nHyphCount);
- INT16 *pPos = aHyphPos.getArray();
- OUStringBuffer hyphenatedWordBuffer;
- OUString hyphenatedWord;
- nHyphCount = 0;
-
- for (i = 0; i < nWord.getLength(); i++) {
- hyphenatedWordBuffer.append(aWord[i]);
- // hyphenation position (not alternative)
- if (hyphens[i]&1 && (!rep || !rep[i])) {
- pPos[nHyphCount] = i;
- hyphenatedWordBuffer.append(sal_Unicode('='));
- nHyphCount++;
- }
- }
-
- hyphenatedWord = hyphenatedWordBuffer.makeStringAndClear();
- //fprintf(stderr,"result is %s\n",OU2A(hyphenatedWord));
- //fflush(stderr);
-
- xRes = new PossibleHyphens( aWord, LocaleToLanguage( aLocale ),
- hyphenatedWord, aHyphPos );
-
- delete[] hyphens;
- delete[] lcword;
-
- if (rep) {
- for(int j = 0; j < n; j++) {
- if (rep[j]) free(rep[j]);
- }
- free(rep);
- }
- if (pos) free(pos);
- if (cut) free(cut);
-
- return xRes;
- }
+ }
+ // now backfill hyphens[] for any removed periods
+ for (int c = n; c < wordlen; c++)
+ hyphens[c] = '0';
+ hyphens[wordlen] = '\0';
+ // fprintf(stderr,"... %s\n",hyphens); fflush(stderr);
- return NULL;
+ INT16 nHyphCount = 0;
+ INT16 i;
+
+ for ( i = 0; i < encWord.getLength(); i++)
+ {
+ if (hyphens[i]&1 && (!rep || !rep[i]))
+ nHyphCount++;
+ }
+
+ Sequence< INT16 > aHyphPos(nHyphCount);
+ INT16 *pPos = aHyphPos.getArray();
+ OUStringBuffer hyphenatedWordBuffer;
+ OUString hyphenatedWord;
+ nHyphCount = 0;
+
+ for (i = 0; i < nWord.getLength(); i++)
+ {
+ hyphenatedWordBuffer.append(aWord[i]);
+ // hyphenation position (not alternative)
+ if (hyphens[i]&1 && (!rep || !rep[i]))
+ {
+ pPos[nHyphCount] = i;
+ hyphenatedWordBuffer.append(sal_Unicode('='));
+ nHyphCount++;
+ }
+ }
+
+ hyphenatedWord = hyphenatedWordBuffer.makeStringAndClear();
+ //fprintf(stderr,"result is %s\n",OU2A(hyphenatedWord));
+ //fflush(stderr);
+
+ xRes = new PossibleHyphens( aWord, LocaleToLanguage( aLocale ),
+ hyphenatedWord, aHyphPos );
+
+ delete[] hyphens;
+ delete[] lcword;
+
+ if (rep)
+ {
+ for(int j = 0; j < n; j++)
+ {
+ if (rep[j]) free(rep[j]);
+ }
+ free(rep);
+ }
+ if (pos) free(pos);
+ if (cut) free(cut);
+ return xRes;
+ }
+
+ return NULL;
}
sal_uInt16 SAL_CALL Hyphenator::capitalType(const OUString& aTerm, CharClass * pCC)
{
- sal_Int32 tlen = aTerm.getLength();
- if ((pCC) && (tlen)) {
- String aStr(aTerm);
- sal_Int32 nc = 0;
- for (xub_StrLen 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;
+ sal_Int32 tlen = aTerm.getLength();
+ if ((pCC) && (tlen))
+ {
+ String aStr(aTerm);
+ sal_Int32 nc = 0;
+ for (xub_StrLen 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;
+ return (sal_uInt16) CAPTYPE_UNKNOWN;
}
OUString SAL_CALL Hyphenator::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 Hyphenator::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 Hyphenator::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)) );
-
- return pCC->toUpper_rtl(bTemp, 0, 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 aTerm;
+ return aTerm;
}
-
-
Reference< XInterface > SAL_CALL Hyphenator_CreateInstance(
- const Reference< XMultiServiceFactory > & /*rSMgr*/ )
+ const Reference< XMultiServiceFactory > & /*rSMgr*/ )
throw(Exception)
{
-
Reference< XInterface > xService = (cppu::OWeakObject*) new Hyphenator;
return xService;
}
-sal_Bool SAL_CALL
- Hyphenator::addLinguServiceEventListener(
- const Reference< XLinguServiceEventListener >& rxLstnr )
+sal_Bool SAL_CALL Hyphenator::addLinguServiceEventListener(
+ const Reference< XLinguServiceEventListener >& rxLstnr )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -787,9 +817,8 @@ sal_Bool SAL_CALL
}
-sal_Bool SAL_CALL
- Hyphenator::removeLinguServiceEventListener(
- const Reference< XLinguServiceEventListener >& rxLstnr )
+sal_Bool SAL_CALL Hyphenator::removeLinguServiceEventListener(
+ const Reference< XLinguServiceEventListener >& rxLstnr )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -804,8 +833,7 @@ sal_Bool SAL_CALL
}
-OUString SAL_CALL
- Hyphenator::getServiceDisplayName( const Locale& /*rLocale*/ )
+OUString SAL_CALL Hyphenator::getServiceDisplayName( const Locale& /*rLocale*/ )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -813,8 +841,7 @@ OUString SAL_CALL
}
-void SAL_CALL
- Hyphenator::initialize( const Sequence< Any >& rArguments )
+void SAL_CALL Hyphenator::initialize( const Sequence< Any >& rArguments )
throw(Exception, RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -836,16 +863,15 @@ void SAL_CALL
xPropHelper = pPropHelper;
pPropHelper->AddAsPropListener(); //! after a reference is established
}
- else {
+ else
+ {
DBG_ERROR( "wrong number of arguments in sequence" );
}
-
}
}
-void SAL_CALL
- Hyphenator::dispose()
+void SAL_CALL Hyphenator::dispose()
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -859,8 +885,7 @@ void SAL_CALL
}
-void SAL_CALL
- Hyphenator::addEventListener( const Reference< XEventListener >& rxListener )
+void SAL_CALL Hyphenator::addEventListener( const Reference< XEventListener >& rxListener )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -870,8 +895,7 @@ void SAL_CALL
}
-void SAL_CALL
- Hyphenator::removeEventListener( const Reference< XEventListener >& rxListener )
+void SAL_CALL Hyphenator::removeEventListener( const Reference< XEventListener >& rxListener )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -927,32 +951,6 @@ Sequence< OUString > Hyphenator::getSupportedServiceNames_Static()
return aSNS;
}
-
-sal_Bool SAL_CALL Hyphenator_writeInfo(
- void * /*pServiceManager*/, registry::XRegistryKey * pRegistryKey )
-{
-
- try
- {
- String aImpl( '/' );
- aImpl += Hyphenator::getImplementationName_Static().getStr();
- aImpl.AppendAscii( "/UNO/SERVICES" );
- Reference< registry::XRegistryKey > xNewKey =
- pRegistryKey->createKey( aImpl );
- Sequence< OUString > aServices =
- Hyphenator::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 Hyphenator_getFactory( const sal_Char * pImplName,
XMultiServiceFactory * pServiceManager, void * )
{
diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.hxx b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.hxx
index 031217914754..e20b4f58f589 100644
--- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.hxx
+++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.hxx
@@ -65,7 +65,7 @@ struct HDInfo {
HyphenDict * aPtr;
OUString aName;
Locale aLoc;
- rtl_TextEncoding aEnc;
+ rtl_TextEncoding eEnc;
CharClass * apCC;
};
@@ -83,12 +83,12 @@ class Hyphenator :
>
{
Sequence< Locale > aSuppLocales;
- HDInfo * aDicts;
- sal_Int32 numdict;
+ HDInfo * aDicts;
+ sal_Int32 numdict;
::cppu::OInterfaceContainerHelper aEvtListeners;
Reference< XPropertyChangeListener > xPropHelper;
- Reference< XMultiServiceFactory > rSMgr;
+ Reference< XMultiServiceFactory > rSMgr;
linguistic::PropertyHelper_Hyphen * pPropHelper;
BOOL bDisposing;
@@ -108,88 +108,38 @@ public:
virtual ~Hyphenator();
// XSupportedLocales (for XHyphenator)
- virtual Sequence< Locale > SAL_CALL getLocales()
- throw(RuntimeException);
- virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale )
- throw(RuntimeException);
+ virtual Sequence< Locale > SAL_CALL getLocales() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) throw(RuntimeException);
// XHyphenator
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenatedWord > SAL_CALL
- hyphenate( const ::rtl::OUString& aWord,
- const ::com::sun::star::lang::Locale& aLocale,
- sal_Int16 nMaxLeading,
- const ::com::sun::star::beans::PropertyValues& aProperties )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenatedWord > SAL_CALL
- queryAlternativeSpelling( const ::rtl::OUString& aWord,
- const ::com::sun::star::lang::Locale& aLocale,
- sal_Int16 nIndex,
- const ::com::sun::star::beans::PropertyValues& aProperties )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XPossibleHyphens > SAL_CALL
- createPossibleHyphens( const ::rtl::OUString& aWord,
- const ::com::sun::star::lang::Locale& aLocale,
- const ::com::sun::star::beans::PropertyValues& aProperties )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenatedWord > SAL_CALL hyphenate( const ::rtl::OUString& aWord, const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nMaxLeading, const ::com::sun::star::beans::PropertyValues& aProperties ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenatedWord > SAL_CALL queryAlternativeSpelling( const ::rtl::OUString& aWord, const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nIndex, const ::com::sun::star::beans::PropertyValues& aProperties ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XPossibleHyphens > SAL_CALL createPossibleHyphens( const ::rtl::OUString& aWord, const ::com::sun::star::lang::Locale& aLocale, const ::com::sun::star::beans::PropertyValues& aProperties ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
// XLinguServiceEventBroadcaster
- virtual sal_Bool SAL_CALL
- addLinguServiceEventListener(
- const Reference< XLinguServiceEventListener >& rxLstnr )
- throw(RuntimeException);
- virtual sal_Bool SAL_CALL
- removeLinguServiceEventListener(
- const Reference< XLinguServiceEventListener >& rxLstnr )
- throw(RuntimeException);
+ virtual sal_Bool SAL_CALL addLinguServiceEventListener( const Reference< XLinguServiceEventListener >& rxLstnr ) throw(RuntimeException);
+ virtual sal_Bool SAL_CALL removeLinguServiceEventListener( const Reference< XLinguServiceEventListener >& rxLstnr ) throw(RuntimeException);
// XServiceDisplayName
- virtual OUString SAL_CALL
- getServiceDisplayName( const Locale& rLocale )
- throw(RuntimeException);
+ virtual OUString SAL_CALL getServiceDisplayName( const Locale& rLocale ) throw(RuntimeException);
// XInitialization
- virtual void SAL_CALL
- initialize( const Sequence< Any >& rArguments )
- throw(Exception, RuntimeException);
+ virtual void SAL_CALL initialize( const Sequence< Any >& rArguments ) throw(Exception, RuntimeException);
// XComponent
- virtual void SAL_CALL
- dispose()
- throw(RuntimeException);
- virtual void SAL_CALL
- addEventListener( const Reference< XEventListener >& rxListener )
- throw(RuntimeException);
- virtual void SAL_CALL
- removeEventListener( const Reference< XEventListener >& rxListener )
- throw(RuntimeException);
-
- ////////////////////////////////////////////////////////////
- // Service specific part
- //
+ virtual void SAL_CALL dispose() throw(RuntimeException);
+ virtual void SAL_CALL addEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
+ virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
// XServiceInfo
- virtual OUString SAL_CALL
- getImplementationName()
- throw(RuntimeException);
- virtual sal_Bool SAL_CALL
- supportsService( const OUString& rServiceName )
- throw(RuntimeException);
- virtual Sequence< OUString > SAL_CALL
- getSupportedServiceNames()
- throw(RuntimeException);
-
-
- static inline OUString
- getImplementationName_Static() throw();
- static Sequence< OUString >
- getSupportedServiceNames_Static() throw();
+ virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw(RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
+ static inline OUString getImplementationName_Static() throw();
+ static Sequence< OUString > getSupportedServiceNames_Static() throw();
+
private:
sal_uInt16 SAL_CALL capitalType(const OUString&, CharClass *);
diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/makefile.mk b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/makefile.mk
index f3626c70312b..6f767d8bfa9e 100644
--- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/makefile.mk
+++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/makefile.mk
@@ -91,3 +91,11 @@ DEF1EXPORTFILE= exports.dxp
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/hyphen.component
+
+$(MISC)/hyphen.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ hyphen.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt hyphen.component
diff --git a/lingucomponent/source/languageguessing/guesslang.component b/lingucomponent/source/languageguessing/guesslang.component
new file mode 100644
index 000000000000..633a489c38fa
--- /dev/null
+++ b/lingucomponent/source/languageguessing/guesslang.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.lingu2.LanguageGuessing">
+ <service name="com.sun.star.linguistic2.LanguageGuessing"/>
+ </implementation>
+</component>
diff --git a/lingucomponent/source/languageguessing/guesslang.cxx b/lingucomponent/source/languageguessing/guesslang.cxx
index c8486c1bc471..baac0fd7e856 100644
--- a/lingucomponent/source/languageguessing/guesslang.cxx
+++ b/lingucomponent/source/languageguessing/guesslang.cxx
@@ -465,13 +465,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
-sal_Bool SAL_CALL component_writeInfo(
- XMultiServiceFactory * xMgr, registry::XRegistryKey * xRegistry )
-{
- return ::cppu::component_writeInfoHelper(
- xMgr, xRegistry, s_component_entries );
-}
-
void * SAL_CALL component_getFactory(
sal_Char const * implName, lang::XMultiServiceFactory * xMgr,
registry::XRegistryKey * xRegistry )
diff --git a/lingucomponent/source/languageguessing/makefile.mk b/lingucomponent/source/languageguessing/makefile.mk
index ebad4076b3ed..624ccba3c334 100644
--- a/lingucomponent/source/languageguessing/makefile.mk
+++ b/lingucomponent/source/languageguessing/makefile.mk
@@ -78,3 +78,11 @@ DEF1NAME =$(SHL1TARGET)
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/guesslang.component
+
+$(MISC)/guesslang.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ guesslang.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt guesslang.component
diff --git a/lingucomponent/source/lingutil/lingutil.cxx b/lingucomponent/source/lingutil/lingutil.cxx
index ee7d71de4435..14253fca5cd3 100644
--- a/lingucomponent/source/lingutil/lingutil.cxx
+++ b/lingucomponent/source/lingutil/lingutil.cxx
@@ -50,6 +50,7 @@
#include <unotools/pathoptions.hxx>
#include <rtl/ustring.hxx>
#include <rtl/string.hxx>
+#include <rtl/tencinfo.h>
#include <linguistic/misc.hxx>
#include <set>
@@ -268,5 +269,25 @@ void MergeNewStyleDicsAndOldStyleDics(
}
}
+
+rtl_TextEncoding getTextEncodingFromCharset(const sal_Char* pCharset)
+{
+ // default result: used to indicate that we failed to get the proper encoding
+ rtl_TextEncoding eRet = RTL_TEXTENCODING_DONTKNOW;
+
+ if (pCharset)
+ {
+ eRet = rtl_getTextEncodingFromMimeCharset(pCharset);
+ if (eRet == RTL_TEXTENCODING_DONTKNOW)
+ eRet = rtl_getTextEncodingFromUnixCharset(pCharset);
+ if (eRet == RTL_TEXTENCODING_DONTKNOW)
+ {
+ if (strcmp("ISCII-DEVANAGARI", pCharset) == 0)
+ eRet = RTL_TEXTENCODING_ISCII_DEVANAGARI;
+ }
+ }
+ return eRet;
+}
+
//////////////////////////////////////////////////////////////////////
diff --git a/lingucomponent/source/lingutil/lingutil.hxx b/lingucomponent/source/lingutil/lingutil.hxx
index 8b45b1f509ad..82d2e646edfc 100644
--- a/lingucomponent/source/lingutil/lingutil.hxx
+++ b/lingucomponent/source/lingutil/lingutil.hxx
@@ -101,5 +101,13 @@ void MergeNewStyleDicsAndOldStyleDics( std::list< SvtLinguConfigDictionaryEntry
///////////////////////////////////////////////////////////////////////////
+
+//Find an encoding from a charset string, using
+//rtl_getTextEncodingFromMimeCharset and falling back to
+//rtl_getTextEncodingFromUnixCharset with the addition of
+//ISCII-DEVANAGARI. On failure will return final fallback of
+//RTL_TEXTENCODING_ISO_8859_1
+rtl_TextEncoding getTextEncodingFromCharset(const sal_Char* pCharset);
+
#endif
diff --git a/lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component b/lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component
new file mode 100644
index 000000000000..2f2f9e102087
--- /dev/null
+++ b/lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="org.openoffice.lingu.MacOSXSpellChecker">
+ <service name="com.sun.star.linguistic2.SpellChecker"/>
+ </implementation>
+</component>
diff --git a/lingucomponent/source/spellcheck/macosxspell/macreg.cxx b/lingucomponent/source/spellcheck/macosxspell/macreg.cxx
index b60ffffe42e9..9df90f79cca7 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macreg.cxx
+++ b/lingucomponent/source/spellcheck/macosxspell/macreg.cxx
@@ -42,9 +42,6 @@ using namespace com::sun::star::registry;
// declaration of external RegEntry-functions defined by the service objects
//
-extern sal_Bool SAL_CALL MacSpellChecker_writeInfo(
- void * /*pServiceManager*/, XRegistryKey * pRegistryKey );
-
extern void * SAL_CALL MacSpellChecker_getFactory(
const sal_Char * pImplName,
XMultiServiceFactory * pServiceManager,
@@ -57,12 +54,6 @@ extern void * SAL_CALL MacSpellChecker_getFactory(
extern "C"
{
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, XRegistryKey * pRegistryKey )
-{
- return MacSpellChecker_writeInfo( pServiceManager, pRegistryKey );
-}
-
void SAL_CALL component_getImplementationEnvironment(
const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
{
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.cxx b/lingucomponent/source/spellcheck/macosxspell/macspellimp.cxx
index 70996793c186..002f1dec0b36 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.cxx
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.cxx
@@ -644,32 +644,6 @@ Sequence< OUString > MacSpellChecker::getSupportedServiceNames_Static()
return aSNS;
}
-
-sal_Bool SAL_CALL MacSpellChecker_writeInfo(
- void * /*pServiceManager*/, registry::XRegistryKey * pRegistryKey )
-{
-
- try
- {
- String aImpl( '/' );
- aImpl += MacSpellChecker::getImplementationName_Static().getStr();
- aImpl.AppendAscii( "/UNO/SERVICES" );
- Reference< registry::XRegistryKey > xNewKey =
- pRegistryKey->createKey( aImpl );
- Sequence< OUString > aServices =
- MacSpellChecker::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 MacSpellChecker_getFactory( const sal_Char * pImplName,
XMultiServiceFactory * pServiceManager, void * )
{
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
index b3cfce92fd8b..fc1906e18025 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
@@ -75,14 +75,14 @@ class MacSpellChecker :
XServiceDisplayName
>
{
- Sequence< Locale > aSuppLocales;
+ Sequence< Locale > aSuppLocales;
// Hunspell ** aDicts;
- rtl_TextEncoding * aDEncs;
- Locale * aDLocs;
- OUString * aDNames;
- sal_Int32 numdict;
- NSSpellChecker * macSpell;
- int macTag; //unique tag for this doc
+ rtl_TextEncoding * aDEncs;
+ Locale * aDLocs;
+ OUString * aDNames;
+ sal_Int32 numdict;
+ NSSpellChecker * macSpell;
+ int macTag; //unique tag for this doc
::cppu::OInterfaceContainerHelper aEvtListeners;
Reference< XPropertyChangeListener > xPropHelper;
@@ -100,84 +100,43 @@ class MacSpellChecker :
}
INT16 GetSpellFailure( const OUString &rWord, const Locale &rLocale );
- Reference< XSpellAlternatives >
- GetProposals( const OUString &rWord, const Locale &rLocale );
+ Reference< XSpellAlternatives > GetProposals( const OUString &rWord, const Locale &rLocale );
public:
MacSpellChecker();
virtual ~MacSpellChecker();
// XSupportedLocales (for XSpellChecker)
- virtual Sequence< Locale > SAL_CALL
- getLocales()
- throw(RuntimeException);
- virtual sal_Bool SAL_CALL
- hasLocale( const Locale& rLocale )
- throw(RuntimeException);
+ virtual Sequence< Locale > SAL_CALL getLocales() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) throw(RuntimeException);
// XSpellChecker
- virtual sal_Bool SAL_CALL
- isValid( const OUString& rWord, const Locale& rLocale,
- const PropertyValues& rProperties )
- throw(IllegalArgumentException,
- RuntimeException);
- virtual Reference< XSpellAlternatives > SAL_CALL
- spell( const OUString& rWord, const Locale& rLocale,
- const PropertyValues& rProperties )
- throw(IllegalArgumentException,
- RuntimeException);
+ virtual sal_Bool SAL_CALL isValid( const OUString& rWord, const Locale& rLocale, const PropertyValues& rProperties ) throw(IllegalArgumentException, RuntimeException);
+ virtual Reference< XSpellAlternatives > SAL_CALL spell( const OUString& rWord, const Locale& rLocale, const PropertyValues& rProperties ) throw(IllegalArgumentException, RuntimeException);
// XLinguServiceEventBroadcaster
- virtual sal_Bool SAL_CALL
- addLinguServiceEventListener(
- const Reference< XLinguServiceEventListener >& rxLstnr )
- throw(RuntimeException);
- virtual sal_Bool SAL_CALL
- removeLinguServiceEventListener(
- const Reference< XLinguServiceEventListener >& rxLstnr )
- throw(RuntimeException);
+ virtual sal_Bool SAL_CALL addLinguServiceEventListener( const Reference< XLinguServiceEventListener >& rxLstnr ) throw(RuntimeException);
+ virtual sal_Bool SAL_CALL removeLinguServiceEventListener( const Reference< XLinguServiceEventListener >& rxLstnr ) throw(RuntimeException);
// XServiceDisplayName
- virtual OUString SAL_CALL
- getServiceDisplayName( const Locale& rLocale )
- throw(RuntimeException);
+ virtual OUString SAL_CALL getServiceDisplayName( const Locale& rLocale ) throw(RuntimeException);
// XInitialization
- virtual void SAL_CALL
- initialize( const Sequence< Any >& rArguments )
- throw(Exception, RuntimeException);
+ virtual void SAL_CALL initialize( const Sequence< Any >& rArguments ) throw(Exception, RuntimeException);
// XComponent
- virtual void SAL_CALL
- dispose()
- throw(RuntimeException);
- virtual void SAL_CALL
- addEventListener( const Reference< XEventListener >& rxListener )
- throw(RuntimeException);
- virtual void SAL_CALL
- removeEventListener( const Reference< XEventListener >& rxListener )
- throw(RuntimeException);
-
- ////////////////////////////////////////////////////////////
- // Service specific part
- //
+ virtual void SAL_CALL dispose() throw(RuntimeException);
+ virtual void SAL_CALL addEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
+ virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
// XServiceInfo
- virtual OUString SAL_CALL
- getImplementationName()
- throw(RuntimeException);
- virtual sal_Bool SAL_CALL
- supportsService( const OUString& rServiceName )
- throw(RuntimeException);
- virtual Sequence< OUString > SAL_CALL
- getSupportedServiceNames()
- throw(RuntimeException);
-
-
- static inline OUString
- getImplementationName_Static() throw();
- static Sequence< OUString >
- getSupportedServiceNames_Static() throw();
+ virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw(RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
+
+
+ static inline OUString getImplementationName_Static() throw();
+ static Sequence< OUString > getSupportedServiceNames_Static() throw();
};
inline OUString MacSpellChecker::getImplementationName_Static() throw()
diff --git a/lingucomponent/source/spellcheck/macosxspell/makefile.mk b/lingucomponent/source/spellcheck/macosxspell/makefile.mk
index 6414560e0f4a..4e88b808ddc0 100644
--- a/lingucomponent/source/spellcheck/macosxspell/makefile.mk
+++ b/lingucomponent/source/spellcheck/macosxspell/makefile.mk
@@ -91,3 +91,11 @@ SHL1VERSIONMAP=$(SOLARENV)/src/component.map
dummy:
@echo " Nothing to build for GUIBASE=$(GUIBASE)"
.ENDIF
+
+ALLTAR : $(MISC)/MacOSXSpell.component
+
+$(MISC)/MacOSXSpell.component .ERRREMOVE : \
+ $(SOLARENV)/bin/createcomponent.xslt MacOSXSpell.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt MacOSXSpell.component
diff --git a/lingucomponent/source/spellcheck/spell/exports.dxp b/lingucomponent/source/spellcheck/spell/exports.dxp
index b0f85bf7bebf..a9861e3ffc0c 100644
--- a/lingucomponent/source/spellcheck/spell/exports.dxp
+++ b/lingucomponent/source/spellcheck/spell/exports.dxp
@@ -1,3 +1,2 @@
component_getFactory
component_getImplementationEnvironment
-component_writeInfo
diff --git a/lingucomponent/source/spellcheck/spell/makefile.mk b/lingucomponent/source/spellcheck/spell/makefile.mk
index 4173d4dbae22..56dd79939b40 100644
--- a/lingucomponent/source/spellcheck/spell/makefile.mk
+++ b/lingucomponent/source/spellcheck/spell/makefile.mk
@@ -85,3 +85,11 @@ DEF1EXPORTFILE= exports.dxp
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/spell.component
+
+$(MISC)/spell.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ spell.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt spell.component
diff --git a/lingucomponent/source/spellcheck/spell/spell.component b/lingucomponent/source/spellcheck/spell/spell.component
new file mode 100644
index 000000000000..9f951a8a8f76
--- /dev/null
+++ b/lingucomponent/source/spellcheck/spell/spell.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="org.openoffice.lingu.MySpellSpellChecker">
+ <service name="com.sun.star.linguistic2.SpellChecker"/>
+ </implementation>
+</component>
diff --git a/lingucomponent/source/spellcheck/spell/sreg.cxx b/lingucomponent/source/spellcheck/spell/sreg.cxx
index bd97403c89d6..4c6375698de6 100644
--- a/lingucomponent/source/spellcheck/spell/sreg.cxx
+++ b/lingucomponent/source/spellcheck/spell/sreg.cxx
@@ -42,9 +42,6 @@ using namespace com::sun::star::registry;
// declaration of external RegEntry-functions defined by the service objects
//
-extern sal_Bool SAL_CALL SpellChecker_writeInfo(
- void * /*pServiceManager*/, XRegistryKey * pRegistryKey );
-
extern void * SAL_CALL SpellChecker_getFactory(
const sal_Char * pImplName,
XMultiServiceFactory * pServiceManager,
@@ -56,12 +53,6 @@ extern void * SAL_CALL SpellChecker_getFactory(
extern "C"
{
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, XRegistryKey * pRegistryKey )
-{
- return SpellChecker_writeInfo( pServiceManager, pRegistryKey );
-}
-
void SAL_CALL component_getImplementationEnvironment(
const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
{
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 8486f4fb38fd..577d105afcde 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -27,6 +27,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_lingucomponent.hxx"
+
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
@@ -37,12 +38,10 @@
#include <unotools/processfactory.hxx>
#include <osl/mutex.hxx>
+#include <lingutil.hxx>
#include <hunspell.hxx>
#include <dictmgr.hxx>
-
-#ifndef _SPELLIMP_HXX
#include <sspellimp.hxx>
-#endif
#include <linguistic/lngprops.hxx>
#include <linguistic/spelldta.hxx>
@@ -52,8 +51,7 @@
#include <unotools/useroptions.hxx>
#include <osl/file.hxx>
#include <rtl/ustrbuf.hxx>
-
-#include <lingutil.hxx>
+#include <rtl/textenc.h>
#include <list>
#include <set>
@@ -77,35 +75,37 @@ using namespace linguistic;
SpellChecker::SpellChecker() :
aEvtListeners ( GetLinguMutex() )
{
- aDicts = NULL;
+ aDicts = NULL;
aDEncs = NULL;
aDLocs = NULL;
aDNames = NULL;
bDisposing = FALSE;
pPropHelper = NULL;
- numdict = 0;
+ numdict = 0;
}
SpellChecker::~SpellChecker()
{
- if (aDicts) {
- for (int i = 0; i < numdict; i++) {
+ if (aDicts)
+ {
+ for (int i = 0; i < numdict; i++)
+ {
if (aDicts[i]) delete aDicts[i];
aDicts[i] = NULL;
- }
- delete[] aDicts;
- }
- aDicts = NULL;
- numdict = 0;
- if (aDEncs) delete[] aDEncs;
- aDEncs = NULL;
- if (aDLocs) delete[] aDLocs;
- aDLocs = NULL;
- if (aDNames) delete[] aDNames;
- aDNames = NULL;
- if (pPropHelper)
- pPropHelper->RemoveAsPropListener();
+ }
+ delete[] aDicts;
+ }
+ aDicts = NULL;
+ numdict = 0;
+ if (aDEncs) delete[] aDEncs;
+ aDEncs = NULL;
+ if (aDLocs) delete[] aDLocs;
+ aDLocs = NULL;
+ if (aDNames) delete[] aDNames;
+ aDNames = NULL;
+ if (pPropHelper)
+ pPropHelper->RemoveAsPropListener();
}
@@ -217,7 +217,7 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
for (sal_Int32 i = 0; i < nLocales; ++i)
{
aDicts[k] = NULL;
- aDEncs[k] = 0;
+ aDEncs[k] = RTL_TEXTENCODING_DONTKNOW;
aDLocs[k] = MsLangId::convertLanguageToLocale(
MsLangId::convertIsoStringToLanguage( aLocaleNames[i] ));
// also both files have to be in the same directory and the
@@ -272,84 +272,86 @@ sal_Bool SAL_CALL SpellChecker::hasLocale(const Locale& rLocale)
return bRes;
}
+
INT16 SpellChecker::GetSpellFailure( const OUString &rWord, const Locale &rLocale )
{
- Hunspell * pMS;
- rtl_TextEncoding aEnc;
+ Hunspell * pMS = NULL;
+ rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
// initialize a myspell object for each dictionary once
- // (note: mutex is held higher up in isValid)
-
+ // (note: mutex is held higher up in isValid)
INT16 nRes = -1;
- // first handle smart quotes both single and double
+ // first handle smart quotes both single and double
OUStringBuffer rBuf(rWord);
- sal_Int32 n = rBuf.getLength();
- sal_Unicode c;
- for (sal_Int32 ix=0; ix < n; ix++) {
+ sal_Int32 n = rBuf.getLength();
+ sal_Unicode c;
+ for (sal_Int32 ix=0; ix < n; ix++)
+ {
c = rBuf.charAt(ix);
- if ((c == 0x201C) || (c == 0x201D)) rBuf.setCharAt(ix,(sal_Unicode)0x0022);
- if ((c == 0x2018) || (c == 0x2019)) rBuf.setCharAt(ix,(sal_Unicode)0x0027);
- }
- OUString nWord(rBuf.makeStringAndClear());
+ if ((c == 0x201C) || (c == 0x201D))
+ rBuf.setCharAt(ix,(sal_Unicode)0x0022);
+ if ((c == 0x2018) || (c == 0x2019))
+ rBuf.setCharAt(ix,(sal_Unicode)0x0027);
+ }
+ OUString nWord(rBuf.makeStringAndClear());
if (n)
{
- for (sal_Int32 i = 0; i < numdict; ++i) {
+ for (sal_Int32 i = 0; i < numdict; ++i)
+ {
pMS = NULL;
- aEnc = 0;
+ eEnc = RTL_TEXTENCODING_DONTKNOW;
if (rLocale == aDLocs[i])
{
- if (!aDicts[i])
- {
- OUString dicpath = aDNames[i] + A2OU(".dic");
- OUString affpath = aDNames[i] + A2OU(".aff");
- OUString dict;
- OUString aff;
- osl::FileBase::getSystemPathFromFileURL(dicpath,dict);
- osl::FileBase::getSystemPathFromFileURL(affpath,aff);
- OString aTmpaff(OU2ENC(aff,osl_getThreadTextEncoding()));
- OString aTmpdict(OU2ENC(dict,osl_getThreadTextEncoding()));
+ if (!aDicts[i])
+ {
+ OUString dicpath = aDNames[i] + A2OU(".dic");
+ OUString affpath = aDNames[i] + A2OU(".aff");
+ OUString dict;
+ OUString aff;
+ osl::FileBase::getSystemPathFromFileURL(dicpath,dict);
+ osl::FileBase::getSystemPathFromFileURL(affpath,aff);
+ OString aTmpaff(OU2ENC(aff,osl_getThreadTextEncoding()));
+ OString aTmpdict(OU2ENC(dict,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.
- aTmpaff = Win_GetShortPathName( aff );
- aTmpdict = Win_GetShortPathName( dict );
+ // 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.
+ aTmpaff = Win_GetShortPathName( aff );
+ aTmpdict = Win_GetShortPathName( dict );
#endif
- aDicts[i] = new Hunspell(aTmpaff.getStr(),aTmpdict.getStr());
- aDEncs[i] = 0;
- if (aDicts[i]) {
- char * dic_encoding = aDicts[i]->get_dic_encoding();
- aDEncs[i] = rtl_getTextEncodingFromUnixCharset(aDicts[i]->get_dic_encoding());
- if (aDEncs[i] == RTL_TEXTENCODING_DONTKNOW) {
- if (strcmp("ISCII-DEVANAGARI", dic_encoding) == 0) {
- aDEncs[i] = RTL_TEXTENCODING_ISCII_DEVANAGARI;
- } else if (strcmp("UTF-8", dic_encoding) == 0) {
- aDEncs[i] = RTL_TEXTENCODING_UTF8;
- }
- }
- }
- }
- pMS = aDicts[i];
- aEnc = aDEncs[i];
- }
+ aDicts[i] = new Hunspell(aTmpaff.getStr(),aTmpdict.getStr());
+ aDEncs[i] = RTL_TEXTENCODING_DONTKNOW;
+ if (aDicts[i])
+ aDEncs[i] = getTextEncodingFromCharset(aDicts[i]->get_dic_encoding());
+ }
+ pMS = aDicts[i];
+ eEnc = aDEncs[i];
+ }
+
if (pMS)
- {
- OString aWrd(OU2ENC(nWord,aEnc));
+ {
+ // 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 -1;
+
+ OString aWrd(OU2ENC(nWord,eEnc));
int rVal = pMS->spell((char*)aWrd.getStr());
- if (rVal != 1)
- {
- nRes = SpellFailure::SPELLING_ERROR;
- } else {
- return -1;
- }
- pMS = NULL;
+ if (rVal != 1)
+ nRes = SpellFailure::SPELLING_ERROR;
+ else
+ return -1;
+ pMS = NULL;
}
}
}
@@ -358,8 +360,7 @@ INT16 SpellChecker::GetSpellFailure( const OUString &rWord, const Locale &rLocal
}
-sal_Bool SAL_CALL
- SpellChecker::isValid( const OUString& rWord, const Locale& rLocale,
+sal_Bool SAL_CALL SpellChecker::isValid( const OUString& rWord, const Locale& rLocale,
const PropertyValues& rProperties )
throw(IllegalArgumentException, RuntimeException)
{
@@ -375,6 +376,9 @@ sal_Bool SAL_CALL
return TRUE;
#endif
+ // return FALSE to process SPELLML requests (they are longer than the header)
+ if (rWord.match(A2OU(SPELLML_HEADER), 0) && (rWord.getLength() > 10)) return FALSE;
+
// Get property values to be used.
// These are be the default values set in the SN_LINGU_PROPERTIES
// PropertySet which are overridden by the supplied ones from the
@@ -390,11 +394,11 @@ sal_Bool SAL_CALL
{
INT16 nLang = LocaleToLanguage( rLocale );
// postprocess result for errors that should be ignored
- if ( (!rHelper.IsSpellUpperCase() && IsUpper( rWord, nLang ))
- || (!rHelper.IsSpellWithDigits() && HasDigits( rWord ))
- || (!rHelper.IsSpellCapitalization()
- && nFailure == SpellFailure::CAPTION_ERROR)
- )
+ const bool bIgnoreError =
+ (!rHelper.IsSpellUpperCase() && IsUpper( rWord, nLang )) ||
+ (!rHelper.IsSpellWithDigits() && HasDigits( rWord )) ||
+ (!rHelper.IsSpellCapitalization() && nFailure == SpellFailure::CAPTION_ERROR);
+ if (bIgnoreError)
nFailure = -1;
}
@@ -410,23 +414,26 @@ Reference< XSpellAlternatives >
// Especially it may give a list of suggested (correct) words:
Reference< XSpellAlternatives > xRes;
- // note: mutex is held by higher up by spell which covers both
+ // note: mutex is held by higher up by spell which covers both
- Hunspell* pMS;
- rtl_TextEncoding aEnc;
- int count;
- int numsug = 0;
+ Hunspell* pMS = NULL;
+ rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
+ int count = 0;
+ int numsug = 0;
- // first handle smart quotes (single and double)
+ // first handle smart quotes (single and double)
OUStringBuffer rBuf(rWord);
- sal_Int32 n = rBuf.getLength();
- sal_Unicode c;
- for (sal_Int32 ix=0; ix < n; ix++) {
- c = rBuf.charAt(ix);
- if ((c == 0x201C) || (c == 0x201D)) rBuf.setCharAt(ix,(sal_Unicode)0x0022);
- if ((c == 0x2018) || (c == 0x2019)) rBuf.setCharAt(ix,(sal_Unicode)0x0027);
- }
- OUString nWord(rBuf.makeStringAndClear());
+ sal_Int32 n = rBuf.getLength();
+ sal_Unicode c;
+ for (sal_Int32 ix=0; ix < n; ix++)
+ {
+ c = rBuf.charAt(ix);
+ if ((c == 0x201C) || (c == 0x201D))
+ rBuf.setCharAt(ix,(sal_Unicode)0x0022);
+ if ((c == 0x2018) || (c == 0x2019))
+ rBuf.setCharAt(ix,(sal_Unicode)0x0027);
+ }
+ OUString nWord(rBuf.makeStringAndClear());
if (n)
{
@@ -434,59 +441,55 @@ Reference< XSpellAlternatives >
Sequence< OUString > aStr( 0 );
- for (int i =0; i < numdict; i++) {
+ for (int i =0; i < numdict; i++)
+ {
pMS = NULL;
- aEnc = 0;
- count = 0;
+ eEnc = RTL_TEXTENCODING_DONTKNOW;
+ count = 0;
if (rLocale == aDLocs[i])
{
- pMS = aDicts[i];
- aEnc = aDEncs[i];
- }
+ pMS = aDicts[i];
+ eEnc = aDEncs[i];
+ }
if (pMS)
{
char ** suglst = NULL;
- OString aWrd(OU2ENC(nWord,aEnc));
- count = pMS->suggest(&suglst, (const char *) aWrd.getStr());
-
- if (count) {
-
- aStr.realloc( numsug + count );
- OUString *pStr = aStr.getArray();
- for (int ii=0; ii < count; ii++)
- {
- // if needed add: if (suglst[ii] == NULL) continue;
- OUString cvtwrd(suglst[ii],strlen(suglst[ii]),aEnc);
- pStr[numsug + ii] = cvtwrd;
- free(suglst[ii]);
- }
- free(suglst);
- numsug += count;
+ OString aWrd(OU2ENC(nWord,eEnc));
+ count = pMS->suggest(&suglst, (const char *) aWrd.getStr());
+
+ if (count)
+ {
+ aStr.realloc( numsug + count );
+ OUString *pStr = aStr.getArray();
+ for (int ii=0; ii < count; ++ii)
+ {
+ OUString cvtwrd(suglst[ii],strlen(suglst[ii]),eEnc);
+ pStr[numsug + ii] = cvtwrd;
}
- }
+ pMS->free_list(&suglst, count);
+ numsug += count;
+ }
+ }
}
- // now return an empty alternative for no suggestions or the list of alternatives if some found
+ // now return an empty alternative for no suggestions or the list of alternatives if some found
SpellAlternatives *pAlt = new SpellAlternatives;
- String aTmp(rWord);
+ String aTmp(rWord);
pAlt->SetWordLanguage( aTmp, nLang );
pAlt->SetFailureType( SpellFailure::SPELLING_ERROR );
pAlt->SetAlternatives( aStr );
xRes = pAlt;
- return xRes;
-
- }
return xRes;
+ }
+ return xRes;
}
-
-
-Reference< XSpellAlternatives > SAL_CALL
- SpellChecker::spell( const OUString& rWord, const Locale& rLocale,
- const PropertyValues& rProperties )
+Reference< XSpellAlternatives > SAL_CALL SpellChecker::spell(
+ const OUString& rWord, const Locale& rLocale,
+ const PropertyValues& rProperties )
throw(IllegalArgumentException, RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -511,7 +514,7 @@ Reference< XSpellAlternatives > SAL_CALL
Reference< XInterface > SAL_CALL SpellChecker_CreateInstance(
- const Reference< XMultiServiceFactory > & /*rSMgr*/ )
+ const Reference< XMultiServiceFactory > & /*rSMgr*/ )
throw(Exception)
{
@@ -520,9 +523,8 @@ Reference< XInterface > SAL_CALL SpellChecker_CreateInstance(
}
-sal_Bool SAL_CALL
- SpellChecker::addLinguServiceEventListener(
- const Reference< XLinguServiceEventListener >& rxLstnr )
+sal_Bool SAL_CALL SpellChecker::addLinguServiceEventListener(
+ const Reference< XLinguServiceEventListener >& rxLstnr )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -536,9 +538,8 @@ sal_Bool SAL_CALL
}
-sal_Bool SAL_CALL
- SpellChecker::removeLinguServiceEventListener(
- const Reference< XLinguServiceEventListener >& rxLstnr )
+sal_Bool SAL_CALL SpellChecker::removeLinguServiceEventListener(
+ const Reference< XLinguServiceEventListener >& rxLstnr )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -553,8 +554,7 @@ sal_Bool SAL_CALL
}
-OUString SAL_CALL
- SpellChecker::getServiceDisplayName( const Locale& /*rLocale*/ )
+OUString SAL_CALL SpellChecker::getServiceDisplayName( const Locale& /*rLocale*/ )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -562,8 +562,7 @@ OUString SAL_CALL
}
-void SAL_CALL
- SpellChecker::initialize( const Sequence< Any >& rArguments )
+void SAL_CALL SpellChecker::initialize( const Sequence< Any >& rArguments )
throw(Exception, RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -585,16 +584,15 @@ void SAL_CALL
xPropHelper = pPropHelper;
pPropHelper->AddAsPropListener(); //! after a reference is established
}
- else {
+ else
+ {
DBG_ERROR( "wrong number of arguments in sequence" );
}
-
}
}
-void SAL_CALL
- SpellChecker::dispose()
+void SAL_CALL SpellChecker::dispose()
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -608,8 +606,7 @@ void SAL_CALL
}
-void SAL_CALL
- SpellChecker::addEventListener( const Reference< XEventListener >& rxListener )
+void SAL_CALL SpellChecker::addEventListener( const Reference< XEventListener >& rxListener )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -619,8 +616,7 @@ void SAL_CALL
}
-void SAL_CALL
- SpellChecker::removeEventListener( const Reference< XEventListener >& rxListener )
+void SAL_CALL SpellChecker::removeEventListener( const Reference< XEventListener >& rxListener )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -676,32 +672,6 @@ Sequence< OUString > SpellChecker::getSupportedServiceNames_Static()
return aSNS;
}
-
-sal_Bool SAL_CALL SpellChecker_writeInfo(
- void * /*pServiceManager*/, registry::XRegistryKey * pRegistryKey )
-{
-
- try
- {
- String aImpl( '/' );
- aImpl += SpellChecker::getImplementationName_Static().getStr();
- aImpl.AppendAscii( "/UNO/SERVICES" );
- Reference< registry::XRegistryKey > xNewKey =
- pRegistryKey->createKey( aImpl );
- Sequence< OUString > aServices =
- SpellChecker::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 SpellChecker_getFactory( const sal_Char * pImplName,
XMultiServiceFactory * pServiceManager, void * )
{
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.hxx b/lingucomponent/source/spellcheck/spell/sspellimp.hxx
index 94c57fa8b742..9bcbdec5250b 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.hxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.hxx
@@ -69,11 +69,11 @@ class SpellChecker :
>
{
Sequence< Locale > aSuppLocales;
- Hunspell ** aDicts;
- rtl_TextEncoding * aDEncs;
- Locale * aDLocs;
- OUString * aDNames;
- sal_Int32 numdict;
+ Hunspell ** aDicts;
+ rtl_TextEncoding * aDEncs;
+ Locale * aDLocs;
+ OUString * aDNames;
+ sal_Int32 numdict;
::cppu::OInterfaceContainerHelper aEvtListeners;
Reference< XPropertyChangeListener > xPropHelper;
@@ -91,84 +91,43 @@ class SpellChecker :
}
INT16 GetSpellFailure( const OUString &rWord, const Locale &rLocale );
- Reference< XSpellAlternatives >
- GetProposals( const OUString &rWord, const Locale &rLocale );
+ Reference< XSpellAlternatives > GetProposals( const OUString &rWord, const Locale &rLocale );
public:
SpellChecker();
virtual ~SpellChecker();
// XSupportedLocales (for XSpellChecker)
- virtual Sequence< Locale > SAL_CALL
- getLocales()
- throw(RuntimeException);
- virtual sal_Bool SAL_CALL
- hasLocale( const Locale& rLocale )
- throw(RuntimeException);
+ virtual Sequence< Locale > SAL_CALL getLocales() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) throw(RuntimeException);
// XSpellChecker
- virtual sal_Bool SAL_CALL
- isValid( const OUString& rWord, const Locale& rLocale,
- const PropertyValues& rProperties )
- throw(IllegalArgumentException,
- RuntimeException);
- virtual Reference< XSpellAlternatives > SAL_CALL
- spell( const OUString& rWord, const Locale& rLocale,
- const PropertyValues& rProperties )
- throw(IllegalArgumentException,
- RuntimeException);
+ virtual sal_Bool SAL_CALL isValid( const OUString& rWord, const Locale& rLocale, const PropertyValues& rProperties ) throw(IllegalArgumentException, RuntimeException);
+ virtual Reference< XSpellAlternatives > SAL_CALL spell( const OUString& rWord, const Locale& rLocale, const PropertyValues& rProperties ) throw(IllegalArgumentException, RuntimeException);
// XLinguServiceEventBroadcaster
- virtual sal_Bool SAL_CALL
- addLinguServiceEventListener(
- const Reference< XLinguServiceEventListener >& rxLstnr )
- throw(RuntimeException);
- virtual sal_Bool SAL_CALL
- removeLinguServiceEventListener(
- const Reference< XLinguServiceEventListener >& rxLstnr )
- throw(RuntimeException);
+ virtual sal_Bool SAL_CALL addLinguServiceEventListener( const Reference< XLinguServiceEventListener >& rxLstnr ) throw(RuntimeException);
+ virtual sal_Bool SAL_CALL removeLinguServiceEventListener( const Reference< XLinguServiceEventListener >& rxLstnr ) throw(RuntimeException);
// XServiceDisplayName
- virtual OUString SAL_CALL
- getServiceDisplayName( const Locale& rLocale )
- throw(RuntimeException);
+ virtual OUString SAL_CALL getServiceDisplayName( const Locale& rLocale ) throw(RuntimeException);
// XInitialization
- virtual void SAL_CALL
- initialize( const Sequence< Any >& rArguments )
- throw(Exception, RuntimeException);
+ virtual void SAL_CALL initialize( const Sequence< Any >& rArguments ) throw(Exception, RuntimeException);
// XComponent
- virtual void SAL_CALL
- dispose()
- throw(RuntimeException);
- virtual void SAL_CALL
- addEventListener( const Reference< XEventListener >& rxListener )
- throw(RuntimeException);
- virtual void SAL_CALL
- removeEventListener( const Reference< XEventListener >& rxListener )
- throw(RuntimeException);
-
- ////////////////////////////////////////////////////////////
- // Service specific part
- //
+ virtual void SAL_CALL dispose() throw(RuntimeException);
+ virtual void SAL_CALL addEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
+ virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
// XServiceInfo
- virtual OUString SAL_CALL
- getImplementationName()
- throw(RuntimeException);
- virtual sal_Bool SAL_CALL
- supportsService( const OUString& rServiceName )
- throw(RuntimeException);
- virtual Sequence< OUString > SAL_CALL
- getSupportedServiceNames()
- throw(RuntimeException);
-
-
- static inline OUString
- getImplementationName_Static() throw();
- static Sequence< OUString >
- getSupportedServiceNames_Static() throw();
+ virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw(RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
+
+
+ static inline OUString getImplementationName_Static() throw();
+ static Sequence< OUString > getSupportedServiceNames_Static() throw();
};
inline OUString SpellChecker::getImplementationName_Static() throw()
@@ -177,7 +136,6 @@ inline OUString SpellChecker::getImplementationName_Static() throw()
}
-
///////////////////////////////////////////////////////////////////////////
#endif
diff --git a/lingucomponent/source/thesaurus/libnth/exports.dxp b/lingucomponent/source/thesaurus/libnth/exports.dxp
index b0f85bf7bebf..a9861e3ffc0c 100644
--- a/lingucomponent/source/thesaurus/libnth/exports.dxp
+++ b/lingucomponent/source/thesaurus/libnth/exports.dxp
@@ -1,3 +1,2 @@
component_getFactory
component_getImplementationEnvironment
-component_writeInfo
diff --git a/lingucomponent/source/thesaurus/libnth/lnth.component b/lingucomponent/source/thesaurus/libnth/lnth.component
new file mode 100644
index 000000000000..bea91b94c1fe
--- /dev/null
+++ b/lingucomponent/source/thesaurus/libnth/lnth.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="org.openoffice.lingu.new.Thesaurus">
+ <service name="com.sun.star.linguistic2.Thesaurus"/>
+ </implementation>
+</component>
diff --git a/lingucomponent/source/thesaurus/libnth/makefile.mk b/lingucomponent/source/thesaurus/libnth/makefile.mk
index 58e4d97e5561..91d39d2d3eeb 100644
--- a/lingucomponent/source/thesaurus/libnth/makefile.mk
+++ b/lingucomponent/source/thesaurus/libnth/makefile.mk
@@ -105,3 +105,11 @@ DEF1EXPORTFILE= exports.dxp
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/lnth.component
+
+$(MISC)/lnth.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ lnth.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt lnth.component
diff --git a/lingucomponent/source/thesaurus/libnth/nthesdta.hxx b/lingucomponent/source/thesaurus/libnth/nthesdta.hxx
index 259bf5454359..23804d54f60f 100644
--- a/lingucomponent/source/thesaurus/libnth/nthesdta.hxx
+++ b/lingucomponent/source/thesaurus/libnth/nthesdta.hxx
@@ -48,11 +48,11 @@ class Meaning :
{
::com::sun::star::uno::Sequence< ::rtl::OUString > aSyn; // list of synonyms, may be empty.
::rtl::OUString aTerm;
- INT16 nLanguage;
+ INT16 nLanguage;
#if 0
// this is for future use by a German thesaurus
- BOOL bIsGermanPreReform;
+ BOOL bIsGermanPreReform;
#endif
// disallow copy-constructor and assignment-operator for now
@@ -68,22 +68,12 @@ public:
virtual ~Meaning();
// XMeaning
- virtual ::rtl::OUString SAL_CALL
- getMeaning()
- throw(::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
- querySynonyms()
- throw(::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getMeaning() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL querySynonyms() throw(::com::sun::star::uno::RuntimeException);
// non-interface specific functions
- void SetSynonyms(
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >
- &rSyn );
-
- void SetMeaning(const ::rtl::OUString &rTerm );
-
-
+ void SetSynonyms( const ::com::sun::star::uno::Sequence< ::rtl::OUString > &rSyn );
+ void SetMeaning( const ::rtl::OUString &rTerm );
};
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 * )
{
diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.hxx b/lingucomponent/source/thesaurus/libnth/nthesimp.hxx
index 94bbb6fb3ea6..e6d447879701 100644
--- a/lingucomponent/source/thesaurus/libnth/nthesimp.hxx
+++ b/lingucomponent/source/thesaurus/libnth/nthesimp.hxx
@@ -116,55 +116,27 @@ public:
virtual ~Thesaurus();
// XSupportedLocales (for XThesaurus)
- virtual Sequence< Locale > SAL_CALL
- getLocales()
- throw(RuntimeException);
- virtual sal_Bool SAL_CALL
- hasLocale( const Locale& rLocale )
- throw(RuntimeException);
+ virtual Sequence< Locale > SAL_CALL getLocales() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) throw(RuntimeException);
// XThesaurus
- virtual Sequence< Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL
- queryMeanings( const OUString& rTerm, const Locale& rLocale,
- const PropertyValues& rProperties )
- throw(IllegalArgumentException,
- RuntimeException);
+ virtual Sequence< Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL queryMeanings( const OUString& rTerm, const Locale& rLocale, const PropertyValues& rProperties ) throw(IllegalArgumentException, RuntimeException);
// XServiceDisplayName
- virtual OUString SAL_CALL
- getServiceDisplayName( const Locale& rLocale )
- throw(RuntimeException);
+ virtual OUString SAL_CALL getServiceDisplayName( const Locale& rLocale ) throw(RuntimeException);
// XInitialization
- virtual void SAL_CALL
- initialize( const Sequence< Any >& rArguments )
- throw(Exception, RuntimeException);
+ virtual void SAL_CALL initialize( const Sequence< Any >& rArguments ) throw(Exception, RuntimeException);
// XComponent
- virtual void SAL_CALL
- dispose()
- throw(RuntimeException);
- virtual void SAL_CALL
- addEventListener( const Reference< XEventListener >& rxListener )
- throw(RuntimeException);
- virtual void SAL_CALL
- removeEventListener( const Reference< XEventListener >& rxListener )
- throw(RuntimeException);
-
- ////////////////////////////////////////////////////////////
- // Service specific part
- //
+ virtual void SAL_CALL dispose() throw(RuntimeException);
+ virtual void SAL_CALL addEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
+ virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
// XServiceInfo
- virtual OUString SAL_CALL
- getImplementationName()
- throw(RuntimeException);
- virtual sal_Bool SAL_CALL
- supportsService( const OUString& rServiceName )
- throw(RuntimeException);
- virtual Sequence< OUString > SAL_CALL
- getSupportedServiceNames()
- throw(RuntimeException);
+ virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw(RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
static inline OUString
@@ -183,8 +155,7 @@ private:
static ::com::sun::star::uno::Reference<
::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
*/
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XLinguServiceManager > GetLngSvcMgr();
+ static ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLinguServiceManager > GetLngSvcMgr();
};
diff --git a/lingucomponent/source/thesaurus/libnth/ntreg.cxx b/lingucomponent/source/thesaurus/libnth/ntreg.cxx
index 14b3b3c896d4..f622e1e094c8 100644
--- a/lingucomponent/source/thesaurus/libnth/ntreg.cxx
+++ b/lingucomponent/source/thesaurus/libnth/ntreg.cxx
@@ -41,9 +41,6 @@ using namespace com::sun::star::registry;
// declaration of external RegEntry-functions defined by the service objects
//
-extern sal_Bool SAL_CALL Thesaurus_writeInfo(
- void * /*pServiceManager*/, XRegistryKey * pRegistryKey );
-
extern void * SAL_CALL Thesaurus_getFactory(
const sal_Char * pImplName,
XMultiServiceFactory * pServiceManager,
@@ -56,12 +53,6 @@ extern void * SAL_CALL Thesaurus_getFactory(
extern "C"
{
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, XRegistryKey * pRegistryKey )
-{
- return Thesaurus_writeInfo( pServiceManager, pRegistryKey );
-}
-
void SAL_CALL component_getImplementationEnvironment(
const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
{
diff --git a/lingucomponent/source/thesaurus/mythes/Makefile b/lingucomponent/source/thesaurus/mythes/Makefile
deleted file mode 100644
index b1d811296714..000000000000
--- a/lingucomponent/source/thesaurus/mythes/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-
-CXX=g++
-
-CXXFLAGS= -O2 -Wall -ansi -pedantic -I.
-
-LDFLAGS=-L. -lmythes
-
-LIBS=libmythes.a
-
-AR=ar rc
-RANLIB=ranlib
-
-OBJS = mythes.o
-
-all: example
-
-libmythes.a: $(OBJS)
- $(AR) $@ $(OBJS)
- -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
-
-example: example.o $(LIBS)
- $(CXX) $(CXXFLAGS) -o $@ example.o $(LDFLAGS)
-
-%.o: %.cxx
- $(CXX) $(CXXFLAGS) -c $<
-
-clean:
- rm -f *.o *~ example libthes.a
-
-distclean: clean
-
-depend:
- makedepend -- $(CXXFLAGS) -- *.[ch]xx
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-mythes.o: mythes.hxx
-example.o: mythes.hxx
-
diff --git a/lingucomponent/source/thesaurus/mythes/README b/lingucomponent/source/thesaurus/mythes/README
deleted file mode 100644
index 421f16a712fe..000000000000
--- a/lingucomponent/source/thesaurus/mythes/README
+++ /dev/null
@@ -1,60 +0,0 @@
-MyThes is a simple thesaurus that uses a structured
-text data file and an index file with binary search
-to lookup words and phrases and return information
-on part of speech, meanings, and synonyms
-
-MyThes was written to provide a thesaurus for the
-OpenOffice.org project
-
-The Main features of MyThes are:
-
-1. written in C++ to make it easier to interface with
- Pspell, OpenOffice, AbiWord, etc
-
-2. it is stateless, uses no static variables and
- should be completely reentrant with no ifdefs
-
-3. it compiles with -ansi and -pedantic and -Wall
- with no warnings so it should be quite portable
-
-4. it uses a perl program to read the structured
- text file and create the index needed for bianry
- searching (see dictionaries/en_US/th_gen_idx.pl)
-
-5. it is very simple with *lots* of comments.
- The main "smarts" are in the structure of the
- text file that makes up the thesaurus data
-
-6. It comes with a ready-to-go structured thesaurus
- data file for en_US extracted from the WordNet-2.0 data.
- (see dictioanries/en_US/th_en_US_new.dat)
-
- Please see WordNet_license.txt and WordNet_readme.txt
- for more information on the very useful project!
- (found in dictionaries/en_US/)
-
-7. The source code has a BSD license (and no advertising clause)
-
-
-MyThes has the world's simplest Makefile and no
-configure support. It does come with a simple example
-program that looks up some words and returns meanings
-and synonyms.
-
-To build it simply do the following:
-
-unzip mythes.zip
-cd mythes
-make
-
-To run the example program:
-./example th_en_US_new.idx th_en_US_new.dat checkme.lst
-
-Please play around with it and let me know
-what you think.
-
-Thanks,
-
-Kevin Hendricks
-kevin.hendricks@sympatico.ca
-
diff --git a/lingucomponent/source/thesaurus/mythes/checkme.lst b/lingucomponent/source/thesaurus/mythes/checkme.lst
deleted file mode 100644
index 120d343a9e0f..000000000000
--- a/lingucomponent/source/thesaurus/mythes/checkme.lst
+++ /dev/null
@@ -1,4 +0,0 @@
-simple
-complex
-junk
-jhjhjh
diff --git a/lingucomponent/source/thesaurus/mythes/data_layout.txt b/lingucomponent/source/thesaurus/mythes/data_layout.txt
deleted file mode 100644
index ef4bc255d96a..000000000000
--- a/lingucomponent/source/thesaurus/mythes/data_layout.txt
+++ /dev/null
@@ -1,131 +0,0 @@
-Description of the Structure of the Data needed by MyThes
---------------------------------------------------------
-
-MyThes is very simple. Almost all of the "smarts" are really
-in the thesaurus data file itself.
-
-The format for this file is at follows:
-
-- no binary data
-
-- line ending is a newline '\n' and not carriage return/linefeeds
-
-- Line 1 is a character string that describes the encoding
-used for the file. It is up to the calling program to convert
-to and from this encoding if necessary.
-
- ISO8859-1 is used by the th_en_US_new.dat file.
-
- Strings currently recognized by OpenOffice.org are:
-
- UTF-8
- ISO8859-1
- ISO8859-2
- ISO8859-3
- ISO8859-4
- ISO8859-5
- ISO8859-6
- ISO8859-7
- ISO8859-8
- ISO8859-9
- ISO8859-10
- KOI8-R
- CP-1251
- ISO8859-14
- ISCII-DEVANAGARI
-
-
-- All of the remaning lines of the file follow this structure
-
-entry|num_mean
-pos|syn1_mean|syn2|...
-.
-.
-.
-pos|mean_syn1|syn2|...
-
-
-where:
-
- entry - all lowercase version of the word or phrase being described
- num_mean - number of meanings for this entry
-
- There is one meaning per line and each meaning is comprised of
-
- pos - part of speech or other meaning specific description
- syn1_mean - synonym 1 also used to describe the meaning itself
- syn2 - synonym 2 for that meaning etc.
-
-
-To make this even more clearer, here is actual data for the
-entry "simple".
-
-simple|9
-(adj)|simple |elemental|ultimate|oversimplified|simplistic|simplex|simplified|unanalyzable|
-undecomposable|uncomplicated|unsophisticated|easy|plain|unsubdivided
-(adj)|elementary|uncomplicated|unproblematic|easy
-(adj)|bare|mere|plain
-(adj)|childlike|wide-eyed|dewy-eyed|naive |naif
-(adj)|dim-witted|half-witted|simple-minded|retarded
-(adj)|simple |unsubdivided|unlobed|smooth
-(adj)|plain
-(noun)|herb|herbaceous plant
-(noun)|simpleton|person|individual|someone|somebody|mortal|human|soul
-
-
-It says that "simple" has 9 different meanings and each
-meaning will have its part of speech and at least 1 synonym
-with other if presetn following on the same line.
-
-
-
-Once you ahve created your own structured text file you can use
-the perl program "th_gen_idx.pl" which can be found in this
-directory to create an index file that is used to seek into
-your data file by the MyThes code.
-
-The correct way to run the perl program is as follows:
-
-cat th_en_US_new.dat | ./th_gen_idx.pl > th_en_US_new.idx
-
-
-
-Then if you head the resulting index file you should see the
-following:
-
-ISO8859-1
-142689
-'hood|10
-'s gravenhage|88
-'tween|173
-'tween decks|196
-.22|231
-.22 caliber|319
-.22 calibre|365
-.38 caliber|411
-.38 calibre|457
-.45 caliber|503
-.45 calibre|549
-0|595
-1|666
-1 chronicles|6283
-1 esdras|6336
-
-
-Line 1 is the same encoding string taken from the
-structured thesaurus data file.
-
-Line 2 is a count of the total number of entries
-in your thesaurus.
-
-All of the remaining lines are of the form
-
-entry|byte_offset_into_data_file_where_entry_is_found
-
-
-That's all there is too it.
-
-
-Kevin
-kevin.hendricks@sympatico.ca
-
diff --git a/lingucomponent/source/thesaurus/mythes/example.cxx b/lingucomponent/source/thesaurus/mythes/example.cxx
deleted file mode 100644
index 31c85989cf26..000000000000
--- a/lingucomponent/source/thesaurus/mythes/example.cxx
+++ /dev/null
@@ -1,128 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_lingucomponent.hxx"
-#include <cstring>
-#include <cstdlib>
-#include <cstdio>
-
-#include "mythes.hxx"
-
-extern char * mystrdup(const char * s);
-
-using namespace std;
-
-int
-main(int argc, char** argv)
-{
-
- char * af;
- char * df;
- char * wtc;
- FILE* wtclst;
-
- /* first parse the command line options */
- /* arg1 - index file, arg2 thesaurus data file, arg3 - file of words to check */
-
- if (argv[1]) {
- af = mystrdup(argv[1]);
- } else {
- fprintf(stderr,"correct syntax is:\n");
- fprintf(stderr,"example index_file thesaurus_file file_of_words_to_check\n");
- exit(1);
- }
- if (argv[2]) {
- df = mystrdup(argv[2]);
- } else {
- fprintf(stderr,"correct syntax is:\n");
- fprintf(stderr,"example index_file thesaurus_file file_of_words_to_check\n");
- exit(1);
- }
- if (argv[3]) {
- wtc = mystrdup(argv[3]);
- } else {
- fprintf(stderr,"correct syntax is:\n");
- fprintf(stderr,"example index_file thesaurus_file file_of_words_to_check\n");
- exit(1);
- }
-
-
- /* open the words to check list */
- wtclst = fopen(wtc,"r");
- if (!wtclst) {
- fprintf(stderr,"Error - could not open file of words to check\n");
- exit(1);
- }
-
- // open a new thesaurus object
- MyThes * pMT= new MyThes(af,df);
-
- // get the encoding used for the thesaurus data
- char * encoding = pMT->get_th_encoding();
- fprintf(stdout,"Thesaurus uses encoding %s\n\n",encoding);
-
- int k;
- char buf[101];
- mentry * pmean;
-
- while(fgets(buf,100,wtclst)) {
- k = strlen(buf);
- *(buf + k - 1) = '\0';
- int len = strlen(buf);
- int count = pMT->Lookup(buf,len,&pmean);
- // don't change value of pmean
- // or count since needed for CleanUpAfterLookup routine
- mentry* pm = pmean;
- if (count) {
- fprintf(stdout,"%s has %d meanings\n",buf,count);
- for (int i=0; i < count; i++) {
- fprintf(stdout," meaning %d: %s\n",i,pm->defn);
- for (int j=0; j < pm->count; j++) {
- fprintf(stdout," %s\n",pm->psyns[j]);
- }
- fprintf(stdout,"\n");
- pm++;
- }
- fprintf(stdout,"\n\n");
- // now clean up all allocated memory
- pMT->CleanUpAfterLookup(&pmean,count);
- } else {
- fprintf(stdout,"\"%s\" is not in thesaurus!\n",buf);
- }
- }
-
- delete pMT;
- fclose(wtclst);
- free(wtc);
- free(df);
- free(af);
-
- return 0;
-}
-
diff --git a/lingucomponent/source/thesaurus/mythes/license.readme b/lingucomponent/source/thesaurus/mythes/license.readme
deleted file mode 100644
index b6bf70a0c7fe..000000000000
--- a/lingucomponent/source/thesaurus/mythes/license.readme
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2003 Kevin B. Hendricks, Stratford, Ontario, Canada
- * And Contributors. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. All modifications to the source code must be clearly marked as
- * such. Binary redistributions based on modified source code
- * must be clearly marked as modified versions in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY KEVIN B. HENDRICKS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * KEVIN B. HENDRICKS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
diff --git a/lingucomponent/source/thesaurus/mythes/makefile.mk b/lingucomponent/source/thesaurus/mythes/makefile.mk
deleted file mode 100644
index ac45219b97a0..000000000000
--- a/lingucomponent/source/thesaurus/mythes/makefile.mk
+++ /dev/null
@@ -1,59 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ = ..$/..$/..
-
-PRJNAME = lingucomponent
-TARGET = mythes
-LIBTARGET=NO
-
-#----- Settings ---------------------------------------------------------
-
-.INCLUDE : settings.mk
-
-# --- Files --------------------------------------------------------
-
-.IF "$(SYSTEM_MYTHES)" == "YES"
-@all:
- @echo "Using system mythes..."
-.ENDIF
-
-all_target: ALLTAR
-
-
-
-SLOFILES= \
- $(SLO)$/mythes.obj
-
-LIB1TARGET= $(SLB)$/lib$(TARGET).lib
-LIB1ARCHIV= $(LB)/lib$(TARGET).a
-LIB1OBJFILES= $(SLOFILES)
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/lingucomponent/source/thesaurus/mythes/mythes.cxx b/lingucomponent/source/thesaurus/mythes/mythes.cxx
deleted file mode 100644
index ebb224d92140..000000000000
--- a/lingucomponent/source/thesaurus/mythes/mythes.cxx
+++ /dev/null
@@ -1,403 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_lingucomponent.hxx"
-#include "license.readme"
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#include "mythes.hxx"
-
-
-
-MyThes::MyThes(const char* idxpath, const char * datpath)
-{
- nw = 0;
- encoding = NULL;
- list = NULL;
- offst = NULL;
-
- if (thInitialize(idxpath, datpath) != 1) {
- fprintf(stderr,"Error - can't open %s or %s\n",idxpath, datpath);
- fflush(stderr);
- thCleanup();
- // did not initialize properly - throw exception?
- }
-}
-
-
-MyThes::~MyThes()
-{
- thCleanup();
-}
-
-
-int MyThes::thInitialize(const char* idxpath, const char* datpath)
-{
-
- // open the index file
- FILE * pifile = fopen(idxpath,"r");
- if (!pifile) {
- return 0;
- }
-
- // parse in encoding and index size */
- char * wrd;
- wrd = (char *)calloc(1, MAX_WD_LEN);
- if (!wrd) {
- fprintf(stderr,"Error - bad memory allocation\n");
- fflush(stderr);
- fclose(pifile);
- return 0;
- }
- int len = readLine(pifile,wrd,MAX_WD_LEN);
- encoding = mystrdup(wrd);
- len = readLine(pifile,wrd,MAX_WD_LEN);
- int idxsz = atoi(wrd);
-
-
- // now allocate list, offst for the given size
- list = (char**) calloc(idxsz,sizeof(char*));
- offst = (unsigned int*) calloc(idxsz,sizeof(unsigned int));
-
- if ( (!(list)) || (!(offst)) ) {
- fprintf(stderr,"Error - bad memory allocation\n");
- fflush(stderr);
- fclose(pifile);
- return 0;
- }
-
- // now parse the remaining lines of the index
- len = readLine(pifile,wrd,MAX_WD_LEN);
- while (len > 0)
- {
- int np = mystr_indexOfChar(wrd,'|');
- if (nw < idxsz) {
- if (np >= 0) {
- *(wrd+np) = '\0';
- list[nw] = (char *)calloc(1,(np+1));
- if (!list[nw]) {
- fprintf(stderr,"Error - bad memory allocation\n");
- fflush(stderr);
- fclose(pifile);
- return 0;
- }
- memcpy((list[nw]),wrd,np);
- offst[nw] = atoi(wrd+np+1);
- nw++;
- }
- }
- len = readLine(pifile,wrd,MAX_WD_LEN);
- }
-
- free((void *)wrd);
- fclose(pifile);
-
- /* next open the data file */
- pdfile = fopen(datpath,"r");
- if (!pdfile) {
- return 0;
- }
-
- return 1;
-}
-
-
-void MyThes::thCleanup()
-{
- /* first close the data file */
- if (pdfile) {
- fclose(pdfile);
- pdfile=NULL;
- }
-
- if (list)
- {
- /* now free up all the allocated strings on the list */
- for (int i=0; i < nw; i++)
- {
- if (list[i]) {
- free(list[i]);
- list[i] = 0;
- }
- }
- free((void*)list);
- }
-
- if (encoding) free((void*)encoding);
- if (offst) free((void*)offst);
-
- encoding = NULL;
- list = NULL;
- offst = NULL;
- nw = 0;
-}
-
-
-
-// lookup text in index and count of meanings and a list of meaning entries
-// with each entry having a synonym count and pointer to an
-// array of char * (i.e the synonyms)
-//
-// note: calling routine should call CleanUpAfterLookup with the original
-// meaning point and count to properly deallocate memory
-
-int MyThes::Lookup(const char * pText, int len, mentry** pme)
-{
-
- *pme = NULL;
-
- // handle the case of missing file or file related errors
- if (! pdfile) return 0;
-
- long offset = 0;
-
- /* copy search word and make sure null terminated */
- char * wrd = (char *) calloc(1,(len+1));
- memcpy(wrd,pText,len);
-
- /* find it in the list */
- int idx = nw > 0 ? binsearch(wrd,list,nw) : -1;
- free(wrd);
- if (idx < 0) return 0;
-
- // now seek to the offset
- offset = (long) offst[idx];
- int rc = fseek(pdfile,offset,SEEK_SET);
- if (rc) {
- return 0;
- }
-
- // grab the count of the number of meanings
- // and allocate a list of meaning entries
- char * buf = NULL;
- buf = (char *) malloc( MAX_LN_LEN );
- if (!buf) return 0;
- readLine(pdfile, buf, (MAX_LN_LEN-1));
- int np = mystr_indexOfChar(buf,'|');
- if (np < 0) {
- free(buf);
- return 0;
- }
- int nmeanings = atoi(buf+np+1);
- *pme = (mentry*) malloc( nmeanings * sizeof(mentry) );
- if (!(*pme)) {
- free(buf);
- return 0;
- }
-
- // now read in each meaning and parse it to get defn, count and synonym lists
- mentry* pm = *(pme);
- char dfn[MAX_WD_LEN];
-
- for (int j = 0; j < nmeanings; j++) {
- readLine(pdfile, buf, (MAX_LN_LEN-1));
-
- pm->count = 0;
- pm->psyns = NULL;
- pm->defn = NULL;
-
- // store away the part of speech for later use
- char * p = buf;
- char * pos = NULL;
- np = mystr_indexOfChar(p,'|');
- if (np >= 0) {
- *(buf+np) = '\0';
- pos = mystrdup(p);
- p = p + np + 1;
- } else {
- pos = mystrdup("");
- }
-
- // count the number of fields in the remaining line
- int nf = 1;
- char * d = p;
- np = mystr_indexOfChar(d,'|');
- while ( np >= 0 ) {
- nf++;
- d = d + np + 1;
- np = mystr_indexOfChar(d,'|');
- }
- pm->count = nf;
- pm->psyns = (char **) malloc(nf*sizeof(char*));
-
- // fill in the synonym list
- d = p;
- for (int jj = 0; jj < nf; jj++)
- {
- np = mystr_indexOfChar(d,'|');
- if (np > 0)
- {
- *(d+np) = '\0';
- pm->psyns[jj] = mystrdup(d);
- d = d + np + 1;
- }
- else
- {
- pm->psyns[jj] = mystrdup(d);
- }
- }
-
- // add pos to first synonym to create the definition
- int k = strlen(pos);
- int m = strlen(pm->psyns[0]);
- if ((k+m) < (MAX_WD_LEN - 1)) {
- strncpy(dfn,pos,k);
- *(dfn+k) = ' ';
- strncpy((dfn+k+1),(pm->psyns[0]),m+1);
- pm->defn = mystrdup(dfn);
- } else {
- pm->defn = mystrdup(pm->psyns[0]);
- }
- free(pos);
- pm++;
-
- }
- free(buf);
-
- return nmeanings;
-}
-
-
-
-void MyThes::CleanUpAfterLookup(mentry ** pme, int nmeanings)
-{
-
- if (nmeanings == 0) return;
- if ((*pme) == NULL) return;
-
- mentry * pm = *pme;
-
- for (int i = 0; i < nmeanings; i++) {
- int count = pm->count;
- for (int j = 0; j < count; j++) {
- if (pm->psyns[j]) free(pm->psyns[j]);
- pm->psyns[j] = NULL;
- }
- if (pm->psyns) free(pm->psyns);
- pm->psyns = NULL;
- if (pm->defn) free(pm->defn);
- pm->defn = NULL;
- pm->count = 0;
- pm++;
- }
- pm = *pme;
- free(pm);
- *pme = NULL;
- return;
-}
-
-
-// read a line of text from a text file stripping
-// off the line terminator and replacing it with
-// a null string terminator.
-// returns: -1 on error or the number of characters in
-// in the returning string
-
-// A maximum of nc characters will be returned
-
-int MyThes::readLine(FILE * pf, char * buf, int nc)
-{
-
- if (fgets(buf,nc,pf)) {
- mychomp(buf);
- return strlen(buf);
- }
- return -1;
-}
-
-
-
-// performs a binary search on null terminated character
-// strings
-//
-// returns: -1 on not found
-// index of wrd in the list[]
-
-int MyThes::binsearch(char * sw, char* _list[], int nlst)
-{
- int lp, up, mp, j, indx;
- lp = 0;
- up = nlst-1;
- indx = -1;
- if (strcmp(sw,_list[lp]) < 0) return -1;
- if (strcmp(sw,_list[up]) > 0) return -1;
- while (indx < 0 ) {
- mp = (int)((lp+up) >> 1);
- j = strcmp(sw,_list[mp]);
- if ( j > 0) {
- lp = mp + 1;
- } else if (j < 0 ) {
- up = mp - 1;
- } else {
- indx = mp;
- }
- if (lp > up) return -1;
- }
- return indx;
-}
-
-char * MyThes::get_th_encoding()
-{
- if (encoding) return encoding;
- return NULL;
-}
-
-
-// string duplication routine
-char * MyThes::mystrdup(const char * p)
-{
- int sl = strlen(p) + 1;
- char * d = (char *)malloc(sl);
- if (d) {
- memcpy(d,p,sl);
- return d;
- }
- return NULL;
-}
-
-// remove cross-platform text line end characters
-void MyThes::mychomp(char * s)
-{
- int k = strlen(s);
- if ((k > 0) && ((*(s+k-1)=='\r') || (*(s+k-1)=='\n'))) *(s+k-1) = '\0';
- if ((k > 1) && (*(s+k-2) == '\r')) *(s+k-2) = '\0';
-}
-
-
-// return index of char in string
-int MyThes::mystr_indexOfChar(const char * d, int c)
-{
- char * p = strchr((char *)d,c);
- if (p) return (int)(p-d);
- return -1;
-}
-
diff --git a/lingucomponent/source/thesaurus/mythes/mythes.hxx b/lingucomponent/source/thesaurus/mythes/mythes.hxx
deleted file mode 100644
index 539e6723c42d..000000000000
--- a/lingucomponent/source/thesaurus/mythes/mythes.hxx
+++ /dev/null
@@ -1,76 +0,0 @@
-#ifndef _MYTHES_HXX_
-#define _MYTHES_HXX_
-
-// some maximum sizes for buffers
-#define MAX_WD_LEN 200
-#define MAX_LN_LEN 16384
-
-
-// a meaning with definition, count of synonyms and synonym list
-struct mentry {
- char* defn;
- int count;
- char** psyns;
-};
-
-
-class MyThes
-{
-
- int nw; /* number of entries in thesaurus */
- char** list; /* stores word list */
- unsigned int* offst; /* stores offset list */
- char * encoding; /* stores text encoding; */
-
- FILE *pdfile;
-
- // disallow copy-constructor and assignment-operator for now
- MyThes();
- MyThes(const MyThes &);
- MyThes & operator = (const MyThes &);
-
-public:
- MyThes(const char* idxpath, const char* datpath);
- ~MyThes();
-
- // lookup text in index and return number of meanings
- // each meaning entry has a defintion, synonym count and pointer
- // when complete return the *original* meaning entry and count via
- // CleanUpAfterLookup to properly handle memory deallocation
-
- int Lookup(const char * pText, int len, mentry** pme);
-
- void CleanUpAfterLookup(mentry** pme, int nmean);
-
- char* get_th_encoding();
-
-private:
- // Open index and dat files and load list array
- int thInitialize (const char* indxpath, const char* datpath);
-
- // internal close and cleanup dat and idx files
- void thCleanup ();
-
- // read a text line (\n terminated) stripping off line terminator
- int readLine(FILE * pf, char * buf, int nc);
-
- // binary search on null terminated character strings
- int binsearch(char * wrd, char* list[], int nlst);
-
- // string duplication routine
- char * mystrdup(const char * p);
-
- // remove cross-platform text line end characters
- void mychomp(char * s);
-
- // return index of char in string
- int mystr_indexOfChar(const char * d, int c);
-
-};
-
-#endif
-
-
-
-
-