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 "ParagraphList_fwd.h"
37 #include "pariterator.h"
40 #include "insets/insetcharstyle.h"
41 #include "insets/insettabular.h"
43 #include "mathed/MathData.h"
44 #include "mathed/InsetMath.h"
45 #include "mathed/MathSupport.h"
47 #include "support/lstrings.h"
49 #include "frontends/Clipboard.h"
50 #include "frontends/Selection.h"
52 #include <boost/current_function.hpp>
53 #include <boost/tuple/tuple.hpp>
67 using support::bformat;
68 using frontend::Clipboard;
72 typedef std::pair<pit_type, int> PitPosPair;
74 typedef limited_stack<pair<ParagraphList, textclass_type> > CutStack;
77 // persistent selection, cleared until the next selection
78 CutStack selectionBuffer(1);
80 // store whether the tabular stack is newer than the normal copy stack
81 // FIXME: this is a workaround for bug 1919. Should be removed for 1.5,
82 // when we (hopefully) have a one-for-all paste mechanism.
83 bool dirty_tabular_stack_ = false;
86 void region(CursorSlice const & i1, CursorSlice const & i2,
87 InsetBase::row_type & r1, InsetBase::row_type & r2,
88 InsetBase::col_type & c1, InsetBase::col_type & c2)
90 InsetBase & p = i1.inset();
102 bool checkPastePossible(int index)
104 return size_t(index) < theCuts.size() && !theCuts[index].first.empty();
108 pair<PitPosPair, pit_type>
109 pasteSelectionHelper(LCursor & cur, ParagraphList const & parlist,
110 textclass_type textclass, ErrorList & errorlist)
112 Buffer const & buffer = cur.buffer();
113 pit_type pit = cur.pit();
114 pos_type pos = cur.pos();
115 ParagraphList & pars = cur.text()->paragraphs();
118 return make_pair(PitPosPair(pit, pos), pit);
120 BOOST_ASSERT (pos <= pars[pit].size());
122 // Make a copy of the CaP paragraphs.
123 ParagraphList insertion = parlist;
124 textclass_type const tc = buffer.params().textclass;
126 // Now remove all out of the pars which is NOT allowed in the
127 // new environment and set also another font if that is required.
129 // Convert newline to paragraph break in ERT inset.
130 // This should not be here!
131 if (pars[pit].inInset() &&
132 pars[pit].inInset()->lyxCode() == InsetBase::ERT_CODE) {
133 for (ParagraphList::size_type i = 0; i < insertion.size(); ++i) {
134 for (pos_type j = 0; j < insertion[i].size(); ++j) {
135 if (insertion[i].isNewline(j)) {
136 // do not track deletion of newline
137 insertion[i].eraseChar(j, false);
138 breakParagraphConservative(
146 // If we are in an inset which returns forceDefaultParagraphs,
147 // set the paragraphs to default
148 if (cur.inset().forceDefaultParagraphs(cur.idx())) {
149 LyXLayout_ptr const layout =
150 buffer.params().getLyXTextClass().defaultLayout();
151 ParagraphList::iterator const end = insertion.end();
152 for (ParagraphList::iterator par = insertion.begin();
157 // Make sure there is no class difference.
159 // This works without copying any paragraph data because we have
160 // a specialized swap method for ParagraphList. This is important
161 // since we store pointers to insets at some places and we don't
162 // want to invalidate them.
163 insertion.swap(in.paragraphs());
164 cap::switchBetweenClasses(textclass, tc, in, errorlist);
165 insertion.swap(in.paragraphs());
167 ParagraphList::iterator tmpbuf = insertion.begin();
168 int depth_delta = pars[pit].params().depth() - tmpbuf->params().depth();
170 depth_type max_depth = pars[pit].getMaxDepthAfter();
172 for (; tmpbuf != insertion.end(); ++tmpbuf) {
173 // If we have a negative jump so that the depth would
174 // go below 0 depth then we have to redo the delta to
175 // this new max depth level so that subsequent
176 // paragraphs are aligned correctly to this paragraph
178 if (int(tmpbuf->params().depth()) + depth_delta < 0)
181 // Set the right depth so that we are not too deep or shallow.
182 tmpbuf->params().depth(tmpbuf->params().depth() + depth_delta);
183 if (tmpbuf->params().depth() > max_depth)
184 tmpbuf->params().depth(max_depth);
186 // Only set this from the 2nd on as the 2nd depends
187 // for maxDepth still on pit.
188 if (tmpbuf != insertion.begin())
189 max_depth = tmpbuf->getMaxDepthAfter();
191 // Set the inset owner of this paragraph.
192 tmpbuf->setInsetOwner(pars[pit].inInset());
193 for (pos_type i = 0; i < tmpbuf->size(); ++i) {
194 if (tmpbuf->getChar(i) == Paragraph::META_INSET &&
195 !pars[pit].insetAllowed(tmpbuf->getInset(i)->lyxCode()))
196 // do not track deletion of invalid insets
197 tmpbuf->eraseChar(i--, false);
200 tmpbuf->setChange(Change(buffer.params().trackChanges ?
201 Change::INSERTED : Change::UNCHANGED));
204 bool const empty = pars[pit].empty();
206 // Make the buf exactly the same layout as the cursor
208 insertion.begin()->makeSameLayout(pars[pit]);
211 // Prepare the paragraphs and insets for insertion.
212 // A couple of insets store buffer references so need updating.
213 insertion.swap(in.paragraphs());
215 ParIterator fpit = par_iterator_begin(in);
216 ParIterator fend = par_iterator_end(in);
218 for (; fpit != fend; ++fpit) {
219 InsetList::const_iterator lit = fpit->insetlist.begin();
220 InsetList::const_iterator eit = fpit->insetlist.end();
222 for (; lit != eit; ++lit) {
223 switch (lit->inset->lyxCode()) {
224 case InsetBase::TABULAR_CODE: {
225 InsetTabular * it = static_cast<InsetTabular*>(lit->inset);
235 insertion.swap(in.paragraphs());
237 // Split the paragraph for inserting the buf if necessary.
239 breakParagraphConservative(buffer.params(), pars, pit, pos);
243 pars.insert(boost::next(pars.begin(), pit),
247 // merge the empty par with the last par of the insertion
248 mergeParagraph(buffer.params(), pars,
249 pit + insertion.size() - 1);
251 pars.insert(boost::next(pars.begin(), pit + 1),
255 // merge the first par of the insertion with the current par
256 mergeParagraph(buffer.params(), pars, pit);
259 pit_type last_paste = pit + insertion.size() - 1;
261 // Store the new cursor position.
263 pos = pars[last_paste].size();
265 // Join (conditionally) last pasted paragraph with next one, i.e.,
266 // the tail of the spliced document paragraph
267 if (!empty && last_paste + 1 != pit_type(pars.size())) {
268 if (pars[last_paste + 1].hasSameLayout(pars[last_paste])) {
269 mergeParagraph(buffer.params(), pars, last_paste);
270 } else if (pars[last_paste + 1].empty()) {
271 pars[last_paste + 1].makeSameLayout(pars[last_paste]);
272 mergeParagraph(buffer.params(), pars, last_paste);
273 } else if (pars[last_paste].empty()) {
274 pars[last_paste].makeSameLayout(pars[last_paste + 1]);
275 mergeParagraph(buffer.params(), pars, last_paste);
277 pars[last_paste + 1].stripLeadingSpaces(buffer.params().trackChanges);
282 return make_pair(PitPosPair(pit, pos), last_paste + 1);
286 PitPosPair eraseSelectionHelper(BufferParams const & params,
287 ParagraphList & pars,
288 pit_type startpit, pit_type endpit,
289 int startpos, int endpos, bool doclear)
291 // Start of selection is really invalid.
292 if (startpit == pit_type(pars.size()) ||
293 (startpos > pars[startpit].size()))
294 return PitPosPair(endpit, endpos);
296 // Start and end is inside same paragraph
297 if (endpit == pit_type(pars.size()) || startpit == endpit) {
298 endpos -= pars[startpit].eraseChars(startpos, endpos, params.trackChanges);
299 return PitPosPair(endpit, endpos);
302 for (pit_type pit = startpit; pit != endpit + 1;) {
303 pos_type const left = (pit == startpit ? startpos : 0);
304 pos_type const right = (pit == endpit ? endpos : pars[pit].size() + 1);
306 bool const merge = pars[pit].isMergedOnEndOfParDeletion(params.trackChanges);
308 // Logically erase only, including the end-of-paragraph character
309 pars[pit].eraseChars(left, right, params.trackChanges);
311 // Separate handling of paragraph break:
312 if (merge && pit != endpit &&
313 (pit + 1 != endpit || pars[pit].hasSameLayout(pars[pit + 1]))) {
314 pos_type const thissize = pars[pit].size();
316 pars[pit + 1].stripLeadingSpaces(params.trackChanges);
317 mergeParagraph(params, pars, pit);
325 // Ensure legal cursor pos:
328 return PitPosPair(endpit, endpos);
332 void putClipboard(ParagraphList const & paragraphs, textclass_type textclass,
333 docstring const & plaintext)
335 // For some strange reason gcc 3.2 and 3.3 do not accept
336 // Buffer buffer(string(), false);
337 Buffer buffer("", false);
338 buffer.setUnnamed(true);
339 buffer.paragraphs() = paragraphs;
340 buffer.params().textclass = textclass;
341 std::ostringstream lyx;
342 if (buffer.write(lyx))
343 theClipboard().put(lyx.str(), plaintext);
345 theClipboard().put(string(), plaintext);
349 void copySelectionHelper(Buffer const & buf, ParagraphList & pars,
350 pit_type startpit, pit_type endpit,
351 int start, int end, textclass_type tc, CutStack & cutstack)
353 BOOST_ASSERT(0 <= start && start <= pars[startpit].size());
354 BOOST_ASSERT(0 <= end && end <= pars[endpit].size());
355 BOOST_ASSERT(startpit != endpit || start <= end);
357 // Clone the paragraphs within the selection.
358 ParagraphList copy_pars(boost::next(pars.begin(), startpit),
359 boost::next(pars.begin(), endpit + 1));
361 // Remove the end of the last paragraph; afterwards, remove the beginning
362 // of the first paragraph. Keep this order - there may only be one paragraph!
363 // Do not track deletions here; this is an internal 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() == InsetBase::ERT_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() is defined for LyXText rather than ParagraphList
385 // Thus we must wrap copy_pars into a LyXText object and cross our fingers
387 copy_pars.swap(lt.paragraphs());
388 lt.acceptChanges(buf.params());
389 copy_pars.swap(lt.paragraphs());
391 cutstack.push(make_pair(copy_pars, tc));
401 docstring grabAndEraseSelection(LCursor & cur)
403 if (!cur.selection())
405 docstring res = grabSelection(cur);
411 void switchBetweenClasses(textclass_type c1, textclass_type c2,
412 InsetText & in, ErrorList & errorlist)
414 BOOST_ASSERT(!in.paragraphs().empty());
418 LyXTextClass const & tclass1 = textclasslist[c1];
419 LyXTextClass const & tclass2 = textclasslist[c2];
422 ParIterator end = par_iterator_end(in);
423 for (ParIterator it = par_iterator_begin(in); it != end; ++it) {
424 string const name = it->layout()->name();
425 bool hasLayout = tclass2.hasLayout(name);
428 it->layout(tclass2[name]);
430 it->layout(tclass2.defaultLayout());
432 if (!hasLayout && name != tclass1.defaultLayoutName()) {
433 docstring const s = bformat(
434 _("Layout had to be changed from\n%1$s to %2$s\n"
435 "because of class conversion from\n%3$s to %4$s"),
436 from_utf8(name), from_utf8(it->layout()->name()),
437 from_utf8(tclass1.name()), from_utf8(tclass2.name()));
438 // To warn the user that something had to be done.
439 errorlist.push_back(ErrorItem(_("Changed Layout"), s,
446 InsetIterator const i_end = inset_iterator_end(in);
447 for (InsetIterator it = inset_iterator_begin(in); it != i_end; ++it) {
448 if (it->lyxCode() == InsetBase::CHARSTYLE_CODE) {
449 InsetCharStyle & inset =
450 static_cast<InsetCharStyle &>(*it);
451 string const name = inset.params().type;
452 CharStyles::iterator const found_cs =
453 tclass2.charstyle(name);
454 if (found_cs == tclass2.charstyles().end()) {
455 // The character style is undefined in tclass2
456 inset.setUndefined();
457 docstring const s = bformat(_(
458 "Character style %1$s is "
459 "undefined because of class "
460 "conversion from\n%2$s to %3$s"),
461 from_utf8(name), from_utf8(tclass1.name()),
462 from_utf8(tclass2.name()));
463 // To warn the user that something had to be done.
464 errorlist.push_back(ErrorItem(
465 _("Undefined character style"),
466 s, it.paragraph().id(), it.pos(), it.pos() + 1));
467 } else if (inset.undefined()) {
468 // The character style is undefined in
469 // tclass1 and is defined in tclass2
470 inset.setDefined(found_cs);
477 std::vector<docstring> const availableSelections(Buffer const & buffer)
479 vector<docstring> selList;
481 CutStack::const_iterator cit = theCuts.begin();
482 CutStack::const_iterator end = theCuts.end();
483 for (; cit != end; ++cit) {
484 // we do not use cit-> here because gcc 2.9x does not
486 ParagraphList const & pars = (*cit).first;
488 ParagraphList::const_iterator pit = pars.begin();
489 ParagraphList::const_iterator pend = pars.end();
490 for (; pit != pend; ++pit) {
491 asciiSel += pit->asString(buffer, false);
492 if (asciiSel.size() > 25) {
493 asciiSel.replace(22, docstring::npos,
499 selList.push_back(asciiSel);
506 size_type numberOfSelections()
508 return theCuts.size();
512 void cutSelection(LCursor & cur, bool doclear, bool realcut)
514 // This doesn't make sense, if there is no selection
515 if (!cur.selection())
518 // OK, we have a selection. This is always between cur.selBegin()
521 if (cur.inTexted()) {
522 LyXText * text = cur.text();
525 // make sure that the depth behind the selection are restored, too
526 recordUndoSelection(cur);
527 pit_type begpit = cur.selBegin().pit();
528 pit_type endpit = cur.selEnd().pit();
530 int endpos = cur.selEnd().pos();
532 BufferParams const & bp = cur.buffer().params();
534 copySelectionHelper(cur.buffer(),
537 cur.selBegin().pos(), endpos,
538 bp.textclass, theCuts);
539 // Stuff what we got on the clipboard.
540 // Even if there is no selection.
541 putClipboard(theCuts[0].first, theCuts[0].second,
542 cur.selectionAsString(true));
545 boost::tie(endpit, endpos) =
546 eraseSelectionHelper(bp,
549 cur.selBegin().pos(), endpos,
552 // cutSelection can invalidate the cursor so we need to set
554 // we prefer the end for when tracking changes
558 // sometimes necessary
560 && text->paragraphs()[begpit].stripLeadingSpaces(bp.trackChanges))
563 // need a valid cursor. (Lgb)
564 cur.clearSelection();
565 updateLabels(cur.buffer());
566 theSelection().haveSelection(false);
568 // tell tabular that a recent copy happened
569 dirtyTabularStack(false);
572 if (cur.inMathed()) {
573 if (cur.selBegin().idx() != cur.selEnd().idx()) {
574 // The current selection spans more than one cell.
576 recordUndoInset(cur);
578 // Record only the current cell to avoid a jumping
589 void copySelection(LCursor & cur)
591 copySelection(cur, cur.selectionAsString(true));
597 void copySelectionToStack(LCursor & cur, CutStack & cutstack)
599 // this doesn't make sense, if there is no selection
600 if (!cur.selection())
603 if (cur.inTexted()) {
604 LyXText * text = cur.text();
606 // ok we have a selection. This is always between cur.selBegin()
607 // and sel_end cursor
609 // copy behind a space if there is one
610 ParagraphList & pars = text->paragraphs();
611 pos_type pos = cur.selBegin().pos();
612 pit_type par = cur.selBegin().pit();
613 while (pos < pars[par].size() &&
614 pars[par].isLineSeparator(pos) &&
615 (par != cur.selEnd().pit() || pos < cur.selEnd().pos()))
618 copySelectionHelper(cur.buffer(), pars, par, cur.selEnd().pit(),
619 pos, cur.selEnd().pos(), cur.buffer().params().textclass, cutstack);
622 if (cur.inMathed()) {
623 //lyxerr << "copySelection in mathed" << endl;
626 BufferParams const & bp = cur.buffer().params();
627 par.layout(bp.getLyXTextClass().defaultLayout());
628 par.insert(0, grabSelection(cur), LyXFont(), Change(Change::UNCHANGED));
630 cutstack.push(make_pair(pars, bp.textclass));
637 void copySelectionToStack()
639 if (!selectionBuffer.empty())
640 theCuts.push(selectionBuffer[0]);
644 void copySelection(LCursor & cur, docstring const & plaintext)
646 // In tablemode, because copy and paste actually use special table stack
647 // we do not attemp to get selected paragraphs under cursor. Instead, a
648 // paragraph with the plain text version is generated so that table cells
649 // can be pasted as pure text somewhere else.
650 if (cur.selBegin().idx() != cur.selEnd().idx()) {
653 BufferParams const & bp = cur.buffer().params();
654 par.layout(bp.getLyXTextClass().defaultLayout());
655 par.insert(0, plaintext, LyXFont(), Change(Change::UNCHANGED));
657 theCuts.push(make_pair(pars, bp.textclass));
659 copySelectionToStack(cur, theCuts);
661 // stuff the selection onto the X clipboard, from an explicit copy request
662 putClipboard(theCuts[0].first, theCuts[0].second, plaintext);
666 void saveSelection(LCursor & cur)
668 if (lyxerr.debugging(Debug::ACTION))
669 lyxerr << BOOST_CURRENT_FUNCTION << ": `"
670 << to_utf8(cur.selectionAsString(true)) << "'."
674 copySelectionToStack(cur, selectionBuffer);
675 // tell X whether we now have a valid selection
676 theSelection().haveSelection(cur.selection());
682 return !selectionBuffer.empty();
686 void clearSelection()
688 selectionBuffer.clear();
692 docstring getSelection(Buffer const & buf, size_t sel_index)
694 return sel_index < theCuts.size()
695 ? theCuts[sel_index].first.back().asString(buf, false)
700 void pasteParagraphList(LCursor & cur, ParagraphList const & parlist,
701 textclass_type textclass, ErrorList & errorList)
703 if (cur.inTexted()) {
704 LyXText * text = cur.text();
710 boost::tie(ppp, endpit) =
711 pasteSelectionHelper(cur, parlist,
712 textclass, errorList);
713 updateLabels(cur.buffer());
714 cur.clearSelection();
715 text->setCursor(cur.top(), ppp.first, ppp.second);
718 // mathed is handled in InsetMathNest/InsetMathGrid
719 BOOST_ASSERT(!cur.inMathed());
723 void pasteFromStack(LCursor & cur, ErrorList & errorList, size_t sel_index)
725 // this does not make sense, if there is nothing to paste
726 if (!checkPastePossible(sel_index))
730 pasteParagraphList(cur, theCuts[sel_index].first,
731 theCuts[sel_index].second, errorList);
737 void pasteClipboard(LCursor & 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().textclass, 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(LCursor & cur, ErrorList & errorList)
777 if (selectionBuffer.empty())
780 pasteParagraphList(cur, selectionBuffer[0].first,
781 selectionBuffer[0].second, errorList);
786 void replaceSelectionWithString(LCursor & cur, docstring const & str, bool backwards)
789 DocIterator selbeg = cur.selectionBegin();
791 // Get font setting before we cut
793 selbeg.paragraph().getFontSettings(cur.buffer().params(), selbeg.pos());
795 // Insert the new string
796 pos_type pos = cur.selEnd().pos();
797 Paragraph & par = cur.selEnd().paragraph();
798 docstring::const_iterator cit = str.begin();
799 docstring::const_iterator end = str.end();
800 for (; cit != end; ++cit, ++pos)
801 par.insertChar(pos, *cit, font, cur.buffer().params().trackChanges);
804 cutSelection(cur, true, false);
806 // select the replacement
808 selbeg.pos() += str.length();
809 cur.setSelection(selbeg, -int(str.length()));
811 cur.setSelection(selbeg, str.length());
816 void replaceSelection(LCursor & cur)
819 cutSelection(cur, true, false);
823 void eraseSelection(LCursor & cur)
825 //lyxerr << "cap::eraseSelection begin: " << cur << endl;
826 CursorSlice const & i1 = cur.selBegin();
827 CursorSlice const & i2 = cur.selEnd();
828 if (i1.inset().asInsetMath()) {
830 if (i1.idx() == i2.idx()) {
831 i1.cell().erase(i1.pos(), i2.pos());
832 // We may have deleted i1.cell(cur.pos()).
833 // Make sure that pos is valid.
834 if (cur.pos() > cur.lastpos())
835 cur.pos() = cur.lastpos();
837 InsetMath * p = i1.asInsetMath();
838 InsetBase::row_type r1, r2;
839 InsetBase::col_type c1, c2;
840 region(i1, i2, r1, r2, c1, c2);
841 for (InsetBase::row_type row = r1; row <= r2; ++row)
842 for (InsetBase::col_type col = c1; col <= c2; ++col)
843 p->cell(p->index(row, col)).clear();
844 // We've deleted the whole cell. Only pos 0 is valid.
847 // need a valid cursor. (Lgb)
848 cur.clearSelection();
849 theSelection().haveSelection(false);
851 lyxerr << "can't erase this selection 1" << endl;
853 //lyxerr << "cap::eraseSelection end: " << cur << endl;
857 void selDel(LCursor & cur)
859 //lyxerr << "cap::selDel" << endl;
865 void selClearOrDel(LCursor & cur)
867 //lyxerr << "cap::selClearOrDel" << endl;
868 if (lyxrc.auto_region_delete)
871 cur.selection() = false;
875 docstring grabSelection(LCursor const & cur)
877 if (!cur.selection())
880 // FIXME: What is wrong with the following?
882 std::ostringstream os;
883 for (DocIterator dit = cur.selectionBegin();
884 dit != cur.selectionEnd(); dit.forwardPos())
885 os << asString(dit.cell());
889 CursorSlice i1 = cur.selBegin();
890 CursorSlice i2 = cur.selEnd();
892 if (i1.idx() == i2.idx()) {
893 if (i1.inset().asInsetMath()) {
894 MathArray::const_iterator it = i1.cell().begin();
895 return asString(MathArray(it + i1.pos(), it + i2.pos()));
897 return from_ascii("unknown selection 1");
901 InsetBase::row_type r1, r2;
902 InsetBase::col_type c1, c2;
903 region(i1, i2, r1, r2, c1, c2);
906 if (i1.inset().asInsetMath()) {
907 for (InsetBase::row_type row = r1; row <= r2; ++row) {
910 for (InsetBase::col_type col = c1; col <= c2; ++col) {
913 data += asString(i1.asInsetMath()->
914 cell(i1.asInsetMath()->index(row, col)));
918 data = from_ascii("unknown selection 2");
924 void dirtyTabularStack(bool b)
926 dirty_tabular_stack_ = b;
930 bool tabularStackDirty()
932 return dirty_tabular_stack_;