1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of*
|
1999-11-15 10:58:38 +00:00
|
|
|
* ======================================================
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
2000-01-24 18:34:46 +00:00
|
|
|
* Copyright 1995 Matthias Ettrich
|
2001-05-30 13:53:44 +00:00
|
|
|
* Copyright 1995-2001 The LyX Team.
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
1999-11-15 10:58:38 +00:00
|
|
|
* ====================================================== */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
#ifndef INSET_BIB_H
|
|
|
|
#define INSET_BIB_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2000-06-07 08:53:40 +00:00
|
|
|
#include <vector>
|
2000-08-04 13:12:30 +00:00
|
|
|
#include "insetcommand.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-02-25 12:06:15 +00:00
|
|
|
class Buffer;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** Used to insert bibitem's information (key and label)
|
|
|
|
|
|
|
|
Must be automatically inserted as the first object in a
|
|
|
|
bibliography paragraph.
|
|
|
|
*/
|
2000-07-15 23:51:46 +00:00
|
|
|
class InsetBibKey : public InsetCommand {
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
|
|
|
///
|
2000-08-04 13:12:30 +00:00
|
|
|
InsetBibKey(InsetCommandParams const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
~InsetBibKey();
|
|
|
|
///
|
2001-07-06 15:57:54 +00:00
|
|
|
Inset * clone(Buffer const &, bool same_id = false) const;
|
2000-07-15 23:51:46 +00:00
|
|
|
/** Currently \bibitem is used as a LyX2.x command,
|
|
|
|
so we need this method.
|
|
|
|
*/
|
2001-07-06 15:57:54 +00:00
|
|
|
void write(Buffer const *, std::ostream &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
void read(Buffer const *, LyXLex & lex);
|
2000-07-13 09:38:34 +00:00
|
|
|
///
|
2001-07-28 12:24:16 +00:00
|
|
|
virtual string const getScreenLabel(Buffer const *) const;
|
2001-07-20 14:18:48 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
void edit(BufferView *, int x, int y, unsigned int button);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-07-20 14:18:48 +00:00
|
|
|
void edit(BufferView * bv, bool front = true);
|
|
|
|
///
|
2001-07-26 09:47:36 +00:00
|
|
|
EDITABLE editable() const { return IS_EDITABLE; }
|
1999-09-27 18:44:28 +00:00
|
|
|
/// A user can't neither insert nor delete this inset
|
2001-06-28 10:25:20 +00:00
|
|
|
bool deletable() const {
|
1999-09-27 18:44:28 +00:00
|
|
|
return false;
|
|
|
|
}
|
2001-07-20 14:18:48 +00:00
|
|
|
///
|
|
|
|
void setCounter(int);
|
|
|
|
///
|
|
|
|
int getCounter() const { return counter; }
|
2000-02-22 00:36:17 +00:00
|
|
|
///
|
2001-01-31 11:46:13 +00:00
|
|
|
string const getBibLabel() const;
|
|
|
|
///
|
2000-02-22 00:36:17 +00:00
|
|
|
struct Holder {
|
|
|
|
InsetBibKey * inset;
|
|
|
|
BufferView * view;
|
|
|
|
};
|
2000-06-12 11:27:15 +00:00
|
|
|
|
2000-07-15 23:51:46 +00:00
|
|
|
private:
|
2000-02-25 16:42:21 +00:00
|
|
|
///
|
2001-07-20 14:18:48 +00:00
|
|
|
int counter;
|
2000-02-22 00:36:17 +00:00
|
|
|
///
|
|
|
|
Holder holder;
|
2001-01-31 11:46:13 +00:00
|
|
|
///
|
|
|
|
static int key_counter;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** Used to insert BibTeX's information
|
|
|
|
*/
|
2000-07-15 23:51:46 +00:00
|
|
|
class InsetBibtex : public InsetCommand {
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
|
|
|
///
|
2001-07-06 15:57:54 +00:00
|
|
|
InsetBibtex(InsetCommandParams const &, bool same_id = false);
|
2000-03-20 14:49:54 +00:00
|
|
|
///
|
|
|
|
~InsetBibtex();
|
2000-07-15 23:51:46 +00:00
|
|
|
///
|
2001-07-06 15:57:54 +00:00
|
|
|
Inset * clone(Buffer const &, bool same_id = false) const {
|
|
|
|
return new InsetBibtex(params(), same_id);
|
2000-10-10 11:50:43 +00:00
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-07-28 12:24:16 +00:00
|
|
|
string const getScreenLabel(Buffer const *) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
EDITABLE editable() const { return IS_EDITABLE; }
|
2000-08-04 13:12:30 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
Inset::Code lyxCode() const { return Inset::BIBTEX_CODE; }
|
2000-08-04 13:12:30 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
void edit(BufferView *, int x, int y, unsigned int button);
|
2001-07-20 14:18:48 +00:00
|
|
|
///
|
|
|
|
void edit(BufferView * bv, bool front = true);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
int latex(Buffer const *, std::ostream &,
|
2001-07-20 14:18:48 +00:00
|
|
|
bool fragile, bool freespace) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-10-03 09:13:34 +00:00
|
|
|
std::vector<std::pair<string,string> > const getKeys(Buffer const *) const;
|
2001-07-20 14:18:48 +00:00
|
|
|
///
|
|
|
|
bool addDatabase(string const &);
|
|
|
|
///
|
|
|
|
bool delDatabase(string const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-03-20 14:49:54 +00:00
|
|
|
bool display() const { return true; }
|
2000-07-15 23:51:46 +00:00
|
|
|
///
|
2000-03-20 14:49:54 +00:00
|
|
|
struct Holder {
|
|
|
|
InsetBibtex * inset;
|
|
|
|
BufferView * view;
|
|
|
|
};
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
private:
|
2000-03-20 14:49:54 +00:00
|
|
|
///
|
|
|
|
Holder holder;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|