]> git.lyx.org Git - lyx.git/blob - src/insets/InsetBox.h
Fix bug #6315: counters in insets that don't produce output have ghost values.
[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         static std::string params2string(InsetBoxParams const &);
84         ///
85         static void string2params(std::string const &, InsetBoxParams &);
86         ///
87         InsetBoxParams const & params() const { return params_; }
88 private:
89         ///
90         friend class InsetBoxParams;
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         ///
104         DisplayType display() const { return Inline; }
105         ///
106         bool allowParagraphCustomization(idx_type = 0) const { return !forcePlainLayout(); }
107         ///
108         bool forcePlainLayout(idx_type = 0) const;
109         ///
110         bool neverIndent() const { return true; }
111         ///
112         bool noFontChange() const { return true; }
113         ///
114         int latex(odocstream &, OutputParams const &) const;
115         ///
116         int plaintext(odocstream &, OutputParams const &) const;
117         ///
118         int docbook(odocstream &, OutputParams const &) const;
119         ///
120         docstring xhtml(XHTMLStream &, OutputParams const &) const;
121         ///
122         void validate(LaTeXFeatures &) const;
123         ///
124         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
125         ///
126         void doDispatch(Cursor & cur, FuncRequest & cmd);
127         /// Is the width forced to some value?
128         bool hasFixedWidth() const;
129         ///
130         Inset * clone() const { return new InsetBox(*this); }
131         /// used by the constructors
132         void init();
133         ///
134         docstring contextMenu(BufferView const & bv, int x, int y) const;
135
136         ///
137         InsetBoxParams params_;
138 };
139
140 } // namespace lyx
141
142 #endif // INSETBOX_H