[Libreoffice-commits] core.git: starmath/source vcl/workben
Caolán McNamara
caolanm at redhat.com
Thu Nov 30 20:36:32 UTC 2017
starmath/source/mathmlimport.cxx | 30 +++++++++++++++++++++++++++++-
vcl/workben/fftester.cxx | 14 ++++++++++++++
2 files changed, 43 insertions(+), 1 deletion(-)
New commits:
commit 01d64f95dc11e7f70c87a5ecdde76f916964a7bf
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Nov 30 20:34:53 2017 +0000
add mml support to fftester
Change-Id: Ie0c3dd5eddb274cf04b335af6fdcb32b3445d02c
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index e1537bf62d75..500ecff58425 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -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: */
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index 4c9c131e39b2..439f2db7702b 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -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 (...)
More information about the Libreoffice-commits
mailing list