#include "lyxrc.h"
#include "layout.h"
#include "language.h"
-#include "tex-strings.h"
#include "buffer.h"
#include "bufferparams.h"
#include "debug.h"
// First write the layout
os << "\n\\layout " << layout()->name() << '\n';
- // Maybe some vertical spaces.
- if (params().spaceTop().kind() != VSpace::NONE)
- os << "\\added_space_top "
- << params().spaceTop().asLyXCommand() << ' ';
- if (params().spaceBottom().kind() != VSpace::NONE)
- os << "\\added_space_bottom "
- << params().spaceBottom().asLyXCommand() << ' ';
-
- // Maybe the paragraph has special spacing
- params().spacing().writeFile(os, true);
-
- // The labelwidth string used in lists.
- if (!params().labelWidthString().empty())
- os << "\\labelwidthstring "
- << params().labelWidthString() << '\n';
-
- // Lines above or below?
- if (params().lineTop())
- os << "\\line_top ";
- if (params().lineBottom())
- os << "\\line_bottom ";
-
- // Pagebreaks above or below?
- if (params().pagebreakTop())
- os << "\\pagebreak_top ";
- if (params().pagebreakBottom())
- os << "\\pagebreak_bottom ";
-
- // Start of appendix?
- if (params().startOfAppendix())
- os << "\\start_of_appendix ";
-
- // Noindent?
- if (params().noindent())
- os << "\\noindent ";
-
- // Do we have a manual left indent?
- if (!params().leftIndent().zero())
- os << "\\leftindent " << params().leftIndent().asString()
- << ' ';
-
- // Alignment?
- if (params().align() != LYX_ALIGN_LAYOUT) {
- int h = 0;
- switch (params().align()) {
- case LYX_ALIGN_LEFT: h = 1; break;
- case LYX_ALIGN_RIGHT: h = 2; break;
- case LYX_ALIGN_CENTER: h = 3; break;
- default: h = 0; break;
- }
- os << "\\align " << string_align[h] << ' ';
- }
+ params().write(os);
LyXFont font1(LyXFont::ALL_INHERIT, bparams.language);
}
}
break;
- case META_NEWLINE:
- os << "\n\\newline \n";
- column = 0;
- break;
case '\\':
os << "\n\\backslash \n";
column = 0;
// and remember the previous character to
// remove unnecessary GetChar() calls
pos_type i = 0;
- if (i < size() && getChar(i) != Paragraph::META_NEWLINE) {
+ if (i < size() && !isNewline(i)) {
++i;
char previous_char = 0;
char temp = 0;
- if (i < size()
- && (previous_char = getChar(i)) != Paragraph::META_NEWLINE) {
- // Yes, this ^ is supposed to be "= " not "=="
- ++i;
- while (i < size()
- && previous_char != ' '
- && (temp = getChar(i)) != Paragraph::META_NEWLINE) {
+ if (i < size()) {
+ previous_char = getChar(i);
+ if (!isNewline(i)) {
++i;
- previous_char = temp;
+ while (i < size() && previous_char != ' ') {
+ temp = getChar(i);
+ if (isNewline(i))
+ break;
+
+ ++i;
+ previous_char = temp;
+ }
}
}
}
column += Changes::latexMarkChange(os, running_change, change);
running_change = change;
- if (c == Paragraph::META_NEWLINE) {
- // newlines are handled differently here than
- // the default in SimpleTeXSpecialChars().
- if (!style->newline_allowed) {
- os << '\n';
- } else {
- if (open_font) {
- column += running_font.latexWriteEndChanges(os, basefont, basefont);
- open_font = false;
- }
- basefont = getLayoutFont(bparams);
- running_font = basefont;
- if (font.family() ==
- LyXFont::TYPEWRITER_FAMILY) {
- os << '~';
- }
- if (moving_arg)
- os << "\\protect ";
-
- os << "\\\\\n";
- }
- texrow.newline();
- texrow.start(this, i + 1);
- column = 0;
- } else {
- pimpl_->simpleTeXSpecialChars(buf, bparams,
- os, texrow, moving_arg,
- font, running_font,
- basefont, open_font,
- running_change,
- *style, i, column, c);
- }
+ pimpl_->simpleTeXSpecialChars(buf, bparams,
+ os, texrow, moving_arg,
+ font, running_font,
+ basefont, open_font,
+ running_change,
+ *style, i, column, c);
}
column += Changes::latexMarkChange(os,
bool Paragraph::isHfill(pos_type pos) const
{
return IsInsetChar(getChar(pos))
- && getInset(pos)->lyxCode() == Inset::HFILL_CODE;
+ && getInset(pos)->lyxCode() == Inset::HFILL_CODE;
}
bool Paragraph::isNewline(pos_type pos) const
{
- return pos >= 0 && IsNewlineChar(getChar(pos));
+ return IsInsetChar(getChar(pos))
+ && getInset(pos)->lyxCode() == Inset::NEWLINE_CODE;
}
value_type const c = getUChar(buffer->params, i);
if (IsPrintable(c))
os << c;
- else if (c == META_NEWLINE)
- os << '\n';
- else if (c == META_INSET)
+ else if (c == META_INSET)
getInset(i)->ascii(buffer, os);
}
pimpl_->inset_owner = i;
InsetList::iterator it = insetlist.begin();
InsetList::iterator end = insetlist.end();
- for (; it != end; ++it)
+ for (; it != end; ++it)
if (it.getInset())
it.getInset()->setOwner(i);
}