diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-10-02 11:36:39 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-10-04 10:25:18 +0200 |
commit | 6b4abed111c67152a2c0c3a498071f37bce93b67 (patch) | |
tree | 5965a24a5eb987dcb33e271d1c83aca632caa425 /vcl/qt5/Qt5Clipboard.cxx | |
parent | 309bd0e920aae38c94f2c83dd5ff7d8b9feb9847 (diff) |
Implement qt5 plain text copy to clipboard
Change-Id: I5804467c97758641718a6d6314cae015a0442d1b
Reviewed-on: https://gerrit.libreoffice.org/61233
Tested-by: Jenkins
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'vcl/qt5/Qt5Clipboard.cxx')
-rw-r--r-- | vcl/qt5/Qt5Clipboard.cxx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/vcl/qt5/Qt5Clipboard.cxx b/vcl/qt5/Qt5Clipboard.cxx index 68fabdf8583f..048acd4e70c8 100644 --- a/vcl/qt5/Qt5Clipboard.cxx +++ b/vcl/qt5/Qt5Clipboard.cxx @@ -118,6 +118,28 @@ void VclQt5Clipboard::setContents( std::vector<Reference<datatransfer::clipboard::XClipboardListener>> aListeners(m_aListeners); datatransfer::clipboard::ClipboardEvent aEv; + if (m_aContents.is()) + { + css::datatransfer::DataFlavor aFlavor; + aFlavor.MimeType = "text/plain;charset=utf-16"; + aFlavor.DataType = cppu::UnoType<OUString>::get(); + + Any aValue; + try + { + aValue = xTrans->getTransferData(aFlavor); + } + catch (...) + { + } + + OUString aString; + aValue >>= aString; + + QClipboard* clipboard = QApplication::clipboard(); + clipboard->setText(toQString(aString)); + } + aEv.Contents = getContents(); aGuard.clear(); |