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