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"
27 #include "InsetIterator.h"
33 #include "TextClass_ptr.h"
34 #include "TextClassList.h"
35 #include "Paragraph.h"
36 #include "paragraph_funcs.h"
37 #include "ParagraphParameters.h"
38 #include "ParIterator.h"
41 #include "insets/InsetFlex.h"
42 #include "insets/InsetTabular.h"
44 #include "mathed/MathData.h"
45 #include "mathed/InsetMath.h"
46 #include "mathed/MathSupport.h"
48 #include "support/lstrings.h"
50 #include "frontends/Clipboard.h"
51 #include "frontends/Selection.h"
53 #include <boost/current_function.hpp>
54 #include <boost/tuple/tuple.hpp>
68 using support::bformat;
69 using frontend::Clipboard;
73 typedef std::pair<pit_type, int> PitPosPair;
75 typedef limited_stack<pair<ParagraphList, TextClass_ptr> > CutStack;
78 // persistent selection, cleared until the next selection
79 CutStack selectionBuffer(1);
81 // store whether the tabular stack is newer than the normal copy stack
82 // FIXME: this is a workaround for bug 1919. Should be removed for 1.5,
83 // when we (hopefully) have a one-for-all paste mechanism.
84 bool dirty_tabular_stack_ = false;
87 void region(CursorSlice const & i1, CursorSlice const & i2,
88 Inset::row_type & r1, Inset::row_type & r2,
89 Inset::col_type & c1, Inset::col_type & c2)
91 Inset & p = i1.inset();
103 bool checkPastePossible(int index)
105 return size_t(index) < theCuts.size() && !theCuts[index].first.empty();
109 pair<PitPosPair, pit_type>
110 pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
111 TextClass_ptr textclass, ErrorList & errorlist)
113 Buffer const & buffer = cur.buffer();
114 pit_type pit = cur.pit();
115 pos_type pos = cur.pos();
116 ParagraphList & pars = cur.text()->paragraphs();
119 return make_pair(PitPosPair(pit, pos), pit);
121 BOOST_ASSERT (pos <= pars[pit].size());
123 // Make a copy of the CaP paragraphs.
124 ParagraphList insertion = parlist;
125 TextClass_ptr const tc = buffer.params().getTextClass_ptr();
127 // Now remove all out of the pars which is NOT allowed in the
128 // new environment and set also another font if that is required.
130 // Convert newline to paragraph break in ERT inset.
131 // This should not be here!
132 if (pars[pit].inInset() &&
133 (pars[pit].inInset()->lyxCode() == Inset::ERT_CODE ||
134 pars[pit].inInset()->lyxCode() == Inset::LISTINGS_CODE)) {
135 for (ParagraphList::size_type i = 0; i < insertion.size(); ++i) {
136 for (pos_type j = 0; j < insertion[i].size(); ++j) {
137 if (insertion[i].isNewline(j)) {
138 // do not track deletion of newline
139 insertion[i].eraseChar(j, false);
140 breakParagraphConservative(
148 // If we are in an inset which returns forceDefaultParagraphs,
149 // set the paragraphs to default
150 if (cur.inset().forceDefaultParagraphs(cur.idx())) {
151 LayoutPtr const layout =
152 buffer.params().getTextClass().defaultLayout();
153 ParagraphList::iterator const end = insertion.end();
154 for (ParagraphList::iterator par = insertion.begin();
159 // Make sure there is no class difference.
161 // This works without copying any paragraph data because we have
162 // a specialized swap method for ParagraphList. This is important
163 // since we store pointers to insets at some places and we don't
164 // want to invalidate them.
165 insertion.swap(in.paragraphs());
166 cap::switchBetweenClasses(textclass, tc, in, errorlist);
167 insertion.swap(in.paragraphs());
169 ParagraphList::iterator tmpbuf = insertion.begin();
170 int depth_delta = pars[pit].params().depth() - tmpbuf->params().depth();
172 depth_type max_depth = pars[pit].getMaxDepthAfter();
174 for (; tmpbuf != insertion.end(); ++tmpbuf) {
175 // If we have a negative jump so that the depth would
176 // go below 0 depth then we have to redo the delta to
177 // this new max depth level so that subsequent
178 // paragraphs are aligned correctly to this paragraph
180 if (int(tmpbuf->params().depth()) + depth_delta < 0)
183 // Set the right depth so that we are not too deep or shallow.
184 tmpbuf->params().depth(tmpbuf->params().depth() + depth_delta);
185 if (tmpbuf->params().depth() > max_depth)
186 tmpbuf->params().depth(max_depth);
188 // Only set this from the 2nd on as the 2nd depends
189 // for maxDepth still on pit.
190 if (tmpbuf != insertion.begin())
191 max_depth = tmpbuf->getMaxDepthAfter();
193 // Set the inset owner of this paragraph.
194 tmpbuf->setInsetOwner(pars[pit].inInset());
195 for (pos_type i = 0; i < tmpbuf->size(); ++i) {
196 if (tmpbuf->getChar(i) == Paragraph::META_INSET &&
197 !pars[pit].insetAllowed(tmpbuf->getInset(i)->lyxCode()))
198 // do not track deletion of invalid insets
199 tmpbuf->eraseChar(i--, false);
202 tmpbuf->setChange(Change(buffer.params().trackChanges ?
203 Change::INSERTED : Change::UNCHANGED));
206 bool const empty = pars[pit].empty();
208 // Make the buf exactly the same layout as the cursor
210 insertion.begin()->makeSameLayout(pars[pit]);
213 // Prepare the paragraphs and insets for insertion.
214 // A couple of insets store buffer references so need updating.
215 insertion.swap(in.paragraphs());
217 ParIterator fpit = par_iterator_begin(in);
218 ParIterator fend = par_iterator_end(in);
220 for (; fpit != fend; ++fpit) {
221 InsetList::const_iterator lit = fpit->insetlist.begin();
222 InsetList::const_iterator eit = fpit->insetlist.end();
224 for (; lit != eit; ++lit) {
225 switch (lit->inset->lyxCode()) {
226 case Inset::TABULAR_CODE: {
227 InsetTabular * it = static_cast<InsetTabular*>(lit->inset);
237 insertion.swap(in.paragraphs());
239 // Split the paragraph for inserting the buf if necessary.
241 breakParagraphConservative(buffer.params(), pars, pit, pos);
245 pars.insert(boost::next(pars.begin(), pit),
249 // merge the empty par with the last par of the insertion
250 mergeParagraph(buffer.params(), pars,
251 pit + insertion.size() - 1);
253 pars.insert(boost::next(pars.begin(), pit + 1),
257 // merge the first par of the insertion with the current par
258 mergeParagraph(buffer.params(), pars, pit);
261 pit_type last_paste = pit + insertion.size() - 1;
263 // Store the new cursor position.
265 pos = pars[last_paste].size();
267 // Join (conditionally) last pasted paragraph with next one, i.e.,
268 // the tail of the spliced document paragraph
269 if (!empty && last_paste + 1 != pit_type(pars.size())) {
270 if (pars[last_paste + 1].hasSameLayout(pars[last_paste])) {
271 mergeParagraph(buffer.params(), pars, last_paste);
272 } else if (pars[last_paste + 1].empty()) {
273 pars[last_paste + 1].makeSameLayout(pars[last_paste]);
274 mergeParagraph(buffer.params(), pars, last_paste);
275 } else if (pars[last_paste].empty()) {
276 pars[last_paste].makeSameLayout(pars[last_paste + 1]);
277 mergeParagraph(buffer.params(), pars, last_paste);
279 pars[last_paste + 1].stripLeadingSpaces(buffer.params().trackChanges);
284 return make_pair(PitPosPair(pit, pos), last_paste + 1);
288 PitPosPair eraseSelectionHelper(BufferParams const & params,
289 ParagraphList & pars,
290 pit_type startpit, pit_type endpit,
291 int startpos, int endpos)
293 // Start of selection is really invalid.
294 if (startpit == pit_type(pars.size()) ||
295 (startpos > pars[startpit].size()))
296 return PitPosPair(endpit, endpos);
298 // Start and end is inside same paragraph
299 if (endpit == pit_type(pars.size()) || startpit == endpit) {
300 endpos -= pars[startpit].eraseChars(startpos, endpos, params.trackChanges);
301 return PitPosPair(endpit, endpos);
304 for (pit_type pit = startpit; pit != endpit + 1;) {
305 pos_type const left = (pit == startpit ? startpos : 0);
306 pos_type right = (pit == endpit ? endpos : pars[pit].size() + 1);
307 bool const merge = pars[pit].isMergedOnEndOfParDeletion(params.trackChanges);
309 // Logically erase only, including the end-of-paragraph character
310 pars[pit].eraseChars(left, right, params.trackChanges);
312 // Separate handling of paragraph break:
313 if (merge && pit != endpit &&
314 (pit + 1 != endpit || pars[pit].hasSameLayout(pars[endpit]))) {
315 if (pit + 1 == endpit)
316 endpos += pars[pit].size();
317 mergeParagraph(params, pars, pit);
323 // Ensure legal cursor pos:
326 return PitPosPair(endpit, endpos);
330 void putClipboard(ParagraphList const & paragraphs, TextClass_ptr textclass,
331 docstring const & plaintext)
333 // For some strange reason gcc 3.2 and 3.3 do not accept
334 // Buffer buffer(string(), false);
335 Buffer buffer("", false);
336 buffer.setUnnamed(true);
337 buffer.paragraphs() = paragraphs;
338 buffer.params().setTextClass(textclass);
339 std::ostringstream lyx;
340 if (buffer.write(lyx))
341 theClipboard().put(lyx.str(), plaintext);
343 theClipboard().put(string(), plaintext);
347 void copySelectionHelper(Buffer const & buf, ParagraphList & pars,
348 pit_type startpit, pit_type endpit,
349 int start, int end, TextClass_ptr tc, CutStack & cutstack)
351 BOOST_ASSERT(0 <= start && start <= pars[startpit].size());
352 BOOST_ASSERT(0 <= end && end <= pars[endpit].size());
353 BOOST_ASSERT(startpit != endpit || start <= end);
355 // Clone the paragraphs within the selection.
356 ParagraphList copy_pars(boost::next(pars.begin(), startpit),
357 boost::next(pars.begin(), endpit + 1));
359 // Remove the end of the last paragraph; afterwards, remove the
360 // beginning of the first paragraph. Keep this order - there may only
361 // be one paragraph! Do not track deletions here; this is an internal
362 // action not visible to the user
364 Paragraph & back = copy_pars.back();
365 back.eraseChars(end, back.size(), false);
366 Paragraph & front = copy_pars.front();
367 front.eraseChars(0, start, false);
369 ParagraphList::iterator it = copy_pars.begin();
370 ParagraphList::iterator it_end = copy_pars.end();
372 for (; it != it_end; it++) {
373 // ERT paragraphs have the Language latex_language.
374 // This is invalid outside of ERT, so we need to change it
375 // to the buffer language.
376 if (it->ownerCode() == Inset::ERT_CODE || it->ownerCode() == Inset::LISTINGS_CODE) {
377 it->changeLanguage(buf.params(), latex_language,
380 it->setInsetOwner(0);
383 // do not copy text (also nested in insets) which is marked as deleted
384 acceptChanges(copy_pars, buf.params());
386 cutstack.push(make_pair(copy_pars, tc));
396 docstring grabAndEraseSelection(Cursor & cur)
398 if (!cur.selection())
400 docstring res = grabSelection(cur);
406 void switchBetweenClasses(TextClass_ptr const & c1,
407 TextClass_ptr const & c2, InsetText & in, ErrorList & errorlist)
411 BOOST_ASSERT(!in.paragraphs().empty());
415 TextClass const & tclass1 = *c1;
416 TextClass const & tclass2 = *c2;
419 ParIterator end = par_iterator_end(in);
420 for (ParIterator it = par_iterator_begin(in); it != end; ++it) {
421 docstring const name = it->layout()->name();
422 bool hasLayout = tclass2.hasLayout(name);
425 it->layout(tclass2[name]);
427 it->layout(tclass2.defaultLayout());
429 if (!hasLayout && name != tclass1.defaultLayoutName()) {
430 docstring const s = bformat(
431 _("Layout had to be changed from\n%1$s to %2$s\n"
432 "because of class conversion from\n%3$s to %4$s"),
433 name, it->layout()->name(),
434 from_utf8(tclass1.name()), from_utf8(tclass2.name()));
435 // To warn the user that something had to be done.
436 errorlist.push_back(ErrorItem(_("Changed Layout"), s,
443 InsetIterator const i_end = inset_iterator_end(in);
444 for (InsetIterator it = inset_iterator_begin(in); it != i_end; ++it) {
445 if (it->lyxCode() == Inset::FLEX_CODE) {
447 static_cast<InsetFlex &>(*it);
448 string const name = inset.params().name;
449 InsetLayout const il =
450 tclass2.insetlayout(from_utf8(name));
452 if (il.labelstring == from_utf8("UNDEFINED")) {
453 // The flex inset is undefined in tclass2
454 docstring const s = bformat(_(
455 "Flex inset %1$s is "
456 "undefined because of class "
457 "conversion from\n%2$s to %3$s"),
458 from_utf8(name), from_utf8(tclass1.name()),
459 from_utf8(tclass2.name()));
460 // To warn the user that something had to be done.
461 errorlist.push_back(ErrorItem(
462 _("Undefined flex inset"),
463 s, it.paragraph().id(), it.pos(), it.pos() + 1));
470 std::vector<docstring> const availableSelections(Buffer const & buffer)
472 vector<docstring> selList;
474 CutStack::const_iterator cit = theCuts.begin();
475 CutStack::const_iterator end = theCuts.end();
476 for (; cit != end; ++cit) {
477 // we do not use cit-> here because gcc 2.9x does not
479 ParagraphList const & pars = (*cit).first;
481 ParagraphList::const_iterator pit = pars.begin();
482 ParagraphList::const_iterator pend = pars.end();
483 for (; pit != pend; ++pit) {
484 asciiSel += pit->asString(buffer, false);
485 if (asciiSel.size() > 25) {
486 asciiSel.replace(22, docstring::npos,
492 selList.push_back(asciiSel);
499 size_type numberOfSelections()
501 return theCuts.size();
505 void cutSelection(Cursor & cur, bool doclear, bool realcut)
507 // This doesn't make sense, if there is no selection
508 if (!cur.selection())
511 // OK, we have a selection. This is always between cur.selBegin()
514 if (cur.inTexted()) {
515 Text * text = cur.text();
520 // make sure that the depth behind the selection are restored, too
521 recordUndoSelection(cur);
522 pit_type begpit = cur.selBegin().pit();
523 pit_type endpit = cur.selEnd().pit();
525 int endpos = cur.selEnd().pos();
527 BufferParams const & bp = cur.buffer().params();
529 copySelectionHelper(cur.buffer(),
532 cur.selBegin().pos(), endpos,
533 bp.getTextClass_ptr(), theCuts);
534 // Stuff what we got on the clipboard.
535 // Even if there is no selection.
536 putClipboard(theCuts[0].first, theCuts[0].second,
537 cur.selectionAsString(true));
540 boost::tie(endpit, endpos) =
541 eraseSelectionHelper(bp,
544 cur.selBegin().pos(), endpos);
546 // cutSelection can invalidate the cursor so we need to set
548 // we prefer the end for when tracking changes
552 // sometimes necessary
554 && text->paragraphs()[begpit].stripLeadingSpaces(bp.trackChanges))
557 // need a valid cursor. (Lgb)
558 cur.clearSelection();
559 updateLabels(cur.buffer());
561 // tell tabular that a recent copy happened
562 dirtyTabularStack(false);
565 if (cur.inMathed()) {
566 if (cur.selBegin().idx() != cur.selEnd().idx()) {
567 // The current selection spans more than one cell.
569 recordUndoInset(cur);
571 // Record only the current cell to avoid a jumping
582 void copySelection(Cursor & cur)
584 copySelection(cur, cur.selectionAsString(true));
590 void copySelectionToStack(Cursor & cur, CutStack & cutstack)
592 // this doesn't make sense, if there is no selection
593 if (!cur.selection())
596 // copySelection can not yet handle the case of cross idx selection
597 if (cur.selBegin().idx() != cur.selEnd().idx())
600 if (cur.inTexted()) {
601 Text * text = cur.text();
603 // ok we have a selection. This is always between cur.selBegin()
604 // and sel_end cursor
606 // copy behind a space if there is one
607 ParagraphList & pars = text->paragraphs();
608 pos_type pos = cur.selBegin().pos();
609 pit_type par = cur.selBegin().pit();
610 while (pos < pars[par].size() &&
611 pars[par].isLineSeparator(pos) &&
612 (par != cur.selEnd().pit() || pos < cur.selEnd().pos()))
615 copySelectionHelper(cur.buffer(), pars, par, cur.selEnd().pit(),
616 pos, cur.selEnd().pos(),
617 cur.buffer().params().getTextClass_ptr(), cutstack);
618 dirtyTabularStack(false);
621 if (cur.inMathed()) {
622 //lyxerr << "copySelection in mathed" << endl;
625 BufferParams const & bp = cur.buffer().params();
626 par.layout(bp.getTextClass().defaultLayout());
627 par.insert(0, grabSelection(cur), Font(), Change(Change::UNCHANGED));
629 cutstack.push(make_pair(pars, bp.getTextClass_ptr()));
636 void copySelectionToStack()
638 if (!selectionBuffer.empty())
639 theCuts.push(selectionBuffer[0]);
643 void copySelection(Cursor & 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.getTextClass().defaultLayout());
654 par.insert(0, plaintext, Font(), Change(Change::UNCHANGED));
656 theCuts.push(make_pair(pars, bp.getTextClass_ptr()));
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(Cursor & cur)
667 // This function is called, not when a selection is formed, but when
668 // a selection is cleared. Therefore, multiple keyboard selection
669 // will not repeatively trigger this function (bug 3877).
671 && cur.selBegin() == cur.bv().cursor().selBegin()
672 && cur.selEnd() == cur.bv().cursor().selEnd()) {
673 LYXERR(Debug::ACTION) << BOOST_CURRENT_FUNCTION << ": `"
674 << to_utf8(cur.selectionAsString(true)) << "'."
676 copySelectionToStack(cur, selectionBuffer);
683 return !selectionBuffer.empty();
687 void clearSelection()
689 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 TextClass_ptr 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().getTextClass_ptr(), 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?
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 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_;