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>
26 #include "support/lstrings.h"
27 using lyx::support::internalLineEnding;
28 using lyx::support::externalLineEnding;
37 QClipboard::Mode const CLIPBOARD_MODE = QClipboard::Selection;
39 // FIXME external clipboard support is mostly broken for windows
40 // because the following fixe would involves too much side effects WRT mouse selection.
41 //QClipboard::Mode const CLIPBOARD_MODE = QClipboard::Clipboard;
42 QClipboard::Mode const CLIPBOARD_MODE = QClipboard::Selection;
45 void GuiClipboard::haveSelection(bool own)
47 if (!qApp->clipboard()->supportsSelection())
51 qApp->clipboard()->setText(QString(), CLIPBOARD_MODE);
53 // We don't need to do anything if own = false, as this case is
58 string const GuiClipboard::get() const
60 QString str = qApp->clipboard()->text(CLIPBOARD_MODE);
61 lyxerr[Debug::ACTION] << "getClipboard: " << (const char*) str << endl;
65 return internalLineEnding(fromqstr(str));
69 void GuiClipboard::put(string const & str)
71 lyxerr[Debug::ACTION] << "putClipboard: " << str << endl;
73 qApp->clipboard()->setText(toqstr(externalLineEnding(str)), CLIPBOARD_MODE);
76 } // namespace frontend