]> git.lyx.org Git - lyx.git/blobdiff - src/DocIterator.cpp
prepare Qt 5.6 builds
[lyx.git] / src / DocIterator.cpp
index e574115c31be85de4349a1ef7ab1e60db2e19f2a..a059ad18d2110b52fe88153b65ef4d5669ed288e 100644 (file)
@@ -226,6 +226,15 @@ CursorSlice const & DocIterator::innerTextSlice() const
 }
 
 
+DocIterator DocIterator::getInnerText() const
+{
+       DocIterator texted = *this;
+       while (!texted.inTexted()) 
+               texted.pop_back();
+       return texted;
+}
+
+
 pit_type DocIterator::lastpit() const
 {
        return inMathed() ? 0 : text()->paragraphs().size() - 1;
@@ -449,6 +458,28 @@ void DocIterator::backwardPos()
 }
 
 
+#if 0
+// works, but currently not needed
+void DocIterator::backwardInset()
+{
+       backwardPos();
+
+       while (!empty() && !nextInset()) {
+               if (inTexted()) {
+                       pos_type const lastp = lastpos();
+                       Paragraph const & par = paragraph();
+                       pos_type & pos = top().pos();
+                       while (pos > 0 && (pos == lastp || !par.isInset(pos)))
+                               --pos;
+                       if (pos > 0)
+                               break;
+               }
+               backwardPos();
+       }
+}
+#endif
+
+
 bool DocIterator::hasPart(DocIterator const & it) const
 {
        // it can't be a part if it is larger
@@ -460,6 +491,19 @@ bool DocIterator::hasPart(DocIterator const & it) const
 }
 
 
+bool DocIterator::allowSpellCheck() const
+{
+       /// spell check is disabled if the iterator position
+       /// is inside of an inset which disables the spell checker
+       size_t const n = depth();
+       for (size_t i = 0; i < n; ++i) {
+               if (!slices_[i].inset_->allowSpellCheck())
+                       return false;
+       }
+       return true;
+}
+
+
 void DocIterator::updateInsets(Inset * inset)
 {
        // this function re-creates the cache of inset pointers.
@@ -555,8 +599,8 @@ void DocIterator::sanitize()
                        fixIfBroken();
                        break;
                }
-               if (!inset->editable()) {
-                       LYXERR0("Inset found on cursor stack is not editable.");
+               if (!inset->isActive()) {
+                       LYXERR0("Inset found on cursor stack is not active.");
                        fixIfBroken();
                        break;
                }