aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lgghunspell_wrapper.h
blob: 4d07ff87bca677ba873c253aeb6358ea340f40eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* Copyright (C) 2009 LordGregGreg Back

   This 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.1 of
   the License, or (at your option) any later version.
 
   This 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 General Public
   License for more details.
 
   You should have received a copy of the GNU Lesser General Public
   License along with the viewer; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.  */

#ifndef ASPELL_WRAPPER
#define ASPELL_WRAPPER 1

#if LL_WINDOWS
#include "hunspell/hunspelldll.h"
#else
#include "hunspell/hunspell.hxx"
#endif

class lggHunSpell_Wrapper
{

public:
	static Hunspell* myHunspell;

	BOOL mSpellCheckHighlight;

	static void initSettings();
	void processSettings();

	std::vector<std::string> getAvailDicts();
	std::vector<std::string> getInstalledDicts();
	std::vector<std::string> getDicts();
	std::vector<std::string> getExtraDicts();
	void addDictionary(std::string additionalDictionary);
	void addWordToCustomDictionary(std::string wordToAdd);
	void addButton(std::string selection);
	void removeButton(std::string selection);
	void editCustomButton();
	void newDictSelection(std::string selection);
	void getMoreButton(void * data);
	static std::string dictName2FullName(std::string dictName);
	static std::string fullName2DictName(std::string fullName);
	void setNewDictionary(std::string newDict);
	void setNewHighlightSetting(BOOL highlight);
	BOOL isSpelledRight(std::string wordToCheck);
	std::vector<std::string> getSuggestionList(std::string badWord);
	S32 findNextError(std::string haystack, int startAt);

	std::vector<std::string> CSV2VEC(std::string csv);
	std::string VEC2CSV(std::vector<std::string> vec);

private:
	void createCustomDic();
	std::string getCorrectPath(std::string file);
	lggHunSpell_Wrapper();
	~lggHunSpell_Wrapper();

	void debugTest(std::string testWord);//prints out debug about testing the word
	std::string currentBaseDic;
	//std::vector<std::string> languageCodes;
	//std::vector<std::string> countryCodes;
};

extern lggHunSpell_Wrapper* glggHunSpell; // the singleton hunspell wrapper

#endif