8 #include "math_inset.h"
10 #include "support/LAssert.h"
11 #include "support/LOstream.h"
14 MathCursorPos::MathCursorPos()
15 : par_(0), idx_(0), pos_(0)
19 MathCursorPos::MathCursorPos(MathInset * p)
20 : par_(p), idx_(0), pos_(0)
27 MathArray & MathCursorPos::cell(MathArray::idx_type idx) const
30 return par_->cell(idx);
34 MathArray & MathCursorPos::cell() const
37 return par_->cell(idx_);
41 void MathCursorPos::getPos(int & x, int & y) const
43 par_->getPos(idx_, pos_, x, y);
47 void MathCursorPos::setPos(MathArray::pos_type pos)
53 std::ostream & operator<<(std::ostream & os, MathCursorPos const & p)
55 os << "(par: " << p.par_ << " idx: " << p.idx_ << " pos: " << p.pos_ << ")";
60 bool operator==(MathCursorPos const & p, MathCursorPos const & q)
62 return p.par_ == q.par_ && p.idx_ == q.idx_ && p.pos_ == q.pos_;
66 bool operator!=(MathCursorPos const & p, MathCursorPos const & q)
68 return p.par_ != q.par_ || p.idx_ != q.idx_ || p.pos_ != q.pos_;
72 bool operator<(MathCursorPos const & p, MathCursorPos const & q)
74 if (p.par_ != q.par_) {
75 lyxerr << "can't compare cursor and anchor in different insets\n";
79 return p.idx_ < q.idx_;
80 return p.pos_ < q.pos_;