summaryrefslogtreecommitdiff
path: root/lingucomponent
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2008-12-15 12:01:46 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2008-12-15 12:01:46 +0000
commita10ddaf8a9d8cf16aa219f72bcdba67df8f6b678 (patch)
tree1e1f4d8edb2a31c2930a090eb10b08a6cd5124ae /lingucomponent
parent3d8934c4ed0ada08548e16628d92642f01a1efd5 (diff)
CWS-TOOLING: integrate CWS tl56_DEV300
Diffstat (limited to 'lingucomponent')
-rw-r--r--lingucomponent/source/lingutil/lingutil.cxx71
-rw-r--r--lingucomponent/source/spellcheck/macosxspell/macspellimp.cxx2
-rw-r--r--lingucomponent/source/spellcheck/macosxspell/spelldta.cxx304
-rw-r--r--lingucomponent/source/spellcheck/macosxspell/spelldta.hxx134
-rw-r--r--lingucomponent/source/spellcheck/spell/spelldta.cxx304
-rw-r--r--lingucomponent/source/spellcheck/spell/spelldta.hxx134
-rw-r--r--lingucomponent/source/spellcheck/spell/sspellimp.cxx2
7 files changed, 2 insertions, 949 deletions
diff --git a/lingucomponent/source/lingutil/lingutil.cxx b/lingucomponent/source/lingutil/lingutil.cxx
index 75e987e07c51..dcf61e351950 100644
--- a/lingucomponent/source/lingutil/lingutil.cxx
+++ b/lingucomponent/source/lingutil/lingutil.cxx
@@ -166,81 +166,10 @@ std::vector< SvtLinguConfigDictionaryEntry > GetOldStyleDics( const char *pDicTy
if (aFormatName.getLength() == 0 || aDicExtension.Len() == 0)
return aRes;
- dictentry * pDict = NULL; // shared dict entry pointer
-
// set of languages to remember the language where it is already
// decided to make use of the dictionary.
std::set< LanguageType > aDicLangInUse;
- const sal_Int16 USER_LAYER = 0;
- for (int k = 0; k < 2; ++k)
- {
- // Search for 'dictionary.lst' file still in use.
- // First look in the user paths for downloaded dictionaries then
- // look in paths for shared installed dictionaries.
- // In each path sequence there should be at most one 'dictionary.lst' be found...
- const sal_Int16 nFlags = k == USER_LAYER ? PATH_FLAG_USER : PATH_FLAG_INTERNAL;
- const uno::Sequence< ::rtl::OUString > aPaths( linguistic::GetLinguisticPaths( nFlags ) );
-
- // invoke a dictionary manager to get the dictionary list
- String aLstFile( String::CreateFromAscii("dictionary.lst") );
- aLstFile = linguistic::SearchFileInPaths( aLstFile, aPaths );
- rtl::OUString aLstFileURL;
- osl::FileBase::getSystemPathFromFileURL( aLstFile, aLstFileURL );
- rtl::OString aSysPathToFile( OU2ENC( aLstFileURL, osl_getThreadTextEncoding() ) );
- DictMgr aDictMgr( aSysPathToFile.getStr(), pDicType );
- int nDicts = aDictMgr.get_list( &pDict );
-
- // Test for existence of the actual dictionary files
- // and remember the ones we like to use...
- for (int i = 0; i < nDicts; ++i)
- {
- // Note: the 'dictionary.lst' file and the actual dictionary files
- // need to reside in the very same directory!!
- String aDicFileName( String::CreateFromAscii( pDict[i].filename ) );
- aDicFileName += aDicExtension;
- aDicFileName = linguistic::SearchFileInPaths( aDicFileName, aPaths );
-
- // file not found?
- if (aDicFileName.Len() == 0)
- continue;
-
-
- //
- // Now, since the dictionary does exist add it to the resulting vector.
- // But don't make use of shared layer dictionaries if for the
- // same language user layer dictionaries do exist.
- // The user dictionaries must get precedence over shared layer
- // (system installed dictionaries) in order to let the user have
- // the choice. E.g. when he wants touse a newer version of a
- // shared layer installed dictionary...
- //
-
- // Thus we first get the language of the dictionary
- LanguageType nLang = MsLangId::convertIsoNamesToLanguage(
- A2OU( pDict[i].lang ),
- A2OU( pDict[i].region ) );
-
- // Don't add shared layer dictionary if there is already
- // a user layer dictionary...
- if (k == USER_LAYER || aDicLangInUse.count( nLang ) == 0)
- {
- // remember the new language in use
- aDicLangInUse.insert( nLang );
-
- // add the dictionary to the resulting vector
- SvtLinguConfigDictionaryEntry aDicEntry;
- aDicEntry.aLocations.realloc(1);
- aDicEntry.aLocaleNames.realloc(1);
- rtl::OUString aLocaleName( MsLangId::convertLanguageToIsoString( nLang ) );
- aDicEntry.aLocations[0] = aDicFileName;
- aDicEntry.aFormatName = aFormatName;
- aDicEntry.aLocaleNames[0] = aLocaleName;
- aRes.push_back( aDicEntry );
- }
- }
- }
-
#ifdef SYSTEM_DICTS
osl::Directory aSystemDicts(aSystemDir);
if (aSystemDicts.open() == osl::FileBase::E_None)
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.cxx b/lingucomponent/source/spellcheck/macosxspell/macspellimp.cxx
index b04154b417e7..d1d8103eedd5 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.cxx
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.cxx
@@ -45,7 +45,7 @@
#include <macspellimp.hxx>
//#include <linguistic/lngprops.hxx>
-#include "spelldta.hxx"
+#include <linguistic/spelldta.hxx>
#include <svtools/pathoptions.hxx>
#include <svtools/useroptions.hxx>
#include <osl/file.hxx>
diff --git a/lingucomponent/source/spellcheck/macosxspell/spelldta.cxx b/lingucomponent/source/spellcheck/macosxspell/spelldta.cxx
deleted file mode 100644
index 1077f8a45cbd..000000000000
--- a/lingucomponent/source/spellcheck/macosxspell/spelldta.cxx
+++ /dev/null
@@ -1,304 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: spelldta.cxx,v $
- * $Revision: 1.3 $
- *
- * 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 <com/sun/star/uno/Reference.h>
-
-#include <com/sun/star/linguistic2/SpellFailure.hpp>
-#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
-#include <tools/debug.hxx>
-#include <unotools/processfactory.hxx>
-#include <osl/mutex.hxx>
-
-#include "spelldta.hxx"
-#include "lngsvcmgr.hxx"
-
-
-using namespace utl;
-using namespace osl;
-using namespace rtl;
-using namespace com::sun::star;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::linguistic2;
-
-namespace linguistic
-{
-
-///////////////////////////////////////////////////////////////////////////
-
-
-#define MAX_PROPOSALS 40
-
-Reference< XSpellAlternatives > MergeProposals(
- Reference< XSpellAlternatives > &rxAlt1,
- Reference< XSpellAlternatives > &rxAlt2)
-{
- Reference< XSpellAlternatives > xMerged;
-
- if (!rxAlt1.is())
- xMerged = rxAlt2;
- else if (!rxAlt2.is())
- xMerged = rxAlt1;
- else
- {
- INT32 nAltCount1 = rxAlt1->getAlternativesCount();
- Sequence< OUString > aAlt1( rxAlt1->getAlternatives() );
- const OUString *pAlt1 = aAlt1.getConstArray();
-
- INT32 nAltCount2 = rxAlt2->getAlternativesCount();
- Sequence< OUString > aAlt2( rxAlt2->getAlternatives() );
- const OUString *pAlt2 = aAlt2.getConstArray();
-
- INT32 nCountNew = Min( nAltCount1 + nAltCount2, (INT32) MAX_PROPOSALS );
- Sequence< OUString > aAltNew( nCountNew );
- OUString *pAltNew = aAltNew.getArray();
-
- INT32 nIndex = 0;
- INT32 i = 0;
- for (int j = 0; j < 2; j++)
- {
- INT32 nCount = j == 0 ? nAltCount1 : nAltCount2;
- const OUString *pAlt = j == 0 ? pAlt1 : pAlt2;
- for (i = 0; i < nCount && nIndex < MAX_PROPOSALS; i++)
- {
- if (pAlt[i].getLength())
- pAltNew[ nIndex++ ] = pAlt[ i ];
- }
- }
- DBG_ASSERT(nIndex == nCountNew, "lng : wrong number of proposals");
-
- SpellAlternatives *pSpellAlt = new SpellAlternatives;
- pSpellAlt->SetWordLanguage( rxAlt1->getWord(),
- LocaleToLanguage( rxAlt1->getLocale() ) );
- pSpellAlt->SetFailureType( rxAlt1->getFailureType() );
- pSpellAlt->SetAlternatives( aAltNew );
- xMerged = pSpellAlt;
- }
-
- return xMerged;
-}
-
-
-BOOL SeqHasEntry(
- const Sequence< OUString > &rSeq,
- const OUString &rTxt)
-{
- BOOL bRes = FALSE;
- INT32 nLen = rSeq.getLength();
- const OUString *pEntry = rSeq.getConstArray();
- for (INT32 i = 0; i < nLen && !bRes; ++i)
- {
- if (rTxt == pEntry[i])
- bRes = TRUE;
- }
- return bRes;
-}
-
-
-void SeqRemoveNegEntries( Sequence< OUString > &rSeq,
- Reference< XDictionaryList > &rxDicList,
- INT16 nLanguage )
-{
- static const OUString aEmpty;
- BOOL bSthRemoved = FALSE;
- INT32 nLen = rSeq.getLength();
- OUString *pEntries = rSeq.getArray();
- for (INT32 i = 0; i < nLen; ++i)
- {
- Reference< XDictionaryEntry > xNegEntry( SearchDicList( rxDicList,
- pEntries[i], nLanguage, FALSE, TRUE ) );
- if (xNegEntry.is())
- {
- pEntries[i] = aEmpty;
- bSthRemoved = TRUE;
- }
- }
- if (bSthRemoved)
- {
- Sequence< OUString > aNew;
- // merge sequence without duplicates and empty strings in new empty sequence
- aNew = MergeProposalSeqs( aNew, rSeq, FALSE );
- rSeq = aNew;
- }
-}
-
-
-Sequence< OUString > MergeProposalSeqs(
- Sequence< OUString > &rAlt1,
- Sequence< OUString > &rAlt2,
- BOOL bAllowDuplicates )
-{
- Sequence< OUString > aMerged;
-
- if (0 == rAlt1.getLength() && bAllowDuplicates)
- aMerged = rAlt2;
- else if (0 == rAlt2.getLength() && bAllowDuplicates)
- aMerged = rAlt1;
- else
- {
- INT32 nAltCount1 = rAlt1.getLength();
- const OUString *pAlt1 = rAlt1.getConstArray();
- INT32 nAltCount2 = rAlt2.getLength();
- const OUString *pAlt2 = rAlt2.getConstArray();
-
- INT32 nCountNew = Min( nAltCount1 + nAltCount2, (INT32) MAX_PROPOSALS );
- aMerged.realloc( nCountNew );
- OUString *pMerged = aMerged.getArray();
-
- INT32 nIndex = 0;
- INT32 i = 0;
- for (int j = 0; j < 2; j++)
- {
- INT32 nCount = j == 0 ? nAltCount1 : nAltCount2;
- const OUString *pAlt = j == 0 ? pAlt1 : pAlt2;
- for (i = 0; i < nCount && nIndex < MAX_PROPOSALS; i++)
- {
- if (pAlt[i].getLength() &&
- (bAllowDuplicates || !SeqHasEntry(aMerged, pAlt[i] )))
- pMerged[ nIndex++ ] = pAlt[ i ];
- }
- }
- //DBG_ASSERT(nIndex == nCountNew, "wrong number of proposals");
- aMerged.realloc( nIndex );
- }
-
- return aMerged;
-}
-
-///////////////////////////////////////////////////////////////////////////
-
-
-SpellAlternatives::SpellAlternatives()
-{
- nLanguage = LANGUAGE_NONE;
- nType = SpellFailure::IS_NEGATIVE_WORD;
-}
-
-
-SpellAlternatives::SpellAlternatives(
- const OUString &rWord, INT16 nLang,
- INT16 nFailureType, const OUString &rRplcWord ) :
- aWord (rWord),
- nLanguage (nLang),
- nType (nFailureType),
- aAlt ( Sequence< OUString >(1) )
-{
- if (rRplcWord.getLength())
- aAlt.getArray()[ 0 ] = rRplcWord;
- else
- aAlt.realloc( 0 );
-}
-
-
-SpellAlternatives::SpellAlternatives(
- const OUString &rWord, INT16 nLang, INT16 nFailureType,
- const Sequence< OUString > &rAlternatives ) :
- aWord (rWord),
- nLanguage (nLang),
- nType (nFailureType),
- aAlt (rAlternatives)
-{
-}
-
-
-SpellAlternatives::~SpellAlternatives()
-{
-}
-
-
-OUString SAL_CALL SpellAlternatives::getWord()
- throw(RuntimeException)
-{
- MutexGuard aGuard( GetLinguMutex() );
- return aWord;
-}
-
-
-Locale SAL_CALL SpellAlternatives::getLocale()
- throw(RuntimeException)
-{
- MutexGuard aGuard( GetLinguMutex() );
- return CreateLocale( nLanguage );
-}
-
-
-sal_Int16 SAL_CALL SpellAlternatives::getFailureType()
- throw(RuntimeException)
-{
- MutexGuard aGuard( GetLinguMutex() );
- return nType;
-}
-
-
-sal_Int16 SAL_CALL SpellAlternatives::getAlternativesCount()
- throw(RuntimeException)
-{
- MutexGuard aGuard( GetLinguMutex() );
- return (INT16) aAlt.getLength();
-}
-
-
-Sequence< OUString > SAL_CALL SpellAlternatives::getAlternatives()
- throw(RuntimeException)
-{
- MutexGuard aGuard( GetLinguMutex() );
- return aAlt;
-}
-
-
-void SpellAlternatives::SetWordLanguage(const OUString &rWord, INT16 nLang)
-{
- MutexGuard aGuard( GetLinguMutex() );
- aWord = rWord;
- nLanguage = nLang;
-}
-
-
-void SpellAlternatives::SetFailureType(INT16 nTypeP)
-{
- MutexGuard aGuard( GetLinguMutex() );
- nType = nTypeP;
-}
-
-
-void SpellAlternatives::SetAlternatives( const Sequence< OUString > &rAlt )
-{
- MutexGuard aGuard( GetLinguMutex() );
- aAlt = rAlt;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-
-} // namespace linguistic
-
diff --git a/lingucomponent/source/spellcheck/macosxspell/spelldta.hxx b/lingucomponent/source/spellcheck/macosxspell/spelldta.hxx
deleted file mode 100644
index 7d6b27f61546..000000000000
--- a/lingucomponent/source/spellcheck/macosxspell/spelldta.hxx
+++ /dev/null
@@ -1,134 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: spelldta.hxx,v $
- * $Revision: 1.3 $
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef _LINGUISTIC_SPELLDTA_HXX_
-#define _LINGUISTIC_SPELLDTA_HXX_
-
-
-#include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
-
-#include <tools/solar.h>
-
-#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
-#include <cppuhelper/implbase1.hxx> // helper for implementations
-
-namespace com { namespace sun { namespace star {
- namespace linguistic2 {
- class XDictionaryList;
- }
-} } }
-
-
-namespace linguistic
-{
-
-///////////////////////////////////////////////////////////////////////////
-
-::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellAlternatives >
- MergeProposals(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellAlternatives > &rxAlt1,
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellAlternatives > &rxAlt2 );
-
-::com::sun::star::uno::Sequence< ::rtl::OUString >
- MergeProposalSeqs(
- ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlt1,
- ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlt2,
- BOOL bAllowDuplicates );
-
-void SeqRemoveNegEntries(
- ::com::sun::star::uno::Sequence< ::rtl::OUString > &rSeq,
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionaryList > &rxDicList,
- INT16 nLanguage );
-
-BOOL SeqHasEntry(
- const ::com::sun::star::uno::Sequence< ::rtl::OUString > &rSeq,
- const ::rtl::OUString &rTxt);
-
-///////////////////////////////////////////////////////////////////////////
-
-
-class SpellAlternatives :
- public cppu::WeakImplHelper1
- <
- ::com::sun::star::linguistic2::XSpellAlternatives
- >
-{
- ::com::sun::star::uno::Sequence< ::rtl::OUString > aAlt; // list of alternatives, may be empty.
- ::rtl::OUString aWord;
- INT16 nType; // type of failure
- INT16 nLanguage;
-
- // disallow copy-constructor and assignment-operator for now
- SpellAlternatives(const SpellAlternatives &);
- SpellAlternatives & operator = (const SpellAlternatives &);
-
-public:
- SpellAlternatives();
- SpellAlternatives(const ::rtl::OUString &rWord, INT16 nLang, INT16 nFailureType,
- const ::rtl::OUString &rRplcWord );
- SpellAlternatives(const ::rtl::OUString &rWord, INT16 nLang, INT16 nFailureType,
- const ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlternatives );
- virtual ~SpellAlternatives();
-
- // XSpellAlternatives
- virtual ::rtl::OUString SAL_CALL
- getWord()
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::lang::Locale SAL_CALL
- getLocale()
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL
- getFailureType()
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL
- getAlternativesCount()
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
- getAlternatives()
- throw(::com::sun::star::uno::RuntimeException);
-
- // non-interface specific functions
- void SetWordLanguage(const ::rtl::OUString &rWord, INT16 nLang);
- void SetFailureType(INT16 nTypeP);
- void SetAlternatives(
- const ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlt );
-};
-
-
-///////////////////////////////////////////////////////////////////////////
-
-} // namespace linguistic
-
-#endif
-
diff --git a/lingucomponent/source/spellcheck/spell/spelldta.cxx b/lingucomponent/source/spellcheck/spell/spelldta.cxx
deleted file mode 100644
index b1309fa75259..000000000000
--- a/lingucomponent/source/spellcheck/spell/spelldta.cxx
+++ /dev/null
@@ -1,304 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: spelldta.cxx,v $
- * $Revision: 1.7 $
- *
- * 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 <com/sun/star/uno/Reference.h>
-
-#include <com/sun/star/linguistic2/SpellFailure.hpp>
-#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
-#include <tools/debug.hxx>
-#include <unotools/processfactory.hxx>
-#include <osl/mutex.hxx>
-
-#include "spelldta.hxx"
-#include "lngsvcmgr.hxx"
-
-
-using namespace utl;
-using namespace osl;
-using namespace rtl;
-using namespace com::sun::star;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::linguistic2;
-
-namespace linguistic
-{
-
-///////////////////////////////////////////////////////////////////////////
-
-
-#define MAX_PROPOSALS 40
-
-Reference< XSpellAlternatives > MergeProposals(
- Reference< XSpellAlternatives > &rxAlt1,
- Reference< XSpellAlternatives > &rxAlt2)
-{
- Reference< XSpellAlternatives > xMerged;
-
- if (!rxAlt1.is())
- xMerged = rxAlt2;
- else if (!rxAlt2.is())
- xMerged = rxAlt1;
- else
- {
- INT32 nAltCount1 = rxAlt1->getAlternativesCount();
- Sequence< OUString > aAlt1( rxAlt1->getAlternatives() );
- const OUString *pAlt1 = aAlt1.getConstArray();
-
- INT32 nAltCount2 = rxAlt2->getAlternativesCount();
- Sequence< OUString > aAlt2( rxAlt2->getAlternatives() );
- const OUString *pAlt2 = aAlt2.getConstArray();
-
- INT32 nCountNew = Min( nAltCount1 + nAltCount2, (INT32) MAX_PROPOSALS );
- Sequence< OUString > aAltNew( nCountNew );
- OUString *pAltNew = aAltNew.getArray();
-
- INT32 nIndex = 0;
- INT32 i = 0;
- for (int j = 0; j < 2; j++)
- {
- INT32 nCount = j == 0 ? nAltCount1 : nAltCount2;
- const OUString *pAlt = j == 0 ? pAlt1 : pAlt2;
- for (i = 0; i < nCount && nIndex < MAX_PROPOSALS; i++)
- {
- if (pAlt[i].getLength())
- pAltNew[ nIndex++ ] = pAlt[ i ];
- }
- }
- DBG_ASSERT(nIndex == nCountNew, "lng : wrong number of proposals");
-
- SpellAlternatives *pSpellAlt = new SpellAlternatives;
- pSpellAlt->SetWordLanguage( rxAlt1->getWord(),
- LocaleToLanguage( rxAlt1->getLocale() ) );
- pSpellAlt->SetFailureType( rxAlt1->getFailureType() );
- pSpellAlt->SetAlternatives( aAltNew );
- xMerged = pSpellAlt;
- }
-
- return xMerged;
-}
-
-
-BOOL SeqHasEntry(
- const Sequence< OUString > &rSeq,
- const OUString &rTxt)
-{
- BOOL bRes = FALSE;
- INT32 nLen = rSeq.getLength();
- const OUString *pEntry = rSeq.getConstArray();
- for (INT32 i = 0; i < nLen && !bRes; ++i)
- {
- if (rTxt == pEntry[i])
- bRes = TRUE;
- }
- return bRes;
-}
-
-
-void SeqRemoveNegEntries( Sequence< OUString > &rSeq,
- Reference< XDictionaryList > &rxDicList,
- INT16 nLanguage )
-{
- static const OUString aEmpty;
- BOOL bSthRemoved = FALSE;
- INT32 nLen = rSeq.getLength();
- OUString *pEntries = rSeq.getArray();
- for (INT32 i = 0; i < nLen; ++i)
- {
- Reference< XDictionaryEntry > xNegEntry( SearchDicList( rxDicList,
- pEntries[i], nLanguage, FALSE, TRUE ) );
- if (xNegEntry.is())
- {
- pEntries[i] = aEmpty;
- bSthRemoved = TRUE;
- }
- }
- if (bSthRemoved)
- {
- Sequence< OUString > aNew;
- // merge sequence without duplicates and empty strings in new empty sequence
- aNew = MergeProposalSeqs( aNew, rSeq, FALSE );
- rSeq = aNew;
- }
-}
-
-
-Sequence< OUString > MergeProposalSeqs(
- Sequence< OUString > &rAlt1,
- Sequence< OUString > &rAlt2,
- BOOL bAllowDuplicates )
-{
- Sequence< OUString > aMerged;
-
- if (0 == rAlt1.getLength() && bAllowDuplicates)
- aMerged = rAlt2;
- else if (0 == rAlt2.getLength() && bAllowDuplicates)
- aMerged = rAlt1;
- else
- {
- INT32 nAltCount1 = rAlt1.getLength();
- const OUString *pAlt1 = rAlt1.getConstArray();
- INT32 nAltCount2 = rAlt2.getLength();
- const OUString *pAlt2 = rAlt2.getConstArray();
-
- INT32 nCountNew = Min( nAltCount1 + nAltCount2, (INT32) MAX_PROPOSALS );
- aMerged.realloc( nCountNew );
- OUString *pMerged = aMerged.getArray();
-
- INT32 nIndex = 0;
- INT32 i = 0;
- for (int j = 0; j < 2; j++)
- {
- INT32 nCount = j == 0 ? nAltCount1 : nAltCount2;
- const OUString *pAlt = j == 0 ? pAlt1 : pAlt2;
- for (i = 0; i < nCount && nIndex < MAX_PROPOSALS; i++)
- {
- if (pAlt[i].getLength() &&
- (bAllowDuplicates || !SeqHasEntry(aMerged, pAlt[i] )))
- pMerged[ nIndex++ ] = pAlt[ i ];
- }
- }
- //DBG_ASSERT(nIndex == nCountNew, "wrong number of proposals");
- aMerged.realloc( nIndex );
- }
-
- return aMerged;
-}
-
-///////////////////////////////////////////////////////////////////////////
-
-
-SpellAlternatives::SpellAlternatives()
-{
- nLanguage = LANGUAGE_NONE;
- nType = SpellFailure::IS_NEGATIVE_WORD;
-}
-
-
-SpellAlternatives::SpellAlternatives(
- const OUString &rWord, INT16 nLang,
- INT16 nFailureType, const OUString &rRplcWord ) :
- aWord (rWord),
- nLanguage (nLang),
- nType (nFailureType),
- aAlt ( Sequence< OUString >(1) )
-{
- if (rRplcWord.getLength())
- aAlt.getArray()[ 0 ] = rRplcWord;
- else
- aAlt.realloc( 0 );
-}
-
-
-SpellAlternatives::SpellAlternatives(
- const OUString &rWord, INT16 nLang, INT16 nFailureType,
- const Sequence< OUString > &rAlternatives ) :
- aWord (rWord),
- nLanguage (nLang),
- nType (nFailureType),
- aAlt (rAlternatives)
-{
-}
-
-
-SpellAlternatives::~SpellAlternatives()
-{
-}
-
-
-OUString SAL_CALL SpellAlternatives::getWord()
- throw(RuntimeException)
-{
- MutexGuard aGuard( GetLinguMutex() );
- return aWord;
-}
-
-
-Locale SAL_CALL SpellAlternatives::getLocale()
- throw(RuntimeException)
-{
- MutexGuard aGuard( GetLinguMutex() );
- return CreateLocale( nLanguage );
-}
-
-
-sal_Int16 SAL_CALL SpellAlternatives::getFailureType()
- throw(RuntimeException)
-{
- MutexGuard aGuard( GetLinguMutex() );
- return nType;
-}
-
-
-sal_Int16 SAL_CALL SpellAlternatives::getAlternativesCount()
- throw(RuntimeException)
-{
- MutexGuard aGuard( GetLinguMutex() );
- return (INT16) aAlt.getLength();
-}
-
-
-Sequence< OUString > SAL_CALL SpellAlternatives::getAlternatives()
- throw(RuntimeException)
-{
- MutexGuard aGuard( GetLinguMutex() );
- return aAlt;
-}
-
-
-void SpellAlternatives::SetWordLanguage(const OUString &rWord, INT16 nLang)
-{
- MutexGuard aGuard( GetLinguMutex() );
- aWord = rWord;
- nLanguage = nLang;
-}
-
-
-void SpellAlternatives::SetFailureType(INT16 nTypeP)
-{
- MutexGuard aGuard( GetLinguMutex() );
- nType = nTypeP;
-}
-
-
-void SpellAlternatives::SetAlternatives( const Sequence< OUString > &rAlt )
-{
- MutexGuard aGuard( GetLinguMutex() );
- aAlt = rAlt;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-
-} // namespace linguistic
-
diff --git a/lingucomponent/source/spellcheck/spell/spelldta.hxx b/lingucomponent/source/spellcheck/spell/spelldta.hxx
deleted file mode 100644
index ebe0a426fb71..000000000000
--- a/lingucomponent/source/spellcheck/spell/spelldta.hxx
+++ /dev/null
@@ -1,134 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: spelldta.hxx,v $
- * $Revision: 1.6 $
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef _LINGUISTIC_SPELLDTA_HXX_
-#define _LINGUISTIC_SPELLDTA_HXX_
-
-
-#include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
-
-#include <tools/solar.h>
-
-#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
-#include <cppuhelper/implbase1.hxx> // helper for implementations
-
-namespace com { namespace sun { namespace star {
- namespace linguistic2 {
- class XDictionaryList;
- }
-} } }
-
-
-namespace linguistic
-{
-
-///////////////////////////////////////////////////////////////////////////
-
-::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellAlternatives >
- MergeProposals(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellAlternatives > &rxAlt1,
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XSpellAlternatives > &rxAlt2 );
-
-::com::sun::star::uno::Sequence< ::rtl::OUString >
- MergeProposalSeqs(
- ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlt1,
- ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlt2,
- BOOL bAllowDuplicates );
-
-void SeqRemoveNegEntries(
- ::com::sun::star::uno::Sequence< ::rtl::OUString > &rSeq,
- ::com::sun::star::uno::Reference<
- ::com::sun::star::linguistic2::XDictionaryList > &rxDicList,
- INT16 nLanguage );
-
-BOOL SeqHasEntry(
- const ::com::sun::star::uno::Sequence< ::rtl::OUString > &rSeq,
- const ::rtl::OUString &rTxt);
-
-///////////////////////////////////////////////////////////////////////////
-
-
-class SpellAlternatives :
- public cppu::WeakImplHelper1
- <
- ::com::sun::star::linguistic2::XSpellAlternatives
- >
-{
- ::com::sun::star::uno::Sequence< ::rtl::OUString > aAlt; // list of alternatives, may be empty.
- ::rtl::OUString aWord;
- INT16 nType; // type of failure
- INT16 nLanguage;
-
- // disallow copy-constructor and assignment-operator for now
- SpellAlternatives(const SpellAlternatives &);
- SpellAlternatives & operator = (const SpellAlternatives &);
-
-public:
- SpellAlternatives();
- SpellAlternatives(const ::rtl::OUString &rWord, INT16 nLang, INT16 nFailureType,
- const ::rtl::OUString &rRplcWord );
- SpellAlternatives(const ::rtl::OUString &rWord, INT16 nLang, INT16 nFailureType,
- const ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlternatives );
- virtual ~SpellAlternatives();
-
- // XSpellAlternatives
- virtual ::rtl::OUString SAL_CALL
- getWord()
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::lang::Locale SAL_CALL
- getLocale()
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL
- getFailureType()
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL
- getAlternativesCount()
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
- getAlternatives()
- throw(::com::sun::star::uno::RuntimeException);
-
- // non-interface specific functions
- void SetWordLanguage(const ::rtl::OUString &rWord, INT16 nLang);
- void SetFailureType(INT16 nTypeP);
- void SetAlternatives(
- const ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlt );
-};
-
-
-///////////////////////////////////////////////////////////////////////////
-
-} // namespace linguistic
-
-#endif
-
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index ecc68f652307..02de8841b3ef 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -48,7 +48,7 @@
#endif
#include <linguistic/lngprops.hxx>
-#include "spelldta.hxx"
+#include <linguistic/spelldta.hxx>
#include <i18npool/mslangid.hxx>
#include <svtools/pathoptions.hxx>
#include <svtools/lingucfg.hxx>