]> git.lyx.org Git - lyx.git/blob - src/insets/insetcharstyle.h
implement and use virtual bool neverIndent() (thereby fixing bug 2003)
[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
40
41 /** The CharStyle inset, also XML short element
42
43 */
44 class InsetCharStyle : public InsetCollapsable {
45 public:
46         /// Construct an undefined character style
47         InsetCharStyle::InsetCharStyle(BufferParams const &, std::string const);
48         ///
49         InsetCharStyle(BufferParams const &, CharStyles::iterator);
50         /// Is this character style defined in the document's textclass?
51         /// May be wrong after textclass change or paste from another document
52         bool undefined() const;
53         /// Set the character style to "undefined"
54         void setUndefined();
55         /// (Re-)set the character style parameters from \p cs
56         void setDefined(CharStyles::iterator cs);
57         ///
58         std::string const editMessage() const;
59         ///
60         InsetBase::Code lyxCode() const { return InsetBase::CHARSTYLE_CODE; }
61         ///
62         void write(Buffer const &, std::ostream &) const;
63         ///
64         void read(Buffer const & buf, LyXLex & lex);
65         ///
66         void metrics(MetricsInfo &, Dimension &) const;
67         ///
68         void draw(PainterInfo &, int, int) const;
69         ///
70         void getDrawFont(LyXFont &) const;
71         ///
72         int latex(Buffer const &, std::ostream &,
73                   OutputParams const &) const;
74         ///
75         int linuxdoc(Buffer const &, std::ostream &,
76                      OutputParams const &) const;
77         ///
78         int docbook(Buffer const &, std::ostream &,
79                     OutputParams const &) const;
80         ///
81         int plaintext(Buffer const &, std::ostream &,
82                   OutputParams const &) const;
83         ///
84         void validate(LaTeXFeatures &) const;
85
86         ///
87         InsetCharStyleParams const & params() const { return params_; }
88
89         /// should paragraph indendation be ommitted in any case?
90         bool neverIndent() const { return true; }
91
92 protected:
93         InsetCharStyle(InsetCharStyle const &);
94         virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
95         ///
96         bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
97
98 private:
99         friend class InsetCharStyleParams;
100
101         virtual std::auto_ptr<InsetBase> doClone() const;
102
103         /// used by the constructors
104         void init();
105         ///
106         InsetCharStyleParams params_;
107         ///
108         bool has_label_;
109 };
110
111 #endif