summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-02-04 10:34:03 +0200
committerNoel Grandin <noel@peralex.com>2013-02-12 10:14:43 +0200
commitf1204419af34b1d2f0ecaa69ceeb1f8c8a7d87df (patch)
treeaf5cc696bc74c2825739b5e639d0bf96259fd4d5 /xmloff
parent37ef449b93750b6101cf04b8112fa2ef64ba38ff (diff)
fdo#46808, Adapt document::XMLOasisBasicImporter UNO service to new style
Change-Id: Ic494847cf56c7661474d2a096dccc675780c9ce1
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/script/xmlbasici.cxx23
-rw-r--r--xmloff/source/script/xmlbasici.hxx4
2 files changed, 9 insertions, 18 deletions
diff --git a/xmloff/source/script/xmlbasici.cxx b/xmloff/source/script/xmlbasici.cxx
index 97a468749f55..188608a19c85 100644
--- a/xmloff/source/script/xmlbasici.cxx
+++ b/xmloff/source/script/xmlbasici.cxx
@@ -21,6 +21,8 @@
#include <xmloff/attrlist.hxx>
#include <xmloff/nmspmap.hxx>
#include <xmloff/xmlimp.hxx>
+#include <com/sun/star/document/XMLOasisBasicImporter.hpp>
+#include <comphelper/processfactory.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -36,22 +38,10 @@ XMLBasicImportContext::XMLBasicImportContext( SvXMLImport& rImport, sal_uInt16 n
,m_xModel( rxModel )
{
Reference< lang::XMultiServiceFactory > xMSF = GetImport().getServiceFactory();
- if ( xMSF.is() )
- {
- m_xHandler.set( xMSF->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.XMLOasisBasicImporter" ) ) ),
- UNO_QUERY );
- }
+ m_xHandler = document::XMLOasisBasicImporter::create( comphelper::getComponentContext(xMSF) );
- if ( m_xHandler.is() )
- {
- Reference< document::XImporter > xImporter( m_xHandler, UNO_QUERY );
- if ( xImporter.is() )
- {
- Reference< lang::XComponent > xComp( m_xModel, UNO_QUERY );
- xImporter->setTargetDocument( xComp );
- }
- }
+ Reference< lang::XComponent > xComp( m_xModel, UNO_QUERY );
+ m_xHandler->setTargetDocument( xComp );
}
// -----------------------------------------------------------------------------
@@ -69,7 +59,8 @@ SvXMLImportContext* XMLBasicImportContext::CreateChildContext(
SvXMLImportContext* pContext = 0;
if ( m_xHandler.is() )
- pContext = new XMLBasicImportChildContext( GetImport(), nPrefix, rLocalName, m_xHandler );
+ pContext = new XMLBasicImportChildContext( GetImport(), nPrefix, rLocalName,
+ Reference<xml::sax::XDocumentHandler>(m_xHandler, UNO_QUERY_THROW) );
if ( !pContext )
pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
diff --git a/xmloff/source/script/xmlbasici.hxx b/xmloff/source/script/xmlbasici.hxx
index 0a1ab864b937..207f296e0627 100644
--- a/xmloff/source/script/xmlbasici.hxx
+++ b/xmloff/source/script/xmlbasici.hxx
@@ -21,7 +21,7 @@
#define _XMLOFF_XMLBASICI_HXX
#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/document/XXMLOasisBasicImporter.hpp>
#include <xmloff/xmlictxt.hxx>
@@ -33,7 +33,7 @@ class XMLBasicImportContext : public SvXMLImportContext
{
private:
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xHandler;
+ ::com::sun::star::uno::Reference< ::com::sun::star::document::XXMLOasisBasicImporter > m_xHandler;
public:
XMLBasicImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName,