X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FCursorSlice.cpp;h=47b518cbfd2e72c3eaf0ff2953f33ca1d31ca8d3;hb=e54ae72e5fac6f750c3f7972c74bb42b57f3a049;hp=f8d72eea131265c0dac2861f49a7f6448bc057fa;hpb=3fdbf5b9c4122b5c9a122978f6374e0b9bcab010;p=lyx.git diff --git a/src/CursorSlice.cpp b/src/CursorSlice.cpp index f8d72eea13..47b518cbfd 100644 --- a/src/CursorSlice.cpp +++ b/src/CursorSlice.cpp @@ -25,12 +25,11 @@ #include "mathed/MathData.h" #include -#include +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());