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
|
|
|
|
|
2010-10-31 01:04:03 +00:00
|
|
|
|
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 {
|
|
|
|
|
2010-10-31 01:04:03 +00:00
|
|
|
class BiblioInfo;
|
|
|
|
|
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
|
|
|
///
|
2010-05-03 21:43:46 +00:00
|
|
|
~InsetBibitem();
|
2010-10-27 21:35:13 +00:00
|
|
|
|
2008-03-27 22:26:24 +00:00
|
|
|
///
|
2010-10-27 21:35:13 +00:00
|
|
|
void updateCommand(docstring const & new_key, bool dummy = false);
|
|
|
|
|
|
|
|
/// \name Public functions inherited from Inset class
|
|
|
|
//@{
|
2008-03-27 22:26:24 +00:00
|
|
|
///
|
2010-10-27 21:35:13 +00:00
|
|
|
InsetCode lyxCode() const { return BIBITEM_CODE; }
|
2010-10-25 23:20:05 +00:00
|
|
|
///
|
2010-10-27 21:35:13 +00:00
|
|
|
bool hasSettings() const { return true; }
|
|
|
|
/// \copydoc Inset::initView()
|
2008-03-04 06:41:47 +00:00
|
|
|
/// verify label and update references.
|
|
|
|
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
|
|
|
///
|
2013-03-08 19:52:18 +00:00
|
|
|
int plaintext(odocstringstream &, OutputParams const &,
|
2013-04-08 13:18:04 +00:00
|
|
|
size_t max_length = INT_MAX) const;
|
2003-02-21 09:20:18 +00:00
|
|
|
///
|
2010-10-27 21:35:13 +00:00
|
|
|
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
2003-02-21 09:20:18 +00:00
|
|
|
///
|
2010-12-03 20:08:04 +00:00
|
|
|
void collectBibKeys(InsetIterator const &) const;
|
2010-10-27 21:35:13 +00:00
|
|
|
/// update the counter of this inset
|
|
|
|
void updateBuffer(ParIterator const &, UpdateType);
|
|
|
|
///@}
|
|
|
|
|
|
|
|
/// \name Static public methods obligated for InsetCommand derived classes
|
|
|
|
//@{
|
2003-02-21 09:20:18 +00:00
|
|
|
///
|
2010-10-27 21:35:13 +00:00
|
|
|
static ParamInfo const & findInfo(std::string const &);
|
2004-08-14 18:41:27 +00:00
|
|
|
///
|
2010-10-27 21:35:13 +00:00
|
|
|
static std::string defaultCommand() { return "bibitem"; }
|
2007-08-14 16:50:51 +00:00
|
|
|
///
|
2011-12-03 22:15:11 +00:00
|
|
|
static bool isCompatibleCommand(std::string const & s)
|
2010-10-27 21:35:13 +00:00
|
|
|
{ return s == "bibitem"; }
|
|
|
|
///@}
|
|
|
|
|
|
|
|
private:
|
2009-06-11 20:08:39 +00:00
|
|
|
///
|
2010-10-27 21:35:13 +00:00
|
|
|
docstring bibLabel() const;
|
|
|
|
|
|
|
|
/// \name Private functions inherited from Inset class
|
|
|
|
//@{
|
2007-10-25 04:13:56 +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); }
|
2016-12-27 11:06:54 +00:00
|
|
|
/// Is the content of this inset part of the immediate (visible) text sequence?
|
|
|
|
bool isPartOfTextSequence() const { return false; }
|
2010-10-27 21:35:13 +00:00
|
|
|
///@}
|
|
|
|
|
|
|
|
/// \name Private functions inherited from InsetCommand class
|
|
|
|
//@{
|
|
|
|
///
|
|
|
|
docstring screenLabel() const;
|
|
|
|
//@}
|
2008-03-27 22:26:24 +00:00
|
|
|
|
2010-02-12 16:08:30 +00:00
|
|
|
friend docstring bibitemWidest(Buffer const & buffer, OutputParams const &);
|
2010-10-27 21:35:13 +00:00
|
|
|
|
2010-03-03 22:13:45 +00:00
|
|
|
/// The label that is set by updateBuffer
|
2007-08-16 11:12:56 +00:00
|
|
|
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.
|
2010-02-12 16:08:30 +00:00
|
|
|
docstring bibitemWidest(Buffer const &, OutputParams const &);
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2010-10-27 21:35:13 +00:00
|
|
|
|
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
|