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
|
|
|
|
* \author Herbert Voss
|
2002-03-21 17:09:55 +00:00
|
|
|
*
|
2002-09-25 14:26:13 +00:00
|
|
|
* Full author contact details are available in file CREDITS
|
|
|
|
*/
|
2000-06-07 08:53:40 +00:00
|
|
|
|
|
|
|
#ifndef INSET_CITE_H
|
|
|
|
#define INSET_CITE_H
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#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:
|
|
|
|
///
|
2001-07-06 15:57:54 +00:00
|
|
|
InsetCitation(InsetCommandParams const &, bool same_id = false);
|
2000-06-07 08:53:40 +00:00
|
|
|
///
|
2001-07-06 15:57:54 +00:00
|
|
|
Inset * clone(Buffer const &, bool same_id = false) const {
|
|
|
|
return new InsetCitation(params(), same_id);
|
2000-10-10 11:50:43 +00:00
|
|
|
}
|
2000-06-07 08:53:40 +00:00
|
|
|
///
|
2001-07-28 12:24:16 +00:00
|
|
|
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
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
Inset::Code lyxCode() const { return Inset::CITE_CODE; }
|
2001-07-20 14:18:48 +00:00
|
|
|
///
|
2002-05-26 17:33:14 +00:00
|
|
|
void edit(BufferView *, int, int, mouse_button::state);
|
2001-05-27 17:51:16 +00:00
|
|
|
///
|
2001-07-20 14:18:48 +00:00
|
|
|
void edit(BufferView * bv, bool front = true);
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
int ascii(Buffer const *, std::ostream &, int linelen) const;
|
2002-03-21 17:09:55 +00:00
|
|
|
///
|
2001-07-19 14:12:37 +00:00
|
|
|
int latex(Buffer const *, std::ostream &, bool, bool) const;
|
|
|
|
///
|
|
|
|
void validate(LaTeXFeatures &) const;
|
2002-10-11 14:06:37 +00:00
|
|
|
/** Invoked by BufferView::Pimpl::dispatch when a new citation key
|
|
|
|
is inserted. Tells us that the buffer is no longer being loaded
|
|
|
|
and that the cache of BibTeX keys should be reloaded in the future.
|
|
|
|
*/
|
|
|
|
void setLoadingBuffer(Buffer const * buffer, bool state) const;
|
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;
|
|
|
|
///
|
|
|
|
string generated_label;
|
|
|
|
///
|
|
|
|
string screen_label;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// This function does the donkey work of creating the pretty label
|
|
|
|
string const generateLabel(Buffer const *) const;
|
|
|
|
///
|
|
|
|
Cache::Style getStyle(Buffer const * buffer) const;
|
|
|
|
|
|
|
|
///
|
|
|
|
mutable Cache cache;
|
2000-06-07 08:53:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INSET_CITE_H
|