]> 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 f8d72eea131265c0dac2861f49a7f6448bc057fa..47b518cbfd2e72c3eaf0ff2953f33ca1d31ca8d3 100644 (file)
 #include "mathed/MathData.h"
 
 #include <boost/assert.hpp>
-#include <boost/bind.hpp>
 
+using std::endl;
 
-namespace lyx {
 
-using std::endl;
+namespace lyx {
 
 
 CursorSlice::CursorSlice()
@@ -42,41 +41,6 @@ CursorSlice::CursorSlice(Inset & p)
        : inset_(&p), idx_(0), pit_(0), pos_(0)
 {
        BOOST_ASSERT(inset_);
-       inset_->destroyed.connect(
-                       boost::bind(&CursorSlice::invalidate, this));
-}
-
-
-CursorSlice::CursorSlice(CursorSlice const & cs)
-{
-       operator=(cs);
-}
-
-
-CursorSlice & CursorSlice::operator=(CursorSlice const & cs)
-{
-       inset_ = cs.inset_;
-       idx_ = cs.idx_;
-       pit_ = cs.pit_;
-       pos_ = cs.pos_;
-       if (inset_) {
-               BOOST_ASSERT(inset_);
-               inset_->destroyed.connect(
-                       boost::bind(&CursorSlice::invalidate, this));
-       }
-       return *this;
-}
-
-
-void CursorSlice::invalidate()
-{
-       inset_ = 0;
-}
-
-
-bool CursorSlice::isValid() const
-{
-       return inset_ != 0;
 }
 
 
@@ -105,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());