Kaydet (Commit) 5684fbce authored tarafından Caolán McNamara's avatar Caolán McNamara

add hwp to fftester

Change-Id: Ibf819307905295580cb6a813f6d003a7dabc86b5
üst 619d8ba5
......@@ -17,6 +17,7 @@ $(eval $(call gb_Library_use_libraries,hwp,\
cppuhelper \
sal \
utl \
tl \
$(gb_UWINAPI) \
))
......
......@@ -26,6 +26,7 @@
#include <math.h>
#include <osl/diagnose.h>
#include <tools/stream.hxx>
#include <comphelper/newarray.hxx>
#include "fontmap.hxx"
......@@ -123,6 +124,26 @@ HwpReader::~HwpReader()
delete d;
}
extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportHWP(const OUString &rURL)
{
SvFileStream aFileStream(rURL, StreamMode::READ);
std::unique_ptr<HStream> stream(new HStream);
byte aData[32768];
sal_Size nRead, nBlock = 32768;
while (true)
{
nRead = aFileStream.Read(aData, nBlock);
if (nRead == 0)
break;
stream->addData(aData, (int)nRead);
}
HWPFile hwpfile;
if (hwpfile.ReadHwpFile(stream.release()))
return false;
return true;
}
sal_Bool HwpReader::filter(const Sequence< PropertyValue >& rDescriptor) throw(RuntimeException, std::exception)
{
......
......@@ -64,6 +64,7 @@ using namespace cppu;
extern "C" { static void SAL_CALL thisModule() {} }
typedef bool (*WFilterCall)(const OUString &rUrl, const OUString &rFlt);
typedef bool (*HFilterCall)(const OUString &rUrl);
/* This constant specifies the number of inputs to process before restarting.
* This is optional, but helps limit the impact of memory leaks and similar
......@@ -333,6 +334,19 @@ try_again:
else
ret = (int) (*pfnImport)(out, OUString("CWW8"));
}
else if (strcmp(argv[2], "hwp") == 0)
{
static HFilterCall pfnImport(0);
if (!pfnImport)
{
osl::Module aLibrary;
aLibrary.loadRelative(&thisModule, "libhwplo.so", SAL_LOADMODULE_LAZY);
pfnImport = reinterpret_cast<HFilterCall>(
aLibrary.getFunctionSymbol("TestImportHWP"));
aLibrary.release();
}
ret = (int) (*pfnImport)(out);
}
}
/* To signal successful completion of a run, we need to deliver
......
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