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"
21 struct InsetBranchParams {
22 explicit InsetBranchParams(std::string const & b = std::string())
25 void write(std::ostream & os) const;
27 void read(LyXLex & lex);
33 /** The Branch inset for alternative, conditional output.
36 class InsetBranch : public InsetCollapsable {
39 InsetBranch(BufferParams const &, InsetBranchParams const &);
43 std::string const editMessage() const;
45 InsetOld::Code lyxCode() const { return InsetOld::BRANCH_CODE; }
47 void write(Buffer const &, std::ostream &) const;
49 void read(Buffer const & buf, LyXLex & lex);
51 void setButtonLabel();
53 bool showInsetDialog(BufferView *) const;
55 int latex(Buffer const &, std::ostream &,
56 OutputParams const &) const;
58 int linuxdoc(Buffer const &, std::ostream &,
59 OutputParams const &) const;
61 int docbook(Buffer const &, std::ostream &,
62 OutputParams const & runparams) const;
64 int plaintext(Buffer const &, std::ostream &,
65 OutputParams const & runparams) const;
67 void validate(LaTeXFeatures &) const;
69 InsetBranchParams const & params() const { return params_; }
71 void setParams(InsetBranchParams const & params) { params_ = params; }
73 /** \returns true if params_.branch is listed as 'selected' in
76 bool isBranchSelected(BranchList const & branchlist) const;
79 InsetBranch(InsetBranch const &);
80 virtual void priv_dispatch(LCursor & cur, FuncRequest & cmd);
82 friend class InsetBranchParams;
84 virtual std::auto_ptr<InsetBase> doClone() const;
86 /// used by the constructors
89 InsetBranchParams params_;
92 #include "mailinset.h"
94 class InsetBranchMailer : public MailInset {
97 InsetBranchMailer(InsetBranch & inset);
99 virtual InsetBase & inset() const { return inset_; }
101 virtual std::string const & name() const { return name_; }
103 virtual std::string const inset2string(Buffer const &) const;
105 static std::string const params2string(InsetBranchParams const &);
107 static void string2params(std::string const &, InsetBranchParams &);
111 static std::string const name_;
113 InsetBranch & inset_;