4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
15 #include "InsetCommand.h"
20 /// The reference inset
21 class InsetRef : public InsetCommand {
25 std::string latex_name;
29 std::string short_gui_name;
31 static type_info types[];
33 static int getType(std::string const & name);
35 static std::string const & getName(int type);
38 InsetRef(Buffer * buffer, InsetCommandParams const &);
40 /// \name Public functions inherited from Inset class
43 bool isLabeled() const { return true; }
45 docstring toolTip(BufferView const &, int, int) const
48 bool hasSettings() const { return true; }
50 InsetCode lyxCode() const { return REF_CODE; }
52 DisplayType display() const { return Inline; }
54 int latex(otexstream &, OutputParams const &) const;
56 int plaintext(odocstream &, OutputParams const &) const;
58 int docbook(odocstream &, OutputParams const &) const;
60 docstring xhtml(XHTMLStream &, OutputParams const &) const;
62 void toString(odocstream &) const;
64 void forToc(docstring &, size_t) const;
66 void validate(LaTeXFeatures & features) const;
68 void updateBuffer(ParIterator const & it, UpdateType);
70 void addToToc(DocIterator const &) const;
72 bool forceLTR() const { return true; }
75 /// \name Static public methods obligated for InsetCommand derived classes
78 static ParamInfo const & findInfo(std::string const &);
80 static std::string defaultCommand() { return "ref"; }
82 static bool isCompatibleCommand(std::string const & s);
86 /// \name Private functions inherited from InsetCommand class
89 docstring screenLabel() const { return screen_label_; }
94 InsetRef(InsetRef const &);
97 /// \name Private functions inherited from Inset class
100 Inset * clone() const { return new InsetRef(*this); }
103 /// \return the label with things that need to be escaped escaped
104 docstring getEscapedLabel(OutputParams const &) const;
105 /// \return the command for a formatted reference to ref
106 /// \param label we're cross-referencing
107 /// \param argument for reference command
108 /// \param prefix of the label (before :)
109 docstring getFormattedCmd(docstring const & ref, docstring & label,
110 docstring & prefix) const;
113 mutable docstring screen_label_;
115 mutable docstring tooltip_;
121 #endif // INSET_REF_H