diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-08-23 14:06:45 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-08-23 14:06:45 +0200 |
commit | 2b5953a19e36a02040f2ff08bc87efe4785f80bd (patch) | |
tree | 10c7d1cbf66788f992ddeed0d390674fb750babe /sw/source/filter/ww8/rtfattributeoutput.cxx | |
parent | c5d5e06c1578f8ecae9e4e6fb55f1bdb529feb7d (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/source/filter/ww8/rtfattributeoutput.cxx')
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 18 |
1 files changed, 9 insertions, 9 deletions
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); |