+
+
+bool InsetTabular::searchForward(BufferView * bv, string const & str,
+ bool cs, bool mw)
+{
+ nodraw(true);
+ if (the_locking_inset) {
+ if (the_locking_inset->searchForward(bv, str, cs, mw)) {
+ nodraw(false);
+ updateLocal(bv, CELL, false);
+ return true;
+ }
+ if (tabular->IsLastCell(actcell)) {
+ nodraw(false);
+ bv->unlockInset(const_cast<InsetTabular *>(this));
+ return false;
+ }
+ ++actcell;
+ }
+ // otherwise we have to lock the next inset and search there
+ UpdatableInset * inset =
+ static_cast<UpdatableInset*>(tabular->GetCellInset(actcell));
+ inset->edit(bv);
+ bool const ret = searchForward(bv, str, cs, mw);
+ nodraw(false);
+ updateLocal(bv, CELL, false);
+ return ret;
+}
+
+
+bool InsetTabular::searchBackward(BufferView * bv, string const & str,
+ bool cs, bool mw)
+{
+ nodraw(true);
+ if (the_locking_inset) {
+ if (the_locking_inset->searchBackward(bv, str, cs, mw)) {
+ nodraw(false);
+ updateLocal(bv, CELL, false);
+ return true;
+ }
+ if (!actcell) { // we are already in the first cell
+ nodraw(false);
+ bv->unlockInset(const_cast<InsetTabular *>(this));
+ return false;
+ }
+ --actcell;
+ }
+ // otherwise we have to lock the next inset and search there
+ UpdatableInset * inset =
+ static_cast<UpdatableInset*>(tabular->GetCellInset(actcell));
+ inset->edit(bv, false);
+ bool const ret = searchBackward(bv, str, cs, mw);
+ nodraw(false);
+ updateLocal(bv, CELL, false);
+ return ret;
+}
+
+
+bool InsetTabular::insetAllowed(Inset::Code code) const
+{
+ if (the_locking_inset)
+ return the_locking_inset->insetAllowed(code);
+ return false;
+}
+
+
+bool InsetTabular::forceDefaultParagraphs(Inset const * in) const
+{
+ const int cell = tabular->GetCellFromInset(in, actcell);
+
+ if (cell != -1)
+ return tabular->GetPWidth(cell).zero();
+
+ // well we didn't obviously find it so maybe our owner knows more
+ if (owner())
+ return owner()->forceDefaultParagraphs(in);
+ // if we're here there is really something strange going on!!!
+ return false;
+}