sc/source/filter/orcus/orcusfiltersimpl.cxx |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 5e9178f765b327a8aba17476d135ba3b1f881bf7
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Sat May 13 19:10:45 2017 +0200

    import stream on the LibreOffice side, tdf#107827
    
    This adds support for all LibreOffice content providers and non-ascii file 
names.
    
    Change-Id: I0a0fd0ab0c78ef039679516e7a3e880929e8f725
    Reviewed-on: https://gerrit.libreoffice.org/37578
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx 
b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 61cf0b488891..f96fb9f3373f 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -87,13 +87,23 @@ bool ScOrcusFiltersImpl::importGnumeric(ScDocument& rDoc, 
SfxMedium& rMedium) co
 {
     ScOrcusFactory aFactory(rDoc);
     aFactory.setStatusIndicator(getStatusIndicator(rMedium));
-    OString aSysPath = toSystemPath(rMedium.GetName());
-    const char* path = aSysPath.getStr();
+    SvStream* pStream = rMedium.GetInStream();
+    pStream->Seek(0);
+    static const size_t nReadBuffer = 1024*32;
+    OStringBuffer aBuffer((int(nReadBuffer)));
+    size_t nRead = 0;
+    do
+    {
+        char pData[nReadBuffer];
+        nRead = pStream->ReadBytes(pData, nReadBuffer);
+        aBuffer.append(static_cast<sal_Char*>(pData), nRead);
+    }
+    while (nRead == nReadBuffer);
 
     try
     {
         orcus::orcus_gnumeric filter(&aFactory);
-        filter.read_file(path);
+        filter.read_stream(aBuffer.getStr(), aBuffer.getLength());
     }
     catch (const std::exception& e)
     {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to