diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-10-17 15:46:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-17 16:40:14 +0200 |
commit | 49ba005c111b50c2d7b6c8c68d0a09d4eafa7288 (patch) | |
tree | 547e19bafeae9184dfdaf416ebfc5a50bba4ffe1 | |
parent | 2d1b5ecdf81d19993f2d9dd4f07521361fac4570 (diff) |
TransformerBase: use the fastparser API when possible
part of the process of making SvXMLImport fastparser-only
Change-Id: Ie93e846e745b4388b891a68740c17742bbd62e82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104465
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | xmloff/source/transform/TransformerBase.cxx | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx index 1b9e43fc9c19..c55e29562558 100644 --- a/xmloff/source/transform/TransformerBase.cxx +++ b/xmloff/source/transform/TransformerBase.cxx @@ -19,6 +19,7 @@ #include <rtl/ref.hxx> #include <rtl/ustrbuf.hxx> +#include <sal/log.hxx> #include <osl/diagnose.h> #include <com/sun/star/i18n/CharacterClassification.hpp> #include <com/sun/star/i18n/UnicodeType.hpp> @@ -382,22 +383,23 @@ void SAL_CALL XMLTransformerBase::initialize( const Sequence< Any >& aArguments // The Any shift operator can't be used to query the type because it // uses queryInterface, and the model also has a XPropertySet interface. + css::uno::Reference< XFastDocumentHandler > xFastHandler; + if( (rArgument >>= xFastHandler) && xFastHandler ) + { + SvXMLImport *pFastHandler = dynamic_cast<SvXMLImport*>( xFastHandler.get() ); + assert(pFastHandler); + m_xHandler.set( new SvXMLLegacyToFastDocHandler( pFastHandler ) ); + } // document handler - if( cppu::UnoType<XDocumentHandler>::get().isAssignableFrom( rArgument.getValueType() ) ) + else if( cppu::UnoType<XDocumentHandler>::get().isAssignableFrom( rArgument.getValueType() ) ) { m_xHandler.set( rArgument, UNO_QUERY ); - // Type change to avoid crashing of dynamic_cast - if (SvXMLImport *pFastHandler = dynamic_cast<SvXMLImport*>( - uno::Reference< XFastDocumentHandler >( m_xHandler, uno::UNO_QUERY ).get() ) ) - m_xHandler.set( new SvXMLLegacyToFastDocHandler( pFastHandler ) ); } - // property set to transport data across - if( cppu::UnoType<XPropertySet>::get().isAssignableFrom( rArgument.getValueType() ) ) + else if( cppu::UnoType<XPropertySet>::get().isAssignableFrom( rArgument.getValueType() ) ) m_xPropSet.set( rArgument, UNO_QUERY ); - // xmodel - if( cppu::UnoType<css::frame::XModel>::get().isAssignableFrom( rArgument.getValueType() ) ) + else if( cppu::UnoType<css::frame::XModel>::get().isAssignableFrom( rArgument.getValueType() ) ) mxModel.set( rArgument, UNO_QUERY ); } |