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"
23 /////////////////////////////////////////////////////////////////////////
27 /////////////////////////////////////////////////////////////////////////
29 /// Used to insert citations
30 class InsetCitation : public InsetCommand
34 InsetCitation(Buffer * buf, InsetCommandParams const &);
39 bool addKey(std::string const & key);
41 /// \name Public functions inherited from Inset class
44 bool isLabeled() const override { return true; }
46 bool hasSettings() const override { return true; }
48 docstring toolTip(BufferView const & bv, int x, int y) const override;
50 void doDispatch(Cursor & cur, FuncRequest & cmd) override;
52 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const override;
54 InsetCode lyxCode() const override { return CITE_CODE; }
56 void latex(otexstream &, OutputParams const &) const override;
58 int plaintext(odocstringstream & ods, OutputParams const & op,
59 size_t max_length = INT_MAX) const override;
61 void docbook(XMLStream &, OutputParams const &) const override;
63 docstring xhtml(XMLStream &, OutputParams const &) const override;
65 void toString(odocstream &) const override;
67 void forOutliner(docstring &, size_t const, bool const) const override;
69 void updateBuffer(ParIterator const & it, UpdateType, bool const deleted = false) override;
71 void addToToc(DocIterator const & di, bool output_active,
72 UpdateType utype, TocBackend & backend) const override;
74 std::string contextMenuName() const override;
76 bool forceLTR(OutputParams const &) const override;
79 /// \name Static public methods obligated for InsetCommand derived classes
82 static ParamInfo const & findInfo(std::string const &);
84 static std::string defaultCommand() { return "cite"; }
86 static bool isCompatibleCommand(std::string const &);
89 typedef std::vector<std::pair<docstring, docstring>> QualifiedList;
91 void redoLabel() { cache.recalculate = true; }
93 CitationStyle getCitationStyle(BufferParams const & bp, std::string const & input,
94 std::vector<CitationStyle> const & valid_styles) const;
96 QualifiedList getQualifiedLists(docstring const & p) const;
98 static bool last_literal;
99 /// Check whether citation contains necessary url/file entries
100 /// or external search script is available
101 bool openCitationPossible() const;
102 /// search and open citation source
105 std::pair<int, int> isWords() const override;
108 /// tries to make a pretty label and makes a basic one if not
109 docstring generateLabel(bool for_xhtml = false) const;
110 /// makes a pretty label
111 docstring complexLabel(bool for_xhtml = false) const;
112 /// makes a very basic label, in case we can't make a pretty one
113 docstring basicLabel(bool for_xhtml = false) const;
117 /// \name Private functions inherited from Inset class
120 Inset * clone() const override { return new InsetCitation(*this); }
123 /// \name Private functions inherited from InsetCommand class
126 docstring screenLabel() const override;
131 Cache() : recalculate(true) {}
135 docstring generated_label;
137 docstring screen_label;
146 #endif // INSET_CITATION_H