]> git.lyx.org Git - lyx.git/blob - src/insets/insetbibtex.h
2a73b1d9a3abe521d045359dfa17b68440acf1a7
[lyx.git] / src / insets / insetbibtex.h
1 // -*- C++ -*-
2 /**
3  * \file insetbibtex.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Alejandro Aguilar Sierra
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSET_BIBTEX_H
13 #define INSET_BIBTEX_H
14
15
16 #include "inset.h"
17 #include "renderers.h"
18 #include "support/filename.h"
19 #include "mailinset.h"
20 #include <vector>
21
22
23 class InsetBibtexParams {
24 public:
25         InsetBibtexParams();
26         bool empty() const;
27         void erase();
28         void write(Buffer const &, std::ostream &) const;
29         void read(Buffer const &, LyXLex &);
30
31         std::vector<lyx::support::FileName> databases;
32         string style;
33         bool bibtotoc;
34 };
35
36
37 class InsetBibtex : public InsetOld {
38 public:
39         ///
40         InsetBibtex();
41         InsetBibtex(InsetBibtexParams const &);
42         ///
43         ~InsetBibtex();
44         ///
45         std::auto_ptr<InsetBase> clone() const;
46         /// small wrapper for the time being
47         virtual dispatch_result localDispatch(FuncRequest const & cmd);
48         ///
49         string const getScreenLabel(Buffer const &) const;
50         ///
51         EDITABLE editable() const { return IS_EDITABLE; }
52         ///
53         InsetOld::Code lyxCode() const { return InsetOld::BIBTEX_CODE; }
54         ///
55         virtual void metrics(MetricsInfo &, Dimension &) const;
56         virtual void draw(PainterInfo & pi, int x, int y) const;
57         ///
58         virtual void write(Buffer const &, std::ostream & os) const;
59         virtual void read(Buffer const &, LyXLex & lex);
60         ///
61         bool display() const { return true; }
62         ///
63         int latex(Buffer const &, std::ostream &,
64                   LatexRunParams const &) const;
65         virtual int ascii(Buffer const &, std::ostream &, int linelen) const;
66         virtual int linuxdoc(Buffer const &, std::ostream &) const;
67         virtual int docbook(Buffer const &, std::ostream &, bool) const;
68         ///
69         void fillWithBibKeys(Buffer const & buffer,
70                 std::vector<std::pair<string,string> > & keys) const;
71         ///
72         std::vector<string> const getFiles(Buffer const &) const;
73         ///
74         bool addDatabase(string const &);
75         bool delDatabase(string const &);
76         ///
77         InsetBibtexParams const & params() const { return params_; }
78         void setParams(InsetBibtexParams const &);
79 private:
80         InsetBibtexParams params_;
81         mutable bool set_label_;
82         mutable unsigned int center_indent_;
83         mutable ButtonRenderer button_;
84 };
85
86
87 class InsetBibtexMailer : public MailInset {
88 public:
89         ///
90         InsetBibtexMailer(InsetBibtex & 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 void string2params(string const &, Buffer const &,
99                                   InsetBibtexParams &);
100         ///
101         static string const params2string(InsetBibtexParams const &,
102                                           Buffer const &);
103 private:
104         ///
105         InsetBibtex & inset_;
106         ///
107         static string const name_;
108 };
109
110 #endif // INSET_BIBTEX_H