summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-08-23 14:06:45 +0200
committerLuboš Luňák <l.lunak@suse.cz>2012-08-23 14:06:45 +0200
commit2b5953a19e36a02040f2ff08bc87efe4785f80bd (patch)
tree10c7d1cbf66788f992ddeed0d390674fb750babe /sw
parentc5d5e06c1578f8ecae9e4e6fb55f1bdb529feb7d (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.
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx3
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx3
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx11
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx18
4 files changed, 16 insertions, 19 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 6615343db092..076eedce7dd4 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -49,10 +49,7 @@ public:
CPPUNIT_TEST(testZoom);
CPPUNIT_TEST(defaultTabStopNotInStyles);
CPPUNIT_TEST(testFdo38244);
- // See rtfexport test on why this is blacklisted.
-#if !(__GNUC__ == 4 && __GNUC_MINOR__ == 4)
CPPUNIT_TEST(testMathEscape);
-#endif
CPPUNIT_TEST(testFdo51034);
#endif
CPPUNIT_TEST_SUITE_END();
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index de705d2ef552..67b6242e3d4e 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -81,8 +81,6 @@ public:
CPPUNIT_TEST(testFdo50831);
CPPUNIT_TEST(testFdo48335);
CPPUNIT_TEST(testFdo38244);
- // With gcc-4.4, the dynamic_cast in RtfAttributeOutput::FlyFrameOLEMath() fails, strange.
-#if !(__GNUC__ == 4 && __GNUC_MINOR__ == 4)
CPPUNIT_TEST(testMathAccents);
CPPUNIT_TEST(testMathEqarray);
CPPUNIT_TEST(testMathD);
@@ -100,7 +98,6 @@ public:
CPPUNIT_TEST(testMathSubscripts);
CPPUNIT_TEST(testMathVerticalstacks);
CPPUNIT_TEST(testMathRuns);
-#endif
CPPUNIT_TEST(testFdo53113);
#endif
CPPUNIT_TEST_SUITE_END();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 71c191524354..b5165e77490e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -87,6 +87,7 @@
#include <editeng/editobj.hxx>
#include <svx/svdmodel.hxx>
#include <svx/svdobj.hxx>
+#include <sfx2/sfxbasemodel.hxx>
#include <anchoredobject.hxx>
#include <docufld.hxx>
@@ -2287,10 +2288,12 @@ void DocxAttributeOutput::WritePostponedMath()
return;
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;
}
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index a152e6ea314b..15f15b719e41 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -80,6 +80,7 @@
#include <filter/msfilter/msoleexp.hxx>
#include <filter/msfilter/rtfutil.hxx>
#include <svtools/miscopt.hxx>
+#include <sfx2/sfxbasemodel.hxx>
#include <docufld.hxx>
#include <fmtclds.hxx>
@@ -3362,15 +3363,14 @@ bool RtfAttributeOutput::FlyFrameOLEMath(const SwFlyFrmFmt* pFlyFrmFmt, SwOLENod
m_aRunText->append("{" LO_STRING_SVTOOLS_RTF_MMATH " ");
uno::Reference<util::XCloseable> xClosable(xObj->getComponent(), uno::UNO_QUERY);
- oox::FormulaExportBase* pBase = dynamic_cast<oox::FormulaExportBase*>(xClosable.get());
- SAL_WARN_IF(!pBase, "sw.rtf", "Math OLE object cannot write out RTF");
- if (pBase)
- {
- OStringBuffer aBuf;
- pBase->writeFormulaRtf(aBuf, m_rExport.eCurrentEncoding);
- m_aRunText->append(aBuf.makeStringAndClear());
- }
-
+// 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* pBase = dynamic_cast<oox::FormulaExportBase*>(dynamic_cast<SfxBaseModel*>(xClosable.get()));
+ assert( pBase != NULL );
+ OStringBuffer aBuf;
+ pBase->writeFormulaRtf(aBuf, m_rExport.eCurrentEncoding);
+ m_aRunText->append(aBuf.makeStringAndClear());
// Replacement graphic.
m_aRunText->append("{" LO_STRING_SVTOOLS_RTF_MMATHPICT " ");
FlyFrameOLEReplacement(pFlyFrmFmt, rOLENode, rSize);