diff options
-rw-r--r-- | filter/inc/filter/msfilter/ooxmlexport.hxx | 3 | ||||
-rw-r--r-- | starmath/Library_sm.mk | 1 | ||||
-rw-r--r-- | starmath/inc/document.hxx | 3 | ||||
-rw-r--r-- | starmath/inc/unomodel.hxx | 2 | ||||
-rw-r--r-- | starmath/source/document.cxx | 4 | ||||
-rw-r--r-- | starmath/source/ooxml.cxx | 12 | ||||
-rw-r--r-- | starmath/source/ooxml.hxx | 4 | ||||
-rw-r--r-- | starmath/source/unomodel.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 2 |
9 files changed, 25 insertions, 10 deletions
diff --git a/filter/inc/filter/msfilter/ooxmlexport.hxx b/filter/inc/filter/msfilter/ooxmlexport.hxx index b8a59e73d8a4..c9de21a9172a 100644 --- a/filter/inc/filter/msfilter/ooxmlexport.hxx +++ b/filter/inc/filter/msfilter/ooxmlexport.hxx @@ -29,6 +29,7 @@ #define _OOXMLEXPORT_HXX #include <sax/fshelper.hxx> +#include <oox/core/filterbase.hxx> #include "filter/msfilter/msfilterdllapi.h" /** @@ -38,7 +39,7 @@ class MSFILTER_DLLPUBLIC OoxmlFormulaExportBase { public: - virtual void writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer ) = 0; + virtual void writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer, oox::core::OoxmlVersion version ) = 0; }; #endif diff --git a/starmath/Library_sm.mk b/starmath/Library_sm.mk index 98d792da9c6d..6c6033724850 100644 --- a/starmath/Library_sm.mk +++ b/starmath/Library_sm.mk @@ -48,6 +48,7 @@ $(eval $(call gb_Library_add_linked_libs,sm,\ editeng \ i18npaper \ msfilter \ + oox \ sal \ sax \ sfx \ diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx index d8e042c3e230..99f0d8b4cc79 100644 --- a/starmath/inc/document.hxx +++ b/starmath/inc/document.hxx @@ -40,6 +40,7 @@ #include <vcl/jobset.hxx> #include <vcl/virdev.hxx> #include <sax/fshelper.hxx> +#include <oox/core/filterbase.hxx> #include <set> @@ -173,7 +174,7 @@ class SmDocShell : public SfxObjectShell, public SfxListener */ void InvalidateCursor(); - bool writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer ); + bool writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer, oox::core::OoxmlVersion version ); public: TYPEINFO(); diff --git a/starmath/inc/unomodel.hxx b/starmath/inc/unomodel.hxx index 15ada7b3a152..a55cac884158 100644 --- a/starmath/inc/unomodel.hxx +++ b/starmath/inc/unomodel.hxx @@ -103,7 +103,7 @@ public: virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xParent ) throw( ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException ); // OoxmlFormulaExportBase - virtual void writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer ); + virtual void writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer, oox::core::OoxmlVersion version ); static ::com::sun::star::uno::Sequence< rtl::OUString > getSupportedServiceNames_Static(); static ::rtl::OUString getImplementationName_Static(); diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index b9db1f5db35e..90da132a385a 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -991,7 +991,7 @@ sal_Bool SmDocShell::ConvertTo( SfxMedium &rMedium ) return bRet; } -bool SmDocShell::writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer ) +bool SmDocShell::writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer, oox::core::OoxmlVersion version ) { RTL_LOGFILE_CONTEXT( aLog, "starmath: SmDocShell::writeFormulaOoxml" ); @@ -999,7 +999,7 @@ bool SmDocShell::writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer Parse(); if( pTree && !IsFormulaArranged() ) ArrangeFormula(); - SmOoxml aEquation( aText, pTree ); + SmOoxml aEquation( aText, pTree, version ); return aEquation.ConvertFromStarMath( m_pSerializer ); } diff --git a/starmath/source/ooxml.cxx b/starmath/source/ooxml.cxx index 10b576deb281..5bf642696936 100644 --- a/starmath/source/ooxml.cxx +++ b/starmath/source/ooxml.cxx @@ -34,6 +34,7 @@ #include <oox/token/tokens.hxx> using namespace oox; +using namespace oox::core; // TODO duped from MathType @@ -70,9 +71,10 @@ static sal_Unicode Convert(sal_Unicode nIn) return nIn; } -SmOoxml::SmOoxml(String &rIn,SmNode *pIn) +SmOoxml::SmOoxml(String &rIn,SmNode *pIn,OoxmlVersion v) : str( rIn ) , pTree( pIn ) +, version( v ) { } @@ -222,6 +224,14 @@ void SmOoxml::HandleTable(SmNode *pNode,int nLevel) void SmOoxml::HandleText(SmNode *pNode, int /*nLevel*/) { m_pSerializer->startElementNS( XML_m, XML_r, FSEND ); + + if( version == ECMA_DIALECT ) + { // 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", + FSNS( XML_w, XML_hAnsi ), "Cambria Math", FSEND ); + m_pSerializer->endElementNS( XML_w, XML_rPr ); + } m_pSerializer->startElementNS( XML_m, XML_t, FSEND ); SmTextNode *pTemp=(SmTextNode *)pNode; fprintf(stderr, "T %s\n", rtl::OUStringToOString( pTemp->GetText(), RTL_TEXTENCODING_UTF8 ).getStr()); diff --git a/starmath/source/ooxml.hxx b/starmath/source/ooxml.hxx index 70de500ebff5..22aa91f61375 100644 --- a/starmath/source/ooxml.hxx +++ b/starmath/source/ooxml.hxx @@ -32,6 +32,7 @@ #include "node.hxx" #include <sax/fshelper.hxx> +#include <oox/core/filterbase.hxx> /** Class implementing writing of formulas to OOXML. @@ -39,7 +40,7 @@ class SmOoxml { public: - SmOoxml(String &rIn,SmNode *pIn); + SmOoxml(String &rIn,SmNode *pIn, oox::core::OoxmlVersion version); bool ConvertFromStarMath( ::sax_fastparser::FSHelperPtr m_pSerializer ); private: void HandleNodes(SmNode *pNode,int nLevel); @@ -49,6 +50,7 @@ private: String str; SmNode *pTree; ::sax_fastparser::FSHelperPtr m_pSerializer; + oox::core::OoxmlVersion version; }; diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index d44485a605cb..4ac92976567e 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -1132,9 +1132,9 @@ void SAL_CALL SmModel::setParent( const uno::Reference< uno::XInterface >& xPare } } -void SmModel::writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer ) +void SmModel::writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer, oox::core::OoxmlVersion version ) { - static_cast< SmDocShell* >( GetObjectShell())->writeFormulaOoxml( m_pSerializer ); + static_cast< SmDocShell* >( GetObjectShell())->writeFormulaOoxml( m_pSerializer, version ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index f080ea9e362f..41c585a6c538 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2319,7 +2319,7 @@ void DocxAttributeOutput::WritePostponedMath() uno::Reference< uno::XInterface > xInterface( aObjRef->getComponent(), uno::UNO_QUERY ); if( OoxmlFormulaExportBase* formulaexport = dynamic_cast< OoxmlFormulaExportBase* >( xInterface.get())) - formulaexport->writeFormulaOoxml( m_pSerializer ); + formulaexport->writeFormulaOoxml( m_pSerializer, GetExport().GetFilter().getVersion()); else OSL_FAIL( "Math OLE object cannot write out OOXML" ); m_postponedMath = NULL; |