]> git.lyx.org Git - lyx.git/blob - src/insets/InsetCounter.h
Make BufferView::singeParUpdate more robust
[lyx.git] / src / insets / InsetCounter.h
1 // -*- C++ -*-
2 /**
3  * \file InsetCounter.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Richard Kimberly Heck
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSET_COUNTER_H
13 #define INSET_COUNTER_H
14
15 #include "InsetCommand.h"
16
17
18 namespace lyx {
19
20 ///
21 class InsetCounter : public InsetCommand {
22 public:
23         ///
24         InsetCounter(Buffer * buffer, InsetCommandParams const &);
25         /// \name Public functions inherited from Inset class
26         //@{
27         ///
28         bool isLabeled() const override { return true; }
29         ///
30         docstring toolTip(BufferView const &, int, int) const override
31                 { return tooltip_; }
32         ///
33         bool hasSettings() const override { return true; }
34         ///
35         InsetCode lyxCode() const override { return COUNTER_CODE; }
36         ///
37         void latex(otexstream &, OutputParams const &) const override;
38         ///
39         int plaintext(odocstringstream & ods, OutputParams const & op,
40                       size_t max_length = INT_MAX) const override;
41         ///
42         void docbook(XMLStream &, OutputParams const &) const override;
43         ///
44         docstring xhtml(XMLStream &, OutputParams const &) const override;
45         ///
46         bool findUsesToString() const override { return true; }
47         ///
48         void toString(odocstream &) const override;
49         ///
50         void validate(LaTeXFeatures & features) const override;
51         ///
52         void updateBuffer(ParIterator const & it, UpdateType, bool const) override;
53         ///
54         std::string contextMenuName() const override;
55         //@}
56
57         /// \name Static public methods obligated for InsetCommand derived classes
58         //@{
59         ///
60         static ParamInfo const & findInfo(std::string const &);
61         ///
62         static std::string defaultCommand() { return "set"; }
63         ///
64         static bool isCompatibleCommand(std::string const & s);
65         //@}
66         /// keys are commands, values are GUI strings
67         static const std::vector<std::pair<std::string, std::string>> counterTable;
68         static const std::map<std::string, std::string> valueTable;
69
70 protected:
71         ///
72         InsetCounter(InsetCounter const &);
73
74 private:
75         /// \name Private functions inherited from Inset class
76         //@{
77         ///
78         Inset * clone() const override { return new InsetCounter(*this); }
79         //@}
80
81         /// \name Private functions inherited from InsetCommand class
82         //@{
83         ///
84         docstring screenLabel() const override { return screen_label_; }
85         //@}
86         ///
87         docstring lyxSaveCounter() const;
88         ///
89         void trackCounters(std::string const & cmd) const;
90         ///
91         mutable docstring screen_label_;
92         ///
93         mutable docstring tooltip_;
94 };
95
96
97 } // namespace lyx
98
99 #endif // INSET_REF_H