#include <config.h>
#include "CursorSlice.h"
+
#include "debug.h"
-#include "LyXText.h"
+#include "Text.h"
#include "Paragraph.h"
+#include "insets/Inset.h"
+
#include "mathed/InsetMath.h"
-#include "mathed/MathArray.h"
+#include "mathed/MathData.h"
#include <boost/assert.hpp>
+using std::endl;
-namespace lyx {
-using std::endl;
+namespace lyx {
CursorSlice::CursorSlice()
{}
-CursorSlice::CursorSlice(InsetBase & p)
+CursorSlice::CursorSlice(Inset & p)
: inset_(&p), idx_(0), pit_(0), pos_(0)
{
BOOST_ASSERT(inset_);
}
-MathArray & CursorSlice::cell() const
+MathData & CursorSlice::cell() const
{
return inset_->asInsetMath()->cell(idx_);
}
}
+pit_type CursorSlice::lastpit() const
+{
+ if (inset().inMathed())
+ return 0;
+ return text()->paragraphs().size() - 1;
+}
+
+
CursorSlice::row_type CursorSlice::row() const
{
BOOST_ASSERT(asInsetMath());
bool operator==(CursorSlice const & p, CursorSlice const & q)
{
- return p.inset_ == q.inset_
+ return &p.inset() == &q.inset()
&& p.idx() == q.idx()
&& p.pit() == q.pit()
&& p.pos() == q.pos();
bool operator!=(CursorSlice const & p, CursorSlice const & q)
{
- return p.inset_ != q.inset_
+ return &p.inset() != &q.inset()
|| p.idx() != q.idx()
|| p.pit() != q.pit()
|| p.pos() != q.pos();