]> git.lyx.org Git - lyx.git/blob - src/insets/insetcharstyle.h
hopefully fix tex2lyx linking.
[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 namespace lyx {
21
22
23 class InsetCharStyleParams {
24 public:
25         ///
26         void write(std::ostream & os) const;
27         ///
28         void read(LyXLex & lex);
29         ///
30         std::string type;
31         ///
32         std::string latextype;
33         ///
34         std::string latexname;
35         ///
36         std::string latexparam;
37         ///
38         LyXFont font;
39         ///
40         LyXFont labelfont;
41         ///
42         bool show_label;
43 };
44
45
46 /** The CharStyle inset, also XML short element
47
48 */
49 class InsetCharStyle : public InsetCollapsable {
50 public:
51         /// Construct an undefined character style
52         InsetCharStyle(BufferParams const &, std::string const);
53         ///
54         InsetCharStyle(BufferParams const &, CharStyles::iterator);
55         /// Is this character style defined in the document's textclass?
56         /// May be wrong after textclass change or paste from another document
57         bool undefined() const;
58         /// Set the character style to "undefined"
59         void setUndefined();
60         /// (Re-)set the character style parameters from \p cs
61         void setDefined(CharStyles::iterator cs);
62         ///
63         virtual docstring const editMessage() const;
64         ///
65         InsetBase::Code lyxCode() const { return InsetBase::CHARSTYLE_CODE; }
66         ///
67         void write(Buffer const &, std::ostream &) const;
68         ///
69         void read(Buffer const & buf, LyXLex & lex);
70         ///
71         void metrics(MetricsInfo &, Dimension &) const;
72         ///
73         void draw(PainterInfo &, int, int) const;
74         ///
75         void getDrawFont(LyXFont &) const;
76         ///
77         bool forceDefaultParagraphs(idx_type) const { return true; }
78         ///
79         int latex(Buffer const &, odocstream &,
80                   OutputParams const &) const;
81         ///
82         int docbook(Buffer const &, odocstream &,
83                     OutputParams const &) const;
84         ///
85         int plaintext(Buffer const &, odocstream &,
86                   OutputParams const &) const;
87         /// the string that is passed to the TOC
88         virtual int textString(Buffer const &, odocstream &,
89                 OutputParams const &) const;
90         ///
91         void validate(LaTeXFeatures &) const;
92
93         ///
94         InsetCharStyleParams const & params() const { return params_; }
95
96         /// should paragraph indendation be ommitted in any case?
97         bool neverIndent(Buffer const &) const { return true; }
98
99 protected:
100         InsetCharStyle(InsetCharStyle const &);
101         virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
102         ///
103         bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
104
105 private:
106         friend class InsetCharStyleParams;
107
108         virtual std::auto_ptr<InsetBase> doClone() const;
109
110         /// used by the constructors
111         void init();
112         ///
113         InsetCharStyleParams params_;
114 };
115
116
117 } // namespace lyx
118
119 #endif