diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2019-02-10 16:29:42 +0100 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2019-02-17 17:00:59 +0100 |
commit | 4d341228fc9988fbf22695494197ace5a342426c (patch) | |
tree | f43cf6d0c0bce286083f32514a84b9cf619b5ddc /sd | |
parent | 841619900d8e148ec5ec8f54b7816ff60a5367fe (diff) |
Simplify: getToken+comparison ==> startsWith
Change-Id: I69d714db155fe27c27ff1769ae5f71161d1de5cf
Reviewed-on: https://gerrit.libreoffice.org/67641
Tested-by: Jenkins
Reviewed-by: Matteo Casalin <matteo.casalin@yahoo.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/view/viewshel.cxx | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index c0fb2aa674a6..09af5e774e4a 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -534,17 +534,10 @@ 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; - if (aMimeType.getToken(0, ';', nIndex) == "text/plain") - { - if (aMimeType.getToken(0, ';', nIndex) == "charset=utf-8") - { - aMimeType = "text/plain;charset=utf-16"; - bConvert = true; - } - } + const bool bConvert{ aMimeType.startsWith("text/plain;charset=utf-8") }; + if (bConvert) + aMimeType = "text/plain;charset=utf-16"; datatransfer::DataFlavor aFlavor; aFlavor.MimeType = OUString::fromUtf8(aMimeType.getStr()); |