+void Paragraph::Pimpl::cleanChanges(Paragraph::ChangeTracking ct)
+{
+ // if the paragraph was not tracked and we don't know the buffer's
+ // change tracking state, we do nothing
+ if ((ct == Paragraph::trackingUnknown) && !tracking())
+ return;
+
+ // untrack everything if we are in a buffer where ct is disabled
+ else if (ct == Paragraph::trackingOff) {
+ untrackChanges();
+ return;
+ }
+
+ // in a buffer where ct is enabled, set everything to INSERTED
+ changes_.reset(new Changes(Change::INSERTED));
+ changes_->set(Change::INSERTED, 0, size() + 1);
+}
+
+
+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::setChangeType(pos_type pos, Change::Type type)
+{
+ if (!tracking())
+ return;
+
+ changes_->set(type, pos);
+}
+
+
+void Paragraph::Pimpl::setChange(pos_type pos, Change change)
+{
+ if (!tracking())
+ return;
+
+ changes_->set(change, pos);
+}
+
+
+Change const Paragraph::Pimpl::lookupChange(pos_type pos) const
+{
+ if (!tracking())
+ return Change(Change::UNCHANGED);
+
+ return changes_->lookup(pos);
+}
+
+
+void Paragraph::Pimpl::markErased(bool erased)