include/oox/mathml/export.hxx | 5 ++++- starmath/inc/document.hxx | 5 ++++- starmath/inc/unomodel.hxx | 4 +++- starmath/source/document.cxx | 7 +++++-- starmath/source/ooxmlexport.cxx | 6 ++++-- starmath/source/ooxmlexport.hxx | 6 +++++- starmath/source/unomodel.cxx | 7 +++++-- sw/source/filter/ww8/docxattributeoutput.cxx | 3 ++- 8 files changed, 32 insertions(+), 11 deletions(-)
New commits: commit acc3d942e1db108ebca3e9e0c086ab361acc3695 Author: Michael Stahl <mst...@redhat.com> Date: Thu Jan 14 22:40:52 2016 +0100 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 <vmik...@collabora.co.uk> Tested-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/include/oox/mathml/export.hxx b/include/oox/mathml/export.hxx index 49a2afe..20b6b21 100644 --- a/include/oox/mathml/export.hxx +++ b/include/oox/mathml/export.hxx @@ -12,6 +12,7 @@ #include <sax/fshelper.hxx> #include <rtl/strbuf.hxx> #include <oox/core/filterbase.hxx> +#include <oox/export/utils.hxx> #include <oox/dllapi.h> namespace oox @@ -24,7 +25,9 @@ namespace oox class OOX_DLLPUBLIC FormulaExportBase { public: - virtual void writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer, oox::core::OoxmlVersion version ) = 0; + virtual void writeFormulaOoxml(::sax_fastparser::FSHelperPtr pSerializer, + oox::core::OoxmlVersion version, + oox::drawingml::DocumentType documentType) = 0; virtual void writeFormulaRtf( OStringBuffer& rBuffer, rtl_TextEncoding nEncoding ) = 0; protected: diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx index 67ef680e..9a94f01 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 6b6ac07..c853806 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 dae2175..63dbfbe 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 5a72ee1..277fb25 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 a474098..5bd69bf 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 34bf51a..32ef68f5 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) diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 858f630..c8ecd9d 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4517,7 +4517,8 @@ void DocxAttributeOutput::WritePostponedMath(const SwOLENode* pPostponedMath) oox::FormulaExportBase* formulaexport = dynamic_cast<oox::FormulaExportBase*>(dynamic_cast<SfxBaseModel*>(xInterface.get())); assert( formulaexport != nullptr ); if (formulaexport) - formulaexport->writeFormulaOoxml( m_pSerializer, GetExport().GetFilter().getVersion()); + formulaexport->writeFormulaOoxml( m_pSerializer, GetExport().GetFilter().getVersion(), + oox::drawingml::DOCUMENT_DOCX); } void DocxAttributeOutput::WritePostponedFormControl(const SdrObject* pObject) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits