]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlThesaurus.h
removed most uses of toupper and friends, removed <config.h> from headers and added...
[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
20 #include "LString.h"
21 #include "Thesaurus.h"
22 #include "ControlDialogs.h"
23
24 /** A controller for Thesaurus dialogs.
25  */
26 class ControlThesaurus : public ControlDialog<ControlConnectBD> {
27 public:
28         ///
29         ControlThesaurus(LyXView &, Dialogs &);
30  
31         /// replace the particular string
32         void replace(string const & newstr);
33
34         /// show dialog
35         virtual void showEntry(string const & str);
36
37         /// get noun entries
38         std::vector<string> getNouns(string const & str) {
39                 return getEntries(str, Thesaurus::NOUN);
40         }
41         /// get verb entries
42         std::vector<string> getVerbs(string const & str) {
43                 return getEntries(str, Thesaurus::VERB);
44         }
45         /// get adjective entries
46         std::vector<string> getAdjectives(string const & str) {
47                 return getEntries(str, Thesaurus::ADJECTIVE);
48         }
49         /// get adverb entries
50         std::vector<string> getAdverbs(string const & str) {
51                 return getEntries(str, Thesaurus::ADVERB);
52         }
53         /// get other entries
54         std::vector<string> getOthers(string const & str) {
55                 return getEntries(str, Thesaurus::OTHER);
56         }
57
58         /// the text
59         string const & text() {
60                 return oldstr_;
61         }
62
63 private:
64         /// get entries for a str
65         std::vector<string> getEntries(string const & str, Thesaurus::POS pos);
66
67         /// last string looked up
68         string laststr_;
69
70         /// entries for last string
71         std::vector<Thesaurus::ThesaurusEntry> entries_;
72
73         /// original string
74         string oldstr_;
75
76         /// not needed.
77         virtual void apply() {}
78 };
79
80 #endif // CONTROLTHESAURUS_H