4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Abdelrazak Younes
10 * Full author contact details are available in file CREDITS.
13 #include "GuiClipboard.h"
14 #include "qt_helpers.h"
18 #include <QApplication>
24 #include "support/lstrings.h"
25 using lyx::support::internalLineEnding;
26 using lyx::support::externalLineEnding;
35 QClipboard::Mode const CLIPBOARD_MODE = QClipboard::Selection;
37 // FIXME external clipboard support is mostly broken for windows
38 // because the following fixe would involves too much side effects WRT mouse selection.
39 //QClipboard::Mode const CLIPBOARD_MODE = QClipboard::Clipboard;
40 QClipboard::Mode const CLIPBOARD_MODE = QClipboard::Selection;
43 void GuiClipboard::haveSelection(bool own)
45 if (!qApp->clipboard()->supportsSelection())
49 qApp->clipboard()->setText(QString(), CLIPBOARD_MODE);
51 // We don't need to do anything if own = false, as this case is
56 string const GuiClipboard::get() const
58 QString str = qApp->clipboard()->text(CLIPBOARD_MODE);
59 lyxerr[Debug::ACTION] << "getClipboard: " << (const char*) str << endl;
63 return internalLineEnding(fromqstr(str));
67 void GuiClipboard::put(string const & str)
69 lyxerr[Debug::ACTION] << "putClipboard: " << str << endl;
71 qApp->clipboard()->setText(toqstr(externalLineEnding(str)), CLIPBOARD_MODE);
74 } // namespace frontend