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(),
}
+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
{
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();
}
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;
+}