#include "frontends/Clipboard.h"
#include "frontends/Painter.h"
#include "frontends/Selection.h"
-#include "frontends/nullpainter.h"
#include <sstream>
#include <iostream>
//lyxerr << "InsetTabular::draw: " << x << " " << y << endl;
BufferView * bv = pi.base.bv;
- static frontend::NullPainter nop;
- static PainterInfo nullpi(bv, nop);
-
resetPos(bv->cursor());
x += scx_;
|| nx > bv->workWidth()
|| y + d < 0
|| y - a > bv->workHeight()) {
- cell(idx)->draw(nullpi, cx, y);
- drawCellLines(nop, nx, y, i, idx, pi.erased_);
+ pi.pain.setDrawingEnabled(false);
+ cell(idx)->draw(pi, cx, y);
+ drawCellLines(pi.pain, nx, y, i, idx, pi.erased_);
+ pi.pain.setDrawingEnabled(true);
} else {
cell(idx)->draw(pi, cx, y);
drawCellLines(pi.pain, nx, y, i, idx, pi.erased_);
cur.idx() = tabular.getCellBelow(cur.idx());
cur.pit() = 0;
cur.pos() = cell(cur.idx())->getText(0)->x2pos(
- cur.pit(), 0, cur.targetX());
+ cur.bv(), cur.pit(), 0, cur.targetX());
}
if (sl == cur.top()) {
// we trick it to go to the RIGHT after leaving the
cur.pit() = cur.lastpit();
LyXText const * text = cell(cur.idx())->getText(0);
cur.pos() = text->x2pos(
+ cur.bv(),
cur.pit(),
text->paragraphs().back().rows().size()-1,
cur.targetX());
}
+void InsetTabular::acceptChanges()
+{
+ for (idx_type idx = 0; idx < nargs(); ++idx)
+ cell(idx)->acceptChanges();
+}
+
+
+void InsetTabular::rejectChanges()
+{
+ for (idx_type idx = 0; idx < nargs(); ++idx)
+ cell(idx)->rejectChanges();
+}
+
+
bool InsetTabular::forceDefaultParagraphs(idx_type cell) const
{
return tabular.getPWidth(cell).zero();
if (buf.length() <= 0)
return true;
+ Buffer const & buffer = *bv.buffer();
+
col_type cols = 1;
row_type rows = 1;
col_type maxCols = 1;
row_type row = 0;
if (usePaste) {
paste_tabular.reset(
- new LyXTabular(bv.buffer()->params(), rows, maxCols));
+ new LyXTabular(buffer.params(), rows, maxCols));
loctab = paste_tabular.get();
cols = 0;
dirtyTabularStack(true);
// we can only set this if we are not too far right
if (cols < columns) {
shared_ptr<InsetText> inset = loctab->getCellInset(cell);
- inset->setViewCache(&bv);
Paragraph & par = inset->text_.getPar(0);
- LyXFont const font = inset->text_.getFont(par, 0);
+ LyXFont const font = inset->text_.getFont(buffer, par, 0);
inset->setText(buf.substr(op, p - op), font,
- bv.buffer()->params().trackChanges);
+ buffer.params().trackChanges);
++cols;
++cell;
}
// we can only set this if we are not too far right
if (cols < columns) {
shared_ptr<InsetText> inset = tabular.getCellInset(cell);
- inset->setViewCache(&bv);
Paragraph & par = inset->text_.getPar(0);
- LyXFont const font = inset->text_.getFont(par, 0);
+ LyXFont const font = inset->text_.getFont(buffer, par, 0);
inset->setText(buf.substr(op, p - op), font,
- bv.buffer()->params().trackChanges);
+ buffer.params().trackChanges);
}
cols = ocol;
++row;
// check for the last cell if there is no trailing '\n'
if (cell < cells && op < len) {
shared_ptr<InsetText> inset = loctab->getCellInset(cell);
- inset->setViewCache(&bv);
Paragraph & par = inset->text_.getPar(0);
- LyXFont const font = inset->text_.getFont(par, 0);
+ LyXFont const font = inset->text_.getFont(buffer, par, 0);
inset->setText(buf.substr(op, len - op), font,
- bv.buffer()->params().trackChanges);
+ buffer.params().trackChanges);
}
return true;
}