summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-12-16 15:10:40 +0100
committerStephan Bergmann <sbergman@redhat.com>2022-12-16 20:18:04 +0000
commit1ae71d8f09771ba7180be6ebdf89d36a31eb8625 (patch)
tree9ae2f804443468128c3e6c72846eaa32d4c49214 /writerfilter
parent068187a898cdd2e26e9b16c348ecc1ed2dee3f29 (diff)
Revert "fix math export/import in docx/rtf"
This reverts commit 2b5953a19e36a02040f2ff08bc87efe4785f80bd. Whatever that "gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast directly to the target class" issue actually was: For one, our GCC 7 baseline presumably would no longer have such an issue. And for another, the added asserts that the results of the dynamic_casts must be non-null were presumably all bogus (and have in part been reverted again in the meantime), as all the sources are UNO interface types that can presumably point at implementation objects of other than the expected C++ class types. (Those dynamic_casts from UNO interface types will be addressed in a follow-up commit. See the upcoming commit introducing loplugin:unocast on why such dynamic_casts are dangerous.) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx sw/qa/extras/rtfexport/rtfexport.cxx sw/source/filter/ww8/docxattributeoutput.cxx sw/source/filter/ww8/rtfattributeoutput.cxx writerfilter/Library_writerfilter.mk writerfilter/source/ooxml/OOXMLFastContextHandler.cxx writerfilter/source/rtftok/rtfdocumentimpl.cxx Change-Id: I0c330a3541e64ce08bfe30ff15d51a2fd8a243b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144336 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/ooxml/OOXMLFastContextHandler.cxx7
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx9
2 files changed, 5 insertions, 11 deletions
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index b479e587ebc0..5fcd1dd518cb 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -2282,11 +2282,8 @@ void OOXMLFastContextHandlerMath::process()
if (!ref.is())
return;
uno::Reference< uno::XInterface > component(ref->getComponent(), uno::UNO_QUERY_THROW);
-// 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));
- import.readFormulaOoxml(buffer);
+ if( oox::FormulaImportBase* import = dynamic_cast< oox::FormulaImportBase* >( component.get()))
+ import->readFormulaOoxml( buffer );
if (!isForwardEvents())
return;
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 8a888d8348f6..921bb61efceb 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2967,12 +2967,9 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState)
{
uno::Reference<util::XCloseable> xComponent(xObject->getComponent(),
uno::UNO_SET_THROW);
- // 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.
- auto& rImport = dynamic_cast<oox::FormulaImportBase&>(
- dynamic_cast<SfxBaseModel&>(*xComponent));
- rImport.readFormulaOoxml(m_aMathBuffer);
+ if (oox::FormulaImportBase* pImport
+ = dynamic_cast<oox::FormulaImportBase*>(xComponent.get()))
+ pImport->readFormulaOoxml(m_aMathBuffer);
auto pValue = new RTFValue(xObject);
RTFSprms aMathAttributes;