]> git.lyx.org Git - lyx.git/blob - src/insets/InsetBranch.h
get rid of useless debug output.
[lyx.git] / src / insets / InsetBranch.h
1 // -*- C++ -*-
2 /**
3  * \file InsetBranch.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Martin Vermeer
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSETBRANCH_H
13 #define INSETBRANCH_H
14
15 #include "InsetCollapsable.h"
16
17
18 namespace lyx {
19
20 class InsetBranchParams {
21 public:
22         ///
23         explicit InsetBranchParams(docstring const & b = docstring())
24                 : branch(b) {}
25         ///
26         void write(std::ostream & os) const;
27         ///
28         void read(Lexer & lex);
29         ///
30         docstring branch;
31 };
32
33
34 /////////////////////////////////////////////////////////////////////////
35 //
36 // InsetBranch
37 //
38 /////////////////////////////////////////////////////////////////////////
39
40 /// The Branch inset for alternative, conditional output.
41
42 class InsetBranch : public InsetCollapsable
43 {
44 public:
45         ///
46         InsetBranch(Buffer const &, InsetBranchParams const &);
47         ///
48         ~InsetBranch();
49
50         ///
51         static std::string params2string(InsetBranchParams const &);
52         ///
53         static void string2params(std::string const &, InsetBranchParams &);
54
55 private:
56         ///
57         docstring editMessage() const;
58         ///
59         InsetCode lyxCode() const { return BRANCH_CODE; }
60         ///
61         void write(std::ostream &) const;
62         ///
63         void read(Lexer & lex);
64         ///
65         void setButtonLabel();
66         ///
67         ColorCode backgroundColor() const;
68         ///
69         bool showInsetDialog(BufferView *) const;
70         ///
71         int latex(odocstream &, OutputParams const &) const;
72         ///
73         int plaintext(odocstream &, OutputParams const &) const;
74         ///
75         int docbook(odocstream &, OutputParams const &) const;
76         ///
77         void textString(odocstream &) const;
78         ///
79         void validate(LaTeXFeatures &) const;
80         ///
81         InsetBranchParams const & params() const { return params_; }
82         ///
83         void setParams(InsetBranchParams const & params) { params_ = params; }
84
85         /** \returns true if params_.branch is listed as 'selected' in
86             \c buffer. This handles the case of child documents.
87          */
88         bool isBranchSelected() const;
89         /*!
90          * Is the content of this inset part of the output document?
91          *
92          * Note that Branch insets are only considered part of the
93          * document when they are selected.
94          */
95         bool producesOutput() const { return isBranchSelected(); }
96         ///
97         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
98         ///
99         bool isMacroScope() const;
100         ///
101         docstring toolTip(BufferView const & bv, int x, int y) const;
102         ///
103         bool useEmptyLayout() const { return false; }
104         ///
105         void doDispatch(Cursor & cur, FuncRequest & cmd);
106         ///
107         docstring name() const { return from_ascii("Branch"); }
108         ///
109         Inset * clone() const { return new InsetBranch(*this); }
110
111         ///
112         friend class InsetBranchParams;
113         ///
114         InsetBranchParams params_;
115 };
116
117 } // namespace lyx
118
119 #endif