3 * \file qt4/GuiClipboard.C
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.
15 #include "GuiClipboard.h"
16 #include "qt_helpers.h"
20 #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] << "GuiClipboard::get: " << (const char*) str
64 return internalLineEnding(fromqstr(str));
68 void GuiClipboard::put(string const & str)
70 lyxerr[Debug::ACTION] << "GuiClipboard::put: " << str << endl;
72 qApp->clipboard()->setText(toqstr(externalLineEnding(str)), CLIPBOARD_MODE);
75 } // namespace frontend