]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiMath.h
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[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
21
22 namespace lyx {
23 namespace frontend {
24
25 struct MathSymbol {
26         MathSymbol(char_type uc = '?', unsigned char fc = 0,
27                 FontFamily ff = SYMBOL_FAMILY)
28                 : unicode(uc), fontcode(fc), fontfamily(ff)
29         {}
30         char_type unicode;
31         unsigned char fontcode;
32         FontFamily fontfamily;
33 };
34
35
36 class GuiMath : public GuiDialog
37 {
38 public:
39         GuiMath(GuiView & lv, QString const & name, QString const & title);
40
41         /// Nothing to initialise in this case.
42         bool initialiseParams(std::string const &) { return true; }
43         void clearParams() {}
44         void dispatchParams() {}
45         bool isBufferDependent() const { return true; }
46
47         /// dispatch an LFUN
48         void dispatchFunc(FuncCode action,
49                 std::string const & arg = std::string()) const;
50         /// Insert a math symbol into the doc.
51         void dispatchInsert(std::string const & name) const;
52         /// Insert a subscript.
53         void dispatchSubscript() const;
54         /// Insert a superscript.
55         void dispatchSuperscript() const;
56         /// Insert a cube root
57         void dispatchCubeRoot() const;
58         /// Insert a matrix
59         void dispatchMatrix(std::string const & str) const;
60         /// Insert a variable size delimiter
61         void dispatchDelim(std::string const & str) const;
62         /// Insert a big delimiter
63         void dispatchBigDelim(std::string const & str) const;
64         /// Switch between display and inline
65         void dispatchToggleDisplay() const;
66         /** A request to the kernel to launch a dialog.
67          *  \param name the dialog identifier.
68          */
69         void showDialog(std::string const & name) const;
70
71         /// \return the math unicode symbol associated to a TeX name.
72         MathSymbol const & mathSymbol(std::string tex_name) const;
73         /// \return the TeX name associated to a math unicode symbol.
74         std::string const & texName(char_type math_symbol) const;
75
76 private:
77         /// TeX-name / Math-symbol map.
78         std::map<std::string, MathSymbol> math_symbols_;
79         /// Math-symbol / TeX-name map.
80         /// This one is for fast search, it contains the same data as
81         /// \c math_symbols_.
82         std::map<char_type, std::string> tex_names_;
83 };
84
85
86 } // namespace frontend
87 } // namespace lyx
88
89 #endif // GUIMATH_H