diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-01-21 17:39:26 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-01-21 19:42:56 +0100 |
commit | 332a796366b7cb91dff41de4b9ffb17843112a3e (patch) | |
tree | b578760ddfffde56cfe9e876b3e86a0916ad79a0 /sd/qa | |
parent | a73e606b8cd714520285b4e40890db9fd27d7ba5 (diff) |
oox: import Math objects from PPTX files
This is quite hacky and limited: in OOXML these are not OLE objects but
occur inside text boxes, and PPT 2010 allows inserting multiple Math
objects into one text box but Impress does not have as-character
anchored objects, so we can't import that properly; for now only import
Math if there is nothing else in the text box.
Also for now only import them as children of TextParagraphContext (a:p);
it's not clear what the possible parent elements could be since the
OOXML standard only lists WordProcessingML parent elements :(
Change-Id: I847f810084c9ddae4b60f93896fb73a742683cc2
Diffstat (limited to 'sd/qa')
-rw-r--r-- | sd/qa/unit/export-tests.cxx | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 818ea21afb80..2f9550afda5e 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -1173,7 +1173,30 @@ void SdExportTest::testMathObject() "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:txBody/a:p/a14:m/m:oMath/m:r[1]/m:t", "a"); - // TODO can't import yet + const SdrPage *pPage = GetPage(1, xDocShRef); + const SdrObject* pObj = dynamic_cast<SdrObject*>(pPage->GetObj(0)); + CPPUNIT_ASSERT_MESSAGE("no object", pObj != nullptr); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier()); + } + + utl::TempFile tempFile2; + xDocShRef = saveAndReload( xDocShRef, PPTX, &tempFile2 ); + + // Export an MS specific ole object (imported from a PPTX document) + { + xmlDocPtr pXmlDocContent = parseExport(tempFile1, "ppt/slides/slide1.xml"); + assertXPath(pXmlDocContent, + "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice", + "Requires", + "a14"); + assertXPathContent(pXmlDocContent, + "/p:sld/p:cSld/p:spTree/mc:AlternateContent/mc:Choice/p:sp/p:txBody/a:p/a14:m/m:oMath/m:r[1]/m:t", + "a"); + + const SdrPage *pPage = GetPage(1, xDocShRef); + const SdrObject* pObj = dynamic_cast<SdrObject*>(pPage->GetObj(0)); + CPPUNIT_ASSERT_MESSAGE("no object", pObj != nullptr); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(OBJ_OLE2), pObj->GetObjIdentifier()); } xDocShRef->DoClose(); |