]> git.lyx.org Git - lyx.git/blob - src/insets/insetbranch.h
the spellcheck cleanup
[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
16 #include "insetcollapsable.h"
17 #include "BranchList.h"
18
19  struct InsetBranchParams {
20         ///
21         void write(std::ostream & os) const;
22         ///
23         void read(LyXLex & lex);
24         ///
25         std::string branch;
26         /// Hack -- MV
27         BranchList branchlist;
28  };
29
30
31 /** The Branch inset for alternative, conditional output.
32
33 */
34 class InsetBranch : public InsetCollapsable {
35 public:
36         ///
37
38
39         InsetBranch(BufferParams const &, std::string const &);
40         /// Copy constructor
41         InsetBranch(InsetBranch const &);
42         ///
43         ~InsetBranch();
44         ///
45         virtual std::auto_ptr<InsetBase> clone() const;
46         ///
47         std::string const editMessage() const;
48         ///
49         InsetOld::Code lyxCode() const { return InsetOld::BRANCH_CODE; }
50         ///
51         void write(Buffer const &, std::ostream &) const;
52         ///
53         void read(Buffer const & buf, LyXLex & lex);
54         ///
55         void setButtonLabel();
56         ///
57         bool showInsetDialog(BufferView *) const;
58         ///
59         int latex(Buffer const &, std::ostream &,
60                         LatexRunParams const &) const;
61         ///
62         int linuxdoc(Buffer const &, std::ostream &,
63                      LatexRunParams const &) const;
64         ///
65         int docbook(Buffer const &, std::ostream &,
66                     LatexRunParams const & runparams) const;
67         ///
68         int ascii(Buffer const &, std::ostream &,
69                   LatexRunParams const & runparams) const;
70         ///
71         void validate(LaTeXFeatures &) const;
72         ///
73         InsetBranchParams const & params() const { return params_; }
74         ///
75         void setParams(InsetBranchParams const & params) { params_ = params; }
76 protected:
77         ///
78         virtual
79         DispatchResult
80         priv_dispatch(FuncRequest const &, idx_type &, pos_type &);
81 private:
82         friend class InsetBranchParams;
83
84         /// used by the constructors
85         void init();
86         ///
87         InsetBranchParams params_;
88 };
89
90 #include "mailinset.h"
91
92 class InsetBranchMailer : public MailInset {
93 public:
94         ///
95         InsetBranchMailer(std::string const & name, InsetBranch & inset);
96         ///
97         virtual InsetBase & inset() const { return inset_; }
98         ///
99         virtual std::string const & name() const { return name_; }
100         ///
101         virtual std::string const inset2string(Buffer const &) const;
102         ///
103         static std::string const params2string(std::string const &, InsetBranchParams const &);
104         ///
105         static void string2params(std::string const &, InsetBranchParams &);
106
107 private:
108         ///
109         std::string const name_;
110         ///
111         InsetBranch & inset_;
112 };
113
114
115
116 #endif