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
|
2003-09-07 01:45:40 +00:00
|
|
|
|
* \author Herbert Vo<EFBFBD>
|
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
|
|
|
|
|
|
|
|
|
#ifndef INSET_CITE_H
|
|
|
|
|
#define INSET_CITE_H
|
|
|
|
|
|
|
|
|
|
|
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 {
|
|
|
|
|
|
|
|
|
|
|
2002-03-21 17:09:55 +00:00
|
|
|
|
/** Used to insert citations
|
2000-06-07 08:53:40 +00:00
|
|
|
|
*/
|
2000-08-04 13:12:30 +00:00
|
|
|
|
class InsetCitation : public InsetCommand {
|
2000-06-07 08:53:40 +00:00
|
|
|
|
public:
|
|
|
|
|
///
|
2003-05-26 09:13:55 +00:00
|
|
|
|
InsetCitation(InsetCommandParams const &);
|
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
|
docstring screenLabel() const;
|
2000-06-07 08:53:40 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
EDITABLE editable() const { return IS_EDITABLE; }
|
2001-01-31 20:39:53 +00:00
|
|
|
|
///
|
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;
|
2005-11-25 14:40:34 +00:00
|
|
|
|
/// the string that is passed to the TOC
|
2008-02-27 20:43:16 +00:00
|
|
|
|
void textString(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
|
|
|
|
///
|
|
|
|
|
void updateLabels(ParIterator const & it);
|
|
|
|
|
///
|
|
|
|
|
void addToToc(ParConstIterator const &) const;
|
|
|
|
|
|
2007-10-25 04:13:56 +00:00
|
|
|
|
///
|
2008-02-23 22:01:02 +00:00
|
|
|
|
static ParamInfo const & findInfo(std::string const &);
|
2007-10-25 04:13:56 +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"; };
|
|
|
|
|
///
|
|
|
|
|
static bool isCompatibleCommand(std::string const & cmd);
|
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); }
|
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
|
|
|
|
/// This function does the donkey work of creating the pretty label
|
2008-02-27 20:43:16 +00:00
|
|
|
|
docstring generateLabel() const;
|
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
|
|
|
|
///
|
2007-10-19 17:22:55 +00:00
|
|
|
|
Cache() : engine(biblio::ENGINE_BASIC), params(CITE_CODE) {}
|
2002-04-24 10:00:39 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
biblio::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
|
|
|
|
|
|
2000-06-07 08:53:40 +00:00
|
|
|
|
#endif // INSET_CITE_H
|