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"
23 #include "ErrorList.h"
24 #include "FuncRequest.h"
26 #include "InsetIterator.h"
32 #include "LyXTextClassList.h"
33 #include "Paragraph.h"
34 #include "paragraph_funcs.h"
35 #include "ParagraphParameters.h"
36 #include "ParIterator.h"
39 #include "insets/InsetCharStyle.h"
40 #include "insets/InsetTabular.h"
42 #include "mathed/MathArray.h"
43 #include "mathed/InsetMath.h"
44 #include "mathed/MathSupport.h"
46 #include "support/lstrings.h"
48 #include "frontends/Clipboard.h"
49 #include "frontends/Selection.h"
51 #include <boost/current_function.hpp>
52 #include <boost/tuple/tuple.hpp>
66 using support::bformat;
67 using frontend::Clipboard;
71 typedef std::pair<pit_type, int> PitPosPair;
73 typedef limited_stack<pair<ParagraphList, textclass_type> > CutStack;
76 // persistent selection, cleared until the next selection
77 CutStack selectionBuffer(1);
79 // store whether the tabular stack is newer than the normal copy stack
80 // FIXME: this is a workaround for bug 1919. Should be removed for 1.5,
81 // when we (hopefully) have a one-for-all paste mechanism.
82 bool dirty_tabular_stack_ = false;
85 void region(CursorSlice const & i1, CursorSlice const & i2,
86 InsetBase::row_type & r1, InsetBase::row_type & r2,
87 InsetBase::col_type & c1, InsetBase::col_type & c2)
89 InsetBase & p = i1.inset();
101 bool checkPastePossible(int index)
103 return size_t(index) < theCuts.size() && !theCuts[index].first.empty();
107 pair<PitPosPair, pit_type>
108 pasteSelectionHelper(LCursor & cur, ParagraphList const & parlist,
109 textclass_type textclass, ErrorList & errorlist)
111 Buffer const & buffer = cur.buffer();
112 pit_type pit = cur.pit();
113 pos_type pos = cur.pos();
114 ParagraphList & pars = cur.text()->paragraphs();
117 return make_pair(PitPosPair(pit, pos), pit);
119 BOOST_ASSERT (pos <= pars[pit].size());
121 // Make a copy of the CaP paragraphs.
122 ParagraphList insertion = parlist;
123 textclass_type const tc = buffer.params().textclass;
125 // Now remove all out of the pars which is NOT allowed in the
126 // new environment and set also another font if that is required.
128 // Convert newline to paragraph break in ERT inset.
129 // This should not be here!
130 if (pars[pit].inInset() &&
131 pars[pit].inInset()->lyxCode() == InsetBase::ERT_CODE) {
132 for (ParagraphList::size_type i = 0; i < insertion.size(); ++i) {
133 for (pos_type j = 0; j < insertion[i].size(); ++j) {
134 if (insertion[i].isNewline(j)) {
135 // do not track deletion of newline
136 insertion[i].eraseChar(j, false);
137 breakParagraphConservative(
145 // If we are in an inset which returns forceDefaultParagraphs,
146 // set the paragraphs to default
147 if (cur.inset().forceDefaultParagraphs(cur.idx())) {
148 LyXLayout_ptr const layout =
149 buffer.params().getLyXTextClass().defaultLayout();
150 ParagraphList::iterator const end = insertion.end();
151 for (ParagraphList::iterator par = insertion.begin();
156 // Make sure there is no class difference.
158 // This works without copying any paragraph data because we have
159 // a specialized swap method for ParagraphList. This is important
160 // since we store pointers to insets at some places and we don't
161 // want to invalidate them.
162 insertion.swap(in.paragraphs());
163 cap::switchBetweenClasses(textclass, tc, in, errorlist);
164 insertion.swap(in.paragraphs());
166 ParagraphList::iterator tmpbuf = insertion.begin();
167 int depth_delta = pars[pit].params().depth() - tmpbuf->params().depth();
169 depth_type max_depth = pars[pit].getMaxDepthAfter();
171 for (; tmpbuf != insertion.end(); ++tmpbuf) {
172 // If we have a negative jump so that the depth would
173 // go below 0 depth then we have to redo the delta to
174 // this new max depth level so that subsequent
175 // paragraphs are aligned correctly to this paragraph
177 if (int(tmpbuf->params().depth()) + depth_delta < 0)
180 // Set the right depth so that we are not too deep or shallow.
181 tmpbuf->params().depth(tmpbuf->params().depth() + depth_delta);
182 if (tmpbuf->params().depth() > max_depth)
183 tmpbuf->params().depth(max_depth);
185 // Only set this from the 2nd on as the 2nd depends
186 // for maxDepth still on pit.
187 if (tmpbuf != insertion.begin())
188 max_depth = tmpbuf->getMaxDepthAfter();
190 // Set the inset owner of this paragraph.
191 tmpbuf->setInsetOwner(pars[pit].inInset());
192 for (pos_type i = 0; i < tmpbuf->size(); ++i) {
193 if (tmpbuf->getChar(i) == Paragraph::META_INSET &&
194 !pars[pit].insetAllowed(tmpbuf->getInset(i)->lyxCode()))
195 // do not track deletion of invalid insets
196 tmpbuf->eraseChar(i--, false);
199 tmpbuf->setChange(Change(buffer.params().trackChanges ?
200 Change::INSERTED : Change::UNCHANGED));
203 bool const empty = pars[pit].empty();
205 // Make the buf exactly the same layout as the cursor
207 insertion.begin()->makeSameLayout(pars[pit]);
210 // Prepare the paragraphs and insets for insertion.
211 // A couple of insets store buffer references so need updating.
212 insertion.swap(in.paragraphs());
214 ParIterator fpit = par_iterator_begin(in);
215 ParIterator fend = par_iterator_end(in);
217 for (; fpit != fend; ++fpit) {
218 InsetList::const_iterator lit = fpit->insetlist.begin();
219 InsetList::const_iterator eit = fpit->insetlist.end();
221 for (; lit != eit; ++lit) {
222 switch (lit->inset->lyxCode()) {
223 case InsetBase::TABULAR_CODE: {
224 InsetTabular * it = static_cast<InsetTabular*>(lit->inset);
234 insertion.swap(in.paragraphs());
236 // Split the paragraph for inserting the buf if necessary.
238 breakParagraphConservative(buffer.params(), pars, pit, pos);
242 pars.insert(boost::next(pars.begin(), pit),
246 // merge the empty par with the last par of the insertion
247 mergeParagraph(buffer.params(), pars,
248 pit + insertion.size() - 1);
250 pars.insert(boost::next(pars.begin(), pit + 1),
254 // merge the first par of the insertion with the current par
255 mergeParagraph(buffer.params(), pars, pit);
258 pit_type last_paste = pit + insertion.size() - 1;
260 // Store the new cursor position.
262 pos = pars[last_paste].size();
264 // Join (conditionally) last pasted paragraph with next one, i.e.,
265 // the tail of the spliced document paragraph
266 if (!empty && last_paste + 1 != pit_type(pars.size())) {
267 if (pars[last_paste + 1].hasSameLayout(pars[last_paste])) {
268 mergeParagraph(buffer.params(), pars, last_paste);
269 } else if (pars[last_paste + 1].empty()) {
270 pars[last_paste + 1].makeSameLayout(pars[last_paste]);
271 mergeParagraph(buffer.params(), pars, last_paste);
272 } else if (pars[last_paste].empty()) {
273 pars[last_paste].makeSameLayout(pars[last_paste + 1]);
274 mergeParagraph(buffer.params(), pars, last_paste);
276 pars[last_paste + 1].stripLeadingSpaces(buffer.params().trackChanges);
281 return make_pair(PitPosPair(pit, pos), last_paste + 1);
285 PitPosPair eraseSelectionHelper(BufferParams const & params,
286 ParagraphList & pars,
287 pit_type startpit, pit_type endpit,
288 int startpos, int endpos, bool doclear)
290 // Start of selection is really invalid.
291 if (startpit == pit_type(pars.size()) ||
292 (startpos > pars[startpit].size()))
293 return PitPosPair(endpit, endpos);
295 // Start and end is inside same paragraph
296 if (endpit == pit_type(pars.size()) || startpit == endpit) {
297 endpos -= pars[startpit].eraseChars(startpos, endpos, params.trackChanges);
298 return PitPosPair(endpit, endpos);
301 for (pit_type pit = startpit; pit != endpit + 1;) {
302 pos_type const left = (pit == startpit ? startpos : 0);
303 pos_type const right = (pit == endpit ? endpos : pars[pit].size() + 1);
305 bool const merge = pars[pit].isMergedOnEndOfParDeletion(params.trackChanges);
307 // Logically erase only, including the end-of-paragraph character
308 pars[pit].eraseChars(left, right, params.trackChanges);
310 // Separate handling of paragraph break:
311 if (merge && pit != endpit &&
312 (pit + 1 != endpit || pars[pit].hasSameLayout(pars[pit + 1]))) {
313 pos_type const thissize = pars[pit].size();
315 pars[pit + 1].stripLeadingSpaces(params.trackChanges);
316 mergeParagraph(params, pars, pit);
324 // Ensure legal cursor pos:
327 return PitPosPair(endpit, endpos);
331 void putClipboard(ParagraphList const & paragraphs, textclass_type textclass,
332 docstring const & plaintext)
334 // For some strange reason gcc 3.2 and 3.3 do not accept
335 // Buffer buffer(string(), false);
336 Buffer buffer("", false);
337 buffer.setUnnamed(true);
338 buffer.paragraphs() = paragraphs;
339 buffer.params().textclass = textclass;
340 std::ostringstream lyx;
341 if (buffer.write(lyx))
342 theClipboard().put(lyx.str(), plaintext);
344 theClipboard().put(string(), plaintext);
348 void copySelectionHelper(Buffer const & buf, ParagraphList & pars,
349 pit_type startpit, pit_type endpit,
350 int start, int end, textclass_type tc, CutStack & cutstack)
352 BOOST_ASSERT(0 <= start && start <= pars[startpit].size());
353 BOOST_ASSERT(0 <= end && end <= pars[endpit].size());
354 BOOST_ASSERT(startpit != endpit || start <= end);
356 // Clone the paragraphs within the selection.
357 ParagraphList copy_pars(boost::next(pars.begin(), startpit),
358 boost::next(pars.begin(), endpit + 1));
360 // Remove the end of the last paragraph; afterwards, remove the beginning
361 // of the first paragraph. Keep this order - there may only be one paragraph!
362 // Do not track deletions here; this is an internal action not visible to the user
363 Paragraph & back = copy_pars.back();
364 back.eraseChars(end, back.size(), false);
365 Paragraph & front = copy_pars.front();
366 front.eraseChars(0, start, false);
368 ParagraphList::iterator it = copy_pars.begin();
369 ParagraphList::iterator it_end = copy_pars.end();
371 for (; it != it_end; it++) {
372 // ERT paragraphs have the Language latex_language.
373 // This is invalid outside of ERT, so we need to change it
374 // to the buffer language.
375 if (it->ownerCode() == InsetBase::ERT_CODE) {
376 it->changeLanguage(buf.params(), latex_language,
379 it->setInsetOwner(0);
382 // do not copy text (also nested in insets) which is marked as deleted
383 // acceptChanges() is defined for LyXText rather than ParagraphList
384 // Thus we must wrap copy_pars into a LyXText object and cross our fingers
386 copy_pars.swap(lt.paragraphs());
387 lt.acceptChanges(buf.params());
388 copy_pars.swap(lt.paragraphs());
390 cutstack.push(make_pair(copy_pars, tc));
400 docstring grabAndEraseSelection(LCursor & cur)
402 if (!cur.selection())
404 docstring res = grabSelection(cur);
410 void switchBetweenClasses(textclass_type c1, textclass_type c2,
411 InsetText & in, ErrorList & errorlist)
413 BOOST_ASSERT(!in.paragraphs().empty());
417 LyXTextClass const & tclass1 = textclasslist[c1];
418 LyXTextClass const & tclass2 = textclasslist[c2];
421 ParIterator end = par_iterator_end(in);
422 for (ParIterator it = par_iterator_begin(in); it != end; ++it) {
423 string const name = it->layout()->name();
424 bool hasLayout = tclass2.hasLayout(name);
427 it->layout(tclass2[name]);
429 it->layout(tclass2.defaultLayout());
431 if (!hasLayout && name != tclass1.defaultLayoutName()) {
432 docstring const s = bformat(
433 _("Layout had to be changed from\n%1$s to %2$s\n"
434 "because of class conversion from\n%3$s to %4$s"),
435 from_utf8(name), from_utf8(it->layout()->name()),
436 from_utf8(tclass1.name()), from_utf8(tclass2.name()));
437 // To warn the user that something had to be done.
438 errorlist.push_back(ErrorItem(_("Changed Layout"), s,
445 InsetIterator const i_end = inset_iterator_end(in);
446 for (InsetIterator it = inset_iterator_begin(in); it != i_end; ++it) {
447 if (it->lyxCode() == InsetBase::CHARSTYLE_CODE) {
448 InsetCharStyle & inset =
449 static_cast<InsetCharStyle &>(*it);
450 string const name = inset.params().type;
451 CharStyles::iterator const found_cs =
452 tclass2.charstyle(name);
453 if (found_cs == tclass2.charstyles().end()) {
454 // The character style is undefined in tclass2
455 inset.setUndefined();
456 docstring const s = bformat(_(
457 "Character style %1$s is "
458 "undefined because of class "
459 "conversion from\n%2$s to %3$s"),
460 from_utf8(name), from_utf8(tclass1.name()),
461 from_utf8(tclass2.name()));
462 // To warn the user that something had to be done.
463 errorlist.push_back(ErrorItem(
464 _("Undefined character style"),
465 s, it.paragraph().id(), it.pos(), it.pos() + 1));
466 } else if (inset.undefined()) {
467 // The character style is undefined in
468 // tclass1 and is defined in tclass2
469 inset.setDefined(found_cs);
476 std::vector<docstring> const availableSelections(Buffer const & buffer)
478 vector<docstring> selList;
480 CutStack::const_iterator cit = theCuts.begin();
481 CutStack::const_iterator end = theCuts.end();
482 for (; cit != end; ++cit) {
483 // we do not use cit-> here because gcc 2.9x does not
485 ParagraphList const & pars = (*cit).first;
487 ParagraphList::const_iterator pit = pars.begin();
488 ParagraphList::const_iterator pend = pars.end();
489 for (; pit != pend; ++pit) {
490 asciiSel += pit->asString(buffer, false);
491 if (asciiSel.size() > 25) {
492 asciiSel.replace(22, docstring::npos,
498 selList.push_back(asciiSel);
505 size_type numberOfSelections()
507 return theCuts.size();
511 void cutSelection(LCursor & cur, bool doclear, bool realcut)
513 // This doesn't make sense, if there is no selection
514 if (!cur.selection())
517 // OK, we have a selection. This is always between cur.selBegin()
520 if (cur.inTexted()) {
521 LyXText * text = cur.text();
524 // make sure that the depth behind the selection are restored, too
525 recordUndoSelection(cur);
526 pit_type begpit = cur.selBegin().pit();
527 pit_type endpit = cur.selEnd().pit();
529 int endpos = cur.selEnd().pos();
531 BufferParams const & bp = cur.buffer().params();
533 copySelectionHelper(cur.buffer(),
536 cur.selBegin().pos(), endpos,
537 bp.textclass, theCuts);
538 // Stuff what we got on the clipboard.
539 // Even if there is no selection.
540 putClipboard(theCuts[0].first, theCuts[0].second,
541 cur.selectionAsString(true));
544 boost::tie(endpit, endpos) =
545 eraseSelectionHelper(bp,
548 cur.selBegin().pos(), endpos,
551 // cutSelection can invalidate the cursor so we need to set
553 // we prefer the end for when tracking changes
557 // sometimes necessary
559 && text->paragraphs()[begpit].stripLeadingSpaces(bp.trackChanges))
562 // need a valid cursor. (Lgb)
563 cur.clearSelection();
564 updateLabels(cur.buffer());
565 theSelection().haveSelection(false);
567 // tell tabular that a recent copy happened
568 dirtyTabularStack(false);
571 if (cur.inMathed()) {
572 if (cur.selBegin().idx() != cur.selEnd().idx()) {
573 // The current selection spans more than one cell.
575 recordUndoInset(cur);
577 // Record only the current cell to avoid a jumping
588 void copySelection(LCursor & cur)
590 copySelection(cur, cur.selectionAsString(true));
596 void copySelectionToStack(LCursor & cur, CutStack & cutstack)
598 // this doesn't make sense, if there is no selection
599 if (!cur.selection())
602 if (cur.inTexted()) {
603 LyXText * text = cur.text();
605 // ok we have a selection. This is always between cur.selBegin()
606 // and sel_end cursor
608 // copy behind a space if there is one
609 ParagraphList & pars = text->paragraphs();
610 pos_type pos = cur.selBegin().pos();
611 pit_type par = cur.selBegin().pit();
612 while (pos < pars[par].size() &&
613 pars[par].isLineSeparator(pos) &&
614 (par != cur.selEnd().pit() || pos < cur.selEnd().pos()))
617 copySelectionHelper(cur.buffer(), pars, par, cur.selEnd().pit(),
618 pos, cur.selEnd().pos(), cur.buffer().params().textclass, cutstack);
621 if (cur.inMathed()) {
622 //lyxerr << "copySelection in mathed" << endl;
625 BufferParams const & bp = cur.buffer().params();
626 par.layout(bp.getLyXTextClass().defaultLayout());
627 par.insert(0, grabSelection(cur), LyXFont(), Change(Change::UNCHANGED));
629 cutstack.push(make_pair(pars, bp.textclass));
636 void copySelectionToStack()
638 if (!selectionBuffer.empty())
639 theCuts.push(selectionBuffer[0]);
643 void copySelection(LCursor & cur, docstring const & plaintext)
645 // In tablemode, because copy and paste actually use special table stack
646 // we do not attemp to get selected paragraphs under cursor. Instead, a
647 // paragraph with the plain text version is generated so that table cells
648 // can be pasted as pure text somewhere else.
649 if (cur.selBegin().idx() != cur.selEnd().idx()) {
652 BufferParams const & bp = cur.buffer().params();
653 par.layout(bp.getLyXTextClass().defaultLayout());
654 par.insert(0, plaintext, LyXFont(), Change(Change::UNCHANGED));
656 theCuts.push(make_pair(pars, bp.textclass));
658 copySelectionToStack(cur, theCuts);
660 // stuff the selection onto the X clipboard, from an explicit copy request
661 putClipboard(theCuts[0].first, theCuts[0].second, plaintext);
665 void saveSelection(LCursor & cur)
667 LYXERR(Debug::ACTION) << BOOST_CURRENT_FUNCTION << ": `"
668 << to_utf8(cur.selectionAsString(true)) << "'."
672 copySelectionToStack(cur, selectionBuffer);
673 // tell X whether we now have a valid selection
674 theSelection().haveSelection(cur.selection());
680 return !selectionBuffer.empty();
684 void clearSelection()
686 selectionBuffer.clear();
690 docstring getSelection(Buffer const & buf, size_t sel_index)
692 return sel_index < theCuts.size()
693 ? theCuts[sel_index].first.back().asString(buf, false)
698 void pasteParagraphList(LCursor & cur, ParagraphList const & parlist,
699 textclass_type textclass, ErrorList & errorList)
701 if (cur.inTexted()) {
702 LyXText * text = cur.text();
708 boost::tie(ppp, endpit) =
709 pasteSelectionHelper(cur, parlist,
710 textclass, errorList);
711 updateLabels(cur.buffer());
712 cur.clearSelection();
713 text->setCursor(cur.top(), ppp.first, ppp.second);
716 // mathed is handled in InsetMathNest/InsetMathGrid
717 BOOST_ASSERT(!cur.inMathed());
721 void pasteFromStack(LCursor & cur, ErrorList & errorList, size_t sel_index)
723 // this does not make sense, if there is nothing to paste
724 if (!checkPastePossible(sel_index))
728 pasteParagraphList(cur, theCuts[sel_index].first,
729 theCuts[sel_index].second, errorList);
735 void pasteClipboard(LCursor & cur, ErrorList & errorList, bool asParagraphs)
737 // Use internal clipboard if it is the most recent one
738 if (theClipboard().isInternal()) {
739 pasteFromStack(cur, errorList, 0);
743 // First try LyX format
744 if (theClipboard().hasLyXContents()) {
745 string lyx = theClipboard().getAsLyX();
747 // For some strange reason gcc 3.2 and 3.3 do not accept
748 // Buffer buffer(string(), false);
749 Buffer buffer("", false);
750 buffer.setUnnamed(true);
751 if (buffer.readString(lyx)) {
753 pasteParagraphList(cur, buffer.paragraphs(),
754 buffer.params().textclass, errorList);
761 // Then try plain text
762 docstring const text = theClipboard().getAsText();
767 cur.text()->insertStringAsParagraphs(cur, text);
769 cur.text()->insertStringAsLines(cur, text);
773 void pasteSelection(LCursor & cur, ErrorList & errorList)
775 if (selectionBuffer.empty())
778 pasteParagraphList(cur, selectionBuffer[0].first,
779 selectionBuffer[0].second, errorList);
784 void replaceSelectionWithString(LCursor & cur, docstring const & str, bool backwards)
787 DocIterator selbeg = cur.selectionBegin();
789 // Get font setting before we cut
791 selbeg.paragraph().getFontSettings(cur.buffer().params(), selbeg.pos());
793 // Insert the new string
794 pos_type pos = cur.selEnd().pos();
795 Paragraph & par = cur.selEnd().paragraph();
796 docstring::const_iterator cit = str.begin();
797 docstring::const_iterator end = str.end();
798 for (; cit != end; ++cit, ++pos)
799 par.insertChar(pos, *cit, font, cur.buffer().params().trackChanges);
802 cutSelection(cur, true, false);
804 // select the replacement
806 selbeg.pos() += str.length();
807 cur.setSelection(selbeg, -int(str.length()));
809 cur.setSelection(selbeg, str.length());
814 void replaceSelection(LCursor & cur)
817 cutSelection(cur, true, false);
821 void eraseSelection(LCursor & 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()) {
828 if (i1.idx() == i2.idx()) {
829 i1.cell().erase(i1.pos(), i2.pos());
830 // We may have deleted i1.cell(cur.pos()).
831 // Make sure that pos is valid.
832 if (cur.pos() > cur.lastpos())
833 cur.pos() = cur.lastpos();
835 InsetMath * p = i1.asInsetMath();
836 InsetBase::row_type r1, r2;
837 InsetBase::col_type c1, c2;
838 region(i1, i2, r1, r2, c1, c2);
839 for (InsetBase::row_type row = r1; row <= r2; ++row)
840 for (InsetBase::col_type col = c1; col <= c2; ++col)
841 p->cell(p->index(row, col)).clear();
842 // We've deleted the whole cell. Only pos 0 is valid.
845 // need a valid cursor. (Lgb)
846 cur.clearSelection();
847 theSelection().haveSelection(false);
849 lyxerr << "can't erase this selection 1" << endl;
851 //lyxerr << "cap::eraseSelection end: " << cur << endl;
855 void selDel(LCursor & cur)
857 //lyxerr << "cap::selDel" << endl;
863 void selClearOrDel(LCursor & cur)
865 //lyxerr << "cap::selClearOrDel" << endl;
866 if (lyxrc.auto_region_delete)
869 cur.selection() = false;
873 docstring grabSelection(LCursor const & cur)
875 if (!cur.selection())
878 // FIXME: What is wrong with the following?
880 std::ostringstream os;
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 MathArray::const_iterator it = i1.cell().begin();
893 return asString(MathArray(it + i1.pos(), it + i2.pos()));
895 return from_ascii("unknown selection 1");
899 InsetBase::row_type r1, r2;
900 InsetBase::col_type c1, c2;
901 region(i1, i2, r1, r2, c1, c2);
904 if (i1.inset().asInsetMath()) {
905 for (InsetBase::row_type row = r1; row <= r2; ++row) {
908 for (InsetBase::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_;