]> git.lyx.org Git - lyx.git/blob - src/insets/insetbranch.h
Enable convertDefault.sh to run even if its executable bit is not set.
[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         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 &, string const &);
40         /// Copy constructor
41         InsetBranch(InsetBranch const &);
42         ///
43         ~InsetBranch();
44         ///
45         virtual std::auto_ptr<InsetBase> clone() const;
46         ///
47         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         dispatch_result localDispatch(FuncRequest const &);
60         ///
61         int latex(Buffer const &, std::ostream &,
62                         LatexRunParams const &) const;
63         ///
64         int linuxdoc(Buffer const &, std::ostream &) const;
65         ///
66         int docbook(Buffer const &, std::ostream &, bool) const;
67         ///
68         int ascii(Buffer const &, std::ostream &, int) const;
69         ///
70         void validate(LaTeXFeatures &) const;
71         ///
72         InsetBranchParams const & params() const { return params_; }
73         ///
74         void setParams(InsetBranchParams const & params) { params_ = params; }
75
76 private:
77         friend class InsetBranchParams;
78
79         /// used by the constructors
80         void init();
81         ///
82         InsetBranchParams params_;
83 };
84
85 #include "mailinset.h"
86
87 class InsetBranchMailer : public MailInset {
88 public:
89         ///
90         InsetBranchMailer(string const & name, InsetBranch & inset);
91         ///
92         virtual InsetBase & inset() const { return inset_; }
93         ///
94         virtual string const & name() const { return name_; }
95         ///
96         virtual string const inset2string(Buffer const &) const;
97         ///
98         static string const params2string(string const &, InsetBranchParams const &);
99         ///
100         static void string2params(string const &, InsetBranchParams &);
101
102 private:
103         ///
104         string const name_;
105         ///
106         InsetBranch & inset_;
107 };
108
109
110
111 #endif