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
|
2000-02-10 17:53:36 +00:00
|
|
|
* Copyright 1995-2000 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;
|
2000-07-07 07:46:37 +00:00
|
|
|
struct FD_bibitem_form;
|
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();
|
|
|
|
///
|
2000-08-04 13:12:30 +00:00
|
|
|
Inset * Clone() const;
|
2000-07-15 23:51:46 +00:00
|
|
|
/** Currently \bibitem is used as a LyX2.x command,
|
|
|
|
so we need this method.
|
|
|
|
*/
|
2000-06-12 11:27:15 +00:00
|
|
|
void Write(Buffer const *, std::ostream &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-07-13 09:38:34 +00:00
|
|
|
void Read(Buffer const *, LyXLex & lex);
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
virtual string getScreenLabel() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-25 12:06:15 +00:00
|
|
|
void Edit(BufferView *, int x, int y, unsigned int button);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-03-08 13:52:57 +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
|
|
|
|
bool Deletable() const {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
///
|
|
|
|
void setCounter(int);
|
|
|
|
///
|
|
|
|
int getCounter() const { return counter; }
|
2000-02-22 00:36:17 +00:00
|
|
|
///
|
2000-07-07 07:46:37 +00:00
|
|
|
void callback( FD_bibitem_form *, long );
|
|
|
|
///
|
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
|
|
|
///
|
|
|
|
int counter;
|
2000-02-22 00:36:17 +00:00
|
|
|
///
|
|
|
|
Holder holder;
|
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:
|
|
|
|
///
|
2000-08-04 13:12:30 +00:00
|
|
|
InsetBibtex(InsetCommandParams const &, Buffer *);
|
2000-03-20 14:49:54 +00:00
|
|
|
///
|
|
|
|
~InsetBibtex();
|
2000-07-15 23:51:46 +00:00
|
|
|
///
|
2000-08-04 13:12:30 +00:00
|
|
|
Inset * Clone() const { return new InsetBibtex(params(), owner); }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string getScreenLabel() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-08-04 13:12:30 +00:00
|
|
|
EDITABLE Editable() const { return IS_EDITABLE; }
|
|
|
|
///
|
|
|
|
Inset::Code LyxCode() const { return Inset::BIBTEX_CODE; }
|
|
|
|
///
|
2000-02-25 12:06:15 +00:00
|
|
|
void Edit(BufferView *, int x, int y, unsigned int button);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-07-15 23:51:46 +00:00
|
|
|
int Latex(Buffer const *, std::ostream &,
|
|
|
|
bool fragile, bool freespace) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-07-15 23:51:46 +00:00
|
|
|
std::vector<std::pair<string,string> > getKeys() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
bool addDatabase(string const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
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-02-18 22:22:42 +00:00
|
|
|
mutable Buffer * owner;
|
2000-03-20 14:49:54 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
Holder holder;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|