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"
20 class InsetLabel : public InsetCommand
24 InsetLabel(Buffer * buf, InsetCommandParams const &);
27 docstring const & activeCounter() const { return active_counter_; }
29 docstring const & counterValue() const { return counter_value_; }
31 docstring const & prettyCounter() const { return pretty_counter_; }
33 void setPrettyCounter(docstring pc) { pretty_counter_ = pc; }
35 int rowFlags() const override { return CanBreakBefore | CanBreakAfter; }
36 /// Updates only the label string, doesn't handle undo nor references.
37 void updateLabel(docstring const & new_label, bool const active = true);
38 /// Updates the label and the references to it.
39 /// Will also handle undo/redo if \p cursor is passed.
40 void updateLabelAndRefs(docstring const & new_label, Cursor * cursor = 0);
42 /// \name Public functions inherited from Inset class
44 /// verify label and update references.
45 void initView() override;
47 bool isLabeled() const override { return true; }
49 bool hasSettings() const override { return true; }
51 InsetCode lyxCode() const override { return LABEL_CODE; }
53 void latex(otexstream & os, OutputParams const & runparams_in) const override;
55 int plaintext(odocstringstream & ods, OutputParams const & op,
56 size_t max_length = INT_MAX) const override;
58 void docbook(XMLStream &, OutputParams const &) const override;
60 docstring xhtml(XMLStream &, OutputParams const &) const override;
62 void updateBuffer(ParIterator const & it, UpdateType, bool const deleted = false) override;
64 void addToToc(DocIterator const & di, bool output_active,
65 UpdateType utype, TocBackend & backend) const override;
66 /// Is the content of this inset part of the immediate (visible) text sequence?
67 bool isPartOfTextSequence() const override { return false; }
70 /// \name Static public methods obligated for InsetCommand derived classes
73 static ParamInfo const & findInfo(std::string const &);
75 static std::string defaultCommand() { return "label"; }
77 static bool isCompatibleCommand(std::string const & s)
78 { return s == "label"; }
82 /// \name Private functions inherited from InsetCommand class
85 docstring screenLabel() const override;
89 /// \name Private functions inherited from Inset class
92 Inset * clone() const override { return new InsetLabel(*this); }
94 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & status) const override;
96 void doDispatch(Cursor & cur, FuncRequest & cmd) override;
100 void uniqueLabel(docstring & label) const;
102 void updateReferences(docstring const & old_label,
103 docstring const & new_label, bool const changes);
105 docstring screen_label_;
107 docstring active_counter_;
109 docstring counter_value_;
111 docstring pretty_counter_;