summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2019-02-10 18:13:10 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2019-02-16 13:26:46 +0100
commit0ae876595e9d9af44fc4d4bc948f8a42d8a27e8d (patch)
tree5653605c52830461804cefe177225839c76f71e7 /sc
parent6637d32cd6f380f68a724499d0850e7944b4e5b6 (diff)
getToken+comparison ==> startsWith, reuse available information
Change-Id: Ie7eef48ee20da9bc01d0b046435bb270f8d1e18f Reviewed-on: https://gerrit.libreoffice.org/67654 Tested-by: Jenkins Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/unoobj/docuno.cxx15
1 files changed, 4 insertions, 11 deletions
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 962c2da2df1b..497e1454b632 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -833,20 +833,13 @@ OString ScModelObj::getTextSelection(const char* pMimeType, OString& rUsedMimeTy
// Take care of UTF-8 text here.
OString aMimeType(pMimeType);
- bool bConvert = false;
- sal_Int32 nIndex = 0;
- if (aMimeType.getToken(0, ';', nIndex) == "text/plain")
- {
- if (aMimeType.getToken(0, ';', nIndex) == "charset=utf-8")
- {
- aMimeType = "text/plain;charset=utf-16";
- bConvert = true;
- }
- }
+ 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());
- if (aMimeType == "text/plain;charset=utf-16")
+ if (bConvert || aMimeType == "text/plain;charset=utf-16")
aFlavor.DataType = cppu::UnoType<OUString>::get();
else
aFlavor.DataType = cppu::UnoType< uno::Sequence<sal_Int8> >::get();