2000-06-07 08:53:40 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-09-25 14:26:13 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file insetcite.h
|
|
|
|
|
* 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "insetcommand.h"
|
2000-07-20 10:04:27 +00:00
|
|
|
|
|
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 &);
|
|
|
|
|
///
|
2003-02-25 14:51:38 +00:00
|
|
|
|
~InsetCitation();
|
|
|
|
|
///
|
2003-07-25 17:11:25 +00:00
|
|
|
|
std::auto_ptr<InsetBase> clone() const {
|
|
|
|
|
return std::auto_ptr<InsetBase>(new InsetCitation(params()));
|
2000-10-10 11:50:43 +00:00
|
|
|
|
}
|
2000-06-07 08:53:40 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const getScreenLabel(Buffer const &) 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
|
|
|
|
///
|
2003-07-25 21:20:24 +00:00
|
|
|
|
InsetOld::Code lyxCode() const { return InsetOld::CITE_CODE; }
|
2001-07-20 14:18:48 +00:00
|
|
|
|
///
|
2003-11-05 12:06:20 +00:00
|
|
|
|
int plaintext(Buffer const &, std::ostream &, int linelen) const;
|
2002-03-21 17:09:55 +00:00
|
|
|
|
///
|
2003-08-28 07:41:31 +00:00
|
|
|
|
int latex(Buffer const &, std::ostream &,
|
2003-11-05 12:06:20 +00:00
|
|
|
|
OutputParams const &) const;
|
2001-07-19 14:12:37 +00:00
|
|
|
|
///
|
|
|
|
|
void validate(LaTeXFeatures &) const;
|
2003-10-17 18:01:15 +00:00
|
|
|
|
protected:
|
|
|
|
|
///
|
|
|
|
|
virtual
|
2003-10-29 10:47:21 +00:00
|
|
|
|
DispatchResult
|
2003-10-17 18:01:15 +00:00
|
|
|
|
priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
|
2002-04-24 10:00:39 +00:00
|
|
|
|
private:
|
|
|
|
|
struct Cache {
|
|
|
|
|
///
|
|
|
|
|
enum Style {
|
|
|
|
|
///
|
|
|
|
|
BASIC,
|
|
|
|
|
///
|
|
|
|
|
NATBIB_AY,
|
|
|
|
|
///
|
|
|
|
|
NATBIB_NUM
|
|
|
|
|
};
|
|
|
|
|
///
|
|
|
|
|
Cache() : style(BASIC) {}
|
|
|
|
|
///
|
|
|
|
|
Style style;
|
|
|
|
|
///
|
|
|
|
|
InsetCommandParams params;
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string generated_label;
|
2002-04-24 10:00:39 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string screen_label;
|
2002-04-24 10:00:39 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/// This function does the donkey work of creating the pretty label
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const generateLabel(Buffer const &) const;
|
2002-04-24 10:00:39 +00:00
|
|
|
|
///
|
2003-08-28 07:41:31 +00:00
|
|
|
|
Cache::Style getStyle(Buffer const & buffer) const;
|
2002-04-24 10:00:39 +00:00
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
mutable Cache cache;
|
2000-06-07 08:53:40 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // INSET_CITE_H
|