2 * \file InsetCollapsable.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Alejandro Aguilar Sierra
8 * \author Lars Gullik Bjønnes
10 * Full author contact details are available in file CREDITS.
15 #include "InsetCollapsable.h"
18 #include "BufferParams.h"
19 #include "BufferView.h"
21 #include "Dimension.h"
22 #include "DispatchResult.h"
23 #include "FloatList.h"
24 #include "FuncRequest.h"
25 #include "FuncStatus.h"
26 #include "InsetLayout.h"
28 #include "LaTeXFeatures.h"
30 #include "MetricsInfo.h"
31 #include "output_xhtml.h"
32 #include "paragraph_funcs.h"
33 #include "ParagraphParameters.h"
35 #include "TextClass.h"
37 #include "frontends/FontMetrics.h"
38 #include "frontends/Painter.h"
40 #include "support/debug.h"
41 #include "support/docstream.h"
42 #include "support/gettext.h"
43 #include "support/lassert.h"
44 #include "support/lstrings.h"
51 InsetCollapsable::CollapseStatus InsetCollapsable::status(BufferView const & bv) const
53 if (decoration() == InsetLayout::CONGLOMERATE)
55 return auto_open_[&bv] ? Open : status_;
59 InsetCollapsable::Geometry InsetCollapsable::geometry(BufferView const & bv) const
61 switch (decoration()) {
62 case InsetLayout::CLASSIC:
63 if (status(bv) == Open)
64 return openinlined_ ? LeftButton : TopButton;
67 case InsetLayout::MINIMALISTIC:
68 return status(bv) == Open ? NoButton : ButtonOnly ;
70 case InsetLayout::CONGLOMERATE:
71 return status(bv) == Open ? SubLabel : Corners ;
73 case InsetLayout::DEFAULT:
74 break; // this shouldn't happen
77 // dummy return value to shut down a warning,
83 InsetCollapsable::Geometry InsetCollapsable::geometry() const
85 switch (decoration()) {
86 case InsetLayout::CLASSIC:
88 return openinlined_ ? LeftButton : TopButton;
91 case InsetLayout::MINIMALISTIC:
92 return status_ == Open ? NoButton : ButtonOnly ;
94 case InsetLayout::CONGLOMERATE:
95 return status_ == Open ? SubLabel : Corners ;
97 case InsetLayout::DEFAULT:
98 break; // this shouldn't happen
101 // dummy return value to shut down a warning,
102 // this is dead code.
107 InsetCollapsable::InsetCollapsable(Buffer const & buf, InsetText::UsePlain ltype)
108 : InsetText(buf, ltype), status_(Inset::Open),
109 openinlined_(false), mouse_hover_(false)
111 setLayout(&buf.params().documentClass());
112 setAutoBreakRows(true);
114 setFrameColor(Color_collapsableframe);
118 InsetCollapsable::InsetCollapsable(InsetCollapsable const & rhs)
120 status_(rhs.status_),
121 layout_(rhs.layout_),
122 labelstring_(rhs.labelstring_),
123 button_dim(rhs.button_dim),
124 openinlined_(rhs.openinlined_),
125 auto_open_(rhs.auto_open_),
126 // the sole purpose of this copy constructor
132 docstring InsetCollapsable::toolTip(BufferView const & bv, int x, int y) const
134 Dimension dim = dimensionCollapsed(bv);
135 if (geometry(bv) == NoButton)
136 return translateIfPossible(layout_->labelstring());
137 if (x > xo(bv) + dim.wid || y > yo(bv) + dim.des || isOpen(bv))
140 OutputParams rp(&buffer().params().encoding());
141 odocstringstream ods;
142 InsetText::plaintext(ods, rp);
143 docstring const content_tip = ods.str();
144 return support::wrapParas(content_tip, 4);
148 void InsetCollapsable::setLayout(BufferParams const & bp)
150 setLayout(bp.documentClassPtr());
154 void InsetCollapsable::setLayout(DocumentClass const * const dc)
157 layout_ = &(dc->insetLayout(name()));
158 labelstring_ = translateIfPossible(layout_->labelstring());
160 layout_ = &DocumentClass::plainInsetLayout();
161 labelstring_ = _("UNDEFINED");
168 void InsetCollapsable::write(ostream & os) const
180 text().write(buffer(), os);
184 void InsetCollapsable::read(Lexer & lex)
186 lex.setContext("InsetCollapsable::read");
189 lex >> "status" >> tmp_token;
190 if (tmp_token == "open")
193 // this must be set before we enter InsetText::read()
194 setLayout(buffer().params());
195 InsetText::read(lex);
196 // set button label again as the inset contents was not read yet at
200 // Force default font, if so requested
201 // This avoids paragraphs in buffer language that would have a
202 // foreign language after a document language change, and it ensures
203 // that all new text in ERT and similar gets the "latex" language,
204 // since new text inherits the language from the last position of the
205 // existing text. As a side effect this makes us also robust against
206 // bugs in LyX that might lead to font changes in ERT in .lyx files.
207 resetParagraphsFont();
211 Dimension InsetCollapsable::dimensionCollapsed(BufferView const & bv) const
213 LASSERT(layout_, /**/);
215 theFontMetrics(layout_->labelfont()).buttonText(
216 buttonLabel(bv), dim.wid, dim.asc, dim.des);
221 void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
223 LASSERT(layout_, /**/);
225 auto_open_[mi.base.bv] = mi.base.bv->cursor().isInside(this);
227 FontInfo tmpfont = mi.base.font;
228 mi.base.font = layout_->font();
229 mi.base.font.realize(tmpfont);
231 BufferView const & bv = *mi.base.bv;
233 switch (geometry(bv)) {
235 InsetText::metrics(mi, dim);
238 InsetText::metrics(mi, dim);
243 InsetText::metrics(mi, dim);
244 // consider width of the inset label
245 FontInfo font(layout_->labelfont());
246 font.realize(sane_font);
252 theFontMetrics(font).rectText(buttonLabel(bv), w, a, d);
259 dim = dimensionCollapsed(bv);
260 if (geometry(bv) == TopButton
261 || geometry(bv) == LeftButton) {
263 InsetText::metrics(mi, textdim);
264 openinlined_ = (textdim.wid + dim.wid) < mi.base.textwidth;
266 // Correct for button width.
267 dim.wid += textdim.wid;
268 dim.des = max(dim.des - textdim.asc + dim.asc, textdim.des);
269 dim.asc = textdim.asc;
271 dim.des += textdim.height() + TEXT_TO_INSET_OFFSET;
272 dim.wid = max(dim.wid, textdim.wid);
278 mi.base.font = tmpfont;
282 bool InsetCollapsable::setMouseHover(bool mouse_hover)
284 mouse_hover_ = mouse_hover;
289 void InsetCollapsable::draw(PainterInfo & pi, int x, int y) const
291 LASSERT(layout_, /**/);
292 BufferView const & bv = *pi.base.bv;
294 auto_open_[&bv] = bv.cursor().isInside(this);
296 FontInfo tmpfont = pi.base.font;
297 pi.base.font = layout_->font();
298 pi.base.font.realize(tmpfont);
300 // Draw button first -- top, left or only
301 Dimension dimc = dimensionCollapsed(bv);
303 if (geometry(*pi.base.bv) == TopButton ||
304 geometry(*pi.base.bv) == LeftButton ||
305 geometry(*pi.base.bv) == ButtonOnly) {
306 button_dim.x1 = x + 0;
307 button_dim.x2 = x + dimc.width();
308 button_dim.y1 = y - dimc.asc;
309 button_dim.y2 = y + dimc.des;
311 pi.pain.buttonText(x, y, buttonLabel(bv), layout_->labelfont(),
320 Dimension const textdim = InsetText::dimension(bv);
321 int const baseline = y;
323 switch (geometry(bv)) {
325 textx = x + dimc.width();
327 InsetText::draw(pi, textx, texty);
331 texty = baseline + dimc.des + textdim.asc;
332 InsetText::draw(pi, textx, texty);
339 InsetText::draw(pi, textx, texty);
345 const_cast<InsetCollapsable *>(this)->setDrawFrame(false);
346 InsetText::draw(pi, textx, texty);
347 const_cast<InsetCollapsable *>(this)->setDrawFrame(true);
349 int desc = textdim.descent();
350 if (geometry(bv) == Corners)
353 const int xx1 = x + TEXT_TO_INSET_OFFSET - 1;
354 const int xx2 = x + textdim.wid - TEXT_TO_INSET_OFFSET + 1;
355 pi.pain.line(xx1, y + desc - 4,
357 layout_->labelfont().color());
359 pi.pain.line(xx1, y + desc,
361 layout_->labelfont().color());
363 // Make status_ value visible:
364 pi.pain.line(xx1, y + desc,
366 layout_->labelfont().color());
367 pi.pain.line(xx2 - 4, y + desc,
369 layout_->labelfont().color());
371 pi.pain.line(x + textdim.wid - 3, y + desc, x + textdim.wid - 3,
372 y + desc - 4, layout_->labelfont().color());
374 // the label below the text. Can be toggled.
375 if (geometry(bv) == SubLabel) {
376 FontInfo font(layout_->labelfont());
377 font.realize(sane_font);
383 theFontMetrics(font).rectText(buttonLabel(bv), w, a, d);
384 int const ww = max(textdim.wid, w);
385 pi.pain.rectText(x + (ww - w) / 2, y + desc + a,
386 buttonLabel(bv), font, Color_none, Color_none);
390 // a visual cue when the cursor is inside the inset
391 Cursor const & cur = bv.cursor();
392 if (cur.isInside(this)) {
395 pi.pain.line(xx1, y + 4, xx1, y, layout_->labelfont().color());
396 pi.pain.line(xx1 + 4, y, xx1, y, layout_->labelfont().color());
397 pi.pain.line(xx2, y + 4, xx2, y,
398 layout_->labelfont().color());
399 pi.pain.line(xx2 - 4, y, xx2, y,
400 layout_->labelfont().color());
405 pi.base.font = tmpfont;
409 void InsetCollapsable::cursorPos(BufferView const & bv,
410 CursorSlice const & sl, bool boundary, int & x, int & y) const
412 if (geometry(bv) == ButtonOnly)
414 LASSERT(geometry(bv) != ButtonOnly, /**/);
416 InsetText::cursorPos(bv, sl, boundary, x, y);
417 Dimension const textdim = InsetText::dimension(bv);
419 switch (geometry(bv)) {
421 x += dimensionCollapsed(bv).wid;
424 y += dimensionCollapsed(bv).des + textdim.asc;
439 bool InsetCollapsable::editable() const
441 return geometry() != ButtonOnly;
445 bool InsetCollapsable::descendable() const
447 return geometry() != ButtonOnly;
451 bool InsetCollapsable::hitButton(FuncRequest const & cmd) const
453 return button_dim.contains(cmd.x, cmd.y);
457 docstring const InsetCollapsable::getNewLabel(docstring const & l) const
460 pos_type const max_length = 15;
461 pos_type const p_siz = paragraphs().begin()->size();
462 pos_type const n = min(max_length, p_siz);
465 for (; i < n && j < p_siz; ++j) {
466 if (paragraphs().begin()->isInset(j))
468 label += paragraphs().begin()->getChar(j);
471 if (paragraphs().size() > 1 || (i > 0 && j < p_siz)) {
474 return label.empty() ? l : label;
478 void InsetCollapsable::edit(Cursor & cur, bool front, EntryDirection entry_from)
480 //lyxerr << "InsetCollapsable: edit left/right" << endl;
482 InsetText::edit(cur, front, entry_from);
486 Inset * InsetCollapsable::editXY(Cursor & cur, int x, int y)
488 //lyxerr << "InsetCollapsable: edit xy" << endl;
489 if (geometry(cur.bv()) == ButtonOnly
490 || (button_dim.contains(x, y)
491 && geometry(cur.bv()) != NoButton))
494 return InsetText::editXY(cur, x, y);
498 void InsetCollapsable::doDispatch(Cursor & cur, FuncRequest & cmd)
500 //lyxerr << "InsetCollapsable::doDispatch (begin): cmd: " << cmd
501 // << " cur: " << cur << " bvcur: " << cur.bv().cursor() << endl;
503 switch (cmd.action) {
504 case LFUN_MOUSE_PRESS:
505 if (hitButton(cmd)) {
506 switch (cmd.button()) {
507 case mouse_button::button1:
508 case mouse_button::button3:
509 // Pass the command to the enclosing InsetText,
510 // so that the cursor gets set.
513 case mouse_button::none:
514 case mouse_button::button2:
515 case mouse_button::button4:
516 case mouse_button::button5:
521 } else if (geometry(cur.bv()) != ButtonOnly)
522 InsetText::doDispatch(cur, cmd);
527 case LFUN_MOUSE_MOTION:
528 case LFUN_MOUSE_DOUBLE:
529 case LFUN_MOUSE_TRIPLE:
532 else if (geometry(cur.bv()) != ButtonOnly)
533 InsetText::doDispatch(cur, cmd);
538 case LFUN_MOUSE_RELEASE:
539 if (!hitButton(cmd)) {
540 // The mouse click has to be within the inset!
541 if (geometry(cur.bv()) != ButtonOnly)
542 InsetText::doDispatch(cur, cmd);
547 if (cmd.button() != mouse_button::button1) {
552 // if we are selecting, we do not want to
556 // Left button is clicked, the user asks to
557 // toggle the inset visual state.
559 cur.updateFlags(Update::Force | Update::FitCursor);
560 if (geometry(cur.bv()) == ButtonOnly) {
561 setStatus(cur, Open);
565 setStatus(cur, Collapsed);
566 cur.bv().cursor() = cur;
569 case LFUN_INSET_TOGGLE:
570 if (cmd.argument() == "open")
571 setStatus(cur, Open);
572 else if (cmd.argument() == "close")
573 setStatus(cur, Collapsed);
574 else if (cmd.argument() == "toggle" || cmd.argument().empty())
575 if (status_ == Open) {
576 setStatus(cur, Collapsed);
577 if (geometry(cur.bv()) == ButtonOnly)
578 cur.top().forwardPos();
580 setStatus(cur, Open);
581 else // if assign or anything else
587 case LFUN_CLIPBOARD_PASTE:
588 case LFUN_SELECTION_PASTE:
589 case LFUN_PRIMARY_SELECTION_PASTE: {
590 InsetText::doDispatch(cur, cmd);
591 // Since we can only store plain text, we must reset all
593 // FIXME: Change only the pasted paragraphs
595 resetParagraphsFont();
600 if (layout_ && layout_->isForceLtr()) {
601 // Force any new text to latex_language
602 // FIXME: This should only be necessary in constructor, but
603 // new paragraphs that are created by pressing enter at the
604 // start of an existing paragraph get the buffer language
605 // and not latex_language, so we take this brute force
607 cur.current_font.setLanguage(latex_language);
608 cur.real_current_font.setLanguage(latex_language);
610 InsetText::doDispatch(cur, cmd);
616 bool InsetCollapsable::allowMultiPar() const
618 return layout_->isMultiPar();
622 void InsetCollapsable::resetParagraphsFont()
624 Font font(inherit_font, buffer().params().language);
625 if (layout_->isForceLtr())
626 font.setLanguage(latex_language);
627 if (layout_->isPassThru()) {
628 ParagraphList::iterator par = paragraphs().begin();
629 ParagraphList::iterator const end = paragraphs().end();
631 par->resetFonts(font);
632 par->params().clear();
639 bool InsetCollapsable::getStatus(Cursor & cur, FuncRequest const & cmd,
640 FuncStatus & flag) const
642 switch (cmd.action) {
643 // FIXME At present, these are being enabled and disabled according to
644 // whether PASSTHRU has been set in the InsetLayout. This makes some
645 // sense, but there are other checks that should really be done. E.g.,
646 // one should not be able to inset IndexPrint inside an optional argument!!
647 case LFUN_ACCENT_ACUTE:
648 case LFUN_ACCENT_BREVE:
649 case LFUN_ACCENT_CARON:
650 case LFUN_ACCENT_CEDILLA:
651 case LFUN_ACCENT_CIRCLE:
652 case LFUN_ACCENT_CIRCUMFLEX:
653 case LFUN_ACCENT_DOT:
654 case LFUN_ACCENT_GRAVE:
655 case LFUN_ACCENT_HUNGARIAN_UMLAUT:
656 case LFUN_ACCENT_MACRON:
657 case LFUN_ACCENT_OGONEK:
658 case LFUN_ACCENT_TIE:
659 case LFUN_ACCENT_TILDE:
660 case LFUN_ACCENT_UMLAUT:
661 case LFUN_ACCENT_UNDERBAR:
662 case LFUN_ACCENT_UNDERDOT:
664 case LFUN_BOX_INSERT:
665 case LFUN_BRANCH_INSERT:
666 case LFUN_CAPTION_INSERT:
667 case LFUN_DEPTH_DECREMENT:
668 case LFUN_DEPTH_INCREMENT:
669 case LFUN_ERT_INSERT:
670 case LFUN_FILE_INSERT:
671 case LFUN_FLEX_INSERT:
672 case LFUN_FLOAT_INSERT:
673 case LFUN_FLOAT_LIST_INSERT:
674 case LFUN_FLOAT_WIDE_INSERT:
676 case LFUN_FONT_BOLDSYMBOL:
677 case LFUN_FONT_TYPEWRITER:
678 case LFUN_FONT_DEFAULT:
681 case LFUN_FONT_ROMAN:
686 case LFUN_FONT_STATE:
687 case LFUN_FONT_UNDERLINE:
688 case LFUN_FONT_STRIKEOUT:
689 case LFUN_FONT_UULINE:
690 case LFUN_FONT_UWAVE:
691 case LFUN_FOOTNOTE_INSERT:
692 case LFUN_HYPERLINK_INSERT:
693 case LFUN_INDEX_INSERT:
694 case LFUN_INDEX_PRINT:
695 case LFUN_INSET_INSERT:
696 case LFUN_LABEL_GOTO:
697 case LFUN_LABEL_INSERT:
698 case LFUN_LAYOUT_TABULAR:
699 case LFUN_LINE_INSERT:
700 case LFUN_MARGINALNOTE_INSERT:
701 case LFUN_MATH_DISPLAY:
702 case LFUN_MATH_INSERT:
703 case LFUN_MATH_MATRIX:
706 case LFUN_NEWLINE_INSERT:
707 case LFUN_NEWPAGE_INSERT:
709 case LFUN_NOMENCL_INSERT:
710 case LFUN_NOMENCL_PRINT:
711 case LFUN_NOTE_INSERT:
713 case LFUN_OPTIONAL_INSERT:
714 case LFUN_PHANTOM_INSERT:
715 case LFUN_REFERENCE_NEXT:
716 case LFUN_SERVER_GOTO_FILE_ROW:
717 case LFUN_SERVER_NOTIFY:
718 case LFUN_SERVER_SET_XY:
719 case LFUN_SPACE_INSERT:
720 case LFUN_SPECIALCHAR_INSERT:
721 case LFUN_TABULAR_INSERT:
722 case LFUN_TEXTSTYLE_APPLY:
723 case LFUN_TEXTSTYLE_UPDATE:
724 case LFUN_TOC_INSERT:
725 case LFUN_WRAP_INSERT:
726 if (layout_->isPassThru()) {
727 flag.setEnabled(false);
730 return InsetText::getStatus(cur, cmd, flag);
732 case LFUN_INSET_TOGGLE:
733 if (cmd.argument() == "open")
734 flag.setEnabled(status_ != Open);
735 else if (cmd.argument() == "close")
736 flag.setEnabled(status_ == Open);
737 else if (cmd.argument() == "toggle" || cmd.argument().empty()) {
738 flag.setEnabled(true);
739 flag.setOnOff(status_ == Open);
741 flag.setEnabled(false);
745 flag.setEnabled(!layout_->isForceLtr());
746 return InsetText::getStatus(cur, cmd, flag);
748 case LFUN_BREAK_PARAGRAPH:
749 flag.setEnabled(layout_->isMultiPar());
753 return InsetText::getStatus(cur, cmd, flag);
758 void InsetCollapsable::setLabel(docstring const & l)
764 void InsetCollapsable::setStatus(Cursor & cur, CollapseStatus status)
768 if (status_ == Collapsed) {
769 cur.leaveInset(*this);
770 mouse_hover_ = false;
775 docstring InsetCollapsable::floatName(
776 string const & type, BufferParams const & bp) const
778 FloatList const & floats = bp.documentClass().floats();
779 FloatList::const_iterator it = floats[type];
781 return (it == floats.end()) ? from_ascii(type) : bp.B_(it->second.name());
785 InsetLayout::InsetDecoration InsetCollapsable::decoration() const
788 return InsetLayout::CLASSIC;
789 InsetLayout::InsetDecoration const dec = layout_->decoration();
791 case InsetLayout::CLASSIC:
792 case InsetLayout::MINIMALISTIC:
793 case InsetLayout::CONGLOMERATE:
795 case InsetLayout::DEFAULT:
798 if (lyxCode() == FLEX_CODE)
799 return InsetLayout::CONGLOMERATE;
800 return InsetLayout::CLASSIC;
804 int InsetCollapsable::latex(odocstream & os,
805 OutputParams const & runparams) const
807 // FIXME: What should we do layout_ is 0?
813 // This implements the standard way of handling the LaTeX output of
814 // a collapsable inset, either a command or an environment. Standard
815 // collapsable insets should not redefine this, non-standard ones may
817 if (!layout_->latexname().empty()) {
818 if (layout_->latextype() == InsetLayout::COMMAND) {
820 if (runparams.moving_arg)
822 os << '\\' << from_utf8(layout_->latexname());
823 if (!layout_->latexparam().empty())
824 os << from_utf8(layout_->latexparam());
826 } else if (layout_->latextype() == InsetLayout::ENVIRONMENT) {
827 os << "%\n\\begin{" << from_utf8(layout_->latexname()) << "}\n";
828 if (!layout_->latexparam().empty())
829 os << from_utf8(layout_->latexparam());
832 OutputParams rp = runparams;
833 if (layout_->isPassThru())
835 if (layout_->isNeedProtect())
836 rp.moving_arg = true;
837 int i = InsetText::latex(os, rp);
838 if (!layout_->latexname().empty()) {
839 if (layout_->latextype() == InsetLayout::COMMAND) {
841 } else if (layout_->latextype() == InsetLayout::ENVIRONMENT) {
842 os << "\n\\end{" << from_utf8(layout_->latexname()) << "}\n";
850 // FIXME It seems as if it ought to be possible to do this more simply,
851 // maybe by calling InsetText::docbook() in the middle there.
852 int InsetCollapsable::docbook(odocstream & os, OutputParams const & runparams) const
854 ParagraphList::const_iterator const beg = paragraphs().begin();
855 ParagraphList::const_iterator par = paragraphs().begin();
856 ParagraphList::const_iterator const end = paragraphs().end();
859 sgml::openTag(os, getLayout().latexname(),
860 par->getID(buffer(), runparams) + getLayout().latexparam());
862 for (; par != end; ++par) {
863 par->simpleDocBookOnePar(buffer(), os, runparams,
864 outerFont(distance(beg, par),
869 sgml::closeTag(os, getLayout().latexname());
875 int InsetCollapsable::xhtml(odocstream & os, OutputParams const & runparams) const
877 InsetLayout const & il = getLayout();
879 return InsetText::xhtml(os, runparams);
881 bool const opened = html::openTag(os, il.htmltag(), il.htmlattr());
882 if (!il.counter().empty()) {
883 // FIXME Master buffer?
884 Counters & cntrs = buffer().params().documentClass().counters();
885 cntrs.step(il.counter());
886 if (!il.htmllabel().empty())
887 os << cntrs.counterLabel(translateIfPossible(from_ascii(il.htmllabel())));
889 bool innertag_opened = false;
890 if (!il.htmlinnertag().empty())
891 innertag_opened = html::openTag(os, il.htmlinnertag(), il.htmlinnerattr());
892 InsetText::xhtml(os, runparams);
894 html::closeTag(os, il.htmlinnertag());
896 html::closeTag(os, il.htmltag());
901 void InsetCollapsable::validate(LaTeXFeatures & features) const
903 features.useInsetLayout(getLayout());
904 InsetText::validate(features);
908 bool InsetCollapsable::undefined() const
910 docstring const & n = getLayout().name();
911 return n.empty() || n == DocumentClass::plainInsetLayout().name();
915 docstring InsetCollapsable::contextMenu(BufferView const & bv, int x,
918 if (decoration() == InsetLayout::CONGLOMERATE)
919 return from_ascii("context-conglomerate");
921 if (geometry(bv) == NoButton)
922 return from_ascii("context-collapsable");
924 Dimension dim = dimensionCollapsed(bv);
925 if (x < xo(bv) + dim.wid && y < yo(bv) + dim.des)
926 return from_ascii("context-collapsable");
928 return InsetText::contextMenu(bv, x, y);
931 void InsetCollapsable::tocString(odocstream & os) const
933 if (!getLayout().isInToc())
935 os << text().asString(0, 1, AS_STR_LABEL | AS_STR_INSETS);