summaryrefslogtreecommitdiff
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
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
-rw-r--r--basic/source/uno/dlgcont.cxx16
-rw-r--r--basic/source/uno/namecont.cxx29
-rw-r--r--basic/source/uno/scriptcont.cxx15
m---------binfilter0
-rw-r--r--chart2/source/model/filter/XMLFilter.cxx8
-rw-r--r--chart2/source/model/inc/XMLFilter.hxx3
-rw-r--r--comphelper/inc/comphelper/ofopxmlhelper.hxx4
-rw-r--r--comphelper/source/xml/ofopxmlhelper.cxx59
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx6
-rw-r--r--dbaccess/source/core/recovery/storagexmlstream.cxx5
-rw-r--r--editeng/source/misc/svxacorr.cxx41
-rw-r--r--editeng/source/xml/xmltxtexp.cxx17
-rw-r--r--filter/source/odfflatxml/OdfFlatXml.cxx7
-rw-r--r--filter/source/svg/svgexport.cxx23
-rw-r--r--filter/source/svg/svgfilter.hxx3
-rw-r--r--filter/source/xsltdialog/typedetectionexport.cxx14
-rw-r--r--filter/source/xsltdialog/typedetectionexport.hxx11
-rw-r--r--filter/source/xsltdialog/xmlfilterjar.cxx4
-rw-r--r--filter/source/xsltdialog/xmlfiltertestdialog.cxx6
-rw-r--r--filter/source/xsltfilter/XSLTFilter.cxx9
-rw-r--r--linguistic/source/convdic.cxx18
-rw-r--r--offapi/UnoApi_offapi.mk2
-rw-r--r--offapi/com/sun/star/xml/sax/Writer.idl38
-rw-r--r--offapi/com/sun/star/xml/sax/XWriter.idl45
-rw-r--r--package/source/manifest/ManifestWriter.cxx24
-rw-r--r--package/source/xstor/owriteablestream.cxx2
-rw-r--r--package/source/xstor/xstorage.cxx2
-rw-r--r--package/source/zippackage/ZipPackage.cxx2
-rw-r--r--reportdesign/source/core/api/ReportDefinition.cxx13
-rw-r--r--sax/source/expatwrap/saxwriter.cxx11
-rw-r--r--sc/inc/xmlwrap.hxx4
-rw-r--r--sc/source/filter/xml/xmlwrap.cxx23
-rw-r--r--sd/source/filter/xml/sdxmlwrp.cxx13
-rw-r--r--sfx2/source/doc/SfxDocumentMetaData.cxx11
-rw-r--r--sfx2/source/doc/doctemplates.cxx2
-rw-r--r--sfx2/source/doc/doctemplateslocal.cxx12
-rw-r--r--sfx2/source/doc/doctemplateslocal.hxx2
-rw-r--r--starmath/source/mathmlexport.cxx7
-rw-r--r--svtools/source/filter/filter.cxx6
-rw-r--r--svx/source/xml/xmlexport.cxx9
-rw-r--r--svx/source/xml/xmlxtexp.cxx10
-rw-r--r--sw/source/core/swg/SwXMLTextBlocks1.cxx95
-rw-r--r--sw/source/filter/xml/wrtxml.cxx11
-rw-r--r--unotools/source/config/accelcfg.cxx11
-rw-r--r--xmloff/source/meta/xmlversion.cxx7
-rw-r--r--xmlscript/inc/xmlscript/xmllib_imexp.hxx6
-rw-r--r--xmlscript/inc/xmlscript/xmlmod_imexp.hxx4
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx28
-rw-r--r--xmlscript/source/xmllib_imexp/xmllib_export.cxx4
-rw-r--r--xmlscript/source/xmlmod_imexp/xmlmod_export.cxx2
-rw-r--r--xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx4
-rw-r--r--xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx9
-rw-r--r--xmlsecurity/source/helper/xmlsignaturehelper.cxx21
53 files changed, 336 insertions, 402 deletions
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index b9ad7f19ecce..1d77d41ed59e 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -20,6 +20,7 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
@@ -125,20 +126,9 @@ bool writeOasis2OOoLibraryElement(
Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(xContext);
- Reference< xml::sax::XExtendedDocumentHandler > xWriter(
- xSMgr->createInstanceWithContext(
- OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.xml.sax.Writer" ) ),
- xContext ),
- UNO_QUERY );
-
- Reference< io::XActiveDataSource > xSource( xWriter, UNO_QUERY );
- xSource->setOutputStream( xOutput );
+ Reference< xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext);
- if ( !xWriter.is() )
- {
- return sal_False;
- }
+ xWriter->setOutputStream( xOutput );
Sequence<Any> aArgs( 1 );
aArgs[0] <<= xWriter;
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index dfce89aa5101..fe76bf7f462f 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -44,6 +44,7 @@
#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -1495,14 +1496,7 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
const ::rtl::OUString& aTargetURL, Reference< XSimpleFileAccess2 > xToUseSFI )
{
// Create sax writer
- Reference< XExtendedDocumentHandler > xHandler(
- mxMSF->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer") ) ), UNO_QUERY );
- if( !xHandler.is() )
- {
- SAL_WARN("basic", "couldn't create sax-writer component");
- return;
- }
+ Reference< XWriter > xWriter = xml::sax::Writer::create(comphelper::getComponentContext(mxMSF));
sal_Bool bLink = pLib->mbLink;
bool bStorage = xStorage.is() && !bLink;
@@ -1587,10 +1581,9 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
return;
}
- Reference< XActiveDataSource > xSource( xHandler, UNO_QUERY );
- xSource->setOutputStream( xOut );
+ xWriter->setOutputStream( xOut );
- xmlscript::exportLibrary( xHandler, rLib );
+ xmlscript::exportLibrary( xWriter, rLib );
}
@@ -1962,14 +1955,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
// Write library container info
// Create sax writer
- Reference< XExtendedDocumentHandler > xHandler(
- mxMSF->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer") ) ), UNO_QUERY );
- if( !xHandler.is() )
- {
- SAL_WARN("basic", "couldn't create sax-writer component");
- return;
- }
+ Reference< XWriter > xWriter = xml::sax::Writer::create(comphelper::getComponentContext(mxMSF));
// Write info file
uno::Reference< io::XOutputStream > xOut;
@@ -2031,12 +2017,11 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
return;
}
- Reference< XActiveDataSource > xSource( xHandler, UNO_QUERY );
- xSource->setOutputStream( xOut );
+ xWriter->setOutputStream( xOut );
try
{
- xmlscript::exportLibraryContainer( xHandler, pLibArray.get() );
+ xmlscript::exportLibraryContainer( xWriter, pLibArray.get() );
if ( bStorage )
{
uno::Reference< embed::XTransactedObject > xTransact( xTargetLibrariesStor, uno::UNO_QUERY );
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index bbc8509d23c2..606db40bb4d6 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
@@ -181,22 +182,14 @@ void SAL_CALL SfxScriptLibraryContainer::writeLibraryElement
throw(Exception)
{
// Create sax writer
- Reference< XExtendedDocumentHandler > xHandler(
- mxMSF->createInstance(
- OUString( "com.sun.star.xml.sax.Writer" ) ), UNO_QUERY );
- if( !xHandler.is() )
- {
- OSL_FAIL( "### couldn't create sax-writer component\n" );
- return;
- }
+ Reference< XWriter > xWriter = xml::sax::Writer::create(comphelper::getComponentContext(mxMSF));
Reference< XTruncate > xTruncate( xOutput, UNO_QUERY );
OSL_ENSURE( xTruncate.is(), "Currently only the streams that can be truncated are expected!" );
if ( xTruncate.is() )
xTruncate->truncate();
- Reference< XActiveDataSource > xSource( xHandler, UNO_QUERY );
- xSource->setOutputStream( xOutput );
+ xWriter->setOutputStream( xOutput );
xmlscript::ModuleDescriptor aMod;
aMod.aName = aElementName;
@@ -228,7 +221,7 @@ void SAL_CALL SfxScriptLibraryContainer::writeLibraryElement
}
}
- xmlscript::exportScriptModule( xHandler, aMod );
+ xmlscript::exportScriptModule( xWriter, aMod );
}
diff --git a/binfilter b/binfilter
-Subproject e9e2d065b33d441ffa8838cc15f70a99155893d
+Subproject ab3e0975e1bf8d662e7d154de9313a491dc02b3
diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx
index 5f72dde8dcf5..10a565a7338e 100644
--- a/chart2/source/model/filter/XMLFilter.cxx
+++ b/chart2/source/model/filter/XMLFilter.cxx
@@ -38,6 +38,7 @@
#include <sot/storage.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
@@ -590,10 +591,7 @@ sal_Int32 XMLFilter::impl_Export(
if( ! xServiceFactory.is())
return ERRCODE_SFX_GENERAL;
- uno::Reference< io::XActiveDataSource > xSaxWriter( xServiceFactory->createInstance(
- C2U("com.sun.star.xml.sax.Writer")), uno::UNO_QUERY );
- if ( !xSaxWriter.is() )
- return ERRCODE_SFX_GENERAL;
+ uno::Reference< xml::sax::XWriter > xSaxWriter = xml::sax::Writer::create(m_xContext);
bool bOasis = true;
isOasisFormat( rMediaDescriptor, bOasis );
@@ -716,7 +714,7 @@ sal_Int32 XMLFilter::impl_ExportStream(
const OUString & rStreamName,
const OUString & rServiceName,
const Reference< embed::XStorage > & xStorage,
- const uno::Reference< io::XActiveDataSource >& xActiveDataSource,
+ const uno::Reference< xml::sax::XWriter >& xActiveDataSource,
const Reference< lang::XMultiServiceFactory >& xServiceFactory,
const Sequence< uno::Any > & rFilterProperties )
{
diff --git a/chart2/source/model/inc/XMLFilter.hxx b/chart2/source/model/inc/XMLFilter.hxx
index 984e894cf337..98500446a2c2 100644
--- a/chart2/source/model/inc/XMLFilter.hxx
+++ b/chart2/source/model/inc/XMLFilter.hxx
@@ -27,6 +27,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/xml/sax/XWriter.hpp>
#include <osl/mutex.hxx>
// for APPHELPER_... macros
@@ -138,7 +139,7 @@ private:
const ::com::sun::star::uno::Reference<
::com::sun::star::embed::XStorage > & xStorage,
const ::com::sun::star::uno::Reference<
- ::com::sun::star::io::XActiveDataSource >& xActiveDataSource,
+ ::com::sun::star::xml::sax::XWriter >& xActiveDataSource,
const ::com::sun::star::uno::Reference<
::com::sun::star::lang::XMultiServiceFactory > & xFactory,
const ::com::sun::star::uno::Sequence<
diff --git a/comphelper/inc/comphelper/ofopxmlhelper.hxx b/comphelper/inc/comphelper/ofopxmlhelper.hxx
index e18d08f727ef..c263022166cd 100644
--- a/comphelper/inc/comphelper/ofopxmlhelper.hxx
+++ b/comphelper/inc/comphelper/ofopxmlhelper.hxx
@@ -96,7 +96,7 @@ public:
void SAL_CALL WriteRelationsInfoSequence(
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutStream,
const ::com::sun::star::uno::Sequence< ::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 );
// writes two entries of type sequence<StringPair>
@@ -109,7 +109,7 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutStream,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >& aDefaultsSequence,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >& aOverridesSequence,
- 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
diff --git a/comphelper/source/xml/ofopxmlhelper.cxx b/comphelper/source/xml/ofopxmlhelper.cxx
index 739b27d1512d..41f5a5ca620c 100644
--- a/comphelper/source/xml/ofopxmlhelper.cxx
+++ b/comphelper/source/xml/ofopxmlhelper.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <comphelper/ofopxmlhelper.hxx>
@@ -54,19 +55,15 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OFOPXMLHelper::Read
}
// -----------------------------------
-void SAL_CALL OFOPXMLHelper::WriteRelationsInfoSequence( const uno::Reference< io::XOutputStream >& xOutStream, const uno::Sequence< uno::Sequence< beans::StringPair > >& aSequence, const uno::Reference< lang::XMultiServiceFactory > xFactory )
+void SAL_CALL OFOPXMLHelper::WriteRelationsInfoSequence( const uno::Reference< io::XOutputStream >& xOutStream, const uno::Sequence< 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 > xWriter = xml::sax::Writer::create(xContext);
- xWriterSource->setOutputStream( xOutStream );
+ xWriter->setOutputStream( xOutStream );
::rtl::OUString aRelListElement( RTL_CONSTASCII_USTRINGPARAM( "Relationships" ) );
::rtl::OUString aRelElement( RTL_CONSTASCII_USTRINGPARAM( "Relationship" ) );
@@ -85,8 +82,8 @@ void SAL_CALL OFOPXMLHelper::WriteRelationsInfoSequence( const uno::Reference< i
aCDATAString,
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "http://schemas.openxmlformats.org/package/2006/relationships" ) ) );
- xWriterHandler->startDocument();
- xWriterHandler->startElement( aRelListElement, xRootAttrList );
+ xWriter->startDocument();
+ xWriter->startElement( aRelListElement, xRootAttrList );
for ( sal_Int32 nInd = 0; nInd < aSequence.getLength(); nInd++ )
{
@@ -108,30 +105,26 @@ void SAL_CALL OFOPXMLHelper::WriteRelationsInfoSequence( const uno::Reference< i
}
}
- xWriterHandler->startElement( aRelElement, xAttrList );
- xWriterHandler->ignorableWhitespace( aWhiteSpace );
- xWriterHandler->endElement( aRelElement );
+ xWriter->startElement( aRelElement, xAttrList );
+ xWriter->ignorableWhitespace( aWhiteSpace );
+ xWriter->endElement( aRelElement );
}
- xWriterHandler->ignorableWhitespace( aWhiteSpace );
- xWriterHandler->endElement( aRelListElement );
- xWriterHandler->endDocument();
+ xWriter->ignorableWhitespace( aWhiteSpace );
+ xWriter->endElement( aRelListElement );
+ xWriter->endDocument();
}
// -----------------------------------
-void SAL_CALL OFOPXMLHelper::WriteContentSequence( const uno::Reference< io::XOutputStream >& xOutStream, const uno::Sequence< beans::StringPair >& aDefaultsSequence, const uno::Sequence< beans::StringPair >& aOverridesSequence, const uno::Reference< lang::XMultiServiceFactory > xFactory )
+void SAL_CALL OFOPXMLHelper::WriteContentSequence( const uno::Reference< io::XOutputStream >& xOutStream, const uno::Sequence< beans::StringPair >& aDefaultsSequence, const uno::Sequence< beans::StringPair >& aOverridesSequence, 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 > xWriter = xml::sax::Writer::create(xContext);
- xWriterSource->setOutputStream( xOutStream );
+ xWriter->setOutputStream( xOutStream );
::rtl::OUString aTypesElement( RTL_CONSTASCII_USTRINGPARAM( "Types" ) );
::rtl::OUString aDefaultElement( RTL_CONSTASCII_USTRINGPARAM( "Default" ) );
@@ -150,8 +143,8 @@ void SAL_CALL OFOPXMLHelper::WriteContentSequence( const uno::Reference< io::XOu
aCDATAString,
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "http://schemas.openxmlformats.org/package/2006/content-types" ) ) );
- xWriterHandler->startDocument();
- xWriterHandler->startElement( aTypesElement, xRootAttrList );
+ xWriter->startDocument();
+ xWriter->startElement( aTypesElement, xRootAttrList );
for ( sal_Int32 nInd = 0; nInd < aDefaultsSequence.getLength(); nInd++ )
{
@@ -160,9 +153,9 @@ void SAL_CALL OFOPXMLHelper::WriteContentSequence( const uno::Reference< io::XOu
pAttrList->AddAttribute( aExtensionAttr, aCDATAString, aDefaultsSequence[nInd].First );
pAttrList->AddAttribute( aContentTypeAttr, aCDATAString, aDefaultsSequence[nInd].Second );
- xWriterHandler->startElement( aDefaultElement, xAttrList );
- xWriterHandler->ignorableWhitespace( aWhiteSpace );
- xWriterHandler->endElement( aDefaultElement );
+ xWriter->startElement( aDefaultElement, xAttrList );
+ xWriter->ignorableWhitespace( aWhiteSpace );
+ xWriter->endElement( aDefaultElement );
}
for ( sal_Int32 nInd = 0; nInd < aOverridesSequence.getLength(); nInd++ )
@@ -172,14 +165,14 @@ void SAL_CALL OFOPXMLHelper::WriteContentSequence( const uno::Reference< io::XOu
pAttrList->AddAttribute( aPartNameAttr, aCDATAString, aOverridesSequence[nInd].First );
pAttrList->AddAttribute( aContentTypeAttr, aCDATAString, aOverridesSequence[nInd].Second );
- xWriterHandler->startElement( aOverrideElement, xAttrList );
- xWriterHandler->ignorableWhitespace( aWhiteSpace );
- xWriterHandler->endElement( aOverrideElement );
+ xWriter->startElement( aOverrideElement, xAttrList );
+ xWriter->ignorableWhitespace( aWhiteSpace );
+ xWriter->endElement( aOverrideElement );
}
- xWriterHandler->ignorableWhitespace( aWhiteSpace );
- xWriterHandler->endElement( aTypesElement );
- xWriterHandler->endDocument();
+ xWriter->ignorableWhitespace( aWhiteSpace );
+ xWriter->endElement( aTypesElement );
+ xWriter->endDocument();
}
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 83435d826e2c..29a0a2fa5850 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -52,6 +52,7 @@
#include <com/sun/star/ui/XUIConfigurationStorage.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/ucb/XContent.hpp>
#include <com/sun/star/sdb/DatabaseContext.hpp>
#include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
@@ -1585,10 +1586,7 @@ void ODatabaseDocument::WriteThroughComponent( const Reference< XOutputStream >&
OSL_ENSURE( NULL != pServiceName, "Need component name!" );
// get component
- Reference< XActiveDataSource > xSaxWriter;
- OSL_VERIFY( m_pImpl->m_aContext.createComponent( "com.sun.star.xml.sax.Writer", xSaxWriter ) );
- if ( !xSaxWriter.is() )
- return;
+ Reference< XWriter > xSaxWriter = xml::sax::Writer::create( m_pImpl->m_aContext.getUNOContext() );
// connect XML writer to output stream
xSaxWriter->setOutputStream( xOutputStream );
diff --git a/dbaccess/source/core/recovery/storagexmlstream.cxx b/dbaccess/source/core/recovery/storagexmlstream.cxx
index 14b76e7eedb1..28f3a17ff1b5 100644
--- a/dbaccess/source/core/recovery/storagexmlstream.cxx
+++ b/dbaccess/source/core/recovery/storagexmlstream.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/xml/sax/XDocumentHandler.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/componentcontext.hxx>
#include <cppuhelper/implbase1.hxx>
@@ -52,6 +53,8 @@ namespace dbaccess
using ::com::sun::star::embed::XStorage;
using ::com::sun::star::xml::sax::XDocumentHandler;
using ::com::sun::star::xml::sax::XAttributeList;
+ using ::com::sun::star::xml::sax::XWriter;
+ using ::com::sun::star::xml::sax::Writer;
using ::com::sun::star::io::XStream;
using ::com::sun::star::io::XOutputStream;
using ::com::sun::star::io::XActiveDataSource;
@@ -80,7 +83,7 @@ namespace dbaccess
:StorageOutputStream( i_rContext, i_rParentStorage, i_rStreamName )
,m_pData( new StorageXMLOutputStream_Data )
{
- const Reference< XActiveDataSource > xSaxWriter( i_rContext.createComponent( "com.sun.star.xml.sax.Writer" ), UNO_QUERY_THROW );
+ const Reference< XWriter > xSaxWriter = Writer::create( i_rContext.getUNOContext() );
xSaxWriter->setOutputStream( getOutputStream() );
m_pData->xHandler.set( xSaxWriter, UNO_QUERY_THROW );
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index a970e8aba8f9..45f63a944eda 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -60,6 +60,7 @@
#include <helpid.hrc>
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <unotools/streamwrap.hxx>
#include <SvXMLAutoCorrectImport.hxx>
#include <SvXMLAutoCorrectExport.hxx>
@@ -2069,23 +2070,15 @@ void SvxAutoCorrectLanguageLists::SaveExceptList_Imp(
uno::Reference< lang::XMultiServiceFactory > xServiceFactory =
comphelper::getProcessServiceFactory();
- OSL_ENSURE( xServiceFactory.is(),
- "XMLReader::Read: got no service manager" );
- if( !xServiceFactory.is() )
- {
- // Throw an exception ?
- }
+ uno::Reference< uno::XComponentContext > xContext =
+ comphelper::getProcessComponentContext();
- uno::Reference < XInterface > xWriter (xServiceFactory->createInstance(
- OUString("com.sun.star.xml.sax.Writer")));
- OSL_ENSURE(xWriter.is(),"com.sun.star.xml.sax.Writer service missing");
+ uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext);
uno::Reference < io::XOutputStream> xOut = new utl::OOutputStreamWrapper( *xStrm );
- uno::Reference<io::XActiveDataSource> xSrc(xWriter, uno::UNO_QUERY);
- xSrc->setOutputStream(xOut);
+ xWriter->setOutputStream(xOut);
- uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter, uno::UNO_QUERY);
-
- SvXMLExceptionListExport aExp( xServiceFactory, rLst, sStrmName, xHandler );
+ uno::Reference < xml::sax::XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW);
+ SvXMLExceptionListExport aExp( xServiceFactory, rLst, sStrmName, xHandler );
aExp.exportDoc( XML_BLOCK_LIST );
@@ -2440,23 +2433,15 @@ sal_Bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SvStorage& rStg )
uno::Reference< lang::XMultiServiceFactory > xServiceFactory =
comphelper::getProcessServiceFactory();
- OSL_ENSURE( xServiceFactory.is(),
- "XMLReader::Read: got no service manager" );
- if( !xServiceFactory.is() )
- {
- // Throw an exception ?
- }
+ uno::Reference< uno::XComponentContext > xContext =
+ comphelper::getProcessComponentContext();
- uno::Reference < XInterface > xWriter (xServiceFactory->createInstance(
- OUString("com.sun.star.xml.sax.Writer")));
- OSL_ENSURE(xWriter.is(),"com.sun.star.xml.sax.Writer service missing");
+ uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext);
uno::Reference < io::XOutputStream> xOut = new utl::OOutputStreamWrapper( *refList );
- uno::Reference<io::XActiveDataSource> xSrc(xWriter, uno::UNO_QUERY);
- xSrc->setOutputStream(xOut);
-
- uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter, uno::UNO_QUERY);
+ xWriter->setOutputStream(xOut);
- SvXMLAutoCorrectExport aExp( xServiceFactory, pAutocorr_List, sStrmName, xHandler );
+ uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter, uno::UNO_QUERY);
+ SvXMLAutoCorrectExport aExp( xServiceFactory, pAutocorr_List, sStrmName, xHandler );
aExp.exportDoc( XML_BLOCK_LIST );
diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx
index 382965de3b43..9148b23c1358 100644
--- a/editeng/source/xml/xmltxtexp.cxx
+++ b/editeng/source/xml/xmltxtexp.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <svl/itemprop.hxx>
#include <svl/brdcst.hxx>
#include <com/sun/star/uno/Sequence.hxx>
@@ -420,6 +421,7 @@ void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection&
// create service factory
uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() );
+ uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
if( !xServiceFactory.is() )
{
@@ -428,16 +430,7 @@ void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection&
}
// create document handler
-
- uno::Reference< uno::XInterface > xWriter( xServiceFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ) );
-
- if( !xWriter.is() )
- {
- OSL_FAIL( "com.sun.star.xml.sax.Writer service missing" );
- break;
- }
-
- uno::Reference<xml::sax::XDocumentHandler> xHandler( xWriter, uno::UNO_QUERY );
+ uno::Reference< xml::sax::XWriter > xWriter = xml::sax::Writer::create( xContext );
// create output stream and active data source
uno::Reference<io::XOutputStream> xOut( new utl::OOutputStreamWrapper( rStream ) );
@@ -450,13 +443,13 @@ void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection&
*/
- uno::Reference<io::XActiveDataSource> xMetaSrc( xWriter, uno::UNO_QUERY );
- xMetaSrc->setOutputStream( xOut );
+ xWriter->setOutputStream( xOut );
// export text
const OUString aName;
// SvxXMLTextExportComponent aExporter( &rEditEngine, rSel, aName, xHandler );
+ uno::Reference< xml::sax::XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW);
SvxXMLTextExportComponent aExporter( xServiceFactory, &rEditEngine, rSel, aName, xHandler );
aExporter.exportDoc();
diff --git a/filter/source/odfflatxml/OdfFlatXml.cxx b/filter/source/odfflatxml/OdfFlatXml.cxx
index cad9039a9a53..5db1e551554c 100644
--- a/filter/source/odfflatxml/OdfFlatXml.cxx
+++ b/filter/source/odfflatxml/OdfFlatXml.cxx
@@ -50,6 +50,7 @@
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
@@ -185,12 +186,8 @@ OdfFlatXml::exporter(const Sequence< PropertyValue >& sourceData,
if (!getDelegate().is())
{
- OUString SAX_WRITER_SERVICE(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer"));
- Reference< XDocumentHandler > saxWriter(m_rServiceFactory->createInstance(SAX_WRITER_SERVICE),
- UNO_QUERY);
+ Reference< XDocumentHandler > saxWriter( Writer::create(comphelper::getComponentContext(m_rServiceFactory)), UNO_QUERY_THROW );
setDelegate(saxWriter);
- if (!getDelegate().is())
- return sal_False;
}
// get data source interface ...
Reference<XActiveDataSource> dataSource(getDelegate(), UNO_QUERY);
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index 686cb5138f65..2013fff563bd 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -35,6 +35,7 @@
#include <com/sun/star/util/MeasureUnit.hpp>
#include <com/sun/star/text/textfield/Type.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <rtl/bootstrap.hxx>
#include <svtools/miscopt.hxx>
@@ -639,7 +640,7 @@ sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
{
if( mSelectedPages.hasElements() && mMasterPageTargets.hasElements() )
{
- Reference< XDocumentHandler > xDocHandler( implCreateExportDocumentHandler( xOStm ) );
+ Reference< XDocumentHandler > xDocHandler( implCreateExportDocumentHandler( xOStm ), UNO_QUERY );
if( xDocHandler.is() )
{
@@ -714,24 +715,14 @@ sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
// -----------------------------------------------------------------------------
-Reference< XDocumentHandler > SVGFilter::implCreateExportDocumentHandler( const Reference< XOutputStream >& rxOStm )
+Reference< XWriter > SVGFilter::implCreateExportDocumentHandler( const Reference< XOutputStream >& rxOStm )
{
- Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
- Reference< XDocumentHandler > xSaxWriter;
+ Reference< XWriter > xSaxWriter;
- if( xMgr.is() && rxOStm.is() )
+ if( rxOStm.is() )
{
- xSaxWriter = Reference< XDocumentHandler >( xMgr->createInstance( B2UCONST( "com.sun.star.xml.sax.Writer" ) ), UNO_QUERY );
-
- if( xSaxWriter.is() )
- {
- Reference< XActiveDataSource > xActiveDataSource( xSaxWriter, UNO_QUERY );
-
- if( xActiveDataSource.is() )
- xActiveDataSource->setOutputStream( rxOStm );
- else
- xSaxWriter = NULL;
- }
+ xSaxWriter = Writer::create( ::comphelper::getProcessComponentContext() );
+ xSaxWriter->setOutputStream( rxOStm );
}
return xSaxWriter;
diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx
index c5567dfe7de1..9624614c26f3 100644
--- a/filter/source/svg/svgfilter.hxx
+++ b/filter/source/svg/svgfilter.hxx
@@ -50,6 +50,7 @@
#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/xml/sax/XWriter.hpp>
#include <boost/unordered_set.hpp>
#include <boost/unordered_map.hpp>
@@ -308,7 +309,7 @@ private:
sal_Bool implImport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException);
sal_Bool implExport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException);
- Reference< XDocumentHandler > implCreateExportDocumentHandler( const Reference< XOutputStream >& rxOStm );
+ Reference< XWriter > implCreateExportDocumentHandler( const Reference< XOutputStream >& rxOStm );
sal_Bool implGetPagePropSet( const Reference< XDrawPage > & rxPage );
sal_Bool implGenerateMetaData();
diff --git a/filter/source/xsltdialog/typedetectionexport.cxx b/filter/source/xsltdialog/typedetectionexport.cxx
index 4f4bb1d32acf..ae0da2375628 100644
--- a/filter/source/xsltdialog/typedetectionexport.cxx
+++ b/filter/source/xsltdialog/typedetectionexport.cxx
@@ -19,6 +19,7 @@
#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <tools/urlobj.hxx>
@@ -36,8 +37,8 @@ using namespace com::sun::star::xml::sax;
using ::rtl::OUString;
-TypeDetectionExporter::TypeDetectionExporter( Reference< XMultiServiceFactory >& xMSF )
-: mxMSF( xMSF )
+TypeDetectionExporter::TypeDetectionExporter( Reference< XComponentContext >& xContext )
+: mxContext( xContext )
{
}
@@ -95,9 +96,8 @@ void TypeDetectionExporter::doExport( Reference< XOutputStream > xOS, const XML
// set up sax writer and connect to given output stream
- Reference< XDocumentHandler > xHandler( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ), UNO_QUERY );
- Reference< XActiveDataSource > xDocSrc( xHandler, UNO_QUERY );
- xDocSrc->setOutputStream( xOS );
+ Reference< XWriter > xHandler = Writer::create( mxContext );
+ xHandler->setOutputStream( xOS );
::comphelper::AttributeList * pAttrList = new ::comphelper::AttributeList;
pAttrList->AddAttribute ( OUString( RTL_CONSTASCII_USTRINGPARAM( "xmlns:oor" )), sCdataAttribute, OUString( RTL_CONSTASCII_USTRINGPARAM( "http://openoffice.org/2001/registry" )) );
@@ -223,7 +223,7 @@ void TypeDetectionExporter::doExport( Reference< XOutputStream > xOS, const XML
}
}
-void TypeDetectionExporter::addProperty( Reference< XDocumentHandler > xHandler, const OUString& rName, const OUString& rValue )
+void TypeDetectionExporter::addProperty( Reference< XWriter > xHandler, const OUString& rName, const OUString& rValue )
{
try
{
@@ -253,7 +253,7 @@ void TypeDetectionExporter::addProperty( Reference< XDocumentHandler > xHandler,
}
}
-void TypeDetectionExporter::addLocaleProperty( Reference< XDocumentHandler > xHandler, const OUString& rName, const OUString& rValue )
+void TypeDetectionExporter::addLocaleProperty( Reference< XWriter > xHandler, const OUString& rName, const OUString& rValue )
{
try
{
diff --git a/filter/source/xsltdialog/typedetectionexport.hxx b/filter/source/xsltdialog/typedetectionexport.hxx
index ebd14cc58317..05d702aee494 100644
--- a/filter/source/xsltdialog/typedetectionexport.hxx
+++ b/filter/source/xsltdialog/typedetectionexport.hxx
@@ -20,8 +20,7 @@
#ifndef _TYPEDETECTION_EXPORT_HXX
#define _TYPEDETECTION_EXPORT_HXX
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/xml/sax/XWriter.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include "xmlfilterjar.hxx"
@@ -29,15 +28,15 @@
class TypeDetectionExporter
{
public:
- TypeDetectionExporter( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMSF );
+ TypeDetectionExporter( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& mxContext );
void doExport(com::sun::star::uno::Reference < com::sun::star::io::XOutputStream > xOS, const XMLFilterVector& rFilters );
private:
- void addProperty( com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > xWriter, const rtl::OUString& rName, const rtl::OUString& rValue );
- void addLocaleProperty( com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > xWriter, const rtl::OUString& rName, const rtl::OUString& rValue );
+ void addProperty( com::sun::star::uno::Reference< com::sun::star::xml::sax::XWriter > xWriter, const rtl::OUString& rName, const rtl::OUString& rValue );
+ void addLocaleProperty( com::sun::star::uno::Reference< com::sun::star::xml::sax::XWriter > xWriter, const rtl::OUString& rName, const rtl::OUString& rValue );
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext;
};
#endif
diff --git a/filter/source/xsltdialog/xmlfilterjar.cxx b/filter/source/xsltdialog/xmlfilterjar.cxx
index fac5f89ad8b1..3867924e080f 100644
--- a/filter/source/xsltdialog/xmlfilterjar.cxx
+++ b/filter/source/xsltdialog/xmlfilterjar.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/util/XChangesBatch.hpp>
+#include <comphelper/processfactory.hxx>
#include <comphelper/oslfile2streamwrap.hxx>
#include <comphelper/storagehelper.hxx>
#include <unotools/streamwrap.hxx>
@@ -225,7 +226,8 @@ bool XMLFilterJarHelper::savePackage( const OUString& rPackageURL, const XMLFilt
/* osl::File::RC rc = */ aOutputFile.open( osl_File_OpenFlag_Write );
Reference< XOutputStream > xOS( new OSLOutputStreamWrapper( aOutputFile ) );
- TypeDetectionExporter aExporter( mxMSF );
+ Reference<XComponentContext> xContext( comphelper::getComponentContext(mxMSF) );
+ TypeDetectionExporter aExporter( xContext );
aExporter.doExport(xOS,rFilters);
}
diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
index 6f265a5f8071..97c61f5915ee 100644
--- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
@@ -36,7 +36,7 @@
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/xml/XImportFilter.hpp>
#include <com/sun/star/xml/XExportFilter.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <comphelper/oslfile2streamwrap.hxx>
#include <vcl/svapp.hxx>
@@ -666,7 +666,7 @@ void XMLFilterTestDialog::import( const OUString& rURL )
aSourceData[i ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DocType_System" ));
aSourceData[i++].Value <<= sDTDPath;
- Reference< XDocumentHandler > xWriter( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" )) ), UNO_QUERY );
+ Reference< XWriter > xWriter = Writer::create( comphelper::getComponentContext(mxMSF) );
File aOutputFile( aTempFileURL );
aOutputFile.open( osl_File_OpenFlag_Write );
@@ -676,7 +676,7 @@ void XMLFilterTestDialog::import( const OUString& rURL )
xDocSrc->setOutputStream( xOS );
Sequence< OUString > aFilterUserData( mpFilterInfo->getFilterUserData() );
- xImporter->importer( aSourceData, xWriter, aFilterUserData );
+ xImporter->importer( aSourceData, Reference<XDocumentHandler>(xWriter, UNO_QUERY_THROW), aFilterUserData );
}
displayXMLFile( aTempFileURL );
diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx
index 4bb92b011d55..7f90eedb695a 100644
--- a/filter/source/xsltfilter/XSLTFilter.cxx
+++ b/filter/source/xsltfilter/XSLTFilter.cxx
@@ -47,6 +47,7 @@
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/xml/XImportFilter.hpp>
#include <com/sun/star/xml/XExportFilter.hpp>
@@ -431,11 +432,9 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False)
if (!getDelegate().is())
{
// get the document writer
- setDelegate(css::uno::Reference<XExtendedDocumentHandler> (
- m_rServiceFactory->createInstance(
- OUString(
- "com.sun.star.xml.sax.Writer" )),
- UNO_QUERY));
+ setDelegate(css::uno::Reference<XExtendedDocumentHandler>(
+ Writer::create(comphelper::getComponentContext(m_rServiceFactory)),
+ UNO_QUERY_THROW));
}
// create transformer
diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx
index 9a14901cc697..ed7a9c5a98b6 100644
--- a/linguistic/source/convdic.cxx
+++ b/linguistic/source/convdic.cxx
@@ -48,7 +48,7 @@
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
@@ -261,21 +261,9 @@ void ConvDic::Save()
SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xStream ) );
// get XML writer
- uno::Reference< io::XActiveDataSource > xSaxWriter;
- if (xServiceFactory.is())
- {
- try
- {
- xSaxWriter = uno::Reference< io::XActiveDataSource >(
- xServiceFactory->createInstance( "com.sun.star.xml.sax.Writer" ), UNO_QUERY );
- }
- catch (uno::Exception &)
- {
- }
- }
- DBG_ASSERT( xSaxWriter.is(), "can't instantiate XML writer" );
+ uno::Reference< xml::sax::XWriter > xSaxWriter = xml::sax::Writer::create(xContext);
- if (xSaxWriter.is() && xStream.is())
+ if (xStream.is())
{
// connect XML writer to output stream
xSaxWriter->setOutputStream( xStream->getOutputStream() );
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index a505169ab1c2..b5d3fb28bd4a 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -318,6 +318,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xml/sax,\
FastShapeContextHandler \
FastTokenHandler \
Parser \
+ Writer \
))
@@ -4251,6 +4252,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/xml/sax,\
XLocator \
XParser \
XSAXSerializable \
+ XWriter \
))
$(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/xml/wrapper,\
XXMLDocumentWrapper \
diff --git a/offapi/com/sun/star/xml/sax/Writer.idl b/offapi/com/sun/star/xml/sax/Writer.idl
new file mode 100644
index 000000000000..5e7072967f65
--- /dev/null
+++ b/offapi/com/sun/star/xml/sax/Writer.idl
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_xml_sax_Writer_idl__
+#define __com_sun_star_xml_sax_Writer_idl__
+
+#include <com/sun/star/xml/sax/XWriter.idl>
+
+
+
+module com { module sun { module star { module xml { module sax {
+
+
+/**
+ */
+service Writer : XWriter;
+
+
+}; }; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/xml/sax/XWriter.idl b/offapi/com/sun/star/xml/sax/XWriter.idl
new file mode 100644
index 000000000000..72fabccf0295
--- /dev/null
+++ b/offapi/com/sun/star/xml/sax/XWriter.idl
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_xml_sax_XWriter_idl__
+#define __com_sun_star_xml_sax_XWriter_idl__
+
+#include <com/sun/star/io/XActiveDataSource.idl>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.idl>
+
+
+module com { module sun { module star { module xml { module sax {
+
+
+/**
+ Provides a unified interface for the new-style Writer service to implement.
+
+ @since LibreOffice 3.7
+ */
+interface XWriter
+{
+ interface com::sun::star::io::XActiveDataSource;
+ interface com::sun::star::xml::sax::XExtendedDocumentHandler;
+};
+
+
+}; }; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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 >() );
}
}
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index 05a3f158fee3..0ed7c8e7374d 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -1692,7 +1692,7 @@ void OWriteStream_Impl::CommitStreamRelInfo( const uno::Reference< embed::XStora
if ( !xOutStream.is() )
throw uno::RuntimeException();
- ::comphelper::OFOPXMLHelper::WriteRelationsInfoSequence( xOutStream, m_aNewRelInfo, m_xFactory );
+ ::comphelper::OFOPXMLHelper::WriteRelationsInfoSequence( xOutStream, m_aNewRelInfo, comphelper::getComponentContext(m_xFactory) );
// set the mediatype
uno::Reference< beans::XPropertySet > xPropSet( xRelsStream, uno::UNO_QUERY_THROW );
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index a8acbdcf562a..478df445d8a9 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -1845,7 +1845,7 @@ void OStorage_Impl::CommitRelInfo( const uno::Reference< container::XNameContain
if ( !xOutStream.is() )
throw uno::RuntimeException( OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
- ::comphelper::OFOPXMLHelper::WriteRelationsInfoSequence( xOutStream, m_aRelInfo, m_xFactory );
+ ::comphelper::OFOPXMLHelper::WriteRelationsInfoSequence( xOutStream, m_aRelInfo, comphelper::getComponentContext(m_xFactory) );
// set the mediatype
uno::Reference< beans::XPropertySet > xPropSet( xRelsStream, uno::UNO_QUERY_THROW );
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index 5ab16b3dfa45..822f8399ea35 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -1104,7 +1104,7 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< uno:
aOverridesSequence.realloc( nSeqLength );
::comphelper::OFOPXMLHelper::WriteContentSequence(
- xConTypeOutStream, aDefaultsSequence, aOverridesSequence, m_xFactory );
+ xConTypeOutStream, aDefaultsSequence, aOverridesSequence, comphelper::getComponentContext(m_xFactory) );
sal_Int32 nBufferLength = static_cast < sal_Int32 > ( pBuffer->getPosition() );
pBuffer->realloc( nBufferLength );
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index df133d7d816d..e5840ccaeff7 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -73,7 +73,7 @@
#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
#include <com/sun/star/ui/XUIConfigurationStorage.hpp>
#include <com/sun/star/xml/AttributeData.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <comphelper/broadcasthelper.hxx>
#include <comphelper/documentconstants.hxx>
@@ -1738,20 +1738,15 @@ sal_Bool OReportDefinition::WriteThroughComponent(
OSL_ENSURE( NULL != pServiceName, "Need component name!" );
// get component
- uno::Reference< io::XActiveDataSource > xSaxWriter(
- m_aProps->m_xContext->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer")),m_aProps->m_xContext),
- uno::UNO_QUERY );
- OSL_ENSURE( xSaxWriter.is(), "can't instantiate XML com.sun.star.xml.sax.Writer" );
- if(!xSaxWriter.is())
- return sal_False;
+ uno::Reference< xml::sax::XWriter > xSaxWriter(
+ xml::sax::Writer::create(m_aProps->m_xContext) );
// connect XML writer to output stream
xSaxWriter->setOutputStream( xOutputStream );
// prepare arguments (prepend doc handler to given arguments)
- uno::Reference<xml::sax::XDocumentHandler> xDocHandler( xSaxWriter,uno::UNO_QUERY);
uno::Sequence<uno::Any> aArgs( 1 + rArguments.getLength() );
- aArgs[0] <<= xDocHandler;
+ aArgs[0] <<= xSaxWriter;
for(sal_Int32 i = 0; i < rArguments.getLength(); i++)
aArgs[i+1] = rArguments[i];
diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx
index 4b3b7a0a4efb..e54c9fcc1d22 100644
--- a/sax/source/expatwrap/saxwriter.cxx
+++ b/sax/source/expatwrap/saxwriter.cxx
@@ -20,16 +20,16 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/util/XCloneable.hpp>
-#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#include <com/sun/star/xml/sax/XParser.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
#include <com/sun/star/xml/sax/SAXInvalidCharacterException.hpp>
+#include <com/sun/star/xml/sax/XWriter.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/weak.hxx>
-#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/byteseq.hxx>
@@ -863,10 +863,9 @@ static inline sal_Int32 getLastLineBreak( const Sequence<sal_Int8> & seq) throw
class SAXWriter :
- public WeakImplHelper3<
- XActiveDataSource,
- XExtendedDocumentHandler,
- XServiceInfo >
+ public WeakImplHelper2<
+ XWriter,
+ XServiceInfo >
{
public:
SAXWriter( ) :
diff --git a/sc/inc/xmlwrap.hxx b/sc/inc/xmlwrap.hxx
index 2e378a4a1d09..7d03f56f27be 100644
--- a/sc/inc/xmlwrap.hxx
+++ b/sc/inc/xmlwrap.hxx
@@ -38,7 +38,7 @@ namespace com { namespace sun { namespace star {
namespace uno { class XInterface; }
namespace embed { class XStorage; }
namespace xml {
- namespace sax { struct InputSource; class XParser; } }
+ namespace sax { struct InputSource; class XParser; class XWriter; } }
} } }
class ScXMLImportWrapper
@@ -59,7 +59,7 @@ class ScXMLImportWrapper
sal_Bool ExportToComponent(com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>& xServiceFactory,
com::sun::star::uno::Reference<com::sun::star::frame::XModel>& xModel,
- com::sun::star::uno::Reference<com::sun::star::uno::XInterface>& xWriter,
+ com::sun::star::uno::Reference<com::sun::star::xml::sax::XWriter>& xWriter,
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aDescriptor,
const rtl::OUString& sName, const rtl::OUString& sMediaType, const rtl::OUString& sComponentName,
const sal_Bool bPlainText, com::sun::star::uno::Sequence<com::sun::star::uno::Any>& aArgs,
diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index 4d513fe3ce83..d059e86ad4b4 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -45,6 +45,7 @@
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/XDTDHandler.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/io/XActiveDataControl.hpp>
#include <com/sun/star/frame/XModel.hpp>
@@ -622,7 +623,7 @@ static bool lcl_HasValidStream(ScDocument& rDoc)
}
sal_Bool ScXMLImportWrapper::ExportToComponent(uno::Reference<lang::XMultiServiceFactory>& xServiceFactory,
- uno::Reference<frame::XModel>& xModel, uno::Reference<uno::XInterface>& xWriter,
+ uno::Reference<frame::XModel>& xModel, uno::Reference<xml::sax::XWriter>& xWriter,
uno::Sequence<beans::PropertyValue>& aDescriptor, const rtl::OUString& sName,
const rtl::OUString& sMediaType, const rtl::OUString& sComponentName,
const sal_Bool bPlainText, uno::Sequence<uno::Any>& aArgs, ScMySharedData*& pSharedData)
@@ -667,8 +668,7 @@ sal_Bool ScXMLImportWrapper::ExportToComponent(uno::Reference<lang::XMultiServic
xInfoSet->setPropertyValue( sPropName, uno::makeAny( sName ) );
}
- uno::Reference<io::XActiveDataSource> xSrc( xWriter, uno::UNO_QUERY );
- xSrc->setOutputStream( xOut );
+ xWriter->setOutputStream( xOut );
uno::Reference<document::XFilter> xFilter(
xServiceFactory->createInstanceWithArguments( sComponentName , aArgs ),
@@ -742,21 +742,16 @@ sal_Bool ScXMLImportWrapper::Export(sal_Bool bStylesOnly)
RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "sb99857", "ScXMLImportWrapper::Export" );
uno::Reference<lang::XMultiServiceFactory> xServiceFactory(comphelper::getProcessServiceFactory());
+ uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
OSL_ENSURE( xServiceFactory.is(), "got no service manager" );
if( !xServiceFactory.is() )
return false;
- uno::Reference<uno::XInterface> xWriter(xServiceFactory->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" )) ));
- OSL_ENSURE( xWriter.is(), "com.sun.star.xml.sax.Writer service missing" );
- if(!xWriter.is())
- return false;
+ uno::Reference<xml::sax::XWriter> xWriter = xml::sax::Writer::create(xContext);
if ( !xStorage.is() && pMedium )
xStorage = pMedium->GetOutputStorage();
- uno::Reference<xml::sax::XDocumentHandler> xHandler( xWriter, uno::UNO_QUERY );
-
OUString sFileName;
OUString sTextMediaType(RTL_CONSTASCII_USTRINGPARAM("text/xml"));
if (pMedium)
@@ -841,7 +836,7 @@ sal_Bool ScXMLImportWrapper::Export(sal_Bool bStylesOnly)
uno::Sequence<uno::Any> aMetaArgs(3);
uno::Any* pMetaArgs = aMetaArgs.getArray();
pMetaArgs[0] <<= xInfoSet;
- pMetaArgs[1] <<= xHandler;
+ pMetaArgs[1] <<= xWriter;
pMetaArgs[2] <<= xStatusIndicator;
RTL_LOGFILE_CONTEXT_TRACE( aLog, "meta export start" );
@@ -882,7 +877,7 @@ sal_Bool ScXMLImportWrapper::Export(sal_Bool bStylesOnly)
pStylesArgs[0] <<= xInfoSet;
pStylesArgs[1] <<= xGrfContainer;
pStylesArgs[2] <<= xStatusIndicator;
- pStylesArgs[3] <<= xHandler;
+ pStylesArgs[3] <<= xWriter;
pStylesArgs[4] <<= xObjectResolver;
RTL_LOGFILE_CONTEXT_TRACE( aLog, "styles export start" );
@@ -906,7 +901,7 @@ sal_Bool ScXMLImportWrapper::Export(sal_Bool bStylesOnly)
pDocArgs[0] <<= xInfoSet;
pDocArgs[1] <<= xGrfContainer;
pDocArgs[2] <<= xStatusIndicator;
- pDocArgs[3] <<= xHandler;
+ pDocArgs[3] <<= xWriter;
pDocArgs[4] <<= xObjectResolver;
RTL_LOGFILE_CONTEXT_TRACE( aLog, "content export start" );
@@ -934,7 +929,7 @@ sal_Bool ScXMLImportWrapper::Export(sal_Bool bStylesOnly)
uno::Sequence<uno::Any> aSettingsArgs(3);
uno::Any* pSettingsArgs = aSettingsArgs.getArray();
pSettingsArgs[0] <<= xInfoSet;
- pSettingsArgs[1] <<= xHandler;
+ pSettingsArgs[1] <<= xWriter;
pSettingsArgs[2] <<= xStatusIndicator;
RTL_LOGFILE_CONTEXT_TRACE( aLog, "settings export start" );
diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx
index f9cf8e3a804f..fb8598e8349b 100644
--- a/sd/source/filter/xml/sdxmlwrp.cxx
+++ b/sd/source/filter/xml/sdxmlwrp.cxx
@@ -59,6 +59,7 @@
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/XDTDHandler.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/io/XActiveDataControl.hpp>
#include <comphelper/componentcontext.hxx>
@@ -878,6 +879,7 @@ sal_Bool SdXMLFilter::Export()
}
uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() );
+ uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
if( !xServiceFactory.is() )
{
@@ -885,14 +887,7 @@ sal_Bool SdXMLFilter::Export()
return sal_False;
}
- uno::Reference< uno::XInterface > xWriter( xServiceFactory->createInstance( "com.sun.star.xml.sax.Writer" ) );
-
- if( !xWriter.is() )
- {
- OSL_FAIL( "com.sun.star.xml.sax.Writer service missing" );
- return sal_False;
- }
- uno::Reference<xml::sax::XDocumentHandler> xHandler( xWriter, uno::UNO_QUERY );
+ uno::Reference< xml::sax::XWriter > xWriter = xml::sax::Writer::create( xContext );
/** property map for export info set */
PropertyMapEntry aExportInfoMap[] =
@@ -1076,7 +1071,7 @@ sal_Bool SdXMLFilter::Export()
if( xObjectResolver.is() ) *pArgs++ <<= xObjectResolver;
if( mxStatusIndicator.is() ) *pArgs++ <<= mxStatusIndicator;
- *pArgs <<= xHandler;
+ *pArgs <<= xWriter;
uno::Reference< document::XFilter > xFilter( xServiceFactory->createInstanceWithArguments( OUString::createFromAscii( pServices->mpService ), aArgs ), uno::UNO_QUERY );
if( xFilter.is() )
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
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index 1ecaff1db896..33628915c80a 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/XDTDHandler.hpp>
#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/io/XActiveDataControl.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
@@ -51,6 +52,7 @@
#include <unotools/saveopt.hxx>
#include <svl/stritem.hxx>
#include <svl/itemprop.hxx>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/processfactory.hxx>
#include <unotools/streamwrap.hxx>
#include <sax/tools/converter.hxx>
@@ -265,9 +267,8 @@ sal_Bool SmXMLExportWrapper::WriteThroughComponent(
OSL_ENSURE(NULL != pComponentName, "Need component name!");
// get component
- Reference< io::XActiveDataSource > xSaxWriter(
- rFactory->createInstance( "com.sun.star.xml.sax.Writer" ),
- UNO_QUERY );
+ Reference< xml::sax::XWriter > xSaxWriter = xml::sax::Writer::create(
+ comphelper::getComponentContext(rFactory) );
OSL_ENSURE( xSaxWriter.is(), "can't instantiate XML writer" );
if (!xSaxWriter.is())
return sal_False;
diff --git a/svtools/source/filter/filter.cxx b/svtools/source/filter/filter.cxx
index 6428c2ea6b4b..7065c89e0618 100644
--- a/svtools/source/filter/filter.cxx
+++ b/svtools/source/filter/filter.cxx
@@ -63,6 +63,7 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/svg/XSVGWriter.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/ucb/CommandAbortedException.hpp>
#include <unotools/ucbstreamhelper.hxx>
#include <unotools/localfilehelper.hxx>
@@ -2073,11 +2074,12 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String&
try
{
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
if( xMgr.is() )
{
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > xSaxWriter( xMgr->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" )) ), ::com::sun::star::uno::UNO_QUERY );
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > xSaxWriter(
+ xml::sax::Writer::create( xContext ), uno::UNO_QUERY_THROW);
::com::sun::star::uno::Reference< ::com::sun::star::svg::XSVGWriter > xSVGWriter( xMgr->createInstance(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svg.SVGWriter" )) ), ::com::sun::star::uno::UNO_QUERY );
diff --git a/svx/source/xml/xmlexport.cxx b/svx/source/xml/xmlexport.cxx
index 0109eff91986..f7f97ce2b3a1 100644
--- a/svx/source/xml/xmlexport.cxx
+++ b/svx/source/xml/xmlexport.cxx
@@ -32,6 +32,7 @@
#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
@@ -77,6 +78,7 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference<io::XOutp
}
uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() );
+ uno::Reference< uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
if( !xServiceFactory.is() )
{
OSL_FAIL( "got no service manager" );
@@ -85,12 +87,7 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference<io::XOutp
if( bDocRet )
{
- uno::Reference< uno::XInterface > xWriter( xServiceFactory->createInstance( OUString( "com.sun.star.xml.sax.Writer" ) ) );
- if( !xWriter.is() )
- {
- OSL_FAIL( "com.sun.star.xml.sax.Writer service missing" );
- bDocRet = sal_False;
- }
+ uno::Reference< xml::sax::XWriter > xWriter = xml::sax::Writer::create( xContext );
::comphelper::IEmbeddedHelper *pPersist = pModel->GetPersist();
if( pPersist )
diff --git a/svx/source/xml/xmlxtexp.cxx b/svx/source/xml/xmlxtexp.cxx
index a2f8322b1763..794d61d9291e 100644
--- a/svx/source/xml/xmlxtexp.cxx
+++ b/svx/source/xml/xmlxtexp.cxx
@@ -28,7 +28,7 @@
#include <tools/urlobj.hxx>
#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
#include <com/sun/star/drawing/LineDash.hpp>
@@ -237,18 +237,14 @@ bool SvxXMLXTableExportComponent::save(
try
{
uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() );
+ uno::Reference< uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
if( !xServiceFactory.is() )
{
OSL_FAIL( "got no service manager" );
return false;
}
- uno::Reference< uno::XInterface > xWriter( xServiceFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ) );
- if( !xWriter.is() )
- {
- OSL_FAIL( "com.sun.star.xml.sax.Writer service missing" );
- return false;
- }
+ uno::Reference< xml::sax::XWriter > xWriter = xml::sax::Writer::create( xContext );
uno::Reference < io::XStream > xStream;
uno::Reference < io::XOutputStream > xOut;
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx
index 714de20465f3..0bdb4ec4d771 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -37,6 +37,7 @@
#include <com/sun/star/xml/sax/InputSource.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/document/XStorageBasedDocument.hpp>
#include <doc.hxx>
#include <docsh.hxx>
@@ -380,6 +381,8 @@ sal_uLong SwXMLTextBlocks::PutBlockText( const String& rShort, const String& ,
uno::Reference< lang::XMultiServiceFactory > xServiceFactory =
comphelper::getProcessServiceFactory();
+ uno::Reference< uno::XComponentContext > xContext =
+ comphelper::getProcessComponentContext();
OSL_ENSURE( xServiceFactory.is(),
"XMLReader::Read: got no service manager" );
if( !xServiceFactory.is() )
@@ -387,9 +390,7 @@ sal_uLong SwXMLTextBlocks::PutBlockText( const String& rShort, const String& ,
// Throw an exception ?
}
- uno::Reference < XInterface > xWriter (xServiceFactory->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer"))));
- OSL_ENSURE(xWriter.is(),"com.sun.star.xml.sax.Writer service missing");
+ uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext);
sal_uLong nRes = 0;
try
@@ -512,6 +513,8 @@ void SwXMLTextBlocks::WriteInfo( void )
{
uno::Reference< lang::XMultiServiceFactory > xServiceFactory =
comphelper::getProcessServiceFactory();
+ uno::Reference< uno::XComponentContext > xContext =
+ comphelper::getProcessComponentContext();
OSL_ENSURE( xServiceFactory.is(),
"XMLReader::Read: got no service manager" );
if( !xServiceFactory.is() )
@@ -519,9 +522,7 @@ void SwXMLTextBlocks::WriteInfo( void )
// Throw an exception ?
}
- uno::Reference < XInterface > xWriter (xServiceFactory->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer"))));
- OSL_ENSURE(xWriter.is(),"com.sun.star.xml.sax.Writer service missing");
+ uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext);
OUString sDocName( RTL_CONSTASCII_USTRINGPARAM( XMLN_BLOCKLIST ) );
/*
@@ -580,6 +581,8 @@ sal_uLong SwXMLTextBlocks::SetMacroTable(
uno::Reference< lang::XMultiServiceFactory > xServiceFactory =
comphelper::getProcessServiceFactory();
+ uno::Reference< uno::XComponentContext > xContext =
+ comphelper::getProcessComponentContext();
OSL_ENSURE( xServiceFactory.is(),
"XML autotext event write:: got no service manager" );
if( !xServiceFactory.is() )
@@ -619,51 +622,43 @@ sal_uLong SwXMLTextBlocks::SetMacroTable(
uno::Reference < io::XOutputStream > xOutputStream = xDocStream->getOutputStream();
// get XML writer
- uno::Reference< io::XActiveDataSource > xSaxWriter(
- xServiceFactory->createInstance(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer")) ),
- UNO_QUERY );
- OSL_ENSURE( xSaxWriter.is(), "can't instantiate XML writer" );
- if( xSaxWriter.is() )
+ uno::Reference< xml::sax::XWriter > xSaxWriter =
+ xml::sax::Writer::create( xContext );
+
+ // connect XML writer to output stream
+ xSaxWriter->setOutputStream( xOutputStream );
+ uno::Reference<xml::sax::XDocumentHandler> xDocHandler(
+ xSaxWriter, UNO_QUERY);
+
+ // construct events object
+ uno::Reference<XNameAccess> xEvents =
+ new SvMacroTableEventDescriptor(rMacroTbl,aAutotextEvents);
+
+ // prepare arguments (prepend doc handler to given arguments)
+ Sequence<Any> aParams(2);
+ aParams[0] <<= xDocHandler;
+ aParams[1] <<= xEvents;
+
+
+ // get filter component
+ OUString sFilterComponent = bOasis
+ ? OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.XMLOasisAutotextEventsExporter"))
+ : OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.XMLAutotextEventsExporter"));
+ uno::Reference< document::XExporter > xExporter(
+ xServiceFactory->createInstanceWithArguments(
+ sFilterComponent, aParams), UNO_QUERY);
+ OSL_ENSURE( xExporter.is(),
+ "can't instantiate export filter component" );
+ if( xExporter.is() )
{
-
- // connect XML writer to output stream
- xSaxWriter->setOutputStream( xOutputStream );
- uno::Reference<xml::sax::XDocumentHandler> xDocHandler(
- xSaxWriter, UNO_QUERY);
-
- // construct events object
- uno::Reference<XNameAccess> xEvents =
- new SvMacroTableEventDescriptor(rMacroTbl,aAutotextEvents);
-
- // prepare arguments (prepend doc handler to given arguments)
- Sequence<Any> aParams(2);
- aParams[0] <<= xDocHandler;
- aParams[1] <<= xEvents;
-
-
- // get filter component
- OUString sFilterComponent = bOasis
- ? OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.XMLOasisAutotextEventsExporter"))
- : OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.XMLAutotextEventsExporter"));
- uno::Reference< document::XExporter > xExporter(
- xServiceFactory->createInstanceWithArguments(
- sFilterComponent, aParams), UNO_QUERY);
- OSL_ENSURE( xExporter.is(),
- "can't instantiate export filter component" );
- if( xExporter.is() )
- {
- // connect model and filter
- xExporter->setSourceDocument( xModelComp );
-
- // filter!
- Sequence<beans::PropertyValue> aFilterProps( 0 );
- uno::Reference < document::XFilter > xFilter( xExporter,
- UNO_QUERY );
- xFilter->filter( aFilterProps );
- }
- else
- nRes = ERR_SWG_WRITE_ERROR;
+ // connect model and filter
+ xExporter->setSourceDocument( xModelComp );
+
+ // filter!
+ Sequence<beans::PropertyValue> aFilterProps( 0 );
+ uno::Reference < document::XFilter > xFilter( xExporter,
+ UNO_QUERY );
+ xFilter->filter( aFilterProps );
}
else
nRes = ERR_SWG_WRITE_ERROR;
diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx
index 9dd317aa7e9f..48f7953c32ed 100644
--- a/sw/source/filter/xml/wrtxml.cxx
+++ b/sw/source/filter/xml/wrtxml.cxx
@@ -33,7 +33,7 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
#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/document/XExporter.hpp>
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/frame/XModule.hpp>
@@ -57,6 +57,7 @@
#include <statstr.hrc>
#include <rtl/logfile.hxx>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/documentconstants.hxx>
#include <comphelper/makesequence.hxx>
#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
@@ -609,13 +610,7 @@ sal_Bool SwXMLWriter::WriteThroughComponent(
"SwXMLWriter::WriteThroughComponent" );
// get component
- uno::Reference< io::XActiveDataSource > xSaxWriter(
- rFactory->createInstance(rtl::OUString("com.sun.star.xml.sax.Writer")),
- UNO_QUERY );
- OSL_ENSURE( xSaxWriter.is(), "can't instantiate XML writer" );
- if(!xSaxWriter.is())
- return sal_False;
-
+ uno::Reference< xml::sax::XWriter > xSaxWriter = xml::sax::Writer::create(comphelper::getComponentContext(rFactory));
RTL_LOGFILE_CONTEXT_TRACE( aFilterLog, "SAX-Writer created" );
// connect XML writer to output stream
diff --git a/unotools/source/config/accelcfg.cxx b/unotools/source/config/accelcfg.cxx
index e3f121ca142f..9c48b7f5e06e 100644
--- a/unotools/source/config/accelcfg.cxx
+++ b/unotools/source/config/accelcfg.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
#include <unotools/configmgr.hxx>
#include <unotools/configitem.hxx>
@@ -88,16 +89,12 @@ SvtAcceleratorConfig_Impl::SvtAcceleratorConfig_Impl( Reference< XInputStream >&
bool SvtAcceleratorConfig_Impl::Commit( Reference< XOutputStream >& rOutputStream )
{
- Reference< XDocumentHandler > xWriter;
+ Reference< XWriter > xWriter = Writer::create( ::comphelper::getProcessComponentContext() );
- xWriter = Reference< XDocumentHandler >( ::comphelper::getProcessServiceFactory()->createInstance(
- ::rtl::OUString("com.sun.star.xml.sax.Writer")), UNO_QUERY) ;
-
- Reference< ::com::sun::star::io::XActiveDataSource> xDataSource( xWriter , UNO_QUERY );
- xDataSource->setOutputStream( rOutputStream );
+ xWriter->setOutputStream( rOutputStream );
try
{
- OWriteAccelatorDocumentHandler aWriteHandler( aList, xWriter );
+ OWriteAccelatorDocumentHandler aWriteHandler( aList, Reference<XDocumentHandler>(xWriter, UNO_QUERY_THROW) );
aWriteHandler.WriteAcceleratorDocument();
rOutputStream->flush();
return true;
diff --git a/xmloff/source/meta/xmlversion.cxx b/xmloff/source/meta/xmlversion.cxx
index 8729cfd91160..55edfdbecd29 100644
--- a/xmloff/source/meta/xmlversion.cxx
+++ b/xmloff/source/meta/xmlversion.cxx
@@ -41,6 +41,7 @@
#include <com/sun/star/util/MeasureUnit.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
using namespace ::com::sun::star::xml::sax;
using namespace ::com::sun::star::uno;
@@ -356,10 +357,10 @@ void SAL_CALL XMLVersionListPersistence::store( const uno::Reference< embed::XSt
Reference< lang::XMultiServiceFactory > xServiceFactory =
comphelper::getProcessServiceFactory();
DBG_ASSERT( xServiceFactory.is(), "XMLReader::Read: got no service manager" );
+ Reference< uno::XComponentContext > xContext =
+ comphelper::getProcessComponentContext();
- Reference< XInterface > xWriter (xServiceFactory->createInstance(
- OUString("com.sun.star.xml.sax.Writer")));
- DBG_ASSERT( xWriter.is(), "com.sun.star.xml.sax.Writer service missing" );
+ Reference< XWriter > xWriter = Writer::create(xContext);
// check whether there's already a sub storage with the version info
// and delete it
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) )
{
diff --git a/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx b/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx
index 6325282bb780..e8b371b0a7ee 100644
--- a/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx
+++ b/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx
@@ -31,7 +31,7 @@
#include <xmlsecurity/sigstruct.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XWriter.hpp>
#include <com/sun/star/xml/crypto/XUriBinding.hpp>
#include <com/sun/star/xml/crypto/XSEInitializer.hpp>
#include <com/sun/star/xml/crypto/sax/XSecurityController.hpp>
@@ -179,7 +179,7 @@ public:
// MT: ??? I think only for adding/removing, not for new signatures...
// MM: Yes, but if you want to insert a new signature into an existing signature file, those function
// will be very usefull, see Mission 3 in the new "multisigdemo" program :-)
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler> CreateDocumentHandlerWithHeader( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xOutputStream );
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XWriter> CreateDocumentHandlerWithHeader( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xOutputStream );
void CloseDocumentHandler( const ::com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler>& xDocumentHandler );
void ExportSignature( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler >& xDocumentHandler, const SignatureInformation& signatureInfo );
};
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 9cee3b5bfee3..aa58d93ddb7b 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -378,9 +378,10 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, OKButtonHdl)
embed::ElementModes::WRITE|embed::ElementModes::TRUNCATE, false );
uno::Reference< io::XOutputStream > xOutputStream(
aStreamHelper.xSignatureStream, uno::UNO_QUERY );
- uno::Reference< com::sun::star::xml::sax::XDocumentHandler> xDocumentHandler =
+ uno::Reference< com::sun::star::xml::sax::XWriter> xSaxWriter =
maSignatureHelper.CreateDocumentHandlerWithHeader( xOutputStream );
+ uno::Reference< xml::sax::XDocumentHandler> xDocumentHandler(xSaxWriter, UNO_QUERY_THROW);
size_t nInfos = maCurrentSignatureInformations.size();
for( size_t n = 0 ; n < nInfos ; ++n )
maSignatureHelper.ExportSignature(
@@ -471,10 +472,11 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, AddButtonHdl)
css::embed::ElementModes::WRITE|css::embed::ElementModes::TRUNCATE, true);
Reference< css::io::XOutputStream > xOutputStream(
aStreamHelper.xSignatureStream, UNO_QUERY_THROW);
- Reference< css::xml::sax::XDocumentHandler> xDocumentHandler =
+ Reference< css::xml::sax::XWriter> xSaxWriter =
maSignatureHelper.CreateDocumentHandlerWithHeader( xOutputStream );
// Export old signatures...
+ uno::Reference< xml::sax::XDocumentHandler> xDocumentHandler(xSaxWriter, UNO_QUERY_THROW);
size_t nInfos = maCurrentSignatureInformations.size();
for ( size_t n = 0; n < nInfos; n++ )
maSignatureHelper.ExportSignature( xDocumentHandler, maCurrentSignatureInformations[n]);
@@ -534,9 +536,10 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, RemoveButtonHdl)
css::embed::ElementModes::WRITE | css::embed::ElementModes::TRUNCATE, true);
Reference< css::io::XOutputStream > xOutputStream(
aStreamHelper.xSignatureStream, UNO_QUERY_THROW);
- Reference< css::xml::sax::XDocumentHandler> xDocumentHandler =
+ Reference< css::xml::sax::XWriter> xSaxWriter =
maSignatureHelper.CreateDocumentHandlerWithHeader( xOutputStream );
+ uno::Reference< xml::sax::XDocumentHandler> xDocumentHandler(xSaxWriter, UNO_QUERY_THROW);
size_t nInfos = maCurrentSignatureInformations.size();
for( size_t n = 0 ; n < nInfos ; ++n )
maSignatureHelper.ExportSignature( xDocumentHandler, maCurrentSignatureInformations[ n ] );
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 )