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[];
34 InsetRef(Buffer * buffer, InsetCommandParams const &);
36 /// \name Public functions inherited from Inset class
39 void doDispatch(Cursor & cur, FuncRequest & cmd);
41 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & status) const;
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 InsetCode lyxCode() const { return REF_CODE; }
54 DisplayType display() const { return Inline; }
56 void latex(otexstream &, OutputParams const &) const;
58 int plaintext(odocstringstream & ods, OutputParams const & op,
59 size_t max_length = INT_MAX) const;
61 int docbook(odocstream &, OutputParams const &) const;
63 docstring xhtml(XHTMLStream &, OutputParams const &) const;
65 void toString(odocstream &) const;
67 void forOutliner(docstring &, size_t const, bool const) const;
69 void validate(LaTeXFeatures & features) const;
71 void updateBuffer(ParIterator const & it, UpdateType);
73 void addToToc(DocIterator const & di, bool output_active,
74 UpdateType utype, TocBackend & backend) const;
76 bool forceLTR() const { return true; }
79 /// \name Static public methods obligated for InsetCommand derived classes
82 static ParamInfo const & findInfo(std::string const &);
84 static std::string defaultCommand() { return "ref"; }
86 static bool isCompatibleCommand(std::string const & s);
91 InsetRef(InsetRef const &);
94 /// \name Private functions inherited from Inset class
97 Inset * clone() const { return new InsetRef(*this); }
100 /// \name Private functions inherited from InsetCommand class
103 docstring screenLabel() const;
106 /// \return the label with things that need to be escaped escaped
107 docstring getEscapedLabel(OutputParams const &) const;
108 /// \return the command for a formatted reference to ref
109 /// \param label we're cross-referencing
110 /// \param argument for reference command
111 /// \param prefix of the label (before :)
112 docstring getFormattedCmd(docstring const & ref, docstring & label,
113 docstring & prefix, docstring const & caps) const;
116 mutable docstring screen_label_;
118 mutable bool broken_;
120 mutable docstring tooltip_;
126 #endif // INSET_REF_H