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

fdo#46808, convert xforms::Model to new style

the service already existed, it just needed an IDL file.

Change-Id: Id8f33183d9332f9defd855b3a3c7413fde24a61b
üst fb0f7c24
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <cppuhelper/implbase4.hxx> #include <cppuhelper/implbase4.hxx>
#include <propertysetbase.hxx> #include <propertysetbase.hxx>
#include <com/sun/star/xforms/XModel.hpp> #include <com/sun/star/xforms/XModel2.hpp>
#include <com/sun/star/xforms/XFormsUIHelper1.hpp> #include <com/sun/star/xforms/XFormsUIHelper1.hpp>
#include <com/sun/star/util/XUpdatable.hpp> #include <com/sun/star/util/XUpdatable.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp>
...@@ -68,7 +68,7 @@ namespace xforms ...@@ -68,7 +68,7 @@ namespace xforms
*/ */
typedef cppu::ImplInheritanceHelper4< typedef cppu::ImplInheritanceHelper4<
PropertySetBase, PropertySetBase,
com::sun::star::xforms::XModel, com::sun::star::xforms::XModel2,
com::sun::star::xforms::XFormsUIHelper1, com::sun::star::xforms::XFormsUIHelper1,
com::sun::star::util::XUpdatable, com::sun::star::util::XUpdatable,
com::sun::star::lang::XUnoTunnel com::sun::star::lang::XUnoTunnel
...@@ -281,7 +281,35 @@ public: ...@@ -281,7 +281,35 @@ public:
virtual XSet_t SAL_CALL getSubmissions() virtual XSet_t SAL_CALL getSubmissions()
throw( RuntimeException_t ); throw( RuntimeException_t );
// XPropertySet
virtual css::uno::Any SAL_CALL getPropertyValue(const rtl::OUString& p)
throw( css::uno::RuntimeException )
{ return PropertySetBase::getPropertyValue(p); }
virtual void SAL_CALL addPropertyChangeListener(const rtl::OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2)
throw( css::uno::RuntimeException )
{ PropertySetBase::addPropertyChangeListener(p1, p2); }
virtual void SAL_CALL removePropertyChangeListener(const rtl::OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2)
throw( css::uno::RuntimeException )
{ PropertySetBase::removePropertyChangeListener(p1, p2); }
virtual void SAL_CALL addVetoableChangeListener(const rtl::OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2)
throw( css::uno::RuntimeException )
{ PropertySetBase::addVetoableChangeListener(p1, p2); }
virtual void SAL_CALL removeVetoableChangeListener(const rtl::OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2)
throw( css::uno::RuntimeException )
{ PropertySetBase::removeVetoableChangeListener(p1, p2); }
virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo()
throw( css::uno::RuntimeException )
{ return PropertySetBase::getPropertySetInfo(); }
virtual void SAL_CALL setPropertyValue(const rtl::OUString& p1, const com::sun::star::uno::Any& p2)
throw( css::uno::RuntimeException )
{ PropertySetBase::setPropertyValue(p1, p2); }
// //
// XFormsUIHelper1 & friends: // XFormsUIHelper1 & friends:
......
...@@ -46,7 +46,7 @@ Reference<XInterface> Model_CreateInstance( ...@@ -46,7 +46,7 @@ Reference<XInterface> Model_CreateInstance(
const Reference<XMultiServiceFactory>& ) const Reference<XMultiServiceFactory>& )
throw( RuntimeException ) throw( RuntimeException )
{ {
return static_cast<XPropertySet*>( new xforms::Model ); return static_cast<XPropertySet*>( static_cast<PropertySetBase*>( new xforms::Model ) );
} }
Reference<XInterface> XForms_CreateInstance( Reference<XInterface> XForms_CreateInstance(
......
...@@ -366,6 +366,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/util,\ ...@@ -366,6 +366,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/util,\
UriAbbreviation \ UriAbbreviation \
URLTransformer \ URLTransformer \
)) ))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xforms,\
Model \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xml/crypto,\ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xml/crypto,\
NSSInitializer \ NSSInitializer \
SEInitializer \ SEInitializer \
...@@ -4072,6 +4075,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/xforms,\ ...@@ -4072,6 +4075,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/xforms,\
XFormsSupplier \ XFormsSupplier \
XFormsUIHelper1 \ XFormsUIHelper1 \
XModel \ XModel \
XModel2 \
XSubmission \ XSubmission \
)) ))
$(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/xml,\ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/xml,\
......
/* -*- 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_xforms_Model_idl__
#define __com_sun_star_xforms_Model_idl__
#include <com/sun/star/xforms/XModel2.idl>
module com { module sun { module star { module xforms {
/**
@since LibreOffice 4.1
*/
service Model : XModel2;
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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_xforms_XModel2_idl__
#define __com_sun_star_xforms_XModel2_idl__
#include <com/sun/star/xforms/XModel.idl>
module com { module sun { module star { module xforms {
/**
@since LibreOffice 4.1
*/
interface XModel2
{
interface com::sun::star::xforms::XModel;
interface com::sun::star::beans::XPropertySet;
};
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
#include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/frame/XModule.hpp> #include <com/sun/star/frame/XModule.hpp>
#include <com/sun/star/xforms/XModel.hpp> #include <com/sun/star/xforms/Model.hpp>
#include <com/sun/star/xforms/XModel2.hpp>
#include <com/sun/star/xforms/XFormsUIHelper1.hpp> #include <com/sun/star/xforms/XFormsUIHelper1.hpp>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <tools/diagnose_ex.h> #include <tools/diagnose_ex.h>
...@@ -37,7 +38,7 @@ using uno::UNO_QUERY; ...@@ -37,7 +38,7 @@ using uno::UNO_QUERY;
using uno::makeAny; using uno::makeAny;
using uno::Exception; using uno::Exception;
using container::XNameContainer; using container::XNameContainer;
using xforms::XModel; using xforms::XModel2;
using frame::XModule; using frame::XModule;
using xforms::XFormsUIHelper1; using xforms::XFormsUIHelper1;
using ::rtl::OUString; using ::rtl::OUString;
...@@ -84,19 +85,13 @@ void SwDoc::initXForms( bool bCreateDefaultModel ) ...@@ -84,19 +85,13 @@ void SwDoc::initXForms( bool bCreateDefaultModel )
if( bCreateDefaultModel && mxXForms.is() ) if( bCreateDefaultModel && mxXForms.is() )
{ {
OUString sName("Model 1"); OUString sName("Model 1");
Reference<XModel> xModel( Reference<XModel2> xModel = xforms::Model::create( comphelper::getProcessComponentContext() );
lcl_createInstance( "com.sun.star.xforms.Model" ), xModel->setID( sName );
UNO_QUERY ); Reference<XFormsUIHelper1>( xModel, uno::UNO_QUERY_THROW )->newInstance(
OSL_ENSURE( xModel.is(), "no model?" ); OUString("Instance 1"),
if( xModel.is() ) OUString(), sal_True );
{ xModel->initialize();
xModel->setID( sName ); mxXForms->insertByName( sName, makeAny( xModel ) );
Reference<XFormsUIHelper1>( xModel, UNO_QUERY )->newInstance(
OUString("Instance 1"),
OUString(), sal_True );
xModel->initialize();
mxXForms->insertByName( sName, makeAny( xModel ) );
}
OSL_ENSURE( mxXForms->hasElements(), "can't create XForms model" ); OSL_ENSURE( mxXForms->hasElements(), "can't create XForms model" );
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <xmloff/nmspmap.hxx> #include <xmloff/nmspmap.hxx>
#include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/xforms/XModel.hpp> #include <com/sun/star/xforms/XModel2.hpp>
#include <tools/debug.hxx> #include <tools/debug.hxx>
...@@ -42,7 +42,7 @@ using com::sun::star::uno::UNO_QUERY; ...@@ -42,7 +42,7 @@ using com::sun::star::uno::UNO_QUERY;
using com::sun::star::uno::UNO_QUERY_THROW; using com::sun::star::uno::UNO_QUERY_THROW;
using com::sun::star::container::XNameContainer; using com::sun::star::container::XNameContainer;
using com::sun::star::xml::sax::XAttributeList; using com::sun::star::xml::sax::XAttributeList;
using com::sun::star::xforms::XModel; using com::sun::star::xforms::XModel2;
using namespace xmloff::token; using namespace xmloff::token;
...@@ -69,9 +69,9 @@ XFormsBindContext::XFormsBindContext( ...@@ -69,9 +69,9 @@ XFormsBindContext::XFormsBindContext(
SvXMLImport& rImport, SvXMLImport& rImport,
sal_uInt16 nPrefix, sal_uInt16 nPrefix,
const OUString& rLocalName, const OUString& rLocalName,
const Reference<XPropertySet>& xModel ) : const Reference<XModel2>& xModel ) :
TokenContext( rImport, nPrefix, rLocalName, aAttributeMap, aEmptyMap ), TokenContext( rImport, nPrefix, rLocalName, aAttributeMap, aEmptyMap ),
mxModel( xModel, UNO_QUERY_THROW ), mxModel( xModel ),
mxBinding( NULL ) mxBinding( NULL )
{ {
// attach binding to model // attach binding to model
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
namespace com { namespace sun { namespace star { namespace com { namespace sun { namespace star {
namespace xml { namespace sax { class XAttributeList; } } namespace xml { namespace sax { class XAttributeList; } }
namespace beans { class XPropertySet; } namespace beans { class XPropertySet; }
namespace xforms { class XModel; } namespace xforms { class XModel2; }
} } } } } }
namespace rtl { class OUString; } namespace rtl { class OUString; }
class SvXMLImport; class SvXMLImport;
...@@ -41,7 +41,7 @@ class SvXMLImportContext; ...@@ -41,7 +41,7 @@ class SvXMLImportContext;
/** import the xforms:binding element */ /** import the xforms:binding element */
class XFormsBindContext : public TokenContext class XFormsBindContext : public TokenContext
{ {
const com::sun::star::uno::Reference<com::sun::star::xforms::XModel> mxModel; const com::sun::star::uno::Reference<com::sun::star::xforms::XModel2> mxModel;
com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> mxBinding; com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> mxBinding;
public: public:
...@@ -49,7 +49,7 @@ public: ...@@ -49,7 +49,7 @@ public:
XFormsBindContext( SvXMLImport& rImport, XFormsBindContext( SvXMLImport& rImport,
sal_uInt16 nPrefix, sal_uInt16 nPrefix,
const rtl::OUString& rLocalName, const rtl::OUString& rLocalName,
const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xModel ); const com::sun::star::uno::Reference<com::sun::star::xforms::XModel2>& xModel );
virtual ~XFormsBindContext(); virtual ~XFormsBindContext();
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/xml/dom/XDocument.hpp> #include <com/sun/star/xml/dom/XDocument.hpp>
#include <com/sun/star/xforms/XModel.hpp> #include <com/sun/star/xforms/XModel2.hpp>
#include <tools/debug.hxx> #include <tools/debug.hxx>
#include <xmloff/xmlnmspe.hxx> #include <xmloff/xmlnmspe.hxx>
...@@ -43,7 +43,7 @@ using com::sun::star::uno::Reference; ...@@ -43,7 +43,7 @@ using com::sun::star::uno::Reference;
using com::sun::star::uno::makeAny; using com::sun::star::uno::makeAny;
using com::sun::star::uno::UNO_QUERY; using com::sun::star::uno::UNO_QUERY;
using com::sun::star::uno::Sequence; using com::sun::star::uno::Sequence;
using com::sun::star::xforms::XModel; using com::sun::star::xforms::XModel2;
using com::sun::star::beans::XPropertySet; using com::sun::star::beans::XPropertySet;
using com::sun::star::beans::PropertyValue; using com::sun::star::beans::PropertyValue;
using com::sun::star::xml::sax::XAttributeList; using com::sun::star::xml::sax::XAttributeList;
...@@ -64,9 +64,9 @@ XFormsInstanceContext::XFormsInstanceContext( ...@@ -64,9 +64,9 @@ XFormsInstanceContext::XFormsInstanceContext(
SvXMLImport& rImport, SvXMLImport& rImport,
sal_uInt16 nPrefix, sal_uInt16 nPrefix,
const OUString& rLocalName, const OUString& rLocalName,
Reference<XPropertySet> xModel ) : const Reference<XModel2> & xModel ) :
TokenContext( rImport, nPrefix, rLocalName, aAttributes, aEmptyMap ), TokenContext( rImport, nPrefix, rLocalName, aAttributes, aEmptyMap ),
mxModel( Reference<XModel>( xModel, UNO_QUERY ) ) mxModel( xModel )
{ {
DBG_ASSERT( mxModel.is(), "need model" ); DBG_ASSERT( mxModel.is(), "need model" );
} }
......
...@@ -32,7 +32,7 @@ namespace com { namespace sun { namespace star { ...@@ -32,7 +32,7 @@ namespace com { namespace sun { namespace star {
namespace xml { namespace sax { class XAttributeList; } } namespace xml { namespace sax { class XAttributeList; } }
namespace xml { namespace dom { class XDocument; } } namespace xml { namespace dom { class XDocument; } }
namespace beans { class XPropertySet; } namespace beans { class XPropertySet; }
namespace xforms { class XModel; } namespace xforms { class XModel2; }
} } } } } }
namespace rtl { class OUString; } namespace rtl { class OUString; }
class SvXMLImport; class SvXMLImport;
...@@ -42,7 +42,7 @@ class SvXMLImportContext; ...@@ -42,7 +42,7 @@ class SvXMLImportContext;
/** import the xforms:instance element */ /** import the xforms:instance element */
class XFormsInstanceContext : public TokenContext class XFormsInstanceContext : public TokenContext
{ {
com::sun::star::uno::Reference<com::sun::star::xforms::XModel> mxModel; com::sun::star::uno::Reference<com::sun::star::xforms::XModel2> mxModel;
com::sun::star::uno::Reference<com::sun::star::xml::dom::XDocument> mxInstance; com::sun::star::uno::Reference<com::sun::star::xml::dom::XDocument> mxInstance;
rtl::OUString msId; rtl::OUString msId;
rtl::OUString msURL; rtl::OUString msURL;
...@@ -52,7 +52,7 @@ public: ...@@ -52,7 +52,7 @@ public:
XFormsInstanceContext( SvXMLImport& rImport, XFormsInstanceContext( SvXMLImport& rImport,
sal_uInt16 nPrfx, sal_uInt16 nPrfx,
const ::rtl::OUString& rLName, const ::rtl::OUString& rLName,
com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> xModel ); const com::sun::star::uno::Reference<com::sun::star::xforms::XModel2> & xModel );
virtual ~XFormsInstanceContext(); virtual ~XFormsInstanceContext();
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/xml/dom/XDocument.hpp> #include <com/sun/star/xml/dom/XDocument.hpp>
#include <com/sun/star/util/XUpdatable.hpp> #include <com/sun/star/util/XUpdatable.hpp>
#include <com/sun/star/xforms/XModel.hpp> #include <com/sun/star/xforms/XModel2.hpp>
using rtl::OUString; using rtl::OUString;
...@@ -78,7 +78,7 @@ XFormsModelContext::~XFormsModelContext() ...@@ -78,7 +78,7 @@ XFormsModelContext::~XFormsModelContext()
} }
Reference<XPropertySet> XFormsModelContext::getModel() Reference<css::xforms::XModel2> XFormsModelContext::getModel()
{ {
return mxModel; return mxModel;
} }
...@@ -126,10 +126,7 @@ SvXMLImportContext* XFormsModelContext::HandleChild( ...@@ -126,10 +126,7 @@ SvXMLImportContext* XFormsModelContext::HandleChild(
break; break;
case XML_SCHEMA: case XML_SCHEMA:
pContext = new SchemaContext( pContext = new SchemaContext(
GetImport(), nPrefix, rLocalName, GetImport(), nPrefix, rLocalName, mxModel->getDataTypeRepository() );
Reference<com::sun::star::xforms::XModel>( mxModel,
UNO_QUERY_THROW )
->getDataTypeRepository() );
break; break;
default: default:
OSL_FAIL( "Boooo!" ); OSL_FAIL( "Boooo!" );
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "TokenContext.hxx" #include "TokenContext.hxx"
#include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/xforms/XModel2.hpp>
// //
...@@ -39,7 +40,7 @@ class SvXMLImportContext; ...@@ -39,7 +40,7 @@ class SvXMLImportContext;
/** import the xforms:model element */ /** import the xforms:model element */
class XFormsModelContext : public TokenContext class XFormsModelContext : public TokenContext
{ {
com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> mxModel; com::sun::star::uno::Reference<com::sun::star::xforms::XModel2> mxModel;
public: public:
...@@ -48,7 +49,7 @@ public: ...@@ -48,7 +49,7 @@ public:
const ::rtl::OUString& rLName ); const ::rtl::OUString& rLName );
virtual ~XFormsModelContext(); virtual ~XFormsModelContext();
com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> getModel(); com::sun::star::uno::Reference<com::sun::star::xforms::XModel2> getModel();
// //
// implement SvXMLImportContext & TokenContext methods: // implement SvXMLImportContext & TokenContext methods:
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include <sax/tools/converter.hxx> #include <sax/tools/converter.hxx>
#include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/xforms/XModel.hpp> #include <com/sun/star/xforms/XModel2.hpp>
#include <tools/debug.hxx> #include <tools/debug.hxx>
...@@ -40,7 +40,7 @@ using rtl::OUString; ...@@ -40,7 +40,7 @@ using rtl::OUString;
using com::sun::star::beans::XPropertySet; using com::sun::star::beans::XPropertySet;
using com::sun::star::container::XNameContainer; using com::sun::star::container::XNameContainer;
using com::sun::star::xml::sax::XAttributeList; using com::sun::star::xml::sax::XAttributeList;
using com::sun::star::xforms::XModel; using com::sun::star::xforms::XModel2;
using namespace com::sun::star::uno; using namespace com::sun::star::uno;
using namespace xmloff::token; using namespace xmloff::token;
...@@ -72,17 +72,15 @@ XFormsSubmissionContext::XFormsSubmissionContext( ...@@ -72,17 +72,15 @@ XFormsSubmissionContext::XFormsSubmissionContext(
SvXMLImport& rImport, SvXMLImport& rImport,
sal_uInt16 nPrefix, sal_uInt16 nPrefix,
const OUString& rLocalName, const OUString& rLocalName,
const Reference<XPropertySet>& xModel ) : const Reference<XModel2>& xModel ) :
TokenContext( rImport, nPrefix, rLocalName, aAttributeMap, aEmptyMap ), TokenContext( rImport, nPrefix, rLocalName, aAttributeMap, aEmptyMap ),
mxSubmission() mxSubmission()
{ {
// register submission with model // register submission with model
DBG_ASSERT( xModel.is(), "need model" ); DBG_ASSERT( xModel.is(), "need model" );
Reference<XModel> xXModel( xModel, UNO_QUERY ); mxSubmission = xModel->createSubmission().get();
DBG_ASSERT( xXModel.is(), "need XModel" );
mxSubmission = xXModel->createSubmission().get();
DBG_ASSERT( mxSubmission.is(), "can't create submission" ); DBG_ASSERT( mxSubmission.is(), "can't create submission" );
xXModel->getSubmissions()->insert( makeAny( mxSubmission ) ); xModel->getSubmissions()->insert( makeAny( mxSubmission ) );
} }
XFormsSubmissionContext::~XFormsSubmissionContext() XFormsSubmissionContext::~XFormsSubmissionContext()
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
namespace com { namespace sun { namespace star { namespace com { namespace sun { namespace star {
namespace xml { namespace sax { class XAttributeList; } } namespace xml { namespace sax { class XAttributeList; } }
namespace beans { class XPropertySet; } namespace beans { class XPropertySet; }
namespace xforms { class XModel2; }
} } } } } }
namespace rtl { class OUString; } namespace rtl { class OUString; }
class SvXMLImport; class SvXMLImport;
...@@ -47,7 +48,7 @@ public: ...@@ -47,7 +48,7 @@ public:
XFormsSubmissionContext( SvXMLImport& rImport, XFormsSubmissionContext( SvXMLImport& rImport,
sal_uInt16 nPrefix, sal_uInt16 nPrefix,
const rtl::OUString& rLocalName, const rtl::OUString& rLocalName,
const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xModel ); const com::sun::star::uno::Reference<com::sun::star::xforms::XModel2>& xModel );
virtual ~XFormsSubmissionContext(); virtual ~XFormsSubmissionContext();
......
...@@ -26,7 +26,8 @@ ...@@ -26,7 +26,8 @@
#include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/xforms/XFormsSupplier.hpp> #include <com/sun/star/xforms/XFormsSupplier.hpp>
#include <com/sun/star/xforms/XDataTypeRepository.hpp> #include <com/sun/star/xforms/XDataTypeRepository.hpp>
#include <com/sun/star/xforms/XModel.hpp> #include <com/sun/star/xforms/Model.hpp>
#include <com/sun/star/xforms/XModel2.hpp>
#include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/xsd/DataTypeClass.hpp> #include <com/sun/star/xsd/DataTypeClass.hpp>
...@@ -48,8 +49,9 @@ using com::sun::star::container::XNameAccess; ...@@ -48,8 +49,9 @@ using com::sun::star::container::XNameAccess;
using com::sun::star::lang::XMultiServiceFactory; using com::sun::star::lang::XMultiServiceFactory;
using com::sun::star::xforms::XFormsSupplier; using com::sun::star::xforms::XFormsSupplier;
using com::sun::star::xforms::XDataTypeRepository; using com::sun::star::xforms::XDataTypeRepository;
using com::sun::star::xforms::Model;
using com::sun::star::xforms::XModel2;
using com::sun::star::container::XNameContainer; using com::sun::star::container::XNameContainer;
using comphelper::getProcessServiceFactory;
using com::sun::star::uno::makeAny; using com::sun::star::uno::makeAny;
using com::sun::star::uno::Any; using com::sun::star::uno::Any;
using com::sun::star::uno::Exception; using com::sun::star::uno::Exception;
...@@ -57,26 +59,16 @@ using com::sun::star::uno::Exception; ...@@ -57,26 +59,16 @@ using com::sun::star::uno::Exception;
using namespace com::sun::star; using namespace com::sun::star;
using namespace xmloff::token; using namespace xmloff::token;
static Reference<XPropertySet> lcl_createPropertySet( const OUString& rServiceName ) Reference<XModel2> xforms_createXFormsModel()
{ {
Reference<XMultiServiceFactory> xFactory = getProcessServiceFactory(); Reference<XModel2> xModel = Model::create( comphelper::getProcessComponentContext() );
DBG_ASSERT( xFactory.is(), "can't get service factory" );
Reference<XPropertySet> xModel( xFactory->createInstance( rServiceName ),
UNO_QUERY_THROW );
DBG_ASSERT( xModel.is(), "can't create model" );
return xModel; return xModel;
} }
Reference<XPropertySet> xforms_createXFormsModel()
{
return lcl_createPropertySet( "com.sun.star.xforms.Model" );
}
void xforms_addXFormsModel( void xforms_addXFormsModel(
const Reference<frame::XModel>& xDocument, const Reference<frame::XModel>& xDocument,
const Reference<XPropertySet>& xModel ) const Reference<xforms::XModel2>& xModel )
{ {
bool bSuccess = false; bool bSuccess = false;
try try
...@@ -129,7 +121,7 @@ static Reference<XPropertySet> lcl_findXFormsBindingOrSubmission( ...@@ -129,7 +121,7 @@ static Reference<XPropertySet> lcl_findXFormsBindingOrSubmission(
sal_Int32 nNames = aNames.getLength(); sal_Int32 nNames = aNames.getLength();
for( sal_Int32 n = 0; (n < nNames) && !xRet.is(); n++ ) for( sal_Int32 n = 0; (n < nNames) && !xRet.is(); n++ )
{ {
Reference<xforms::XModel> xModel( Reference<xforms::XModel2> xModel(
xForms->getByName( pNames[n] ), UNO_QUERY ); xForms->getByName( pNames[n] ), UNO_QUERY );
if( xModel.is() ) if( xModel.is() )
{ {
......
...@@ -31,15 +31,15 @@ namespace com { namespace sun { namespace star { ...@@ -31,15 +31,15 @@ namespace com { namespace sun { namespace star {
namespace beans { class XPropertySet; } namespace beans { class XPropertySet; }
namespace frame { class XModel; } namespace frame { class XModel; }
namespace uno { template<class A> class Reference; } namespace uno { template<class A> class Reference; }
namespace xforms { class XDataTypeRepository; } namespace xforms { class XDataTypeRepository; class XModel2; }
} } } } } }
class SvXMLNamespaceMap; class SvXMLNamespaceMap;
com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> xforms_createXFormsModel(); com::sun::star::uno::Reference<com::sun::star::xforms::XModel2> xforms_createXFormsModel();
void xforms_addXFormsModel( void xforms_addXFormsModel(
const com::sun::star::uno::Reference<com::sun::star::frame::XModel>& xDocument, const com::sun::star::uno::Reference<com::sun::star::frame::XModel>& xDocument,
const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xModel ); const com::sun::star::uno::Reference<com::sun::star::xforms::XModel2>& xModel );
com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> xforms_findXFormsBinding( com::sun::star::uno::Reference<com::sun::star::frame::XModel>&, const rtl::OUString& ); com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> xforms_findXFormsBinding( com::sun::star::uno::Reference<com::sun::star::frame::XModel>&, const rtl::OUString& );
......
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