string const clip = bv->getClipboard();
if (clip.empty())
break;
-#if 0
if (clip.find('\t') != string::npos) {
int cols = 1;
int rows = 1;
maxCols = max(cols, maxCols);
paste_tabular.reset(
- new LyXTabular(bv->buffer()->params(),
- this, rows, maxCols)
- );
+ new LyXTabular(bv->buffer()->params(), rows, maxCols));
string::size_type op = 0;
int cell = 0;
int cells = paste_tabular->getNumberOfCells();
p = 0;
cols = 0;
+ LyXFont font;
while (cell < cells && p < len &&
(p = clip.find_first_of("\t\n", p)) != string::npos) {
if (p >= len)
break;
switch (clip[p]) {
case '\t':
- paste_tabular->getCellInset(cell)->setText(clip.substr(op, p-op));
+ paste_tabular->getCellInset(cell).
+ setText(clip.substr(op, p-op), font);
++cols;
++cell;
break;
case '\n':
- paste_tabular->getCellInset(cell)->setText(clip.substr(op, p-op));
+ paste_tabular->getCellInset(cell).
+ setText(clip.substr(op, p-op), font);
while (cols++ < maxCols)
++cell;
cols = 0;
}
// check for the last cell if there is no trailing '\n'
if (cell < cells && op < len)
- paste_tabular->getCellInset(cell)->setText(clip.substr(op, len-op));
- } else
-#else
- if (!insertAsciiString(bv, clip, true))
-#endif
+ paste_tabular->getCellInset(cell).
+ setText(clip.substr(op, len-op), font);
+ } else if (!insertAsciiString(bv, clip, true))
{
// so that the clipboard is used and it goes on
// to default
result.update(true);
break;
- case LFUN_PASTE:
- if (!autoBreakRows_) {
- if (CutAndPaste::nrOfParagraphs() > 1) {
-#ifdef WITH_WARNINGS
-#warning FIXME horrendously bad UI
-#endif
- Alert::error(_("Paste failed"),
- _("Cannot include more than one paragraph."));
- }
- } else {
- replaceSelection(bv->getLyXText());
- size_t sel_index = 0;
- string const & arg = cmd.argument;
- if (isStrUnsignedInt(arg)) {
-#warning FIXME Check if the arg is in the domain of available selections.
- sel_index = strToUnsignedInt(arg);
- }
- text_.pasteSelection(sel_index);
- // bug 393
- text_.clearSelection();
-#warning should be also set dispatched here?
- result.update(true);
- }
- break;
-
case LFUN_BREAKPARAGRAPH:
if (!autoBreakRows_) {
result.dispatched(true);