New support files for Hunspell support. Only autotools for now.

Hunspell is not used yet, don't try it.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30527 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2009-07-12 22:46:01 +00:00
parent 8c2d81bc34
commit 97a33c4f51
4 changed files with 175 additions and 22 deletions

View File

@ -7,7 +7,7 @@ AC_DEFUN([CHECK_WITH_ASPELL],
test "$with_aspell" = "no" && lyx_use_aspell=false
if $lyx_use_aspell ; then
AC_CHECK_HEADERS(aspell.h aspell/aspell.h,
AC_CHECK_HEADERS(aspell.h,
[lyx_use_aspell=true; break;],
[lyx_use_aspell=false])
AC_CHECK_LIB(aspell, new_aspell_config, LIBS="-laspell $LIBS", lyx_use_aspell=false)
@ -23,12 +23,40 @@ AC_DEFUN([CHECK_WITH_ASPELL],
fi
])
# Macro to add for using hunspell spellchecker libraries! -*- sh -*-
AC_DEFUN([CHECK_WITH_HUNSPELL],
[
lyx_use_hunspell=true
AC_ARG_WITH(hunspell, AC_HELP_STRING([--with-hunspell],[use Hunspell libraries]))
test "$with_hunspell" = "no" && lyx_use_hunspell=false
### Check if we want spell libraries, prefer new aspell
if $lyx_use_hunspell ; then
AC_CHECK_HEADERS(hunspell/hunspell.hxx,
[lyx_use_hunspell=true; break;],
[lyx_use_hunspell=false])
AC_CHECK_LIB(hunspell, main, LIBS="-lhunspell $LIBS", lyx_use_hunspell=false)
AC_MSG_CHECKING([whether to use hunspell])
if $lyx_use_hunspell ; then
AC_MSG_RESULT(yes)
AC_DEFINE(USE_HUNSPELL, 1, [Define as 1 to use the hunspell library])
lyx_flags="$lyx_flags use-hunspell"
else
AC_MSG_RESULT(no)
fi
fi
])
### Check if we want spell libraries, prefer new aspell or hunspell
AC_DEFUN([LYX_CHECK_SPELL_ENGINES],
[
lyx_use_aspell=false
CHECK_WITH_ASPELL
AM_CONDITIONAL(USE_ASPELL, $lyx_use_aspell)
lyx_use_hunspell=false
CHECK_WITH_HUNSPELL
AM_CONDITIONAL(USE_HUNSPELL, $lyx_use_hunspell)
])

View File

@ -0,0 +1,80 @@
/**
* \file HunspellSpellChecker.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Abdelrazak Younes
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "HunspellSpellChecker.h"
#include "LyXRC.h"
#include "WordLangTuple.h"
#include "support/lassert.h"
#include "support/debug.h"
#include <hunspell/hunspell.hxx>
#include <map>
#include <string>
using namespace std;
namespace lyx {
namespace {
typedef map<std::string, Hunspell *> Spellers;
}
class HunspellSpellChecker::Private
{
/// the spellers
Spellers spellers_;
};
HunspellSpellChecker::HunspellSpellChecker(): d(new Private)
{
}
HunspellSpellChecker::~HunspellSpellChecker()
{
delete d;
}
SpellChecker::Result HunspellSpellChecker::check(WordLangTuple const & word)
{
return OK;
}
void HunspellSpellChecker::insert(WordLangTuple const & word)
{
}
void HunspellSpellChecker::accept(WordLangTuple const & word)
{
}
docstring const HunspellSpellChecker::nextMiss()
{
return docstring();
}
docstring const HunspellSpellChecker::error()
{
return docstring();
}
} // namespace lyx

View File

@ -0,0 +1,40 @@
// -*- C++ -*-
/**
* \file HunspellSpellChecker.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Abdelrazak Younes
*
* Full author contact details are available in file CREDITS.
*/
#ifndef LYX_HUNSPELL_H
#define LYX_HUNSPELL_H
#include "SpellChecker.h"
namespace lyx {
class HunspellSpellChecker : public SpellChecker
{
public:
HunspellSpellChecker();
~HunspellSpellChecker();
SpellChecker::Result check(WordLangTuple const &);
void insert(WordLangTuple const &);
void accept(WordLangTuple const &);
docstring const nextMiss();
docstring const error();
private:
struct Private;
Private * d;
};
} // namespace lyx
#endif // LYX_Hunspell_H

View File

@ -52,6 +52,10 @@ if USE_ASPELL
ASPELL = ASpell.cpp ASpell_local.h
endif
if USE_HUNSPELL
HUNSPELL = HunspellSpellChecker.cpp HunspellSpellChecker.h
endif
# These four objects are linked as object files as they are not
# referenced within the core and therefore are not picked up
# by the linker without looping over libs. We do not want that,
@ -65,6 +69,7 @@ lyx_SOURCES = \
Box.h \
Dimension.cpp \
Dimension.h \
$(HUNSPELL) \
PrinterParams.cpp \
PrinterParams.h \
Thesaurus.cpp \