]> git.lyx.org Git - lyx.git/blob - src/insets/insetbranch.h
setFont rework + some code simplification
[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         InsetBranch(BufferParams const &, std::string const &);
38         /// Copy constructor
39         InsetBranch(InsetBranch const &);
40         ///
41         ~InsetBranch();
42         ///
43         virtual std::auto_ptr<InsetBase> clone() const;
44         ///
45         std::string const editMessage() const;
46         ///
47         InsetOld::Code lyxCode() const { return InsetOld::BRANCH_CODE; }
48         ///
49         void write(Buffer const &, std::ostream &) const;
50         ///
51         void read(Buffer const & buf, LyXLex & lex);
52         ///
53         void setButtonLabel();
54         ///
55         bool showInsetDialog(BufferView *) const;
56         ///
57         int latex(Buffer const &, std::ostream &,
58                         OutputParams const &) const;
59         ///
60         int linuxdoc(Buffer const &, std::ostream &,
61                      OutputParams const &) const;
62         ///
63         int docbook(Buffer const &, std::ostream &,
64                     OutputParams const & runparams) const;
65         ///
66         int plaintext(Buffer const &, std::ostream &,
67                   OutputParams const & runparams) const;
68         ///
69         void validate(LaTeXFeatures &) const;
70         ///
71         InsetBranchParams const & params() const { return params_; }
72         ///
73         void setParams(InsetBranchParams const & params) { params_ = params; }
74 protected:
75         ///
76         virtual
77         DispatchResult
78         priv_dispatch(FuncRequest const &, idx_type &, pos_type &);
79 private:
80         friend class InsetBranchParams;
81
82         /// used by the constructors
83         void init();
84         ///
85         InsetBranchParams params_;
86 };
87
88 #include "mailinset.h"
89
90 class InsetBranchMailer : public MailInset {
91 public:
92         ///
93         InsetBranchMailer(std::string const & name, InsetBranch & inset);
94         ///
95         virtual InsetBase & inset() const { return inset_; }
96         ///
97         virtual std::string const & name() const { return name_; }
98         ///
99         virtual std::string const inset2string(Buffer const &) const;
100         ///
101         static std::string const params2string(std::string const &, InsetBranchParams const &);
102         ///
103         static void string2params(std::string const &, InsetBranchParams &);
104
105 private:
106         ///
107         std::string const name_;
108         ///
109         InsetBranch & inset_;
110 };
111
112
113
114 #endif