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