1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
2002-09-25 14:26:13 +00:00
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
* \file InsetLabel.h
|
2002-09-25 14:26:13 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2002-03-21 17:09:55 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-09-25 14:26:13 +00:00
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
#ifndef INSET_LABEL_H
|
|
|
|
#define INSET_LABEL_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "InsetCommand.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2017-07-03 17:45:58 +00:00
|
|
|
class InsetLabel : public InsetCommand
|
2010-10-18 14:20:03 +00:00
|
|
|
{
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
|
|
|
///
|
2009-11-08 16:10:34 +00:00
|
|
|
InsetLabel(Buffer * buf, InsetCommandParams const &);
|
2008-03-02 18:14:12 +00:00
|
|
|
|
2010-10-27 21:35:13 +00:00
|
|
|
///
|
|
|
|
docstring const & activeCounter() const { return active_counter_; }
|
|
|
|
///
|
|
|
|
docstring const & counterValue() const { return counter_value_; }
|
|
|
|
///
|
|
|
|
docstring const & prettyCounter() const { return pretty_counter_; }
|
2022-06-09 19:29:21 +00:00
|
|
|
///
|
|
|
|
int rowFlags() const override { return CanBreakBefore | CanBreakAfter; }
|
2011-07-06 17:40:51 +00:00
|
|
|
/// Updates only the label string, doesn't handle undo nor references.
|
2019-01-25 13:40:30 +00:00
|
|
|
void updateLabel(docstring const & new_label, bool const active = true);
|
2011-07-06 18:52:56 +00:00
|
|
|
/// Updates the label and the references to it.
|
|
|
|
/// Will also handle undo/redo if \p cursor is passed.
|
2011-07-06 17:40:51 +00:00
|
|
|
void updateLabelAndRefs(docstring const & new_label, Cursor * cursor = 0);
|
2010-10-27 21:35:13 +00:00
|
|
|
|
|
|
|
/// \name Public functions inherited from Inset class
|
|
|
|
//@{
|
2008-03-02 18:14:12 +00:00
|
|
|
/// verify label and update references.
|
2020-10-01 07:42:11 +00:00
|
|
|
void initView() override;
|
2008-03-10 15:30:32 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
bool isLabeled() const override { return true; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
bool hasSettings() const override { return true; }
|
2000-05-19 16:46:01 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
InsetCode lyxCode() const override { return LABEL_CODE; }
|
2000-08-04 13:12:30 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void latex(otexstream & os, OutputParams const & runparams_in) const override;
|
2019-03-14 13:24:43 +00:00
|
|
|
///
|
2013-03-08 19:52:18 +00:00
|
|
|
int plaintext(odocstringstream & ods, OutputParams const & op,
|
2020-10-01 07:42:11 +00:00
|
|
|
size_t max_length = INT_MAX) const override;
|
2000-04-24 20:58:23 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void docbook(XMLStream &, OutputParams const &) const override;
|
2007-10-25 04:13:56 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
docstring xhtml(XMLStream &, OutputParams const &) const override;
|
2009-06-05 17:48:14 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void updateBuffer(ParIterator const & it, UpdateType, bool const deleted = false) override;
|
2010-10-27 21:35:13 +00:00
|
|
|
///
|
2015-09-27 06:05:00 +00:00
|
|
|
void addToToc(DocIterator const & di, bool output_active,
|
2020-10-01 07:42:11 +00:00
|
|
|
UpdateType utype, TocBackend & backend) const override;
|
2016-12-27 11:06:54 +00:00
|
|
|
/// Is the content of this inset part of the immediate (visible) text sequence?
|
2020-10-01 07:42:11 +00:00
|
|
|
bool isPartOfTextSequence() const override { return false; }
|
2010-10-27 21:35:13 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/// \name Static public methods obligated for InsetCommand derived classes
|
|
|
|
//@{
|
|
|
|
///
|
2008-02-23 22:01:02 +00:00
|
|
|
static ParamInfo const & findInfo(std::string const &);
|
2007-10-25 04:13:56 +00:00
|
|
|
///
|
2009-11-28 21:37:47 +00:00
|
|
|
static std::string defaultCommand() { return "label"; }
|
2007-10-25 04:13:56 +00:00
|
|
|
///
|
2017-07-03 17:45:58 +00:00
|
|
|
static bool isCompatibleCommand(std::string const & s)
|
2007-10-25 04:13:56 +00:00
|
|
|
{ return s == "label"; }
|
2010-10-27 21:35:13 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
//FIXME: private
|
|
|
|
/// \name Private functions inherited from InsetCommand class
|
|
|
|
//@{
|
2008-02-27 15:23:22 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
docstring screenLabel() const override;
|
2010-10-27 21:35:13 +00:00
|
|
|
//@}
|
2017-07-03 17:45:58 +00:00
|
|
|
|
2010-10-27 21:35:13 +00:00
|
|
|
private:
|
|
|
|
/// \name Private functions inherited from Inset class
|
|
|
|
//@{
|
2008-03-03 09:35:26 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
Inset * clone() const override { return new InsetLabel(*this); }
|
2008-11-16 19:19:07 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & status) const override;
|
2008-02-23 22:01:02 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd) override;
|
2010-10-27 21:35:13 +00:00
|
|
|
//@}
|
|
|
|
|
2011-07-06 17:40:51 +00:00
|
|
|
///
|
|
|
|
void uniqueLabel(docstring & label) const;
|
|
|
|
///
|
|
|
|
void updateReferences(docstring const & old_label,
|
|
|
|
docstring const & new_label);
|
2008-03-03 13:31:44 +00:00
|
|
|
///
|
|
|
|
docstring screen_label_;
|
2010-01-20 19:03:17 +00:00
|
|
|
///
|
|
|
|
docstring active_counter_;
|
|
|
|
///
|
|
|
|
docstring counter_value_;
|
2010-01-20 20:33:36 +00:00
|
|
|
///
|
|
|
|
docstring pretty_counter_;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#endif
|