]> git.lyx.org Git - lyx.git/blob - src/insets/InsetFlex.h
139ca4c4d66d403df2c2b2e4f43463efbe08e090
[lyx.git] / src / insets / InsetFlex.h
1 // -*- C++ -*-
2 /**
3  * \file InsetFlex.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 INSETFLEX_H
14 #define INSETFLEX_H
15
16 #include "InsetCollapsable.h"
17 #include "TextClass.h"
18
19
20 namespace lyx {
21
22
23 class InsetFlexParams {
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 Flex inset, e.g., CharStyle, Custom inset or XML short element
35
36 */
37 class InsetFlex : public InsetCollapsable {
38 public:
39         ///
40         InsetFlex(BufferParams const &, InsetLayout const &);
41         ///
42         docstring name() const { return from_ascii("Flex"); }
43         ///
44         InsetLayout const & getLayout(BufferParams const &) const
45         { return *layout_; } 
46         /// Is this character style defined in the document's textclass?
47         /// May be wrong after textclass change or paste from another document
48         bool undefined() const;
49         /// (Re-)set the character style parameters from \p il
50         void setLayout(InsetLayout const & il);
51         ///
52         virtual docstring const editMessage() const;
53         ///
54         InsetCode lyxCode() const { return FLEX_CODE; }
55         ///
56         void write(Buffer const &, std::ostream &) const;
57         ///
58         void read(Buffer const & buf, Lexer & lex);
59         ///
60         bool forceDefaultParagraphs(idx_type) const { return true; }
61
62         ///
63         int plaintext(Buffer const &, odocstream &,
64                       OutputParams const &) const;
65         ///
66         int docbook(Buffer const &, odocstream &,
67                     OutputParams const &) const;
68         /// the string that is passed to the TOC
69         virtual void textString(Buffer const &, odocstream &) const;
70
71         ///
72         InsetFlexParams const & params() const { return params_; }
73
74         /// should paragraph indendation be ommitted in any case?
75         bool neverIndent(Buffer const &) const { return true; }
76
77 protected:
78         InsetFlex(InsetFlex const &);
79
80 private:
81         friend class InsetFlexParams;
82
83         virtual Inset * clone() const;
84
85         ///
86         InsetFlexParams params_;
87 };
88
89
90 } // namespace lyx
91
92 #endif