+ id_ = paragraph_id++;
+
+ if (p.tracking())
+ changes_.reset(new Changes(*p.changes_.get()));
+}
+
+
+void Paragraph::Pimpl::setContentsFromPar(Paragraph const & par)
+{
+ owner_->text_ = par.text_;
+ if (par.pimpl_->tracking()) {
+ changes_.reset(new Changes(*(par.pimpl_->changes_.get())));
+ }
+}
+
+
+void Paragraph::Pimpl::trackChanges(Change::Type type)
+{
+ if (tracking()) {
+ lyxerr[Debug::CHANGES] << "already tracking for par " << id_ << endl;
+ return;
+ }
+
+ lyxerr[Debug::CHANGES] << "track changes for par "
+ << id_ << " type " << type << endl;
+ changes_.reset(new Changes(type));
+ changes_->set(type, 0, size());
+}
+
+
+void Paragraph::Pimpl::untrackChanges()
+{
+ changes_.reset(0);
+}
+
+
+void Paragraph::Pimpl::cleanChanges()
+{
+ // if we're not tracking, we don't want to reset...
+ if (!tracking())
+ return;
+
+ changes_.reset(new Changes(Change::INSERTED));
+ changes_->set(Change::INSERTED, 0, size());
+}
+
+
+bool Paragraph::Pimpl::isChanged(pos_type start, pos_type end) const
+{
+ if (!tracking())
+ return false;
+
+ return changes_->isChange(start, end);
+}
+
+
+bool Paragraph::Pimpl::isChangeEdited(pos_type start, pos_type end) const
+{
+ if (!tracking())
+ return false;
+
+ return changes_->isChangeEdited(start, end);
+}
+
+
+void Paragraph::Pimpl::setChange(pos_type pos, Change::Type type)
+{
+ if (!tracking())
+ return;
+
+ changes_->set(type, pos);
+}
+
+
+Change::Type Paragraph::Pimpl::lookupChange(pos_type pos) const
+{
+ if (!tracking())
+ return Change::UNCHANGED;
+
+ return changes_->lookup(pos);