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) {
156 colinfo_[col].lines_++;
157 } else if (c == 'c' || c == 'l' || c == 'r') {
158 colinfo_[col].align = c;
160 colinfo_[col].lines_ = 0;
162 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];
177 void MathGridInset::halign(char h, col_type col)
179 colinfo_[col].align = h;
183 char MathGridInset::halign(col_type col) const
185 return colinfo_[col].align;
189 string MathGridInset::halign() const
192 for (col_type col = 0; col < ncols(); ++col) {
193 res += string(colinfo_[col].lines_, '|');
194 res += colinfo_[col].align;
200 void MathGridInset::valign(char c)
206 char MathGridInset::valign() const
212 MathGridInset::col_type MathGridInset::ncols() const
214 return colinfo_.size();
218 MathGridInset::row_type MathGridInset::nrows() const
220 return rowinfo_.size();
224 MathGridInset::col_type MathGridInset::col(idx_type idx) const
226 return idx % ncols();
230 MathGridInset::row_type MathGridInset::row(idx_type idx) const
232 return idx / ncols();
236 void MathGridInset::vcrskip(LyXLength const & crskip, row_type row)
238 rowinfo_[row].crskip_ = crskip;
242 LyXLength MathGridInset::vcrskip(row_type row) const
244 return rowinfo_[row].crskip_;
248 void MathGridInset::metrics(MetricsInfo & mi) const
250 // let the cells adjust themselves
251 MathNestInset::metrics(mi);
253 // compute absolute sizes of vertical structure
254 for (row_type row = 0; row < nrows(); ++row) {
257 for (col_type col = 0; col < ncols(); ++col) {
258 MathArray const & c = cell(index(row, col));
259 asc = max(asc, c.ascent());
260 desc = max(desc, c.descent());
262 rowinfo_[row].ascent_ = asc;
263 rowinfo_[row].descent_ = desc;
265 rowinfo_[0].ascent_ += hlinesep() * rowinfo_[0].lines_;
267 // compute vertical offsets
268 rowinfo_[0].offset_ = 0;
269 for (row_type row = 1; row < nrows(); ++row) {
270 rowinfo_[row].offset_ =
271 rowinfo_[row - 1].offset_ +
272 rowinfo_[row - 1].descent_ +
273 rowinfo_[row - 1].skipPixels() +
275 rowinfo_[row].lines_ * hlinesep() +
276 rowinfo_[row].ascent_;
279 // adjust vertical offset
286 h = rowinfo_[nrows() - 1].offset_;
289 h = rowinfo_[nrows() - 1].offset_ / 2;
291 for (row_type row = 0; row < nrows(); ++row)
292 rowinfo_[row].offset_ -= h;
295 // compute absolute sizes of horizontal structure
296 for (col_type col = 0; col < ncols(); ++col) {
298 for (row_type row = 0; row < nrows(); ++row)
299 wid = max(wid, cell(index(row, col)).width());
300 colinfo_[col].width_ = wid;
303 // compute horizontal offsets
304 colinfo_[0].offset_ = border();
305 for (col_type col = 1; col < ncols(); ++col) {
306 colinfo_[col].offset_ =
307 colinfo_[col - 1].offset_ +
308 colinfo_[col - 1].width_ +
309 colinfo_[col - 1].skip_ +
311 colinfo_[col].lines_ * vlinesep();
315 dim_.w = colinfo_[ncols() - 1].offset_
316 + colinfo_[ncols() - 1].width_
317 //+ vlinesep() * colinfo_[ncols()].lines_
320 dim_.a = - rowinfo_[0].offset_
321 + rowinfo_[0].ascent_
322 + hlinesep() * rowinfo_[0].lines_
325 dim_.d = rowinfo_[nrows() - 1].offset_
326 + rowinfo_[nrows() - 1].descent_
327 //+ hlinesep() * rowinfo_[nrows()].lines_
332 // Increase ws_[i] for 'R' columns (except the first one)
333 for (int i = 1; i < nc_; ++i)
334 if (align_[i] == 'R')
335 ws_[i] += 10 * df_width;
336 // Increase ws_[i] for 'C' column
337 if (align_[0] == 'C')
338 if (ws_[0] < 7 * workwidth / 8)
339 ws_[0] = 7 * workwidth / 8;
343 for (cxrow = row_.begin(); cxrow; ++cxrow) {
346 for (int i = 0; i < nc_; ++i) {
348 if (cxrow->getTab(i) <= 0) {
349 cxrow->setTab(i, df_width);
357 lf = (ws_[i] - cxrow->getTab(i))/2;
361 lf = ws_[i] - cxrow->getTab(i);
364 if (cxrow == row_.begin())
366 else if (cxrow.is_last())
367 lf = ws_[i] - cxrow->getTab(i);
369 lf = (ws_[i] - cxrow->getTab(i))/2;
372 int const ww = (isvoid) ? lf : lf + cxrow->getTab(i);
373 cxrow->setTab(i, lf + rg);
374 rg = ws_[i] - ww + colsep();
375 if (cxrow == row_.begin())
376 width += ws_[i] + colsep();
378 cxrow->setBaseline(cxrow->getBaseline() - ascent);
384 void MathGridInset::draw(PainterInfo & pi, int x, int y) const
386 for (idx_type idx = 0; idx < nargs(); ++idx)
387 cell(idx).draw(pi, x + cellXOffset(idx), y + cellYOffset(idx));
389 for (row_type row = 0; row < nrows(); ++row)
390 for (int i = 0; i < rowinfo_[row].lines_; ++i) {
391 int yy = y + rowinfo_[row].offset_ - rowinfo_[row].ascent_
392 - i * hlinesep() - hlinesep()/2 - rowsep()/2;
393 pi.pain.line(x + 1, yy, x + width() - 1, yy);
396 for (col_type col = 0; col < ncols(); ++col)
397 for (int i = 0; i < colinfo_[col].lines_; ++i) {
398 int xx = x + colinfo_[col].offset_
399 - i * vlinesep() - vlinesep()/2 - colsep()/2;
400 pi.pain.line(xx, y - ascent() + 1, xx, y + descent() - 1);
405 void MathGridInset::metricsT(TextMetricsInfo const & mi) const
407 // let the cells adjust themselves
408 //MathNestInset::metrics(mi);
409 for (idx_type i = 0; i < nargs(); ++i)
410 cell(i).metricsT(mi);
412 // compute absolute sizes of vertical structure
413 for (row_type row = 0; row < nrows(); ++row) {
416 for (col_type col = 0; col < ncols(); ++col) {
417 MathArray const & c = cell(index(row, col));
418 asc = max(asc, c.ascent());
419 desc = max(desc, c.descent());
421 rowinfo_[row].ascent_ = asc;
422 rowinfo_[row].descent_ = desc;
424 //rowinfo_[0].ascent_ += hlinesep() * rowinfo_[0].lines_;
426 // compute vertical offsets
427 rowinfo_[0].offset_ = 0;
428 for (row_type row = 1; row < nrows(); ++row) {
429 rowinfo_[row].offset_ =
430 rowinfo_[row - 1].offset_ +
431 rowinfo_[row - 1].descent_ +
432 //rowinfo_[row - 1].skipPixels() +
434 //rowinfo_[row].lines_ * hlinesep() +
435 rowinfo_[row].ascent_;
438 // adjust vertical offset
445 h = rowinfo_[nrows() - 1].offset_;
448 h = rowinfo_[nrows() - 1].offset_ / 2;
450 for (row_type row = 0; row < nrows(); ++row)
451 rowinfo_[row].offset_ -= h;
454 // compute absolute sizes of horizontal structure
455 for (col_type col = 0; col < ncols(); ++col) {
457 for (row_type row = 0; row < nrows(); ++row)
458 wid = max(wid, cell(index(row, col)).width());
459 colinfo_[col].width_ = wid;
462 // compute horizontal offsets
463 colinfo_[0].offset_ = border();
464 for (col_type col = 1; col < ncols(); ++col) {
465 colinfo_[col].offset_ =
466 colinfo_[col - 1].offset_ +
467 colinfo_[col - 1].width_ +
468 colinfo_[col - 1].skip_ +
470 //colinfo_[col].lines_ * vlinesep();
474 dim_.w = colinfo_[ncols() - 1].offset_
475 + colinfo_[ncols() - 1].width_
476 //+ vlinesep() * colinfo_[ncols()].lines_
479 dim_.a = -rowinfo_[0].offset_
480 + rowinfo_[0].ascent_
481 //+ hlinesep() * rowinfo_[0].lines_
484 dim_.d = rowinfo_[nrows() - 1].offset_
485 + rowinfo_[nrows() - 1].descent_
486 //+ hlinesep() * rowinfo_[nrows()].lines_
492 void MathGridInset::drawT(TextPainter & pain, int x, int y) const
494 for (idx_type idx = 0; idx < nargs(); ++idx)
495 cell(idx).drawT(pain, x + cellXOffset(idx), y + cellYOffset(idx));
499 string MathGridInset::eolString(row_type row, bool fragile) const
503 if (!rowinfo_[row].crskip_.zero())
504 eol += '[' + rowinfo_[row].crskip_.asLatexString() + ']';
506 // make sure an upcoming '[' does not break anything
507 if (row + 1 < nrows()) {
508 MathArray const & c = cell(index(row + 1, 0));
509 if (c.size() && c.front()->getChar() == '[')
514 // only add \\ if necessary
515 if (eol.empty() && row + 1 == nrows())
518 return (fragile ? "\\protect\\\\" : "\\\\") + eol;
522 string MathGridInset::eocString(col_type col, col_type lastcol) const
524 if (col + 1 == lastcol)
530 void MathGridInset::addRow(row_type row)
532 rowinfo_.insert(rowinfo_.begin() + row + 1, RowInfo());
534 (cells_.begin() + (row + 1) * ncols(), ncols(), MathArray());
536 (cellinfo_.begin() + (row + 1) * ncols(), ncols(), CellInfo());
540 void MathGridInset::appendRow()
542 rowinfo_.push_back(RowInfo());
543 //cells_.insert(cells_.end(), ncols(), MathArray());
544 for (col_type col = 0; col < ncols(); ++col) {
545 cells_.push_back(cells_type::value_type());
546 cellinfo_.push_back(CellInfo());
551 void MathGridInset::delRow(row_type row)
556 cells_type::iterator it = cells_.begin() + row * ncols();
557 cells_.erase(it, it + ncols());
559 vector<CellInfo>::iterator jt = cellinfo_.begin() + row * ncols();
560 cellinfo_.erase(jt, jt + ncols());
562 rowinfo_.erase(rowinfo_.begin() + row);
566 void MathGridInset::copyRow(row_type row)
569 for (col_type col = 0; col < ncols(); ++col)
570 cells_[(row + 1) * ncols() + col] = cells_[row * ncols() + col];
574 void MathGridInset::swapRow(row_type row)
578 if (row + 1 == nrows())
580 for (col_type col = 0; col < ncols(); ++col)
581 swap(cells_[row * ncols() + col], cells_[(row + 1) * ncols() + col]);
585 void MathGridInset::addCol(col_type newcol)
587 const col_type nc = ncols();
588 const row_type nr = nrows();
589 cells_type new_cells((nc + 1) * nr);
590 vector<CellInfo> new_cellinfo((nc + 1) * nr);
592 for (row_type row = 0; row < nr; ++row)
593 for (col_type col = 0; col < nc; ++col) {
594 new_cells[row * (nc + 1) + col + (col > newcol)]
595 = cells_[row * nc + col];
596 new_cellinfo[row * (nc + 1) + col + (col > newcol)]
597 = cellinfo_[row * nc + col];
599 swap(cells_, new_cells);
600 swap(cellinfo_, new_cellinfo);
603 inf.skip_ = defaultColSpace(newcol);
604 inf.align = defaultColAlign(newcol);
605 colinfo_.insert(colinfo_.begin() + newcol, inf);
609 void MathGridInset::delCol(col_type col)
615 vector<CellInfo> tmpcellinfo;
616 for (col_type i = 0; i < nargs(); ++i)
617 if (i % ncols() != col) {
618 tmpcells.push_back(cells_[i]);
619 tmpcellinfo.push_back(cellinfo_[i]);
621 swap(cells_, tmpcells);
622 swap(cellinfo_, tmpcellinfo);
624 colinfo_.erase(colinfo_.begin() + col);
628 void MathGridInset::copyCol(col_type col)
631 for (row_type row = 0; row < nrows(); ++row)
632 cells_[row * ncols() + col + 1] = cells_[row * ncols() + col];
636 void MathGridInset::swapCol(col_type col)
640 if (col + 1 == ncols())
642 for (row_type row = 0; row < nrows(); ++row)
643 swap(cells_[row * ncols() + col], cells_[row * ncols() + col + 1]);
647 int MathGridInset::cellXOffset(idx_type idx) const
649 col_type c = col(idx);
650 int x = colinfo_[c].offset_;
651 char align = colinfo_[c].align;
652 if (align == 'r' || align == 'R')
653 x += colinfo_[c].width_ - cell(idx).width();
654 if (align == 'c' || align == 'C')
655 x += (colinfo_[c].width_ - cell(idx).width()) / 2;
660 int MathGridInset::cellYOffset(idx_type idx) const
662 return rowinfo_[row(idx)].offset_;
666 bool MathGridInset::idxUpDown(idx_type & idx, pos_type & pos, bool up,
673 pos = cell(idx).x2pos(targetx - cell(idx).xo());
676 if (idx >= ncols() * (nrows() - 1))
679 pos = cell(idx).x2pos(targetx - cell(idx).xo());
685 bool MathGridInset::idxLeft(idx_type & idx, pos_type & pos) const
687 // leave matrix if on the left hand edge
691 pos = cell(idx).size();
696 bool MathGridInset::idxRight(idx_type & idx, pos_type & pos) const
698 // leave matrix if on the right hand edge
699 if (col(idx) + 1 == ncols())
707 bool MathGridInset::idxFirst(idx_type & idx, pos_type & pos) const
714 idx = (nrows() - 1) * ncols();
717 idx = ((nrows() - 1) / 2) * ncols();
724 bool MathGridInset::idxLast(idx_type & idx, pos_type & pos) const
734 idx = ((nrows() - 1) / 2 + 1) * ncols() - 1;
736 pos = cell(idx).size();
741 bool MathGridInset::idxHome(idx_type & idx, pos_type & pos) const
748 idx -= idx % ncols();
761 bool MathGridInset::idxEnd(idx_type & idx, pos_type & pos) const
763 if (pos < cell(idx).size()) {
764 pos = cell(idx).size();
767 if (col(idx) < ncols() - 1) {
768 idx = idx - idx % ncols() + ncols() - 1;
769 pos = cell(idx).size();
772 if (idx < nargs() - 1) {
774 pos = cell(idx).size();
781 bool MathGridInset::idxDelete(idx_type & idx)
783 // nothing to do if we have just one row
787 // nothing to do if we are in the middle of the last row of the inset
788 if (idx + ncols() > nargs())
791 // try to delete entire sequence of ncols() empty cells if possible
792 for (idx_type i = idx; i < idx + ncols(); ++i)
796 // move cells if necessary
797 for (idx_type i = index(row(idx), 0); i < idx; ++i)
798 std::swap(cell(i), cell(i + ncols()));
805 // undo effect of Ctrl-Tab (i.e. pull next cell)
806 //if (idx + 1 != nargs())
807 // cell(idx).swap(cell(idx + 1));
809 // we handled the event..
814 // reimplement old behaviour when pressing Delete in the last position
816 void MathGridInset::idxGlue(idx_type idx)
818 col_type c = col(idx);
819 if (c + 1 == ncols()) {
820 if (row(idx) + 1 != nrows()) {
821 for (col_type cc = 0; cc < ncols(); ++cc)
822 cell(idx).append(cell(idx + cc + 1));
823 delRow(row(idx) + 1);
826 cell(idx).append(cell(idx + 1));
827 for (col_type cc = c + 2; cc < ncols(); ++cc)
828 cell(idx - c + cc - 1) = cell(idx - c + cc);
829 cell(idx - c + ncols() - 1).clear();
834 MathGridInset::RowInfo const & MathGridInset::rowinfo(row_type row) const
836 return rowinfo_[row];
840 MathGridInset::RowInfo & MathGridInset::rowinfo(row_type row)
842 return rowinfo_[row];
846 bool MathGridInset::idxBetween(idx_type idx, idx_type from, idx_type to) const
848 row_type const ri = row(idx);
849 row_type const r1 = min(row(from), row(to));
850 row_type const r2 = max(row(from), row(to));
851 col_type const ci = col(idx);
852 col_type const c1 = min(col(from), col(to));
853 col_type const c2 = max(col(from), col(to));
854 return r1 <= ri && ri <= r2 && c1 <= ci && ci <= c2;
859 void MathGridInset::normalize(NormalStream & os) const
862 for (row_type row = 0; row < nrows(); ++row) {
864 for (col_type col = 0; col < ncols(); ++col)
865 os << "[cell " << cell(index(row, col)) << ']';
872 void MathGridInset::mathmlize(MathMLStream & os) const
874 os << MTag("mtable");
875 for (row_type row = 0; row < nrows(); ++row) {
877 for (col_type col = 0; col < ncols(); ++col)
878 os << cell(index(row, col));
881 os << ETag("mtable");
885 void MathGridInset::write(WriteStream & os) const
887 for (row_type row = 0; row < nrows(); ++row) {
888 os << verboseHLine(rowinfo_[row].lines_);
889 // don't write & and empty cells at end of line
890 col_type lastcol = 0;
891 bool emptyline = true;
892 for (col_type col = 0; col < ncols(); ++col)
893 if (!cell(index(row, col)).empty()) {
897 for (col_type col = 0; col < lastcol; ++col)
898 os << cell(index(row, col)) << eocString(col, lastcol);
899 os << eolString(row, os.fragile());
900 // append newline only if line wasn't completely empty
901 // and this was not the last line in the grid
902 if (!emptyline && row + 1 < nrows())
905 //string const s = verboseHLine(rowinfo_[nrows()].lines_);
906 //if (!s.empty() && s != " ") {
908 // os << "\\protect";
909 // os << "\\\\" << s;
914 int MathGridInset::colsep() const
920 int MathGridInset::rowsep() const
926 int MathGridInset::hlinesep() const
932 int MathGridInset::vlinesep() const
938 int MathGridInset::border() const
944 void MathGridInset::splitCell(idx_type & idx, pos_type & pos)
946 if (idx + 1 == nargs())
948 MathArray ar = cell(idx);
950 cell(idx).erase(pos, cell(idx).size());
953 cell(idx).insert(0, ar);
957 dispatch_result MathGridInset::dispatch
958 (FuncRequest const & cmd, idx_type & idx, pos_type & pos)
960 switch (cmd.action) {
962 case LFUN_MOUSE_RELEASE:
963 //if (cmd.button() == mouse_button::button3) {
964 // GridInsetMailer mailer(*this);
965 // mailer.showDialog();
966 // return DISPATCHED;
970 case LFUN_INSET_DIALOG_UPDATE: {
971 GridInsetMailer mailer(*this);
972 mailer.updateDialog(cmd.view());
976 // insert file functions
977 case LFUN_DELETE_LINE_FORWARD:
978 //autocorrect_ = false;
988 if (pos > cell(idx).size())
989 pos = cell(idx).size();
990 return DISPATCHED_POP;
992 case LFUN_CELL_SPLIT:
993 //bv->lockedInsetStoreUndo(Undo::EDIT);
995 return DISPATCHED_POP;
997 case LFUN_BREAKLINE: {
998 //bv->lockedInsetStoreUndo(Undo::INSERT);
999 row_type const r = row(idx);
1003 for (col_type c = col(idx) + 1; c < ncols(); ++c)
1004 std::swap(cell(index(r, c)), cell(index(r + 1, c)));
1007 splitCell(idx, pos);
1008 std::swap(cell(idx), cell(idx + ncols() - 1));
1011 pos = cell(idx).size();
1013 //mathcursor->normalize();
1014 return DISPATCHED_POP;
1017 case LFUN_TABULAR_FEATURE: {
1018 //lyxerr << "handling tabular-feature " << cmd.argument << "\n";
1019 istringstream is(cmd.argument);
1022 if (s == "valign-top")
1024 else if (s == "valign-center")
1026 else if (s == "valign-bottom")
1028 else if (s == "align-left")
1029 halign('l', col(idx));
1030 else if (s == "align-right")
1031 halign('r', col(idx));
1032 else if (s == "align-center")
1033 halign('c', col(idx));
1034 else if (s == "append-row")
1035 for (int i = 0, n = extractInt(is); i < n; ++i)
1037 else if (s == "delete-row")
1038 for (int i = 0, n = extractInt(is); i < n; ++i) {
1043 else if (s == "copy-row")
1044 for (int i = 0, n = extractInt(is); i < n; ++i)
1046 else if (s == "swap-row")
1048 else if (s == "append-column")
1049 for (int i = 0, n = extractInt(is); i < n; ++i) {
1050 row_type r = row(idx);
1051 col_type c = col(idx);
1055 else if (s == "delete-column")
1056 for (int i = 0, n = extractInt(is); i < n; ++i) {
1057 row_type r = row(idx);
1058 col_type c = col(idx);
1064 else if (s == "copy-column")
1066 else if (s == "swap-column")
1069 return UNDISPATCHED;
1070 lyxerr << "returning DISPATCHED_POP\n";
1071 return DISPATCHED_POP;
1075 //lyxerr << "pasting '" << cmd.argument << "'\n";
1076 MathGridInset grid(1, 1);
1077 mathed_parse_normal(grid, cmd.argument);
1078 if (grid.nargs() == 1) {
1079 // single cell/part of cell
1080 cell(idx).insert(pos, grid.cell(0));
1081 pos += grid.cell(0).size();
1084 col_type const numcols = min(grid.ncols(), ncols() - col(idx));
1085 row_type const numrows = min(grid.nrows(), nrows() - row(idx));
1086 for (row_type r = 0; r < numrows; ++r) {
1087 for (col_type c = 0; c < numcols; ++c) {
1088 idx_type i = index(r + row(idx), c + col(idx));
1089 cell(i).append(grid.cell(grid.index(r, c)));
1091 // append the left over horizontal cells to the last column
1092 idx_type i = index(r + row(idx), ncols() - 1);
1093 for (MathInset::col_type c = numcols; c < grid.ncols(); ++c)
1094 cell(i).append(grid.cell(grid.index(r, c)));
1096 // append the left over vertical cells to the last _cell_
1097 idx_type i = nargs() - 1;
1098 for (row_type r = numrows; r < grid.nrows(); ++r)
1099 for (col_type c = 0; c < grid.ncols(); ++c)
1100 cell(i).append(grid.cell(grid.index(r, c)));
1102 return DISPATCHED_POP;
1106 return MathNestInset::dispatch(cmd, idx, pos);
1108 return UNDISPATCHED;