summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-01-14 22:40:52 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-01-21 08:13:28 +0000
commitacc3d942e1db108ebca3e9e0c086ab361acc3695 (patch)
tree5f8dcb93b451bd2b09dcdbf8094266719e48bd41 /starmath
parent50a3c6b2f3b849885580b304929eabe4a71b9162 (diff)
starmath: only use WordProcessingML elements in DOCX files
Change-Id: I1b0f6d67bd0db0796756fd920ab92303a7ee7d79 (cherry picked from commit 80b55dcfc9754553e42625d0d6e9ebbb728200eb) Reviewed-on: https://gerrit.libreoffice.org/21494 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/inc/document.hxx5
-rw-r--r--starmath/inc/unomodel.hxx4
-rw-r--r--starmath/source/document.cxx7
-rw-r--r--starmath/source/ooxmlexport.cxx6
-rw-r--r--starmath/source/ooxmlexport.hxx6
-rw-r--r--starmath/source/unomodel.cxx7
6 files changed, 26 insertions, 9 deletions
diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx
index 67ef680e79c6..9a94f0115982 100644
--- a/starmath/inc/document.hxx
+++ b/starmath/inc/document.hxx
@@ -31,6 +31,7 @@
#include <sax/fshelper.hxx>
#include <oox/core/filterbase.hxx>
#include <oox/mathml/import.hxx>
+#include <oox/export/utils.hxx>
#include <set>
@@ -145,7 +146,9 @@ class SM_DLLPUBLIC SmDocShell : public SfxObjectShell, public SfxListener
*/
void InvalidateCursor();
- bool writeFormulaOoxml( ::sax_fastparser::FSHelperPtr pSerializer, oox::core::OoxmlVersion version );
+ bool writeFormulaOoxml(::sax_fastparser::FSHelperPtr pSerializer,
+ oox::core::OoxmlVersion version,
+ oox::drawingml::DocumentType documentType);
void writeFormulaRtf(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding);
void readFormulaOoxml( oox::formulaimport::XmlStream& stream );
diff --git a/starmath/inc/unomodel.hxx b/starmath/inc/unomodel.hxx
index 6b6ac0779f69..c853806b5302 100644
--- a/starmath/inc/unomodel.hxx
+++ b/starmath/inc/unomodel.hxx
@@ -91,7 +91,9 @@ public:
virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& xParent ) throw( css::lang::NoSupportException, css::uno::RuntimeException, std::exception ) override;
// oox::FormulaExportBase
- virtual void writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer, oox::core::OoxmlVersion version ) override;
+ virtual void writeFormulaOoxml(::sax_fastparser::FSHelperPtr pSerializer,
+ oox::core::OoxmlVersion version,
+ oox::drawingml::DocumentType documentType) override;
virtual void writeFormulaRtf(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding) override;
// oox::FormulaImportBase
virtual void readFormulaOoxml( oox::formulaimport::XmlStream& stream ) override;
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index dae21759c0b2..63dbfbe07e37 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -900,13 +900,16 @@ bool SmDocShell::ConvertTo( SfxMedium &rMedium )
return bRet;
}
-bool SmDocShell::writeFormulaOoxml( ::sax_fastparser::FSHelperPtr pSerializer, oox::core::OoxmlVersion version )
+bool SmDocShell::writeFormulaOoxml(
+ ::sax_fastparser::FSHelperPtr const pSerializer,
+ oox::core::OoxmlVersion const version,
+ oox::drawingml::DocumentType const documentType)
{
if( !pTree )
Parse();
if( pTree && !IsFormulaArranged() )
ArrangeFormula();
- SmOoxmlExport aEquation( pTree, version );
+ SmOoxmlExport aEquation(pTree, version, documentType);
return aEquation.ConvertFromStarMath( pSerializer );
}
diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx
index 5a72ee11784b..277fb2511914 100644
--- a/starmath/source/ooxmlexport.cxx
+++ b/starmath/source/ooxmlexport.cxx
@@ -16,9 +16,11 @@
using namespace oox;
using namespace oox::core;
-SmOoxmlExport::SmOoxmlExport( const SmNode* pIn, OoxmlVersion v )
+SmOoxmlExport::SmOoxmlExport(const SmNode *const pIn, OoxmlVersion const v,
+ drawingml::DocumentType const documentType)
: SmWordExportBase( pIn )
, version( v )
+, m_DocumentType(documentType)
{
}
@@ -63,7 +65,7 @@ void SmOoxmlExport::HandleText( const SmNode* pNode, int /*nLevel*/)
m_pSerializer->singleElementNS( XML_m, XML_nor, FSEND );
m_pSerializer->endElementNS( XML_m, XML_rPr );
}
- if( version == ECMA_DIALECT )
+ if (drawingml::DOCUMENT_DOCX == m_DocumentType && ECMA_DIALECT == version)
{ // HACK: MSOffice2007 does not import characters properly unless this font is explicitly given
m_pSerializer->startElementNS( XML_w, XML_rPr, FSEND );
m_pSerializer->singleElementNS( XML_w, XML_rFonts, FSNS( XML_w, XML_ascii ), "Cambria Math",
diff --git a/starmath/source/ooxmlexport.hxx b/starmath/source/ooxmlexport.hxx
index a4740989d79d..5bd69bf8eeaf 100644
--- a/starmath/source/ooxmlexport.hxx
+++ b/starmath/source/ooxmlexport.hxx
@@ -14,6 +14,7 @@
#include <sax/fshelper.hxx>
#include <oox/core/filterbase.hxx>
+#include <oox/export/utils.hxx>
/**
Class implementing writing of formulas to OOXML.
@@ -21,7 +22,8 @@
class SmOoxmlExport : public SmWordExportBase
{
public:
- SmOoxmlExport( const SmNode* pIn, oox::core::OoxmlVersion version );
+ SmOoxmlExport(const SmNode* pIn, oox::core::OoxmlVersion version,
+ oox::drawingml::DocumentType documentType);
bool ConvertFromStarMath( ::sax_fastparser::FSHelperPtr m_pSerializer );
private:
virtual void HandleVerticalStack( const SmNode* pNode, int nLevel ) override;
@@ -37,6 +39,8 @@ private:
virtual void HandleBlank() override;
::sax_fastparser::FSHelperPtr m_pSerializer;
oox::core::OoxmlVersion version;
+ /// needed to determine markup for nested run properties
+ oox::drawingml::DocumentType const m_DocumentType;
};
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index 34bf51a1b21d..32ef68f5fb6b 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -1110,9 +1110,12 @@ void SAL_CALL SmModel::setParent( const uno::Reference< uno::XInterface >& xPare
}
}
-void SmModel::writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer, oox::core::OoxmlVersion version )
+void SmModel::writeFormulaOoxml(
+ ::sax_fastparser::FSHelperPtr const pSerializer,
+ oox::core::OoxmlVersion const version,
+ oox::drawingml::DocumentType const documentType)
{
- static_cast< SmDocShell* >( GetObjectShell())->writeFormulaOoxml( m_pSerializer, version );
+ static_cast<SmDocShell*>(GetObjectShell())->writeFormulaOoxml(pSerializer, version, documentType);
}
void SmModel::writeFormulaRtf(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding)