+
+int InsetCollapsable::latex(Buffer const * buf, ostream & os,
+ bool fragile, bool free_spc) const
+{
+ return inset.latex(buf, os, fragile, free_spc);
+}
+
+
+int InsetCollapsable::ascii(Buffer const * buf, ostream & os, int ll) const
+{
+ return inset.ascii(buf, os, ll);
+}
+
+
+int InsetCollapsable::linuxdoc(Buffer const * buf, ostream & os) const
+{
+ return inset.linuxdoc(buf, os);
+}
+
+
+int InsetCollapsable::docbook(Buffer const * buf, ostream & os) const
+{
+ return inset.docbook(buf, os);
+}
+
+#if 0
+int InsetCollapsable::getMaxWidth(BufferView * bv,
+ UpdatableInset const * in) const
+{
+#if 0
+ int const w = UpdatableInset::getMaxWidth(bv, in);
+
+ if (w < 0) {
+ // What does a negative max width signify? (Lgb)
+ // Use the max width of the draw-area (Jug)
+ return w;
+ }
+ // should be at least 30 pixels !!!
+ return max(30, w - width_collapsed());
+#else
+ return UpdatableInset::getMaxWidth(bv, in);
+#endif
+}
+#endif
+
+
+void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
+ bool reinit)
+{
+ if (in_update) {
+ if (reinit && owner()) {
+ owner()->update(bv, font, true);
+ }
+ return;
+ }
+ in_update = true;
+ inset.update(bv, font, reinit);
+ if (reinit && owner()) {
+ owner()->update(bv, font, true);
+ }
+ in_update = false;
+}
+
+
+UpdatableInset::RESULT
+InsetCollapsable::localDispatch(BufferView * bv, kb_action action,
+ string const & arg)
+{
+ UpdatableInset::RESULT result = inset.localDispatch(bv, action, arg);
+ if (result >= FINISHED)
+ bv->unlockInset(this);
+ first_after_edit = false;
+ return result;
+}
+
+
+bool InsetCollapsable::lockInsetInInset(BufferView * bv, UpdatableInset * in)
+{
+ if (&inset == in)
+ return true;
+ return inset.lockInsetInInset(bv, in);
+}
+
+
+bool InsetCollapsable::unlockInsetInInset(BufferView * bv, UpdatableInset * in,
+ bool lr)
+{
+ if (&inset == in) {
+ bv->unlockInset(this);
+ return true;
+ }
+ return inset.unlockInsetInInset(bv, in, lr);
+}
+
+
+bool InsetCollapsable::updateInsetInInset(BufferView * bv, Inset *in)
+{
+ if (in == this)
+ return true;
+ return inset.updateInsetInInset(bv, in);
+}
+
+
+unsigned int InsetCollapsable::insetInInsetY()
+{
+ return inset.insetInInsetY() - (top_baseline - inset.y());
+}
+
+
+void InsetCollapsable::validate(LaTeXFeatures & features) const
+{
+ inset.validate(features);
+}
+
+
+void InsetCollapsable::getCursorPos(BufferView * bv, int & x, int & y) const
+{
+ inset.getCursorPos(bv, x , y);
+}
+
+
+void InsetCollapsable::toggleInsetCursor(BufferView * bv)
+{
+ inset.toggleInsetCursor(bv);
+}
+
+
+void InsetCollapsable::showInsetCursor(BufferView * bv, bool show)
+{
+ inset.showInsetCursor(bv, show);
+}
+
+
+void InsetCollapsable::hideInsetCursor(BufferView * bv)
+{
+ inset.hideInsetCursor(bv);
+}
+
+
+UpdatableInset * InsetCollapsable::getLockingInset() const
+{
+ UpdatableInset * in = inset.getLockingInset();
+ if (const_cast<InsetText *>(&inset) == in)
+ return const_cast<InsetCollapsable *>(this);
+ return in;
+}
+
+
+UpdatableInset * InsetCollapsable::getFirstLockingInsetOfType(Inset::Code c)
+{
+ if (c == lyxCode())
+ return this;
+ return inset.getFirstLockingInsetOfType(c);
+}
+
+
+void InsetCollapsable::setFont(BufferView * bv, LyXFont const & font,
+ bool toggleall, bool selectall)
+{
+ inset.setFont(bv, font, toggleall, selectall);
+}
+
+
+bool InsetCollapsable::doClearArea() const
+{
+ return inset.doClearArea();
+}
+
+
+LyXText * InsetCollapsable::getLyXText(BufferView const * bv,
+ bool const recursive) const
+{
+ return inset.getLyXText(bv, recursive);
+}
+
+
+void InsetCollapsable::deleteLyXText(BufferView * bv, bool recursive) const
+{
+ inset.deleteLyXText(bv, recursive);
+}
+
+
+void InsetCollapsable::resizeLyXText(BufferView * bv, bool force) const
+{
+ inset.resizeLyXText(bv, force);
+ LyXFont font(LyXFont::ALL_SANE);
+ oldWidth = width(bv, font);
+}
+
+
+vector<string> const InsetCollapsable::getLabelList() const
+{
+ return inset.getLabelList();
+}
+
+
+bool InsetCollapsable::nodraw() const
+{
+ return inset.nodraw();
+}
+
+
+int InsetCollapsable::scroll(bool recursive) const
+{
+ int sx = UpdatableInset::scroll(false);
+
+ if (recursive)
+ sx += inset.scroll(recursive);
+
+ return sx;
+}
+
+
+Paragraph * InsetCollapsable::getParFromID(int id) const
+{
+ lyxerr[Debug::INFO] << "Looking for paragraph " << id << endl;
+ return inset.getParFromID(id);
+}
+
+
+Paragraph * InsetCollapsable::firstParagraph() const
+{
+ return inset.firstParagraph();
+}
+
+
+Paragraph * InsetCollapsable::getFirstParagraph(int i) const
+{
+ return inset.getFirstParagraph(i);
+}
+
+
+LyXCursor const & InsetCollapsable::cursor(BufferView * bv) const
+{
+ return inset.cursor(bv);
+}
+
+
+Inset * InsetCollapsable::getInsetFromID(int id_arg) const
+{
+ if (id_arg == id())
+ return const_cast<InsetCollapsable *>(this);
+ return inset.getInsetFromID(id_arg);
+}
+
+
+void InsetCollapsable::open(BufferView * bv)
+{
+ if (!collapsed_) return;
+
+ collapsed_ = false;
+ bv->updateInset(this, false);
+}
+
+
+void InsetCollapsable::close(BufferView * bv) const
+{
+ if (collapsed_)
+ return;
+
+ collapsed_ = true;
+ bv->updateInset(const_cast<InsetCollapsable *>(this), false);
+}
+
+
+void InsetCollapsable::setLabel(string const & l) const
+{
+ label = l;
+}
+
+
+bool InsetCollapsable::searchForward(BufferView * bv, string const & str,
+ bool cs, bool mw)
+{
+ bool found = inset.searchForward(bv, str, cs, mw);
+ if (first_after_edit && !found)
+ close(bv);
+ first_after_edit = false;
+ return found;
+}
+
+
+bool InsetCollapsable::searchBackward(BufferView * bv, string const & str,
+ bool cs, bool mw)
+{
+ bool found = inset.searchBackward(bv, str, cs, mw);
+ if (first_after_edit && !found)
+ close(bv);
+ first_after_edit = false;
+ return found;