4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Martin Vermeer
9 * Full author contact details are available in file CREDITS.
15 #include "InsetCollapsable.h"
16 #include "MailInset.h"
21 class InsetBranchParams {
23 explicit InsetBranchParams(docstring const & b = docstring())
26 void write(std::ostream & os) const;
28 void read(Lexer & lex);
34 /** The Branch inset for alternative, conditional output.
37 class InsetBranch : public InsetCollapsable {
40 InsetBranch(Buffer const &, InsetBranchParams const &);
44 docstring editMessage() const;
46 InsetCode lyxCode() const { return BRANCH_CODE; }
48 void write(std::ostream &) const;
50 void read(Lexer & lex);
52 void setButtonLabel();
54 virtual ColorCode backgroundColor() const;
56 bool showInsetDialog(BufferView *) const;
58 int latex(odocstream &, OutputParams const &) const;
60 int plaintext(odocstream &, OutputParams const &) const;
62 int docbook(odocstream &, OutputParams const &) const;
64 void textString(odocstream &) const;
66 void validate(LaTeXFeatures &) const;
68 InsetBranchParams const & params() const { return params_; }
70 void setParams(InsetBranchParams const & params) { params_ = params; }
72 /** \returns true if params_.branch is listed as 'selected' in
73 \c buffer. This handles the case of child documents.
75 bool isBranchSelected() const;
77 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
79 virtual void updateLabels(ParIterator const &);
81 bool isMacroScope() const;
83 docstring toolTip(BufferView const & bv, int x, int y) const;
86 void doDispatch(Cursor & cur, FuncRequest & cmd);
88 docstring name() const { return from_ascii("Branch"); }
91 friend class InsetBranchParams;
93 Inset * clone() const { return new InsetBranch(*this); }
95 InsetBranchParams params_;
99 class InsetBranchMailer : public MailInset {
102 InsetBranchMailer(InsetBranch & inset);
104 virtual Inset & inset() const { return inset_; }
106 virtual std::string const & name() const { return name_; }
108 virtual std::string const inset2string(Buffer const &) const;
110 static std::string const params2string(InsetBranchParams const &);
112 static void string2params(std::string const &, InsetBranchParams &);
116 static std::string const name_;
118 InsetBranch & inset_;