]> git.lyx.org Git - lyx.git/blob - src/insets/InsetRef.h
InsetInfo: enable inset dissolve
[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         void doDispatch(Cursor & cur, FuncRequest & cmd);
44         ///
45         bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & status) const;
46         ///
47         bool isLabeled() const { return true; }
48         ///
49         docstring toolTip(BufferView const &, int, int) const
50                 { return tooltip_; }
51         ///
52   docstring getTOCString() const;
53         ///
54         bool hasSettings() const { return true; }
55         ///
56         InsetCode lyxCode() const { return REF_CODE; }
57         ///
58         DisplayType display() const { return Inline; }
59         ///
60         void latex(otexstream &, OutputParams const &) const;
61         ///
62         int plaintext(odocstringstream & ods, OutputParams const & op,
63                       size_t max_length = INT_MAX) const;
64         ///
65         int docbook(odocstream &, OutputParams const &) const;
66         ///
67         docstring xhtml(XHTMLStream &, OutputParams const &) const;
68         ///
69         void toString(odocstream &) const;
70         ///
71         void forOutliner(docstring &, size_t const, bool const) const;
72         ///
73         void validate(LaTeXFeatures & features) const;
74         ///
75         void updateBuffer(ParIterator const & it, UpdateType);
76         ///
77         void addToToc(DocIterator const & di, bool output_active,
78                                   UpdateType utype, TocBackend & backend) const;
79         ///
80         bool forceLTR() const { return true; }
81         //@}
82
83         /// \name Static public methods obligated for InsetCommand derived classes
84         //@{
85         ///
86         static ParamInfo const & findInfo(std::string const &);
87         ///
88         static std::string defaultCommand() { return "ref"; }
89         ///
90         static bool isCompatibleCommand(std::string const & s);
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         /// \name Private functions inherited from InsetCommand class
105         //@{
106         ///
107         docstring screenLabel() const;
108         //@}
109
110         /// \return the label with things that need to be escaped escaped
111         docstring getEscapedLabel(OutputParams const &) const;
112         /// \return the command for a formatted reference to ref
113         /// \param label we're cross-referencing
114         /// \param argument for reference command
115         /// \param prefix of the label (before :)
116         docstring getFormattedCmd(docstring const & ref, docstring & label,
117                         docstring & prefix, docstring const & caps) const;
118
119         ///
120         mutable docstring screen_label_;
121         ///
122         mutable bool broken_;
123         ///
124         mutable docstring tooltip_;
125 };
126
127
128 } // namespace lyx
129
130 #endif // INSET_REF_H