]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiMath.h
b7bbeed53862018f8db80b471a5eb1629ab9d942
[lyx.git] / src / frontends / qt4 / GuiMath.h
1 // -*- C++ -*-
2 /**
3  * \file GuiMath.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef GUIMATH_H
13 #define GUIMATH_H
14
15 #include "GuiDialog.h"
16 #include "FuncCode.h"
17 #include "FontEnums.h"
18
19 #include <map>
20 #include <string>
21
22
23 namespace lyx {
24 namespace frontend {
25
26 struct MathSymbol {
27         MathSymbol(char_type uc = '?', unsigned char fc = 0,
28                 FontFamily ff = SYMBOL_FAMILY)
29                 : unicode(uc), fontcode(fc), fontfamily(ff)
30         {}
31         char_type unicode;
32         unsigned char fontcode;
33         FontFamily fontfamily;
34 };
35
36
37 class GuiMath : public GuiDialog
38 {
39 public:
40         GuiMath(GuiView & lv, QString const & name, QString const & title);
41
42         /// Nothing to initialise in this case.
43         bool initialiseParams(std::string const &) { return true; }
44         void clearParams() {}
45         void dispatchParams() {}
46         bool isBufferDependent() const { return true; }
47
48         /// dispatch an LFUN
49         void dispatchFunc(FuncCode action,
50                 std::string const & arg = std::string()) const;
51
52         /// \return the math unicode symbol associated to a TeX name.
53         MathSymbol const & mathSymbol(std::string tex_name) const;
54         /// \return the TeX name associated to a math unicode symbol.
55         std::string const & texName(char_type math_symbol) const;
56
57 private:
58         /// TeX-name / Math-symbol map.
59         std::map<std::string, MathSymbol> math_symbols_;
60         /// Math-symbol / TeX-name map.
61         /// This one is for fast search, it contains the same data as
62         /// \c math_symbols_.
63         std::map<char_type, std::string> tex_names_;
64 };
65
66
67 } // namespace frontend
68 } // namespace lyx
69
70 #endif // GUIMATH_H