]> git.lyx.org Git - lyx.git/blob - src/insets/InsetBox.h
Fix pdf format conversion
[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         /// Is there a parbox?
35         bool use_parbox;
36         /// Is there a makebox?
37         bool use_makebox;
38         /// Do we have an inner parbox or minipage to format paragraphs to
39         /// columnwidth?
40         bool inner_box;
41         ///
42         Length width;
43         /// "special" widths, see usrguide.dvi ยง3.5
44         std::string special;
45         ///
46         char pos;
47         ///
48         char hor_pos;
49         ///
50         char inner_pos;
51         ///
52         Length height;
53         ///
54         std::string height_special;
55 };
56
57
58
59 ///////////////////////////////////////////////////////////////////////
60 //
61 // The fbox/fancybox inset
62 //
63 ///////////////////////////////////////////////////////////////////////
64
65
66 class InsetBox : public InsetCollapsable
67 {
68 public:
69         ///
70         enum BoxType {
71                 Frameless,
72                 Boxed,
73                 Framed,
74                 ovalbox,
75                 Ovalbox,
76                 Shadowbox,
77                 Shaded,
78                 Doublebox
79         };
80         ///
81         InsetBox(Buffer *, std::string const &);
82
83         ///
84         static std::string params2string(InsetBoxParams const &);
85         ///
86         static void string2params(std::string const &, InsetBoxParams &);
87         ///
88         InsetBoxParams const & params() const { return params_; }
89
90         /// \name Public functions inherited from Inset class
91         //@{
92         ///
93         InsetCode lyxCode() const { return BOX_CODE; }
94         ///
95         docstring layoutName() const;
96         ///
97         void write(std::ostream &) const;
98         ///
99         void read(Lexer & lex);
100         ///
101         void metrics(MetricsInfo &, Dimension &) const;
102         ///
103         DisplayType display() const { return Inline; }
104         ///
105         ColorCode backgroundColor(PainterInfo const &) const;
106         ///
107         bool allowParagraphCustomization(idx_type = 0) const { return !forcePlainLayout(); }
108         ///
109         bool forcePlainLayout(idx_type = 0) const;
110         ///
111         bool neverIndent() const { return true; }
112         ///
113         bool inheritFont() const { return false; }
114         ///
115         void latex(otexstream &, OutputParams const &) const;
116         ///
117         int plaintext(odocstringstream & ods, OutputParams const & op,
118                       size_t max_length = INT_MAX) const;
119         ///
120         int docbook(odocstream &, OutputParams const &) const;
121         ///
122         docstring xhtml(XHTMLStream &, OutputParams const &) const;
123         ///
124         void validate(LaTeXFeatures &) const;
125         ///
126         bool hasFixedWidth() const;
127         ///
128         std::string contextMenuName() const;
129         //@}
130
131         /// \name Public functions inherited from InsetCollapsable class
132         //@{
133         ///
134         void setButtonLabel();
135         //@}
136
137 protected:
138         /// \name Protected functions inherited from Inset class
139         //@{
140         ///
141         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
142         ///
143         void doDispatch(Cursor & cur, FuncRequest & cmd);
144         ///
145         Inset * clone() const { return new InsetBox(*this); }
146         //@}
147
148 private:
149         /// used by the constructors
150         void init();
151
152         ///
153         friend class InsetBoxParams;
154         InsetBoxParams params_;
155 };
156
157 } // namespace lyx
158
159 #endif // INSETBOX_H