]> git.lyx.org Git - lyx.git/blob - src/insets/InsetRef.h
Merge branch 'master' into biblatex2
[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 const 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   docstring getTOCString() const;
49         ///
50         bool hasSettings() const { return true; }
51         ///
52         InsetCode lyxCode() const { return REF_CODE; }
53         ///
54         DisplayType display() const { return Inline; }
55         ///
56         void latex(otexstream &, OutputParams const &) const;
57         ///
58         int plaintext(odocstringstream & ods, OutputParams const & op,
59                       size_t max_length = INT_MAX) const;
60         ///
61         int docbook(odocstream &, OutputParams const &) const;
62         ///
63         docstring xhtml(XHTMLStream &, OutputParams const &) const;
64         /// 
65         void toString(odocstream &) const;
66         ///
67         void forOutliner(docstring &, size_t const, bool const) const;
68         ///
69         void validate(LaTeXFeatures & features) const;
70         ///
71         void updateBuffer(ParIterator const & it, UpdateType);
72         ///
73         void addToToc(DocIterator const & di, bool output_active,
74                                   UpdateType utype) const;
75         ///
76         bool forceLTR() const { return true; }
77         //@}
78
79         /// \name Static public methods obligated for InsetCommand derived classes
80         //@{
81         ///
82         static ParamInfo const & findInfo(std::string const &);
83         ///
84         static std::string defaultCommand() { return "ref"; }
85         ///
86         static bool isCompatibleCommand(std::string const & s);
87         //@}
88
89         //FIXME: private
90         /// \name Private functions inherited from InsetCommand class
91         //@{
92         ///
93         docstring screenLabel() const { return screen_label_; }
94         //@}
95
96 protected:
97         ///
98         InsetRef(InsetRef const &);
99
100 private:
101         /// \name Private functions inherited from Inset class
102         //@{
103         ///
104         Inset * clone() const { return new InsetRef(*this); }
105         //@}
106         
107         /// \return the label with things that need to be escaped escaped
108         docstring getEscapedLabel(OutputParams const &) const;
109         /// \return the command for a formatted reference to ref
110         /// \param label we're cross-referencing
111         /// \param argument for reference command
112         /// \param prefix of the label (before :)
113         docstring getFormattedCmd(docstring const & ref, docstring & label,
114                         docstring & prefix, docstring const & caps) const;
115
116         ///
117         mutable docstring screen_label_;
118         ///
119         mutable docstring tooltip_;
120 };
121
122
123 } // namespace lyx
124
125 #endif // INSET_REF_H