summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-06-24 09:19:16 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-06-24 21:41:34 +0200
commit1f8095ad5f073c14b9e604d02dda4435eb23fefa (patch)
tree34c0517b7e336fcd19768b1b563aabcdc73b21d2 /vcl/unx
parentc83a9ef419ac9bde61d0ebafa3692c8e43374d49 (diff)
gtk4: merge some common dnd and cnp blocks
Change-Id: I195eb7ae3fda492a36423f57139550cb7fef9b2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117765 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/gtk3/gtkframe.cxx11
-rw-r--r--vcl/unx/gtk3/gtkinst.cxx22
2 files changed, 15 insertions, 18 deletions
diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index 3f13023d76f4..529c39e7f0dc 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -4417,16 +4417,9 @@ public:
pInstance->DoYield(true, false);
if (aFlavor.MimeType == "text/plain;charset=utf-8")
- {
- const char* pStr = reinterpret_cast<const char*>(aRes.aVector.data());
- OUString aStr(pStr, aRes.aVector.size(), RTL_TEXTENCODING_UTF8);
- aRet <<= aStr.replaceAll("\r\n", "\n");
- }
+ aRet <<= aRes.get_as_string();
else
- {
- auto aSeq = css::uno::Sequence<sal_Int8>(aRes.aVector.data(), aRes.aVector.size());
- aRet <<= aSeq;
- }
+ aRet <<= aRes.get_as_sequence();
#endif
return aRet;
}
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index f3f739454e3b..f062dc5c13a4 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -696,6 +696,17 @@ void read_transfer_result::read_block_async_completed(GObject* source, GAsyncRes
read_block_async_completed,
user_data);
}
+
+OUString read_transfer_result::get_as_string() const
+{
+ const char* pStr = reinterpret_cast<const char*>(aVector.data());
+ return OUString(pStr, aVector.size(), RTL_TEXTENCODING_UTF8).replaceAll("\r\n", "\n");
+}
+
+css::uno::Sequence<sal_Int8> read_transfer_result::get_as_sequence() const
+{
+ return css::uno::Sequence<sal_Int8>(aVector.data(), aVector.size());
+}
#endif
namespace {
@@ -810,16 +821,9 @@ public:
pInstance->DoYield(true, false);
if (aFlavor.MimeType == "text/plain;charset=utf-8")
- {
- const char* pStr = reinterpret_cast<const char*>(aRes.aVector.data());
- OUString aStr(pStr, aRes.aVector.size(), RTL_TEXTENCODING_UTF8);
- aRet <<= aStr.replaceAll("\r\n", "\n");
- }
+ aRet <<= aRes.get_as_string();
else
- {
- auto aSeq = css::uno::Sequence<sal_Int8>(aRes.aVector.data(), aRes.aVector.size());
- aRet <<= aSeq;
- }
+ aRet <<= aRes.get_as_sequence();
#endif
return aRet;
}