]> git.lyx.org Git - lyx.git/blobdiff - src/paragraph.C
de.po updated
[lyx.git] / src / paragraph.C
index fe8cf4f368657cfa9632ceb52f6f3a82215597b4..1ca0c04ef1b5575dbd0a4e2e5d4156d77e6602d1 100644 (file)
@@ -29,9 +29,7 @@
 #include "ParameterStruct.h"
 #include "gettext.h"
 
-#include "insets/insetinclude.h"
 #include "insets/insetbib.h"
-#include "insets/insettext.h"
 #include "insets/insetoptarg.h"
 
 #include "support/filetools.h"
@@ -184,15 +182,15 @@ void Paragraph::write(Buffer const * buf, ostream & os,
        }
 
        // First write the layout
-       os << "\n\\layout " << layout()->name() << "\n";
+       os << "\n\\layout " << layout()->name() << '\n';
 
        // Maybe some vertical spaces.
        if (params().spaceTop().kind() != VSpace::NONE)
                os << "\\added_space_top "
-                  << params().spaceTop().asLyXCommand() << " ";
+                  << params().spaceTop().asLyXCommand() << ' ';
        if (params().spaceBottom().kind() != VSpace::NONE)
                os << "\\added_space_bottom "
-                  << params().spaceBottom().asLyXCommand() << " ";
+                  << params().spaceBottom().asLyXCommand() << ' ';
 
        // Maybe the paragraph has special spacing
        params().spacing().writeFile(os, true);
@@ -224,7 +222,8 @@ void Paragraph::write(Buffer const * buf, ostream & os,
 
        // Do we have a manual left indent?
        if (!params().leftIndent().zero())
-               os << "\\leftindent " << params().leftIndent().asString() << " ";
+               os << "\\leftindent " << params().leftIndent().asString()
+                  << ' ';
 
        // Alignment?
        if (params().align() != LYX_ALIGN_LAYOUT) {
@@ -235,7 +234,7 @@ void Paragraph::write(Buffer const * buf, ostream & os,
                case LYX_ALIGN_CENTER: h = 3; break;
                default: h = 0; break;
                }
-               os << "\\align " << string_align[h] << " ";
+               os << "\\align " << string_align[h] << ' ';
        }
 
        // bibitem  ale970302
@@ -247,18 +246,14 @@ void Paragraph::write(Buffer const * buf, ostream & os,
        int column = 0;
        for (pos_type i = 0; i < size(); ++i) {
                if (!i) {
-                       os << "\n";
+                       os << '\n';
                        column = 0;
                }
 
                // Write font changes
                LyXFont font2 = getFontSettings(bparams, i);
                if (font2 != font1) {
-#ifndef INHERIT_LANGUAGE
                        font2.lyxWriteChanges(font1, os);
-#else
-                       font2.lyxWriteChanges(font1, bparams.language, os);
-#endif
                        column = 0;
                        font1 = font2;
                }
@@ -299,12 +294,12 @@ void Paragraph::write(Buffer const * buf, ostream & os,
                                os << ".\n";
                                column = 0;
                        } else
-                               os << ".";
+                               os << '.';
                        break;
                default:
                        if ((column > 70 && c == ' ')
                            || column > 79) {
-                               os << "\n";
+                               os << '\n';
                                column = 0;
                        }
                        // this check is to amend a bug. LyX sometimes
@@ -476,10 +471,6 @@ LyXFont const Paragraph::getFontSettings(BufferParams const & bparams,
                retfont = getFontSettings(bparams, pos - 1);
        } else
                retfont = LyXFont(LyXFont::ALL_INHERIT, getParLanguage(bparams));
-#ifdef INHERIT_LANGUAGE
-       if (retfont.language() == inherit_language)
-               retfont.setLanguage(bparams.language);
-#endif
 
        return retfont;
 }
@@ -520,11 +511,7 @@ LyXFont const Paragraph::getFont(BufferParams const & bparams,
                layoutfont = lout->font;
 
        LyXFont tmpfont = getFontSettings(bparams, pos);
-#ifndef INHERIT_LANGUAGE
        tmpfont.realize(layoutfont);
-#else
-       tmpfont.realize(layoutfont, bparams.language);
-#endif
 
        return pimpl_->realizeFont(tmpfont, bparams);
 }
@@ -998,7 +985,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf,
 
                if (!params().spacing().isDefault()
                        && (!previous() || !previous()->hasSameLayout(this))) {
-                       os << params().spacing().writeEnvirBegin() << "\n";
+                       os << params().spacing().writeEnvirBegin() << '\n';
                        texrow.newline();
                }
 
@@ -1038,8 +1025,10 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf,
        if (language->babel() != previous_language->babel()
            // check if we already put language command in TeXEnvironment()
            && !(style->isEnvironment()
-                && (!previous() || previous()->layout() != layout() ||
-                        previous()->params().depth() != params().depth())))
+                && (!previous() ||
+                    (previous()->layout() != layout() &&
+                     previous()->getDepth() <= getDepth())
+                    || previous()->getDepth() < getDepth())))
        {
                if (!lyxrc.language_command_end.empty() &&
                    previous_language->babel() != doc_language->babel())
@@ -1064,7 +1053,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf,
            language->encoding() != previous_language->encoding()) {
                os << "\\inputencoding{"
                   << language->encoding()->LatexName()
-                  << "}" << endl;
+                  << "}\n";
                texrow.newline();
        }
 
