diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-10-17 15:44:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-17 18:07:02 +0200 |
commit | f71debf3fa65493ebb1a1538023987d76c66374c (patch) | |
tree | 08805bdbf7715db8a6891fddbc7196ee40369e57 | |
parent | 49ba005c111b50c2d7b6c8c68d0a09d4eafa7288 (diff) |
OOo2Oasis: use the fastparser API when possible
part of the process of making SvXMLImport fastparser-only
Change-Id: Ib8b4a02fff94653adf9d48ac07404d392572b1f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104464
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | xmloff/source/transform/OOo2Oasis.cxx | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/xmloff/source/transform/OOo2Oasis.cxx b/xmloff/source/transform/OOo2Oasis.cxx index 7b17554bdb6f..4e860b64f620 100644 --- a/xmloff/source/transform/OOo2Oasis.cxx +++ b/xmloff/source/transform/OOo2Oasis.cxx @@ -42,6 +42,7 @@ #include "OOo2Oasis.hxx" #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/typeprovider.hxx> +#include <tools/diagnose_ex.h> using namespace ::xmloff::token; using namespace ::com::sun::star::uno; @@ -1915,32 +1916,26 @@ void OOo2OasisTransformer::Initialize( { OSL_ENSURE( !GetDocHandler().is(), "duplication initialization" ); - Reference< XDocumentHandler > xDocHandler; + Reference< XInterface > xFilter; if( !m_aSubServiceName.isEmpty() ) { - Reference< XComponentContext > xContext = - comphelper::getProcessComponentContext(); - try - { - // get filter component - xDocHandler.set( - xContext->getServiceManager()->createInstanceWithArgumentsAndContext(m_aSubServiceName, rArguments, xContext), - UNO_QUERY); - } - catch( Exception& ) - { - } + Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + // get filter component + xFilter = + xContext->getServiceManager()->createInstanceWithArgumentsAndContext(m_aSubServiceName, rArguments, xContext); + SAL_WARN_IF(!xFilter, "xmloff", "could not instantiate " << m_aSubServiceName); } + else + SAL_WARN("xmloff", "no subservice name"); - OSL_ENSURE( xDocHandler.is(), "can't instantiate filter component" ); - if( xDocHandler.is() ) + if (xFilter.is()) { Sequence<Any> aArgs( 1 + rArguments.getLength() ); - aArgs[0] <<= xDocHandler; + aArgs[0] <<= xFilter; std::copy(rArguments.begin(), rArguments.end(), std::next(aArgs.begin())); XMLTransformerBase::initialize( aArgs ); - OSL_ENSURE( GetDocHandler() == xDocHandler, + OSL_ENSURE( GetDocHandler() == xFilter, "duplicate doc handler" ); } else |