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"
|
2007-10-19 17:22:55 +00:00
|
|
|
#include "InsetCode.h"
|
2007-03-25 01:12:38 +00:00
|
|
|
|
2007-08-20 17:04:36 +00:00
|
|
|
#include "BiblioInfo.h"
|
2004-05-14 13:13:20 +00:00
|
|
|
|
2000-07-20 10:04:27 +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:
|
|
|
|
///
|
2009-11-08 16:10:34 +00:00
|
|
|
explicit InsetCitation(Buffer * buf, InsetCommandParams const &);
|
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
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
docstring screenLabel() const;
|
2000-06-07 08:53:40 +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;
|
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
InsetCode lyxCode() const { return CITE_CODE; }
|
2001-07-20 14:18:48 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int latex(odocstream &, OutputParams const &) const;
|
2007-02-17 16:36:45 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int plaintext(odocstream &, OutputParams const &) 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;
|
2005-11-25 14:40:34 +00:00
|
|
|
/// the string that is passed to the TOC
|
2008-11-10 22:45:14 +00:00
|
|
|
void tocString(odocstream &) const;
|
2004-10-21 22:39:20 +00:00
|
|
|
///
|
2001-07-19 14:12:37 +00:00
|
|
|
void validate(LaTeXFeatures &) const;
|
2008-03-04 17:47:47 +00:00
|
|
|
///
|
2009-12-04 03:03:38 +00:00
|
|
|
void updateLabels(ParIterator const & it, bool);
|
2008-03-04 17:47:47 +00:00
|
|
|
///
|
2008-05-13 08:23:44 +00:00
|
|
|
void addToToc(DocIterator const &);
|
2008-03-04 17:47:47 +00:00
|
|
|
|
2007-10-25 04:13:56 +00:00
|
|
|
///
|
2008-02-23 22:01:02 +00:00
|
|
|
static ParamInfo const & findInfo(std::string const &);
|
2008-03-27 22:26:24 +00:00
|
|
|
// FIXME This is the locus of the design problem we have.
|
|
|
|
// It really ought to do what default_cite_command() does,
|
|
|
|
// but to do that it needs to know what CiteEngine we are
|
|
|
|
// using.
|
|
|
|
static std::string defaultCommand() { return "cite"; }
|
2007-10-25 04:13:56 +00:00
|
|
|
///
|
|
|
|
static bool isCompatibleCommand(std::string const & cmd);
|
2008-04-28 15:21:55 +00:00
|
|
|
///
|
|
|
|
virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
|
2002-04-24 10:00:39 +00:00
|
|
|
private:
|
2008-02-23 22:01:02 +00:00
|
|
|
///
|
2008-02-29 20:00:39 +00:00
|
|
|
Inset * clone() const { return new InsetCitation(*this); }
|
2010-01-09 22:30:12 +00:00
|
|
|
/// This function does the donkey work of creating the pretty label
|
|
|
|
docstring generateLabel() const;
|
|
|
|
///
|
|
|
|
docstring complexLabel() const;
|
|
|
|
///
|
|
|
|
docstring basicLabel() const;
|
2008-02-23 22:01:02 +00:00
|
|
|
/// we'll eventually want to be able to get info on this from the
|
|
|
|
/// various CiteEngines
|
|
|
|
static ParamInfo param_info_;
|
2004-05-10 20:55:00 +00:00
|
|
|
|
2008-02-23 22:01:02 +00:00
|
|
|
///
|
2005-01-19 15:03:31 +00:00
|
|
|
class Cache {
|
|
|
|
public:
|
2002-04-24 10:00:39 +00:00
|
|
|
///
|
2008-04-20 15:00:11 +00:00
|
|
|
Cache() : engine(ENGINE_BASIC), params(CITE_CODE) {}
|
2002-04-24 10:00:39 +00:00
|
|
|
///
|
2008-04-20 15:00:11 +00:00
|
|
|
CiteEngine engine;
|
2002-04-24 10:00:39 +00:00
|
|
|
///
|
|
|
|
InsetCommandParams params;
|
|
|
|
///
|
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
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
2008-03-27 22:26:24 +00:00
|
|
|
#endif // INSET_CITATION_H
|