]> git.lyx.org Git - lyx.git/blobdiff - src/DocIterator.cpp
BufferParams.cpp: fix bug 3568:
[lyx.git] / src / DocIterator.cpp
index af3ed12d15fdc00e7c5f1707a03beac6e0ce5af5..cf84b1b1c7cff0657ec2da7ac22322748e3d347a 100644 (file)
@@ -14,7 +14,7 @@
 #include "DocIterator.h"
 
 #include "debug.h"
-#include "LyXText.h"
+#include "Text.h"
 #include "Paragraph.h"
 
 #include "mathed/MathData.h"
@@ -152,13 +152,13 @@ MathAtom & DocIterator::nextAtom()
 }
 
 
-LyXText * DocIterator::text()
+Text * DocIterator::text()
 {
        BOOST_ASSERT(!empty());
        return top().text();
 }
 
-LyXText const * DocIterator::text() const
+Text const * DocIterator::text() const
 {
        BOOST_ASSERT(!empty());
        return top().text();
@@ -181,6 +181,22 @@ Paragraph const & DocIterator::paragraph() const
 }
 
 
+Paragraph const & DocIterator::innerParagraph() const
+{
+       BOOST_ASSERT(!empty());
+       // go up until first non-0 text is hit
+       // (innermost text is 0 in mathed)
+       for (int i = depth() - 1; i >= 0; --i)
+               if (slices_[i].text())
+                       return slices_[i].paragraph();
+
+       // This case is in principe not possible. We _must_
+       // be inside a Paragraph.
+       BOOST_ASSERT(false);
+       return paragraph();
+}
+
+
 pit_type DocIterator::lastpit() const
 {
        return inMathed() ? 0 : text()->paragraphs().size() - 1;
@@ -246,7 +262,7 @@ MathData & DocIterator::cell()
 }
 
 
-LyXText * DocIterator::innerText()
+Text * DocIterator::innerText()
 {
        BOOST_ASSERT(!empty());
        // Go up until first non-0 text is hit
@@ -257,7 +273,7 @@ LyXText * DocIterator::innerText()
        return 0;
 }
 
-LyXText const * DocIterator::innerText() const
+Text const * DocIterator::innerText() const
 {
        BOOST_ASSERT(!empty());
        // go up until first non-0 text is hit