1 #include "math_gridinset.h"
2 #include "math_mathmlstream.h"
3 #include "math_streamstr.h"
5 #include "funcrequest.h"
6 #include "frontends/Painter.h"
11 #include "insets/mailinset.h"
20 class GridInsetMailer : public MailInset {
22 GridInsetMailer(MathGridInset & inset) : inset_(inset) {}
24 virtual string const & name() const
26 static const string theName = "tabular";
30 virtual string const inset2string() const
33 //data << name() << " active_cell " << inset.getActCell() << '\n';
34 data << name() << " active_cell " << 0 << '\n';
41 InsetBase & inset() const { return inset_; }
42 MathGridInset & inset_;
46 void mathed_parse_normal(MathGridInset &, string const & argument);
50 string verboseHLine(int n)
53 for (int i = 0; i < n; ++i)
61 int extractInt(istream & is)
65 return (num == 0) ? 1 : num;
71 int MathGridInset::RowInfo::skipPixels() const
73 return crskip_.inBP();
78 //////////////////////////////////////////////////////////////
81 MathGridInset::MathGridInset(char v, string const & h)
82 : MathNestInset(1), rowinfo_(1), colinfo_(1), cellinfo_(1)
87 //lyxerr << "created grid with " << ncols() << " columns\n";
91 MathGridInset::MathGridInset()
92 : MathNestInset(1), rowinfo_(1), colinfo_(1), cellinfo_(1), v_align_('c')
98 MathGridInset::MathGridInset(col_type m, row_type n)
99 : MathNestInset(m * n),
100 rowinfo_(n), colinfo_(m), cellinfo_(m * n), v_align_('c')
106 MathGridInset::MathGridInset(col_type m, row_type n, char v, string const & h)
107 : MathNestInset(m * n),
108 rowinfo_(n), colinfo_(m), cellinfo_(m * n), v_align_(v)
116 MathGridInset::~MathGridInset()
118 GridInsetMailer mailer(*this);
123 MathInset * MathGridInset::clone() const
125 return new MathGridInset(*this);
129 MathInset::idx_type MathGridInset::index(row_type row, col_type col) const
131 return col + ncols() * row;
135 void MathGridInset::setDefaults()
138 lyxerr << "positive number of columns expected\n";
140 // lyxerr << "positive number of rows expected\n";
141 for (col_type col = 0; col < ncols(); ++col) {
142 colinfo_[col].align = defaultColAlign(col);
143 colinfo_[col].skip_ = defaultColSpace(col);
148 void MathGridInset::halign(string const & hh)
151 for (string::const_iterator it = hh.begin(); it != hh.end(); ++it) {
155 lyxerr << "handle column separator: '" << c << "'\n";
157 colinfo_[col].lines_++;
158 } else if (c == 'c' || c == 'l' || c == 'r') {
159 colinfo_[col].align = c;
161 colinfo_[col].lines_ = 0;
163 lyxerr << "unknown column separator: '" << c << "'\n";
167 col_type n = hh.size();
170 for (col_type col = 0; col < n; ++col)
171 colinfo_[col].align = hh[col];
176 void MathGridInset::halign(char h, col_type col)
178 colinfo_[col].align = h;
182 char MathGridInset::halign(col_type col) const
184 return colinfo_[col].align;
188 string MathGridInset::halign() const
191 for (col_type col = 0; col < ncols(); ++col) {
192 res += string(colinfo_[col].lines_, '|');
193 res += colinfo_[col].align;
199 void MathGridInset::valign(char c)
205 char MathGridInset::valign() const
211 MathGridInset::col_type MathGridInset::ncols() const
213 return colinfo_.size();
217 MathGridInset::row_type MathGridInset::nrows() const
219 return rowinfo_.size();
223 MathGridInset::col_type MathGridInset::col(idx_type idx) const
225 return idx % ncols();
229 MathGridInset::row_type MathGridInset::row(idx_type idx) const
231 return idx / ncols();
235 void MathGridInset::vcrskip(LyXLength const & crskip, row_type row)
237 rowinfo_[row].crskip_ = crskip;
241 LyXLength MathGridInset::vcrskip(row_type row) const
243 return rowinfo_[row].crskip_;
247 void MathGridInset::metrics(MetricsInfo & mi) const
249 // let the cells adjust themselves
250 MathNestInset::metrics(mi);
252 // compute absolute sizes of vertical structure
253 for (row_type row = 0; row < nrows(); ++row) {
256 for (col_type col = 0; col < ncols(); ++col) {
257 MathArray const & c = cell(index(row, col));
258 asc = max(asc, c.ascent());
259 desc = max(desc, c.descent());
261 rowinfo_[row].ascent_ = asc;
262 rowinfo_[row].descent_ = desc;
264 rowinfo_[0].ascent_ += hlinesep() * rowinfo_[0].lines_;
266 // compute vertical offsets
267 rowinfo_[0].offset_ = 0;
268 for (row_type row = 1; row < nrows(); ++row) {
269 rowinfo_[row].offset_ =
270 rowinfo_[row - 1].offset_ +
271 rowinfo_[row - 1].descent_ +
272 rowinfo_[row - 1].skipPixels() +
274 rowinfo_[row].lines_ * hlinesep() +
275 rowinfo_[row].ascent_;
278 // adjust vertical offset
285 h = rowinfo_[nrows() - 1].offset_;
288 h = rowinfo_[nrows() - 1].offset_ / 2;
290 for (row_type row = 0; row < nrows(); ++row)
291 rowinfo_[row].offset_ -= h;
294 // compute absolute sizes of horizontal structure
295 for (col_type col = 0; col < ncols(); ++col) {
297 for (row_type row = 0; row < nrows(); ++row)
298 wid = max(wid, cell(index(row, col)).width());
299 colinfo_[col].width_ = wid;
302 // compute horizontal offsets
303 colinfo_[0].offset_ = border();
304 for (col_type col = 1; col < ncols(); ++col) {
305 colinfo_[col].offset_ =
306 colinfo_[col - 1].offset_ +
307 colinfo_[col - 1].width_ +
308 colinfo_[col - 1].skip_ +
310 colinfo_[col].lines_ * vlinesep();
314 dim_.w = colinfo_[ncols() - 1].offset_
315 + colinfo_[ncols() - 1].width_
316 //+ vlinesep() * colinfo_[ncols()].lines_
319 dim_.a = - rowinfo_[0].offset_
320 + rowinfo_[0].ascent_
321 + hlinesep() * rowinfo_[0].lines_
324 dim_.d = rowinfo_[nrows() - 1].offset_
325 + rowinfo_[nrows() - 1].descent_
326 //+ hlinesep() * rowinfo_[nrows()].lines_
331 // Increase ws_[i] for 'R' columns (except the first one)
332 for (int i = 1; i < nc_; ++i)
333 if (align_[i] == 'R')
334 ws_[i] += 10 * df_width;
335 // Increase ws_[i] for 'C' column
336 if (align_[0] == 'C')
337 if (ws_[0] < 7 * workwidth / 8)
338 ws_[0] = 7 * workwidth / 8;
342 for (cxrow = row_.begin(); cxrow; ++cxrow) {
345 for (int i = 0; i < nc_; ++i) {
347 if (cxrow->getTab(i) <= 0) {
348 cxrow->setTab(i, df_width);
356 lf = (ws_[i] - cxrow->getTab(i))/2;
360 lf = ws_[i] - cxrow->getTab(i);
363 if (cxrow == row_.begin())
365 else if (cxrow.is_last())
366 lf = ws_[i] - cxrow->getTab(i);
368 lf = (ws_[i] - cxrow->getTab(i))/2;
371 int const ww = (isvoid) ? lf : lf + cxrow->getTab(i);
372 cxrow->setTab(i, lf + rg);
373 rg = ws_[i] - ww + colsep();
374 if (cxrow == row_.begin())
375 width += ws_[i] + colsep();
377 cxrow->setBaseline(cxrow->getBaseline() - ascent);
383 void MathGridInset::draw(PainterInfo & pi, int x, int y) const
385 for (idx_type idx = 0; idx < nargs(); ++idx)
386 cell(idx).draw(pi, x + cellXOffset(idx), y + cellYOffset(idx));
388 for (row_type row = 0; row < nrows(); ++row)
389 for (int i = 0; i < rowinfo_[row].lines_; ++i) {
390 int yy = y + rowinfo_[row].offset_ - rowinfo_[row].ascent_
391 - i * hlinesep() - hlinesep()/2 - rowsep()/2;
392 pi.pain.line(x + 1, yy, x + width() - 1, yy);
395 for (col_type col = 0; col < ncols(); ++col)
396 for (int i = 0; i < colinfo_[col].lines_; ++i) {
397 int xx = x + colinfo_[col].offset_
398 - i * vlinesep() - vlinesep()/2 - colsep()/2;
399 pi.pain.line(xx, y - ascent() + 1, xx, y + descent() - 1);
404 void MathGridInset::metricsT(TextMetricsInfo const & mi) const
406 // let the cells adjust themselves
407 //MathNestInset::metrics(mi);
408 for (idx_type i = 0; i < nargs(); ++i)
409 cell(i).metricsT(mi);
411 // compute absolute sizes of vertical structure
412 for (row_type row = 0; row < nrows(); ++row) {
415 for (col_type col = 0; col < ncols(); ++col) {
416 MathArray const & c = cell(index(row, col));
417 asc = max(asc, c.ascent());
418 desc = max(desc, c.descent());
420 rowinfo_[row].ascent_ = asc;
421 rowinfo_[row].descent_ = desc;
423 //rowinfo_[0].ascent_ += hlinesep() * rowinfo_[0].lines_;
425 // compute vertical offsets
426 rowinfo_[0].offset_ = 0;
427 for (row_type row = 1; row < nrows(); ++row) {
428 rowinfo_[row].offset_ =
429 rowinfo_[row - 1].offset_ +
430 rowinfo_[row - 1].descent_ +
431 //rowinfo_[row - 1].skipPixels() +
433 //rowinfo_[row].lines_ * hlinesep() +
434 rowinfo_[row].ascent_;
437 // adjust vertical offset
444 h = rowinfo_[nrows() - 1].offset_;
447 h = rowinfo_[nrows() - 1].offset_ / 2;
449 for (row_type row = 0; row < nrows(); ++row)
450 rowinfo_[row].offset_ -= h;
453 // compute absolute sizes of horizontal structure
454 for (col_type col = 0; col < ncols(); ++col) {
456 for (row_type row = 0; row < nrows(); ++row)
457 wid = max(wid, cell(index(row, col)).width());
458 colinfo_[col].width_ = wid;
461 // compute horizontal offsets
462 colinfo_[0].offset_ = border();
463 for (col_type col = 1; col < ncols(); ++col) {
464 colinfo_[col].offset_ =
465 colinfo_[col - 1].offset_ +
466 colinfo_[col - 1].width_ +
467 colinfo_[col - 1].skip_ +
469 //colinfo_[col].lines_ * vlinesep();
473 dim_.w = colinfo_[ncols() - 1].offset_
474 + colinfo_[ncols() - 1].width_
475 //+ vlinesep() * colinfo_[ncols()].lines_
478 dim_.a = -rowinfo_[0].offset_
479 + rowinfo_[0].ascent_
480 //+ hlinesep() * rowinfo_[0].lines_
483 dim_.d = rowinfo_[nrows() - 1].offset_
484 + rowinfo_[nrows() - 1].descent_
485 //+ hlinesep() * rowinfo_[nrows()].lines_
491 void MathGridInset::drawT(TextPainter & pain, int x, int y) const
493 for (idx_type idx = 0; idx < nargs(); ++idx)
494 cell(idx).drawT(pain, x + cellXOffset(idx), y + cellYOffset(idx));
498 string MathGridInset::eolString(row_type row, bool fragile) const
502 if (!rowinfo_[row].crskip_.zero())
503 eol += '[' + rowinfo_[row].crskip_.asLatexString() + ']';
505 // make sure an upcoming '[' does not break anything
506 if (row + 1 < nrows()) {
507 MathArray const & c = cell(index(row + 1, 0));
508 if (c.size() && c.front()->getChar() == '[')
513 // only add \\ if necessary
514 if (eol.empty() && row + 1 == nrows())
517 return (fragile ? "\\protect\\\\" : "\\\\") + eol;
521 string MathGridInset::eocString(col_type col, col_type lastcol) const
523 if (col + 1 == lastcol)
529 void MathGridInset::addRow(row_type row)
531 rowinfo_.insert(rowinfo_.begin() + row + 1, RowInfo());
533 (cells_.begin() + (row + 1) * ncols(), ncols(), MathArray());
535 (cellinfo_.begin() + (row + 1) * ncols(), ncols(), CellInfo());
539 void MathGridInset::appendRow()
541 rowinfo_.push_back(RowInfo());
542 //cells_.insert(cells_.end(), ncols(), MathArray());
543 for (col_type col = 0; col < ncols(); ++col) {
544 cells_.push_back(cells_type::value_type());
545 cellinfo_.push_back(CellInfo());
550 void MathGridInset::delRow(row_type row)
555 cells_type::iterator it = cells_.begin() + row * ncols();
556 cells_.erase(it, it + ncols());
558 vector<CellInfo>::iterator jt = cellinfo_.begin() + row * ncols();
559 cellinfo_.erase(jt, jt + ncols());
561 rowinfo_.erase(rowinfo_.begin() + row);
565 void MathGridInset::copyRow(row_type row)
568 for (col_type col = 0; col < ncols(); ++col)
569 cells_[(row + 1) * ncols() + col] = cells_[row * ncols() + col];
573 void MathGridInset::swapRow(row_type row)
577 if (row + 1 == nrows())
579 for (col_type col = 0; col < ncols(); ++col)
580 swap(cells_[row * ncols() + col], cells_[(row + 1) * ncols() + col]);
584 void MathGridInset::addCol(col_type newcol)
586 const col_type nc = ncols();
587 const row_type nr = nrows();
588 cells_type new_cells((nc + 1) * nr);
589 vector<CellInfo> new_cellinfo((nc + 1) * nr);
591 for (row_type row = 0; row < nr; ++row)
592 for (col_type col = 0; col < nc; ++col) {
593 new_cells[row * (nc + 1) + col + (col > newcol)]
594 = cells_[row * nc + col];
595 new_cellinfo[row * (nc + 1) + col + (col > newcol)]
596 = cellinfo_[row * nc + col];
598 swap(cells_, new_cells);
599 swap(cellinfo_, new_cellinfo);
602 inf.skip_ = defaultColSpace(newcol);
603 inf.align = defaultColAlign(newcol);
604 colinfo_.insert(colinfo_.begin() + newcol, inf);
608 void MathGridInset::delCol(col_type col)
614 vector<CellInfo> tmpcellinfo;
615 for (col_type i = 0; i < nargs(); ++i)
616 if (i % ncols() != col) {
617 tmpcells.push_back(cells_[i]);
618 tmpcellinfo.push_back(cellinfo_[i]);
620 swap(cells_, tmpcells);
621 swap(cellinfo_, tmpcellinfo);
623 colinfo_.erase(colinfo_.begin() + col);
627 void MathGridInset::copyCol(col_type col)
630 for (row_type row = 0; row < nrows(); ++row)
631 cells_[row * ncols() + col + 1] = cells_[row * ncols() + col];
635 void MathGridInset::swapCol(col_type col)
639 if (col + 1 == ncols())
641 for (row_type row = 0; row < nrows(); ++row)
642 swap(cells_[row * ncols() + col], cells_[row * ncols() + col + 1]);
646 int MathGridInset::cellXOffset(idx_type idx) const
648 col_type c = col(idx);
649 int x = colinfo_[c].offset_;
650 char align = colinfo_[c].align;
651 if (align == 'r' || align == 'R')
652 x += colinfo_[c].width_ - cell(idx).width();
653 if (align == 'c' || align == 'C')
654 x += (colinfo_[c].width_ - cell(idx).width()) / 2;
659 int MathGridInset::cellYOffset(idx_type idx) const
661 return rowinfo_[row(idx)].offset_;
665 bool MathGridInset::idxUpDown(idx_type & idx, pos_type & pos, bool up,
672 pos = cell(idx).x2pos(targetx - cell(idx).xo());
675 if (idx >= ncols() * (nrows() - 1))
678 pos = cell(idx).x2pos(targetx - cell(idx).xo());
684 bool MathGridInset::idxLeft(idx_type & idx, pos_type & pos) const
686 // leave matrix if on the left hand edge
690 pos = cell(idx).size();
695 bool MathGridInset::idxRight(idx_type & idx, pos_type & pos) const
697 // leave matrix if on the right hand edge
698 if (col(idx) + 1 == ncols())
706 bool MathGridInset::idxFirst(idx_type & idx, pos_type & pos) const
713 idx = (nrows() - 1) * ncols();
716 idx = ((nrows() - 1) / 2) * ncols();
723 bool MathGridInset::idxLast(idx_type & idx, pos_type & pos) const
733 idx = ((nrows() - 1) / 2 + 1) * ncols() - 1;
735 pos = cell(idx).size();
740 bool MathGridInset::idxHome(idx_type & idx, pos_type & pos) const
747 idx -= idx % ncols();
760 bool MathGridInset::idxEnd(idx_type & idx, pos_type & pos) const
762 if (pos < cell(idx).size()) {
763 pos = cell(idx).size();
766 if (col(idx) < ncols() - 1) {
767 idx = idx - idx % ncols() + ncols() - 1;
768 pos = cell(idx).size();
771 if (idx < nargs() - 1) {
773 pos = cell(idx).size();
780 bool MathGridInset::idxDelete(idx_type & idx)
782 // nothing to do if we have just one row
786 // nothing to do if we are in the middle of the last row of the inset
787 if (idx + ncols() > nargs())
790 // try to delete entire sequence of ncols() empty cells if possible
791 for (idx_type i = idx; i < idx + ncols(); ++i)
795 // move cells if necessary
796 for (idx_type i = index(row(idx), 0); i < idx; ++i)
797 std::swap(cell(i), cell(i + ncols()));
804 // undo effect of Ctrl-Tab (i.e. pull next cell)
805 //if (idx + 1 != nargs())
806 // cell(idx).swap(cell(idx + 1));
808 // we handled the event..
813 // reimplement old behaviour when pressing Delete in the last position
815 void MathGridInset::idxGlue(idx_type idx)
817 col_type c = col(idx);
818 if (c + 1 == ncols()) {
819 if (row(idx) + 1 != nrows()) {
820 for (col_type cc = 0; cc < ncols(); ++cc)
821 cell(idx).append(cell(idx + cc + 1));
822 delRow(row(idx) + 1);
825 cell(idx).append(cell(idx + 1));
826 for (col_type cc = c + 2; cc < ncols(); ++cc)
827 cell(idx - c + cc - 1) = cell(idx - c + cc);
828 cell(idx - c + ncols() - 1).clear();
833 MathGridInset::RowInfo const & MathGridInset::rowinfo(row_type row) const
835 return rowinfo_[row];
839 MathGridInset::RowInfo & MathGridInset::rowinfo(row_type row)
841 return rowinfo_[row];
845 bool MathGridInset::idxBetween(idx_type idx, idx_type from, idx_type to) const
847 row_type const ri = row(idx);
848 row_type const r1 = min(row(from), row(to));
849 row_type const r2 = max(row(from), row(to));
850 col_type const ci = col(idx);
851 col_type const c1 = min(col(from), col(to));
852 col_type const c2 = max(col(from), col(to));
853 return r1 <= ri && ri <= r2 && c1 <= ci && ci <= c2;
858 void MathGridInset::normalize(NormalStream & os) const
861 for (row_type row = 0; row < nrows(); ++row) {
863 for (col_type col = 0; col < ncols(); ++col)
864 os << "[cell " << cell(index(row, col)) << ']';
871 void MathGridInset::mathmlize(MathMLStream & os) const
873 os << MTag("mtable");
874 for (row_type row = 0; row < nrows(); ++row) {
876 for (col_type col = 0; col < ncols(); ++col)
877 os << cell(index(row, col));
880 os << ETag("mtable");
884 void MathGridInset::write(WriteStream & os) const
886 for (row_type row = 0; row < nrows(); ++row) {
887 os << verboseHLine(rowinfo_[row].lines_);
888 // don't write & and empty cells at end of line
889 col_type lastcol = 0;
890 bool emptyline = true;
891 for (col_type col = 0; col < ncols(); ++col)
892 if (!cell(index(row, col)).empty()) {
896 for (col_type col = 0; col < lastcol; ++col)
897 os << cell(index(row, col)) << eocString(col, lastcol);
898 os << eolString(row, os.fragile());
899 // append newline only if line wasn't completely empty
900 // and this was not the last line in the grid
901 if (!emptyline && row + 1 < nrows())
904 //string const s = verboseHLine(rowinfo_[nrows()].lines_);
905 //if (!s.empty() && s != " ") {
907 // os << "\\protect";
908 // os << "\\\\" << s;
913 int MathGridInset::colsep() const
919 int MathGridInset::rowsep() const
925 int MathGridInset::hlinesep() const
931 int MathGridInset::vlinesep() const
937 int MathGridInset::border() const
943 void MathGridInset::splitCell(idx_type & idx, pos_type & pos)
945 if (idx + 1 == nargs())
947 MathArray ar = cell(idx);
949 cell(idx).erase(pos, cell(idx).size());
952 cell(idx).insert(0, ar);
956 dispatch_result MathGridInset::dispatch
957 (FuncRequest const & cmd, idx_type & idx, pos_type & pos)
959 switch (cmd.action) {
961 case LFUN_MOUSE_RELEASE:
962 //if (cmd.button() == mouse_button::button3) {
963 // GridInsetMailer mailer(*this);
964 // mailer.showDialog();
965 // return DISPATCHED;
969 case LFUN_INSET_DIALOG_UPDATE: {
970 GridInsetMailer mailer(*this);
971 mailer.updateDialog(cmd.view());
975 // insert file functions
976 case LFUN_DELETE_LINE_FORWARD:
977 //autocorrect_ = false;
987 if (pos > cell(idx).size())
988 pos = cell(idx).size();
989 return DISPATCHED_POP;
991 case LFUN_CELL_SPLIT:
992 //bv->lockedInsetStoreUndo(Undo::EDIT);
994 return DISPATCHED_POP;
996 case LFUN_BREAKLINE: {
997 //bv->lockedInsetStoreUndo(Undo::INSERT);
998 row_type const r = row(idx);
1002 for (col_type c = col(idx) + 1; c < ncols(); ++c)
1003 std::swap(cell(index(r, c)), cell(index(r + 1, c)));
1006 splitCell(idx, pos);
1007 std::swap(cell(idx), cell(idx + ncols() - 1));
1010 pos = cell(idx).size();
1012 //mathcursor->normalize();
1013 return DISPATCHED_POP;
1016 case LFUN_TABULAR_FEATURE: {
1017 //lyxerr << "handling tabular-feature " << cmd.argument << "\n";
1018 istringstream is(cmd.argument);
1021 if (s == "valign-top")
1023 else if (s == "valign-center")
1025 else if (s == "valign-bottom")
1027 else if (s == "align-left")
1028 halign('l', col(idx));
1029 else if (s == "align-right")
1030 halign('r', col(idx));
1031 else if (s == "align-center")
1032 halign('c', col(idx));
1033 else if (s == "append-row")
1034 for (int i = 0, n = extractInt(is); i < n; ++i)
1036 else if (s == "delete-row")
1037 for (int i = 0, n = extractInt(is); i < n; ++i) {
1042 else if (s == "copy-row")
1043 for (int i = 0, n = extractInt(is); i < n; ++i)
1045 else if (s == "swap-row")
1047 else if (s == "append-column")
1048 for (int i = 0, n = extractInt(is); i < n; ++i) {
1049 row_type r = row(idx);
1050 col_type c = col(idx);
1054 else if (s == "delete-column")
1055 for (int i = 0, n = extractInt(is); i < n; ++i) {
1056 row_type r = row(idx);
1057 col_type c = col(idx);
1063 else if (s == "copy-column")
1065 else if (s == "swap-column")
1068 return UNDISPATCHED;
1069 lyxerr << "returning DISPATCHED_POP\n";
1070 return DISPATCHED_POP;
1074 //lyxerr << "pasting '" << cmd.argument << "'\n";
1075 MathGridInset grid(1, 1);
1076 mathed_parse_normal(grid, cmd.argument);
1077 if (grid.nargs() == 1) {
1078 // single cell/part of cell
1079 cell(idx).insert(pos, grid.cell(0));
1080 pos += grid.cell(0).size();
1083 col_type const numcols = min(grid.ncols(), ncols() - col(idx));
1084 row_type const numrows = min(grid.nrows(), nrows() - row(idx));
1085 for (row_type r = 0; r < numrows; ++r) {
1086 for (col_type c = 0; c < numcols; ++c) {
1087 idx_type i = index(r + row(idx), c + col(idx));
1088 cell(i).append(grid.cell(grid.index(r, c)));
1090 // append the left over horizontal cells to the last column
1091 idx_type i = index(r + row(idx), ncols() - 1);
1092 for (MathInset::col_type c = numcols; c < grid.ncols(); ++c)
1093 cell(i).append(grid.cell(grid.index(r, c)));
1095 // append the left over vertical cells to the last _cell_
1096 idx_type i = nargs() - 1;
1097 for (row_type r = numrows; r < grid.nrows(); ++r)
1098 for (col_type c = 0; c < grid.ncols(); ++c)
1099 cell(i).append(grid.cell(grid.index(r, c)));
1101 return DISPATCHED_POP;
1105 return MathNestInset::dispatch(cmd, idx, pos);
1107 return UNDISPATCHED;