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
|
|
|
|
|
|
|
|
#include "insetcommand.h"
|
|
|
|
|
2000-03-28 02:18:55 +00:00
|
|
|
using std::ostream;
|
|
|
|
|
2000-02-25 12:06:15 +00:00
|
|
|
class Buffer;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** Used to insert citations
|
|
|
|
*/
|
|
|
|
class InsetCitation: public InsetCommand {
|
|
|
|
public:
|
|
|
|
///
|
1999-12-07 00:44:53 +00:00
|
|
|
InsetCitation() : InsetCommand("cite") {}
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
InsetCitation(string const & key, string const & note = string());
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
~InsetCitation();
|
|
|
|
///
|
1999-11-24 22:14:46 +00:00
|
|
|
Inset * Clone() const {
|
1999-11-22 16:19:48 +00:00
|
|
|
return new InsetCitation(contents, options);
|
|
|
|
}
|
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-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
|
|
|
}
|
2000-02-22 00:36:17 +00:00
|
|
|
///
|
|
|
|
struct Holder {
|
|
|
|
InsetCitation * inset;
|
|
|
|
BufferView * view;
|
|
|
|
};
|
|
|
|
|
2000-02-25 16:42:21 +00:00
|
|
|
private:
|
2000-02-22 00:36:17 +00:00
|
|
|
///
|
|
|
|
Holder holder;
|
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.
|
|
|
|
*/
|
|
|
|
class InsetBibKey: public InsetCommand {
|
|
|
|
public:
|
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
InsetBibKey() : InsetCommand("bibitem") { counter = 1; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
InsetBibKey(string const & key, string const & label = string());
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
InsetBibKey(InsetBibKey const *);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
~InsetBibKey();
|
|
|
|
///
|
1999-11-24 22:14:46 +00:00
|
|
|
Inset * Clone() const { return new InsetBibKey(this); }
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Currently \bibitem is used as a LyX2.x command, so we need this method.
|
2000-02-18 22:22:42 +00:00
|
|
|
void Write(ostream &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
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
|
|
|
///
|
|
|
|
struct Holder {
|
|
|
|
InsetBibKey * inset;
|
|
|
|
BufferView * view;
|
|
|
|
};
|
|
|
|
|
2000-02-25 16:42:21 +00:00
|
|
|
private:
|
|
|
|
///
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
class InsetBibtex: public InsetCommand {
|
|
|
|
public:
|
|
|
|
///
|
1999-12-07 00:44:53 +00:00
|
|
|
InsetBibtex() : InsetCommand("BibTeX") { owner = 0; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
InsetBibtex(string const & dbase, string const & style,
|
1999-09-27 18:44:28 +00:00
|
|
|
Buffer *);
|
2000-03-20 14:49:54 +00:00
|
|
|
///
|
|
|
|
~InsetBibtex();
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-24 22:14:46 +00:00
|
|
|
Inset * Clone() const {
|
1999-11-22 16:19:48 +00:00
|
|
|
return new InsetBibtex(contents, options, 0);
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
Inset::Code LyxCode() const
|
|
|
|
{
|
|
|
|
return Inset::BIBTEX_CODE;
|
|
|
|
}
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
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-09 03:36:48 +00:00
|
|
|
int Latex(ostream &, signed char, bool) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-12-22 14:35:05 +00:00
|
|
|
string getKeys(char delim);
|
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
|
|
|
}
|
|
|
|
///
|
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; }
|
|
|
|
|
|
|
|
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
|