]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiClipboard.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / qt4 / GuiClipboard.C
1 // -*- C++ -*-
2 /**
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.
6  *
7  * \author John Levon
8  * \author Abdelrazak Younes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #include <config.h>
14
15 #include "GuiClipboard.h"
16 #include "qt_helpers.h"
17
18 #include "debug.h"
19
20 #include <QApplication>
21 #include <QClipboard>
22 #include <QString>
23
24 #include "support/lstrings.h"
25 using lyx::support::internalLineEnding;
26 using lyx::support::externalLineEnding;
27
28 using std::endl;
29
30 namespace lyx {
31 namespace frontend {
32
33 docstring const GuiClipboard::get() const
34 {
35         QString const str = qApp->clipboard()->text(QClipboard::Clipboard);
36         lyxerr[Debug::ACTION] << "GuiClipboard::get: " << fromqstr(str)
37                               << endl;
38         if (str.isNull())
39                 return docstring();
40
41         return internalLineEnding(qstring_to_ucs4(str));
42 }
43
44
45 void GuiClipboard::put(docstring const & str)
46 {
47         lyxerr[Debug::ACTION] << "GuiClipboard::put: " << lyx::to_utf8(str) << endl;
48
49         qApp->clipboard()->setText(toqstr(externalLineEnding(str)),
50                                    QClipboard::Clipboard);
51 }
52
53 } // namespace frontend
54 } // namespace lyx