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 docstring getTOCString() const;
50 bool hasSettings() const { return true; }
52 bool inheritFont() const { return true; }
54 InsetCode lyxCode() const { return REF_CODE; }
56 DisplayType display() const { return Inline; }
58 void latex(otexstream &, OutputParams const &) const;
60 int plaintext(odocstringstream & ods, OutputParams const & op,
61 size_t max_length = INT_MAX) const;
63 int docbook(odocstream &, OutputParams const &) const;
65 docstring xhtml(XHTMLStream &, OutputParams const &) const;
67 void toString(odocstream &) const;
69 void forOutliner(docstring &, size_t const, bool const) const;
71 void validate(LaTeXFeatures & features) const;
73 void updateBuffer(ParIterator const & it, UpdateType);
75 void addToToc(DocIterator const & di, bool output_active,
76 UpdateType utype, TocBackend & backend) const;
78 bool forceLTR() const { return true; }
81 /// \name Static public methods obligated for InsetCommand derived classes
84 static ParamInfo const & findInfo(std::string const &);
86 static std::string defaultCommand() { return "ref"; }
88 static bool isCompatibleCommand(std::string const & s);
93 InsetRef(InsetRef const &);
96 /// \name Private functions inherited from Inset class
99 Inset * clone() const { return new InsetRef(*this); }
102 /// \name Private functions inherited from InsetCommand class
105 docstring screenLabel() const;
108 /// \return the label with things that need to be escaped escaped
109 docstring getEscapedLabel(OutputParams const &) const;
110 /// \return the command for a formatted reference to ref
111 /// \param label we're cross-referencing
112 /// \param argument for reference command
113 /// \param prefix of the label (before :)
114 docstring getFormattedCmd(docstring const & ref, docstring & label,
115 docstring & prefix, docstring const & caps) const;
118 mutable docstring screen_label_;
120 mutable bool broken_;
122 mutable docstring tooltip_;
128 #endif // INSET_REF_H