using lyx::support::contains;
using lyx::support::subst;
+using std::distance;
using std::endl;
using std::list;
using std::stack;
Paragraph::Paragraph(Paragraph const & par)
- : y(0), height(0), text_(par.text_), begin_of_body_(par.begin_of_body_),
+ : itemdepth(par.itemdepth), insetlist(par.insetlist),
+ rows(par.rows), y(par.y), height(par.height),
+ width(par.width), layout_(par.layout_),
+ text_(par.text_), begin_of_body_(par.begin_of_body_),
pimpl_(new Paragraph::Pimpl(*par.pimpl_, this))
{
- itemdepth = 0;
- // this is because of the dummy layout of the paragraphs that
- // follow footnotes
- layout_ = par.layout();
-
- // copy everything behind the break-position to the new paragraph
- insetlist = par.insetlist;
InsetList::iterator it = insetlist.begin();
InsetList::iterator end = insetlist.end();
for (; it != end; ++it)
lyxerr << "Paragraph::operator=()" << endl;
- text_ = par.text_;
-
- delete pimpl_;
- pimpl_ = new Pimpl(*par.pimpl_, this);
-
itemdepth = par.itemdepth;
- // this is because of the dummy layout of the paragraphs that
- // follow footnotes
- layout_ = par.layout();
- // copy everything behind the break-position to the new paragraph
insetlist = par.insetlist;
InsetList::iterator it = insetlist.begin();
InsetList::iterator end = insetlist.end();
for (; it != end; ++it)
it->inset = it->inset->clone().release();
+
+ rows = par.rows;
+ y = par.y;
+ height = par.height;
+ width = par.width;
+ layout_ = par.layout();
+ text_ = par.text_;
+ begin_of_body_ = par.begin_of_body_;
+
+ delete pimpl_;
+ pimpl_ = new Pimpl(*par.pimpl_, this);
}
LyXFont const Paragraph::getFontSettings(BufferParams const & bparams,
pos_type pos) const
{
- BOOST_ASSERT(pos <= size());
+ if (pos > size()) {
+ lyxerr << " pos: " << pos << " size: " << size() << endl;
+ BOOST_ASSERT(pos <= size());
+ }
Pimpl::FontList::const_iterator cit = pimpl_->fontlist.begin();
Pimpl::FontList::const_iterator end = pimpl_->fontlist.end();
if (it->pos() >= pos)
break;
}
- unsigned int i = std::distance(beg, it);
+ unsigned int i = distance(beg, it);
bool notfound = (it == endit);
if (!notfound && pimpl_->fontlist[i].font() == font)
namespace {
// paragraphs inside floats need different alignment tags to avoid
-// unwanted space
+// unwanted space
bool noTrivlistCentering(UpdatableInset const * inset)
{
int char_line_count = depth;
bool label_closed = true;
bool para_closed = true;
-
+
if (style->latextype == LATEX_ITEM_ENVIRONMENT) {
string ls = "";
Counters & counters = buf.params().getLyXTextClass().counters();
if (!defaultstyle->latexparam().empty()) {
counters.step("para");
ls = tostr(counters.value("para"));
- ls = " id=\""
+ ls = " id=\""
+ subst(defaultstyle->latexparam(), "#", ls) + '"';
}
- os << "<" << style->itemtag() << ">\n"
- << string(depth, ' ') << "<"
+ os << "<" << style->itemtag() << ">\n"
+ << string(depth, ' ') << "<"
<< defaultstyle->latexname() << ls << ">\n";
para_closed = false;
}
}
}
-
if (isInset(i)) {
InsetBase const * inset = getInset(i);
// don't print the inset in position 0 if desc_on == 3 (label)
os << str;
} else if (!style->labeltag().empty() && !label_closed) {
++char_line_count;
- os << "\n</" << style->labeltag() << "><"
- << style->itemtag() << "><"
+ os << "\n</" << style->labeltag() << "><"
+ << style->itemtag() << "><"
<< defaultstyle->latexname() << ">";
label_closed = true;
para_closed = false;
// resets description flag correctly
if (!label_closed) {
// <term> not closed...
- os << "</" << style->labeltag() << ">\n<"
- << style->itemtag() << "><"
+ os << "</" << style->labeltag() << ">\n<"
+ << style->itemtag() << "><"
<< defaultstyle->latexname() << "> ";
}
if (!para_closed) {
- os << "\n" << string(depth, ' ') << "</"
+ os << "\n" << string(depth, ' ') << "</"
<< defaultstyle->latexname() << ">\n";
}
if (style->free_spacing)
}
-bool Paragraph::isMultiLingual(BufferParams const & bparams)
+bool Paragraph::isMultiLingual(BufferParams const & bparams) const
{
Language const * doc_language = bparams.language;
Pimpl::FontList::const_iterator cit = pimpl_->fontlist.begin();
void Paragraph::setChange(lyx::pos_type pos, Change::Type type)
{
pimpl_->setChange(pos, type);
-
}
<< id() << " of size " << siz
<< " is a bit silly !" << endl;
BOOST_ASSERT(false);
- return '\0';
}
return text_[pos];
}
+RowList::const_iterator Paragraph::getRow(pos_type pos) const
+{
+ RowList::const_iterator rit = rows.end();
+ RowList::const_iterator const begin = rows.begin();
+
+ for (--rit; rit != begin && rit->pos() > pos; --rit)
+ ;
+
+ return rit;
+}
+
+
+size_t Paragraph::row(pos_type pos) const
+{
+ RowList::const_iterator rit = rows.end();
+ RowList::const_iterator const begin = rows.begin();
+
+ for (--rit; rit != begin && rit->pos() > pos; --rit)
+ ;
+
+ return rit - begin;
+}
+
+
unsigned char Paragraph::transformChar(unsigned char c, pos_type pos) const
{
if (!Encodings::is_arabic(c))