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;
+ //lyxerr << "Paragraph::Paragraph(Paragraph const&)" << endl;
InsetList::iterator it = insetlist.begin();
InsetList::iterator end = insetlist.end();
for (; it != end; ++it)
}
-void Paragraph::operator=(Paragraph const & par)
+Paragraph & Paragraph::operator=(Paragraph const & par)
{
// needed as we will destroy the pimpl_ before copying it
- if (&par != this)
- return;
-
- 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();
+ if (&par != this) {
+ itemdepth = par.itemdepth;
+
+ 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);
+ }
+ return *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();
}
-int Paragraph::beginOfBody() const
+pos_type Paragraph::beginOfBody() const
{
return begin_of_body_;
}
}
}
-
if (isInset(i)) {
InsetBase const * inset = getInset(i);
// don't print the inset in position 0 if desc_on == 3 (label)
}
-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))