4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Alejandro Aguilar Sierra
9 * Full author contact details are available in file CREDITS.
12 #ifndef INSET_BIBTEX_H
13 #define INSET_BIBTEX_H
17 #include "renderers.h"
18 #include "support/filename.h"
19 #include "mailinset.h"
23 class InsetBibtexParams {
28 void write(Buffer const &, std::ostream &) const;
29 void read(Buffer const &, LyXLex &);
31 std::vector<lyx::support::FileName> databases;
37 class InsetBibtex : public InsetOld {
41 InsetBibtex(InsetBibtexParams const &);
45 std::auto_ptr<InsetBase> clone() const;
46 /// small wrapper for the time being
47 virtual dispatch_result localDispatch(FuncRequest const & cmd);
49 string const getScreenLabel(Buffer const &) const;
51 EDITABLE editable() const { return IS_EDITABLE; }
53 InsetOld::Code lyxCode() const { return InsetOld::BIBTEX_CODE; }
55 virtual void metrics(MetricsInfo &, Dimension &) const;
56 virtual void draw(PainterInfo & pi, int x, int y) const;
58 virtual void write(Buffer const &, std::ostream & os) const;
59 virtual void read(Buffer const &, LyXLex & lex);
61 bool display() const { return true; }
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;
69 void fillWithBibKeys(Buffer const & buffer,
70 std::vector<std::pair<string,string> > & keys) const;
72 std::vector<string> const getFiles(Buffer const &) const;
74 bool addDatabase(string const &);
75 bool delDatabase(string const &);
77 InsetBibtexParams const & params() const { return params_; }
78 void setParams(InsetBibtexParams const &);
80 InsetBibtexParams params_;
81 mutable bool set_label_;
82 mutable unsigned int center_indent_;
83 mutable ButtonRenderer button_;
87 class InsetBibtexMailer : public MailInset {
90 InsetBibtexMailer(InsetBibtex & inset);
92 virtual InsetBase & inset() const { return inset_; }
94 virtual string const & name() const { return name_; }
96 virtual string const inset2string(Buffer const &) const;
98 static void string2params(string const &, Buffer const &,
101 static string const params2string(InsetBibtexParams const &,
105 InsetBibtex & inset_;
107 static string const name_;
110 #endif // INSET_BIBTEX_H