summaryrefslogtreecommitdiff
path: root/xmlsecurity/source/helper
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-10-10 10:13:18 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-10-22 17:01:11 +0200
commitfb741b5e1e6aeaee74cf14af4f1cc152f0ab0952 (patch)
tree24864ba5addb12799a508ce4718868026519f057 /xmlsecurity/source/helper
parent9cabab002b1180650236f3d1f5fd32dfdd4bf79a (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 'xmlsecurity/source/helper')
-rw-r--r--xmlsecurity/source/helper/xmlsignaturehelper.cxx21
1 files changed, 6 insertions, 15 deletions
diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
index 26318d80e0a1..163e5f600f37 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
@@ -36,6 +36,7 @@
#include <com/sun/star/security/SerialNumberAdapter.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <tools/date.hxx>
#include <tools/time.hxx>
@@ -150,18 +151,14 @@ void XMLSignatureHelper::AddForSigning( sal_Int32 nSecurityId, const rtl::OUStri
}
-uno::Reference<xml::sax::XDocumentHandler> XMLSignatureHelper::CreateDocumentHandlerWithHeader(
+uno::Reference<xml::sax::XWriter> XMLSignatureHelper::CreateDocumentHandlerWithHeader(
const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xOutputStream )
{
/*
* get SAX writer component
*/
uno::Reference< lang::XMultiComponentFactory > xMCF( mxCtx->getServiceManager() );
- uno::Reference< io::XActiveDataSource > xSaxWriter(
- xMCF->createInstanceWithContext(rtl::OUString(
- "com.sun.star.xml.sax.Writer"), mxCtx ), uno::UNO_QUERY );
-
- DBG_ASSERT( xSaxWriter.is(), "can't instantiate XML writer" );
+ uno::Reference< xml::sax::XWriter > xSaxWriter = xml::sax::Writer::create(mxCtx);
/*
* connect XML writer to output stream
@@ -169,12 +166,6 @@ uno::Reference<xml::sax::XDocumentHandler> XMLSignatureHelper::CreateDocumentHan
xSaxWriter->setOutputStream( xOutputStream );
/*
- * prepare document handler
- */
- uno::Reference<xml::sax::XDocumentHandler>
- xDocHandler( xSaxWriter,uno::UNO_QUERY);
-
- /*
* write the xml context for signatures
*/
rtl::OUString tag_AllSignatures(TAG_DOCUMENTSIGNATURES);
@@ -190,12 +181,12 @@ uno::Reference<xml::sax::XDocumentHandler> XMLSignatureHelper::CreateDocumentHan
rtl::OUString(ATTR_XMLNS),
sNamespace);
- xDocHandler->startDocument();
- xDocHandler->startElement(
+ xSaxWriter->startDocument();
+ xSaxWriter->startElement(
tag_AllSignatures,
uno::Reference< com::sun::star::xml::sax::XAttributeList > (pAttributeList));
- return xDocHandler;
+ return xSaxWriter;
}
void XMLSignatureHelper::CloseDocumentHandler( const uno::Reference<xml::sax::XDocumentHandler>& xDocumentHandler )