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 InsetRef.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 José Matos
|
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_REF_H
|
|
|
|
#define INSET_REF_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 {
|
|
|
|
|
2004-02-13 11:05:29 +00:00
|
|
|
/// The reference inset
|
2000-07-15 23:51:46 +00:00
|
|
|
class InsetRef : public InsetCommand {
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
2001-01-21 21:41:35 +00:00
|
|
|
struct type_info {
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string latex_name;
|
2001-01-21 21:41:35 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string gui_name;
|
2001-01-21 21:41:35 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string short_gui_name;
|
2001-01-21 21:41:35 +00:00
|
|
|
};
|
2013-10-07 22:59:05 +00:00
|
|
|
static const type_info types[];
|
2001-01-21 21:41:35 +00:00
|
|
|
|
2010-10-27 21:35:13 +00:00
|
|
|
///
|
2009-11-08 15:53:21 +00:00
|
|
|
InsetRef(Buffer * buffer, InsetCommandParams const &);
|
2003-06-03 15:10:14 +00:00
|
|
|
|
2019-12-31 11:29:53 +00:00
|
|
|
///
|
|
|
|
void changeTarget(docstring const & new_label);
|
|
|
|
|
2010-10-27 21:35:13 +00:00
|
|
|
/// \name Public functions inherited from Inset class
|
|
|
|
//@{
|
2008-03-10 15:30:32 +00:00
|
|
|
///
|
2019-12-31 11:29:53 +00:00
|
|
|
docstring layoutName() const;
|
|
|
|
///
|
2018-04-07 01:31:11 +00:00
|
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
|
|
|
///
|
|
|
|
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & status) const;
|
|
|
|
///
|
2008-03-10 15:30:32 +00:00
|
|
|
bool isLabeled() const { return true; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2010-02-26 20:16:12 +00:00
|
|
|
docstring toolTip(BufferView const &, int, int) const
|
|
|
|
{ return tooltip_; }
|
2000-08-04 13:12:30 +00:00
|
|
|
///
|
2019-12-30 15:28:15 +00:00
|
|
|
docstring getTOCString() const;
|
2014-10-30 22:39:58 +00:00
|
|
|
///
|
2009-04-22 20:55:13 +00:00
|
|
|
bool hasSettings() const { return true; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
InsetCode lyxCode() const { return REF_CODE; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2011-02-10 20:02:48 +00:00
|
|
|
void latex(otexstream &, OutputParams const &) const;
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2013-03-08 19:52:18 +00:00
|
|
|
int plaintext(odocstringstream & ods, OutputParams const & op,
|
|
|
|
size_t max_length = INT_MAX) const;
|
2000-04-24 20:58:23 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int docbook(odocstream &, OutputParams const &) const;
|
2009-11-14 14:12:37 +00:00
|
|
|
///
|
2019-05-09 23:35:40 +00:00
|
|
|
docstring xhtml(XMLStream &, OutputParams const &) const;
|
2017-05-16 10:13:58 +00:00
|
|
|
///
|
2010-12-15 01:34:04 +00:00
|
|
|
void toString(odocstream &) const;
|
2000-05-19 16:46:01 +00:00
|
|
|
///
|
2015-10-04 18:38:47 +00:00
|
|
|
void forOutliner(docstring &, size_t const, bool const) const;
|
2010-12-20 21:55:09 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
void validate(LaTeXFeatures & features) const;
|
2007-10-25 04:13:56 +00:00
|
|
|
///
|
2020-03-06 12:23:01 +00:00
|
|
|
void updateBuffer(ParIterator const & it, UpdateType, bool const deleted = false);
|
2010-10-27 21:35:13 +00:00
|
|
|
///
|
2015-09-27 06:05:00 +00:00
|
|
|
void addToToc(DocIterator const & di, bool output_active,
|
2017-01-13 10:06:48 +00:00
|
|
|
UpdateType utype, TocBackend & backend) const;
|
2010-10-27 22:34:18 +00:00
|
|
|
///
|
2019-08-05 14:30:01 +00:00
|
|
|
bool forceLTR(OutputParams const &) const;
|
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-14 14:12:37 +00:00
|
|
|
static std::string defaultCommand() { return "ref"; }
|
2007-10-25 04:13:56 +00:00
|
|
|
///
|
|
|
|
static bool isCompatibleCommand(std::string const & s);
|
2010-10-27 21:35:13 +00:00
|
|
|
//@}
|
2020-03-14 15:29:53 +00:00
|
|
|
///
|
|
|
|
bool outputActive() const { return active_; }
|
2010-10-27 21:35:13 +00:00
|
|
|
|
2003-10-17 18:01:15 +00:00
|
|
|
protected:
|
2007-11-01 22:17:22 +00:00
|
|
|
///
|
2004-11-23 23:04:52 +00:00
|
|
|
InsetRef(InsetRef const &);
|
2010-10-27 21:35:13 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
private:
|
2010-10-27 21:35:13 +00:00
|
|
|
/// \name Private functions inherited from Inset class
|
|
|
|
//@{
|
2007-11-01 22:17:22 +00:00
|
|
|
///
|
|
|
|
Inset * clone() const { return new InsetRef(*this); }
|
2010-10-27 21:35:13 +00:00
|
|
|
//@}
|
2017-05-16 10:13:58 +00:00
|
|
|
|
|
|
|
/// \name Private functions inherited from InsetCommand class
|
|
|
|
//@{
|
|
|
|
///
|
|
|
|
docstring screenLabel() const;
|
|
|
|
//@}
|
|
|
|
|
2010-10-28 15:15:14 +00:00
|
|
|
/// \return the label with things that need to be escaped escaped
|
|
|
|
docstring getEscapedLabel(OutputParams const &) const;
|
|
|
|
/// \return the command for a formatted reference to ref
|
2010-11-08 17:50:02 +00:00
|
|
|
/// \param label we're cross-referencing
|
|
|
|
/// \param argument for reference command
|
|
|
|
/// \param prefix of the label (before :)
|
|
|
|
docstring getFormattedCmd(docstring const & ref, docstring & label,
|
2016-06-18 23:29:15 +00:00
|
|
|
docstring & prefix, docstring const & caps) const;
|
2010-10-27 21:35:13 +00:00
|
|
|
|
2008-03-03 17:58:26 +00:00
|
|
|
///
|
|
|
|
mutable docstring screen_label_;
|
2010-02-26 20:16:12 +00:00
|
|
|
///
|
2017-05-16 10:13:58 +00:00
|
|
|
mutable bool broken_;
|
|
|
|
///
|
2020-03-14 15:29:53 +00:00
|
|
|
mutable bool active_;
|
|
|
|
///
|
2010-02-26 20:16:12 +00:00
|
|
|
mutable docstring tooltip_;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2010-10-27 21:35:13 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
2010-10-27 21:35:13 +00:00
|
|
|
#endif // INSET_REF_H
|