mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-11 16:31:09 +00:00
re-enable paste in tables
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8093 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2956e084bb
commit
4003db620d
@ -761,7 +761,6 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
|
|||||||
string const clip = bv->getClipboard();
|
string const clip = bv->getClipboard();
|
||||||
if (clip.empty())
|
if (clip.empty())
|
||||||
break;
|
break;
|
||||||
#if 0
|
|
||||||
if (clip.find('\t') != string::npos) {
|
if (clip.find('\t') != string::npos) {
|
||||||
int cols = 1;
|
int cols = 1;
|
||||||
int rows = 1;
|
int rows = 1;
|
||||||
@ -787,27 +786,28 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
|
|||||||
maxCols = max(cols, maxCols);
|
maxCols = max(cols, maxCols);
|
||||||
|
|
||||||
paste_tabular.reset(
|
paste_tabular.reset(
|
||||||
new LyXTabular(bv->buffer()->params(),
|
new LyXTabular(bv->buffer()->params(), rows, maxCols));
|
||||||
this, rows, maxCols)
|
|
||||||
);
|
|
||||||
|
|
||||||
string::size_type op = 0;
|
string::size_type op = 0;
|
||||||
int cell = 0;
|
int cell = 0;
|
||||||
int cells = paste_tabular->getNumberOfCells();
|
int cells = paste_tabular->getNumberOfCells();
|
||||||
p = 0;
|
p = 0;
|
||||||
cols = 0;
|
cols = 0;
|
||||||
|
LyXFont font;
|
||||||
while (cell < cells && p < len &&
|
while (cell < cells && p < len &&
|
||||||
(p = clip.find_first_of("\t\n", p)) != string::npos) {
|
(p = clip.find_first_of("\t\n", p)) != string::npos) {
|
||||||
if (p >= len)
|
if (p >= len)
|
||||||
break;
|
break;
|
||||||
switch (clip[p]) {
|
switch (clip[p]) {
|
||||||
case '\t':
|
case '\t':
|
||||||
paste_tabular->getCellInset(cell)->setText(clip.substr(op, p-op));
|
paste_tabular->getCellInset(cell).
|
||||||
|
setText(clip.substr(op, p-op), font);
|
||||||
++cols;
|
++cols;
|
||||||
++cell;
|
++cell;
|
||||||
break;
|
break;
|
||||||
case '\n':
|
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)
|
while (cols++ < maxCols)
|
||||||
++cell;
|
++cell;
|
||||||
cols = 0;
|
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'
|
// check for the last cell if there is no trailing '\n'
|
||||||
if (cell < cells && op < len)
|
if (cell < cells && op < len)
|
||||||
paste_tabular->getCellInset(cell)->setText(clip.substr(op, len-op));
|
paste_tabular->getCellInset(cell).
|
||||||
} else
|
setText(clip.substr(op, len-op), font);
|
||||||
#else
|
} else if (!insertAsciiString(bv, clip, true))
|
||||||
if (!insertAsciiString(bv, clip, true))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// so that the clipboard is used and it goes on
|
// so that the clipboard is used and it goes on
|
||||||
// to default
|
// to default
|
||||||
|
@ -519,31 +519,6 @@ DispatchResult InsetText::priv_dispatch(FuncRequest const & cmd,
|
|||||||
result.update(true);
|
result.update(true);
|
||||||
break;
|
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:
|
case LFUN_BREAKPARAGRAPH:
|
||||||
if (!autoBreakRows_) {
|
if (!autoBreakRows_) {
|
||||||
result.dispatched(true);
|
result.dispatched(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user