]> git.lyx.org Git - lyx.git/blobdiff - src/Paragraph.cpp
prepare Qt 5.6 builds
[lyx.git] / src / Paragraph.cpp
index 84e609bb605c642779e9d799e385a5252a5b08e8..734d18a81c6574388f6eeb2d71236a6b6880c865 100644 (file)
@@ -510,6 +510,8 @@ Paragraph::Private::Private(Paragraph * owner, Layout const & layout)
 // FIXME: There should be a more intelligent way to generate and use the
 // paragraph ids per buffer instead a global static counter for all InsetText
 // in the running program.
+// However, this per-session id is used in LFUN_PARAGRAPH_GOTO to
+// switch to a different buffer, as used in the outliner for instance.
 static int paragraph_id = -1;
 
 Paragraph::Private::Private(Private const & p, Paragraph * owner)
@@ -1424,7 +1426,7 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const
                        icit->inset->validate(features);
                        if (layout_->needprotect &&
                            icit->inset->lyxCode() == FOOT_CODE)
-                               features.require("footmisc");
+                               features.require("NeedLyXFootnoteCode");
                }
        }
 
@@ -1997,7 +1999,7 @@ docstring Paragraph::expandParagraphLabel(Layout const & layout,
                        docstring parent(fmt, i + 1, j - i - 1);
                        docstring label = from_ascii("??");
                        if (tclass.hasLayout(parent))
-                               docstring label = expandParagraphLabel(tclass[parent], bparams,
+                               label = expandParagraphLabel(tclass[parent], bparams,
                                                      process_appendix);
                        fmt = docstring(fmt, 0, i) + label
                                + docstring(fmt, j + 1, docstring::npos);
@@ -2193,7 +2195,6 @@ int Paragraph::Private::startTeXParParams(BufferParams const & bparams,
                        corrected_env(os, begin_tag, "flushright", code, lastpar, column);
                break;
        } case LYX_ALIGN_RIGHT: {
-               string output;
                if (owner_->getParLanguage(bparams)->babel() != "hebrew")
                        corrected_env(os, begin_tag, "flushright", code, lastpar, column);
                else
@@ -2566,8 +2567,7 @@ void Paragraph::latex(BufferParams const & bparams,
        if (allowcust && d->endTeXParParams(bparams, os, runparams)
            && runparams.encoding != prev_encoding) {
                runparams.encoding = prev_encoding;
-               if (!runparams.isFullUnicode())
-                       os << setEncoding(prev_encoding->iconvName());
+               os << setEncoding(prev_encoding->iconvName());
        }
 
        LYXERR(Debug::LATEX, "Paragraph::latex... done " << this);
@@ -3257,21 +3257,23 @@ docstring Paragraph::asString(pos_type beg, pos_type end, int options, const Out
 }
 
 
-void Paragraph::forOutliner(docstring & os, size_t maxlen) const
+void Paragraph::forOutliner(docstring & os, size_t const maxlen,
+                                                       bool const shorten) const
 {
+       size_t tmplen = shorten ? maxlen + 1 : maxlen;
        if (!d->params_.labelString().empty())
                os += d->params_.labelString() + ' ';
-       for (pos_type i = 0; i < size() && os.length() < maxlen; ++i) {
+       for (pos_type i = 0; i < size() && os.length() < tmplen; ++i) {
                if (isDeleted(i))
                        continue;
                char_type const c = d->text_[i];
                if (isPrintable(c))
                        os += c;
-               else if (c == '\t' || c == '\n')
-                       os += ' ';
                else if (c == META_INSET)
-                       getInset(i)->forOutliner(os, maxlen);
+                       getInset(i)->forOutliner(os, tmplen, false);
        }
+       if (shorten)
+               Text::shortenForOutliner(os, maxlen);
 }