summaryrefslogtreecommitdiffstats
path: root/filter
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 /filter
parentCLANGPLUGIN_CPPFLAGS for building plugin for Clang in nonstandard location (diff)
downloadcore-fb741b5e1e6aeaee74cf14af4f1cc152f0ab0952.tar.gz
core-fb741b5e1e6aeaee74cf14af4f1cc152f0ab0952.zip
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 'filter')
-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
8 files changed, 33 insertions, 44 deletions
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