[Libreoffice-commits] core.git: Branch 'distro/collabora/cd-5.3-3.4' - 34 commits - chart2/source configmgr/source connectivity/source desktop/CppunitTest_desktop_lokinit.mk desktop/inc desktop/Module_desktop.mk desktop/qa desktop/source download.lst editeng/qa editeng/source extensions/Library_ldapbe2.mk extensions/source external/curl external/python3 include/sfx2 include/tools include/vcl sc/CppunitTest_sc_tiledrendering.mk sc/inc sc/qa scripting/examples sc/sdi sc/source sd/qa sd/source sfx2/source sw/CppunitTest_sw_uiwriter.mk sw/inc sw/qa sw/source tools/Library_tl.mk tools/source vcl/source vcl/unx writerfilter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Aug 20 10:01:17 UTC 2018


 chart2/source/controller/main/ChartController_Window.cxx |   14 
 chart2/source/tools/ResourceManager.cxx                  |   13 
 configmgr/source/winreg.cxx                              |   17 
 connectivity/source/commontools/DateConversion.cxx       |    2 
 desktop/CppunitTest_desktop_lokinit.mk                   |   49 ++
 desktop/Module_desktop.mk                                |    1 
 desktop/inc/lib/init.hxx                                 |    6 
 desktop/qa/unit/desktop-lok-init.cxx                     |  140 +++++++
 desktop/source/lib/init.cxx                              |   85 ++++
 download.lst                                             |    6 
 editeng/qa/unit/core-test.cxx                            |    2 
 editeng/source/editeng/impedit3.cxx                      |   11 
 extensions/Library_ldapbe2.mk                            |    1 
 extensions/source/config/ldap/ldapuserprofilebe.cxx      |   41 +-
 external/curl/CVE-2017-8816.patch                        |   67 ---
 external/curl/CVE-2018-1000005.patch                     |   36 -
 external/curl/CVE-2018-1000007.patch                     |  110 -----
 external/curl/ExternalPackage_curl.mk                    |    8 
 external/curl/ExternalProject_curl.mk                    |   48 +-
 external/curl/UnpackedTarball_curl.mk                    |   17 
 external/curl/clang-cl.patch.0                           |   11 
 external/curl/curl-7.26.0_mingw.patch                    |   24 -
 external/curl/curl-7.26.0_win-proxy.patch                |   49 +-
 external/curl/curl-msvc-disable-protocols.patch.1        |   11 
 external/curl/curl-msvc-schannel.patch.1                 |   22 -
 external/curl/curl-msvc.patch.1                          |   48 +-
 external/curl/curl-osx.patch.1                           |  285 ---------------
 external/curl/curl-xp.patch.1                            |   12 
 external/curl/zlib.patch.0                               |  100 +++++
 external/python3/ExternalPackage_python3.mk              |    1 
 include/sfx2/shell.hxx                                   |    8 
 include/tools/fileutil.hxx                               |   27 +
 include/vcl/ppdparser.hxx                                |    2 
 sc/CppunitTest_sc_tiledrendering.mk                      |    2 
 sc/inc/colorscale.hxx                                    |    6 
 sc/inc/scabstdlg.hxx                                     |    3 
 sc/qa/unit/screenshots/screenshots.cxx                   |    2 
 sc/qa/unit/tiledrendering/tiledrendering.cxx             |   43 ++
 sc/sdi/scalc.sdi                                         |    2 
 sc/source/core/data/colorscale.cxx                       |    4 
 sc/source/ui/app/scmod.cxx                               |   32 -
 sc/source/ui/attrdlg/scdlgfact.cxx                       |    5 
 sc/source/ui/attrdlg/scdlgfact.hxx                       |    3 
 sc/source/ui/formdlg/formula.cxx                         |    6 
 sc/source/ui/inc/anyrefdg.hxx                            |    4 
 sc/source/ui/miscdlgs/anyrefdg.cxx                       |   32 -
 sc/source/ui/unoobj/filtuno.cxx                          |    2 
 sc/source/ui/view/cellsh1.cxx                            |   92 +++-
 sc/source/ui/view/cellsh2.cxx                            |    2 
 sc/source/ui/view/viewfun5.cxx                           |   87 ++--
 scripting/examples/python/NamedRanges.py                 |    2 
 sd/qa/unit/data/ppt/tdf116899.ppt                        |binary
 sd/qa/unit/import-tests.cxx                              |   25 +
 sd/source/filter/ppt/pptinanimations.cxx                 |   15 
 sfx2/source/control/dispatch.cxx                         |   18 
 sfx2/source/control/shell.cxx                            |   15 
 sfx2/source/dialog/dinfdlg.cxx                           |   14 
 sfx2/source/doc/docfile.cxx                              |   14 
 sw/CppunitTest_sw_uiwriter.mk                            |    1 
 sw/inc/swtypes.hxx                                       |    8 
 sw/inc/view.hxx                                          |    2 
 sw/qa/extras/ooxmlexport/data/tdf116976.docx             |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx                |    7 
 sw/qa/extras/rtfimport/data/tdf117246.rtf                |   11 
 sw/qa/extras/rtfimport/rtfimport.cxx                     |    6 
 sw/qa/extras/uiwriter/data2/tdf101534.fodt               |   28 +
 sw/qa/extras/uiwriter/uiwriter2.cxx                      |   60 +++
 sw/source/core/doc/DocumentContentOperationsManager.cxx  |    4 
 sw/source/core/doc/DocumentStylePoolManager.cxx          |    8 
 sw/source/core/doc/SwStyleNameMapper.cxx                 |    4 
 sw/source/core/doc/doclay.cxx                            |    8 
 sw/source/core/docnode/ndsect.cxx                        |    2 
 sw/source/core/docnode/ndtbl.cxx                         |    2 
 sw/source/core/tox/tox.cxx                               |   33 -
 sw/source/ui/dialog/swdialmgr.cxx                        |   16 
 sw/source/ui/dialog/swuiexp.cxx                          |    2 
 sw/source/uibase/app/docsh2.cxx                          |    4 
 sw/source/uibase/app/swmodule.cxx                        |   17 
 sw/source/uibase/shells/textsh.cxx                       |    4 
 sw/source/uibase/uiview/view2.cxx                        |   15 
 sw/source/uibase/uiview/viewstat.cxx                     |    2 
 sw/source/uibase/utlui/initui.cxx                        |    4 
 tools/Library_tl.mk                                      |    1 
 tools/source/fsys/fileutil.cxx                           |   77 ++++
 vcl/source/window/floatwin.cxx                           |   14 
 vcl/unx/generic/printer/jobdata.cxx                      |    3 
 vcl/unx/generic/printer/ppdparser.cxx                    |   12 
 writerfilter/source/dmapper/GraphicImport.cxx            |   10 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx           |    9 
 89 files changed, 1170 insertions(+), 908 deletions(-)

New commits:
commit 03b6597567b584e6decd1175672f3eee53d7c882
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jun 19 21:43:43 2018 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Aug 20 12:00:34 2018 +0200

    forcepoint#50 fix end detection
    
    rBuffer.size() of 26, nBytes of 25, rBuffer[25] is the first zero
    so aLine.getLength() of 25, nBytes reduced by aLine.getLength()+1 and
    nRun increased by same, so nBytes wraps and nRun is 26.
    
    contains...
    
    forcepoint: rework to explore loop
    
    Change-Id: I14f6a3269fc3347a9976d899519e74f58d5975c8
    Reviewed-on: https://gerrit.libreoffice.org/56125
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 6e5e83025c948b699bb65839ef810a45a98ba014)
    
    Change-Id: Ia9f4789e081e6b77a21321f37d71cabfc7c84550
    Reviewed-on: https://gerrit.libreoffice.org/56481
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit 0cefb4f0552a9d1ec3afd64e695596480a1c9757)
    (cherry picked from commit c102d535021abd31d6dfaca4f58b2312b7ef4d08)

diff --git a/include/vcl/ppdparser.hxx b/include/vcl/ppdparser.hxx
index 134bb9bf49fa..3c64b159f928 100644
--- a/include/vcl/ppdparser.hxx
+++ b/include/vcl/ppdparser.hxx
@@ -273,7 +273,7 @@ public:
 
     // for printer setup
     char*   getStreamableBuffer( sal_uLong& rBytes ) const;
-    void    rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes );
+    void    rebuildFromStreamBuffer(const std::vector<char> &rBuffer);
 
     // convenience
     int getRenderResolution() const;
diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx
index 89673ba05b34..acad5897b9b4 100644
--- a/vcl/unx/generic/printer/jobdata.cxx
+++ b/vcl/unx/generic/printer/jobdata.cxx
@@ -279,8 +279,9 @@ bool JobData::constructFromStreamBuffer( const void* pData, sal_uInt32 bytes, Jo
                     nBytes = aStream.ReadBytes(aRemain.data(), nBytes);
                     if (nBytes)
                     {
+                        aRemain.resize(nBytes+1);
                         aRemain[nBytes] = 0;
-                        rJobData.m_aContext.rebuildFromStreamBuffer(aRemain.data(), nBytes);
+                        rJobData.m_aContext.rebuildFromStreamBuffer(aRemain);
                         bContext = true;
                     }
                 }
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index c882822200ed..3b81c539bf21 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -1847,17 +1847,18 @@ char* PPDContext::getStreamableBuffer( sal_uLong& rBytes ) const
     return pBuffer;
 }
 
-void PPDContext::rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes )
+void PPDContext::rebuildFromStreamBuffer(const std::vector<char> &rBuffer)
 {
     if( ! m_pParser )
         return;
 
     m_aCurrentValues.clear();
 
-    char* pRun = pBuffer;
-    while( nBytes && *pRun )
+    const size_t nBytes = rBuffer.size() - 1;
+    size_t nRun = 0;
+    while (nRun < nBytes && rBuffer[nRun])
     {
-        OString aLine( pRun );
+        OString aLine(rBuffer.data() + nRun);
         sal_Int32 nPos = aLine.indexOf(':');
         if( nPos != -1 )
         {
@@ -1876,8 +1877,7 @@ void PPDContext::rebuildFromStreamBuffer( char* pBuffer, sal_uLong nBytes )
                     << " }");
             }
         }
-        nBytes -= aLine.getLength()+1;
-        pRun += aLine.getLength()+1;
+        nRun += aLine.getLength()+1;
     }
 }
 
commit 27b158a408dc161605e9a92d54cf6c0b1fb5909f
Author:     Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Thu Jul 19 15:32:59 2018 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Aug 20 12:00:24 2018 +0200

    tdf#101534 sw: fix lost indent attributes when copying into numbered paragraph
    
    Commit aa91dc0ccbe53ffcec9dbfec2265de057775d4e3 (CWS-TOOLING: integrate
    CWS sw32numbf01, 2009-09-08) replaced the SwDoc::ReplaceNumRule() call
    with SwDoc::SetNumRule(), as the later handles list ids. This required a
    decision if resetting of the indent attributes is needed or not, but it
    did not document why resetting was chosen.
    
    On the other hand, the current bugdoc shows why resetting is a bad idea:
    this way if you paste into a numbered paragraph which has a non-zero
    paragraph indent inherited from the numbering + zero indent as direct
    formatting, then this later is lost during paste.
    
    Conflicts:
            sw/qa/extras/uiwriter/uiwriter2.cxx
    
    (cherry picked from commit 340eaa6aa15c18cc2696a4a304350810cb36565c)
    
    Change-Id: Ie5dcf6ed86c240fd61c4d5bfed886910aea3648f
    Reviewed-on: https://gerrit.libreoffice.org/57770
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit 499c31d83f3ad6356678ae9103e7e0748ff45ad7)

diff --git a/sw/CppunitTest_sw_uiwriter.mk b/sw/CppunitTest_sw_uiwriter.mk
index e048fae7e2c9..4b60c7ead4b8 100644
--- a/sw/CppunitTest_sw_uiwriter.mk
+++ b/sw/CppunitTest_sw_uiwriter.mk
@@ -13,6 +13,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,sw_uiwriter))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,sw_uiwriter, \
     sw/qa/extras/uiwriter/uiwriter \
+    sw/qa/extras/uiwriter/uiwriter2 \
 ))
 
 # note: this links msword only for the reason to have a order dependency,
diff --git a/sw/qa/extras/uiwriter/data2/tdf101534.fodt b/sw/qa/extras/uiwriter/data2/tdf101534.fodt
new file mode 100644
index 000000000000..e1db2f08ee08
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data2/tdf101534.fodt
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oas
 is:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:
 experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+  <office:styles>
+    <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
+    <text:list-style style:name="MyList">
+      <text:list-level-style-number text:level="1" style:num-format="1" text:display-levels="1">
+        <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+          <style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.635cm" fo:text-indent="1.27cm" fo:margin-left="-1.27cm"/>
+        </style:list-level-properties>
+      </text:list-level-style-number>
+    </text:list-style>
+  </office:styles>
+  <office:automatic-styles>
+    <style:style style:name="P1" style:family="paragraph">
+      <style:paragraph-properties fo:margin-left="0cm"/>
+    </style:style>
+  </office:automatic-styles>
+  <office:body>
+    <office:text>
+      <text:p>Lorem ipsum dolor sit amet.</text:p>
+      <text:list text:style-name="MyList">
+        <text:list-item>
+              <text:p text:style-name="P1">Quo dolor dolore ea, vis te dicunt evertitur. Quo idque nostrud referrentur at, saperet volumus sententiae ut pro.</text:p>
+        </text:list-item>
+      </text:list>
+    </office:text>
+  </office:body>
+</office:document>
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
new file mode 100644
index 000000000000..e6b061f0e071
--- /dev/null
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <swmodeltestbase.hxx>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <swdtflvr.hxx>
+#include <wrtsh.hxx>
+
+namespace
+{
+char const DATA_DIRECTORY[] = "/sw/qa/extras/uiwriter/data2/";
+}
+
+/// Second set of tests asserting the behavior of Writer user interface shells.
+class SwUiWriterTest2 : public SwModelTestBase
+{
+public:
+    void testTdf101534();
+
+    CPPUNIT_TEST_SUITE(SwUiWriterTest2);
+    CPPUNIT_TEST(testTdf101534);
+    CPPUNIT_TEST_SUITE_END();
+};
+
+void SwUiWriterTest2::testTdf101534()
+{
+    // Copy the first paragraph of the document.
+    load(DATA_DIRECTORY, "tdf101534.fodt");
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    pWrtShell->EndPara(/*bSelect=*/true);
+    rtl::Reference<SwTransferable> pTransfer = new SwTransferable(*pWrtShell);
+    pTransfer->Copy();
+
+    // Go to the second paragraph, assert that we have margins as direct
+    // formatting.
+    pWrtShell->Down(/*bSelect=*/false);
+    SfxItemSet aSet(pWrtShell->GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE);
+    pWrtShell->GetCurAttr(aSet);
+    CPPUNIT_ASSERT(aSet.HasItem(RES_LR_SPACE));
+
+    // Make sure that direct formatting is preserved during paste.
+    pWrtShell->EndPara(/*bSelect=*/false);
+    TransferableDataHelper aHelper(pTransfer.get());
+    SwTransferable::Paste(*pWrtShell, aHelper);
+    pWrtShell->GetCurAttr(aSet);
+    // This failed, direct formatting was lost.
+    CPPUNIT_ASSERT(aSet.HasItem(RES_LR_SPACE));
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest2);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 943a702100e3..6b2682c5b45f 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -4550,8 +4550,10 @@ bool DocumentContentOperationsManager::CopyImpl( SwPaM& rPam, SwPosition& rPos,
     if ( pNumRuleToPropagate != nullptr )
     {
         // #i86492# - use <SwDoc::SetNumRule(..)>, because it also handles the <ListId>
+        // Don't reset indent attributes, that would mean loss of direct
+        // formatting.
         pDoc->SetNumRule( *pCopyPam, *pNumRuleToPropagate, false,
-                          aListIdToPropagate, true, true );
+                          aListIdToPropagate, true, /*bResetIndentAttrs=*/false );
     }
 
     pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
