]> git.lyx.org Git - lyx.git/blobdiff - src/Paragraph.cpp
Kornel's gcc compile fix.
[lyx.git] / src / Paragraph.cpp
index 6f1c408aba621a66bf3bbece0cd359db3b04b7bb..6ad82dce590f2d5c1dfb654a121debdb2c24c3f6 100644 (file)
@@ -36,7 +36,6 @@
 #include "OutputParams.h"
 #include "output_latex.h"
 #include "output_xhtml.h"
-#include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
 #include "SpellChecker.h"
 #include "sgml.h"
@@ -173,6 +172,12 @@ public:
 
        /// match a string against a particular point in the paragraph
        bool isTextAt(string const & str, pos_type pos) const;
+
+
+       InsetCode ownerCode() const
+       {
+               return inset_owner_ ? inset_owner_->lyxCode() : NO_CODE;
+       }
        
        /// Which Paragraph owns us?
        Paragraph * owner_;
@@ -588,8 +593,8 @@ bool Paragraph::Private::simpleTeXBlanks(OutputParams const & runparams,
                }
        }
 
-       if (lyxrc.plaintext_linelen > 0
-           && column > lyxrc.plaintext_linelen
+       if (runparams.linelen > 0
+           && column > runparams.linelen
            && i
            && text_[i - 1] != ' '
            && (i + 1 < int(text_.size()))
@@ -1695,12 +1700,6 @@ void Paragraph::setBeginOfBody()
 }
 
 
-bool Paragraph::forcePlainLayout() const
-{
-       return inInset().forcePlainLayout();
-}
-
-
 bool Paragraph::allowParagraphCustomization() const
 {
        return inInset().allowParagraphCustomization();
@@ -1807,7 +1806,7 @@ int Paragraph::Private::startTeXParParams(BufferParams const & bparams,
        }
 
        string const begin_tag = "\\begin";
-       InsetCode code = owner_->ownerCode();
+       InsetCode code = ownerCode();
        bool const lastpar = runparams.isLastPar;
 
        switch (curAlign) {
@@ -1875,7 +1874,7 @@ int Paragraph::Private::endTeXParParams(BufferParams const & bparams,
        }
 
        string const end_tag = "\n\\par\\end";
-       InsetCode code = owner_->ownerCode();
+       InsetCode code = ownerCode();
        bool const lastpar = runparams.isLastPar;
 
        switch (curAlign) {
@@ -1930,7 +1929,7 @@ bool Paragraph::latex(BufferParams const & bparams,
 
        // FIXME This check should not be needed. Perhaps issue an
        // error if it triggers.
-       Layout const & style = forcePlainLayout() ?
+       Layout const & style = inInset().forcePlainLayout() ?
                bparams.documentClass().plainLayout() : *d->layout_;
 
        // Current base font for all inherited font changes, without any
@@ -2188,8 +2187,12 @@ bool Paragraph::latex(BufferParams const & bparams,
                return_value = false;
        }
 
-       if (allowcust && d->endTeXParParams(bparams, os, texrow, runparams))
+       if (allowcust && d->endTeXParParams(bparams, os, texrow, runparams)
+           && runparams.encoding != prev_encoding) {
                runparams.encoding = prev_encoding;
+               if (!bparams.useXetex)
+                       os << setEncoding(prev_encoding->iconvName());
+       }
 
        LYXERR(Debug::LATEX, "Paragraph::latex... done " << this);
        return return_value;
@@ -2641,12 +2644,6 @@ Inset const & Paragraph::inInset() const
 }
 
 
-InsetCode Paragraph::ownerCode() const
-{
-       return d->inset_owner_ ? d->inset_owner_->lyxCode() : NO_CODE;
-}
-
-
 ParagraphParameters & Paragraph::params()
 {
        return d->params_;
@@ -3022,8 +3019,6 @@ void Paragraph::locateWord(pos_type & from, pos_type & to,
 void Paragraph::collectWords()
 {
        pos_type n = size();
-       WordLangTuple wl;
-       docstring_list suggestions;
        for (pos_type pos = 0; pos < n; ++pos) {
                if (isWordSeparator(pos))
                        continue;
@@ -3033,11 +3028,6 @@ void Paragraph::collectWords()
                        docstring word = asString(from, pos, AS_STR_NONE);
                        d->words_.insert(word);
                }
-               if (lyxrc.spellcheck_continuously
-                   && spellCheck(from, pos, wl, suggestions)) {
-                       for (size_t i = 0; i != suggestions.size(); ++i)
-                               d->words_.insert(suggestions[i]);
-               }
        }
 }