starmath: fix OOXML export of non-BMP Unicode
Change-Id: Iafaeb9ea2e96ee6d8cc96174731ba3845c230b5e
This commit is contained in:
BIN
sd/qa/unit/data/pptx/Math.pptx
Normal file
BIN
sd/qa/unit/data/pptx/Math.pptx
Normal file
Binary file not shown.
@@ -142,6 +142,7 @@ public:
|
|||||||
void testTdf91378();
|
void testTdf91378();
|
||||||
void testBnc822341();
|
void testBnc822341();
|
||||||
void testMathObject();
|
void testMathObject();
|
||||||
|
void testMathObjectPPT2010();
|
||||||
void testTdf80224();
|
void testTdf80224();
|
||||||
void testTdf92527();
|
void testTdf92527();
|
||||||
|
|
||||||
@@ -182,6 +183,7 @@ public:
|
|||||||
|
|
||||||
CPPUNIT_TEST(testBnc822341);
|
CPPUNIT_TEST(testBnc822341);
|
||||||
CPPUNIT_TEST(testMathObject);
|
CPPUNIT_TEST(testMathObject);
|
||||||
|
CPPUNIT_TEST(testMathObjectPPT2010);
|
||||||
CPPUNIT_TEST(testTdf80224);
|
CPPUNIT_TEST(testTdf80224);
|
||||||
|
|
||||||
CPPUNIT_TEST(testExportTransitionsPPTX);
|
CPPUNIT_TEST(testExportTransitionsPPTX);
|
||||||
@@ -1202,6 +1204,33 @@ void SdExportTest::testMathObject()
|
|||||||
xDocShRef->DoClose();
|
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()
|
void SdExportTest::testBulletMarginAndIndentation()
|
||||||
{
|
{
|
||||||
::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/bulletMarginAndIndent.pptx"), PPTX );
|
::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/bulletMarginAndIndent.pptx"), PPTX );
|
||||||
|
@@ -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 );
|
m_pSerializer->startElementNS( XML_m, XML_t, FSNS( XML_xml, XML_space ), "preserve", FSEND );
|
||||||
const SmTextNode* pTemp = static_cast<const SmTextNode* >(pNode);
|
const SmTextNode* pTemp = static_cast<const SmTextNode* >(pNode);
|
||||||
SAL_INFO( "starmath.ooxml", "Text:" << OUStringToOString( pTemp->GetText(), RTL_TEXTENCODING_UTF8 ).getStr());
|
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++)
|
for(sal_Int32 i=0;i<pTemp->GetText().getLength();i++)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
@@ -94,9 +95,7 @@ void SmOoxmlExport::HandleText( const SmNode* pNode, int /*nLevel*/)
|
|||||||
nFace = 0x7;
|
nFace = 0x7;
|
||||||
*pS << sal_uInt8(nFace+128); //typeface
|
*pS << sal_uInt8(nFace+128); //typeface
|
||||||
#endif
|
#endif
|
||||||
sal_uInt16 nChar = pTemp->GetText()[i];
|
buf[i] = SmTextNode::ConvertSymbolToUnicode(buf[i]);
|
||||||
m_pSerializer->writeEscaped( OUString( SmTextNode::ConvertSymbolToUnicode(nChar)));
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
//Mathtype can only have these sort of character
|
//Mathtype can only have these sort of character
|
||||||
//attributes on a single character, starmath can put them
|
//attributes on a single character, starmath can put them
|
||||||
@@ -127,6 +126,7 @@ void SmOoxmlExport::HandleText( const SmNode* pNode, int /*nLevel*/)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
m_pSerializer->writeEscaped(buf.makeStringAndClear());
|
||||||
m_pSerializer->endElementNS( XML_m, XML_t );
|
m_pSerializer->endElementNS( XML_m, XML_t );
|
||||||
m_pSerializer->endElementNS( XML_m, XML_r );
|
m_pSerializer->endElementNS( XML_m, XML_r );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user