commit 073307c085ebdf4f3d7f52ab21589a6e7edb64fe
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Thu Jul 5 15:28:06 2018 -0400
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Aug 20 12:00:16 2018 +0200

    tdf#118540: LO6.1b2: DOCX crashes when properties...
    
    are opened in print preview mode
    
    Change-Id: Idc64d2b98dff157d28813dd3f90a276f8cacd11f
    Reviewed-on: https://gerrit.libreoffice.org/57024
    Tested-by: Jenkins
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/57059
    Reviewed-by: Aron Budea <aron.budea at collabora.com>
    Tested-by: Aron Budea <aron.budea at collabora.com>
    (cherry picked from commit 8dd5be05ae7ed825af4fc99604f9772f0f60003c)

diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 93a65fad30ff..3a904826e90c 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -139,7 +139,9 @@ using namespace ::sfx2;
 // create DocInfo (virtual)
 VclPtr<SfxDocumentInfoDialog> SwDocShell::CreateDocumentInfoDialog(const SfxItemSet &rSet)
 {
-    VclPtr<SfxDocumentInfoDialog> pDlg = VclPtr<SfxDocumentInfoDialog>::Create(&GetView()->GetViewFrame()->GetWindow(), rSet);
+    SfxViewShell* pViewShell = GetView() ? GetView() : SfxViewShell::Current();
+    vcl::Window* pWindow = pViewShell ? &pViewShell->GetViewFrame()->GetWindow() : nullptr;
+    VclPtr<SfxDocumentInfoDialog> pDlg = VclPtr<SfxDocumentInfoDialog>::Create(pWindow, rSet);
     //only with statistics, when this document is being shown, not
     //from within the Doc-Manager
     SwDocShell* pDocSh = static_cast<SwDocShell*>( SfxObjectShell::Current());
commit 8c6643e8fee833cc3eb760d1c7afa98d06d209c6
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Mon Jun 25 22:58:30 2018 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Aug 20 12:00:06 2018 +0200

    Conditional formatting: Allow to set the icon set CF via .uno: command.
    
    When .uno:IconSetFormatDialog gets a parameter, it directly creates the
    icon set conditional formatting with pre-selected values.
    
    Change-Id: I75dda90e5ea9c191254acc24c564cda7b27243a5
    Reviewed-on: https://gerrit.libreoffice.org/56429
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit 5e3365e88c94450e6db687eb46425e07db6997f5)

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 85c22c02eb9d..10e81de091e5 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -337,6 +337,8 @@ std::vector<beans::PropertyValue> desktop::jsonToPropertyValuesVector(const char
                 aValue.Value <<= OString(rValue.c_str()).toFloat();
             else if (rType == "long")
                 aValue.Value <<= OString(rValue.c_str()).toInt32();
+            else if (rType == "short")
+                aValue.Value <<= static_cast<sal_Int16>(OString(rValue.c_str()).toInt32());
             else if (rType == "unsigned short")
                 aValue.Value <<= static_cast<sal_uInt16>(OString(rValue.c_str()).toUInt32());
             else if (rType == "[]any")
diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 840b6824963d..8ae03f419b18 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -51,7 +51,7 @@ private:
     ScColorScaleEntryType meType;
 
 public:
-    ScColorScaleEntry(double nVal, const Color& rCol);
+    ScColorScaleEntry(double nVal, const Color& rCol, ScColorScaleEntryType eType = COLORSCALE_VALUE);
     ScColorScaleEntry();
     ScColorScaleEntry(const ScColorScaleEntry& rEntry);
     ScColorScaleEntry(ScDocument* pDoc, const ScColorScaleEntry& rEntry);
@@ -329,8 +329,8 @@ struct ScIconSetFormatData
     // std..pair::second == -1 means no image
     std::vector<std::pair<ScIconSetType, sal_Int32> > maCustomVector;
 
-    ScIconSetFormatData():
-        eIconSetType(IconSet_3Arrows),
+    ScIconSetFormatData(ScIconSetType eType = IconSet_3Arrows):
+        eIconSetType(eType),
         mbShowValue(true),
         mbReverse(false),
         mbCustom(false)
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 544655e5fe4f..56d68d0799fd 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -829,7 +829,7 @@ SfxVoidItem DataBarFormatDialog SID_OPENDLG_DATABAR
 
 
 SfxVoidItem IconSetFormatDialog SID_OPENDLG_ICONSET
-()
+(SfxInt16Item IconSet FN_PARAM_1)
 [
     AutoUpdate = FALSE,
     FastCall = FALSE,
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index cb7599e0db53..7c6bb46aa8a2 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -158,10 +158,10 @@ ScColorScaleEntry::ScColorScaleEntry():
 {
 }
 
-ScColorScaleEntry::ScColorScaleEntry(double nVal, const Color& rCol):
+ScColorScaleEntry::ScColorScaleEntry(double nVal, const Color& rCol, ScColorScaleEntryType eType):
     mnVal(nVal),
     maColor(rCol),
-    meType(COLORSCALE_VALUE)
+    meType(eType)
 {
 }
 
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index e8a5fecaf609..efe07dbccd94 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -48,6 +48,7 @@
 #include <editeng/editview.hxx>
 
 #include "cellsh.hxx"
+#include <ftools.hxx>
 #include "sc.hrc"
 #include "document.hxx"
 #include "patattr.hxx"
@@ -77,6 +78,7 @@
 #include "cliputil.hxx"
 #include "markdata.hxx"
 #include "docpool.hxx"
+#include <colorscale.hxx>
 #include "condformatdlg.hxx"
 #include "attrib.hxx"
 #include "condformatdlgitem.hxx"
@@ -100,6 +102,7 @@
 #include <com/sun/star/i18n/TransliterationModules.hpp>
 #include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
 
+#include <o3tl/make_unique.hxx>
 #include <memory>
 
 using namespace ::com::sun::star;
@@ -1984,15 +1987,16 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                     aRangeList.push_back(pRange);
                 }
 
+                // try to find an existing conditional format
                 const ScConditionalFormat* pCondFormat = nullptr;
                 const ScPatternAttr* pPattern = pDoc->GetPattern(aPos.Col(), aPos.Row(), aPos.Tab());
+                ScConditionalFormatList* pList = pDoc->GetCondFormList(aPos.Tab());
                 const std::vector<sal_uInt32>& rCondFormats = static_cast<const ScCondFormatItem&>(pPattern->GetItem(ATTR_CONDITIONAL)).GetCondFormatData();
                 bool bContainsCondFormat = !rCondFormats.empty();
                 bool bCondFormatDlg = false;
+                bool bContainsExistingCondFormat = false;
                 if(bContainsCondFormat)
                 {
-                    bool bContainsExistingCondFormat = false;
-                    ScConditionalFormatList* pList = pDoc->GetCondFormList(aPos.Tab());
                     for (std::vector<sal_uInt32>::const_iterator itr = rCondFormats.begin(), itrEnd = rCondFormats.end();
                                             itr != itrEnd; ++itr)
                     {
@@ -2011,39 +2015,73 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                             break;
                         }
                     }
+                }
+
+                // do we have a parameter with the conditional formatting type?
+                const SfxInt16Item* pParam = rReq.GetArg<SfxInt16Item>(FN_PARAM_1);
+                if (pParam && nSlot == SID_OPENDLG_ICONSET)
+                {
+                    ScConditionalFormat* pFormat = new ScConditionalFormat(0, pDoc);
+                    pFormat->SetRange(aRangeList);
+
+                    ScIconSetType eIconSetType = limit_cast<ScIconSetType>(pParam->GetValue(), IconSet_3Arrows, IconSet_5Boxes);
+                    int nSteps = 3;
+                    if (eIconSetType >= IconSet_4Arrows && eIconSetType < IconSet_5Arrows)
+                        nSteps = 4;
+                    else if (eIconSetType >= IconSet_5Arrows)
+                        nSteps = 5;
+
+                    ScIconSetFormat* pEntry = new ScIconSetFormat(pDoc);
+                    ScIconSetFormatData* pIconSetFormatData = new ScIconSetFormatData(eIconSetType);
+
+                    pIconSetFormatData->m_Entries.push_back(o3tl::make_unique<ScColorScaleEntry>(0, COL_RED, COLORSCALE_PERCENT));
+                    pIconSetFormatData->m_Entries.push_back(o3tl::make_unique<ScColorScaleEntry>(round(100. / nSteps), COL_BROWN, COLORSCALE_PERCENT));
+                    pIconSetFormatData->m_Entries.push_back(o3tl::make_unique<ScColorScaleEntry>(round(200. / nSteps), COL_YELLOW, COLORSCALE_PERCENT));
+                    if (nSteps > 3)
+                        pIconSetFormatData->m_Entries.push_back(o3tl::make_unique<ScColorScaleEntry>(round(300. / nSteps), COL_WHITE, COLORSCALE_PERCENT));
+                    if (nSteps > 4)
+                        pIconSetFormatData->m_Entries.push_back(o3tl::make_unique<ScColorScaleEntry>(round(400. / nSteps), COL_GREEN, COLORSCALE_PERCENT));
 
-                    // if not found a conditional format ask whether we should edit one of the existing
-                    // or should create a new overlapping conditional format
-                    if(!bCondFormatDlg && bContainsExistingCondFormat)
+                    pEntry->SetIconSetData(pIconSetFormatData);
+                    pFormat->AddEntry(pEntry);
+
+                    // use the new conditional formatting
+                    GetViewData()->GetDocShell()->GetDocFunc().ReplaceConditionalFormat(nIndex, pFormat, aPos.Tab(), aRangeList);
+
+                    break;
+                }
+
+                // if not found a conditional format ask whether we should edit one of the existing
+                // or should create a new overlapping conditional format
+                if(bContainsCondFormat && !bCondFormatDlg && bContainsExistingCondFormat)
+                {
+                    ScopedVclPtrInstance<QueryBox> aBox( pTabViewShell->GetDialogParent(), WinBits( WB_YES_NO | WB_DEF_YES ),
+                           ScGlobal::GetRscString(STR_EDIT_EXISTING_COND_FORMATS) );
+                    bool bEditExisting = aBox->Execute() == RET_YES;
+                    if(bEditExisting)
                     {
-                        ScopedVclPtrInstance<QueryBox> aBox( pTabViewShell->GetDialogParent(), WinBits( WB_YES_NO | WB_DEF_YES ),
-                               ScGlobal::GetRscString(STR_EDIT_EXISTING_COND_FORMATS) );
-                        bool bEditExisting = aBox->Execute() == RET_YES;
-                        if(bEditExisting)
+                        // differentiate between ranges where one conditional format is defined
+                        // and several formats are defined
+                        // if we have only one => open the cond format dlg to edit it
+                        // otherwise open the manage cond format dlg
+                        if(rCondFormats.size() == 1)
                         {
-                            // differentiate between ranges where one conditional format is defined
-                            // and several formats are defined
-                            // if we have only one => open the cond format dlg to edit it
-                            // otherwise open the manage cond format dlg
-                            if(rCondFormats.size() == 1)
-                            {
-                                pCondFormat = pList->GetFormat(rCondFormats[0]);
-                                assert(pCondFormat);
-                                bCondFormatDlg = true;
-                            }
-                            else
-                            {
-                                // Queue message to open Conditional Format Manager Dialog.
-                                GetViewData()->GetDispatcher().Execute( SID_OPENDLG_CONDFRMT_MANAGER, SfxCallMode::ASYNCHRON );
-                                break;
-                            }
+                            pCondFormat = pList->GetFormat(rCondFormats[0]);
+                            assert(pCondFormat);
+                            bCondFormatDlg = true;
                         }
                         else
                         {
-                            // define an overlapping conditional format
-                            // does not need to be handled here
+                            // Queue message to open Conditional Format Manager Dialog.
+                            GetViewData()->GetDispatcher().Execute( SID_OPENDLG_CONDFRMT_MANAGER, SfxCallMode::ASYNCHRON );
+                            break;
                         }
                     }
+                    else
+                    {
+                        // define an overlapping conditional format
+                        // does not need to be handled here
+                    }
                 }
 
                 condformat::dialog::ScCondFormatDialogType eType = condformat::dialog::NONE;
commit b3540b779cbfadb696f091522f3f0ac4aaff90ab
Author:     Andras Timar <andras.timar at collabora.com>
AuthorDate: Tue Jun 19 15:27:31 2018 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Aug 20 11:59:55 2018 +0200

    checksum of Noto-hinted.zip changed
    
    Change-Id: Ib7ebf33a69ebabbb28dd26ab1a702fc8c7c8ed66
    (cherry picked from commit d99f351377a335ffbc5deddfca2860815e3bcfad)

