#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"
}
// 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);
// 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) {
case LYX_ALIGN_CENTER: h = 3; break;
default: h = 0; break;
}
- os << "\\align " << string_align[h] << " ";
+ os << "\\align " << string_align[h] << ' ';
}
// bibitem ale970302
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;
}
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
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;
}
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);
}
if (!params().spacing().isDefault()
&& (!previous() || !previous()->hasSameLayout(this))) {
- os << params().spacing().writeEnvirBegin() << "\n";
+ os << params().spacing().writeEnvirBegin() << '\n';
texrow.newline();
}
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())
language->encoding() != previous_language->encoding()) {
os << "\\inputencoding{"
<< language->encoding()->LatexName()
- << "}" << endl;
+ << "}\n";
texrow.newline();
}
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:
if (!params().spacing().isDefault()
&& (!next_ || !next_->hasSameLayout(this))) {
- os << params().spacing().writeEnvirEnd() << "\n";
+ os << params().spacing().writeEnvirEnd() << '\n';
texrow.newline();
}
}
running_font = basefont;
if (font.family() ==
LyXFont::TYPEWRITER_FAMILY) {
- os << "~";
+ os << '~';
}
if (moving_arg)
os << "\\protect ";
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
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;
// 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;
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',' ');
}
}
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;
}
}
- return ost.str().c_str();
+ return STRCONV(ost.str());
}