]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetRef.h
Loop refactoring
[lyx.git] / src / insets / InsetRef.h
index 3a8c4637b686ee6ea729c1ad9f0aadddca3336f6..d18f61939c86a72c6c1bbc0caff5ba780512be52 100644 (file)
@@ -4,7 +4,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author José Matos
+ * \author José Matos
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -17,7 +17,6 @@
 
 namespace lyx {
 
-
 /// The reference inset
 class InsetRef : public InsetCommand {
 public:
@@ -29,47 +28,106 @@ public:
                ///
                std::string short_gui_name;
        };
-       static type_info types[];
-       ///
-       static int getType(std::string const & name);
-       ///
-       static std::string const & getName(int type);
+       static const type_info types[];
 
+       ///
+       InsetRef(Buffer * buffer, InsetCommandParams const &);
 
-       InsetRef(InsetCommandParams const &, Buffer const &);
+       ///
+       void changeTarget(docstring const & new_label);
 
+       /// \name Public functions inherited from Inset class
+       //@{
+       ///
+       docstring layoutName() const override;
+       ///
+       void doDispatch(Cursor & cur, FuncRequest & cmd) override;
+       ///
+       bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & status) const override;
+       ///
+       bool isLabeled() const override { return true; }
+       ///
+       docstring toolTip(BufferView const &, int, int) const override
+               { return tooltip_; }
+       ///
+       docstring getTOCString() const;
+       ///
+       bool hasSettings() const override { return true; }
+       ///
+       InsetCode lyxCode() const override { return REF_CODE; }
+       ///
+       void latex(otexstream &, OutputParams const &) const override;
+       ///
+       int plaintext(odocstringstream & ods, OutputParams const & op,
+                     size_t max_length = INT_MAX) const override;
+       ///
+       void docbook(XMLStream &, OutputParams const &) const override;
        ///
-       docstring const getScreenLabel(Buffer const &) const;
+       docstring xhtml(XMLStream &, OutputParams const &) const override;
        ///
-       EDITABLE editable() const { return IS_EDITABLE; }
+       void toString(odocstream &) const override;
        ///
-       Code lyxCode() const { return REF_CODE; }
+       void forOutliner(docstring &, size_t const, bool const) const override;
        ///
-       bool display() const { return false; }
+       void validate(LaTeXFeatures & features) const override;
        ///
-       int latex(Buffer const &, odocstream &, OutputParams const &) const;
+       void updateBuffer(ParIterator const & it, UpdateType, bool const deleted = false) override;
        ///
-       int plaintext(Buffer const &, odocstream &, OutputParams const &) const;
+       void addToToc(DocIterator const & di, bool output_active,
+                                 UpdateType utype, TocBackend & backend) const override;
        ///
-       int docbook(Buffer const &, odocstream &, OutputParams const &) const;
-       /// the string that is passed to the TOC
-       virtual int textString(Buffer const &, odocstream &,
-               OutputParams const &) const;
+       bool forceLTR(OutputParams const &) const override;
+       //@}
+
+       /// \name Static public methods obligated for InsetCommand derived classes
+       //@{
+       ///
+       static ParamInfo const & findInfo(std::string const &);
+       ///
+       static std::string defaultCommand() { return "ref"; }
+       ///
+       static bool isCompatibleCommand(std::string const & s);
+       //@}
        ///
-       void validate(LaTeXFeatures & features) const;
+       bool outputActive() const { return active_; }
+
 protected:
+       ///
        InsetRef(InsetRef const &);
 
-       ///
-       virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
 private:
-       virtual std::auto_ptr<Inset> doClone() const {
-               return std::auto_ptr<Inset>(new InsetRef(*this));
-       }
+       /// \name Private functions inherited from Inset class
+       //@{
+       ///
+       Inset * clone() const override { return new InsetRef(*this); }
+       //@}
+
+       /// \name Private functions inherited from InsetCommand class
+       //@{
+       ///
+       docstring screenLabel() const override;
+       //@}
+
+       /// \return the label with things that need to be escaped escaped
+       docstring getEscapedLabel(OutputParams const &) const;
+       /// \return the command for a formatted reference to ref
+       /// \param label we're cross-referencing
+       /// \param argument for reference command
+       /// \param prefix of the label (before :)
+       docstring getFormattedCmd(docstring const & ref, docstring & label,
+                       docstring & prefix, docstring const & caps) const;
+
        ///
-       bool isLatex;
+       mutable docstring screen_label_;
+       ///
+       mutable bool broken_;
+       ///
+       mutable bool active_;
+       ///
+       mutable docstring tooltip_;
 };
 
+
 } // namespace lyx
 
-#endif
+#endif // INSET_REF_H