summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-11-30 20:34:53 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-11-30 20:35:26 +0000
commit01d64f95dc11e7f70c87a5ecdde76f916964a7bf (patch)
tree21c4a803f56eadd387ee992b6d00f2e1367811e4 /starmath
parent83d51a0d14a2da6fd1af6c4ff4bb5ff7bfb94cf1 (diff)
add mml support to fftester
Change-Id: Ie0c3dd5eddb274cf04b335af6fdcb32b3445d02c
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/mathmlimport.cxx30
1 files changed, 29 insertions, 1 deletions
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: */