diff --git a/download.lst b/download.lst
index 04d84a1bde56..54cb0494b8bd 100644
--- a/download.lst
+++ b/download.lst
@@ -48,7 +48,7 @@ export FONT_LIBERATION_NARROW_TARBALL := 134d8262145fc793c6af494dcace3e71-libera
 export FONT_LIBERATION_TARBALL := 5c781723a0d9ed6188960defba8e91cf-liberation-fonts-ttf-2.00.1.tar.gz
 export FONT_LINLIBERTINEG_TARBALL := e7a384790b13c29113e22e596ade9687-LinLibertineG-20120116.zip
 export FONT_NOTO_TARBALL := Noto-hinted.zip
-export FONT_NOTO_MD5SUM := 5489f1765afd34a2adfdc04d014762e7
+export FONT_NOTO_MD5SUM := 10caa4ab07fefe97292353493c217815
 export FONT_NOTO_SANS_JP_TARBALL := NotoSansJP.zip
 export FONT_NOTO_SANS_JP_MD5SUM := 7f2597c54c292b4c72ffcdc5e6d31e4d
 export FONT_NOTO_SANS_KR_TARBALL := NotoSansKR.zip
commit a1b3c4d11ffc5ce92c0bb9058119cded80e41991
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Tue Jun 19 01:18:08 2018 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Aug 20 11:59:29 2018 +0200

    lok: Unit test for passing table borders via jsonToPropertyValuesVector.
    
    Change-Id: Iadc0d76a1903d76fcd84f316d4796cc1dec13277
    (cherry picked from commit 749780c9b5e2922417a7686efc3e4f609bb20264)

diff --git a/desktop/CppunitTest_desktop_lokinit.mk b/desktop/CppunitTest_desktop_lokinit.mk
index 91493dee4530..07d235861d90 100644
--- a/desktop/CppunitTest_desktop_lokinit.mk
+++ b/desktop/CppunitTest_desktop_lokinit.mk
@@ -19,6 +19,8 @@ $(eval $(call gb_CppunitTest_use_external,desktop_lok_init,boost_headers))
 
 $(eval $(call gb_CppunitTest_use_sdk_api,desktop_lok_init))
 
+$(eval $(call gb_CppunitTest_use_ure,desktop_lok_init))
+
 $(eval $(call gb_CppunitTest_set_include,desktop_lok_init,\
     -I$(SRCDIR)/desktop/source/inc \
     -I$(SRCDIR)/desktop/inc \
diff --git a/desktop/qa/unit/desktop-lok-init.cxx b/desktop/qa/unit/desktop-lok-init.cxx
index 07abe887ccfd..69c209e9055e 100644
--- a/desktop/qa/unit/desktop-lok-init.cxx
+++ b/desktop/qa/unit/desktop-lok-init.cxx
@@ -20,10 +20,13 @@
 
 #include <osl/file.hxx>
 #include <rtl/bootstrap.hxx>
-#include <vcl/scheduler.hxx>
+#include <tools/colordata.hxx>
 
 #include <lib/init.hxx>
 
+#include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/table/BorderLineStyle.hpp>
+
 using namespace css;
 
 /// Unit tests for desktop/source/lib/init.cxx internals.
@@ -35,9 +38,11 @@ public:
     }
 
     void testJsonToPropertyValues();
+    void testJsonToPropertyValuesBorder();
 
     CPPUNIT_TEST_SUITE(LOKInitTest);
     CPPUNIT_TEST(testJsonToPropertyValues);
+    CPPUNIT_TEST(testJsonToPropertyValuesBorder);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -70,6 +75,64 @@ void LOKInitTest::testJsonToPropertyValues()
     assertSequencesEqual(aArgs, comphelper::containerToSequence(desktop::jsonToPropertyValuesVector(arguments)));
 }
 
