diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-10 10:13:18 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-22 17:01:11 +0200 |
commit | fb741b5e1e6aeaee74cf14af4f1cc152f0ab0952 (patch) | |
tree | 24864ba5addb12799a508ce4718868026519f057 /package/source/manifest | |
parent | 9cabab002b1180650236f3d1f5fd32dfdd4bf79a (diff) |
fdo#46808, Adapt xml::sax::XWriter UNO service to new style
Create a merged XWriter interface for the service.
The xml.sax.Writer service already existed, it just did not have
an IDL file.
Change-Id: I4e6d3f3c68f9282a55fc7aa19778f97632fd8ad5
Diffstat (limited to 'package/source/manifest')
-rw-r--r-- | package/source/manifest/ManifestWriter.cxx | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/package/source/manifest/ManifestWriter.cxx b/package/source/manifest/ManifestWriter.cxx index e55127824fbe..824789294152 100644 --- a/package/source/manifest/ManifestWriter.cxx +++ b/package/source/manifest/ManifestWriter.cxx @@ -19,9 +19,10 @@ #include <ManifestWriter.hxx> #include <ManifestExport.hxx> +#include <comphelper/processfactory.hxx> #include <cppuhelper/factory.hxx> #include <com/sun/star/io/XActiveDataSource.hpp> -#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <com/sun/star/xml/sax/Writer.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/xml/sax/SAXException.hpp> @@ -51,20 +52,15 @@ ManifestWriter::~ManifestWriter() void SAL_CALL ManifestWriter::writeManifestSequence( const Reference< XOutputStream >& rStream, const Sequence< Sequence< PropertyValue > >& rSequence ) throw (RuntimeException) { - OUString sSaxWriter ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.xml.sax.Writer" ) ); - Reference < XActiveDataSource > xSource ( xFactory->createInstance ( sSaxWriter ), UNO_QUERY ); - if (xSource.is()) - { - xSource->setOutputStream ( rStream ); + Reference < XWriter > xSource = Writer::create( comphelper::getComponentContext(xFactory) ); + xSource->setOutputStream ( rStream ); + try { Reference < XDocumentHandler > xHandler ( xSource, UNO_QUERY ); - if (xHandler.is()) - try { - ManifestExport( xHandler, rSequence); - } - catch( SAXException& ) - { - throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - } + ManifestExport( xHandler, rSequence); + } + catch( SAXException& ) + { + throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } } |