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"
|
2004-05-14 13:13:20 +00:00
|
|
|
|
2010-10-31 00:31:57 +00:00
|
|
|
#include "Citation.h"
|
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:
|
|
|
|
///
|
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
|
|
|
|
|
|
|
/// \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);
|
|
|
|
///
|
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
|
|
|
///
|
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;
|
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
|
|
|
///
|
2010-12-20 21:55:09 +00:00
|
|
|
void forToc(docstring &, size_t) const;
|
|
|
|
///
|
2012-03-01 00:41:30 +00:00
|
|
|
void validate(LaTeXFeatures &) const {}
|
2008-03-04 17:47:47 +00:00
|
|
|
///
|
2010-03-03 22:13:45 +00:00
|
|
|
void updateBuffer(ParIterator const & it, UpdateType);
|
2008-03-04 17:47:47 +00:00
|
|
|
///
|
2011-01-12 22:23:27 +00:00
|
|
|
void addToToc(DocIterator const &) 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
|
|
|
///
|
|
|
|
static bool isCompatibleCommand(std::string const & cmd);
|
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;
|
|
|
|
//@}
|
|
|
|
|
2011-12-03 22:15:11 +00:00
|
|
|
/// we'll eventually want to be able to get info on this from the
|
2008-02-23 22:01:02 +00:00
|
|
|
/// various CiteEngines
|
|
|
|
static ParamInfo param_info_;
|
2004-05-10 20:55:00 +00:00
|
|
|
|
2008-02-23 22:01:02 +00:00
|
|
|
///
|
2011-05-07 23:02:53 +00:00
|
|
|
struct Cache {
|
|
|
|
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
|