summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2011-08-16 14:45:42 +0200
committerLuboš Luňák <l.lunak@suse.cz>2011-08-18 15:33:46 +0200
commit1ea4a6658517d27e7d5e26fc33fca9e49af6ddf7 (patch)
tree171f4aa9e40324b6a3ff41f93c39b10fa6907ef8
parent046677539e002698425b11428488a1229fc3be20 (diff)
write formula to the proper place inside ooxml document
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx26
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx2
2 files changed, 23 insertions, 5 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index fcd303ac8b36..f080ea9e362f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -585,6 +585,8 @@ void DocxAttributeOutput::EndRun()
// append the actual run end
m_pSerializer->endElementNS( XML_w, XML_r );
+ WritePostponedMath();
+
while ( m_Fields.begin() != m_Fields.end() )
{
EndField_Impl( m_Fields.front( ) );
@@ -2302,14 +2304,27 @@ bool DocxAttributeOutput::WriteOLEMath( const SdrObject*, const SwOLENode& rOLEN
if( !SotExchange::IsMath(aObjName) )
return false;
- uno::Reference< uno::XInterface > xInterface( aObjRef->getComponent(), uno::UNO_QUERY );
- OoxmlFormulaExportBase* formulaexport = dynamic_cast< OoxmlFormulaExportBase* >( xInterface.get());
- if( formulaexport == NULL )
- return false;
- formulaexport->writeFormulaOoxml( m_pSerializer );
+ assert( m_postponedMath == NULL ); // make it a list if there can be more inside one run
+ m_postponedMath = &rOLENode;
return true;
}
+void DocxAttributeOutput::WritePostponedMath()
+{
+ if( m_postponedMath == NULL )
+ return;
+ uno::Reference < embed::XEmbeddedObject > xObj(const_cast<SwOLENode*>(m_postponedMath)->GetOLEObj().GetOleRef());
+ sal_Int64 nAspect = m_postponedMath->GetAspect();
+ svt::EmbeddedObjectRef aObjRef( xObj, nAspect );
+
+ uno::Reference< uno::XInterface > xInterface( aObjRef->getComponent(), uno::UNO_QUERY );
+ if( OoxmlFormulaExportBase* formulaexport = dynamic_cast< OoxmlFormulaExportBase* >( xInterface.get()))
+ formulaexport->writeFormulaOoxml( m_pSerializer );
+ else
+ OSL_FAIL( "Math OLE object cannot write out OOXML" );
+ m_postponedMath = NULL;
+}
+
void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Point& /*rNdTopLeft*/ )
{
m_pSerializer->mark();
@@ -4341,6 +4356,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
m_pParentFrame( NULL ),
m_nCloseHyperlinkStatus( Undetected ),
m_postponedGraphic( NULL ),
+ m_postponedMath( NULL ),
m_postitFieldsMaxId( 0 )
{
}
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 550ba9fdd1f4..10ee7cd96a94 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -530,6 +530,7 @@ private:
void DoWriteBookmarks( );
void WritePostponedGraphic();
+ void WritePostponedMath();
void StartField_Impl( FieldInfos& rInfos, sal_Bool bWriteRun = sal_False );
void DoWriteCmd( String& rCmd );
@@ -603,6 +604,7 @@ private:
Size size;
};
std::list< PostponedGraphic >* m_postponedGraphic;
+ const SwOLENode* m_postponedMath;
std::vector< const SwPostItField* > m_postitFields;
unsigned int m_postitFieldsMaxId;