]> git.lyx.org Git - lyx.git/blob - src/insets/InsetRef.h
Natbib authoryear uses (Ref1; Ref2) by default.
[lyx.git] / src / insets / InsetRef.h
1 // -*- C++ -*-
2 /**
3  * \file InsetRef.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author José Matos
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSET_REF_H
13 #define INSET_REF_H
14
15 #include "InsetCommand.h"
16
17
18 namespace lyx {
19
20 /// The reference inset
21 class InsetRef : public InsetCommand {
22 public:
23         struct type_info {
24                 ///
25                 std::string latex_name;
26                 ///
27                 std::string gui_name;
28                 ///
29                 std::string short_gui_name;
30         };
31         static type_info types[];
32         ///
33         static int getType(std::string const & name);
34         ///
35         static std::string const & getName(int type);
36
37         ///
38         InsetRef(Buffer * buffer, InsetCommandParams const &);
39
40         /// \name Public functions inherited from Inset class
41         //@{
42         ///
43         bool isLabeled() const { return true; }
44         ///
45         docstring toolTip(BufferView const &, int, int) const
46                 { return tooltip_; }
47         ///
48         bool hasSettings() const { return true; }
49         ///
50         InsetCode lyxCode() const { return REF_CODE; }
51         ///
52         DisplayType display() const { return Inline; }
53         ///
54         void latex(otexstream &, OutputParams const &) const;
55         ///
56         int plaintext(odocstringstream & ods, OutputParams const & op,
57                       size_t max_length = INT_MAX) const;
58         ///
59         int docbook(odocstream &, OutputParams const &) const;
60         ///
61         docstring xhtml(XHTMLStream &, OutputParams const &) const;
62         /// 
63         void toString(odocstream &) const;
64         ///
65         void forToc(docstring &, size_t) const;
66         ///
67         void validate(LaTeXFeatures & features) const;
68         ///
69         void updateBuffer(ParIterator const & it, UpdateType);
70         ///
71         void addToToc(DocIterator const & di, bool output_active) const;
72         ///
73         bool forceLTR() const { return true; }
74         //@}
75
76         /// \name Static public methods obligated for InsetCommand derived classes
77         //@{
78         ///
79         static ParamInfo const & findInfo(std::string const &);
80         ///
81         static std::string defaultCommand() { return "ref"; }
82         ///
83         static bool isCompatibleCommand(std::string const & s);
84         //@}
85
86         //FIXME: private
87         /// \name Private functions inherited from InsetCommand class
88         //@{
89         ///
90         docstring screenLabel() const { return screen_label_; }
91         //@}
92
93 protected:
94         ///
95         InsetRef(InsetRef const &);
96
97 private:
98         /// \name Private functions inherited from Inset class
99         //@{
100         ///
101         Inset * clone() const { return new InsetRef(*this); }
102         //@}
103         
104         /// \return the label with things that need to be escaped escaped
105         docstring getEscapedLabel(OutputParams const &) const;
106         /// \return the command for a formatted reference to ref
107         /// \param label we're cross-referencing
108         /// \param argument for reference command
109         /// \param prefix of the label (before :)
110         docstring getFormattedCmd(docstring const & ref, docstring & label,
111                         docstring & prefix) const;
112
113         ///
114         mutable docstring screen_label_;
115         ///
116         mutable docstring tooltip_;
117 };
118
119
120 } // namespace lyx
121
122 #endif // INSET_REF_H