2000-06-07 08:53:40 +00:00
|
|
|
// -*- C++ -*-
|
2002-09-25 14:26:13 +00:00
|
|
|
/**
|
2007-04-25 16:11:45 +00:00
|
|
|
* \file InsetCitation.h
|
2002-09-25 14:26:13 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2000-06-07 08:53:40 +00:00
|
|
|
*
|
2002-09-25 14:26:13 +00:00
|
|
|
* \author Angus Leeming
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Herbert Voß
|
2002-03-21 17:09:55 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-09-25 14:26:13 +00:00
|
|
|
*/
|
2000-06-07 08:53:40 +00:00
|
|
|
|
2008-03-27 22:26:24 +00:00
|
|
|
#ifndef INSET_CITATION_H
|
|
|
|
#define INSET_CITATION_H
|
2000-06-07 08:53:40 +00:00
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "InsetCommand.h"
|
2017-01-07 16:37:35 +00:00
|
|
|
#include "Citation.h"
|
2004-05-14 13:13:20 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2008-03-27 22:26:24 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// InsetCitation
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2008-03-27 22:26:24 +00:00
|
|
|
/// Used to insert citations
|
|
|
|
class InsetCitation : public InsetCommand
|
|
|
|
{
|
2000-06-07 08:53:40 +00:00
|
|
|
public:
|
|
|
|
///
|
2010-10-27 21:35:13 +00:00
|
|
|
InsetCitation(Buffer * buf, InsetCommandParams const &);
|
2013-01-12 00:04:07 +00:00
|
|
|
///
|
|
|
|
~InsetCitation();
|
2010-10-27 21:35:13 +00:00
|
|
|
|
2012-06-05 08:37:34 +00:00
|
|
|
///
|
|
|
|
bool addKey(std::string const & key);
|
|
|
|
|
2010-10-27 21:35:13 +00:00
|
|
|
/// \name Public functions inherited from Inset class
|
|
|
|
//@{
|
2003-05-26 09:13:55 +00:00
|
|
|
///
|
2008-03-10 15:30:32 +00:00
|
|
|
bool isLabeled() const { return true; }
|
2008-03-10 15:01:57 +00:00
|
|
|
///
|
2009-04-22 20:55:13 +00:00
|
|
|
bool hasSettings() const { return true; }
|
2001-01-31 20:39:53 +00:00
|
|
|
///
|
2009-03-25 12:23:43 +00:00
|
|
|
docstring toolTip(BufferView const & bv, int x, int y) const;
|
|
|
|
///
|
2011-05-07 23:02:53 +00:00
|
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
|
|
|
///
|
2017-01-03 12:11:11 +00:00
|
|
|
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
|
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
InsetCode lyxCode() const { return CITE_CODE; }
|
2001-07-20 14:18:48 +00:00
|
|
|
///
|
2011-02-10 20:02:48 +00:00
|
|
|
void latex(otexstream &, OutputParams const &) const;
|
2007-02-17 16:36:45 +00:00
|
|
|
///
|
2013-03-08 19:52:18 +00:00
|
|
|
int plaintext(odocstringstream & ods, OutputParams const & op,
|
|
|
|
size_t max_length = INT_MAX) const;
|
2001-07-19 14:12:37 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int docbook(odocstream &, OutputParams const &) const;
|
2009-06-11 21:04:15 +00:00
|
|
|
///
|
2009-11-30 22:59:18 +00:00
|
|
|
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
2010-10-27 21:35:13 +00:00
|
|
|
///
|
2010-12-15 01:34:04 +00:00
|
|
|
void toString(odocstream &) const;
|
2004-10-21 22:39:20 +00:00
|
|
|
///
|
2015-10-04 18:38:47 +00:00
|
|
|
void forOutliner(docstring &, size_t const, bool const) const;
|
2010-12-20 21:55:09 +00:00
|
|
|
///
|
2010-03-03 22:13:45 +00:00
|
|
|
void updateBuffer(ParIterator const & it, UpdateType);
|
2008-03-04 17:47:47 +00:00
|
|
|
///
|
2015-09-27 06:05:00 +00:00
|
|
|
void addToToc(DocIterator const & di, bool output_active,
|
2017-01-13 10:06:48 +00:00
|
|
|
UpdateType utype, TocBackend & backend) const;
|
2010-10-27 21:35:13 +00:00
|
|
|
///
|
2011-10-29 14:48:55 +00:00
|
|
|
std::string contextMenuName() const;
|
2010-10-27 21:35:13 +00:00
|
|
|
//@}
|
2008-03-04 17:47:47 +00:00
|
|
|
|
2010-10-27 21:35:13 +00:00
|
|
|
/// \name Static public methods obligated for InsetCommand derived classes
|
|
|
|
//@{
|
2007-10-25 04:13:56 +00:00
|
|
|
///
|
2008-02-23 22:01:02 +00:00
|
|
|
static ParamInfo const & findInfo(std::string const &);
|
2012-03-01 00:41:30 +00:00
|
|
|
///
|
2008-03-27 22:26:24 +00:00
|
|
|
static std::string defaultCommand() { return "cite"; }
|
2007-10-25 04:13:56 +00:00
|
|
|
///
|
2017-01-03 16:27:51 +00:00
|
|
|
static bool isCompatibleCommand(std::string const &);
|
2010-10-27 21:35:13 +00:00
|
|
|
//@}
|
2017-01-07 16:37:35 +00:00
|
|
|
///
|
2017-12-06 08:11:18 +00:00
|
|
|
void redoLabel() { cache.recalculate = true; }
|
|
|
|
///
|
2017-01-07 16:37:35 +00:00
|
|
|
CitationStyle getCitationStyle(BufferParams const & bp, std::string const & input,
|
|
|
|
std::vector<CitationStyle> const & valid_styles) const;
|
Support for "qualified citation lists"
These are biblatex-specific multicite commands that allow for multiple
pre- and postnotes, as in:
\cites(pre)(post)[pre1][post1]{key1}[pre2][post2]{key2}...
with an optional general pre- and postnote, which applies to the whole
list (like [][] in normal cite commands) and an optional pre- and
postnotes for each item, so that pagination can actually be specified in
multi-cite references, as in:
(cf. Miller 2015, 2; furthermore Smith 2013, 23-23; Jenkins 2012, 103,
also refer to chapter 6 in this book)
See the biblatex manual, sec. 3.8.3., for details.
File format change.
2017-01-21 13:25:17 +00:00
|
|
|
///
|
|
|
|
std::map<docstring, docstring> getQualifiedLists(docstring const p) const;
|
2018-02-22 20:24:28 +00:00
|
|
|
///
|
|
|
|
static bool last_literal;
|
2010-10-27 21:35:13 +00:00
|
|
|
|
2002-04-24 10:00:39 +00:00
|
|
|
private:
|
2010-01-11 16:11:55 +00:00
|
|
|
/// tries to make a pretty label and makes a basic one if not
|
|
|
|
docstring generateLabel(bool for_xhtml = false) const;
|
|
|
|
/// makes a pretty label
|
|
|
|
docstring complexLabel(bool for_xhtml = false) const;
|
|
|
|
/// makes a very basic label, in case we can't make a pretty one
|
|
|
|
docstring basicLabel(bool for_xhtml = false) const;
|
2010-10-27 21:35:13 +00:00
|
|
|
|
|
|
|
/// \name Private functions inherited from Inset class
|
|
|
|
//@{
|
|
|
|
///
|
|
|
|
Inset * clone() const { return new InsetCitation(*this); }
|
|
|
|
//@}
|
|
|
|
|
|
|
|
/// \name Private functions inherited from InsetCommand class
|
|
|
|
//@{
|
|
|
|
///
|
|
|
|
docstring screenLabel() const;
|
|
|
|
//@}
|
|
|
|
|
2008-02-23 22:01:02 +00:00
|
|
|
///
|
2011-05-07 23:02:53 +00:00
|
|
|
struct Cache {
|
2013-05-12 11:00:02 +00:00
|
|
|
Cache() : recalculate(true) {}
|
2002-04-24 10:00:39 +00:00
|
|
|
///
|
2011-05-07 23:02:53 +00:00
|
|
|
bool recalculate;
|
2002-04-24 10:00:39 +00:00
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
docstring generated_label;
|
2002-04-24 10:00:39 +00:00
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
docstring screen_label;
|
2002-04-24 10:00:39 +00:00
|
|
|
};
|
|
|
|
///
|
|
|
|
mutable Cache cache;
|
2000-06-07 08:53:40 +00:00
|
|
|
};
|
|
|
|
|
2010-10-27 21:35:13 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
2008-03-27 22:26:24 +00:00
|
|
|
#endif // INSET_CITATION_H
|