[Libreoffice-commits] core.git: sd/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Feb 21 21:56:04 UTC 2019
sd/source/ui/view/viewshel.cxx | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
New commits:
commit a9de98d3b874de12d2533dbb5a4db30c6e3e81b6
Author: Matteo Casalin <matteo.casalin at yahoo.com>
AuthorDate: Thu Feb 21 18:30:32 2019 +0100
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Feb 21 22:55:37 2019 +0100
Revert "Simplify: getToken+comparison ==> startsWith"
Not equivalent to original code, may cause problems in the future.
This reverts commit 4d341228fc9988fbf22695494197ace5a342426c.
Change-Id: Ie91e43496c3ff67d31a0fc363638dde41fffa550
Reviewed-on: https://gerrit.libreoffice.org/68175
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 9163d2142dd2..4f321bd7134b 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -534,10 +534,17 @@ OString ViewShell::GetTextSelection(const OString& _aMimeType, OString& rUsedMim
uno::Reference<datatransfer::XTransferable> xTransferable = rEditView.GetEditEngine()->CreateTransferable(rEditView.GetSelection());
// Take care of UTF-8 text here.
+ bool bConvert = false;
+ sal_Int32 nIndex = 0;
OString aMimeType = _aMimeType;
- const bool bConvert{ aMimeType.startsWith("text/plain;charset=utf-8") };
- if (bConvert)
- aMimeType = "text/plain;charset=utf-16";
+ if (aMimeType.getToken(0, ';', nIndex) == "text/plain")
+ {
+ if (aMimeType.getToken(0, ';', nIndex) == "charset=utf-8")
+ {
+ aMimeType = "text/plain;charset=utf-16";
+ bConvert = true;
+ }
+ }
datatransfer::DataFlavor aFlavor;
aFlavor.MimeType = OUString::fromUtf8(aMimeType.getStr());
More information about the Libreoffice-commits
mailing list