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