LyXParagraph::LyXParagraph()
{
-#ifndef HAVE_ROPE
text.reserve(500); // is this number too big?
-#endif
for (int i = 0; i < 10; ++i) setCounter(i , 0);
appendix = false;
enumdepth = 0;
// This konstruktor inserts the new paragraph in a list.
LyXParagraph::LyXParagraph(LyXParagraph * par)
{
-#ifndef HAVE_ROPE
text.reserve(500);
-#endif
par->fitToSize();
for (int i = 0; i < 10; ++i) setCounter(i, 0);
insetlist.erase(it);
}
}
-#ifndef HAVE_ROPE
+
text.erase(text.begin() + pos);
-#else
- text.erase(text.mutable_begin() + pos);
-#endif
+
// Erase entries in the tables.
FontTable search_font(pos, LyXFont());
#else
Assert(pos <= size());
#endif
-#ifndef HAVE_ROPE
text.insert(text.begin() + pos, c);
-#else
- text.insert(pos, c);
-#endif
+
// Update the font table.
FontTable search_font(pos, LyXFont());
for (FontList::iterator it = lower_bound(fontlist.begin(),
"position does not exist. "
<< pos << " (" << static_cast<int>(pos)
<< ")" << endl;
- }
- else if (pos > 0) {
+ } else if (pos > 0) {
return GetFontSettings(bparams, pos - 1);
}
#else
//return LyXFont(LyXFont::ALL_INHERIT);
}
+
// Gets uninstantiated font setting at position 0
LyXFont const LyXParagraph::GetFirstFontSettings() const
{
}
+LyXParagraph::value_type
+LyXParagraph::GetUChar(BufferParams const & bparams,
+ LyXParagraph::size_type pos) const
+{
+ value_type c = GetChar(pos);
+ if (!lyxrc.rtl_support)
+ return c;
+
+ value_type uc = c;
+ switch (c) {
+ case '(':
+ uc = ')';
+ break;
+ case ')':
+ uc = '(';
+ break;
+ case '[':
+ uc = ']';
+ break;
+ case ']':
+ uc = '[';
+ break;
+ case '{':
+ uc = '}';
+ break;
+ case '}':
+ uc = '{';
+ break;
+ case '<':
+ uc = '>';
+ break;
+ case '>':
+ uc = '<';
+ break;
+ }
+ if (uc != c && GetFontSettings(bparams, pos).isRightToLeft())
+ return uc;
+ else
+ return c;
+}
+
// return an string of the current word, and the end of the word in lastpos.
string const LyXParagraph::GetWord(LyXParagraph::size_type & lastpos) const
{
return (*cit).pos;
}
}
+ if (inset == bibkey)
+ return 0;
+
#ifndef NEW_INSETS
// Think about footnotes.
if (footnoteflag == LyXParagraph::NO_FOOTNOTE
// This is necessary because LaTeX (and LyX on the screen)
// calculates the space between the baselines according
// to this font. (Matthias)
+ //
+ // Is this really needed ? (Dekel)
+ // We do not need to use to change the font for the last paragraph
+ // or for a command.
LyXFont font = getFont(bparams, Last() - 1);
- if (need_par && next) {
- if (style.resfont.size() != font.size()) {
- os << '\\'
- << font.latexSize()
- << ' ';
- }
+ bool is_command = textclasslist.Style(bparams.textclass,
+ GetLayout()).isCommand();
+ if (style.resfont.size() != font.size() && next && !is_command) {
+ if (!need_par)
+ os << "{";
+ os << "\\" << font.latexSize() << " \\par}";
+ } else if (need_par) {
os << "\\par}";
- } else if (textclasslist.Style(bparams.textclass,
- GetLayout()).isCommand()) {
- if (style.resfont.size() != font.size()) {
- os << '\\'
- << font.latexSize()
- << ' ';
- }
- os << '}';
- } else if ((style.resfont.size() != font.size()) && next){
- os << "{\\" << font.latexSize() << " \\par}";
- }
+ } else if (is_command)
+ os << "}";
if (language->babel() != doc_language->babel() &&
(!par
break;
default:
// we don't need it for the last paragraph!!!
+ // or for tables in floats
+ // -- effectively creates a \par where there isn't one which
+ // breaks a \subfigure or \subtable.
if (next) {
+// && footnoteflag == LyXParagraph::NO_FOOTNOTE) {
os << '\n';
texrow.newline();
}
if (style.isCommand()) {
os << '{';
++column;
- } else if (align != LYX_ALIGN_LAYOUT) {
- os << "{\\par";
- column += 4;
+ } else if (align != LYX_ALIGN_LAYOUT && next) {
+ // We do not need \par here (Dekel)
+ // os << "{\\par";
+ os << "{";
+ ++column;
return_value = true;
}
case LYX_ALIGN_SPECIAL:
break;
case LYX_ALIGN_LEFT:
+ if (moving_arg)
+ os << "\\protect";
if (getParLanguage(bparams)->babel() != "hebrew") {
os << "\\raggedright ";
column+= 13;
}
break;
case LYX_ALIGN_RIGHT:
+ if (moving_arg)
+ os << "\\protect";
if (getParLanguage(bparams)->babel() != "hebrew") {
os << "\\raggedleft ";
column+= 12;
}
break;
case LYX_ALIGN_CENTER:
+ if (moving_arg)
+ os << "\\protect";
os << "\\centering ";
column+= 11;
break;
s += labelstring + ' ';
for (LyXParagraph::size_type i = beg; i < end; ++i) {
- value_type c = GetChar(i);
+ value_type c = GetUChar(buffer->params, i);
if (IsPrintable(c))
s += c;
else if (c == META_INSET) {
}
}
}
+
+
+void LyXParagraph::fitToSize()
+{
+ TextContainer tmp(text.begin(), text.end());
+ text.swap(tmp);
+}
+
+
+void LyXParagraph::setContentsFromPar(LyXParagraph * par)
+{
+ text = par->text;
+}