// -*- C++ -*-
-/* This file is part of*
- * ======================================================
+/**
+ * \file insetcite.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * LyX, The Document Processor
- *
- * Copyright 1995 Matthias Ettrich
- * Copyright 1995-2000 The LyX Team.
- *
- * ====================================================== */
+ * \author Angus Leeming
+ * \author Herbert Voß
+ *
+ * Full author contact details are available in file CREDITS.
+ */
#ifndef INSET_CITE_H
#define INSET_CITE_H
-#ifdef __GNUG__
-#pragma interface
-#endif
#include "insetcommand.h"
-#include "bibforms.h"
-#include <vector>
+#include "bufferparams.h"
-class Buffer;
-/** Used to insert citations
+/** Used to insert citations
*/
-class InsetCitation: public InsetCommand {
+class InsetCitation : public InsetCommand {
public:
///
- enum State {
- CANCEL,
- OK,
- DOWN,
- UP,
- DELETE,
- ADD,
- BIBBRSR,
- CITEBRSR,
- ON,
- OFF
- };
- ///
- InsetCitation() : InsetCommand("cite") {}
+ InsetCitation(InsetCommandParams const &);
///
- explicit
- InsetCitation(string const & key, string const & note = string());
- ///
- ~InsetCitation();
- ///
- Inset * Clone() const {
- return new InsetCitation(getContents(), getOptions());
+ std::auto_ptr<InsetBase> clone() const {
+ return std::auto_ptr<InsetBase>(new InsetCitation(params()));
}
- ///
- string getScreenLabel()const;
- ///
- void Edit(BufferView *, int x, int y, unsigned int button);
///
- void callback( FD_citation_form *, State );
- ///
- EDITABLE Editable() const {
- return IS_EDITABLE;
- }
+ std::string const getScreenLabel(Buffer const &) const;
///
- struct Holder {
- InsetCitation * inset;
- BufferView * view;
- };
-
-private:
- ///
- void setSize( FD_citation_form *, int, bool ) const;
+ EDITABLE editable() const { return IS_EDITABLE; }
///
- void setBibButtons( FD_citation_form *, State ) const;
+ InsetOld::Code lyxCode() const { return InsetOld::CITE_CODE; }
///
- void setCiteButtons( FD_citation_form *, State ) const;
+ int plaintext(Buffer const &, std::ostream &, OutputParams const &) const;
+ ///
+ int latex(Buffer const &, std::ostream &,
+ OutputParams const &) const;
+ ///
+ int docbook(Buffer const &, std::ostream &,
+ OutputParams const &) const;
+ ///
+ void validate(LaTeXFeatures &) const;
+
+private:
+ /// This function does the donkey work of creating the pretty label
+ std::string const generateLabel(Buffer const &) const;
+
+ struct Cache {
+ ///
+ Cache() : engine(lyx::biblio::ENGINE_BASIC) {}
+ ///
+ lyx::biblio::CiteEngine engine;
+ ///
+ InsetCommandParams params;
+ ///
+ std::string generated_label;
+ ///
+ std::string screen_label;
+ };
///
- void updateBrowser( FL_OBJECT *, std::vector<string> const & ) const;
- ///
- Holder holder;
+ mutable Cache cache;
};
#endif // INSET_CITE_H