diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-10-23 20:50:40 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-10-24 08:54:42 +0100 |
commit | 3168ba6c6eb995060842614a11c7bc5a780812d3 (patch) | |
tree | 66a22c74bf4a01a56aab8a880b34bfbd02588966 | |
parent | d8a299e12937896f0346881cd7b9b7602010b2c4 (diff) |
rework TestImportXLS to take a SvStream arg
Change-Id: I65d02604ac489d8c8649673f3f851d1a6650406e
-rw-r--r-- | sc/source/filter/excel/excel.cxx | 7 | ||||
-rw-r--r-- | vcl/workben/fftester.cxx | 8 |
2 files changed, 9 insertions, 6 deletions
diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx index cb818217a393..5f9addb25489 100644 --- a/sc/source/filter/excel/excel.cxx +++ b/sc/source/filter/excel/excel.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/document/XImporter.hpp> #include <scitems.hxx> #include <svl/stritem.hxx> +#include <unotools/streamwrap.hxx> #include <filter.hxx> #include <document.hxx> #include <optuno.hxx> @@ -243,10 +244,12 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportCalcRTF(SvStream &rStrea return ScFormatFilter::Get().ScImportRTF(rStream, OUString(), &aDocument, aRange) == ERRCODE_NONE; } -extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportXLS(const OUString &rURL) +extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportXLS(SvStream& rStream) { ScDLL::Init(); - SfxMedium aMedium(rURL, StreamMode::READ); + SfxMedium aMedium; + css::uno::Reference<css::io::XInputStream> xStm(new utl::OInputStreamWrapper(rStream)); + aMedium.GetItemSet()->Put(SfxUsrAnyItem(SID_INPUTSTREAM, css::uno::makeAny(xStm))); ScDocument aDocument; ScDocOptions aDocOpt = aDocument.GetDocOptions(); aDocOpt.SetLookUpColRowNames(false); diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx index 295a3bcb0231..de87da8c476c 100644 --- a/vcl/workben/fftester.cxx +++ b/vcl/workben/fftester.cxx @@ -55,7 +55,6 @@ using namespace cppu; extern "C" { static void SAL_CALL thisModule() {} } #endif -typedef bool (*WFilterCall)(const OUString &rUrl); typedef bool (*FFilterCall)(SvStream &rStream); SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) @@ -404,16 +403,17 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) } else if (strcmp(argv[2], "xls") == 0) { - static WFilterCall pfnImport(nullptr); + static FFilterCall pfnImport(nullptr); if (!pfnImport) { osl::Module aLibrary; aLibrary.loadRelative(&thisModule, "libscfiltlo.so", SAL_LOADMODULE_LAZY); - pfnImport = reinterpret_cast<WFilterCall>( + pfnImport = reinterpret_cast<FFilterCall>( aLibrary.getFunctionSymbol("TestImportXLS")); aLibrary.release(); } - ret = (int) (*pfnImport)(out); + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream); } else if (strcmp(argv[2], "hwp") == 0) { |