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