summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-01-14 22:40:52 +0100
committerMichael Stahl <mstahl@redhat.com>2016-01-15 13:03:08 +0100
commit80b55dcfc9754553e42625d0d6e9ebbb728200eb (patch)
tree25e34b3936cc27da5ee5358293611777c6625ef0
parent3e0bc5c7fe715ebd38bfa64a49b23df58d6d29a9 (diff)
starmath: only use WordProcessingML elements in DOCX files
Change-Id: I1b0f6d67bd0db0796756fd920ab92303a7ee7d79
-rw-r--r--include/oox/mathml/export.hxx5
-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
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx3
8 files changed, 32 insertions, 11 deletions
diff --git a/include/oox/mathml/export.hxx b/include/oox/mathml/export.hxx
index 49a2afe7e3b0..20b6b21da53a 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 dde99d513209..7a9c3598da43 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 <memory>
#include <set>
@@ -146,7 +147,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 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)
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index e8b505504532..138b8069f225 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4544,7 +4544,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)