]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlThesaurus.h
John's character.C patch (bug fix).
[lyx.git] / src / frontends / controllers / ControlThesaurus.h
1 // -*- C++ -*-
2 /**
3  * \file ControlThesaurus.h
4  * Copyright 2001 the LyX Team
5  * Read the file COPYING
6  *
7  * \author John Levon
8  */
9
10
11 #ifndef CONTROLTHESAURUS_H
12 #define CONTROLTHESAURUS_H
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include <vector>
19 #include <config.h>
20
21 #include "LString.h"
22 #include "Thesaurus.h"
23 #include "ControlDialogs.h"
24
25 /** A controller for Thesaurus dialogs.
26  */
27 class ControlThesaurus : public ControlDialog<ControlConnectBD> {
28 public:
29         ///
30         ControlThesaurus(LyXView &, Dialogs &);
31  
32         /// replace the particular string
33         void replace(string const & newstr);
34
35         /// show dialog
36         virtual void showEntry(string const & str);
37
38         /// get noun entries
39         std::vector<string> getNouns(string const & str) {
40                 return getEntries(str, Thesaurus::NOUN);
41         }
42         /// get verb entries
43         std::vector<string> getVerbs(string const & str) {
44                 return getEntries(str, Thesaurus::VERB);
45         }
46         /// get adjective entries
47         std::vector<string> getAdjectives(string const & str) {
48                 return getEntries(str, Thesaurus::ADJECTIVE);
49         }
50         /// get adverb entries
51         std::vector<string> getAdverbs(string const & str) {
52                 return getEntries(str, Thesaurus::ADVERB);
53         }
54         /// get other entries
55         std::vector<string> getOthers(string const & str) {
56                 return getEntries(str, Thesaurus::OTHER);
57         }
58
59         /// the text
60         string const & text() {
61                 return oldstr_;
62         }
63
64 private:
65         /// get entries for a str
66         std::vector<string> getEntries(string const & str, Thesaurus::POS pos);
67
68         /// last string looked up
69         string laststr_;
70
71         /// entries for last string
72         std::vector<Thesaurus::ThesaurusEntry> entries_;
73
74         /// original string
75         string oldstr_;
76
77         /// not needed.
78         virtual void apply() {}
79 };
80
81 #endif // CONTROLTHESAURUS_H