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 void doDispatch(Cursor & cur, FuncRequest & cmd);
45 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & status) const;
47 bool isLabeled() const { return true; }
49 docstring toolTip(BufferView const &, int, int) const
52 docstring getTOCString() const;
54 bool hasSettings() const { return true; }
56 InsetCode lyxCode() const { return REF_CODE; }
58 DisplayType display() const { return Inline; }
60 void latex(otexstream &, OutputParams const &) const;
62 int plaintext(odocstringstream & ods, OutputParams const & op,
63 size_t max_length = INT_MAX) const;
65 int docbook(odocstream &, OutputParams const &) const;
67 docstring xhtml(XHTMLStream &, OutputParams const &) const;
69 void toString(odocstream &) const;
71 void forOutliner(docstring &, size_t const, bool const) const;
73 void validate(LaTeXFeatures & features) const;
75 void updateBuffer(ParIterator const & it, UpdateType);
77 void addToToc(DocIterator const & di, bool output_active,
78 UpdateType utype, TocBackend & backend) const;
80 bool forceLTR() const { return true; }
83 /// \name Static public methods obligated for InsetCommand derived classes
86 static ParamInfo const & findInfo(std::string const &);
88 static std::string defaultCommand() { return "ref"; }
90 static bool isCompatibleCommand(std::string const & s);
95 InsetRef(InsetRef const &);
98 /// \name Private functions inherited from Inset class
101 Inset * clone() const { return new InsetRef(*this); }
104 /// \name Private functions inherited from InsetCommand class
107 docstring screenLabel() const;
110 /// \return the label with things that need to be escaped escaped
111 docstring getEscapedLabel(OutputParams const &) const;
112 /// \return the command for a formatted reference to ref
113 /// \param label we're cross-referencing
114 /// \param argument for reference command
115 /// \param prefix of the label (before :)
116 docstring getFormattedCmd(docstring const & ref, docstring & label,
117 docstring & prefix, docstring const & caps) const;
120 mutable docstring screen_label_;
122 mutable bool broken_;
124 mutable docstring tooltip_;
130 #endif // INSET_REF_H