summaryrefslogtreecommitdiff
path: root/sw/source/core/swg/SwXMLTextBlocks1.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/swg/SwXMLTextBlocks1.cxx')
-rw-r--r--sw/source/core/swg/SwXMLTextBlocks1.cxx16
1 files changed, 13 insertions, 3 deletions
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx
index 0297d68fa442..589d4e192097 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/io/IOException.hpp>
#include <com/sun/star/xml/sax/FastParser.hpp>
#include <com/sun/star/xml/sax/FastToken.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
#include <com/sun/star/document/XStorageBasedDocument.hpp>
@@ -194,6 +195,9 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
uno::Reference< uno::XComponentContext > xContext =
comphelper::getProcessComponentContext();
+ // get parser
+ uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext );
+
// create descriptor and reference to it. Either
// both or neither must be kept because of the
// reference counting!
@@ -206,15 +210,21 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
OUString sFilterComponent = bOasis
? OUString("com.sun.star.comp.Writer.XMLOasisAutotextEventsImporter")
: OUString("com.sun.star.comp.Writer.XMLAutotextEventsImporter");
- uno::Reference< xml::sax::XFastParser > xFilter(
+ uno::Reference< xml::sax::XDocumentHandler > xFilter(
xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
sFilterComponent, aFilterArguments, xContext),
- UNO_QUERY_THROW );
+ UNO_QUERY );
+ OSL_ENSURE( xFilter.is(), "can't instantiate autotext-events filter");
+ if ( !xFilter.is() )
+ return ERR_SWG_READ_ERROR;
+
+ // connect parser and filter
+ xParser->setDocumentHandler( xFilter );
// parse the stream
try
{
- xFilter->parseStream( aParserInput );
+ xParser->parseStream( aParserInput );
}
catch( xml::sax::SAXParseException& )
{