summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-11-02 16:21:29 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-11-02 20:47:30 +0100
commitf821939c1d2befafda70a8e8c3ed88748ab75762 (patch)
treec4ee499092f63650b823ab9affece35d73c13b2d /reportdesign
parent4460f5f8503db44bf8e62fd4b2f7246a87156f84 (diff)
tdf#137916 get report xml importer working again
Change-Id: I238373bdfd35001c09a67b73cc38f5a96640e2ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105190 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/source/filter/xml/xmlfilter.cxx24
1 files changed, 8 insertions, 16 deletions
diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx
index d3d495d79d0f..487ee306aa16 100644
--- a/reportdesign/source/filter/xml/xmlfilter.cxx
+++ b/reportdesign/source/filter/xml/xmlfilter.cxx
@@ -114,7 +114,7 @@ static ErrCode ReadThroughComponent(
const uno::Reference<XInputStream>& xInputStream,
const uno::Reference<XComponent>& xModelComponent,
const uno::Reference<XComponentContext> & rContext,
- const uno::Reference< XDocumentHandler >& _xFilter )
+ const uno::Reference<XFastParser>& rFastParser )
{
OSL_ENSURE(xInputStream.is(), "input stream missing");
OSL_ENSURE(xModelComponent.is(), "document missing");
@@ -125,27 +125,18 @@ static ErrCode ReadThroughComponent(
aParserInput.aInputStream = xInputStream;
// get filter
- SAL_WARN_IF( !_xFilter.is(), "reportdesign", "Can't instantiate filter component." );
- if( !_xFilter.is() )
+ SAL_WARN_IF( !rFastParser.is(), "reportdesign", "Can't instantiate filter component." );
+ if( !rFastParser.is() )
return ErrCode(1);
// connect model and filter
- uno::Reference < XImporter > xImporter( _xFilter, UNO_QUERY );
+ uno::Reference < XImporter > xImporter( rFastParser, UNO_QUERY );
xImporter->setTargetDocument( xModelComponent );
// finally, parser the stream
try
{
- uno::Reference < XFastParser > xFastParser( _xFilter, UNO_QUERY );\
- if (xFastParser.is())
- xFastParser->parseStream( aParserInput );
- else
- {
- uno::Reference< XParser > xParser = xml::sax::Parser::create(rContext);
- // connect parser and filter
- xParser->setDocumentHandler( _xFilter );
- xParser->parseStream( aParserInput );
- }
+ rFastParser->parseStream( aParserInput );
}
catch (const SAXParseException&)
{
@@ -233,7 +224,8 @@ static ErrCode ReadThroughComponent(
if ( _xProp.is() )
aFilterCompArgs[ nArgs++ ] <<= _xProp;
- Reference< xml::sax::XDocumentHandler > xDocHandler(
+ // the underlying SvXMLImport implements XFastParser, XImporter, XFastDocumentHandler
+ Reference< XFastParser > xFastParser(
rxContext->getServiceManager()->createInstanceWithArgumentsAndContext(_sFilterName, aFilterCompArgs, rxContext),
uno::UNO_QUERY_THROW );
uno::Reference< XInputStream > xInputStream = xDocStream->getInputStream();
@@ -241,7 +233,7 @@ static ErrCode ReadThroughComponent(
return ReadThroughComponent( xInputStream
,xModelComponent
,rxContext
- ,xDocHandler );
+ ,xFastParser );
}
// TODO/LATER: better error handling