diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-11-13 17:41:45 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-11-13 18:43:57 +0100 |
commit | 4038d6c393c3cf6330671124ba69cdba98b24960 (patch) | |
tree | 79dbbc062df6fb3acd544e223b6b7cd036f1da54 /oox/qa | |
parent | ae499df25c01a149dfbb387da17a7f8a232a6a4e (diff) |
tdf#117658 PPTX import: fix duplicated math object handling
We used to recurse into both arms of <mc:AlternateContent>: while the
intention is that an importer either reads <mc:Choice> or <mc:Fallback>.
Fix this by converting PPTShapeGroupContext to be a FragmentHandler2,
this way FragmentHandler2::prepareMceContext() is invoked, which knows
how to do this correctly.
This requires declaring "a14" as a supported namespace, e.g.
SdOOXMLExportTest2::testMathObject() would fail without it. This also
requires keeping "a14" unsupported in the Calc case, e.g.
ScFiltersTest::testControlImport() would fail without it. Finally the
"Convert this to FragmentHandler2" TODO in
SlideFragmentHandler::onCreateContext() from 2011 can be removed with
this.
Change-Id: I883237902c71cb515e810a8e34443c9eeaca48b0
Reviewed-on: https://gerrit.libreoffice.org/82623
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'oox/qa')
-rw-r--r-- | oox/qa/unit/data/import-mce.pptx | bin | 0 -> 33763 bytes | |||
-rw-r--r-- | oox/qa/unit/mathml.cxx | 18 |
2 files changed, 17 insertions, 1 deletions
diff --git a/oox/qa/unit/data/import-mce.pptx b/oox/qa/unit/data/import-mce.pptx Binary files differnew file mode 100644 index 000000000000..65cf1cbabfe7 --- /dev/null +++ b/oox/qa/unit/data/import-mce.pptx diff --git a/oox/qa/unit/mathml.cxx b/oox/qa/unit/mathml.cxx index 632fc566ddb7..0352c7a84ec4 100644 --- a/oox/qa/unit/mathml.cxx +++ b/oox/qa/unit/mathml.cxx @@ -10,8 +10,9 @@ #include <test/bootstrapfixture.hxx> #include <unotest/macros_test.hxx> -#include <com/sun/star/frame/Desktop.hpp> +#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> #include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <comphelper/embeddedobjectcontainer.hxx> #include <comphelper/processfactory.hxx> @@ -60,6 +61,21 @@ CPPUNIT_TEST_FIXTURE(OoxMathmlTest, testImportCharacters) CPPUNIT_ASSERT(getComponent().is()); } +CPPUNIT_TEST_FIXTURE(OoxMathmlTest, testImportMce) +{ + OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "import-mce.pptx"; + getComponent() = loadFromDesktop(aURL); + uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + + // Without the accompanying fix in place, this failed with: + // - Expected: 1 + // - Actual : 2 + // i.e. both the math object and its replacement image was imported, as two separate objects. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xDrawPage->getCount()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |