]> git.lyx.org Git - features.git/commitdiff
re-enable paste in tables
authorAndré Pönitz <poenitz@gmx.net>
Mon, 17 Nov 2003 13:20:34 +0000 (13:20 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Mon, 17 Nov 2003 13:20:34 +0000 (13:20 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8093 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/insettabular.C
src/insets/insettext.C

index 20acf61fe5e9741af58520c8e36429d7cc3dad6a..47a1502d17ac93e6fcf16a6e6a03d55a5177e141 100644 (file)
@@ -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
index 42416b8e9f65ac0aba13487d09fb131b061c8f8b..61d647abe2a6ecd26373c8319eea2962d449d46b 100644 (file)
@@ -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);