summaryrefslogtreecommitdiff
path: root/sd/source/ui/view/viewshel.cxx
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2019-02-21 18:30:32 +0100
committerStephan Bergmann <sbergman@redhat.com>2019-02-21 22:55:37 +0100
commita9de98d3b874de12d2533dbb5a4db30c6e3e81b6 (patch)
tree8853a4592884533b27a0a6dab288ea7a70289fb2 /sd/source/ui/view/viewshel.cxx
parent7d2afd1c205d324447e42a8281f646b086882cd5 (diff)
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@redhat.com>
Diffstat (limited to 'sd/source/ui/view/viewshel.cxx')
-rw-r--r--sd/source/ui/view/viewshel.cxx13
1 files changed, 10 insertions, 3 deletions
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());