]> git.lyx.org Git - lyx.git/blob - src/insets/InsetBibitem.h
tex2lyx/text.cpp: fix typos
[lyx.git] / src / insets / InsetBibitem.h
1 // -*- C++ -*-
2 /**
3  * \file InsetBibitem.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Alejandro Aguilar Sierra
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSET_BIBITEM_H
13 #define INSET_BIBITEM_H
14
15
16 #include "InsetCommand.h"
17
18
19 namespace lyx {
20
21 class BiblioInfo;
22
23 /////////////////////////////////////////////////////////////////////////
24 //
25 // InsetBibItem
26 //
27 /////////////////////////////////////////////////////////////////////////
28
29 /// Used to insert bibitem's information (key and label)
30
31 //  Must be automatically inserted as the first object in a
32 //  bibliography paragraph.
33 class InsetBibitem : public InsetCommand
34 {
35 public:
36         ///
37         InsetBibitem(Buffer *, InsetCommandParams const &);
38         ///
39         ~InsetBibitem();
40
41         ///
42         void updateCommand(docstring const & new_key, bool dummy = false);
43
44         /// \name Public functions inherited from Inset class
45         //@{
46         ///
47         InsetCode lyxCode() const { return BIBITEM_CODE; }
48         ///
49         bool hasSettings() const { return true; }
50         /// \copydoc Inset::initView()
51         /// verify label and update references.
52         void initView();
53         ///
54         bool isLabeled() const { return true; }
55         ///
56         void read(Lexer & lex);
57         ///
58         int plaintext(odocstream &, OutputParams const &) const;
59         ///
60         docstring xhtml(XHTMLStream &, OutputParams const &) const;
61         ///
62         void collectBibKeys(InsetIterator const &) const;
63         /// update the counter of this inset
64         void updateBuffer(ParIterator const &, UpdateType);
65         ///@}
66
67         /// \name Static public methods obligated for InsetCommand derived classes
68         //@{
69         ///
70         static ParamInfo const & findInfo(std::string const &);
71         ///
72         static std::string defaultCommand() { return "bibitem"; }
73         ///
74         static bool isCompatibleCommand(std::string const & s)
75                 { return s == "bibitem"; }
76         ///@}
77
78 private:
79         ///
80         docstring bibLabel() const;
81
82         /// \name Private functions inherited from Inset class
83         //@{
84         ///
85         void doDispatch(Cursor & cur, FuncRequest & cmd);
86         ///
87         Inset * clone() const { return new InsetBibitem(*this); }
88         ///@}
89
90         /// \name Private functions inherited from InsetCommand class
91         //@{
92         ///
93         docstring screenLabel() const;
94         //@}
95
96         friend docstring bibitemWidest(Buffer const & buffer, OutputParams const &);
97
98         /// The label that is set by updateBuffer
99         docstring autolabel_;
100         ///
101         static int key_counter;
102 };
103
104
105 /// Return the widest label in the Bibliography.
106 docstring bibitemWidest(Buffer const &, OutputParams const &);
107
108
109 } // namespace lyx
110
111 #endif // INSET_BIBITEM_H