summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
Diffstat (limited to 'starmath')
-rw-r--r--starmath/CppunitTest_starmath_import.mk88
-rw-r--r--starmath/Library_sm.mk4
-rw-r--r--starmath/Module_starmath.mk1
-rw-r--r--starmath/inc/document.hxx3
-rw-r--r--starmath/inc/smdll.hxx4
-rw-r--r--starmath/inc/smdllapi.hxx23
-rw-r--r--starmath/qa/extras/data/simple.mml13
-rw-r--r--starmath/qa/extras/mmlimport-test.cxx92
8 files changed, 226 insertions, 2 deletions
diff --git a/starmath/CppunitTest_starmath_import.mk b/starmath/CppunitTest_starmath_import.mk
new file mode 100644
index 000000000000..17a9f716f500
--- /dev/null
+++ b/starmath/CppunitTest_starmath_import.mk
@@ -0,0 +1,88 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,starmath_import))
+
+$(eval $(call gb_CppunitTest_set_include,starmath_import,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/starmath/inc \
+))
+
+$(eval $(call gb_CppunitTest_use_external,starmath_import,boost_headers))
+
+$(eval $(call gb_CppunitTest_use_api,starmath_import,\
+ offapi \
+ udkapi \
+))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,starmath_import,\
+ starmath/qa/extras/mmlimport-test \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,starmath_import,\
+ comphelper \
+ cppu \
+ cppuhelper \
+ editeng \
+ i18nlangtag \
+ i18nutil \
+ msfilter \
+ oox \
+ sal \
+ salhelper \
+ sax \
+ sfx \
+ sm \
+ smd \
+ sot \
+ svl \
+ svt \
+ svx \
+ svxcore \
+ test \
+ tk \
+ tl \
+ unotest \
+ unoxml \
+ utl \
+ vcl \
+ xo \
+ $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,starmath_import))
+$(eval $(call gb_CppunitTest_use_vcl,starmath_import))
+
+$(eval $(call gb_CppunitTest_use_components,starmath_import,\
+ configmgr/source/configmgr \
+ framework/util/fwk \
+ i18npool/util/i18npool \
+ package/source/xstor/xstor \
+ package/util/package2 \
+ sfx2/util/sfx \
+ starmath/util/sm \
+ starmath/util/smd \
+ toolkit/util/tk \
+ ucb/source/core/ucb1 \
+ ucb/source/ucp/file/ucpfile1 \
+ unotools/util/utl \
+ comphelper/util/comphelp \
+ filter/source/config/cache/filterconfig1 \
+ oox/util/oox \
+ sax/source/expatwrap/expwrap \
+ svl/source/fsstor/fsstorage \
+ svl/util/svl \
+ svx/util/svx \
+ unoxml/source/service/unoxml \
+ xmloff/util/xo \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,starmath_import))
+
+# vim: set noet sw=4 ts=4:
diff --git a/starmath/Library_sm.mk b/starmath/Library_sm.mk
index fc1d1e1a9077..7208dcb49c74 100644
--- a/starmath/Library_sm.mk
+++ b/starmath/Library_sm.mk
@@ -21,6 +21,10 @@ $(eval $(call gb_Library_set_include,sm,\
$$(INCLUDE) \
))
+$(eval $(call gb_Library_add_defs,sm,\
+ -DSM_DLLIMPLEMENTATION \
+))
+
$(eval $(call gb_Library_use_external,sm,boost_headers))
$(eval $(call gb_Library_use_custom_headers,sm,oox/generated))
diff --git a/starmath/Module_starmath.mk b/starmath/Module_starmath.mk
index 2830a466c255..1a6af4ccc3d7 100644
--- a/starmath/Module_starmath.mk
+++ b/starmath/Module_starmath.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_Module_add_l10n_targets,starmath,\
))
$(eval $(call gb_Module_add_check_targets,starmath,\
+ CppunitTest_starmath_import \
CppunitTest_starmath_qa_cppunit \
))
diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx
index e71a2f990308..792bbb68b4f1 100644
--- a/starmath/inc/document.hxx
+++ b/starmath/inc/document.hxx
@@ -37,6 +37,7 @@
#include "format.hxx"
#include "parse.hxx"
#include "smmod.hxx"
+#include "smdllapi.hxx"
class SmNode;
class SfxMenuBarManager;
@@ -84,7 +85,7 @@ void SetEditEngineDefaultFonts(SfxItemPool &rEditEngineItemPool);
-class SmDocShell : public SfxObjectShell, public SfxListener
+class SM_DLLPUBLIC SmDocShell : public SfxObjectShell, public SfxListener
{
friend class SmPrinterAccess;
friend class SmModel;
diff --git a/starmath/inc/smdll.hxx b/starmath/inc/smdll.hxx
index 034e985974f2..3408f2fd4414 100644
--- a/starmath/inc/smdll.hxx
+++ b/starmath/inc/smdll.hxx
@@ -19,9 +19,11 @@
#ifndef INCLUDED_STARMATH_INC_SMDLL_HXX
#define INCLUDED_STARMATH_INC_SMDLL_HXX
+#include "smdllapi.hxx"
+
namespace SmGlobals
{
- void ensure();
+ SM_DLLPUBLIC void ensure();
}
#endif
diff --git a/starmath/inc/smdllapi.hxx b/starmath/inc/smdllapi.hxx
new file mode 100644
index 000000000000..ad183991f579
--- /dev/null
+++ b/starmath/inc/smdllapi.hxx
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_STARMATH_INC_SMDLLAPI_HXX
+#define INCLUDED_STARMATH_INC_SMDLLAPI_HXX
+
+#include <sal/types.h>
+
+#if defined(SM_DLLIMPLEMENTATION)
+#define SM_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define SM_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/starmath/qa/extras/data/simple.mml b/starmath/qa/extras/data/simple.mml
new file mode 100644
index 000000000000..822d1a709668
--- /dev/null
+++ b/starmath/qa/extras/data/simple.mml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<math xmlns="http://www.w3.org/1998/Math/MathML">
+ <msup>
+ <mfenced>
+ <mrow>
+ <mi>a</mi>
+ <mo>+</mo>
+ <mi>b</mi>
+ </mrow>
+ </mfenced>
+ <mn>2</mn>
+ </msup>
+</math>
diff --git a/starmath/qa/extras/mmlimport-test.cxx b/starmath/qa/extras/mmlimport-test.cxx
new file mode 100644
index 000000000000..2fbeda7928dc
--- /dev/null
+++ b/starmath/qa/extras/mmlimport-test.cxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sal/config.h>
+#include <test/bootstrapfixture.hxx>
+
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/sfxmodelfactory.hxx>
+
+#include <document.hxx>
+#include <smdll.hxx>
+
+namespace {
+
+using namespace ::com::sun::star;
+
+typedef tools::SvRef<SmDocShell> SmDocShellRef;
+
+class Test : public test::BootstrapFixture
+{
+public:
+ virtual void setUp() SAL_OVERRIDE;
+ virtual void tearDown() SAL_OVERRIDE;
+
+ void testSimple();
+
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(testSimple);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ void loadURL(const OUString &rURL)
+ {
+ // Cf.
+ // filter/source/config/fragments/filters/MathML_XML__Math_.xcu
+ SfxFilter* pFilter = new SfxFilter(MATHML_XML,
+ OUString(),
+ SFX_FILTER_IMPORT | SFX_FILTER_EXPORT | SFX_FILTER_TEMPLATE,
+ SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS,
+ "MathML 1.01",
+ 0,
+ OUString(),
+ OUString(),
+ "private:factory/smath*");
+ pFilter->SetVersion(SOFFICE_FILEFORMAT_60);
+
+ mxDocShell = new SmDocShell(SFXMODEL_STANDARD |
+ SFXMODEL_DISABLE_EMBEDDED_SCRIPTS |
+ SFXMODEL_DISABLE_DOCUMENT_RECOVERY);
+
+ SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ);
+ pSrcMed->SetFilter(pFilter);
+ pSrcMed->UseInteractionHandler(false);
+ bool bLoaded = mxDocShell->DoLoad(pSrcMed);
+ CPPUNIT_ASSERT_MESSAGE(OUStringToOString("failed to load " + rURL, RTL_TEXTENCODING_UTF8).getStr(),
+ bLoaded);
+ }
+
+ SmDocShellRef mxDocShell;
+};
+
+void Test::setUp()
+{
+ BootstrapFixture::setUp();
+ SmGlobals::ensure();
+}
+
+void Test::tearDown()
+{
+ if (mxDocShell) mxDocShell->DoClose();
+ BootstrapFixture::tearDown();
+}
+
+void Test::testSimple()
+{
+ loadURL(getURLFromSrc("starmath/qa/extras/data/simple.mml"));
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */