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 /sfx2 | |
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 'sfx2')
-rw-r--r-- | sfx2/source/doc/SfxDocumentMetaData.cxx | 11 | ||||
-rw-r--r-- | sfx2/source/doc/doctemplates.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/doctemplateslocal.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/doc/doctemplateslocal.hxx | 2 |
4 files changed, 11 insertions, 16 deletions
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 0b97c0b8e19a..b530da3571e9 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -45,6 +45,7 @@ #include "com/sun/star/document/XExporter.hpp" #include "com/sun/star/document/XFilter.hpp" #include "com/sun/star/xml/sax/Parser.hpp" +#include "com/sun/star/xml/sax/Writer.hpp" #include "com/sun/star/xml/dom/XDocument.hpp" #include "com/sun/star/xml/dom/XElement.hpp" #include "com/sun/star/xml/dom/DocumentBuilder.hpp" @@ -2003,13 +2004,9 @@ SfxDocumentMetaData::storeToStorage( if (!xOutStream.is()) throw css::uno::RuntimeException(); css::uno::Reference<css::lang::XMultiComponentFactory> xMsf ( m_xContext->getServiceManager()); - css::uno::Reference<css::io::XActiveDataSource> xSaxWriter( - xMsf->createInstanceWithContext(::rtl::OUString( - "com.sun.star.xml.sax.Writer"), m_xContext), - css::uno::UNO_QUERY_THROW); + css::uno::Reference<css::xml::sax::XWriter> xSaxWriter( + css::xml::sax::Writer::create(m_xContext)); xSaxWriter->setOutputStream(xOutStream); - css::uno::Reference<css::xml::sax::XDocumentHandler> xDocHandler ( - xSaxWriter, css::uno::UNO_QUERY_THROW); const sal_uInt64 version = SotStorage::GetVersion( xStorage ); // Oasis is also the default (0) @@ -2022,7 +2019,7 @@ SfxDocumentMetaData::storeToStorage( css::uno::Reference<css::beans::XPropertySet> xPropArg = getURLProperties(Medium); css::uno::Sequence< css::uno::Any > args(2); - args[0] <<= xDocHandler; + args[0] <<= xSaxWriter; args[1] <<= xPropArg; css::uno::Reference<css::document::XExporter> xExp( diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index e1f1986ea930..f4dbb6cf6749 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -1406,7 +1406,7 @@ sal_Bool SfxDocTplService_Impl::WriteUINamesForTemplateDir_Impl( const ::rtl::OU if ( !xOutStream.is() ) throw uno::RuntimeException(); - DocTemplLocaleHelper::WriteGroupLocalizationSequence( xOutStream, aUINames, mxFactory ); + DocTemplLocaleHelper::WriteGroupLocalizationSequence( xOutStream, aUINames, comphelper::getComponentContext(mxFactory)); try { // the SAX writer might close the stream xOutStream->closeOutput(); diff --git a/sfx2/source/doc/doctemplateslocal.cxx b/sfx2/source/doc/doctemplateslocal.cxx index 82452dc14a39..5f8f174384fc 100644 --- a/sfx2/source/doc/doctemplateslocal.cxx +++ b/sfx2/source/doc/doctemplateslocal.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/xml/sax/Parser.hpp> +#include <com/sun/star/xml/sax/Writer.hpp> #include <com/sun/star/xml/sax/XDocumentHandler.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> @@ -40,19 +41,16 @@ uno::Sequence< beans::StringPair > DocTemplLocaleHelper::ReadGroupLocalizationSe } // ----------------------------------- -void SAL_CALL DocTemplLocaleHelper::WriteGroupLocalizationSequence( const uno::Reference< io::XOutputStream >& xOutStream, const uno::Sequence< beans::StringPair >& aSequence, const uno::Reference< lang::XMultiServiceFactory > xFactory ) +void SAL_CALL DocTemplLocaleHelper::WriteGroupLocalizationSequence( const uno::Reference< io::XOutputStream >& xOutStream, const uno::Sequence< beans::StringPair >& aSequence, const uno::Reference< uno::XComponentContext > xContext ) throw( uno::Exception ) { if ( !xOutStream.is() ) throw uno::RuntimeException(); - uno::Reference< io::XActiveDataSource > xWriterSource( - xFactory->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ), - uno::UNO_QUERY_THROW ); - uno::Reference< xml::sax::XDocumentHandler > xWriterHandler( xWriterSource, uno::UNO_QUERY_THROW ); + uno::Reference< xml::sax::XWriter > xWriterHandler( + xml::sax::Writer::create(xContext) ); - xWriterSource->setOutputStream( xOutStream ); + xWriterHandler->setOutputStream( xOutStream ); ::rtl::OUString aGroupListElement( RTL_CONSTASCII_USTRINGPARAM( "groupuinames:template-group-list" ) ); ::rtl::OUString aGroupElement( RTL_CONSTASCII_USTRINGPARAM( "groupuinames:template-group" ) ); diff --git a/sfx2/source/doc/doctemplateslocal.hxx b/sfx2/source/doc/doctemplateslocal.hxx index ba0f58af2b86..b6f7fc286b0a 100644 --- a/sfx2/source/doc/doctemplateslocal.hxx +++ b/sfx2/source/doc/doctemplateslocal.hxx @@ -60,7 +60,7 @@ public: void SAL_CALL WriteGroupLocalizationSequence( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutStream, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >& aSequence, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory ) + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext ) throw( ::com::sun::star::uno::Exception ); // XDocumentHandler |