#include "DocIterator.h"
#include "debug.h"
-#include "LyXText.h"
+#include "Text.h"
#include "Paragraph.h"
#include "mathed/MathData.h"
}
-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();
}
+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;
}
-LyXText * DocIterator::innerText()
+Text * DocIterator::innerText()
{
BOOST_ASSERT(!empty());
// Go up until first non-0 text is hit
return 0;
}
-LyXText const * DocIterator::innerText() const
+Text const * DocIterator::innerText() const
{
BOOST_ASSERT(!empty());
// go up until first non-0 text is hit