*
* LyX, The Document Processor
*
- * Copyright (C) 1995 Matthias Ettrich
- * Copyright (C) 1995-1999 The LyX Team.
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-2000 The LyX Team.
*
* ====================================================== */
#pragma interface
#endif
+#include <vector>
#include "insetcommand.h"
-// Created by Alejandro 970222
-
-
-/** Used to insert citations
- */
-class InsetCitation: public InsetCommand {
-public:
- ///
- InsetCitation(): InsetCommand("cite") { }
- ///
- InsetCitation(string const & key, string const & note = string());
- ///
- ~InsetCitation();
- ///
- Inset * Clone() { return new InsetCitation(contents, options); }
- ///
- string getScreenLabel()const;
- ///
- void Edit(int, int);
- ///
- unsigned char Editable() const {
- return 1;
- }
-};
-
+class Buffer;
/** 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 {
+class InsetBibKey : public InsetCommand {
public:
///
- InsetBibKey(): InsetCommand("bibitem") { counter = 1; }
- ///
- InsetBibKey(string const & key, string const & label = string());
- ///
- InsetBibKey(InsetBibKey const *);
+ InsetBibKey(InsetCommandParams const &);
///
~InsetBibKey();
///
- Inset * Clone() { return new InsetBibKey(this); }
- /// Currently \bibitem is used as a LyX2.x command, so we need this method.
- void Write(FILE *);
+ Inset * Clone(Buffer const &) const;
+ /** Currently \bibitem is used as a LyX2.x command,
+ so we need this method.
+ */
+ void Write(Buffer const *, std::ostream &) const;
///
- virtual string getScreenLabel() const;
+ void Read(Buffer const *, LyXLex & lex);
+ ///
+ virtual string const getScreenLabel() const;
///
- void Edit(int, int);
+ void Edit(BufferView *, int x, int y, unsigned int button);
///
- unsigned char Editable() const {
- return 1;
+ EDITABLE Editable() const {
+ return IS_EDITABLE;
}
/// A user can't neither insert nor delete this inset
bool Deletable() const {
void setCounter(int);
///
int getCounter() const { return counter; }
-
- private:
+ ///
+ string const getBibLabel() const;
+ ///
+ struct Holder {
+ InsetBibKey * inset;
+ BufferView * view;
+ };
+
+private:
///
int counter;
+ ///
+ Holder holder;
+ ///
+ static int key_counter;
};
/** Used to insert BibTeX's information
*/
-class InsetBibtex: public InsetCommand {
+class InsetBibtex : public InsetCommand {
public:
- ///
- InsetBibtex(): InsetCommand("BibTeX") { owner = 0; }
///
- InsetBibtex(string const & dbase, string const & style,
- Buffer *);
- ///
- ~InsetBibtex();
- ///
- Inset * Clone() { return new InsetBibtex(contents, options, 0); }
- ///
- Inset::Code LyxCode() const
- {
- return Inset::BIBTEX_CODE;
+ InsetBibtex(InsetCommandParams const &);
+ ///
+ ~InsetBibtex();
+ ///
+ Inset * Clone(Buffer const &) const {
+ return new InsetBibtex(params());
}
///
- string getScreenLabel() const;
+ string const getScreenLabel() const;
///
- void Edit(int, int);
- ///
- int Latex(FILE *, signed char);
+ EDITABLE Editable() const { return IS_EDITABLE; }
///
- int Latex(string & file, signed char fragile);
+ Inset::Code LyxCode() const { return Inset::BIBTEX_CODE; }
///
- string getKeys();
+ void Edit(BufferView *, int x, int y, unsigned int button);
+ ///
+ int Latex(Buffer const *, std::ostream &,
+ bool fragile, bool freespace) const;
///
- unsigned char Editable() const {
- return 1;
- }
+ std::vector<std::pair<string,string> > const getKeys(Buffer const *) const;
///
- bool addDatabase(string const&);
+ bool addDatabase(string const &);
///
- bool delDatabase(string const&);
+ bool delDatabase(string const &);
+ ///
+ bool display() const { return true; }
///
- bool Display() const { return true; }
+ struct Holder {
+ InsetBibtex * inset;
+ BufferView * view;
+ };
+
private:
///
- Buffer *owner;
+ Holder holder;
};
-
#endif