]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetFloat.cpp
This should be the last of the commits refactoring the InsetLayout code.
[lyx.git] / src / insets / InsetFloat.cpp
index 8b4e9b28e400335e96d111b4200868a2f8e03a02..e966bb5d6c7b9a0c1f2720cc7e163a1d19e2cdda 100644 (file)
 #include "BufferView.h"
 #include "Counters.h"
 #include "Cursor.h"
-#include "support/debug.h"
 #include "DispatchResult.h"
 #include "Floating.h"
 #include "FloatList.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
-#include "support/gettext.h"
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "OutputParams.h"
 #include "TextClass.h"
 
+#include "support/debug.h"
+#include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/docstream.h"
 #include "support/convert.h"
@@ -110,7 +110,6 @@ namespace lyx {
 InsetFloat::InsetFloat(BufferParams const & bp, string const & type)
        : InsetCollapsable(bp), name_(from_utf8(type))
 {
-       BOOST_ASSERT(false);
        setLabel(_("float: ") + floatName(type, bp));
        params_.type = type;
 }
@@ -262,7 +261,7 @@ void InsetFloat::validate(LaTeXFeatures & features) const
        }
 
        if (params_.sideways)
-               features.require("rotating");
+               features.require("rotfloat");
 
        features.useFloat(params_.type);
        InsetCollapsable::validate(features);
@@ -285,13 +284,13 @@ int InsetFloat::latex(Buffer const & buf, odocstream & os,
                      OutputParams const & runparams) const
 {
        FloatList const & floats = buf.params().getTextClass().floats();
-       string tmptype = (params_.wide ? params_.type + "*" : params_.type);
-       if (params_.sideways) {
-               if (params_.type == "table")
-                       tmptype = "sidewaystable";
-               else if (params_.type == "figure")
-                       tmptype = "sidewaysfigure";
-       }
+       string tmptype = params_.type;
+       if (params_.sideways)
+               tmptype = "sideways" + params_.type;
+       if (params_.wide && (!params_.sideways ||
+                            params_.type == "figure" ||
+                            params_.type == "table"))
+               tmptype += "*";
        // Figure out the float placement to use.
        // From lowest to highest:
        // - float default placement