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