Kaydet (Commit) 3168ba6c authored tarafından Caolán McNamara's avatar Caolán McNamara

rework TestImportXLS to take a SvStream arg

Change-Id: I65d02604ac489d8c8649673f3f851d1a6650406e
üst d8a299e1
......@@ -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);
......
......@@ -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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment