]> git.lyx.org Git - lyx.git/blob - src/insets/insetcharstyle.h
Introduce wide streams. This fixes the remaining problems of plain text
[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(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         virtual lyx::docstring 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         bool forceDefaultParagraphs(idx_type) const { return true; }
73         ///
74         int latex(Buffer const &, std::ostream &,
75                   OutputParams const &) const;
76         ///
77         int docbook(Buffer const &, std::ostream &,
78                     OutputParams const &) const;
79         ///
80         int plaintext(Buffer const &, lyx::odocstream &,
81                   OutputParams const &) const;
82         /// the string that is passed to the TOC
83         virtual int textString(Buffer const &, lyx::odocstream &,
84                 OutputParams const &) const;
85         ///
86         void validate(LaTeXFeatures &) const;
87
88         ///
89         InsetCharStyleParams const & params() const { return params_; }
90
91         /// should paragraph indendation be ommitted in any case?
92         bool neverIndent() const { return true; }
93
94 protected:
95         InsetCharStyle(InsetCharStyle const &);
96         virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
97         ///
98         bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
99
100 private:
101         friend class InsetCharStyleParams;
102
103         virtual std::auto_ptr<InsetBase> doClone() const;
104
105         /// used by the constructors
106         void init();
107         ///
108         InsetCharStyleParams params_;
109         ///
110         bool has_label_;
111 };
112
113 #endif