Kaydet (Commit) f1204419 authored tarafından Noel Grandin's avatar Noel Grandin

fdo#46808, Adapt document::XMLOasisBasicImporter UNO service to new style

Change-Id: Ic494847cf56c7661474d2a096dccc675780c9ce1
üst 37ef449b
......@@ -104,6 +104,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/document,\
OOXMLDocumentPropertiesImporter \
XMLBasicExporter \
XMLOasisBasicExporter \
XMLOasisBasicImporter \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/drawing,\
ShapeCollection \
......@@ -668,7 +669,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/documen
Settings \
TypeDetection \
XMLBasicImporter \
XMLOasisBasicImporter \
))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/drawing,\
AccessibleDrawDocumentView \
......@@ -2174,6 +2174,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/document,\
XUndoManagerSupplier \
XViewDataSupplier \
XXMLBasicExporter \
XXMLOasisBasicImporter \
))
$(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/drawing,\
Alignment \
......
......@@ -19,8 +19,7 @@
#ifndef __com_sun_star_document_XMLOasisBasicImporter_idl__
#define __com_sun_star_document_XMLOasisBasicImporter_idl__
#include <com/sun/star/document/XImporter.idl>
#include <com/sun/star/xml/sax/XDocumentHandler.idl>
#include <com/sun/star/document/XXMLOasisBasicImporter.idl>
......@@ -37,19 +36,7 @@ module com { module sun { module star { module document {
@since OOo 2.0
*/
published service XMLOasisBasicImporter
{
/** sets the target document for this filter.
*/
interface com::sun::star::document::XImporter;
/** receives notification of general document events.
*/
interface com::sun::star::xml::sax::XDocumentHandler;
};
published service XMLOasisBasicImporter : XXMLOasisBasicImporter;
}; }; }; };
......
/* -*- 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_document_XXMLOasisBasicImporter_idl__
#define __com_sun_star_document_XXMLOasisBasicImporter_idl__
#include <com/sun/star/document/XImporter.idl>
#include <com/sun/star/xml/sax/XDocumentHandler.idl>
module com { module sun { module star { module document {
/**
@since LibreOffice 4.1
*/
published interface XXMLOasisBasicImporter
{
/** sets the target document for this filter.
*/
interface com::sun::star::document::XImporter;
/** receives notification of general document events.
*/
interface com::sun::star::xml::sax::XDocumentHandler;
};
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -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 );
......
......@@ -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,
......
......@@ -20,15 +20,14 @@
#ifndef XMLSCRIPT_XMLBAS_IMPORT_HXX
#define XMLSCRIPT_XMLBAS_IMPORT_HXX
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/document/XImporter.hpp>
#include <com/sun/star/document/XXMLOasisBasicImporter.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/script/XLibraryContainer2.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/xml/input/XRoot.hpp>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase2.hxx>
#include <osl/mutex.hxx>
#include <rtl/ustrbuf.hxx>
......@@ -245,10 +244,9 @@ namespace xmlscript
// class XMLBasicImporterBase
// =============================================================================
typedef ::cppu::WeakImplHelper3<
typedef ::cppu::WeakImplHelper2<
::com::sun::star::lang::XServiceInfo,
::com::sun::star::document::XImporter,
::com::sun::star::xml::sax::XDocumentHandler > XMLBasicImporterBase_BASE;
::com::sun::star::document::XXMLOasisBasicImporter > XMLBasicImporterBase_BASE;
class XMLBasicImporterBase : public XMLBasicImporterBase_BASE
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment