path: root/sw
diff options
authorLuboš Luňák <>2012-08-23 14:06:45 +0200
committerMiklos Vajna <>2012-08-24 08:47:29 +0200
commit44bdf23e3fa29f1b37faa6460bdf61e4b4627fe8 (patch)
tree24545212a59cc15dc7df363511760159ce5d741a /sw
parent7f18b80a3bd2b3c126ac852c7ecd5ceb376f389d (diff)
fix math export/import in docx/rtf
For some reason older gcc versions don't manage to dynamic_cast to the necessary cast. I'm not quite sure why, forcing sal/osl/unx/module.cxx to always use RTLD_GLOBAL does not seem to help. Most probably compiler bug. Changing the cast to two simpler ones helps. Signed-off-by: Miklos Vajna <>
Diffstat (limited to 'sw')
1 files changed, 7 insertions, 4 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 34e383cc2ae6..7ad5a1ee90fc 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -96,6 +96,7 @@
#include <editeng/opaqitem.hxx>
#include <svx/svdmodel.hxx>
#include <svx/svdobj.hxx>
+#include <sfx2/sfxbasemodel.hxx>
#include <anchoredobject.hxx>
#include <docufld.hxx>
@@ -2333,10 +2334,12 @@ void DocxAttributeOutput::WritePostponedMath()
uno::Reference < embed::XEmbeddedObject > xObj(const_cast<SwOLENode*>(m_postponedMath)->GetOLEObj().GetOleRef());
uno::Reference< uno::XInterface > xInterface( xObj->getComponent(), uno::UNO_QUERY );
- if( oox::FormulaExportBase* formulaexport = dynamic_cast< oox::FormulaExportBase* >( xInterface.get()))
- formulaexport->writeFormulaOoxml( m_pSerializer, GetExport().GetFilter().getVersion());
- else
- OSL_FAIL( "Math OLE object cannot write out OOXML" );
+// gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast directly to the target class,
+// so help it with an intermediate cast. I'm not sure what exactly the problem is, seems to be unrelated
+// to RTLD_GLOBAL, so most probably a gcc bug.
+ oox::FormulaExportBase* formulaexport = dynamic_cast<oox::FormulaExportBase*>(dynamic_cast<SfxBaseModel*>(xInterface.get()));
+ assert( formulaexport != NULL );
+ formulaexport->writeFormulaOoxml( m_pSerializer, GetExport().GetFilter().getVersion());
m_postponedMath = NULL;