]> git.lyx.org Git - lyx.git/blob - src/insets/insetcharstyle.h
implement getStatus in charstyle and ERT / insetcharstyle drawing improvements
[lyx.git] / src / insets / insetcharstyle.h
1 // -*- C++ -*-
2 /**
3  * \file insetcharstyle.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  * \author Martin Vermeer
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef INSETCHARSTYLE_H
14 #define INSETCHARSTYLE_H
15
16 #include "insetcollapsable.h"
17 #include "lyxtextclass.h"
18
19
20 struct InsetCharStyleParams {
21         ///
22         void write(std::ostream & os) const;
23         ///
24         void read(LyXLex & lex);
25         ///
26         std::string type;
27         ///
28         std::string latextype;
29         ///
30         std::string latexname;
31         ///
32         std::string latexparam;
33         ///
34         LyXFont font;
35         ///
36         LyXFont labelfont;
37 };
38
39
40 /** The CharStyle inset, also XML short element
41
42 */
43 class InsetCharStyle : public InsetCollapsable {
44 public:
45         ///
46         InsetCharStyle(BufferParams const &, CharStyles::iterator);
47         /// Copy constructor
48         InsetCharStyle(InsetCharStyle const &);
49         ///
50         virtual std::auto_ptr<InsetBase> clone() const;
51         ///
52         std::string const editMessage() const;
53         ///
54         InsetOld::Code lyxCode() const { return InsetOld::CHARSTYLE_CODE; }
55         ///
56         void write(Buffer const &, std::ostream &) const;
57         ///
58         void read(Buffer const & buf, LyXLex & lex);
59         ///
60         void metrics(MetricsInfo &, Dimension &) const;
61         ///
62         void draw(PainterInfo &, int, int) const;
63         ///
64         void getDrawFont(LyXFont &) const;
65         ///
66         int latex(Buffer const &, std::ostream &,
67                   OutputParams const &) const;
68         ///
69         int linuxdoc(Buffer const &, std::ostream &,
70                      OutputParams const &) const;
71         ///
72         int docbook(Buffer const &, std::ostream &,
73                     OutputParams const &) const;
74         ///
75         int plaintext(Buffer const &, std::ostream &,
76                   OutputParams const &) const;
77         ///
78         void validate(LaTeXFeatures &) const;
79
80         ///
81         InsetCharStyleParams const & params() const { return params_; }
82
83 protected:
84         ///
85         virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
86         ///
87         bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
88
89 private:
90         ///
91         friend class InsetCharStyleParams;
92
93         /// used by the constructors
94         void init();
95         ///
96         InsetCharStyleParams params_;
97         ///
98         bool has_label_;
99 };
100
101 #endif