From 4003db620da5bf8e5bb150e3e5e2fb21656f95f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Mon, 17 Nov 2003 13:20:34 +0000 Subject: [PATCH] re-enable paste in tables git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8093 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/insettabular.C | 20 +++++++++----------- src/insets/insettext.C | 25 ------------------------- 2 files changed, 9 insertions(+), 36 deletions(-) diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 20acf61fe5..47a1502d17 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -761,7 +761,6 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &) string const clip = bv->getClipboard(); if (clip.empty()) break; -#if 0 if (clip.find('\t') != string::npos) { int cols = 1; int rows = 1; @@ -787,27 +786,28 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &) 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; @@ -818,11 +818,9 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &) } // 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 diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 42416b8e9f..61d647abe2 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -519,31 +519,6 @@ DispatchResult InsetText::priv_dispatch(FuncRequest const & cmd, 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);