summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sd/qa/unit/data/pptx/Math.pptxbin0 -> 35240 bytes
-rw-r--r--sd/qa/unit/export-tests.cxx29
-rw-r--r--starmath/source/ooxmlexport.cxx6
3 files changed, 32 insertions, 3 deletions
diff --git a/sd/qa/unit/data/pptx/Math.pptx b/sd/qa/unit/data/pptx/Math.pptx
new file mode 100644
index 000000000000..fef20675b59e
--- /dev/null
+++ b/sd/qa/unit/data/pptx/Math.pptx
Binary files differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 2f9550afda5e..211cff25eb4d 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -142,6 +142,7 @@ public:
void testTdf91378();
void testBnc822341();
void testMathObject();
+ void testMathObjectPPT2010();
void testTdf80224();
void testTdf92527();
@@ -182,6 +183,7 @@ public:
CPPUNIT_TEST(testBnc822341);
CPPUNIT_TEST(testMathObject);
+ CPPUNIT_TEST(testMathObjectPPT2010);
CPPUNIT_TEST(testTdf80224);
CPPUNIT_TEST(testExportTransitionsPPTX);
@@ -1202,6 +1204,33 @@ void SdExportTest::testMathObject()
xDocShRef->DoClose();
}
+void SdExportTest::testMathObjectPPT2010()
+{
+ // Check import / export of math object
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/Math.pptx"), PPTX);
+ utl::TempFile tempFile1;
+ xDocShRef = saveAndReload(xDocShRef, PPTX, &tempFile1);
+
+ // 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:sSup/m:e/m:r[1]/m:t",
+ OUString::fromUtf8("\xf0\x9d\x91\x8e")); // non-BMP char
+
+ 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();
+}
+
void SdExportTest::testBulletMarginAndIndentation()
{
::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/bulletMarginAndIndent.pptx"), PPTX );
diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx
index 277fb2511914..63f7cd4fc0f0 100644
--- a/starmath/source/ooxmlexport.cxx
+++ b/starmath/source/ooxmlexport.cxx
@@ -75,6 +75,7 @@ void SmOoxmlExport::HandleText( const SmNode* pNode, int /*nLevel*/)
m_pSerializer->startElementNS( XML_m, XML_t, FSNS( XML_xml, XML_space ), "preserve", FSEND );
const SmTextNode* pTemp = static_cast<const SmTextNode* >(pNode);
SAL_INFO( "starmath.ooxml", "Text:" << OUStringToOString( pTemp->GetText(), RTL_TEXTENCODING_UTF8 ).getStr());
+ OUStringBuffer buf(pTemp->GetText());
for(sal_Int32 i=0;i<pTemp->GetText().getLength();i++)
{
#if 0
@@ -94,9 +95,7 @@ void SmOoxmlExport::HandleText( const SmNode* pNode, int /*nLevel*/)
nFace = 0x7;
*pS << sal_uInt8(nFace+128); //typeface
#endif
- sal_uInt16 nChar = pTemp->GetText()[i];
- m_pSerializer->writeEscaped( OUString( SmTextNode::ConvertSymbolToUnicode(nChar)));
-
+ buf[i] = SmTextNode::ConvertSymbolToUnicode(buf[i]);
#if 0
//Mathtype can only have these sort of character
//attributes on a single character, starmath can put them
@@ -127,6 +126,7 @@ void SmOoxmlExport::HandleText( const SmNode* pNode, int /*nLevel*/)
}
#endif
}
+ m_pSerializer->writeEscaped(buf.makeStringAndClear());
m_pSerializer->endElementNS( XML_m, XML_t );
m_pSerializer->endElementNS( XML_m, XML_r );
}