/*
 * gspellchecker.h
 * This file is part of glib
 *
 * Copyright (C) 2006 Paolo Maggi
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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 for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

/*
 * Modified by the GLib Team and others 2006.  See the AUTHORS
 * file for a list of people on the GLib Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
 * GLib at ftp://ftp.gtk.org/pub/gtk/. 
 */

#ifndef __G_SPELL_CHECKER_H__
#define __G_SPELL_CHECKER_H__

#include <glib.h>
#include <glib-object.h>

#include <gspell/gspellcheckerlanguage.h>

G_BEGIN_DECLS

#define G_TYPE_SPELL_CHECKER            (g_spell_checker_get_type ())
#define G_SPELL_CHECKER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_SPELL_CHECKER, GSpellChecker))
#define G_SPELL_CHECKER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), G_TYPE_SPELL_CHECKER, GSpellChecker))
#define G_IS_SPELL_CHECKER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_SPELL_CHECKER))
#define G_IS_SPELL_CHECKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_SPELL_CHECKER))
#define G_SPELL_CHECKER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_SPELL_CHECKER, GSpellChecker))

typedef struct _GSpellChecker GSpellChecker;

typedef struct _GSpellCheckerClass GSpellCheckerClass;

struct _GSpellCheckerClass 
{
  GObjectClass parent_class;

  /*< public > */
  /* Signals */
  void (* added_to_pwl)     (GSpellChecker               *checker,
                              const gchar                 *word, 
                              gssize                       len);

  void (* added_to_session)  (GSpellChecker               *checker,
                              const gchar                 *word,
                              gssize                       len);

  void (* set_language)      (GSpellChecker               *checker,
                              const GSpellCheckerLanguage *language);

  void ( * session_cleared)  (GSpellChecker               *checker,);

  /*< private > */
  /* Padding for future expansion */
  gpointer pdummy[4];
};

GType                        g_spell_checker_get_type             (void) G_GNUC_CONST;
GSpellChecker               *g_spell_checker_new                  (void);

gboolean                     g_spell_checker_set_language         (GSpellChecker                *checker,
                                                                   const GSpellCheckerLanguage  *lang);

const GSpellCheckerLanguage *g_spell_checker_get_language         (GSpellChecker                *checker);

/* TODO: do we need other properties like ignore-numbers, ignore-all-caps, ignome-urls, etc. ? */

gboolean                     g_spell_checker_check_word           (GSpellChecker                *checker,
                                                                   const gchar                  *word,
                                                                   gssize                        len,
                                                                   GError                      **error);

GSList                      *g_spell_checker_get_suggestions      (GSpellChecker                *checker,
                                                                   const gchar                  *word,
                                                                   gssize                        len,
                                                                   GError                      **error);

void                         g_spell_checker_store_replacement    (GSpellChecker                *checker,
                                                                   const gchar                  *word,
                                                                   gssize                        w_len,
                                                                   const gchar                  *replacement, 
                                                                   gssize                        r_len,
                                                                   GError                      **error);                                                                   
/* Session management */
void                         g_spell_checker_add_word_to_session  (GSpellChecker                *checker,
                                                                   const gchar                  *word,
                                                                   gssize                        len,                                                                   
                                                                   GError                      **error);

gboolean                     g_spell_checker_word_is_in_session   (GSpellChecker                *checker,
                                                                   const gchar                  *word,
                                                                   gssize                        len,                                                                   
                                                                   GError                      **error);

void                         g_spell_checker_clear_session        (GSpellChecker                *checker,
                                                                   GError                      **error);

/* Personal word list (pwl) management */                                                                   
void                         g_spell_checker_add_word_to_pwl      (GSpellChecker                *checker,
                                                                   const gchar                  *word,
                                                                   gssize                        len,                                                                   
                                                                   GError                      **error);

gboolean                     g_spell_checker_word_is_in_pwl       (GSpellChecker                *checker,
                                                                   const gchar                  *word,
                                                                   gssize                        len,                                                                   
                                                                   GError                      **error);

gboolean                     g_spell_checker_remove_word_from_pwl (GSpellChecker                *checker,
                                                                   const gchar                  *word,
                                                                   gssize                        len,                                                                   
                                                                   GError                      **error);

GSList                      *g_spell_checker_list_pwl             (GSpellChecker                *checker,
                                                                   GError                      **error);

void                         g_spell_checker_clear_pwl            (GSpellChecker                *checker,
                                                                   GError                      **error);

G_END_DECLS

#endif /* __G_SPELL_CHECKER_H__ */
