]> git.lyx.org Git - lyx.git/blob - src/insets/InsetLabel.h
Change cursor shape for clickable math insets
[lyx.git] / src / insets / InsetLabel.h
1 // -*- C++ -*-
2 /**
3  * \file InsetLabel.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSET_LABEL_H
13 #define INSET_LABEL_H
14
15 #include "InsetCommand.h"
16
17
18 namespace lyx {
19
20 class InsetLabel : public InsetCommand
21 {
22 public:
23         ///
24         InsetLabel(Buffer * buf, InsetCommandParams const &);
25
26         ///
27         docstring const & activeCounter() const { return active_counter_; }
28         ///
29         docstring const & counterValue() const { return counter_value_; }
30         ///
31         docstring const & prettyCounter() const { return pretty_counter_; }
32         /// Updates only the label string, doesn't handle undo nor references.
33         void updateLabel(docstring const & new_label, bool const active = true);
34         /// Updates the label and the references to it.
35         /// Will also handle undo/redo if \p cursor is passed.
36         void updateLabelAndRefs(docstring const & new_label, Cursor * cursor = 0);
37
38         /// \name Public functions inherited from Inset class
39         //@{
40         /// verify label and update references.
41         void initView() override;
42         ///
43         bool isLabeled() const override { return true; }
44         ///
45         bool hasSettings() const override { return true; }
46         ///
47         InsetCode lyxCode() const override { return LABEL_CODE; }
48         ///
49         void latex(otexstream & os, OutputParams const & runparams_in) const override;
50         ///
51         int plaintext(odocstringstream & ods, OutputParams const & op,
52                       size_t max_length = INT_MAX) const override;
53         ///
54         void docbook(XMLStream &, OutputParams const &) const override;
55         ///
56         docstring xhtml(XMLStream &, OutputParams const &) const override;
57         ///
58         void updateBuffer(ParIterator const & it, UpdateType, bool const deleted = false) override;
59         ///
60         void addToToc(DocIterator const & di, bool output_active,
61                                   UpdateType utype, TocBackend & backend) const override;
62         /// Is the content of this inset part of the immediate (visible) text sequence?
63         bool isPartOfTextSequence() const override { return false; }
64         //@}
65
66         /// \name Static public methods obligated for InsetCommand derived classes
67         //@{
68         ///
69         static ParamInfo const & findInfo(std::string const &);
70         ///
71         static std::string defaultCommand() { return "label"; }
72         ///
73         static bool isCompatibleCommand(std::string const & s)
74                 { return s == "label"; }
75         //@}
76
77         //FIXME: private
78         /// \name Private functions inherited from InsetCommand class
79         //@{
80         ///
81         docstring screenLabel() const override;
82         //@}
83
84 private:
85         /// \name Private functions inherited from Inset class
86         //@{
87         ///
88         Inset * clone() const override { return new InsetLabel(*this); }
89         ///
90         bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & status) const override;
91         ///
92         void doDispatch(Cursor & cur, FuncRequest & cmd) override;
93         //@}
94
95         ///
96         void uniqueLabel(docstring & label) const;
97         ///
98         void updateReferences(docstring const & old_label,
99                 docstring const & new_label);
100         ///
101         docstring screen_label_;
102         ///
103         docstring active_counter_;
104         ///
105         docstring counter_value_;
106         ///
107         docstring pretty_counter_;
108 };
109
110
111 } // namespace lyx
112
113 #endif