]> git.lyx.org Git - lyx.git/blob - src/insets/InsetPhantom.h
some InsetPhantom fixes.
[lyx.git] / src / insets / InsetPhantom.h
1 // -*- C++ -*-
2 /**
3  * \file InsetPhantom.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Uwe Stöhr
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSET_PHANTOM_H
13 #define INSET_PHANTOM_H
14
15 #include "InsetCollapsable.h"
16
17
18 namespace lyx {
19
20 class InsetPhantomParams
21 {
22 public:
23         enum Type {
24                 Phantom,
25                 HPhantom,
26                 VPhantom
27         };
28         /// \c type defaults to Phantom
29         InsetPhantomParams();
30         ///
31         void write(std::ostream & os) const;
32         ///
33         void read(Lexer & lex);
34         ///
35         Type type;
36 };
37
38
39 /////////////////////////////////////////////////////////////////////////
40 //
41 // InsetPhantom
42 //
43 /////////////////////////////////////////////////////////////////////////
44
45 /// The phantom inset
46 class InsetPhantom : public InsetCollapsable
47 {
48 public:
49         ///
50         InsetPhantom(Buffer const &, std::string const &);
51         ///
52         ~InsetPhantom();
53         ///
54         static std::string params2string(InsetPhantomParams const &);
55         ///
56         static void string2params(std::string const &, InsetPhantomParams &);
57         ///
58         InsetPhantomParams const & params() const { return params_; }
59 private:
60         ///
61         docstring editMessage() const;
62         ///
63         docstring name() const;
64         ///
65         DisplayType display() const;
66         ///
67         void metrics(MetricsInfo &, Dimension &) const;
68         ///
69         void draw(PainterInfo & pi, int x, int y) const;
70         ///
71         void write(std::ostream &) const;
72         ///
73         void read(Lexer & lex);
74         ///
75         void setButtonLabel();
76         /// show the phantom dialog
77         bool showInsetDialog(BufferView * bv) const;
78         ///
79         bool allowParagraphCustomization(idx_type = 0) const { return false; }
80         ///
81         bool forcePlainLayout(idx_type = 0) const { return true; }
82         ///
83         bool neverIndent() const { return true; }
84         ///
85         int latex(odocstream &, OutputParams const &) const;
86         ///
87         int plaintext(odocstream &, OutputParams const &) const;
88         ///
89         int docbook(odocstream &, OutputParams const &) const;
90         ///
91         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
92         ///
93         void doDispatch(Cursor & cur, FuncRequest & cmd);
94         ///
95         docstring toolTip(BufferView const & bv, int x, int y) const;
96         /// used by the constructors
97         void init();
98         ///
99         docstring contextMenu(BufferView const & bv, int x, int y) const;
100         ///
101         friend class InsetPhantomParams;
102
103         ///
104         InsetPhantomParams params_;
105 };
106
107
108 } // namespace lyx
109
110 #endif // INSET_PHANTOM_H