2003-02-21 09:20:18 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
* \file InsetBibitem.h
|
2003-02-21 09:20:18 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Alejandro Aguilar Sierra
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-02-21 09:20:18 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INSET_BIBITEM_H
|
|
|
|
#define INSET_BIBITEM_H
|
|
|
|
|
2007-08-20 17:04:36 +00:00
|
|
|
#include "BiblioInfo.h"
|
2008-06-18 18:54:31 +00:00
|
|
|
#include "InsetCommand.h"
|
2003-02-21 09:20:18 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2008-03-27 22:26:24 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// InsetBibItem
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/// Used to insert bibitem's information (key and label)
|
2003-02-21 09:20:18 +00:00
|
|
|
|
2008-03-27 22:26:24 +00:00
|
|
|
// Must be automatically inserted as the first object in a
|
|
|
|
// bibliography paragraph.
|
|
|
|
class InsetBibitem : public InsetCommand
|
|
|
|
{
|
2003-02-21 09:20:18 +00:00
|
|
|
public:
|
|
|
|
///
|
2009-11-08 15:53:21 +00:00
|
|
|
InsetBibitem(Buffer *, InsetCommandParams const &);
|
More cache fixing. Similar fix as for InsetBibtex, and I've renamed the key routine.
Unfortunately, we can't do a one-short fix for InsetCommand, requiring that it take
a Buffer & in the constructor, due to problems in mathed, specifically, here:
void InsetMathHull::label(row_type row, docstring const & label)
{
...
label_[row] = new InsetLabel(p);
if (buffer_)
label_[row]->setBuffer(buffer());
}
If InsetLabel has to have a Buffer, then buffer_ has to be set, which means InsetMathHull needs a Buffer. But then truckloads of these are created in Parser, where we don't really seem to have access to a Buffer.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25137 a592a061-630c-0410-9148-cb99ea01b6c8
2008-06-05 06:55:34 +00:00
|
|
|
///
|
|
|
|
virtual ~InsetBibitem();
|
2008-03-27 22:26:24 +00:00
|
|
|
///
|
|
|
|
static ParamInfo const & findInfo(std::string const &);
|
|
|
|
///
|
|
|
|
static std::string defaultCommand() { return "bibitem"; }
|
|
|
|
///
|
|
|
|
static bool isCompatibleCommand(std::string const & s)
|
|
|
|
{ return s == "bibitem"; }
|
|
|
|
private:
|
2008-03-04 06:41:47 +00:00
|
|
|
/// verify label and update references.
|
2008-03-27 22:26:24 +00:00
|
|
|
/// Overloaded from Inset::initView.
|
2008-03-04 06:41:47 +00:00
|
|
|
void initView();
|
2003-02-21 09:20:18 +00:00
|
|
|
///
|
2008-03-10 15:30:32 +00:00
|
|
|
bool isLabeled() const { return true; }
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
void read(Lexer & lex);
|
2003-02-21 09:20:18 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
docstring screenLabel() const;
|
2003-02-21 09:20:18 +00:00
|
|
|
///
|
2009-04-22 20:55:13 +00:00
|
|
|
bool hasSettings() const { return true; }
|
2003-02-21 09:20:18 +00:00
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
InsetCode lyxCode() const { return BIBITEM_CODE; }
|
2003-02-21 09:20:18 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
docstring bibLabel() const;
|
2004-08-14 18:41:27 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int plaintext(odocstream &, OutputParams const &) const;
|
2007-08-14 16:50:51 +00:00
|
|
|
///
|
2009-11-30 22:28:54 +00:00
|
|
|
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
2009-06-11 20:08:39 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
virtual void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const;
|
2007-08-16 11:12:56 +00:00
|
|
|
/// Update the counter of this inset
|
2009-12-04 03:03:38 +00:00
|
|
|
virtual void updateLabels(ParIterator const &, bool);
|
2007-10-25 04:13:56 +00:00
|
|
|
///
|
2008-03-04 06:41:47 +00:00
|
|
|
void updateCommand(docstring const & new_key, bool dummy = false);
|
2003-10-17 18:01:15 +00:00
|
|
|
///
|
2008-03-27 22:26:24 +00:00
|
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
2008-02-23 22:01:02 +00:00
|
|
|
///
|
2008-03-27 22:26:24 +00:00
|
|
|
Inset * clone() const { return new InsetBibitem(*this); }
|
|
|
|
|
|
|
|
friend docstring bibitemWidest(Buffer const & buffer);
|
2007-08-16 11:12:56 +00:00
|
|
|
/// The label that is set by updateLabels
|
|
|
|
docstring autolabel_;
|
2003-02-21 09:20:18 +00:00
|
|
|
///
|
|
|
|
static int key_counter;
|
|
|
|
};
|
|
|
|
|
2005-01-23 16:36:36 +00:00
|
|
|
|
|
|
|
/// Return the widest label in the Bibliography.
|
2008-03-27 22:26:24 +00:00
|
|
|
docstring bibitemWidest(Buffer const &);
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
2005-01-23 16:36:36 +00:00
|
|
|
|
2003-02-21 09:20:18 +00:00
|
|
|
#endif // INSET_BIBITEM_H
|