@@ -1114,12 +1103,12 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf,
 
        if (style->resfont.size() != font.size() && next_ && !is_command) {
                if (!need_par)
-                       os << "{";
+                       os << '{';
                os << "\\" << font.latexSize() << " \\par}";
        } else if (need_par) {
                os << "\\par}";
        } else if (is_command)
-               os << "}";
+               os << '}';
 
        switch (style->latextype) {
        case LATEX_ITEM_ENVIRONMENT:
@@ -1169,7 +1158,7 @@ Paragraph * Paragraph::TeXOnePar(Buffer const * buf,
 
                if (!params().spacing().isDefault()
                        && (!next_ || !next_->hasSameLayout(this))) {
-                       os << params().spacing().writeEnvirEnd() << "\n";
+                       os << params().spacing().writeEnvirEnd() << '\n';
                        texrow.newline();
                }
        }
@@ -1471,7 +1460,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
                                running_font = basefont;
                                if (font.family() ==
                                    LyXFont::TYPEWRITER_FAMILY) {
-                                       os << "~";
+                                       os << '~';
                                }
                                if (moving_arg)
                                        os << "\\protect ";
@@ -1692,17 +1681,7 @@ Language const *
 Paragraph::getParLanguage(BufferParams const & bparams) const
 {
        if (!empty()) {
-#ifndef INHERIT_LANGUAGE
                return getFirstFontSettings().language();
-#else
-               Language const * lang = getFirstFontSettings().language();
-#ifdef WITH_WARNINGS
-#warning We should make this somewhat better, any ideas? (Jug)
-#endif
-               if (lang == inherit_language || lang == ignore_language)
-                       lang = bparams.language;
-               return lang;
-#endif
        } else if (previous_)
                return previous_->getParLanguage(bparams);
        else
@@ -1741,9 +1720,6 @@ bool Paragraph::isMultiLingual(BufferParams const & bparams)
        for (; cit != end; ++cit)
                if (cit->font().language() != ignore_language &&
                    cit->font().language() != latex_language &&
-#ifdef INHERIT_LANGUAGE
-                       cit->font().language() != inherit_language &&
-#endif
                        cit->font().language() != doc_language)
                        return true;
        return false;
@@ -1752,7 +1728,7 @@ bool Paragraph::isMultiLingual(BufferParams const & bparams)
 
 // Convert the paragraph to a string.
 // Used for building the table of contents
-string const Paragraph::asString(Buffer const * buffer, bool label)
+string const Paragraph::asString(Buffer const * buffer, bool label) const
 {
        BufferParams const & bparams = buffer->params;
        string s;
@@ -1768,7 +1744,7 @@ string const Paragraph::asString(Buffer const * buffer, bool label)
                         getInset(i)->lyxCode() == Inset::MATH_CODE) {
                        ostringstream ost;
                        getInset(i)->ascii(buffer, ost);
-                       s += subst(ost.str().c_str(),'\n',' ');
+                       s += subst(STRCONV(ost.str()),'\n',' ');
                }
        }
 
@@ -1780,7 +1756,7 @@ string const Paragraph::asString(Buffer const * buffer, bool label)
 
 
 string const Paragraph::asString(Buffer const * buffer,
-                                pos_type beg, pos_type end, bool label)
+                                pos_type beg, pos_type end, bool label) const
 {
        ostringstream ost;
 
@@ -1800,7 +1776,7 @@ string const Paragraph::asString(Buffer const * buffer,
                }
        }
 
-       return ost.str().c_str();
+       return STRCONV(ost.str());
 }