+ return !formula();
+}
+
+
+InsetBase * LCursor::nextInset()
+{
+ if (pos() == lastpos())
+ return 0;
+ if (inMathed())
+ return nextAtom().nucleus();
+ return paragraph().isInset(pos()) ? paragraph().getInset(pos()) : 0;
+}
+
+
+InsetBase * LCursor::prevInset()
+{
+ if (pos() == 0)
+ return 0;
+ if (inMathed())
+ return prevAtom().nucleus();
+ return paragraph().isInset(pos() - 1) ? paragraph().getInset(pos() - 1) : 0;
+}
+
+
+InsetBase const * LCursor::prevInset() const
+{
+ if (pos() == 0)
+ return 0;
+ if (inMathed())
+ return prevAtom().nucleus();
+ return paragraph().isInset(pos() - 1) ? paragraph().getInset(pos() - 1) : 0;
+}
+
+
+void LCursor::message(string const & msg) const
+{
+ bv().owner()->getLyXFunc().setMessage(msg);
+}
+
+
+void LCursor::errorMessage(string const & msg) const
+{
+ bv().owner()->getLyXFunc().setErrorMessage(msg);
+}
+
+
+string LCursor::selectionAsString(bool label) const
+{
+ if (!selection())
+ return string();
+
+ if (inTexted()) {
+ Buffer const & buffer = *bv().buffer();
+
+ // should be const ...
+ ParagraphList::iterator startpit = text()->getPar(selBegin());
+ ParagraphList::iterator endpit = text()->getPar(selEnd());
+ size_t const startpos = selBegin().pos();
+ size_t const endpos = selEnd().pos();
+
+ if (startpit == endpit)
+ return startpit->asString(buffer, startpos, endpos, label);
+
+ // First paragraph in selection
+ string result =
+ startpit->asString(buffer, startpos, startpit->size(), label) + "\n\n";
+
+ // The paragraphs in between (if any)
+ ParagraphList::iterator pit = startpit;
+ for (++pit; pit != endpit; ++pit)
+ result += pit->asString(buffer, 0, pit->size(), label) + "\n\n";
+
+ // Last paragraph in selection
+ result += endpit->asString(buffer, 0, endpos, label);
+
+ return result;
+ }
+
+#warning an mathed?
+ return string();
+}
+
+
+string LCursor::currentState()
+{
+ if (inMathed()) {
+ std::ostringstream os;
+ info(os);
+ return os.str();
+ }
+ return text() ? text()->currentState(*this) : string();
+}
+
+
+// only used by the spellchecker
+void LCursor::replaceWord(string const & replacestring)
+{
+ LyXText * t = text();
+ BOOST_ASSERT(t);
+
+ t->replaceSelectionWithString(*this, replacestring);
+ t->setSelectionRange(*this, replacestring.length());
+
+ // Go back so that replacement string is also spellchecked
+ for (string::size_type i = 0; i < replacestring.length() + 1; ++i)
+ t->cursorLeft(*this, true);
+}
+
+
+void LCursor::update()
+{
+ bv().update();
+}
+
+
+string LCursor::getPossibleLabel()
+{
+ return inMathed() ? "eq:" : text()->getPossibleLabel(*this);
+}
+
+
+void LCursor::notdispatched()
+{
+ disp_.dispatched(false);
+}
+
+
+void LCursor::dispatched(dispatch_result_t res)
+{
+ disp_.val(res);
+}
+
+
+void LCursor::noupdate()
+{
+ disp_.update(false);