]> git.lyx.org Git - lyx.git/blobdiff - src/CursorSlice.cpp
Fixed some lines that were too long. It compiled afterwards.
[lyx.git] / src / CursorSlice.cpp
index 840d4b1c32402768458bd3cd1977a37cbb084ca0..47b518cbfd2e72c3eaf0ff2953f33ca1d31ca8d3 100644 (file)
 #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()
@@ -34,14 +37,14 @@ 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_);
 }
@@ -66,6 +69,14 @@ pos_type CursorSlice::lastpos() const
 }
 
 
+pit_type CursorSlice::lastpit() const
+{
+       if (inset().inMathed())
+               return 0;
+       return text()->paragraphs().size() - 1;
+}
+
+
 CursorSlice::row_type CursorSlice::row() const
 {
        BOOST_ASSERT(asInsetMath());
@@ -82,7 +93,7 @@ CursorSlice::col_type CursorSlice::col() const
 
 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();
@@ -91,7 +102,7 @@ bool operator==(CursorSlice const & p, CursorSlice const & q)
 
 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();