2 * \file CutAndPaste.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Alfredo Braunstein
11 * Full author contact details are available in file CREDITS.
16 #include "CutAndPaste.h"
19 #include "buffer_funcs.h"
20 #include "BufferParams.h"
21 #include "BufferView.h"
24 #include "ErrorList.h"
25 #include "FuncRequest.h"
26 #include "InsetIterator.h"
27 #include "InsetList.h"
33 #include "TextClassList.h"
34 #include "Paragraph.h"
35 #include "paragraph_funcs.h"
36 #include "ParagraphParameters.h"
37 #include "ParIterator.h"
40 #include "insets/InsetFlex.h"
41 #include "insets/InsetTabular.h"
43 #include "mathed/MathData.h"
44 #include "mathed/InsetMath.h"
45 #include "mathed/MathSupport.h"
47 #include "support/debug.h"
48 #include "support/docstream.h"
49 #include "support/gettext.h"
50 #include "support/limited_stack.h"
51 #include "support/lstrings.h"
53 #include "frontends/Clipboard.h"
54 #include "frontends/Selection.h"
56 #include <boost/tuple/tuple.hpp>
57 #include <boost/next_prior.hpp>
62 using namespace lyx::support;
68 typedef pair<pit_type, int> PitPosPair;
70 typedef limited_stack<pair<ParagraphList, TextClassPtr> > CutStack;
73 // persistent selection, cleared until the next selection
74 CutStack selectionBuffer(1);
76 // store whether the tabular stack is newer than the normal copy stack
77 // FIXME: this is a workaround for bug 1919. Should be removed for 1.5,
78 // when we (hopefully) have a one-for-all paste mechanism.
79 bool dirty_tabular_stack_ = false;
82 void region(CursorSlice const & i1, CursorSlice const & i2,
83 Inset::row_type & r1, Inset::row_type & r2,
84 Inset::col_type & c1, Inset::col_type & c2)
86 Inset & p = i1.inset();
98 bool checkPastePossible(int index)
100 return size_t(index) < theCuts.size() && !theCuts[index].first.empty();
104 pair<PitPosPair, pit_type>
105 pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
106 TextClassPtr textclass, ErrorList & errorlist)
108 Buffer const & buffer = cur.buffer();
109 pit_type pit = cur.pit();
110 pos_type pos = cur.pos();
111 ParagraphList & pars = cur.text()->paragraphs();
114 return make_pair(PitPosPair(pit, pos), pit);
116 BOOST_ASSERT (pos <= pars[pit].size());
118 // Make a copy of the CaP paragraphs.
119 ParagraphList insertion = parlist;
120 TextClassPtr const tc = buffer.params().getTextClassPtr();
122 // Now remove all out of the pars which is NOT allowed in the
123 // new environment and set also another font if that is required.
125 // Convert newline to paragraph break in ERT inset.
126 // This should not be here!
127 if (pars[pit].inInset() &&
128 (pars[pit].inInset()->lyxCode() == ERT_CODE ||
129 pars[pit].inInset()->lyxCode() == LISTINGS_CODE)) {
130 for (ParagraphList::size_type i = 0; i < insertion.size(); ++i) {
131 for (pos_type j = 0; j < insertion[i].size(); ++j) {
132 if (insertion[i].isNewline(j)) {
133 // do not track deletion of newline
134 insertion[i].eraseChar(j, false);
135 breakParagraphConservative(
143 // If we are in an inset which returns forceDefaultParagraphs,
144 // set the paragraphs to default
145 if (cur.inset().forceDefaultParagraphs(cur.idx())) {
146 LayoutPtr const layout =
147 buffer.params().getTextClass().defaultLayout();
148 ParagraphList::iterator const end = insertion.end();
149 for (ParagraphList::iterator par = insertion.begin();
154 // Make sure there is no class difference.
156 // This works without copying any paragraph data because we have
157 // a specialized swap method for ParagraphList. This is important
158 // since we store pointers to insets at some places and we don't
159 // want to invalidate them.
160 insertion.swap(in.paragraphs());
161 cap::switchBetweenClasses(textclass, tc, in, errorlist);
162 insertion.swap(in.paragraphs());
164 ParagraphList::iterator tmpbuf = insertion.begin();
165 int depth_delta = pars[pit].params().depth() - tmpbuf->params().depth();
167 depth_type max_depth = pars[pit].getMaxDepthAfter();
169 for (; tmpbuf != insertion.end(); ++tmpbuf) {
170 // If we have a negative jump so that the depth would
171 // go below 0 depth then we have to redo the delta to
172 // this new max depth level so that subsequent
173 // paragraphs are aligned correctly to this paragraph
175 if (int(tmpbuf->params().depth()) + depth_delta < 0)
178 // Set the right depth so that we are not too deep or shallow.
179 tmpbuf->params().depth(tmpbuf->params().depth() + depth_delta);
180 if (tmpbuf->params().depth() > max_depth)
181 tmpbuf->params().depth(max_depth);
183 // Only set this from the 2nd on as the 2nd depends
184 // for maxDepth still on pit.
185 if (tmpbuf != insertion.begin())
186 max_depth = tmpbuf->getMaxDepthAfter();
188 // Set the inset owner of this paragraph.
189 tmpbuf->setInsetOwner(pars[pit].inInset());
190 for (pos_type i = 0; i < tmpbuf->size(); ++i) {
191 if (tmpbuf->isInset(i) &&
192 !pars[pit].insetAllowed(tmpbuf->getInset(i)->lyxCode()))
193 // do not track deletion of invalid insets
194 tmpbuf->eraseChar(i--, false);
197 tmpbuf->setChange(Change(buffer.params().trackChanges ?
198 Change::INSERTED : Change::UNCHANGED));
201 bool const empty = pars[pit].empty();
203 // Make the buf exactly the same layout as the cursor
205 insertion.begin()->makeSameLayout(pars[pit]);
208 // Prepare the paragraphs and insets for insertion.
209 // A couple of insets store buffer references so need updating.
210 insertion.swap(in.paragraphs());
212 ParIterator fpit = par_iterator_begin(in);
213 ParIterator fend = par_iterator_end(in);
215 for (; fpit != fend; ++fpit) {
216 InsetList::const_iterator lit = fpit->insetList().begin();
217 InsetList::const_iterator eit = fpit->insetList().end();
219 for (; lit != eit; ++lit) {
220 switch (lit->inset->lyxCode()) {
222 InsetTabular * it = static_cast<InsetTabular*>(lit->inset);
232 insertion.swap(in.paragraphs());
234 // Split the paragraph for inserting the buf if necessary.
236 breakParagraphConservative(buffer.params(), pars, pit, pos);
240 pars.insert(boost::next(pars.begin(), pit),
244 // merge the empty par with the last par of the insertion
245 mergeParagraph(buffer.params(), pars,
246 pit + insertion.size() - 1);
248 pars.insert(boost::next(pars.begin(), pit + 1),
252 // merge the first par of the insertion with the current par
253 mergeParagraph(buffer.params(), pars, pit);
256 pit_type last_paste = pit + insertion.size() - 1;
258 // Store the new cursor position.
260 pos = pars[last_paste].size();
262 // Join (conditionally) last pasted paragraph with next one, i.e.,
263 // the tail of the spliced document paragraph
264 if (!empty && last_paste + 1 != pit_type(pars.size())) {
265 if (pars[last_paste + 1].hasSameLayout(pars[last_paste])) {
266 mergeParagraph(buffer.params(), pars, last_paste);
267 } else if (pars[last_paste + 1].empty()) {
268 pars[last_paste + 1].makeSameLayout(pars[last_paste]);
269 mergeParagraph(buffer.params(), pars, last_paste);
270 } else if (pars[last_paste].empty()) {
271 pars[last_paste].makeSameLayout(pars[last_paste + 1]);
272 mergeParagraph(buffer.params(), pars, last_paste);
274 pars[last_paste + 1].stripLeadingSpaces(buffer.params().trackChanges);
279 return make_pair(PitPosPair(pit, pos), last_paste + 1);
283 PitPosPair eraseSelectionHelper(BufferParams const & params,
284 ParagraphList & pars,
285 pit_type startpit, pit_type endpit,
286 int startpos, int endpos)
288 // Start of selection is really invalid.
289 if (startpit == pit_type(pars.size()) ||
290 (startpos > pars[startpit].size()))
291 return PitPosPair(endpit, endpos);
293 // Start and end is inside same paragraph
294 if (endpit == pit_type(pars.size()) || startpit == endpit) {
295 endpos -= pars[startpit].eraseChars(startpos, endpos, params.trackChanges);
296 return PitPosPair(endpit, endpos);
299 for (pit_type pit = startpit; pit != endpit + 1;) {
300 pos_type const left = (pit == startpit ? startpos : 0);
301 pos_type right = (pit == endpit ? endpos : pars[pit].size() + 1);
302 bool const merge = pars[pit].isMergedOnEndOfParDeletion(params.trackChanges);
304 // Logically erase only, including the end-of-paragraph character
305 pars[pit].eraseChars(left, right, params.trackChanges);
307 // Separate handling of paragraph break:
308 if (merge && pit != endpit &&
309 (pit + 1 != endpit || pars[pit].hasSameLayout(pars[endpit]))) {
310 if (pit + 1 == endpit)
311 endpos += pars[pit].size();
312 mergeParagraph(params, pars, pit);
318 // Ensure legal cursor pos:
321 return PitPosPair(endpit, endpos);
325 void putClipboard(ParagraphList const & paragraphs, TextClassPtr textclass,
326 docstring const & plaintext)
328 // For some strange reason gcc 3.2 and 3.3 do not accept
329 // Buffer buffer(string(), false);
330 Buffer buffer("", false);
331 buffer.setUnnamed(true);
332 buffer.paragraphs() = paragraphs;
333 buffer.params().setTextClass(textclass);
335 if (buffer.write(lyx))
336 theClipboard().put(lyx.str(), plaintext);
338 theClipboard().put(string(), plaintext);
342 void copySelectionHelper(Buffer const & buf, ParagraphList & pars,
343 pit_type startpit, pit_type endpit,
344 int start, int end, TextClassPtr tc, CutStack & cutstack)
346 BOOST_ASSERT(0 <= start && start <= pars[startpit].size());
347 BOOST_ASSERT(0 <= end && end <= pars[endpit].size());
348 BOOST_ASSERT(startpit != endpit || start <= end);
350 // Clone the paragraphs within the selection.
351 ParagraphList copy_pars(boost::next(pars.begin(), startpit),
352 boost::next(pars.begin(), endpit + 1));
354 // Remove the end of the last paragraph; afterwards, remove the
355 // beginning of the first paragraph. Keep this order - there may only
356 // be one paragraph! Do not track deletions here; this is an internal
357 // action not visible to the user
359 Paragraph & back = copy_pars.back();
360 back.eraseChars(end, back.size(), false);
361 Paragraph & front = copy_pars.front();
362 front.eraseChars(0, start, false);
364 ParagraphList::iterator it = copy_pars.begin();
365 ParagraphList::iterator it_end = copy_pars.end();
367 for (; it != it_end; it++) {
368 // ERT paragraphs have the Language latex_language.
369 // This is invalid outside of ERT, so we need to change it
370 // to the buffer language.
371 if (it->ownerCode() == ERT_CODE || it->ownerCode() == LISTINGS_CODE) {
372 it->changeLanguage(buf.params(), latex_language, buf.language());
374 it->setInsetOwner(0);
377 // do not copy text (also nested in insets) which is marked as deleted
378 acceptChanges(copy_pars, buf.params());
380 cutstack.push(make_pair(copy_pars, tc));
390 docstring grabAndEraseSelection(Cursor & cur)
392 if (!cur.selection())
394 docstring res = grabSelection(cur);
400 void switchBetweenClasses(TextClassPtr const & c1,
401 TextClassPtr const & c2, InsetText & in, ErrorList & errorlist)
405 BOOST_ASSERT(!in.paragraphs().empty());
409 TextClass const & tclass1 = *c1;
410 TextClass const & tclass2 = *c2;
413 ParIterator end = par_iterator_end(in);
414 for (ParIterator it = par_iterator_begin(in); it != end; ++it) {
415 docstring const name = it->layout()->name();
416 bool hasLayout = tclass2.hasLayout(name);
419 it->layout(tclass2[name]);
421 it->layout(tclass2.defaultLayout());
423 if (!hasLayout && name != tclass1.defaultLayoutName()) {
424 docstring const s = bformat(
425 _("Layout had to be changed from\n%1$s to %2$s\n"
426 "because of class conversion from\n%3$s to %4$s"),
427 name, it->layout()->name(),
428 from_utf8(tclass1.name()), from_utf8(tclass2.name()));
429 // To warn the user that something had to be done.
430 errorlist.push_back(ErrorItem(_("Changed Layout"), s,
437 InsetIterator const i_end = inset_iterator_end(in);
438 for (InsetIterator it = inset_iterator_begin(in); it != i_end; ++it) {
439 InsetCollapsable * inset = it->asInsetCollapsable();
442 if (inset->lyxCode() != FLEX_CODE)
443 // FIXME: Should we verify all InsetCollapsable?
445 docstring const name = inset->name();
446 InsetLayout const & il = tclass2.insetlayout(name);
447 inset->setLayout(il);
448 if (il.labelstring != from_utf8("UNDEFINED"))
450 // The flex inset is undefined in tclass2
451 docstring const s = bformat(_(
452 "Flex inset %1$s is "
453 "undefined because of class "
454 "conversion from\n%2$s to %3$s"),
455 name, from_utf8(tclass1.name()),
456 from_utf8(tclass2.name()));
457 // To warn the user that something had to be done.
458 errorlist.push_back(ErrorItem(
459 _("Undefined flex inset"),
460 s, it.paragraph().id(), it.pos(), it.pos() + 1));
465 vector<docstring> const availableSelections(Buffer const & buffer)
467 vector<docstring> selList;
469 CutStack::const_iterator cit = theCuts.begin();
470 CutStack::const_iterator end = theCuts.end();
471 for (; cit != end; ++cit) {
472 // we do not use cit-> here because gcc 2.9x does not
474 ParagraphList const & pars = (*cit).first;
476 ParagraphList::const_iterator pit = pars.begin();
477 ParagraphList::const_iterator pend = pars.end();
478 for (; pit != pend; ++pit) {
479 asciiSel += pit->asString(buffer, false);
480 if (asciiSel.size() > 25) {
481 asciiSel.replace(22, docstring::npos,
487 selList.push_back(asciiSel);
494 size_type numberOfSelections()
496 return theCuts.size();
500 void cutSelection(Cursor & cur, bool doclear, bool realcut)
502 // This doesn't make sense, if there is no selection
503 if (!cur.selection())
506 // OK, we have a selection. This is always between cur.selBegin()
509 if (cur.inTexted()) {
510 Text * text = cur.text();
515 // make sure that the depth behind the selection are restored, too
516 cur.recordUndoSelection();
517 pit_type begpit = cur.selBegin().pit();
518 pit_type endpit = cur.selEnd().pit();
520 int endpos = cur.selEnd().pos();
522 BufferParams const & bp = cur.buffer().params();
524 copySelectionHelper(cur.buffer(),
527 cur.selBegin().pos(), endpos,
528 bp.getTextClassPtr(), theCuts);
529 // Stuff what we got on the clipboard.
530 // Even if there is no selection.
531 putClipboard(theCuts[0].first, theCuts[0].second,
532 cur.selectionAsString(true));
535 boost::tie(endpit, endpos) =
536 eraseSelectionHelper(bp,
539 cur.selBegin().pos(), endpos);
541 // cutSelection can invalidate the cursor so we need to set
543 // we prefer the end for when tracking changes
547 // sometimes necessary
549 && text->paragraphs()[begpit].stripLeadingSpaces(bp.trackChanges))
552 // need a valid cursor. (Lgb)
553 cur.clearSelection();
554 updateLabels(cur.buffer());
556 // tell tabular that a recent copy happened
557 dirtyTabularStack(false);
560 if (cur.inMathed()) {
561 if (cur.selBegin().idx() != cur.selEnd().idx()) {
562 // The current selection spans more than one cell.
564 cur.recordUndoInset();
566 // Record only the current cell to avoid a jumping
577 void copySelection(Cursor & cur)
579 copySelection(cur, cur.selectionAsString(true));
585 void copySelectionToStack(Cursor & cur, CutStack & cutstack)
587 // this doesn't make sense, if there is no selection
588 if (!cur.selection())
591 // copySelection can not yet handle the case of cross idx selection
592 if (cur.selBegin().idx() != cur.selEnd().idx())
595 if (cur.inTexted()) {
596 Text * text = cur.text();
598 // ok we have a selection. This is always between cur.selBegin()
599 // and sel_end cursor
601 // copy behind a space if there is one
602 ParagraphList & pars = text->paragraphs();
603 pos_type pos = cur.selBegin().pos();
604 pit_type par = cur.selBegin().pit();
605 while (pos < pars[par].size() &&
606 pars[par].isLineSeparator(pos) &&
607 (par != cur.selEnd().pit() || pos < cur.selEnd().pos()))
610 copySelectionHelper(cur.buffer(), pars, par, cur.selEnd().pit(),
611 pos, cur.selEnd().pos(),
612 cur.buffer().params().getTextClassPtr(), cutstack);
613 dirtyTabularStack(false);
616 if (cur.inMathed()) {
617 //lyxerr << "copySelection in mathed" << endl;
620 BufferParams const & bp = cur.buffer().params();
621 par.layout(bp.getTextClass().defaultLayout());
622 par.insert(0, grabSelection(cur), Font(), Change(Change::UNCHANGED));
624 cutstack.push(make_pair(pars, bp.getTextClassPtr()));
631 void copySelectionToStack()
633 if (!selectionBuffer.empty())
634 theCuts.push(selectionBuffer[0]);
638 void copySelection(Cursor & cur, docstring const & plaintext)
640 // In tablemode, because copy and paste actually use special table stack
641 // we do not attempt to get selected paragraphs under cursor. Instead, a
642 // paragraph with the plain text version is generated so that table cells
643 // can be pasted as pure text somewhere else.
644 if (cur.selBegin().idx() != cur.selEnd().idx()) {
647 BufferParams const & bp = cur.buffer().params();
648 par.layout(bp.getTextClass().defaultLayout());
649 par.insert(0, plaintext, Font(), Change(Change::UNCHANGED));
651 theCuts.push(make_pair(pars, bp.getTextClassPtr()));
653 copySelectionToStack(cur, theCuts);
656 // stuff the selection onto the X clipboard, from an explicit copy request
657 putClipboard(theCuts[0].first, theCuts[0].second, plaintext);
661 void saveSelection(Cursor & cur)
663 // This function is called, not when a selection is formed, but when
664 // a selection is cleared. Therefore, multiple keyboard selection
665 // will not repeatively trigger this function (bug 3877).
667 && cur.selBegin() == cur.bv().cursor().selBegin()
668 && cur.selEnd() == cur.bv().cursor().selEnd()) {
669 LYXERR(Debug::ACTION, "'" << cur.selectionAsString(true) << "'");
670 copySelectionToStack(cur, selectionBuffer);
677 return !selectionBuffer.empty();
681 void clearSelection()
683 selectionBuffer.clear();
693 docstring getSelection(Buffer const & buf, size_t sel_index)
695 return sel_index < theCuts.size()
696 ? theCuts[sel_index].first.back().asString(buf, false)
701 void pasteParagraphList(Cursor & cur, ParagraphList const & parlist,
702 TextClassPtr textclass, ErrorList & errorList)
704 if (cur.inTexted()) {
705 Text * text = cur.text();
711 boost::tie(ppp, endpit) =
712 pasteSelectionHelper(cur, parlist,
713 textclass, errorList);
714 updateLabels(cur.buffer());
715 cur.clearSelection();
716 text->setCursor(cur, ppp.first, ppp.second);
719 // mathed is handled in InsetMathNest/InsetMathGrid
720 BOOST_ASSERT(!cur.inMathed());
724 void pasteFromStack(Cursor & cur, ErrorList & errorList, size_t sel_index)
726 // this does not make sense, if there is nothing to paste
727 if (!checkPastePossible(sel_index))
731 pasteParagraphList(cur, theCuts[sel_index].first,
732 theCuts[sel_index].second, errorList);
737 void pasteClipboard(Cursor & cur, ErrorList & errorList, bool asParagraphs)
739 // Use internal clipboard if it is the most recent one
740 if (theClipboard().isInternal()) {
741 pasteFromStack(cur, errorList, 0);
745 // First try LyX format
746 if (theClipboard().hasLyXContents()) {
747 string lyx = theClipboard().getAsLyX();
749 // For some strange reason gcc 3.2 and 3.3 do not accept
750 // Buffer buffer(string(), false);
751 Buffer buffer("", false);
752 buffer.setUnnamed(true);
753 if (buffer.readString(lyx)) {
755 pasteParagraphList(cur, buffer.paragraphs(),
756 buffer.params().getTextClassPtr(), errorList);
763 // Then try plain text
764 docstring const text = theClipboard().getAsText();
769 cur.text()->insertStringAsParagraphs(cur, text);
771 cur.text()->insertStringAsLines(cur, text);
775 void pasteSelection(Cursor & cur, ErrorList & errorList)
777 if (selectionBuffer.empty())
780 pasteParagraphList(cur, selectionBuffer[0].first,
781 selectionBuffer[0].second, errorList);
785 void replaceSelectionWithString(Cursor & cur, docstring const & str, bool backwards)
788 DocIterator selbeg = cur.selectionBegin();
790 // Get font setting before we cut
792 selbeg.paragraph().getFontSettings(cur.buffer().params(), selbeg.pos());
794 // Insert the new string
795 pos_type pos = cur.selEnd().pos();
796 Paragraph & par = cur.selEnd().paragraph();
797 docstring::const_iterator cit = str.begin();
798 docstring::const_iterator end = str.end();
799 for (; cit != end; ++cit, ++pos)
800 par.insertChar(pos, *cit, font, cur.buffer().params().trackChanges);
803 cutSelection(cur, true, false);
805 // select the replacement
807 selbeg.pos() += str.length();
808 cur.setSelection(selbeg, -int(str.length()));
810 cur.setSelection(selbeg, str.length());
814 void replaceSelection(Cursor & cur)
817 cutSelection(cur, true, false);
821 void eraseSelection(Cursor & cur)
823 //lyxerr << "cap::eraseSelection begin: " << cur << endl;
824 CursorSlice const & i1 = cur.selBegin();
825 CursorSlice const & i2 = cur.selEnd();
826 if (i1.inset().asInsetMath()) {
829 if (i1.idx() == i2.idx()) {
830 i1.cell().erase(i1.pos(), i2.pos());
831 // We may have deleted i1.cell(cur.pos()).
832 // Make sure that pos is valid.
833 if (cur.pos() > cur.lastpos())
834 cur.pos() = cur.lastpos();
836 InsetMath * p = i1.asInsetMath();
837 Inset::row_type r1, r2;
838 Inset::col_type c1, c2;
839 region(i1, i2, r1, r2, c1, c2);
840 for (Inset::row_type row = r1; row <= r2; ++row)
841 for (Inset::col_type col = c1; col <= c2; ++col)
842 p->cell(p->index(row, col)).clear();
843 // We've deleted the whole cell. Only pos 0 is valid.
846 // need a valid cursor. (Lgb)
847 cur.clearSelection();
849 lyxerr << "can't erase this selection 1" << endl;
851 //lyxerr << "cap::eraseSelection end: " << cur << endl;
855 void selDel(Cursor & cur)
857 //lyxerr << "cap::selDel" << endl;
863 void selClearOrDel(Cursor & cur)
865 //lyxerr << "cap::selClearOrDel" << endl;
866 if (lyxrc.auto_region_delete)
869 cur.selection() = false;
873 docstring grabSelection(Cursor const & cur)
875 if (!cur.selection())
878 // FIXME: What is wrong with the following?
881 for (DocIterator dit = cur.selectionBegin();
882 dit != cur.selectionEnd(); dit.forwardPos())
883 os << asString(dit.cell());
887 CursorSlice i1 = cur.selBegin();
888 CursorSlice i2 = cur.selEnd();
890 if (i1.idx() == i2.idx()) {
891 if (i1.inset().asInsetMath()) {
892 MathData::const_iterator it = i1.cell().begin();
893 return asString(MathData(it + i1.pos(), it + i2.pos()));
895 return from_ascii("unknown selection 1");
899 Inset::row_type r1, r2;
900 Inset::col_type c1, c2;
901 region(i1, i2, r1, r2, c1, c2);
904 if (i1.inset().asInsetMath()) {
905 for (Inset::row_type row = r1; row <= r2; ++row) {
908 for (Inset::col_type col = c1; col <= c2; ++col) {
911 data += asString(i1.asInsetMath()->
912 cell(i1.asInsetMath()->index(row, col)));
916 data = from_ascii("unknown selection 2");
922 void dirtyTabularStack(bool b)
924 dirty_tabular_stack_ = b;
928 bool tabularStackDirty()
930 return dirty_tabular_stack_;