]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetText.cpp
Allow row-breaking after some insets
[lyx.git] / src / insets / InsetText.cpp
index 47b9fc3a4894e5e85bc3b9a81f0ee7ebb6b4282a..ac10443d00bcf04f67094c442db42e079dfc8b4f 100644 (file)
@@ -45,7 +45,7 @@
 #include "ParagraphParameters.h"
 #include "ParIterator.h"
 #include "Row.h"
-#include "sgml.h"
+#include "xml.h"
 #include "TexRow.h"
 #include "texstream.h"
 #include "TextClass.h"
@@ -56,7 +56,6 @@
 #include "frontends/alert.h"
 #include "frontends/Painter.h"
 
-#include "support/bind.h"
 #include "support/convert.h"
 #include "support/debug.h"
 #include "support/gettext.h"
@@ -568,7 +567,7 @@ int InsetText::plaintext(odocstringstream & os,
        for (; it != end; ++it) {
                if (it != beg) {
                        os << '\n';
-                       if (runparams.linelen > 0)
+                       if (runparams.linelen > 0 && !getLayout().parbreakIsNewline())
                                os << '\n';
                }
                odocstringstream oss;
@@ -591,19 +590,19 @@ int InsetText::docbook(odocstream & os, OutputParams const & runparams) const
        ParagraphList::const_iterator const beg = paragraphs().begin();
 
        if (!undefined())
-               sgml::openTag(os, getLayout().latexname(),
+               xml::openTag(os, getLayout().latexname(),
                              beg->getID(buffer(), runparams) + getLayout().latexparam());
 
        docbookParagraphs(text_, buffer(), os, runparams);
 
        if (!undefined())
-               sgml::closeTag(os, getLayout().latexname());
+               xml::closeTag(os, getLayout().latexname());
 
        return 0;
 }
 
 
-docstring InsetText::xhtml(XHTMLStream & xs, OutputParams const & runparams) const
+docstring InsetText::xhtml(XMLStream & xs, OutputParams const & runparams) const
 {
        return insetAsXHTML(xs, runparams, WriteEverything);
 }
@@ -622,7 +621,7 @@ docstring InsetText::xhtml(XHTMLStream & xs, OutputParams const & runparams) con
 // if so, try to close fonts, etc.
 // There are probably limits to how well we can do here, though, and we will
 // have to rely upon users not putting footnotes inside noun-type insets.
-docstring InsetText::insetAsXHTML(XHTMLStream & xs, OutputParams const & rp,
+docstring InsetText::insetAsXHTML(XMLStream & xs, OutputParams const & rp,
                                   XHTMLOptions opts) const
 {
        // we will always want to output all our paragraphs when we are
@@ -640,7 +639,7 @@ docstring InsetText::insetAsXHTML(XHTMLStream & xs, OutputParams const & rp,
 
        InsetLayout const & il = getLayout();
        if (opts & WriteOuterTag)
-               xs << html::StartTag(il.htmltag(), il.htmlattr());
+               xs << xml::StartTag(il.htmltag(), il.htmlattr());
 
        if ((opts & WriteLabel) && !il.counter().empty()) {
                BufferParams const & bp = buffer().masterBuffer()->params();
@@ -652,15 +651,15 @@ docstring InsetText::insetAsXHTML(XHTMLStream & xs, OutputParams const & rp,
                                cntrs.counterLabel(from_utf8(il.htmllabel()), bp.language->code());
                        // FIXME is this check necessary?
                        if (!lbl.empty()) {
-                               xs << html::StartTag(il.htmllabeltag(), il.htmllabelattr());
+                               xs << xml::StartTag(il.htmllabeltag(), il.htmllabelattr());
                                xs << lbl;
-                               xs << html::EndTag(il.htmllabeltag());
+                               xs << xml::EndTag(il.htmllabeltag());
                        }
                }
        }
 
        if (opts & WriteInnerTag)
-               xs << html::StartTag(il.htmlinnertag(), il.htmlinnerattr());
+               xs << xml::StartTag(il.htmlinnertag(), il.htmlinnerattr());
 
        // we will eventually lose information about the containing inset
        if (!allowMultiPar() || opts == JustText)
@@ -673,10 +672,10 @@ docstring InsetText::insetAsXHTML(XHTMLStream & xs, OutputParams const & rp,
        xs.endDivision();
 
        if (opts & WriteInnerTag)
-               xs << html::EndTag(il.htmlinnertag());
+               xs << xml::EndTag(il.htmlinnertag());
 
        if (opts & WriteOuterTag)
-               xs << html::EndTag(il.htmltag());
+               xs << xml::EndTag(il.htmltag());
 
        return docstring();
 }
@@ -749,8 +748,9 @@ void InsetText::appendParagraphs(ParagraphList & plist)
        mergeParagraph(buffer().params(), pl,
                       distance(pl.begin(), ins) - 1);
 
-       for_each(pit, plist.end(),
-                bind(&ParagraphList::push_back, ref(pl), _1));
+       ParagraphList::iterator const pend = plist.end();
+       for (; pit != pend; ++pit)
+               pl.push_back(*pit);
 }
 
 
@@ -815,7 +815,7 @@ bool InsetText::insetAllowed(InsetCode code) const
 }
 
 
-void InsetText::updateBuffer(ParIterator const & it, UpdateType utype)
+void InsetText::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted)
 {
        ParIterator it2 = it;
        it2.forwardPos();
@@ -829,7 +829,7 @@ void InsetText::updateBuffer(ParIterator const & it, UpdateType utype)
                        cnt.clearLastLayout();
                        // FIXME cnt.saveLastCounter()?
                }
-               buffer().updateBuffer(it2, utype);
+               buffer().updateBuffer(it2, utype, deleted);
                if (save_layouts) {
                        // LYXERR0("Exiting " << name());
                        cnt.restoreLastLayout();
@@ -845,7 +845,7 @@ void InsetText::updateBuffer(ParIterator const & it, UpdateType utype)
                // we need float information even in note insets (#9760)
                tclass.counters().current_float(savecnt.current_float());
                tclass.counters().isSubfloat(savecnt.isSubfloat());
-               buffer().updateBuffer(it2, utype);
+               buffer().updateBuffer(it2, utype, deleted);
                tclass.counters() = move(savecnt);
        }
 }