diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-01-14 22:40:52 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-01-15 13:03:08 +0100 |
commit | 80b55dcfc9754553e42625d0d6e9ebbb728200eb (patch) | |
tree | 25e34b3936cc27da5ee5358293611777c6625ef0 /starmath/source | |
parent | 3e0bc5c7fe715ebd38bfa64a49b23df58d6d29a9 (diff) |
starmath: only use WordProcessingML elements in DOCX files
Change-Id: I1b0f6d67bd0db0796756fd920ab92303a7ee7d79
Diffstat (limited to 'starmath/source')
-rw-r--r-- | starmath/source/document.cxx | 7 | ||||
-rw-r--r-- | starmath/source/ooxmlexport.cxx | 6 | ||||
-rw-r--r-- | starmath/source/ooxmlexport.hxx | 6 | ||||
-rw-r--r-- | starmath/source/unomodel.cxx | 7 |
4 files changed, 19 insertions, 7 deletions
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 758fb8a95a0e..41c6d6cd1bcf 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -895,13 +895,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 51c588ca3a93..2c19f8a28e85 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) |