4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS.
15 #include "InsetCommand.h"
22 class InsetLabel : public InsetCommand
26 InsetLabel(Buffer * buf, InsetCommandParams const &);
29 docstring const & activeCounter() const { return active_counter_; }
31 docstring const & counterValue() const { return counter_value_; }
33 docstring const & prettyCounter() const { return pretty_counter_; }
34 /// Updates only the label string, doesn't handle undo nor references.
35 void updateLabel(docstring const & new_label);
36 /// Updates the label and the references to it.
37 /// Will also handle undo/redo if \p cursor is passed.
38 void updateLabelAndRefs(docstring const & new_label, Cursor * cursor = 0);
40 /// \name Public functions inherited from Inset class
42 /// verify label and update references.
45 bool isLabeled() const { return true; }
47 bool hasSettings() const { return true; }
49 InsetCode lyxCode() const { return LABEL_CODE; }
51 int plaintext(odocstringstream & ods, OutputParams const & op,
52 size_t max_length = INT_MAX) const;
54 int docbook(odocstream &, OutputParams const &) const;
56 docstring xhtml(XHTMLStream &, OutputParams const &) const;
58 void updateBuffer(ParIterator const & it, UpdateType);
60 void addToToc(DocIterator const & di, bool output_active,
61 UpdateType utype) const;
64 /// \name Static public methods obligated for InsetCommand derived classes
67 static ParamInfo const & findInfo(std::string const &);
69 static std::string defaultCommand() { return "label"; }
71 static bool isCompatibleCommand(std::string const & s)
72 { return s == "label"; }
76 /// \name Private functions inherited from InsetCommand class
79 docstring screenLabel() const;
83 /// \name Private functions inherited from Inset class
86 Inset * clone() const { return new InsetLabel(*this); }
88 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & status) const;
90 void doDispatch(Cursor & cur, FuncRequest & cmd);
94 void uniqueLabel(docstring & label) const;
96 void updateReferences(docstring const & old_label,
97 docstring const & new_label);
99 docstring screen_label_;
101 docstring active_counter_;
103 docstring counter_value_;
105 docstring pretty_counter_;