Kaydet (Commit) 0ae87659 authored tarafından Matteo Casalin's avatar Matteo Casalin Kaydeden (comit) Markus Mohrhard

getToken+comparison ==> startsWith, reuse available information

Change-Id: Ie7eef48ee20da9bc01d0b046435bb270f8d1e18f
Reviewed-on: https://gerrit.libreoffice.org/67654
Tested-by: Jenkins
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 6637d32c
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment