Kaydet (Commit) 01d64f95 authored tarafından Caolán McNamara's avatar Caolán McNamara

add mml support to fftester

Change-Id: Ie0c3dd5eddb274cf04b335af6fdcb32b3445d02c
üst 83d51a0d
......@@ -62,8 +62,9 @@ one go*/
#include "mathmlattr.hxx"
#include "mathmlimport.hxx"
#include "register.hxx"
#include <unomodel.hxx>
#include <document.hxx>
#include <smdll.hxx>
#include <unomodel.hxx>
#include <utility.hxx>
using namespace ::com::sun::star::beans;
......@@ -3103,5 +3104,32 @@ void SmXMLImport::SetConfigurationSettings(const Sequence<PropertyValue>& aConfP
}
}
extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportMML(SvStream &rStream)
{
SmGlobals::ensure();
SfxObjectShellLock xDocSh(new SmDocShell(SfxModelFlags::EMBEDDED_OBJECT));
xDocSh->DoInitNew();
uno::Reference<frame::XModel> xModel(xDocSh->GetModel());
uno::Reference<beans::XPropertySet> xInfoSet;
uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory());
uno::Reference<io::XInputStream> xStream(new utl::OSeekableInputStreamWrapper(rStream));
//SetLoading hack because the document properties will be re-initted
//by the xml filter and during the init, while its considered uninitialized,
//setting a property will inform the document its modified, which attempts
//to update the properties, which throws cause the properties are uninitialized
xDocSh->SetLoading(SfxLoadedFlags::NONE);
auto nRet = SmXMLImportWrapper::ReadThroughComponent(xStream, xModel, xContext, xInfoSet, "com.sun.star.comp.Math.XMLImporter", false);
xDocSh->SetLoading(SfxLoadedFlags::ALL);
xDocSh->DoClose();
return nRet != ERRCODE_NONE;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -627,6 +627,20 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
SvFileStream aFileStream(out, StreamMode::READ);
ret = (int) (*pfnImport)(aFileStream);
}
else if (strcmp(argv[2], "mml") == 0)
{
static FFilterCall pfnImport(nullptr);
if (!pfnImport)
{
osl::Module aLibrary;
aLibrary.loadRelative(&thisModule, "libsmlo.so", SAL_LOADMODULE_LAZY);
pfnImport = reinterpret_cast<FFilterCall>(
aLibrary.getFunctionSymbol("TestImportMML"));
aLibrary.release();
}
SvFileStream aFileStream(out, StreamMode::READ);
ret = (int) (*pfnImport)(aFileStream);
}
#endif
}
catch (...)
......
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