Fix multiple cell pasting on Windows and Mac (bug 4436):

* src/frontends/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/branches/BRANCH_1_5_X@22326 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2007-12-28 15:58:28 +00:00
parent 80410d0386
commit 762a38c282
5 changed files with 21 additions and 1 deletions

View 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.

View File

@ -118,6 +118,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()->

View 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;
//@}

View File

@ -3449,7 +3449,8 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
}
case LFUN_PASTE:
if (tabularStackDirty() && theClipboard().isInternal()) {
if (tabularStackDirty() && (theClipboard().isInternal() ||
!theClipboard().hasInternal() && theClipboard().hasLyXContents())) {
recordUndoInset(cur, Undo::INSERT);
pasteClipboard(cur);
break;

View File

@ -80,6 +80,8 @@ What's new
- Overwrite selected text when inserting from the math panel (bug 4055,
part 2).
- Fix pasting of multiple tabular cells on Mac and Windows (bug 4436).
- Fix the function "mark-on" (bug 2913).
- Fix rows alignment in the gather environment (part of bug 1497).