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