4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Richard Kimberly Heck
9 * Full author contact details are available in file CREDITS.
12 #ifndef INSET_COUNTER_H
13 #define INSET_COUNTER_H
15 #include "InsetCommand.h"
21 class InsetCounter : public InsetCommand {
24 InsetCounter(Buffer * buffer, InsetCommandParams const &);
25 /// \name Public functions inherited from Inset class
28 bool isLabeled() const override { return true; }
30 docstring toolTip(BufferView const &, int, int) const override
33 bool hasSettings() const override { return true; }
35 InsetCode lyxCode() const override { return COUNTER_CODE; }
37 void latex(otexstream &, OutputParams const &) const override;
39 int plaintext(odocstringstream & ods, OutputParams const & op,
40 size_t max_length = INT_MAX) const override;
42 void docbook(XMLStream &, OutputParams const &) const override;
44 docstring xhtml(XMLStream &, OutputParams const &) const override;
46 bool findUsesToString() const override { return true; }
48 void toString(odocstream &) const override;
50 void validate(LaTeXFeatures & features) const override;
52 void updateBuffer(ParIterator const & it, UpdateType, bool const) override;
54 std::string contextMenuName() const override;
57 /// \name Static public methods obligated for InsetCommand derived classes
60 static ParamInfo const & findInfo(std::string const &);
62 static std::string defaultCommand() { return "set"; }
64 static bool isCompatibleCommand(std::string const & s);
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;
72 InsetCounter(InsetCounter const &);
75 /// \name Private functions inherited from Inset class
78 Inset * clone() const override { return new InsetCounter(*this); }
81 /// \name Private functions inherited from InsetCommand class
84 docstring screenLabel() const override { return screen_label_; }
87 docstring lyxSaveCounter() const;
89 void trackCounters(std::string const & cmd) const;
91 mutable docstring screen_label_;
93 mutable docstring tooltip_;