]> git.lyx.org Git - lyx.git/blob - src/insets/InsetCounter.h
New counter manipulation inset.
[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 { return true; }
29         ///
30         docstring toolTip(BufferView const &, int, int) const
31                 { return tooltip_; }
32         ///
33         bool hasSettings() const { return true; }
34         ///
35         InsetCode lyxCode() const { return COUNTER_CODE; }
36         ///
37         void latex(otexstream &, OutputParams const &) const;
38         ///
39         int plaintext(odocstringstream & ods, OutputParams const & op,
40                       size_t max_length = INT_MAX) const;
41         ///
42         int docbook(odocstream &, OutputParams const &) const;
43         ///
44         docstring xhtml(XHTMLStream &, OutputParams const &) const;
45         ///
46         void toString(odocstream &) const;
47         ///
48         void validate(LaTeXFeatures & features) const;
49         ///
50         void updateBuffer(ParIterator const & it, UpdateType, bool const);
51         ///
52         std::string contextMenuName() const;
53         //@}
54
55         /// \name Static public methods obligated for InsetCommand derived classes
56         //@{
57         ///
58         static ParamInfo const & findInfo(std::string const &);
59         ///
60         static std::string defaultCommand() { return "set"; }
61         ///
62         static bool isCompatibleCommand(std::string const & s);
63         //@}
64         /// keys are commands, values are GUI strings
65         static const std::map<std::string, std::string> counterTable;
66         static const std::map<std::string, std::string> valueTable;
67
68 protected:
69         ///
70         InsetCounter(InsetCounter const &);
71
72 private:
73         /// \name Private functions inherited from Inset class
74         //@{
75         ///
76         Inset * clone() const { return new InsetCounter(*this); }
77         //@}
78
79         /// \name Private functions inherited from InsetCommand class
80         //@{
81         ///
82         docstring screenLabel() const { return screen_label_; }
83         //@}
84         ///
85         docstring value() const;
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