]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetFloat.h
Reduce caption hardcoding
[lyx.git] / src / insets / InsetFloat.h
index 34c5a28020fffca9ae338416ed269c39987206b8..6cff1089754a15401dff14d5a33d2b169cc815db 100644 (file)
@@ -4,22 +4,20 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Jürgen Vigna
- * \author Lars Gullik Bjønnes
+ * \author Jürgen Vigna
+ * \author Lars Gullik Bjønnes
  *
  * Full author contact details are available in file CREDITS.
  */
 
-#ifndef INSETFLOAT_H
-#define INSETFLOAT_H
+#ifndef INSET_FLOAT_H
+#define INSET_FLOAT_H
 
 #include "InsetCollapsable.h"
-#include "MailInset.h"
 
 
 namespace lyx {
 
-
 class InsetFloatParams {
 public:
        ///
@@ -32,7 +30,7 @@ public:
        std::string type;
        ///
        std::string placement;
-       ///
+       /// span columns
        bool wide;
        ///
        bool sideways;
@@ -41,17 +39,41 @@ public:
 };
 
 
-/** The float inset
 
-*/
-class InsetFloat : public InsetCollapsable {
+/////////////////////////////////////////////////////////////////////////
+//
+// InsetFloat
+//
+/////////////////////////////////////////////////////////////////////////
+
+/// Used for "floating" objects like tables, figures etc.
+class InsetFloat : public InsetCollapsable
+{
 public:
        ///
-       InsetFloat(Buffer const &, std::string const &);
+       InsetFloat(Buffer * buffer, std::string params_str);
+
+       ///
+       static void string2params(std::string const &, InsetFloatParams &);
+       ///
+       static std::string params2string(InsetFloatParams const &);
+       ///
+       void setWide(bool w, bool update_label = true);
+       ///
+       void setSideways(bool s, bool update_label = true);
+       ///
+       void setSubfloat(bool s, bool update_label = true);
        ///
-       ~InsetFloat();
+       void setNewLabel();
        ///
-       docstring name() const { return name_; }
+       InsetFloatParams const & params() const { return params_; }
+       ///
+       bool allowsCaptionVariation(std::string const &) const;
+private:
+       ///
+       docstring layoutName() const;
+       ///
+       docstring toolTip(BufferView const & bv, int x, int y) const;
        ///
        void write(std::ostream & os) const;
        ///
@@ -61,71 +83,35 @@ public:
        ///
        InsetCode lyxCode() const { return FLOAT_CODE; }
        ///
-       bool isMacroScope() const { return true; }
+       void latex(otexstream &, OutputParams const &) const;
        ///
-       int latex(odocstream &, OutputParams const &) const;
-       ///
-       int plaintext(odocstream &, OutputParams const &) const;
+       int plaintext(odocstringstream & ods, OutputParams const & op,
+                     size_t max_length = INT_MAX) const;
        ///
        int docbook(odocstream &, OutputParams const &) const;
        ///
-       docstring editMessage() const;
+       docstring xhtml(XHTMLStream &, OutputParams const &) const;
        ///
        bool insetAllowed(InsetCode) const;
-       /** returns true if, when outputing LaTeX, font changes should
+       /** returns false if, when outputing LaTeX, font changes should
            be closed before generating this inset. This is needed for
            insets that may contain several paragraphs */
-       bool noFontChange() const { return true; }
-       ///
-       void wide(bool w, BufferParams const &);
-       ///
-       void sideways(bool s, BufferParams const &);
-       ///
-       void subfloat(bool s, BufferParams const &);
-       ///
-       bool  showInsetDialog(BufferView *) const;
-       ///
-       InsetFloatParams const & params() const { return params_; }
+       bool inheritFont() const { return false; }
        ///
        bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
        // Update the counters of this inset and of its contents
-       void updateLabels(ParIterator const &);
-protected:
-       virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
-private:
+       void updateBuffer(ParIterator const &, UpdateType);
        ///
-       virtual Inset * clone() const;
+       void doDispatch(Cursor & cur, FuncRequest & cmd);
+       ///
+       Inset * clone() const { return new InsetFloat(*this); }
        ///
        docstring getCaption(OutputParams const &) const;
        ///
        InsetFloatParams params_;
-       ///
-       docstring name_;
-};
-
-
-class InsetFloatMailer : public MailInset {
-public:
-       ///
-       InsetFloatMailer(InsetFloat & inset);
-       ///
-       virtual Inset & inset() const { return inset_; }
-       ///
-       virtual std::string const & name() const { return name_; }
-       ///
-       virtual std::string const inset2string(Buffer const &) const;
-       ///
-       static void string2params(std::string const &, InsetFloatParams &);
-       ///
-       static std::string const params2string(InsetFloatParams const &);
-private:
-       ///
-       static std::string const name_;
-       ///
-       InsetFloat & inset_;
 };
 
 
 } // namespace lyx
 
-#endif
+#endif // INSET_FLOAT_H