]> git.lyx.org Git - lyx.git/blobdiff - src/cursor_slice.C
Tweak layout in GToc
[lyx.git] / src / cursor_slice.C
index f891844e196547906fa8ac0d54d414290325c0ab..eda679a2e95750fa10c79da8517003c57dd63ba3 100644 (file)
 #include "mathed/math_inset.h"
 #include "mathed/math_data.h"
 
-#include "insets/updatableinset.h"
-
-
 #include <boost/assert.hpp>
 
 using std::endl;
 
 
 CursorSlice::CursorSlice()
-       : inset_(0), idx_(0), par_(0), pos_(0), boundary_(false)
+       : inset_(0), idx_(0), pit_(0), pos_(0)
 {}
 
 
 CursorSlice::CursorSlice(InsetBase & p)
-       : inset_(&p), idx_(0), par_(0), pos_(0), boundary_(false)
+       : inset_(&p), idx_(0), pit_(0), pos_(0)
 {
        BOOST_ASSERT(inset_);
 }
 
 
-size_t CursorSlice::nargs() const
+MathArray & CursorSlice::cell() const
 {
-       BOOST_ASSERT(inset_);
-       return inset_->nargs();
+       return inset_->asMathInset()->cell(idx_);
 }
 
 
-size_t CursorSlice::nrows() const
+Paragraph & CursorSlice::paragraph()
 {
-       BOOST_ASSERT(inset_);
-       return inset_->nrows();
+       return text()->getPar(pit_);
 }
 
 
-size_t CursorSlice::ncols() const
+Paragraph const & CursorSlice::paragraph() const
 {
-       BOOST_ASSERT(inset_);
-       return inset_->ncols();
+       return text()->getPar(pit_);
 }
 
 
@@ -83,55 +77,11 @@ CursorSlice::col_type CursorSlice::col() const
 }
 
 
-MathInset * CursorSlice::asMathInset() const
-{
-       BOOST_ASSERT(inset_);
-       return inset_->asMathInset();
-}
-
-
-UpdatableInset * CursorSlice::asUpdatableInset() const
-{
-       BOOST_ASSERT(inset_);
-       return inset_->asUpdatableInset();
-}
-
-
-MathArray & CursorSlice::cell() const
-{
-       BOOST_ASSERT(asMathInset());
-       return asMathInset()->cell(idx_);
-}
-
-
-LyXText * CursorSlice::text() const
-{
-       BOOST_ASSERT(inset_);
-       return inset_->getText(idx_);
-}
-
-
-Paragraph & CursorSlice::paragraph()
-{
-       // access to the main lyx text must be handled in the cursor
-       BOOST_ASSERT(text());
-       return text()->getPar(par_);
-}
-
-
-Paragraph const & CursorSlice::paragraph() const
-{
-       // access to the main lyx text must be handled in the cursor
-       BOOST_ASSERT(text());
-       return text()->getPar(par_);
-}
-
-
 bool operator==(CursorSlice const & p, CursorSlice const & q)
 {
        return &p.inset() == &q.inset()
               && p.idx() == q.idx()
-              && p.par() == q.par()
+              && p.pit() == q.pit()
               && p.pos() == q.pos();
 }
 
@@ -140,7 +90,7 @@ bool operator!=(CursorSlice const & p, CursorSlice const & q)
 {
        return &p.inset() != &q.inset()
               || p.idx() != q.idx()
-              || p.par() != q.par()
+              || p.pit() != q.pit()
               || p.pos() != q.pos();
 }
 
@@ -154,8 +104,8 @@ bool operator<(CursorSlice const & p, CursorSlice const & q)
        }
        if (p.idx() != q.idx())
                return p.idx() < q.idx();
-       if (p.par() != q.par())
-               return p.par() < q.par();
+       if (p.pit() != q.pit())
+               return p.pit() < q.pit();
        return p.pos() < q.pos();
 }
 
@@ -178,7 +128,7 @@ std::ostream & operator<<(std::ostream & os, CursorSlice const & item)
           << "inset: " << &item.inset()
 //        << " text: " << item.text()
           << " idx: " << item.idx()
-          << " par: " << item.par()
+          << " par: " << item.pit()
           << " pos: " << item.pos()
 //        << " x: " << item.inset().x()
 //        << " y: " << item.inset().y()