]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetFloat.h
Do not repeatedly call main_font_encoding()
[lyx.git] / src / insets / InsetFloat.h
index d768a769a01fd4e1efbbbab8717f2950f6cf0ecc..9d20a486cf0329a77d553ac0a5074e71d97f89ff 100644 (file)
@@ -4,8 +4,8 @@
  * 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 INSET_FLOAT_H
 #define INSET_FLOAT_H
 
-#include "InsetCollapsable.h"
+#include "InsetCaptionable.h"
 
 
 namespace lyx {
 
-class InsetFloatParams {
+struct TexString;
+
+
+class InsetFloatParams
+{
 public:
        ///
-       InsetFloatParams() : wide(false), sideways(false), subfloat(false) {}
+       InsetFloatParams() : type("senseless"), placement("document"), alignment("document"),
+               wide(false), sideways(false), subfloat(false) {}
        ///
        void write(std::ostream & os) const;
        ///
@@ -30,6 +35,8 @@ public:
        std::string type;
        ///
        std::string placement;
+       ///
+       std::string alignment;
        /// span columns
        bool wide;
        ///
@@ -47,71 +54,76 @@ public:
 /////////////////////////////////////////////////////////////////////////
 
 /// Used for "floating" objects like tables, figures etc.
-class InsetFloat : public InsetCollapsable
+class InsetFloat : public InsetCaptionable
 {
 public:
-       ///
-       InsetFloat(Buffer const &, std::string const &);
-       ///
-       ~InsetFloat();
-
+       InsetFloat(Buffer * buffer, std::string const & params_str);
        ///
        static void string2params(std::string const &, InsetFloatParams &);
        ///
        static std::string params2string(InsetFloatParams const &);
        ///
-       void setWide(bool w, BufferParams const &);
+       void setWide(bool w, bool update_label = true);
        ///
-       void setSideways(bool s, BufferParams const &);
+       void setSideways(bool s, bool update_label = true);
        ///
-       void setSubfloat(bool s, BufferParams const &);
+       void setSubfloat(bool s, bool update_label = true);
+       ///
+       void setNewLabel();
        ///
        InsetFloatParams const & params() const { return params_; }
+       ///
+       bool allowsCaptionVariation(std::string const &) const override;
+       ///
+       LyXAlignment contentAlignment() const override;
+       ///
+       bool forceParDirectionSwitch() const override { return true; }
 private:
        ///
-       docstring name() const { return name_; }
+       void setCaptionType(std::string const & type) override;
        ///
-       docstring toolTip(BufferView const & bv, int x, int y) const;
+       docstring layoutName() const override;
        ///
-       void write(std::ostream & os) const;
+       docstring toolTip(BufferView const & bv, int x, int y) const override;
        ///
-       void read(Lexer & lex);
+       void write(std::ostream & os) const override;
        ///
-       void validate(LaTeXFeatures & features) const;
+       void read(Lexer & lex) override;
        ///
-       InsetCode lyxCode() const { return FLOAT_CODE; }
+       void validate(LaTeXFeatures & features) const override;
        ///
-       int latex(odocstream &, OutputParams const &) const;
+       InsetCode lyxCode() const override { return FLOAT_CODE; }
        ///
-       int plaintext(odocstream &, OutputParams const &) const;
+       void latex(otexstream &, OutputParams const &) const override;
        ///
-       int docbook(odocstream &, OutputParams const &) const;
+       int plaintext(odocstringstream & ods, OutputParams const & op,
+                     size_t max_length = INT_MAX) const override;
        ///
-       docstring editMessage() const;
+       void docbook(XMLStream &, OutputParams const &) const override;
        ///
-       bool insetAllowed(InsetCode) const;
-       /** returns true 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; }
+       docstring xhtml(XMLStream &, OutputParams const &) const override;
        ///
-       bool showInsetDialog(BufferView *) const;
+       bool insetAllowed(InsetCode) const override;
        ///
-       bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
-       // Update the counters of this inset and of its contents
-       void updateLabels(ParIterator const &);
+       bool inheritFont() const override { return false; }
        ///
-       void doDispatch(Cursor & cur, FuncRequest & cmd);
+       bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
        ///
-       Inset * clone() const { return new InsetFloat(*this); }
+       bool hasSubCaptions(ParIterator const & it) const override;
        ///
-       docstring getCaption(OutputParams const &) const;
+       void doDispatch(Cursor & cur, FuncRequest & cmd) override;
        ///
-       docstring getCaptionText(OutputParams const &) const;
+       Inset * clone() const override { return new InsetFloat(*this); }
+       /// Is the content of this inset part of the immediate (visible) text sequence?
+       bool isPartOfTextSequence() const override { return false; }
        ///
-       InsetFloatParams params_;
+       TexString getCaption(OutputParams const &) const;
+       ///
+       std::string getAlignment() const;
        ///
-       docstring name_;
+       CtObject getCtObject(OutputParams const &) const override;
+
+       InsetFloatParams params_;
 };