]> git.lyx.org Git - lyx.git/blob - src/insets/InsetBox.h
Do not check again and again for non existing files
[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         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 neverIndent() const { return true; }
127         ///
128         bool inheritFont() const { return false; }
129         ///
130         void latex(otexstream &, OutputParams const &) const;
131         ///
132         int plaintext(odocstringstream & ods, OutputParams const & op,
133                       size_t max_length = INT_MAX) const;
134         ///
135         int docbook(odocstream &, OutputParams const &) const;
136         ///
137         docstring xhtml(XHTMLStream &, OutputParams const &) const;
138         ///
139         void validate(LaTeXFeatures &) const;
140         ///
141         bool hasFixedWidth() const;
142         ///
143         std::string contextMenuName() const;
144         //@}
145
146         /// \name Public functions inherited from InsetCollapsible class
147         //@{
148         ///
149         void setButtonLabel();
150         //@}
151
152 protected:
153         /// \name Protected functions inherited from Inset class
154         //@{
155         ///
156         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
157         ///
158         void doDispatch(Cursor & cur, FuncRequest & cmd);
159         ///
160         Inset * clone() const { return new InsetBox(*this); }
161         //@}
162
163 private:
164         /// used by the constructors
165         void init();
166
167         ///
168         friend class InsetBoxParams;
169         InsetBoxParams params_;
170 };
171
172 } // namespace lyx
173
174 #endif // INSETBOX_H