summaryrefslogtreecommitdiff
path: root/sc/source/filter/xml/xmlwrap.cxx
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 /sc/source/filter/xml/xmlwrap.cxx
parent9cabab002b1180650236f3d1f5fd32dfdd4bf79a (diff)
fdo#46808, Adapt xml::sax::XWriter UNO service to new style
Create a merged XWriter interface for the service. The xml.sax.Writer service already existed, it just did not have an IDL file. Change-Id: I4e6d3f3c68f9282a55fc7aa19778f97632fd8ad5
Diffstat (limited to 'sc/source/filter/xml/xmlwrap.cxx')
-rw-r--r--sc/source/filter/xml/xmlwrap.cxx23
1 files changed, 9 insertions, 14 deletions
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" );