]> git.lyx.org Git - lyx.git/blob - src/insets/InsetBox.h
Get rid of Qt resources
[lyx.git] / src / insets / InsetBox.h
1 // -*- C++ -*-
2 /**
3  * \file InsetBox.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  * \author Uwe Stöhr
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef INSETBOX_H
15 #define INSETBOX_H
16
17 #include "InsetCollapsible.h"
18 #include "Length.h"
19
20
21 namespace lyx {
22
23 class InsetBoxParams
24 {
25 public:
26         ///
27         explicit InsetBoxParams(std::string const &);
28         ///
29         void write(std::ostream & os) const;
30         ///
31         void read(Lexer & lex);
32
33         ///
34         std::string type;
35         /// Is there a parbox?
36         bool use_parbox;
37         /// Is there a makebox?
38         bool use_makebox;
39         /// Do we have an inner parbox or minipage to format paragraphs to
40         /// columnwidth?
41         bool inner_box;
42         ///
43         Length width;
44         /// "special" widths, see usrguide.dvi §3.5
45         std::string special;
46         ///
47         char pos;
48         ///
49         char hor_pos;
50         ///
51         char inner_pos;
52         ///
53         Length height;
54         ///
55         std::string height_special;
56         ///
57         Length thickness;
58         ///
59         Length separation;
60         ///
61         Length shadowsize;
62         ///
63         std::string framecolor;
64         ///
65         std::string backgroundcolor;
66 };
67
68
69
70 ///////////////////////////////////////////////////////////////////////
71 //
72 // The fbox/fancybox inset
73 //
74 ///////////////////////////////////////////////////////////////////////
75
76
77 class InsetBox : public InsetCollapsible
78 {
79 public:
80         ///
81         enum BoxType {
82                 Frameless,
83                 Boxed,
84                 Framed,
85                 ovalbox,
86                 Ovalbox,
87                 Shadowbox,
88                 Shaded,
89                 Doublebox
90         };
91         ///
92         InsetBox(Buffer *, std::string const &);
93
94         ///
95         static std::string params2string(InsetBoxParams const &);
96         ///
97         static void string2params(std::string const &, InsetBoxParams &);
98         ///
99         InsetBoxParams const & params() const { return params_; }
100
101         /// \name Public functions inherited from Inset class
102         //@{
103         ///
104         InsetCode lyxCode() const { return BOX_CODE; }
105         ///
106         docstring layoutName() const;
107         ///
108         void write(std::ostream &) const;
109         ///
110         void read(Lexer & lex);
111         ///
112         void metrics(MetricsInfo &, Dimension &) const;
113         ///
114         DisplayType display() const { return Inline; }
115         ///
116         ColorCode backgroundColor(PainterInfo const &) const;
117         ///
118         LyXAlignment contentAlignment() const;
119         ///
120         bool allowParagraphCustomization(idx_type = 0) const { return !forcePlainLayout(); }
121         ///
122         bool allowMultiPar() const;
123         ///
124         bool forcePlainLayout(idx_type = 0) const;
125         ///
126         bool needsCProtection(bool const maintext = false,
127                               bool const fragile = false) const;
128         ///
129         bool neverIndent() const { return true; }
130         ///
131         bool inheritFont() const { return false; }
132         ///
133         void latex(otexstream &, OutputParams const &) const;
134         ///
135         int plaintext(odocstringstream & ods, OutputParams const & op,
136                       size_t max_length = INT_MAX) const;
137         ///
138         int docbook(odocstream &, OutputParams const &) const;
139         ///
140         docstring xhtml(XHTMLStream &, OutputParams const &) const;
141         ///
142         void validate(LaTeXFeatures &) const;
143         ///
144         bool hasFixedWidth() const;
145         ///
146         std::string contextMenuName() const;
147         //@}
148
149         /// \name Public functions inherited from InsetCollapsible class
150         //@{
151         ///
152         void setButtonLabel();
153         //@}
154
155 protected:
156         /// \name Protected functions inherited from Inset class
157         //@{
158         ///
159         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
160         ///
161         void doDispatch(Cursor & cur, FuncRequest & cmd);
162         ///
163         Inset * clone() const { return new InsetBox(*this); }
164         //@}
165
166 private:
167         /// used by the constructors
168         void init();
169
170         ///
171         friend class InsetBoxParams;
172         InsetBoxParams params_;
173 };
174
175 } // namespace lyx
176
177 #endif // INSETBOX_H