Kaydet (Commit) 4d341228 authored tarafından Matteo Casalin's avatar Matteo Casalin

Simplify: getToken+comparison ==> startsWith

Change-Id: I69d714db155fe27c27ff1769ae5f71161d1de5cf
Reviewed-on: https://gerrit.libreoffice.org/67641
Tested-by: Jenkins
Reviewed-by: 's avatarMatteo Casalin <matteo.casalin@yahoo.com>
üst 84161990
......@@ -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());
......
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