summaryrefslogtreecommitdiff
path: root/package
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 /package
parentbd6b41bce491ac5a5f562652b7e32045cc22c35c (diff)
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 'package')
-rw-r--r--package/source/manifest/ManifestReader.cxx54
-rw-r--r--package/source/xstor/owriteablestream.cxx4
-rw-r--r--package/source/xstor/xstorage.cxx4
-rw-r--r--package/source/zippackage/ZipPackage.cxx2
4 files changed, 31 insertions, 33 deletions
diff --git a/package/source/manifest/ManifestReader.cxx b/package/source/manifest/ManifestReader.cxx
index f57f43bf74b3..9ff714484b81 100644
--- a/package/source/manifest/ManifestReader.cxx
+++ b/package/source/manifest/ManifestReader.cxx
@@ -19,10 +19,11 @@
#include <ManifestReader.hxx>
#include <ManifestImport.hxx>
+#include <comphelper/processfactory.hxx>
#include <cppuhelper/factory.hxx>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <vector>
@@ -49,34 +50,31 @@ Sequence< Sequence< PropertyValue > > SAL_CALL ManifestReader::readManifestSeque
throw (::com::sun::star::uno::RuntimeException)
{
Sequence < Sequence < PropertyValue > > aManifestSequence;
- Reference < XParser > xParser (xFactory->createInstance ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.xml.sax.Parser" ) ) ), UNO_QUERY );
- if (xParser.is())
+ Reference < XParser > xParser = Parser::create(comphelper::getComponentContext(xFactory));
+ try
+ {
+ vector < Sequence < PropertyValue > > aManVector;
+ Reference < XDocumentHandler > xFilter = new ManifestImport( aManVector );
+ InputSource aParserInput;
+ aParserInput.aInputStream = rStream;
+ aParserInput.sSystemId = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "META-INF/manifest.xml" ) );
+ xParser->setDocumentHandler ( xFilter );
+ xParser->parseStream( aParserInput );
+ aManifestSequence.realloc ( aManVector.size() );
+ Sequence < PropertyValue > * pSequence = aManifestSequence.getArray();
+ ::std::vector < Sequence < PropertyValue > >::const_iterator aIter = aManVector.begin();
+ ::std::vector < Sequence < PropertyValue > >::const_iterator aEnd = aManVector.end();
+ while( aIter != aEnd )
+ *pSequence++ = (*aIter++);
+ }
+ catch (SAXParseException& )
+ {
+ }
+ catch (SAXException& )
+ {
+ }
+ catch (IOException& )
{
- try
- {
- vector < Sequence < PropertyValue > > aManVector;
- Reference < XDocumentHandler > xFilter = new ManifestImport( aManVector );
- InputSource aParserInput;
- aParserInput.aInputStream = rStream;
- aParserInput.sSystemId = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "META-INF/manifest.xml" ) );
- xParser->setDocumentHandler ( xFilter );
- xParser->parseStream( aParserInput );
- aManifestSequence.realloc ( aManVector.size() );
- Sequence < PropertyValue > * pSequence = aManifestSequence.getArray();
- ::std::vector < Sequence < PropertyValue > >::const_iterator aIter = aManVector.begin();
- ::std::vector < Sequence < PropertyValue > >::const_iterator aEnd = aManVector.end();
- while( aIter != aEnd )
- *pSequence++ = (*aIter++);
- }
- catch (SAXParseException& )
- {
- }
- catch (SAXException& )
- {
- }
- catch (IOException& )
- {
- }
}
xParser->setDocumentHandler ( Reference < XDocumentHandler > () );
return aManifestSequence;
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index a8d1b925c5f5..05a3f158fee3 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -1082,7 +1082,7 @@ void OWriteStream_Impl::ReadRelInfoIfNecessary()
m_aOrigRelInfo = ::comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(
m_xOrigRelInfoStream,
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels/*.rels" ) ),
- m_xFactory );
+ comphelper::getComponentContext(m_xFactory) );
// in case of success the stream must be thrown away, that means that the OrigRelInfo is initialized
// the reason for this is that the original stream might not be seekable ( at the same time the new
@@ -1108,7 +1108,7 @@ void OWriteStream_Impl::ReadRelInfoIfNecessary()
m_aNewRelInfo = ::comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(
m_xNewRelInfoStream,
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels/*.rels" ) ),
- m_xFactory );
+ comphelper::getComponentContext(m_xFactory) );
m_nRelInfoStatus = RELINFO_CHANGED_STREAM_READ;
}
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index 3908e8acaf3d..33d4aaa79cf6 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -595,7 +595,7 @@ void OStorage_Impl::ReadRelInfoIfNecessary()
m_aRelInfo = ::comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(
xRelInfoStream,
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels/.rels" ) ),
- m_xFactory );
+ comphelper::getComponentContext(m_xFactory) );
m_nRelInfoStatus = RELINFO_READ;
}
@@ -608,7 +608,7 @@ void OStorage_Impl::ReadRelInfoIfNecessary()
m_aRelInfo = ::comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(
m_xNewRelInfoStream,
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels/.rels" ) ),
- m_xFactory );
+ comphelper::getComponentContext(m_xFactory) );
m_nRelInfoStatus = RELINFO_CHANGED_STREAM_READ;
}
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index b3e1730e4462..5ab16b3dfa45 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -464,7 +464,7 @@ void ZipPackage::parseContentType()
sal_Int32 nInd = 0;
// here aContentTypeInfo[0] - Defaults, and aContentTypeInfo[1] - Overrides
uno::Sequence< uno::Sequence< beans::StringPair > > aContentTypeInfo =
- ::comphelper::OFOPXMLHelper::ReadContentTypeSequence( xInStream, m_xFactory );
+ ::comphelper::OFOPXMLHelper::ReadContentTypeSequence( xInStream, comphelper::getComponentContext(m_xFactory) );
if ( aContentTypeInfo.getLength() != 2 )
throw io::IOException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );