fdo#66278 - MathML export: distinguish inline/display equations.

Change-Id: Ia764c2fd64ab772342ce86f67ee290ab38dc4a83
Reviewed-on: https://gerrit.libreoffice.org/4607
Reviewed-by: Bosdonnat Cedric <cedric.bosdonnat@free.fr>
Tested-by: Bosdonnat Cedric <cedric.bosdonnat@free.fr>
This commit is contained in:
Frédéric Wang
2013-06-28 17:07:11 +02:00
committed by Bosdonnat Cedric
parent a70d429b96
commit 1ef63d0842
2 changed files with 24 additions and 12 deletions

View File

@@ -2949,9 +2949,7 @@
-->
<!-- MathML -->
<xsl:template match="draw:object[math:math]">
<math xmlns="http://www.w3.org/1998/Math/MathML">
<xsl:apply-templates select="math:math/math:semantics/*" mode="math"/>
</math>
<xsl:apply-templates select="math:math" mode="math"/>
</xsl:template>
<xsl:template match="*" mode="math">
@@ -2966,6 +2964,12 @@
</xsl:attribute>
</xsl:template>
<xsl:template match="math:annotation" mode="math"/>
<!-- Ignore semantic annotations -->
<xsl:template match="math:semantics" mode="math">
<xsl:apply-templates select="*[1]" mode="math"/>
</xsl:template>
<!-- Ignore the replacement image -->
<xsl:template match="draw:frame/draw:image[preceding-sibling::*[1]/math:math]"/>
</xsl:stylesheet>

View File

@@ -599,6 +599,22 @@ sal_uInt32 SmXMLExport::exportDoc(enum XMLTokenEnum eClass)
void SmXMLExport::_ExportContent()
{
uno::Reference <frame::XModel> xModel = GetModel();
uno::Reference <lang::XUnoTunnel> xTunnel;
xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY);
SmModel *pModel = reinterpret_cast<SmModel *>
(xTunnel->getSomething(SmModel::getUnoTunnelId()));
SmDocShell *pDocShell = pModel ?
static_cast<SmDocShell*>(pModel->GetObjectShell()) : 0;
OSL_ENSURE( pDocShell, "doc shell missing" );
if (pDocShell && !pDocShell->GetFormat().IsTextmode())
{
// If the Math equation is not in text mode, we attach a display="block"
// attribute on the <math> root. We don't do anything if it is in
// text mode, the default display="inline" value will be used.
AddAttribute(XML_NAMESPACE_MATH, XML_DISPLAY, XML_BLOCK);
}
SvXMLElementExport aEquation(*this, XML_NAMESPACE_MATH, XML_MATH, sal_True, sal_True);
SvXMLElementExport *pSemantics=0;
@@ -613,14 +629,6 @@ void SmXMLExport::_ExportContent()
if (aText.Len())
{
// Convert symbol names
uno::Reference <frame::XModel> xModel = GetModel();
uno::Reference <lang::XUnoTunnel> xTunnel;
xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY);
SmModel *pModel = reinterpret_cast<SmModel *>
(xTunnel->getSomething(SmModel::getUnoTunnelId()));
SmDocShell *pDocShell = pModel ?
static_cast<SmDocShell*>(pModel->GetObjectShell()) : 0;
OSL_ENSURE( pDocShell, "doc shell missing" );
if (pDocShell)
{
SmParser &rParser = pDocShell->GetParser();