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 class InsetBranchParams {
23 explicit InsetBranchParams(std::string const & b = std::string())
26 void write(std::ostream & os) const;
28 void read(LyXLex & lex);
34 /** The Branch inset for alternative, conditional output.
37 class InsetBranch : public InsetCollapsable {
40 InsetBranch(BufferParams const &, InsetBranchParams const &);
44 virtual lyx::docstring const editMessage() const;
46 InsetBase::Code lyxCode() const { return InsetBase::BRANCH_CODE; }
48 void write(Buffer const &, std::ostream &) const;
50 void read(Buffer const & buf, LyXLex & lex);
52 void setButtonLabel();
54 bool showInsetDialog(BufferView *) const;
56 int latex(Buffer const &, std::ostream &,
57 OutputParams const &) const;
59 int docbook(Buffer const &, std::ostream &,
60 OutputParams const & runparams) const;
62 int plaintext(Buffer const &, std::ostream &,
63 OutputParams const & runparams) const;
65 void validate(LaTeXFeatures &) const;
67 InsetBranchParams const & params() const { return params_; }
69 void setParams(InsetBranchParams const & params) { params_ = params; }
71 /** \returns true if params_.branch is listed as 'selected' in
72 \c buffer. This handles the case of child documents.
74 bool isBranchSelected(Buffer const & buffer) const;
76 bool getStatus(LCursor &, FuncRequest const &, FuncStatus &) const;
79 InsetBranch(InsetBranch const &);
80 virtual void doDispatch(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_;