[Libreoffice-commits] core.git: sd/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Feb 17 16:01:23 UTC 2019


 sd/source/ui/view/viewshel.cxx |   13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

New commits:
commit 4d341228fc9988fbf22695494197ace5a342426c
Author:     Matteo Casalin <matteo.casalin at yahoo.com>
AuthorDate: Sun Feb 10 16:29:42 2019 +0100
Commit:     Matteo Casalin <matteo.casalin at yahoo.com>
CommitDate: Sun Feb 17 17:00:59 2019 +0100

    Simplify: getToken+comparison ==> startsWith
    
    Change-Id: I69d714db155fe27c27ff1769ae5f71161d1de5cf
    Reviewed-on: https://gerrit.libreoffice.org/67641
    Tested-by: Jenkins
    Reviewed-by: Matteo Casalin <matteo.casalin at yahoo.com>

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());


More information about the Libreoffice-commits mailing list