]> git.lyx.org Git - lyx.git/commitdiff
Fix multiple cell pasting on Windows and Mac (bug 4436):
authorJürgen Spitzmüller <spitz@lyx.org>
Fri, 28 Dec 2007 15:56:05 +0000 (15:56 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Fri, 28 Dec 2007 15:56:05 +0000 (15:56 +0000)
* 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
src/frontends/qt4/GuiClipboard.cpp
src/frontends/qt4/GuiClipboard.h
src/insets/InsetTabular.cpp

index 0db784c9268c8e9e19fe7bd87bf0b75ef085dfa0..812dd43a8426dd3dab100144e247d40a032a2c5d 100644 (file)
@@ -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.
index 188eafbbcefe545b306b4bfa2e7a3c66c1b8a879..8915ab92990fd52b6c67bb1ba20e12de361e2abb 100644 (file)
@@ -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()->
index da98c2b163136c4fb112bc90a36774e3b9922510..71ff17435ad79dcd5aa51eb9de3d12c8069a0f52 100644 (file)
@@ -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;
        //@}
 
index b8f8b5562a178b1a736a5cb821e8c7505773b99a..2908f2671b66865f8ada4ca3a1f222a75058d536 100644 (file)
@@ -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;