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 const 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 void latex(otexstream &, OutputParams const &) const;
56 int plaintext(odocstringstream & ods, OutputParams const & op,
57 size_t max_length = INT_MAX) const;
59 int docbook(odocstream &, OutputParams const &) const;
61 docstring xhtml(XHTMLStream &, OutputParams const &) const;
63 void toString(odocstream &) const;
65 void forOutliner(docstring &, size_t) const;
67 void validate(LaTeXFeatures & features) const;
69 void updateBuffer(ParIterator const & it, UpdateType);
71 void addToToc(DocIterator const & di, bool output_active) const;
73 bool forceLTR() const { return true; }
76 /// \name Static public methods obligated for InsetCommand derived classes
79 static ParamInfo const & findInfo(std::string const &);
81 static std::string defaultCommand() { return "ref"; }
83 static bool isCompatibleCommand(std::string const & s);
87 /// \name Private functions inherited from InsetCommand class
90 docstring screenLabel() const { return screen_label_; }
95 InsetRef(InsetRef const &);
98 /// \name Private functions inherited from Inset class
101 Inset * clone() const { return new InsetRef(*this); }
104 /// \return the label with things that need to be escaped escaped
105 docstring getEscapedLabel(OutputParams const &) const;
106 /// \return the command for a formatted reference to ref
107 /// \param label we're cross-referencing
108 /// \param argument for reference command
109 /// \param prefix of the label (before :)
110 docstring getFormattedCmd(docstring const & ref, docstring & label,
111 docstring & prefix) const;
114 mutable docstring screen_label_;
116 mutable docstring tooltip_;
122 #endif // INSET_REF_H