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.
This commit is contained in:
@@ -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();
|
||||
|
@@ -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();
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -74,6 +74,7 @@ $(eval $(call gb_Library_use_libraries,writerfilter,\
|
||||
msfilter \
|
||||
oox \
|
||||
sal \
|
||||
sfx \
|
||||
sot \
|
||||
svt \
|
||||
tl \
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include <comphelper/embeddedobjectcontainer.hxx>
|
||||
#include <tools/globname.hxx>
|
||||
#include <comphelper/classids.hxx>
|
||||
#include <sfx2/sfxbasemodel.hxx>
|
||||
#include "OOXMLFastContextHandler.hxx"
|
||||
#include "OOXMLFactory.hxx"
|
||||
#include "Handler.hxx"
|
||||
@@ -2441,8 +2442,12 @@ void OOXMLFastContextHandlerMath::process()
|
||||
OUString aName;
|
||||
uno::Reference< embed::XEmbeddedObject > ref = container.CreateEmbeddedObject( name.GetByteSequence(), aName );
|
||||
uno::Reference< uno::XInterface > component( ref->getComponent(), uno::UNO_QUERY );
|
||||
if( oox::FormulaImportBase* import = dynamic_cast< oox::FormulaImportBase* >( component.get()))
|
||||
import->readFormulaOoxml( buffer );
|
||||
// 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::FormulaImportBase* import = dynamic_cast< oox::FormulaImportBase* >( dynamic_cast< SfxBaseModel* >(component.get()));
|
||||
assert( import != NULL );
|
||||
import->readFormulaOoxml( buffer );
|
||||
if (isForwardEvents())
|
||||
{
|
||||
OOXMLPropertySet * pProps = new OOXMLPropertySetImpl();
|
||||
|
@@ -51,6 +51,7 @@
|
||||
#include <tools/globname.hxx>
|
||||
#include <comphelper/classids.hxx>
|
||||
#include <comphelper/embeddedobjectcontainer.hxx>
|
||||
#include <sfx2/sfxbasemodel.hxx>
|
||||
|
||||
#include <oox/mathml/import.hxx>
|
||||
#include <doctok/sprmids.hxx> // NS_sprm namespace
|
||||
@@ -3635,8 +3636,12 @@ int RTFDocumentImpl::popState()
|
||||
OUString aName;
|
||||
uno::Reference<embed::XEmbeddedObject> xObject = aContainer.CreateEmbeddedObject(aGlobalName.GetByteSequence(), aName);
|
||||
uno::Reference<util::XCloseable> xComponent(xObject->getComponent(), uno::UNO_QUERY);
|
||||
if( oox::FormulaImportBase* pImport = dynamic_cast<oox::FormulaImportBase*>(xComponent.get()))
|
||||
pImport->readFormulaOoxml(m_aMathBuffer);
|
||||
// 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::FormulaImportBase* pImport = dynamic_cast<oox::FormulaImportBase*>(dynamic_cast<SfxBaseModel*>(xComponent.get()));
|
||||
assert( pImport != NULL );
|
||||
pImport->readFormulaOoxml(m_aMathBuffer);
|
||||
RTFValue::Pointer_t pValue(new RTFValue(xObject));
|
||||
RTFSprms aMathAttributes;
|
||||
aMathAttributes.set(NS_ooxml::LN_starmath, pValue);
|
||||
|
Reference in New Issue
Block a user