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 /xmlscript | |
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 'xmlscript')
-rw-r--r-- | xmlscript/inc/xmlscript/xmllib_imexp.hxx | 6 | ||||
-rw-r--r-- | xmlscript/inc/xmlscript/xmlmod_imexp.hxx | 4 | ||||
-rw-r--r-- | xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx | 28 | ||||
-rw-r--r-- | xmlscript/source/xmllib_imexp/xmllib_export.cxx | 4 | ||||
-rw-r--r-- | xmlscript/source/xmlmod_imexp/xmlmod_export.cxx | 2 |
5 files changed, 12 insertions, 32 deletions
diff --git a/xmlscript/inc/xmlscript/xmllib_imexp.hxx b/xmlscript/inc/xmlscript/xmllib_imexp.hxx index 6470e6cba7d1..08f58c5e6049 100644 --- a/xmlscript/inc/xmlscript/xmllib_imexp.hxx +++ b/xmlscript/inc/xmlscript/xmllib_imexp.hxx @@ -19,7 +19,7 @@ #ifndef _XMLSCRIPT_XMLLIB_IMEXP_HXX_ #define _XMLSCRIPT_XMLLIB_IMEXP_HXX_ -#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> +#include <com/sun/star/xml/sax/XWriter.hpp> #include <com/sun/star/uno/Sequence.hxx> #include "xmlscript/xmlns.h" @@ -59,7 +59,7 @@ struct XMLSCRIPT_DLLPUBLIC LibDescriptorArray XMLSCRIPT_DLLPUBLIC void SAL_CALL exportLibraryContainer( ::com::sun::star::uno::Reference< - ::com::sun::star::xml::sax::XExtendedDocumentHandler > const & xOut, + ::com::sun::star::xml::sax::XWriter > const & xOut, const LibDescriptorArray* pLibArray ) SAL_THROW( (::com::sun::star::uno::Exception) ); @@ -72,7 +72,7 @@ SAL_CALL importLibraryContainer( LibDescriptorArray* pLibArray ) XMLSCRIPT_DLLPUBLIC void SAL_CALL exportLibrary( ::com::sun::star::uno::Reference< - ::com::sun::star::xml::sax::XExtendedDocumentHandler > const & xOut, + ::com::sun::star::xml::sax::XWriter > const & xOut, const LibDescriptor& rLib ) SAL_THROW( (::com::sun::star::uno::Exception) ); diff --git a/xmlscript/inc/xmlscript/xmlmod_imexp.hxx b/xmlscript/inc/xmlscript/xmlmod_imexp.hxx index ed3368acb4f6..2898d8a5fc20 100644 --- a/xmlscript/inc/xmlscript/xmlmod_imexp.hxx +++ b/xmlscript/inc/xmlscript/xmlmod_imexp.hxx @@ -19,7 +19,7 @@ #ifndef _XMLSCRIPT_XMLMOD_IMEXP_HXX_ #define _XMLSCRIPT_XMLMOD_IMEXP_HXX_ -#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> +#include <com/sun/star/xml/sax/XWriter.hpp> #include <com/sun/star/uno/Sequence.hxx> #include <xmlscript/xmlns.h> #include "xmlscript/xmlscriptdllapi.h" @@ -43,7 +43,7 @@ struct XMLSCRIPT_DLLPUBLIC ModuleDescriptor XMLSCRIPT_DLLPUBLIC void SAL_CALL exportScriptModule( ::com::sun::star::uno::Reference< - ::com::sun::star::xml::sax::XExtendedDocumentHandler > const & xOut, + ::com::sun::star::xml::sax::XWriter > const & xOut, const ModuleDescriptor& rMod ) SAL_THROW( (::com::sun::star::uno::Exception) ); diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx index 238c612f021d..9918419274c7 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx @@ -21,6 +21,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 <comphelper/processfactory.hxx> #include <cppuhelper/implbase1.hxx> @@ -65,26 +66,12 @@ Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel( Reference< XModel > const & xDocument ) SAL_THROW( (Exception) ) { - Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() ); - if (! xSMgr.is()) - { - throw RuntimeException("no service manager available!", - Reference< XInterface >() ); - } - - Reference< xml::sax::XExtendedDocumentHandler > xHandler( xSMgr->createInstanceWithContext( - "com.sun.star.xml.sax.Writer", xContext ), UNO_QUERY ); - OSL_ASSERT( xHandler.is() ); - if (! xHandler.is()) - { - throw RuntimeException("could not create sax-writer component!", - Reference< XInterface >() ); - } + Reference< xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext); ByteSequence aBytes; + xWriter->setOutputStream( createOutputStream( &aBytes ) ); - Reference< io::XActiveDataSource > xSource( xHandler, UNO_QUERY ); - xSource->setOutputStream( createOutputStream( &aBytes ) ); + Reference< xml::sax::XExtendedDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW); exportDialogModel( xHandler, xDialogModel, xDocument ); return new InputStreamProvider( aBytes ); @@ -98,13 +85,6 @@ void SAL_CALL importDialogModel( Reference< XModel > const & xDocument ) SAL_THROW( (Exception) ) { - Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() ); - if (! xSMgr.is()) - { - throw RuntimeException("no service manager available!", - Reference< XInterface >() ); - } - Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext ); // error handler, entity resolver omitted for this helper function diff --git a/xmlscript/source/xmllib_imexp/xmllib_export.cxx b/xmlscript/source/xmllib_imexp/xmllib_export.cxx index 9f0cb742cf91..3d1e3dad2d36 100644 --- a/xmlscript/source/xmllib_imexp/xmllib_export.cxx +++ b/xmlscript/source/xmllib_imexp/xmllib_export.cxx @@ -39,7 +39,7 @@ const char aFalseStr[] = "false"; void SAL_CALL exportLibraryContainer( - Reference< xml::sax::XExtendedDocumentHandler > const & xOut, + Reference< xml::sax::XWriter > const & xOut, const LibDescriptorArray* pLibArray ) SAL_THROW( (Exception) ) { @@ -105,7 +105,7 @@ SAL_CALL exportLibraryContainer( void SAL_CALL exportLibrary( - ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > const & xOut, + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XWriter > const & xOut, const LibDescriptor& rLib ) SAL_THROW( (::com::sun::star::uno::Exception) ) { diff --git a/xmlscript/source/xmlmod_imexp/xmlmod_export.cxx b/xmlscript/source/xmlmod_imexp/xmlmod_export.cxx index 6036cc8afa95..4048a1f21ca9 100644 --- a/xmlscript/source/xmlmod_imexp/xmlmod_export.cxx +++ b/xmlscript/source/xmlmod_imexp/xmlmod_export.cxx @@ -32,7 +32,7 @@ namespace xmlscript void SAL_CALL exportScriptModule( - Reference< xml::sax::XExtendedDocumentHandler > const & xOut, + Reference< xml::sax::XWriter > const & xOut, const ModuleDescriptor& rMod ) SAL_THROW( (Exception) ) { |