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
16 #include "insetcollapsable.h"
17 #include "BranchList.h"
19 struct InsetBranchParams {
21 void write(std::ostream & os) const;
23 void read(LyXLex & lex);
27 BranchList branchlist;
31 /** The Branch inset for alternative, conditional output.
34 class InsetBranch : public InsetCollapsable {
39 InsetBranch(BufferParams const &, string const &);
41 InsetBranch(InsetBranch const &);
45 virtual std::auto_ptr<InsetBase> clone() const;
47 string const editMessage() const;
49 InsetOld::Code lyxCode() const { return InsetOld::BRANCH_CODE; }
51 void write(Buffer const *, std::ostream &) const;
53 void read(Buffer const * buf, LyXLex & lex);
55 void setButtonLabel();
57 void metrics(MetricsInfo & mi, Dimension & dim) const;
59 void draw(PainterInfo & pi, int x, int y) const;
61 bool showInsetDialog(BufferView *) const;
63 dispatch_result localDispatch(FuncRequest const &);
65 int latex(Buffer const *, std::ostream &,
66 LatexRunParams const &) const;
68 int linuxdoc(Buffer const *, std::ostream &) const;
70 int docbook(Buffer const *, std::ostream &, bool) const;
72 int ascii(Buffer const *, std::ostream &, int) const;
74 void validate(LaTeXFeatures &) const;
76 InsetBranchParams const & params() const { return params_; }
78 void setParams(InsetBranchParams const & params) { params_ = params; }
81 friend class InsetBranchParams;
83 /// used by the constructors
86 InsetBranchParams params_;
89 #include "mailinset.h"
91 class InsetBranchMailer : public MailInset {
94 InsetBranchMailer(string const & name, InsetBranch & inset);
96 virtual InsetBase & inset() const { return inset_; }
98 virtual string const & name() const { return name_; }
100 virtual string const inset2string(Buffer const &) const;
102 static string const params2string(string const &, InsetBranchParams const &);
104 static void string2params(string const &, InsetBranchParams &);
110 InsetBranch & inset_;