summaryrefslogtreecommitdiffstats
path: root/sw/source/filter/xml
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-10-03 13:30:43 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-10-04 16:29:53 +0200
commita20f9a410fdd3f776f870434bc39219d5fc64b40 (patch)
tree079278e5859c5782fbe9bfcc34302d09bd8dfadd /sw/source/filter/xml
parentbump to latest *binary* liberation fonts (diff)
downloadcore-a20f9a410fdd3f776f870434bc39219d5fc64b40.tar.gz
core-a20f9a410fdd3f776f870434bc39219d5fc64b40.zip
fdo#46808, Adapt xml::sax::XParser UNO service to new style
The xml.sax.Parser service already existed, it just did not have a new-style service to create it. Change-Id: I6f145a7504ff9e149c802f723991954a2801cbc9
Diffstat (limited to 'sw/source/filter/xml')
-rw-r--r--sw/source/filter/xml/swxml.cxx34
1 files changed, 11 insertions, 23 deletions
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index cfda96c4e7a5..c07cedac9075 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -33,7 +33,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/componentcontext.hxx>
#include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/io/XActiveDataControl.hpp>
#include <com/sun/star/text/XTextRange.hpp>
#include <com/sun/star/container/XChild.hpp>
@@ -158,13 +158,7 @@ sal_Int32 ReadThroughComponent(
aParserInput.aInputStream = xInputStream;
// get parser
- uno::Reference< xml::sax::XParser > xParser(
- rFactory->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser"))),
- UNO_QUERY );
- OSL_ENSURE( xParser.is(), "Can't create parser" );
- if( !xParser.is() )
- return ERR_SWG_READ_ERROR;
+ uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(comphelper::getComponentContext(rFactory));
RTL_LOGFILE_CONTEXT_TRACE( aLog, "parser created" );
// get filter
@@ -1067,6 +1061,8 @@ size_t XMLReader::GetSectionList( SfxMedium& rMedium,
{
uno::Reference< lang::XMultiServiceFactory > xServiceFactory =
comphelper::getProcessServiceFactory();
+ uno::Reference< uno::XComponentContext > xContext =
+ comphelper::getProcessComponentContext();
OSL_ENSURE( xServiceFactory.is(),
"XMLReader::Read: got no service manager" );
uno::Reference < embed::XStorage > xStg2;
@@ -1082,23 +1078,15 @@ size_t XMLReader::GetSectionList( SfxMedium& rMedium,
uno::Reference < io::XStream > xStm = xStg2->openStreamElement( sDocName, embed::ElementModes::READ );
aParserInput.aInputStream = xStm->getInputStream();
- // get parser
- uno::Reference< XInterface > xXMLParser = xServiceFactory->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser")) );
- OSL_ENSURE( xXMLParser.is(),
- "XMLReader::Read: com.sun.star.xml.sax.Parser service missing" );
- if( xXMLParser.is() )
- {
- // get filter
- uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLSectionList( xServiceFactory, rStrings );
+ // get filter
+ uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLSectionList( xServiceFactory, rStrings );
- // connect parser and filter
- uno::Reference< xml::sax::XParser > xParser( xXMLParser, UNO_QUERY );
- xParser->setDocumentHandler( xFilter );
+ // connect parser and filter
+ uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(xContext);
+ xParser->setDocumentHandler( xFilter );
- // parse
- xParser->parseStream( aParserInput );
- }
+ // parse
+ xParser->parseStream( aParserInput );
}
catch( xml::sax::SAXParseException& )
{