From 636b655216fd5fa0a8acd68f1310ce4a16c1b955 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Fri, 28 Dec 2007 15:56:05 +0000 Subject: [PATCH] Fix multiple cell pasting on Windows and Mac (bug 4436): * src/Clipboard.h: * src/frontends/GuiClipboard.{cpp,h}: - new member hasInternal() which indicates whether the OS knows the concept of clipboard ownership. * src/insets/InsetTabular.cpp (doDispatch): - consider hasInternal() while pasting. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22325 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/Clipboard.h | 3 +++ src/frontends/qt4/GuiClipboard.cpp | 13 +++++++++++++ src/frontends/qt4/GuiClipboard.h | 1 + src/insets/InsetTabular.cpp | 3 ++- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/frontends/Clipboard.h b/src/frontends/Clipboard.h index 0db784c926..812dd43a84 100644 --- a/src/frontends/Clipboard.h +++ b/src/frontends/Clipboard.h @@ -55,6 +55,9 @@ public: /// \returns true if the system clipboard has been set within LyX /// (document contents, dialogs count as external here). virtual bool isInternal() const = 0; + /// \returns true if the OS has the concept of clipboard ownership, + /// which is crucial for our concept of internal clipboard. + virtual bool hasInternal() const = 0; /// Is the clipboard empty? /// \returns true if both the LyX and the plaintext versions of the /// clipboard are empty. diff --git a/src/frontends/qt4/GuiClipboard.cpp b/src/frontends/qt4/GuiClipboard.cpp index 188eafbbce..8915ab9299 100644 --- a/src/frontends/qt4/GuiClipboard.cpp +++ b/src/frontends/qt4/GuiClipboard.cpp @@ -115,6 +115,19 @@ bool GuiClipboard::isInternal() const } +bool GuiClipboard::hasInternal() const +{ + // Windows and Mac OS X does not have the concept of ownership; + // the clipboard is a fully global resource so all applications + // are notified of changes. +#if (defined(Q_WS_X11)) + return true; +#else + return false; +#endif +} + + void GuiClipboard::on_dataChanged() { text_clipboard_empty_ = qApp->clipboard()-> diff --git a/src/frontends/qt4/GuiClipboard.h b/src/frontends/qt4/GuiClipboard.h index da98c2b163..71ff17435a 100644 --- a/src/frontends/qt4/GuiClipboard.h +++ b/src/frontends/qt4/GuiClipboard.h @@ -39,6 +39,7 @@ public: void put(std::string const & lyx, docstring const & text); bool hasLyXContents() const; bool isInternal() const; + bool hasInternal() const; bool empty() const; //@} diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index b8f8b5562a..2908f2671b 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -3473,7 +3473,8 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd) } case LFUN_PASTE: - if (tabularStackDirty() && theClipboard().isInternal()) { + if (tabularStackDirty() && theClipboard().isInternal() || + !theClipboard().hasInternal() && theClipboard().hasLyXContents()) { cur.recordUndoInset(INSERT_UNDO); pasteClipboard(cur); break; -- 2.39.2