+void LOKInitTest::testJsonToPropertyValuesBorder()
+{
+    const char arguments[] = "{"
+        "\"OuterBorder\": {"
+            "\"type\" : \"[]any\","
+            "\"value\" : ["
+                "{ \"type\" : \"com.sun.star.table.BorderLine2\", \"value\" : { \"Color\" : { \"type\" : \"com.sun.star.util.Color\", \"value\" : 0 }, \"InnerLineWidth\" : { \"type\" : \"short\", \"value\" : 0 }, \"OuterLineWidth\" : { \"type\" : \"short\", \"value\" : 1 }, \"LineDistance\" : { \"type\" : \"short\", \"value\" : 0 },  \"LineStyle\" : { \"type\" : \"short\", \"value\" : 0 }, \"LineWidth\" : { \"type\" : \"unsigned long\", \"value\" : 1 } } },"
+                "{ \"type\" : \"com.sun.star.table.BorderLine2\", \"value\" : { \"Color\" : { \"type\" : \"com.sun.star.util.Color\", \"value\" : 0 }, \"InnerLineWidth\" : { \"type\" : \"short\", \"value\" : 0 }, \"OuterLineWidth\" : { \"type\" : \"short\", \"value\" : 1 }, \"LineDistance\" : { \"type\" : \"short\", \"value\" : 0 },  \"LineStyle\" : { \"type\" : \"short\", \"value\" : 0 }, \"LineWidth\" : { \"type\" : \"unsigned long\", \"value\" : 1 } } },"
+                "{ \"type\" : \"com.sun.star.table.BorderLine2\", \"value\" : { \"Color\" : { \"type\" : \"com.sun.star.util.Color\", \"value\" : 0 }, \"InnerLineWidth\" : { \"type\" : \"short\", \"value\" : 0 }, \"OuterLineWidth\" : { \"type\" : \"short\", \"value\" : 1 }, \"LineDistance\" : { \"type\" : \"short\", \"value\" : 0 },  \"LineStyle\" : { \"type\" : \"short\", \"value\" : 0 }, \"LineWidth\" : { \"type\" : \"unsigned long\", \"value\" : 1 } } },"
+                "{ \"type\" : \"com.sun.star.table.BorderLine2\", \"value\" : { \"Color\" : { \"type\" : \"com.sun.star.util.Color\", \"value\" : 0 }, \"InnerLineWidth\" : { \"type\" : \"short\", \"value\" : 0 }, \"OuterLineWidth\" : { \"type\" : \"short\", \"value\" : 1 }, \"LineDistance\" : { \"type\" : \"short\", \"value\" : 0 },  \"LineStyle\" : { \"type\" : \"short\", \"value\" : 0 }, \"LineWidth\" : { \"type\" : \"unsigned long\", \"value\" : 1 } } },"
+                "{ \"type\" : \"long\", \"value\" : 0 },"
+                "{ \"type\" : \"long\", \"value\" : 0 },"
+                "{ \"type\" : \"long\", \"value\" : 0 },"
+                "{ \"type\" : \"long\", \"value\" : 0 },"
+                "{ \"type\" : \"long\", \"value\" : 0 }"
+            "]"
+        "},"
+        "\"InnerBorder\":{"
+            "\"type\" : \"[]any\","
+            "\"value\" : ["
+                "{ \"type\" : \"com.sun.star.table.BorderLine2\", \"value\" : { \"Color\" : { \"type\" : \"com.sun.star.util.Color\", \"value\" : 0 }, \"InnerLineWidth\" : { \"type\" : \"short\", \"value\" : 0 }, \"OuterLineWidth\" : { \"type\" : \"short\", \"value\" : 1 }, \"LineDistance\" : { \"type\" : \"short\", \"value\" : 0 },  \"LineStyle\" : { \"type\" : \"short\", \"value\" : 0 }, \"LineWidth\" : { \"type\" : \"unsigned long\", \"value\" : 1 } } },"
+                "{ \"type\" : \"com.sun.star.table.BorderLine2\", \"value\" : { \"Color\" : { \"type\" : \"com.sun.star.util.Color\", \"value\" : 0 }, \"InnerLineWidth\" : { \"type\" : \"short\", \"value\" : 0 }, \"OuterLineWidth\" : { \"type\" : \"short\", \"value\" : 1 }, \"LineDistance\" : { \"type\" : \"short\", \"value\" : 0 },  \"LineStyle\" : { \"type\" : \"short\", \"value\" : 0 }, \"LineWidth\" : { \"type\" : \"unsigned long\", \"value\" : 1 } } },"
+                "{ \"type\" : \"short\", \"value\" : 0 },"
+                "{ \"type\" : \"short\", \"value\" : 127 },"
+                "{ \"type\" : \"long\", \"value\" : 0 }"
+            "]"
+        "}}";
+
+    // see SvxBoxItem::QueryValue for details
+    uno::Sequence<uno::Any> aOuterSeq(9);
+    table::BorderLine2 aLine(sal_Int32(COL_BLACK), 0, 1, 0, table::BorderLineStyle::SOLID, 1);
+    aOuterSeq[0] = uno::makeAny(aLine); // left
+    aOuterSeq[1] = uno::makeAny(aLine); // right
+    aOuterSeq[2] = uno::makeAny(aLine); // bottom
+    aOuterSeq[3] = uno::makeAny(aLine); // top
+    aOuterSeq[4] = uno::makeAny((sal_Int32)(0));
+    aOuterSeq[5] = uno::makeAny((sal_Int32)(0));
+    aOuterSeq[6] = uno::makeAny((sal_Int32)(0));
+    aOuterSeq[7] = uno::makeAny((sal_Int32)(0));
+    aOuterSeq[8] = uno::makeAny((sal_Int32)(0));
+
+    // see SvxBoxInfoItem::QueryValue() for details
+    uno::Sequence<uno::Any> aInnerSeq(5);
+    aInnerSeq[0] = uno::makeAny(aLine); // horizontal
+    aInnerSeq[1] = uno::makeAny(aLine); // vertical
+    aInnerSeq[2] = uno::makeAny((sal_Int16)(0));
+    aInnerSeq[3] = uno::makeAny((sal_Int16)(0x7F));
+    aInnerSeq[4] = uno::makeAny((sal_Int32)(0));
+
+    uno::Sequence<beans::PropertyValue> aArgs(2);
+    aArgs[0].Name = "OuterBorder";
+    aArgs[0].Value <<= aOuterSeq;
+    aArgs[1].Name = "InnerBorder";
+    aArgs[1].Value <<= aInnerSeq;
+
+    assertSequencesEqual(aArgs, comphelper::containerToSequence(desktop::jsonToPropertyValuesVector(arguments)));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(LOKInitTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 56aea139736275cf0e855674ea96faec42fb68db
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Tue Jun 19 00:00:05 2018 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Aug 20 11:59:22 2018 +0200

    lok: Unit test for jsonToPropertyValuesVector.
    
    Change-Id: I3e0623cc68838c650edbd03cc89bf3fcb8098ff8
    (cherry picked from commit f4e8bbe596cb337c36c3e80b53cac3f4beb85685)

diff --git a/desktop/CppunitTest_desktop_lokinit.mk b/desktop/CppunitTest_desktop_lokinit.mk
new file mode 100644
index 000000000000..91493dee4530
--- /dev/null
+++ b/desktop/CppunitTest_desktop_lokinit.mk
@@ -0,0 +1,47 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,desktop_lok_init))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,desktop_lok_init, \
+    desktop/qa/unit/desktop-lok-init \
+))
+
+$(eval $(call gb_CppunitTest_use_external,desktop_lok_init,boost_headers))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,desktop_lok_init))
+
+$(eval $(call gb_CppunitTest_set_include,desktop_lok_init,\
+    -I$(SRCDIR)/desktop/source/inc \
+    -I$(SRCDIR)/desktop/inc \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,desktop_lok_init, \
+	comphelper \
+	cppu \
+	sal \
+	sofficeapp \
+	vcl \
+	$(gb_UWINAPI) \
+))
+
+ifeq ($(OS),LINUX)
+$(eval $(call gb_CppunitTest_add_libs,desktop_lok_init,\
+    -lm \
+    -ldl \
+    -lpthread \
+))
+endif
+
+$(eval $(call gb_CppunitTest_use_configuration,desktop_lok_init))
+
+# vim: set noet sw=4 ts=4:
diff --git a/desktop/Module_desktop.mk b/desktop/Module_desktop.mk
index 17ec5bf52b12..ca527504ee40 100644
--- a/desktop/Module_desktop.mk
+++ b/desktop/Module_desktop.mk
@@ -143,6 +143,7 @@ $(eval $(call gb_Module_add_check_targets,desktop, \
 ifeq ($(OS),LINUX)
 $(eval $(call gb_Module_add_check_targets,desktop, \
     CppunitTest_desktop_lib \
+    CppunitTest_desktop_lokinit \
 ))
 endif
 
diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx
index c8162c1fea2f..2cb76ee3c9e2 100644
--- a/desktop/inc/lib/init.hxx
+++ b/desktop/inc/lib/init.hxx
@@ -16,9 +16,11 @@
 #include <mutex>
 
 #include <osl/thread.h>
+#include <rtl/ref.hxx>
 #include <vcl/idle.hxx>
 #include <LibreOfficeKit/LibreOfficeKit.h>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/frame/XStorable.hpp>
 #include <com/sun/star/lang/XComponent.hpp>
 
@@ -99,6 +101,10 @@ namespace desktop {
     /// comma, like: Name1=Value1,Name2=Value2,Name3=Value3.
     /// @param rOptions When exctacted, the Param=Value is removed from it.
     DESKTOP_DLLPUBLIC OUString extractParameter(OUString& aOptions, const OUString& rName);
+
+    /// Helper function to convert JSON to a vector of PropertyValues.
+    /// Public to be unit-test-able.
+    DESKTOP_DLLPUBLIC std::vector<com::sun::star::beans::PropertyValue> jsonToPropertyValuesVector(const char* pJSON);
 }
 
 #endif
diff --git a/desktop/qa/unit/desktop-lok-init.cxx b/desktop/qa/unit/desktop-lok-init.cxx
new file mode 100644
index 000000000000..07abe887ccfd
--- /dev/null
+++ b/desktop/qa/unit/desktop-lok-init.cxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <memory>
+#include <boost/property_tree/json_parser.hpp>
+#include <cppunit/TestFixture.h>
+#include <cppunit/plugin/TestPlugIn.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <comphelper/anytostring.hxx>
+#include <comphelper/sequence.hxx>
+#include <cstdlib>
+#include <string>
+#include <stdio.h>
+
+#include <osl/file.hxx>
+#include <rtl/bootstrap.hxx>
+#include <vcl/scheduler.hxx>
+
+#include <lib/init.hxx>
+
+using namespace css;
+
+/// Unit tests for desktop/source/lib/init.cxx internals.
+class LOKInitTest : public ::CppUnit::TestFixture
+{
+public:
+    LOKInitTest()
+    {
+    }
+
+    void testJsonToPropertyValues();
+
+    CPPUNIT_TEST_SUITE(LOKInitTest);
+    CPPUNIT_TEST(testJsonToPropertyValues);
+    CPPUNIT_TEST_SUITE_END();
+};
+
+namespace {
+
+void assertSequencesEqual(const uno::Sequence<beans::PropertyValue>& expected, const uno::Sequence<beans::PropertyValue>& actual)
+{
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("The sequences should have the same length", expected.getLength(), actual.getLength());
+    for (int i = 0; i < expected.getLength(); ++i)
+    {
+        CPPUNIT_ASSERT_EQUAL(expected[i].Name, actual[i].Name);
+        CPPUNIT_ASSERT_EQUAL(comphelper::anyToString(expected[i].Value), comphelper::anyToString(actual[i].Value));
+    }
+}
+
+}
+
+void LOKInitTest::testJsonToPropertyValues()
+{
+    const char arguments[] = "{"
+        "\"FileName\":{"
+            "\"type\":\"string\","
+            "\"value\":\"something.odt\""
+        "}}";
+
+    uno::Sequence<beans::PropertyValue> aArgs(1);
+    aArgs[0].Name = "FileName";
+    aArgs[0].Value <<= OUString("something.odt");
+
+    assertSequencesEqual(aArgs, comphelper::containerToSequence(desktop::jsonToPropertyValuesVector(arguments)));
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(LOKInitTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 79de10127fa5..85c22c02eb9d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -313,7 +313,7 @@ static uno::Any jsonToUnoAny(const boost::property_tree::ptree& aTree)
     return aAny;
 }
 
-static std::vector<beans::PropertyValue> jsonToPropertyValuesVector(const char* pJSON)
+std::vector<beans::PropertyValue> desktop::jsonToPropertyValuesVector(const char* pJSON)
 {
     std::vector<beans::PropertyValue> aArguments;
     if (pJSON && pJSON[0] != '\0')
commit ebfc551893bfdd8ce6937f630d02e85b76e0c6a0
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Mon Jun 18 08:28:40 2018 -0400
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Aug 20 11:59:14 2018 +0200

    lokit: add jsonToUnoAny
    
    Change-Id: I79c2fe22fe7f3a8daa121ecaa529b6bca3216bf3
    (cherry picked from commit 1664de4d0b02bd99a14048244cdb8c1d7db3007a)

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index e63653507093..79de10127fa5 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -48,6 +48,9 @@
 #include <com/sun/star/lang/Locale.hpp>
 #include <com/sun/star/lang/XComponent.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/reflection/theCoreReflection.hpp>
+#include <com/sun/star/reflection/XIdlClass.hpp>
+#include <com/sun/star/reflection/XIdlReflection.hpp>
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/ucb/XContentProvider.hpp>
 #include <com/sun/star/ucb/XUniversalContentBroker.hpp>
@@ -250,19 +253,79 @@ static OUString getAbsoluteURL(const char* pURL)
     return OUString();
 }
 
+static uno::Any jsonToUnoAny(const boost::property_tree::ptree& aTree)
+{
+    uno::Any aAny;
+    uno::Any aValue;
+    sal_Int32 nFields;
+    uno::TypeClass aTypeClass;
+    uno::Reference< reflection::XIdlField > aField;
+    boost::property_tree::ptree aNodeNull, aNodeValue, aNodeField;
+    const std::string& rType = aTree.get<std::string>("type", "");
+    const std::string& rValue = aTree.get<std::string>("value", "");
+    uno::Sequence< uno::Reference< reflection::XIdlField > > aFields;
+    uno::Reference< reflection:: XIdlClass > xIdlClass =
+        css::reflection::theCoreReflection::get(comphelper::getProcessComponentContext())->forName(OUString::fromUtf8(rType.c_str()));
+    if (xIdlClass.is())
+    {
+        aTypeClass = xIdlClass->getTypeClass();
+        xIdlClass->createObject(aAny);
+        aFields = xIdlClass->getFields();
+        nFields = aFields.getLength();
+        aNodeValue = aTree.get_child("value", aNodeNull);
+        if (nFields > 0 && aNodeValue != aNodeNull)
+        {
+            for (sal_Int32 itField = 0; itField < nFields; ++itField)
+            {
+                aField = aFields[itField];
+                aNodeField = aNodeValue.get_child(aField->getName().toUtf8().getStr(), aNodeNull);
+                if (aNodeField != aNodeNull)
+                {
+                    aValue = jsonToUnoAny(aNodeField);
+                    aField->set(aAny, aValue);
+                }
+            }
+        }
+        else if (!rValue.empty())
+        {
+            if (aTypeClass == uno::TypeClass_VOID)
+                aAny.clear();
+            else if (aTypeClass == uno::TypeClass_BYTE)
+                aAny <<= static_cast<sal_Int8>(OString(rValue.c_str()).toInt32());
+            else if (aTypeClass == uno::TypeClass_BOOLEAN)
+                aAny <<= OString(rValue.c_str()).toBoolean();
+            else if (aTypeClass == uno::TypeClass_SHORT)
+                aAny <<= static_cast<sal_Int16>(OString(rValue.c_str()).toInt32());
+            else if (aTypeClass == uno::TypeClass_UNSIGNED_SHORT)
+                aAny <<= static_cast<sal_uInt16>(OString(rValue.c_str()).toUInt32());
+            else if (aTypeClass == uno::TypeClass_LONG)
+                aAny <<= OString(rValue.c_str()).toInt32();
+            else if (aTypeClass == uno::TypeClass_UNSIGNED_LONG)
+                aAny <<= static_cast<sal_uInt32>(OString(rValue.c_str()).toInt32());
+            else if (aTypeClass == uno::TypeClass_FLOAT)
+                aAny <<= OString(rValue.c_str()).toFloat();
+            else if (aTypeClass == uno::TypeClass_DOUBLE)
+                aAny <<= OString(rValue.c_str()).toDouble();
+            else if (aTypeClass == uno::TypeClass_STRING)
+                aAny <<= OUString::fromUtf8(rValue.c_str());
+        }
+    }
+    return aAny;
+}
+
 static std::vector<beans::PropertyValue> jsonToPropertyValuesVector(const char* pJSON)
 {
     std::vector<beans::PropertyValue> aArguments;
     if (pJSON && pJSON[0] != '\0')
     {
-        boost::property_tree::ptree aTree;
+        boost::property_tree::ptree aTree, aNodeNull, aNodeValue;
         std::stringstream aStream(pJSON);
         boost::property_tree::read_json(aStream, aTree);
 
         for (const auto& rPair : aTree)
         {
-            const std::string& rType = rPair.second.get<std::string>("type");
-            const std::string& rValue = rPair.second.get<std::string>("value");
+            const std::string& rType = rPair.second.get<std::string>("type", "");
+            const std::string& rValue = rPair.second.get<std::string>("value", "");
 
             beans::PropertyValue aValue;
             aValue.Name = OUString::fromUtf8(rPair.first.c_str());
@@ -276,6 +339,18 @@ static std::vector<beans::PropertyValue> jsonToPropertyValuesVector(const char*
                 aValue.Value <<= OString(rValue.c_str()).toInt32();
             else if (rType == "unsigned short")
                 aValue.Value <<= static_cast<sal_uInt16>(OString(rValue.c_str()).toUInt32());
+            else if (rType == "[]any")
+            {
+                aNodeValue = rPair.second.get_child("value", aNodeNull);
+                if (aNodeValue != aNodeNull && aNodeValue.size() > 0)
+                {
+                    sal_Int32 itSeq = 0;
+                    uno::Sequence< uno::Any > aSeq(aNodeValue.size());
+                    for (const auto& rSeqPair : aNodeValue)
+                        aSeq[itSeq++] = jsonToUnoAny(rSeqPair.second);
+                    aValue.Value <<= aSeq;
+                }
+            }
             else
                 SAL_WARN("desktop.lib", "jsonToPropertyValuesVector: unhandled type '"<<rType<<"'");
             aArguments.push_back(aValue);
commit f0132cad1654210547015e5f33fcbee48feb9461
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Wed May 23 16:47:49 2018 -0400
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Aug 20 11:59:05 2018 +0200

    sc:test: fix access configuration ui dialogs
    
    Change-Id: If5c5ec12fab7bca0c874efbec64661f4d0e1496d
    Reviewed-on: https://gerrit.libreoffice.org/54735
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>
    (cherry picked from commit 54ba02f3ac2a0868106348ba83b66a69862d3674)

diff --git a/sc/CppunitTest_sc_tiledrendering.mk b/sc/CppunitTest_sc_tiledrendering.mk
index fb86e258ba6e..12d477750ea1 100644
--- a/sc/CppunitTest_sc_tiledrendering.mk
+++ b/sc/CppunitTest_sc_tiledrendering.mk
@@ -53,7 +53,7 @@ $(eval $(call gb_CppunitTest_use_vcl,sc_tiledrendering))
 
 $(eval $(call gb_CppunitTest_use_rdb,sc_tiledrendering,services))
 
-$(eval $(call gb_CppunitTest_use_configuration,sc_tiledrendering))
+$(eval $(call gb_CppunitTest_use_instdir_configuration,sc_tiledrendering))
 
 $(call gb_CppunitTest_get_target,sc_tiledrendering) : $(call gb_AllLangResTarget_get_target,sc)
 
commit 50ecb5c0258581cfc9a18749deb6a410f8d350c0
Author:     Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Wed May 16 21:43:59 2018 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Aug 20 11:58:48 2018 +0200

    lok: sc: tunneled spell-check context menu appear in bottom right corner
    
    In the end it seems that in this context LogicToLogic is used for
    converting non-pixel units, too.
    
    Change-Id: I268e5522e929dd55af1284c38780064315d8cd41
    Reviewed-on: https://gerrit.libreoffice.org/54465
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>
    (cherry picked from commit 873f09df02a14c8e16ff13ce189c0af3317a754a)

diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 302703bf4e8a..8a5d5dcc62fd 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -445,13 +445,22 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow,
 
     if (bLOKActive && pLOKTwipsPos)
     {
-        // if we use pW->LogicToLogic(aPos, pW->GetMapMode(), MapMode(MapUnit::MapTwip)),
-        // when map mode is not enabled, we gets a 20 twips per pixel conversion
-        // since LogicToLogic uses a fixed 72 dpi value, instead of a correctly
-        // computed output device dpi or at least the most commonly used 96 dpi
-        // value; and anyway the following is what we already do in
-        // ScGridWindow::LogicInvalidate when map mode is not enabled.
-        *pLOKTwipsPos = pW->PixelToLogic(aPos, MapMode(MapUnit::MapTwip));
+        if (pW->IsMapModeEnabled() || pW->GetMapMode().GetMapUnit() == MapUnit::MapPixel)
+        {
+            // if we use pW->LogicToLogic(aPos, pW->GetMapMode(), MapMode(MapUnit::MapTwip)),
+            // for pixel conversions when map mode is not enabled, we gets
+            // a 20 twips per pixel conversion since LogicToLogic uses
+            // a fixed 72 dpi value, instead of a correctly computed output
+            // device dpi or at least the most commonly used 96 dpi value;
+            // and anyway the following is what we already do in
+            // ScGridWindow::LogicInvalidate when map mode is not enabled.
+
+            *pLOKTwipsPos = pW->PixelToLogic(aPos, MapMode(MapUnit::MapTwip));
+        }
+        else
+        {
+            *pLOKTwipsPos = pW->LogicToLogic(aPos, pW->GetMapMode(), MapMode(MapUnit::MapTwip));
+        }
     }
 
     // caller expects coordinates relative to top-level win
commit 453d97a7b3ee55b13aff7941087f5e88a7247bd4
Author:     Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Fri Apr 27 21:51:41 2018 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Aug 20 11:58:40 2018 +0200

    lok: sc: tunneling the ascii import dialog on paste action
    
    I needed to modify CreateScImportAsciiDlg signature so that we are
    able
    to pass a pointer to a dialog parent window to ScImportAsciiDlg.
    
    Moreover, I needed to perform the execution of the ScImportAsciiDlg
    dialog in ScViewFunc::PasteDataFormat asynchronously, both for lok and
    desktop case. In order to achieve this result it has been needed
    to modify the lifespan of some objects previously local
    to PasteDataFormat.
    
    Since PasteDataFormat returns a boolean, I took care to check how this
    return value is used. I found out 2 cases:
    1) in ScViewFunc::PasteFromSystem where it is used for popping up an
    error dialog box, informing the user in the case that the paste
    operation is failed;
    2) in ScGridWindow::ExecuteDrop where it is used for informing the
    system window manager of the success or fail of the drag and drop
    action.
    
    The first case is now handled by a lamba invoked soon after the dialog
    execution ended. The second case is more tricky: I handle it as
    the paste operation is always successful, hoping it doesn't do any
    real
    difference since the return value is used not by LO but by the system
    window manager (e.g. gtk).
    
    The asynchronous call and the behaviors described above occur only
    when the paste operation involves some kind of simple text, in all
    other
    cases nothing is changed.
    
    Change-Id: Id4f96180a9336f665a22a2441ea490af993431b0
    Reviewed-on: https://gerrit.libreoffice.org/53931
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>
    (cherry picked from commit 32ebfd0da5da80a2fc7b92469024585f1d49bb16)

diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 67be06b9ad73..92c66e392902 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -394,7 +394,8 @@ class ScAbstractDialogFactory
 public:
     SC_DLLPUBLIC static ScAbstractDialogFactory*    Create();
 
-    virtual     VclPtr<AbstractScImportAsciiDlg> CreateScImportAsciiDlg( const OUString& aDatName,
+    virtual     VclPtr<AbstractScImportAsciiDlg> CreateScImportAsciiDlg(vcl::Window* pParent,
+                                                                    const OUString& aDatName,
                                                                     SvStream* pInStream,
                                                                     ScImportAsciiCall eCall) = 0;
 
diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx
index 3cf875b3cc05..9def8077e515 100644
--- a/sc/qa/unit/screenshots/screenshots.cxx
+++ b/sc/qa/unit/screenshots/screenshots.cxx
@@ -244,7 +244,7 @@ VclPtr<VclAbstractDialog> ScScreenshotTest::createDialogByID(sal_uInt32 nID)
 
         case 13: // "modules/scalc/ui/textimportcsv.ui"
         {
-            pReturnDialog = mpFact->CreateScImportAsciiDlg(OUString(), mpStream.get(), SC_PASTETEXT);
+            pReturnDialog = mpFact->CreateScImportAsciiDlg(nullptr, OUString(), mpStream.get(), SC_PASTETEXT);
             break;
         }
         case 14: // "modules/scalc/ui/formatcellsdialog.ui"
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 733afc03d39a..dfcd08f4639c 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -604,10 +604,11 @@ bool AbstractScTextImportOptionsDlg_Impl::IsDateConversionSet() const
 }
 
 // =========================Factories  for createdialog ===================
-VclPtr<AbstractScImportAsciiDlg> ScAbstractDialogFactory_Impl::CreateScImportAsciiDlg ( const OUString& aDatName,
+VclPtr<AbstractScImportAsciiDlg> ScAbstractDialogFactory_Impl::CreateScImportAsciiDlg ( vcl::Window* pParent,
+                                                    const OUString& aDatName,
                                                     SvStream* pInStream, ScImportAsciiCall eCall )
 {
-    VclPtr<ScImportAsciiDlg> pDlg = VclPtr<ScImportAsciiDlg>::Create( nullptr, aDatName,pInStream, eCall );
+    VclPtr<ScImportAsciiDlg> pDlg = VclPtr<ScImportAsciiDlg>::Create( pParent, aDatName,pInStream, eCall );
     return VclPtr<AbstractScImportAsciiDlg_Impl>::Create( pDlg );
 }
 
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index ef6e0a6a1057..2a0e2652c5c6 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -418,7 +418,8 @@ class ScAbstractDialogFactory_Impl : public ScAbstractDialogFactory
 public:
     virtual ~ScAbstractDialogFactory_Impl() {}
 
-    virtual VclPtr<AbstractScImportAsciiDlg> CreateScImportAsciiDlg( const OUString& aDatName,
+    virtual VclPtr<AbstractScImportAsciiDlg> CreateScImportAsciiDlg(vcl::Window* pParent,
+                                                                    const OUString& aDatName,
                                                                     SvStream* pInStream,
                                                                     ScImportAsciiCall eCall) override;
 
diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx
index f11fc1ee18d5..f5188d93e4d0 100644
--- a/sc/source/ui/unoobj/filtuno.cxx
+++ b/sc/source/ui/unoobj/filtuno.cxx
@@ -176,7 +176,7 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException, st
         if ( xInputStream.is() )
             pInStream.reset(utl::UcbStreamHelper::CreateStream( xInputStream ));
 
-        ScopedVclPtr<AbstractScImportAsciiDlg> pDlg(pFact->CreateScImportAsciiDlg( aPrivDatName, pInStream.get(), SC_IMPORTFILE));
+        ScopedVclPtr<AbstractScImportAsciiDlg> pDlg(pFact->CreateScImportAsciiDlg(nullptr, aPrivDatName, pInStream.get(), SC_IMPORTFILE));
         OSL_ENSURE(pDlg, "Dialog create fail!");
         if ( pDlg->Execute() == RET_OK )
         {
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 8f4d031e6564..2cb6af596414 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -983,7 +983,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
                     ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
                     OSL_ENSURE( pFact, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pFact is null!" );
                     ScopedVclPtr<AbstractScImportAsciiDlg> pDlg(pFact->CreateScImportAsciiDlg(
-                        OUString(), &aStream, SC_TEXTTOCOLUMNS));
+                            nullptr, OUString(), &aStream, SC_TEXTTOCOLUMNS));
                     OSL_ENSURE( pDlg, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pDlg is null!" );
 
                     if ( pDlg->Execute() == RET_OK )
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index 9a3ae1b14f04..c1da82818cef 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -44,6 +44,7 @@
 #include <svtools/transfer.hxx>
 #include <vcl/graph.hxx>
 
+#include <comphelper/lok.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/storagehelper.hxx>
 #include <comphelper/string.hxx>
@@ -56,6 +57,8 @@
 #include "dbdata.hxx"
 #include "sc.hrc"
 #include "filter.hxx"
+#include "globstr.hrc"
+#include "global.hxx"
 #include "scextopt.hxx"
 #include "tabvwsh.hxx"
 #include "compiler.hxx"
@@ -293,10 +296,11 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
         else
         {
             ScAddress aCellPos( nPosX, nPosY, GetViewData().GetTabNo() );
-            ScImportExport aObj( GetViewData().GetDocument(), aCellPos );
-            aObj.SetOverwriting( true );
+            std::shared_ptr<ScImportExport> pObj(new ScImportExport(GetViewData().GetDocument(), aCellPos));
+            pObj->SetOverwriting( true );
 
-            OUString aStr;
+
+            std::shared_ptr<OUString> pStrBuffer(new OUString());
             tools::SvRef<SotStorageStream> xStream;
             if ( aDataHelper.GetSotStorageStream( nFormatId, xStream ) && xStream.Is() )
             {
@@ -314,7 +318,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
                         ScAsciiOptions aOptions;
                         aOptions.SetLanguage(pDlg->GetLanguageType());
                         aOptions.SetDetectSpecialNumber(pDlg->IsDateConversionSet());
-                        aObj.SetExtOptions(aOptions);
+                        pObj->SetExtOptions(aOptions);
                     }
                     else
                     {
@@ -323,46 +327,63 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
                     }
                 }
                 if(!bRet)
-                    bRet = aObj.ImportStream( *xStream, OUString(), nFormatId );
+                    bRet = pObj->ImportStream( *xStream, OUString(), nFormatId );
                 // mba: clipboard always must contain absolute URLs (could be from alien source)
             }
-            else if (nFormatId == SotClipboardFormatId::STRING && aDataHelper.GetString( nFormatId, aStr ))
+
+            else if (nFormatId == SotClipboardFormatId::STRING && aDataHelper.GetString( nFormatId, *pStrBuffer ))
             {
                 // Do CSV dialog if more than one line.
-                sal_Int32 nDelim = aStr.indexOf('\n');
-                if (nDelim >= 0 && nDelim != aStr.getLength () - 1)
+                sal_Int32 nDelim = pStrBuffer->indexOf('\n');
+                if (nDelim >= 0 && nDelim != pStrBuffer->getLength () - 1)
                 {
-                    ScImportStringStream aStrm( aStr);
-                    ScAbstractDialogFactory* pFact =
-                        ScAbstractDialogFactory::Create();
-                    ScopedVclPtr<AbstractScImportAsciiDlg> pDlg(
-                        pFact->CreateScImportAsciiDlg( OUString(), &aStrm, SC_PASTETEXT));
+                    vcl::Window* pParent = comphelper::LibreOfficeKit::isActive() ? GetActiveWin() : nullptr;
 
-                    if (pDlg->Execute() == RET_OK)
-                    {
-                        ScAsciiOptions aOptions;
-                        pDlg->GetOptions( aOptions );
-                        pDlg->SaveParameters();
-                        aObj.SetExtOptions( aOptions );
+                    std::shared_ptr<ScImportStringStream> pStrm(new ScImportStringStream(*pStrBuffer));
+
+                    ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
+                    VclPtr<AbstractScImportAsciiDlg> pDlg(
+                        pFact->CreateScImportAsciiDlg(pParent, OUString(), pStrm.get(), SC_PASTETEXT));
+
+                    bAllowDialogs = bAllowDialogs && !SC_MOD()->IsInExecuteDrop();
+
+                    pDlg->StartExecuteAsync([this, pDlg, pDoc, pStrm, nFormatId, pStrBuffer, pObj, bAllowDialogs](sal_Int32 nResult){
+                        bool bShowErrorDialog = bAllowDialogs;
+                        if (RET_OK == nResult)
+                        {
+                            ScAsciiOptions aOptions;
+                            pDlg->GetOptions( aOptions );
+                            pDlg->SaveParameters();
+                            pObj->SetExtOptions( aOptions );
+                            pObj->ImportString( *pStrBuffer, nFormatId );
+
+                            // TODO: what if (aObj.IsOverflow())
+                            // Content was partially pasted, which can be undone by
+                            // the user though.
+                            bShowErrorDialog = bShowErrorDialog && pObj->IsOverflow();
+                        }
+                        else
+                        {
+                            bShowErrorDialog = false;
+                            // Yes, no failure, don't raise a "couldn't paste"
+                            // dialog if user cancelled.
+                        }
 
-                        bRet = aObj.ImportString( aStr, nFormatId );
+                        InvalidateAttribs();
+                        GetViewData().UpdateInputHandler();
 
-                        // TODO: what if (aObj.IsOverflow())
-                        // Content was partially pasted, which can be undone by
-                        // the user though.
-                        if (aObj.IsOverflow())
-                            bRet = false;
-                    }
-                    else
-                        bRet = true;
-                        // Yes, no failure, don't raise a "couldn't paste"
-                        // dialog if user cancelled.
+                        pDoc->SetPastingDrawFromOtherDoc( false );
+
+                        if (bShowErrorDialog)
+                            ErrorMessage(STR_PASTE_ERROR);
+                    });
+                    return true;
                 }
                 else
-                    bRet = aObj.ImportString( aStr, nFormatId );
+                    bRet = pObj->ImportString( *pStrBuffer, nFormatId );
             }
-            else if (nFormatId != SotClipboardFormatId::STRING && aDataHelper.GetString( nFormatId, aStr ))
-                bRet = aObj.ImportString( aStr, nFormatId );
+            else if (nFormatId != SotClipboardFormatId::STRING && aDataHelper.GetString( nFormatId, *pStrBuffer ))
+                bRet = pObj->ImportString( *pStrBuffer, nFormatId );
 
             InvalidateAttribs();
             GetViewData().UpdateInputHandler();
commit 1fdb3ae15960396889400d2f458b76d58ab18a58
Author:     Andras Timar <andras.timar at collabora.com>
AuthorDate: Wed May 23 14:10:08 2018 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Aug 20 11:58:28 2018 +0200

    curl: upgrade to release 7.60.0
    
    Change-Id: Ic8510b424f52c059f979e26441e67ec15b332933
    (cherry picked from commit f5a1568cb2e41b68d65e81dda099bc767a7a7801)
    (cherry picked from commit 3f83a6d632ab3839fbab3865366e8a1eb244cbe3)

diff --git a/download.lst b/download.lst
index d857917a5e2b..04d84a1bde56 100644
--- a/download.lst
+++ b/download.lst
@@ -24,8 +24,8 @@ export COLLADA2GLTF_TARBALL := 4b87018f7fff1d054939d19920b751a0-collada2gltf-mas
 export CPPUNIT_MD5SUM := d1c6bdd5a76c66d2c38331e2d287bc01
 export CPPUNIT_TARBALL := cppunit-1.13.2.tar.gz
 export CT2N_TARBALL := 1f467e5bb703f12cbbb09d5cf67ecf4a-converttexttonumber-1-5-0.oxt
-export CURL_MD5SUM := 4e1ef056e117b4d25f4ec42ac609c0d4
-export CURL_TARBALL := curl-7.52.1.tar.gz
+export CURL_MD5SUM := 48eb126345d3b0f0a71a486b7f5d0307
+export CURL_TARBALL := curl-7.60.0.tar.gz
 export DBGHELP_DLL := 13fbc2e8b37ddf28181dd6d8081c2b8e-dbghelp.dll
 export EBOOK_MD5SUM := 6b48eda57914e6343efebc9381027b78
 export EBOOK_TARBALL := libe-book-0.1.2.tar.bz2
diff --git a/external/curl/CVE-2017-8816.patch b/external/curl/CVE-2017-8816.patch
deleted file mode 100644
index dd4fa677e03f..000000000000
--- a/external/curl/CVE-2017-8816.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From 7947c50bcd09cf471c95511739bc66d2cb506ee2 Mon Sep 17 00:00:00 2001
-From: Daniel Stenberg <daniel at haxx.se>
-Date: Mon, 6 Nov 2017 23:51:52 +0100
-Subject: [PATCH] ntlm: avoid integer overflow for malloc size
-
-Reported-by: Alex Nichols
-Assisted-by: Kamil Dudka and Max Dymond
-
-CVE-2017-8816
-
-Bug: https://curl.haxx.se/docs/adv_2017-11e7.html
----
- lib/curl_ntlm_core.c | 23 +++++++++++++++++++++--
- 1 file changed, 21 insertions(+), 2 deletions(-)
-
-diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c
-index 1309bf0d9..e8962769c 100644
---- a/lib/curl_ntlm_core.c
-+++ b/lib/curl_ntlm_core.c
-@@ -644,23 +644,42 @@ CURLcode Curl_hmac_md5(const unsigned char *key, unsigned int keylen,
-   Curl_HMAC_final(ctxt, output);
- 
-   return CURLE_OK;
- }
- 
-+#ifndef SIZE_T_MAX
-+/* some limits.h headers have this defined, some don't */
-+#if defined(SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > 4)
-+#define SIZE_T_MAX 18446744073709551615U
-+#else
-+#define SIZE_T_MAX 4294967295U
-+#endif
-+#endif
-+
- /* This creates the NTLMv2 hash by using NTLM hash as the key and Unicode
-  * (uppercase UserName + Domain) as the data
-  */
- CURLcode Curl_ntlm_core_mk_ntlmv2_hash(const char *user, size_t userlen,
-                                        const char *domain, size_t domlen,
-                                        unsigned char *ntlmhash,
-                                        unsigned char *ntlmv2hash)
- {
-   /* Unicode representation */
--  size_t identity_len = (userlen + domlen) * 2;
--  unsigned char *identity = malloc(identity_len);
-+  size_t identity_len;
-+  unsigned char *identity;
-   CURLcode result = CURLE_OK;
- 
-+  /* we do the length checks below separately to avoid integer overflow risk
-+     on extreme data lengths */
-+  if((userlen > SIZE_T_MAX/2) ||
-+     (domlen > SIZE_T_MAX/2) ||
-+     ((userlen + domlen) > SIZE_T_MAX/2))
-+    return CURLE_OUT_OF_MEMORY;
-+
-+  identity_len = (userlen + domlen) * 2;
-+  identity = malloc(identity_len);
-+
-   if(!identity)
-     return CURLE_OUT_OF_MEMORY;
- 
-   ascii_uppercase_to_unicode_le(identity, user, userlen);
-   ascii_to_unicode_le(identity + (userlen << 1), domain, domlen);
--- 
-2.15.0
-
diff --git a/external/curl/CVE-2018-1000005.patch b/external/curl/CVE-2018-1000005.patch
deleted file mode 100644
index 7b5578b1aacc..000000000000
--- a/external/curl/CVE-2018-1000005.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From fa3dbb9a147488a2943bda809c66fc497efe06cb Mon Sep 17 00:00:00 2001
-From: Zhouyihai Ding <ddyihai at ddyihai.svl.corp.google.com>
-Date: Wed, 10 Jan 2018 10:12:18 -0800
-Subject: [PATCH] http2: fix incorrect trailer buffer size
-
-Prior to this change the stored byte count of each trailer was
-miscalculated and 1 less than required. It appears any trailer
-after the first that was passed to Curl_client_write would be truncated
-or corrupted as well as the size. Potentially the size of some
-subsequent trailer could be erroneously extracted from the contents of
-that trailer, and since that size is used by client write an
-out-of-bounds read could occur and cause a crash or be otherwise
-processed by client write.
-
-The bug appears to have been born in 0761a51 (precedes 7.49.0).
-
-Closes https://github.com/curl/curl/pull/2231
----
- lib/http2.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/lib/http2.c b/lib/http2.c
-index 8e2fc71996..699287940e 100644
---- a/lib/http2.c
-+++ b/lib/http2.c
-@@ -925,8 +925,8 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
- 
-   if(stream->bodystarted) {
-     /* This is trailer fields. */
--    /* 3 is for ":" and "\r\n". */
--    uint32_t n = (uint32_t)(namelen + valuelen + 3);
-+    /* 4 is for ": " and "\r\n". */
-+    uint32_t n = (uint32_t)(namelen + valuelen + 4);
- 
-     DEBUGF(infof(data_s, "h2 trailer: %.*s: %.*s\n", namelen, name, valuelen,
-                  value));
diff --git a/external/curl/CVE-2018-1000007.patch b/external/curl/CVE-2018-1000007.patch
deleted file mode 100644
index c474370c78ad..000000000000
--- a/external/curl/CVE-2018-1000007.patch
+++ /dev/null
@@ -1,110 +0,0 @@
-From af32cd3859336ab963591ca0df9b1e33a7ee066b Mon Sep 17 00:00:00 2001
-From: Daniel Stenberg <daniel at haxx.se>
-Date: Fri, 19 Jan 2018 13:19:25 +0100
-Subject: [PATCH] http: prevent custom Authorization headers in redirects
-
-... unless CURLOPT_UNRESTRICTED_AUTH is set to allow them. This matches how
-curl already handles Authorization headers created internally.
-
-Note: this changes behavior slightly, for the sake of reducing mistakes.
-
-Added test 317 and 318 to verify.
-
-Reported-by: Craig de Stigter
-Bug: https://curl.haxx.se/docs/adv_2018-b3bf.html
----
- docs/libcurl/opts/CURLOPT_HTTPHEADER.3 | 12 ++++-
- lib/http.c                             | 10 +++-
- lib/setopt.c                           |  2 +-
- lib/urldata.h                          |  2 +-
- tests/data/Makefile.inc                |  2 +-
- tests/data/test317                     | 94 +++++++++++++++++++++++++++++++++
- tests/data/test318                     | 95 ++++++++++++++++++++++++++++++++++
- 7 files changed, 212 insertions(+), 5 deletions(-)
- create mode 100644 tests/data/test317
- create mode 100644 tests/data/test318
-
-diff --git a/docs/libcurl/opts/CURLOPT_HTTPHEADER.3 b/docs/libcurl/opts/CURLOPT_HTTPHEADER.3
-index c5ccb1a53d..c9f29e393e 100644
---- a/docs/libcurl/opts/CURLOPT_HTTPHEADER.3
-+++ b/docs/libcurl/opts/CURLOPT_HTTPHEADER.3
-@@ -5,7 +5,7 @@
- .\" *                            | (__| |_| |  _ <| |___
- .\" *                             \___|\___/|_| \_\_____|
- .\" *
--.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel at haxx.se>, et al.
-+.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel at haxx.se>, et al.
- .\" *
- .\" * This software is licensed as described in the file COPYING, which
- .\" * you should have received as part of this distribution. The terms
-@@ -77,6 +77,16 @@ the headers. They may be private or otherwise sensitive to leak.
- 
- Use \fICURLOPT_HEADEROPT(3)\fP to make the headers only get sent to where you
- intend them to get sent.
-+
-+Custom headers are sent in all requests done by the easy handles, which
-+implies that if you tell libcurl to follow redirects
-+(\fBCURLOPT_FOLLOWLOCATION(3)\fP), the same set of custom headers will be sent
-+in the subsequent request. Redirects can of course go to other hosts and thus
-+those servers will get all the contents of your custom headers too.
-+
-+Starting in 7.58.0, libcurl will specifically prevent "Authorization:" headers
-+from being sent to other hosts than the first used one, unless specifically
-+permitted with the \fBCURLOPT_UNRESTRICTED_AUTH(3)\fP option.
- .SH DEFAULT
- NULL
- .SH PROTOCOLS
-diff --git a/lib/http.c b/lib/http.c
-index c1cdf2da02..a5007670d7 100644
---- a/lib/http.c
-+++ b/lib/http.c
-@@ -714,7 +714,7 @@ Curl_http_output_auth(struct connectdata *conn,
-   if(!data->state.this_is_a_follow ||
-      conn->bits.netrc ||
-      !data->state.first_host ||
--     data->set.http_disable_hostname_check_before_authentication ||
-+     data->set.allow_auth_to_other_hosts ||
-      strcasecompare(data->state.first_host, conn->host.name)) {
-     result = output_auth_headers(conn, authhost, request, path, FALSE);
-   }
-@@ -1636,6 +1636,14 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn,
-                   checkprefix("Transfer-Encoding:", headers->data))
-             /* HTTP/2 doesn't support chunked requests */
-             ;
-+          else if(checkprefix("Authorization:", headers->data) &&
-+                  /* be careful of sending this potentially sensitive header to
-+                     other hosts */
-+                  (data->state.this_is_a_follow &&
-+                   data->state.first_host &&
-+                   !data->set.allow_auth_to_other_hosts &&
-+                   !strcasecompare(data->state.first_host, conn->host.name)))
-+            ;
-           else {
-             CURLcode result = Curl_add_bufferf(req_buffer, "%s\r\n",
-                                                headers->data);
-diff --git a/lib/setopt.c b/lib/setopt.c
-index 66f30ea653..a5ef75c722 100644
---- a/lib/url.c
-+++ b/lib/url.c
-@@ -976,7 +976,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option,
-      * Send authentication (user+password) when following locations, even when
-      * hostname changed.
-      */
--    data->set.http_disable_hostname_check_before_authentication =
-+    data->set.allow_auth_to_other_hosts =
-       (0 != va_arg(param, long)) ? TRUE : FALSE;
-     break;
- 
-diff --git a/lib/urldata.h b/lib/urldata.h
-index 4dcd1a322c..5c04ad1720 100644
---- a/lib/urldata.h
-+++ b/lib/urldata.h
-@@ -1599,7 +1599,7 @@ struct UserDefined {
-   bool http_keep_sending_on_error; /* for HTTP status codes >= 300 */
-   bool http_follow_location; /* follow HTTP redirects */
-   bool http_transfer_encoding; /* request compressed HTTP transfer-encoding */
--  bool http_disable_hostname_check_before_authentication;
-+  bool allow_auth_to_other_hosts;
-   bool include_header;   /* include received protocol headers in data output */
-   bool http_set_referer; /* is a custom referer used */
-   bool http_auto_referer; /* set "correct" referer when following location: */
diff --git a/external/curl/ExternalPackage_curl.mk b/external/curl/ExternalPackage_curl.mk
index 2de52db1b741..56c418b6ef0c 100644
--- a/external/curl/ExternalPackage_curl.mk
+++ b/external/curl/ExternalPackage_curl.mk
@@ -13,16 +13,14 @@ $(eval $(call gb_ExternalPackage_use_external_project,curl,curl))
 
 ifneq ($(DISABLE_DYNLOADING),TRUE)
 
-ifeq ($(OS)$(COM),WNTGCC)
-$(eval $(call gb_ExternalPackage_add_file,curl,$(LIBO_LIB_FOLDER)/libcurl.dll,lib/.libs/libcurl.dll))
-else ifeq ($(COM),MSC)
-$(eval $(call gb_ExternalPackage_add_file,curl,$(LIBO_LIB_FOLDER)/libcurl$(if $(MSVC_USE_DEBUG_RUNTIME),d).dll,lib/$(if $(MSVC_USE_DEBUG_RUNTIME),debug-dll,release-dll)/libcurl$(if $(MSVC_USE_DEBUG_RUNTIME),d).dll))
+ifeq ($(COM),MSC)
+$(eval $(call gb_ExternalPackage_add_file,curl,$(LIBO_LIB_FOLDER)/libcurl$(if $(MSVC_USE_DEBUG_RUNTIME),_debug).dll,builds/libcurl-vc12-$(if $(filter X86_64,$(CPUNAME)),x64,x86)-$(if $(MSVC_USE_DEBUG_RUNTIME),debug,release)-dll-ipv6-sspi-winssl/bin/libcurl$(if $(MSVC_USE_DEBUG_RUNTIME),_debug).dll))
 else ifeq ($(OS),MACOSX)
 $(eval $(call gb_ExternalPackage_add_file,curl,$(LIBO_LIB_FOLDER)/libcurl.4.dylib,lib/.libs/libcurl.4.dylib))
 else ifeq ($(OS),AIX)
 $(eval $(call gb_ExternalPackage_add_file,curl,$(LIBO_LIB_FOLDER)/libcurl.so,lib/.libs/libcurl.so.4))
 else
-$(eval $(call gb_ExternalPackage_add_file,curl,$(LIBO_LIB_FOLDER)/libcurl.so.4,lib/.libs/libcurl.so.4.4.0))
+$(eval $(call gb_ExternalPackage_add_file,curl,$(LIBO_LIB_FOLDER)/libcurl.so.4,lib/.libs/libcurl.so.4.5.0))
 endif
 
 endif # $(DISABLE_DYNLOADING)
diff --git a/external/curl/ExternalProject_curl.mk b/external/curl/ExternalProject_curl.mk
index 5151d75c3f88..136e50f3a81c 100644
--- a/external/curl/ExternalProject_curl.mk
+++ b/external/curl/ExternalProject_curl.mk
@@ -10,7 +10,7 @@
 $(eval $(call gb_ExternalProject_ExternalProject,curl))
 
 $(eval $(call gb_ExternalProject_use_externals,curl,\
-	nss3 \
+	$(if $(ENABLE_NSS),nss3) \
 	zlib \
 ))
 
@@ -21,7 +21,7 @@ $(eval $(call gb_ExternalProject_register_targets,curl,\
 ifneq ($(OS),WNT)
 
 curl_CPPFLAGS :=
-curl_LDFLAGS := $(if $(filter LINUX FREEBSD,$(OS)),"-Wl$(COMMA)-z$(COMMA)origin -Wl$(COMMA)-rpath$(COMMA)\\"\$$\$$ORIGIN)
+curl_LDFLAGS := $(if $(filter LINUX FREEBSD,$(OS)),-Wl$(COMMA)-z$(COMMA)origin -Wl$(COMMA)-rpath$(COMMA)\$$$$ORIGIN)
 
 ifneq ($(OS),ANDROID)
 ifneq ($(SYSBASE),)
@@ -39,16 +39,15 @@ endif
 # use --with-nss only on platforms other than Mac OS X and iOS
 $(call gb_ExternalProject_get_state_target,curl,build):
 	$(call gb_ExternalProject_run,build,\
-		CPPFLAGS="$(curl_CPPFLAGS)" \
-		LDFLAGS=$(curl_LDFLAGS) \
 		./configure \
 			$(if $(filter IOS MACOSX,$(OS)),\
 				--with-darwinssl,\
-				--with-nss$(if $(SYSTEM_NSS),,="$(call gb_UnpackedTarball_get_dir,nss)/dist/out")) \
-			--without-ssl --without-gnutls --without-polarssl --without-cyassl --without-axtls \
+				$(if $(ENABLE_NSS),--with-nss$(if $(SYSTEM_NSS),,="$(call gb_UnpackedTarball_get_dir,nss)/dist/out"),--without-nss)) \
+			--without-ssl --without-gnutls --without-polarssl --without-cyassl --without-axtls --without-mbedtls \
 			--enable-ftp --enable-http --enable-ipv6 \
 			--without-libidn2 --without-libpsl --without-librtmp \
 			--without-libssh2 --without-metalink --without-nghttp2 \
+			--without-libssh --without-brotli \
 			--disable-ares \
 			--disable-dict --disable-file --disable-gopher --disable-imap \
 			--disable-ldap --disable-ldaps --disable-manual --disable-pop3 \
@@ -58,34 +57,33 @@ $(call gb_ExternalProject_get_state_target,curl,build):
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
 			$(if $(filter TRUE,$(DISABLE_DYNLOADING)),--disable-shared,--disable-static) \
 			$(if $(ENABLE_DEBUG),--enable-debug) \
+			$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
 			$(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO) \
-		&& cd lib \
-		&& $(MAKE) \
-	)
-
-else ifeq ($(OS)$(COM),WNTGCC)
-
-$(call gb_ExternalProject_get_state_target,curl,build):
-	$(call gb_ExternalProject_run,build,\
-		./configure --with-nss --without-ssl --enable-ftp --enable-ipv6 --disable-http --disable-gopher \
-			--disable-file --disable-ldap --disable-telnet --disable-dict --build=i586-pc-mingw32 --host=i586-pc-mingw32 \
-			$(if $(ENABLE_DEBUG),--enable-debug) \
-			CC="$(CC) -mthreads $(if $(MINGW_SHARED_GCCLIB),-shared-libgcc)" \
-			LIBS="-lws2_32 -lwinmm $(if $(MINGW_SHARED_GXXLIB),$(MINGW_SHARED_LIBSTDCPP))" \
-			LDFLAGS="$(patsubst ;, -L,$(ILIB))" \
-			CPPFLAGS="$(INCLUDE)" OBJDUMP="objdump" \
+			$(if $(filter MACOSX,$(OS)),CFLAGS='$(CFLAGS) \
+				-mmacosx-version-min=$(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)') \
+			CPPFLAGS='$(curl_CPPFLAGS)' \
+			LDFLAGS='$(curl_LDFLAGS)' \
+			ZLIB_CFLAGS='$(ZLIB_CFLAGS)' ZLIB_LIBS='$(ZLIB_LIBS)' \
 		&& cd lib \
 		&& $(MAKE) \
 	)
 
 else ifeq ($(COM),MSC)
 
+$(eval $(call gb_ExternalProject_use_nmake,curl,build))
+
 $(call gb_ExternalProject_get_state_target,curl,build):
 	$(call gb_ExternalProject_run,build,\
-		MAKEFLAGS= LIB="$(ILIB)" nmake -f Makefile.vc12 \
-			cfg=$(if $(MSVC_USE_DEBUG_RUNTIME),debug-dll,release-dll) \
-			EXCFLAGS="/EHs /D_CRT_SECURE_NO_DEPRECATE /DUSE_WINDOWS_SSPI /D_USING_V110_SDK71_ $(SOLARINC)" $(if $(filter X86_64,$(CPUNAME)),MACHINE=X64) \
-	,lib)
+		nmake -f Makefile.vc \
+			mode=dll \
+			VC=12 \
+			$(if $(filter X86_64,$(CPUNAME)),MACHINE=x64,MACHINE=x86) \
+			GEN_PDB=$(if $(gb_SYMBOL),yes,no) \
+			DEBUG=$(if $(MSVC_USE_DEBUG_RUNTIME),yes,no) \
+			ENABLE_IPV6=yes \
+			ENABLE_SSPI=yes \
+			ENABLE_WINSSL=yes \
+	,winbuild)
 
 endif
 
diff --git a/external/curl/UnpackedTarball_curl.mk b/external/curl/UnpackedTarball_curl.mk
index 19d4ccd4bf2e..1cdb64c0bca2 100644
--- a/external/curl/UnpackedTarball_curl.mk
+++ b/external/curl/UnpackedTarball_curl.mk
@@ -14,19 +14,14 @@ $(eval $(call gb_UnpackedTarball_set_tarball,curl,$(CURL_TARBALL),,curl))
 $(eval $(call gb_UnpackedTarball_set_patchlevel,curl,1))
 
 $(eval $(call gb_UnpackedTarball_fix_end_of_line,curl,\
-	lib/Makefile.vc12 \
+	winbuild/MakefileBuild.vc \
 ))
 
 $(eval $(call gb_UnpackedTarball_add_patches,curl,\
 	external/curl/curl-msvc.patch.1 \
 	external/curl/curl-msvc-disable-protocols.patch.1 \
-	external/curl/curl-msvc-schannel.patch.1 \
-	external/curl/curl-7.26.0_mingw.patch \
 	external/curl/curl-7.26.0_win-proxy.patch \
-	external/curl/curl-xp.patch.1 \
-	external/curl/CVE-2017-8816.patch \
-	external/curl/CVE-2018-1000005.patch \
-	external/curl/CVE-2018-1000007.patch \
+	external/curl/zlib.patch.0 \
 ))
 
 ifeq ($(SYSTEM_NSS),)
@@ -35,12 +30,10 @@ $(eval $(call gb_UnpackedTarball_add_patches,curl,\
 ))
 endif
 
-ifeq ($(OS),MACOSX)
-ifneq ($(filter 1080 1090 101000,$(MAC_OS_X_VERSION_MIN_REQUIRED)),)
-$(eval $(call gb_UnpackedTarball_add_patches,curl,\
-	external/curl/curl-osx.patch.1 \
+ifeq ($(OS)-$(COM_IS_CLANG),WNT-TRUE)
+$(eval $(call gb_UnpackedTarball_add_patches,curl, \
+    external/curl/clang-cl.patch.0 \
 ))
 endif
-endif
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/curl/clang-cl.patch.0 b/external/curl/clang-cl.patch.0
new file mode 100644
index 000000000000..2f7fe567460c
--- /dev/null
+++ b/external/curl/clang-cl.patch.0
@@ -0,0 +1,11 @@
+--- winbuild/MakefileBuild.vc
++++ winbuild/MakefileBuild.vc
+@@ -60,7 +60,7 @@
+ !ELSE
+ CC_NODEBUG  = $(CC) /O2 /DNDEBUG
+ CC_DEBUG    = $(CC) /Od /D_DEBUG /RTC1 /Z7 /LDd
+-CFLAGS      = /I. /I ../lib /I../include /nologo /W4 /wd4127 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL $(SOLARINC)
++CFLAGS      = /I. /I ../lib /I../include /nologo /W4 /wd4127 /EHsc /DWIN32 /c /DBUILDING_LIBCURL $(SOLARINC)
+ !ENDIF
+ 
+ LFLAGS     = /nologo /machine:$(MACHINE)
diff --git a/external/curl/curl-7.26.0_mingw.patch b/external/curl/curl-7.26.0_mingw.patch
deleted file mode 100644
index be9a20cac358..000000000000
--- a/external/curl/curl-7.26.0_mingw.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- a/lib/curl_setup.h	2009-10-29 05:21:58.000000000 +0900
-+++ b/lib/curl_setup.h	2010-03-02 06:03:10.009500000 +0900
-@@ -40,6 +40,21 @@
- 
- #include "curl_config.h"
- 
-+#ifdef __MINGW32__
-+#undef HAVE_DLFCN_H
-+#define HAVE_GETHOSTBYADDR 1
-+#define HAVE_GETHOSTBYNAME 1
-+#undef HAVE_LIBZ
-+#undef HAVE_NETDB_H
-+#undef HAVE_POLL_H
-+#undef HAVE_SYS_IOCTL_H
-+#undef HAVE_SYS_POLL_H
-+#undef HAVE_SYS_UIO_H
-+#undef HAVE_TERMIOS_H
-+#undef HAVE_TERMIO_H
-+#undef HAVE_ZLIB_H
-+#endif
-+
- #else /* HAVE_CONFIG_H */
- 
- #ifdef _WIN32_WCE
diff --git a/external/curl/curl-7.26.0_win-proxy.patch b/external/curl/curl-7.26.0_win-proxy.patch
index 1c478868d7d2..5361433a917b 100644
--- a/external/curl/curl-7.26.0_win-proxy.patch
+++ b/external/curl/curl-7.26.0_win-proxy.patch
@@ -1,14 +1,14 @@
---- curl-7.26.0/lib/Makefile.vc12
-+++ misc/build/curl-7.26.0/lib/Makefile.vc12
-@@ -118,7 +118,7 @@
- WINSSLLIBS   = crypt32.lib
- ZLIBLIBSDLL  = zdll.lib
- ZLIBLIBS     = zlib.lib
--WINLIBS      = ws2_32.lib wldap32.lib advapi32.lib
-+WINLIBS      = ws2_32.lib wldap32.lib advapi32.lib winhttp.lib crypt32.lib
- CFLAGS       = $(CFLAGS) $(EXCFLAGS)
+--- curl/winbuild/MakefileBuild.vc.orig	2017-10-23 17:15:22.969492548 +0200
++++ curl/winbuild/MakefileBuild.vc	2017-10-23 17:16:38.491490679 +0200
+@@ -72,7 +72,7 @@
  
- CFGSET       = FALSE
+ CFLAGS_LIBCURL_STATIC  = /DCURL_STATICLIB
+ 
+-WIN_LIBS    = ws2_32.lib wldap32.lib advapi32.lib crypt32.lib
++WIN_LIBS    = ws2_32.lib wldap32.lib advapi32.lib crypt32.lib winhttp.lib
+ 
+ BASE_NAME              = libcurl
+ BASE_NAME_DEBUG        = $(BASE_NAME)_debug
 --- curl-7.26.0/lib/url.c
 +++ misc/build/curl-7.26.0/lib/url.c
 @@ -78,6 +78,10 @@
@@ -23,9 +23,9 @@
  #include "netrc.h"
  
 @@ -4586,6 +4590,21 @@
-   return FALSE;
  }
  
+ #ifndef CURL_DISABLE_HTTP
 +#ifdef _WIN32
 +static char *wstrToCstr(LPWSTR wStr)
 +{
@@ -44,20 +44,12 @@
  /****************************************************************
  * Detect what (if any) proxy to use. Remember that this selects a host
  * name and is not limited to HTTP proxies only.
-@@ -4594,6 +4613,7 @@
- static char *detect_proxy(struct connectdata *conn)
- {
-   char *proxy = NULL;
-+  char *no_proxy=NULL;
- 
- #ifndef CURL_DISABLE_HTTP
-   /* If proxy was not specified, we check for default proxy environment
-@@ -4613,7 +4633,64 @@
+@@ -4613,6 +4633,66 @@
     * For compatibility, the all-uppercase versions of these variables are
     * checked if the lowercase versions don't exist.
     */
--  char *no_proxy=NULL;
 +#ifdef _WIN32
++  char *no_proxy = NULL;
 +  WINHTTP_CURRENT_USER_IE_PROXY_CONFIG *ieProxyConfig;
 +  ieProxyConfig = (WINHTTP_CURRENT_USER_IE_PROXY_CONFIG *)
 +    malloc(sizeof(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG));
@@ -114,15 +106,16 @@
 +    GlobalFree(ieProxyConfig->lpszProxy);
 +    GlobalFree(ieProxyConfig->lpszProxyBypass);
 +  }
++  free(no_proxy);
 +#else /* !WIN32 */
    char proxy_env[128];
- 
-   no_proxy=curl_getenv("no_proxy");
+   const char *protop = conn->handler->scheme;
+   char *envp = proxy_env;
 @@ -4663,6 +4739,7 @@
-     }
-   } /* if(!check_noproxy(conn->host.name, no_proxy)) - it wasn't specified
-        non-proxy */
+   }
+   if(proxy)
+     infof(conn->data, "Uses proxy env variable %s == '%s'\n", envp, proxy);
 +#endif /* WIN32 */
-   free(no_proxy);
  
- #else /* !CURL_DISABLE_HTTP */
+   return proxy;
+ }
diff --git a/external/curl/curl-msvc-disable-protocols.patch.1 b/external/curl/curl-msvc-disable-protocols.patch.1
index 38ff5ccb5ac0..c8747a5fcc1d 100644
--- a/external/curl/curl-msvc-disable-protocols.patch.1
+++ b/external/curl/curl-msvc-disable-protocols.patch.1
@@ -22,3 +22,14 @@ disable protocols nobody needs in MSVC build
 +#define CURL_DISABLE_TFTP 1
 +
  #endif /* HEADER_CURL_CONFIG_WIN32_H */
+--- curl/winbuild/MakefileBuild.vc.orig	2017-10-23 23:41:21.393200000 +0200
++++ curl/winbuild/MakefileBuild.vc	2017-10-23 23:34:16.028000000 +0200
+@@ -431,7 +431,7 @@
+ 
+ EXE_OBJS = $(CURL_OBJS) $(CURL_DIROBJ)\curl.res
+ 
+-all : $(TARGET) $(PROGRAM_NAME)
++all : $(TARGET)
+ 
+ package: $(TARGET)
+ 	@cd $(DIRDIST)
diff --git a/external/curl/curl-msvc-schannel.patch.1 b/external/curl/curl-msvc-schannel.patch.1
deleted file mode 100644
index 96768aa3f92c..000000000000
--- a/external/curl/curl-msvc-schannel.patch.1
+++ /dev/null
@@ -1,22 +0,0 @@
-MSVC: use WNT native Schannel SSL/TLS implementation
-
---- curl/lib/Makefile.vc12.old	2013-11-19 00:00:29.044499752 +0100
-+++ curl/lib/Makefile.vc12	2013-11-19 00:01:29.135499684 +0100
-@@ -260,7 +260,7 @@
- TARGET = $(LIBCURL_DYN_LIB_REL)
- DIROBJ = $(CFG)
- LNK    = $(LNKDLL) $(WINLIBS) /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(LIBCURL_IMP_LIB_REL)
--CC     = $(CCNODBG) $(RTLIB)
-+CC     = $(CCNODBG) $(RTLIB) $(CFLAGSWINSSL)
- CFGSET = TRUE
- RESOURCE = $(DIROBJ)\libcurl.res
- !ENDIF
-@@ -427,7 +427,7 @@
- TARGET = $(LIBCURL_DYN_LIB_DBG)
- DIROBJ = $(CFG)
- LNK    = $(LNKDLL) $(WINLIBS) /DEBUG /out:$(DIROBJ)\$(TARGET) /IMPLIB:$(DIROBJ)\$(LIBCURL_IMP_LIB_DBG) /PDB:$(DIROBJ)\$(LIBCURL_DYN_LIB_PDB)
--CC     = $(CCDEBUG) $(RTLIBD)
-+CC     = $(CCDEBUG) $(RTLIBD) $(CFLAGSWINSSL)
- CFGSET = TRUE
- RESOURCE = $(DIROBJ)\libcurl.res
- !ENDIF
diff --git a/external/curl/curl-msvc.patch.1 b/external/curl/curl-msvc.patch.1
index 57a292bb69a3..80160958c99d 100644
--- a/external/curl/curl-msvc.patch.1
+++ b/external/curl/curl-msvc.patch.1
@@ -1,27 +1,27 @@
-MSVC: using SOLARINC and EXCFLAGS
+MSVC: using SOLARINC
 
---- curl/lib/Makefile.vc12	2012-05-24 12:07:02.000000000 -0400
-+++ curl/lib/Makefile.vc12	2012-10-29 11:53:44.658809300 -0400
-@@ -117,7 +117,7 @@
- ZLIBLIBSDLL  = zdll.lib
- ZLIBLIBS     = zlib.lib
- WINLIBS      = ws2_32.lib wldap32.lib advapi32.lib
--CFLAGS       = $(CFLAGS)
-+CFLAGS       = $(CFLAGS) $(EXCFLAGS)
+--- curl/winbuild/MakefileBuild.vc.orig	2017-10-23 16:36:07.713550851 +0200
++++ curl/winbuild/MakefileBuild.vc	2017-10-23 16:38:19.301547594 +0200
+@@ -60,7 +60,7 @@
+ !ELSE
+ CC_NODEBUG  = $(CC) /O2 /DNDEBUG
+ CC_DEBUG    = $(CC) /Od /D_DEBUG /RTC1 /Z7 /LDd
+-CFLAGS      = /I. /I ../lib /I../include /nologo /W4 /wd4127 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL
++CFLAGS      = /I. /I ../lib /I../include /nologo /W4 /wd4127 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL $(SOLARINC)
+ !ENDIF
  
- CFGSET       = FALSE
+ LFLAGS     = /nologo /machine:$(MACHINE)
+@@ -300,11 +300,11 @@
+ # CURL_XX macros are for the curl.exe command
  
-@@ -620,11 +620,11 @@
- debug-dll-ssl-dll\libcurl.res \
- debug-dll-zlib-dll\libcurl.res \
- debug-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc
--	rc /dDEBUGBUILD=1 /Fo $@ libcurl.rc
-+	rc $(SOLARINC) /dDEBUGBUILD=1 /Fo $@ libcurl.rc
-
- release-dll\libcurl.res \
- release-dll-ssl-dll\libcurl.res \
- release-dll-zlib-dll\libcurl.res \
- release-dll-ssl-dll-zlib-dll\libcurl.res: libcurl.rc
--	rc /dDEBUGBUILD=0 /Fo $@ libcurl.rc
-+	rc $(SOLARINC) /dDEBUGBUILD=0 /Fo $@ libcurl.rc
- !ENDIF  # End of case where a config was provided.
+ !IF "$(DEBUG)"=="yes"
+-RC_FLAGS = /dDEBUGBUILD=1 /Fo $@ $(LIBCURL_SRC_DIR)\libcurl.rc
++RC_FLAGS = $(SOLARINC) /dDEBUGBUILD=1 /Fo $@ $(LIBCURL_SRC_DIR)\libcurl.rc
+ CURL_CC       = $(CC_DEBUG) $(RTLIB_DEBUG)
+ CURL_RC_FLAGS = /i../include /dDEBUGBUILD=1 /Fo $@ $(CURL_SRC_DIR)\curl.rc
+ !ELSE
+-RC_FLAGS = /dDEBUGBUILD=0 /Fo $@ $(LIBCURL_SRC_DIR)\libcurl.rc
++RC_FLAGS = $(SOLARINC) /dDEBUGBUILD=0 /Fo $@ $(LIBCURL_SRC_DIR)\libcurl.rc
+ CURL_CC       = $(CC_NODEBUG) $(RTLIB)
+ CURL_RC_FLAGS = /i../include /dDEBUGBUILD=0 /Fo $@ $(CURL_SRC_DIR)\curl.rc
+ !ENDIF
diff --git a/external/curl/curl-osx.patch.1 b/external/curl/curl-osx.patch.1
deleted file mode 100644
index 7694a1dcda2c..000000000000
--- a/external/curl/curl-osx.patch.1
+++ /dev/null
@@ -1,285 +0,0 @@
-From efebf4d4f882a57a98a0653d21d543cd4132d23d Mon Sep 17 00:00:00 2001
-From: Palo Markovic <pavol.markovic at kompiler.info>
-Date: Sat, 18 Mar 2017 16:37:02 +1300
-Subject: [PATCH] macOS: Fixed crash on 10.8 caused by missing connectx()
- function
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The connectx() function call appeared in Darwin 15.0.0
-That covers OS X 10.11, iOS 9 and tvOS 9.
-
-Because connectx is not declared with weak_import attribute it’s not possible
-to build libcurl on OS X 10.11 and later and target systems which don’t have
-_connectx symbol declared in libsystem_kernel.dylib (i.e. OS 10.8 and earlier).
-
-Solution is to use connectx only on platforms that officially support it
-i.e. by defining CFLAGS="-mmacosx-version-min=10.11" in configure step.
-
-Note: It is possible to conditionally use connectx() in libcurl targeting
-range of systems based on availability determined during runtime using dlsym().
-
-[Bug: https://github.com/curl/curl/issues/1330]
----
- lib/connect.c    |  2 +-
- lib/curl_setup.h | 16 ++++++++++++++++
- lib/url.c        |  2 +-
- 3 files changed, 18 insertions(+), 2 deletions(-)
-
-diff --git a/lib/connect.c b/lib/connect.c
-index 197eff242f..33251914b8 100644
---- a/lib/connect.c
-+++ b/lib/connect.c
-@@ -1075,7 +1075,7 @@ static CURLcode singleipconnect(struct connectdata *conn,
-   /* Connect TCP sockets, bind UDP */
-   if(!isconnected && (conn->socktype == SOCK_STREAM)) {
-     if(conn->bits.tcp_fastopen) {
--#if defined(CONNECT_DATA_IDEMPOTENT) /* OS X */
-+#if defined(HAVE_DARWIN_CONNECTX) /* Darwin */
-       sa_endpoints_t endpoints;
-       endpoints.sae_srcif = 0;
-       endpoints.sae_srcaddr = NULL;
-diff --git a/lib/curl_setup.h b/lib/curl_setup.h
-index 0fe3633ec7..8643e1fd28 100644
---- a/lib/curl_setup.h
-+++ b/lib/curl_setup.h
-@@ -762,4 +762,20 @@ endings either CRLF or LF so 't' is appropriate.
- #  endif
- # endif
- 
-+/* Detect Darwin connectx() function availability.
-+ * The connectx() function call appeared in Darwin 15.0.0
-+ * but it's not declared using availability attribute.
-+ */
-+#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
-+#  if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
-+#    define HAVE_DARWIN_CONNECTX 1
-+#  endif
-+#elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
-+#  if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 90000)
-+#    define HAVE_DARWIN_CONNECTX 1
-+#  endif
-+#elif defined(CONNECT_DATA_IDEMPOTENT)  /* Fallback for other Darwin OS */
-+#  define HAVE_DARWIN_CONNECTX 1
-+#endif
-+
- #endif /* HEADER_CURL_SETUP_H */
-diff --git a/lib/url.c b/lib/url.c
-index 03feaa20f7..08fbe5132b 100644
---- a/lib/url.c
-+++ b/lib/url.c
-@@ -2834,7 +2834,7 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option,
-     data->set.tcp_keepintvl = va_arg(param, long);
-     break;
-   case CURLOPT_TCP_FASTOPEN:
--#if defined(CONNECT_DATA_IDEMPOTENT) || defined(MSG_FASTOPEN)
-+#if defined(HAVE_DARWIN_CONNECTX) || defined(MSG_FASTOPEN)
-     data->set.tcp_fastopen = (0 != va_arg(param, long))?TRUE:FALSE;
- #else
-     result = CURLE_NOT_BUILT_IN;
-From 45756a8a23967570da1390f9b1475c1db38a52d1 Mon Sep 17 00:00:00 2001
-From: Palo Markovic <pavol.markovic at kompiler.info>
-Date: Sat, 25 Mar 2017 13:20:51 +1300
-Subject: [PATCH] macOS: moved connectx check to configuration phase
-
----
- acinclude.m4     | 40 ++++++++++++++++++++++++++++++++++++++++
- configure.ac     |  1 +
- lib/connect.c    |  2 +-
- lib/curl_setup.h | 16 ----------------
- lib/url.c        |  2 +-
- 5 files changed, 43 insertions(+), 18 deletions(-)
-
-diff --git a/acinclude.m4 b/acinclude.m4
-index 2abae8d8ad..769e67c510 100644
---- a/acinclude.m4
-+++ b/acinclude.m4
-@@ -3243,3 +3243,43 @@ AC_DEFUN([CURL_MAC_CFLAGS], [
-   fi
- 
- ])
-+
-+
-+dnl CURL_CHECK_FUNC_CONNECTX
-+dnl
-+dnl Check if connectx() function is present.
-+dnl The connectx() function call appeared in Darwin 15.0.0
-+dnl but it's not declared using availability attribute.
-+dnl Additionally _connectx symbol is part of OS X 10.9/10.10
-+dnl system lib but does not have specified functionality.
-+dnl
-+
-+AC_DEFUN([CURL_CHECK_FUNC_CONNECTX], [
-+  AC_REQUIRE([CURL_MAC_CFLAGS])dnl
-+  AC_CHECK_FUNCS([connectx])
-+  AC_MSG_CHECKING([if connectx is available in deployment target])
-+  AC_COMPILE_IFELSE(
-+    [AC_LANG_PROGRAM([[
-+#if defined(HAVE_CONNECTX)
-+#  include <Availability.h>
-+#  if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
-+#    if (__MAC_OS_X_VERSION_MIN_REQUIRED < 101100)
-+#      error Function requires deployment target OS X 10.11 or later
-+#    endif
-+#  elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
-+#    if (__IPHONE_OS_VERSION_MIN_REQUIRED < 90000)
-+#      error Function requires deployment target iOS 9.0 or later
-+#    endif
-+#  endif
-+#else
-+#  error Function not present in the headers
-+#endif
-+    ]])],
-+    [
-+      AC_DEFINE(HAVE_VALID_CONNECTX, 1,
-+        [Set to 1 if connectx() function have specified functionality.])
-+      AC_MSG_RESULT([yes])
-+    ],
-+    [AC_MSG_RESULT([no])]
-+  )
-+])
-diff --git a/configure.ac b/configure.ac
-index abd0def369..a3930447c3 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -3226,6 +3226,7 @@ CURL_CHECK_FUNC_BASENAME
- CURL_CHECK_FUNC_CLOSESOCKET
- CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
- CURL_CHECK_FUNC_CONNECT
-+CURL_CHECK_FUNC_CONNECTX
- CURL_CHECK_FUNC_FCNTL
- CURL_CHECK_FUNC_FDOPEN
- CURL_CHECK_FUNC_FREEADDRINFO
-diff --git a/lib/connect.c b/lib/connect.c
-index 33251914b8..8c5e45aea5 100644
---- a/lib/connect.c
-+++ b/lib/connect.c
-@@ -1075,7 +1075,7 @@ static CURLcode singleipconnect(struct connectdata *conn,
-   /* Connect TCP sockets, bind UDP */
-   if(!isconnected && (conn->socktype == SOCK_STREAM)) {
-     if(conn->bits.tcp_fastopen) {
--#if defined(HAVE_DARWIN_CONNECTX) /* Darwin */
-+#if defined(HAVE_VALID_CONNECTX) /* Darwin */
-       sa_endpoints_t endpoints;
-       endpoints.sae_srcif = 0;
-       endpoints.sae_srcaddr = NULL;
-diff --git a/lib/curl_setup.h b/lib/curl_setup.h
-index 8643e1fd28..0fe3633ec7 100644
---- a/lib/curl_setup.h
-+++ b/lib/curl_setup.h
-@@ -762,20 +762,4 @@ endings either CRLF or LF so 't' is appropriate.
- #  endif
- # endif
- 
--/* Detect Darwin connectx() function availability.
-- * The connectx() function call appeared in Darwin 15.0.0
-- * but it's not declared using availability attribute.
-- */
--#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
--#  if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
--#    define HAVE_DARWIN_CONNECTX 1
--#  endif
--#elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
--#  if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 90000)
--#    define HAVE_DARWIN_CONNECTX 1
--#  endif
--#elif defined(CONNECT_DATA_IDEMPOTENT)  /* Fallback for other Darwin OS */
--#  define HAVE_DARWIN_CONNECTX 1
--#endif
--
- #endif /* HEADER_CURL_SETUP_H */
-diff --git a/lib/url.c b/lib/url.c
-index 08fbe5132b..7160ae041d 100644
---- a/lib/url.c
-+++ b/lib/url.c
-@@ -2834,7 +2834,7 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option,
-     data->set.tcp_keepintvl = va_arg(param, long);
-     break;
-   case CURLOPT_TCP_FASTOPEN:
--#if defined(HAVE_DARWIN_CONNECTX) || defined(MSG_FASTOPEN)
-+#if defined(HAVE_VALID_CONNECTX) || defined(MSG_FASTOPEN)
-     data->set.tcp_fastopen = (0 != va_arg(param, long))?TRUE:FALSE;
- #else
-     result = CURLE_NOT_BUILT_IN;
-From 113088ac81edbb9d51582a114d006bf60e3e6a87 Mon Sep 17 00:00:00 2001
-From: Palo Markovic <pavol.markovic at kompiler.info>
-Date: Wed, 5 Apr 2017 06:04:42 +1200
-Subject: [PATCH] macOS: added connectx check for cmake
-
----
- CMake/CurlTests.c       | 18 ++++++++++++++++++
- CMakeLists.txt          |  9 +++++++++
- lib/curl_config.h.cmake |  6 ++++++
- 3 files changed, 33 insertions(+)
-
-diff --git a/CMake/CurlTests.c b/CMake/CurlTests.c
-index bc36c8ef7d..7077059f9c 100644
---- a/CMake/CurlTests.c
-+++ b/CMake/CurlTests.c
-@@ -533,3 +533,21 @@ main() {
-     return 0;
- }
- #endif
-+#ifdef HAVE_VALID_CONNECTX
-+#  include <Availability.h>
-+#  include <sys/socket.h>
-+#  if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
-+#    if (__MAC_OS_X_VERSION_MIN_REQUIRED < 101100)
-+#      error Function requires deployment target OS X 10.11 or later
-+#    endif
-+#  elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
-+#    if (__IPHONE_OS_VERSION_MIN_REQUIRED < 90000)
-+#      error Function requires deployment target iOS 9.0 or later
-+#    endif
-+#  endif
-+
-+main() {
-+  connectx(0, 0, 0, 0, 0, 0, 0, 0);
-+  return 0;
-+}
-+#endif
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 8390c38c99..ab8be51ebc 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -849,6 +849,15 @@ check_symbol_exists(fcntl          "${CURL_INCLUDES}" HAVE_FCNTL)
- check_symbol_exists(ioctl          "${CURL_INCLUDES}" HAVE_IOCTL)
- check_symbol_exists(setsockopt     "${CURL_INCLUDES}" HAVE_SETSOCKOPT)
- 
-+# The connectx() function call appeared in Darwin 15.0.0
-+# but it's not declared using availability attribute.
-+# Additionally _connectx symbol is part of OS X 10.9/10.10
-+# system lib but does not have specified functionality.
-+check_symbol_exists(connectx       "${CURL_INCLUDES}" HAVE_CONNECTX)
-+if(HAVE_CONNECTX)
-+  curl_internal_test_run(HAVE_VALID_CONNECTX)
-+endif(HAVE_CONNECTX)
-+
- # symbol exists in win32, but function does not.
- check_function_exists(inet_pton HAVE_INET_PTON)
- 
-diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake
-index 9fcdd97f98..6fc4415a8d 100644
---- a/lib/curl_config.h.cmake
-+++ b/lib/curl_config.h.cmake
-@@ -130,6 +130,9 @@
- /* Define to 1 if bool is an available type. */
- #cmakedefine HAVE_BOOL_T 1
- 
-+/* Define to 1 if you have the connectx function. */
-+#cmakedefine HAVE_CONNECTX 1
-+
- /* Define to 1 if you have the clock_gettime function and monotonic timer. */
- #cmakedefine HAVE_CLOCK_GETTIME_MONOTONIC 1
- 
-@@ -719,6 +722,9 @@

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list