]> git.lyx.org Git - lyx.git/blobdiff - src/Paragraph.cpp
Account for changes in insets when checking changes in selection
[lyx.git] / src / Paragraph.cpp
index dab004ee3904e3d42ef4e14d36aa4d8201348cd7..27d1230f97d9f7e637f28113478f8e924e626484 100644 (file)
@@ -581,18 +581,6 @@ void Paragraph::addChangesToToc(DocIterator const & cdit, Buffer const & buf,
 }
 
 
-void Paragraph::addChangesToBuffer(Buffer const & buf) const
-{
-       d->changes_.updateBuffer(buf);
-}
-
-
-bool Paragraph::isChangeUpdateRequired() const
-{
-       return d->changes_.isUpdateRequired();
-}
-
-
 bool Paragraph::isDeleted(pos_type start, pos_type end) const
 {
        LASSERT(start >= 0 && start <= size(), return false);
@@ -610,6 +598,30 @@ bool Paragraph::isChanged(pos_type start, pos_type end) const
        return d->changes_.isChanged(start, end);
 }
 
+// FIXME: Ideally the diverse isChanged() methods should account for that!
+bool Paragraph::hasChangedInsets(pos_type start, pos_type end) const
+{
+       LASSERT(start >= 0 && start <= size(), return false);
+       LASSERT(end > start && end <= size() + 1, return false);
+
+       InsetList::const_iterator icit = d->insetlist_.begin();
+       InsetList::const_iterator iend = d->insetlist_.end();
+       for (; icit != iend; ++icit) {
+               if (icit->pos < start)
+                       continue;
+               if (icit->pos >= end)
+                       break;
+               if (icit->inset && icit->inset->isChanged())
+                       return true;
+       }
+       return false;
+}
+
+bool Paragraph::isChanged() const
+{
+       return d->changes_.isChanged();
+}
+
 
 bool Paragraph::isMergedOnEndOfParDeletion(bool trackChanges) const
 {
@@ -660,8 +672,8 @@ void Paragraph::setChange(pos_type pos, Change const & change)
 
        // see comment in setChange(Change const &) above
        if (!change.deleted() && pos < size())
-                       if (Inset * inset = getInset(pos))
-                               inset->setChange(change);
+               if (Inset * inset = getInset(pos))
+                       inset->setChange(change);
 }