3 * \file InsetCitation.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
10 * Full author contact details are available in file CREDITS.
13 #ifndef INSET_CITATION_H
14 #define INSET_CITATION_H
16 #include "InsetCommand.h"
21 /////////////////////////////////////////////////////////////////////////
25 /////////////////////////////////////////////////////////////////////////
27 /// Used to insert citations
28 class InsetCitation : public InsetCommand
32 InsetCitation(Buffer * buf, InsetCommandParams const &);
37 bool addKey(std::string const & key);
39 /// \name Public functions inherited from Inset class
42 bool isLabeled() const { return true; }
44 bool hasSettings() const { return true; }
46 bool inheritFont() const { return true; }
48 docstring toolTip(BufferView const & bv, int x, int y) const;
50 void doDispatch(Cursor & cur, FuncRequest & cmd);
52 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
54 InsetCode lyxCode() const { return CITE_CODE; }
56 void latex(otexstream &, OutputParams const &) const;
58 int plaintext(odocstringstream & ods, OutputParams const & op,
59 size_t max_length = INT_MAX) const;
61 int docbook(odocstream &, OutputParams const &) const;
63 docstring xhtml(XHTMLStream &, OutputParams const &) const;
65 void toString(odocstream &) const;
67 void forOutliner(docstring &, size_t const, bool const) const;
69 void updateBuffer(ParIterator const & it, UpdateType);
71 void addToToc(DocIterator const & di, bool output_active,
72 UpdateType utype, TocBackend & backend) const;
74 std::string contextMenuName() const;
77 /// \name Static public methods obligated for InsetCommand derived classes
80 static ParamInfo const & findInfo(std::string const &);
82 static std::string defaultCommand() { return "cite"; }
84 static bool isCompatibleCommand(std::string const &);
87 CitationStyle getCitationStyle(BufferParams const & bp, std::string const & input,
88 std::vector<CitationStyle> const & valid_styles) const;
90 std::map<docstring, docstring> getQualifiedLists(docstring const p) const;
93 /// tries to make a pretty label and makes a basic one if not
94 docstring generateLabel(bool for_xhtml = false) const;
95 /// makes a pretty label
96 docstring complexLabel(bool for_xhtml = false) const;
97 /// makes a very basic label, in case we can't make a pretty one
98 docstring basicLabel(bool for_xhtml = false) const;
100 /// \name Private functions inherited from Inset class
103 Inset * clone() const { return new InsetCitation(*this); }
106 /// \name Private functions inherited from InsetCommand class
109 docstring screenLabel() const;
112 /// we'll eventually want to be able to get info on this from the
113 /// various CiteEngines
114 static ParamInfo param_info_;
118 Cache() : recalculate(true) {}
122 docstring generated_label;
124 docstring screen_label;
133 #endif // INSET_CITATION_H