]> git.lyx.org Git - lyx.git/blob - src/insets/InsetBox.h
HTML output code for a handful of easy insets.
[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  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef INSETBOX_H
14 #define INSETBOX_H
15
16 #include "InsetCollapsable.h"
17 #include "Length.h"
18
19
20 namespace lyx {
21
22 class InsetBoxParams
23 {
24 public:
25         ///
26         InsetBoxParams(std::string const &);
27         ///
28         void write(std::ostream & os) const;
29         ///
30         void read(Lexer & lex);
31
32         ///
33         std::string type;
34         /// Use a parbox (true) or minipage (false)
35         bool use_parbox;
36         /// Do we have an inner parbox or minipage to format paragraphs to
37         /// columnwidth?
38         bool inner_box;
39         ///
40         Length width;
41         /// "special" widths, see usrguide.dvi ยง3.5
42         std::string special;
43         ///
44         char pos;
45         ///
46         char hor_pos;
47         ///
48         char inner_pos;
49         ///
50         Length height;
51         ///
52         std::string height_special;
53 };
54
55
56
57 ///////////////////////////////////////////////////////////////////////
58 //
59 // The fbox/fancybox inset
60 //
61 ///////////////////////////////////////////////////////////////////////
62
63
64 class InsetBox : public InsetCollapsable
65 {
66 public:
67         ///
68         enum BoxType {
69                 Frameless,
70                 Boxed,
71                 Framed,
72                 ovalbox,
73                 Ovalbox,
74                 Shadowbox,
75                 Shaded,
76                 Doublebox
77         };
78         ///
79         InsetBox(Buffer const &, std::string const &);
80         ///
81         ~InsetBox();
82         ///
83         static std::string params2string(InsetBoxParams const &);
84         ///
85         static void string2params(std::string const &, InsetBoxParams &);
86 private:
87         ///
88         friend class InsetBoxParams;
89         ///
90         docstring editMessage() const;
91         ///
92         InsetCode lyxCode() const { return BOX_CODE; }
93         ///
94         docstring name() const;
95         ///
96         void write(std::ostream &) const;
97         ///
98         void read(Lexer & lex);
99         ///
100         void setButtonLabel();
101         ///
102         void metrics(MetricsInfo &, Dimension &) const;
103         /// show the Box dialog
104         bool showInsetDialog(BufferView * bv) const;
105         ///
106         DisplayType display() const { return Inline; }
107         ///
108         bool allowParagraphCustomization(idx_type = 0) const { return !forcePlainLayout(); }
109         ///
110         bool forcePlainLayout(idx_type = 0) const;
111         ///
112         bool neverIndent() const { return true; }
113         ///
114         bool noFontChange() const { return true; }
115         ///
116         int latex(odocstream &, OutputParams const &) const;
117         ///
118         int plaintext(odocstream &, OutputParams const &) const;
119         ///
120         int docbook(odocstream &, OutputParams const &) const;
121         ///
122         int xhtml(odocstream &, OutputParams const &) const;
123         ///
124         void validate(LaTeXFeatures &) const;
125         ///
126         InsetBoxParams const & params() const { return params_; }
127         ///
128         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
129         ///
130         void doDispatch(Cursor & cur, FuncRequest & cmd);
131         /// Is the width forced to some value?
132         bool hasFixedWidth() const;
133         ///
134         Inset * clone() const { return new InsetBox(*this); }
135         /// used by the constructors
136         void init();
137         ///
138         docstring contextMenu(BufferView const & bv, int x, int y) const;
139
140         ///
141         InsetBoxParams params_;
142 };
143
144 } // namespace lyx
145
146 #endif // INSETBOX_H