]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetFloat.cpp
Add a layout tag ForceOwnlines that assures an inset is started and terminated by...
[lyx.git] / src / insets / InsetFloat.cpp
index e3876ba1c3305597046967a17fbd53dc0f2cf434..beb5e0b5571e1b2d63508eafef0d52f2fcb0a9b8 100644 (file)
@@ -119,7 +119,7 @@ InsetFloat::InsetFloat(Buffer * buf, string params_str)
 }
 
 
-docstring InsetFloat::name() const 
+docstring InsetFloat::layoutName() const
 { 
        return "Float:" + from_utf8(params_.type);
 }
@@ -189,6 +189,12 @@ bool InsetFloat::getStatus(Cursor & cur, FuncRequest const & cmd,
                        return true;
                } else
                        return false;
+       
+       case LFUN_NEWLINE_INSERT:
+               if (params_.subfloat) {
+                       flag.setEnabled(false);
+                       return true;
+               }
 
        default:
                return InsetCollapsable::getStatus(cur, cmd, flag);
@@ -374,6 +380,8 @@ void InsetFloat::latex(otexstream & os, OutputParams const & runparams_in) const
 
        // Force \begin{<floatname>} to appear in a new line.
        os << breakln << "\\begin{" << from_ascii(tmptype) << '}';
+       if (runparams.lastid != -1)
+               os.texrow().start(runparams.lastid, runparams.lastpos);
        // We only output placement if different from the def_placement.
        // sidewaysfloats always use their own page
        if (!placement.empty() && !params_.sideways)
@@ -387,11 +395,11 @@ void InsetFloat::latex(otexstream & os, OutputParams const & runparams_in) const
 }
 
 
-int InsetFloat::plaintext(odocstream & os, OutputParams const & runparams) const
+int InsetFloat::plaintext(odocstringstream & os, OutputParams const & runparams, size_t max_length) const
 {
        os << '[' << buffer().B_("float") << ' '
                << floatName(params_.type) << ":\n";
-       InsetText::plaintext(os, runparams);
+       InsetText::plaintext(os, runparams, max_length);
        os << "\n]";
 
        return PLAINTEXT_NEWLINE + 1; // one char on a separate line
@@ -468,6 +476,12 @@ void InsetFloat::setNewLabel()
 }
 
 
+bool InsetFloat::allowsCaptionVariation(std::string const & newtype) const
+{
+       return !params_.subfloat && newtype != "LongTableNoNumber";
+}
+
+
 docstring InsetFloat::getCaption(OutputParams const & runparams) const
 {
        if (paragraphs().empty())
@@ -480,7 +494,7 @@ docstring InsetFloat::getCaption(OutputParams const & runparams) const
        TexRow texrow;
        odocstringstream ods;
        otexstream os(ods, texrow);
-       ins->getOptArg(os, runparams);
+       ins->getArgs(os, runparams);
        ods << '[';
        odocstringstream odss;
        otexstream oss(odss, texrow);