X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetbib.h;h=e51b236deaf9dfa610932c7067697f6cad72947f;hb=4a5b7a5952ad2381fcdf4830511293e184c7c5a1;hp=0e4d1bec8da0875a00bf23cb5022728deae083f5;hpb=27de1486ca34aaad446adb798d71a77d6f6304da;p=lyx.git diff --git a/src/insets/insetbib.h b/src/insets/insetbib.h index 0e4d1bec8d..e51b236dea 100644 --- a/src/insets/insetbib.h +++ b/src/insets/insetbib.h @@ -1,133 +1,123 @@ // -*- C++ -*- /* This file is part of* - * ====================================================== + * ====================================================== * * LyX, The Document Processor * - * Copyright (C) 1995 Matthias Ettrich - * Copyright (C) 1995-1998 The LyX Team. + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2001 The LyX Team. * - *======================================================*/ + * ====================================================== */ -#ifndef _INSET_BIB_H -#define _INSET_BIB_H +#ifndef INSET_BIB_H +#define INSET_BIB_H #ifdef __GNUG__ #pragma interface #endif +#include #include "insetcommand.h" -// Created by Alejandro 970222 - - -/** Used to insert citations - */ -class InsetCitation: public InsetCommand { -public: - /// - InsetCitation(): InsetCommand("cite") { } - /// - InsetCitation(LString const & key, LString const & note=LString()); - /// - ~InsetCitation(); - /// - Inset* Clone() { return new InsetCitation(contents, options); } - /// - LString 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(InsetCommandParams const &); + /// + ~InsetBibKey(); /// - InsetBibKey(LString const & key, LString const & label=LString()); + Inset * clone(Buffer const &, bool same_id = false) const; + /** Currently \bibitem is used as a LyX2.x command, + so we need this method. + */ + void write(Buffer const *, std::ostream &) const; /// - InsetBibKey(InsetBibKey const*); + void read(Buffer const *, LyXLex & lex); /// - ~InsetBibKey(); + virtual string const getScreenLabel(Buffer const *) const; /// - Inset* Clone() { return new InsetBibKey(this); } - /// Currently \bibitem is used as a LyX2.x command, so we need this method. - void Write(FILE *); + void edit(BufferView *, int x, int y, unsigned int button); /// - virtual LString getScreenLabel() const; - /// - void Edit(int, int); + void edit(BufferView * bv, bool front = true); /// - 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 { + bool deletable() const { return false; } - /// - void setCounter(int); - /// - int getCounter() const { return counter; } - - private: /// - int counter; + void setCounter(int); + /// + int getCounter() const { return counter; } + /// + 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 = NULL; } - /// - InsetBibtex(LString const & dbase, LString const & style, - Buffer *); - /// - ~InsetBibtex(); - /// - Inset* Clone() { return new InsetBibtex(contents, options, NULL); } - /// - Inset::Code LyxCode() const - { - return Inset::BIBTEX_CODE; + /// + InsetBibtex(InsetCommandParams const &, bool same_id = false); + /// + ~InsetBibtex(); + /// + Inset * clone(Buffer const &, bool same_id = false) const { + return new InsetBibtex(params(), same_id); } /// - LString getScreenLabel() const; + string const getScreenLabel(Buffer const *) const; + /// + EDITABLE editable() const { return IS_EDITABLE; } /// - void Edit(int, int); + Inset::Code lyxCode() const { return Inset::BIBTEX_CODE; } + /// + void edit(BufferView *, int x, int y, unsigned int button); + /// + void edit(BufferView * bv, bool front = true); /// - int Latex(FILE *, signed char); + int latex(Buffer const *, std::ostream &, + bool fragile, bool freespace) const; /// - int Latex(LString &file, signed char fragile); + std::vector > const getKeys(Buffer const *) const; /// - LString getKeys(); + std::vector const getFiles(Buffer const &) const; /// - unsigned char Editable() const { - return 1; - } - /// - bool addDatabase(LString const&); - /// - bool delDatabase(LString const&); + bool addDatabase(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