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 &);
37 void changeTarget(docstring const & new_label);
39 /// \name Public functions inherited from Inset class
42 docstring layoutName() const;
44 void doDispatch(Cursor & cur, FuncRequest & cmd);
46 bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & status) const;
48 bool isLabeled() const { return true; }
50 docstring toolTip(BufferView const &, int, int) const
53 docstring getTOCString() const;
55 bool hasSettings() const { return true; }
57 InsetCode lyxCode() const { return REF_CODE; }
59 DisplayType display() const { return Inline; }
61 void latex(otexstream &, OutputParams const &) const;
63 int plaintext(odocstringstream & ods, OutputParams const & op,
64 size_t max_length = INT_MAX) const;
66 int docbook(odocstream &, OutputParams const &) const;
68 docstring xhtml(XMLStream &, OutputParams const &) const;
70 void toString(odocstream &) const;
72 void forOutliner(docstring &, size_t const, bool const) const;
74 void validate(LaTeXFeatures & features) const;
76 void updateBuffer(ParIterator const & it, UpdateType, bool const deleted = false);
78 void addToToc(DocIterator const & di, bool output_active,
79 UpdateType utype, TocBackend & backend) const;
81 bool forceLTR(OutputParams const &) const;
84 /// \name Static public methods obligated for InsetCommand derived classes
87 static ParamInfo const & findInfo(std::string const &);
89 static std::string defaultCommand() { return "ref"; }
91 static bool isCompatibleCommand(std::string const & s);
94 bool outputActive() const { return active_; }
98 InsetRef(InsetRef const &);
101 /// \name Private functions inherited from Inset class
104 Inset * clone() const { return new InsetRef(*this); }
107 /// \name Private functions inherited from InsetCommand class
110 docstring screenLabel() const;
113 /// \return the label with things that need to be escaped escaped
114 docstring getEscapedLabel(OutputParams const &) const;
115 /// \return the command for a formatted reference to ref
116 /// \param label we're cross-referencing
117 /// \param argument for reference command
118 /// \param prefix of the label (before :)
119 docstring getFormattedCmd(docstring const & ref, docstring & label,
120 docstring & prefix, docstring const & caps) const;
123 mutable docstring screen_label_;
125 mutable bool broken_;
127 mutable bool active_;
129 mutable docstring tooltip_;
135 #endif // INSET_REF_H