diff options
author | Frédéric Wang <fred.wang@free.fr> | 2013-06-28 17:07:11 +0200 |
---|---|---|
committer | Bosdonnat Cedric <cedric.bosdonnat@free.fr> | 2013-07-01 13:41:35 +0000 |
commit | 1ef63d0842dab4154c5ca2fc42e416950bd7459a (patch) | |
tree | ed4f883b134f3ae0cc708a843adfba24e3311727 | |
parent | a70d429b96be02f0aa407216ab91edbe7883c7c7 (diff) |
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>
-rw-r--r-- | filter/source/xslt/odf2xhtml/export/xhtml/body.xsl | 12 | ||||
-rw-r--r-- | starmath/source/mathmlexport.cxx | 24 |
2 files changed, 24 insertions, 12 deletions
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl index d9de0e9ba322..e83195c50cda 100644 --- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl +++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl @@ -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> diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index fb1e6c365130..fbc1e9747832 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -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(); |