summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-03-01 16:32:32 +0200
committerNoel Grandin <noel@peralex.com>2013-03-04 10:13:20 +0200
commitb313e37a92a18bc663ea5eb97ea0a569c6b0a962 (patch)
treed23b3a673046bfe4dbb78d145aab4e9f425b8860
parentfb0f7c2415321a3bcae00802b98ae76144ea4e79 (diff)
fdo#46808, convert xforms::Model to new style
the service already existed, it just needed an IDL file. Change-Id: Id8f33183d9332f9defd855b3a3c7413fde24a61b
-rw-r--r--forms/source/xforms/model.hxx32
-rw-r--r--forms/source/xforms/xforms_services.cxx2
-rw-r--r--offapi/UnoApi_offapi.mk4
-rw-r--r--offapi/com/sun/star/xforms/Model.idl37
-rw-r--r--offapi/com/sun/star/xforms/XModel2.idl44
-rw-r--r--sw/source/core/doc/docxforms.cxx25
-rw-r--r--xmloff/source/xforms/XFormsBindContext.cxx8
-rw-r--r--xmloff/source/xforms/XFormsBindContext.hxx6
-rw-r--r--xmloff/source/xforms/XFormsInstanceContext.cxx8
-rw-r--r--xmloff/source/xforms/XFormsInstanceContext.hxx6
-rw-r--r--xmloff/source/xforms/XFormsModelContext.cxx9
-rw-r--r--xmloff/source/xforms/XFormsModelContext.hxx5
-rw-r--r--xmloff/source/xforms/XFormsSubmissionContext.cxx12
-rw-r--r--xmloff/source/xforms/XFormsSubmissionContext.hxx3
-rw-r--r--xmloff/source/xforms/xformsapi.cxx24
-rw-r--r--xmloff/source/xforms/xformsapi.hxx6
16 files changed, 164 insertions, 67 deletions
diff --git a/forms/source/xforms/model.hxx b/forms/source/xforms/model.hxx
index acbeff46366d..2e989ab1aa87 100644
--- a/forms/source/xforms/model.hxx
+++ b/forms/source/xforms/model.hxx
@@ -22,7 +22,7 @@
#include <cppuhelper/implbase4.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/util/XUpdatable.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -68,7 +68,7 @@ namespace xforms
*/
typedef cppu::ImplInheritanceHelper4<
PropertySetBase,
- com::sun::star::xforms::XModel,
+ com::sun::star::xforms::XModel2,
com::sun::star::xforms::XFormsUIHelper1,
com::sun::star::util::XUpdatable,
com::sun::star::lang::XUnoTunnel
@@ -281,7 +281,35 @@ public:
virtual XSet_t SAL_CALL getSubmissions()
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:
diff --git a/forms/source/xforms/xforms_services.cxx b/forms/source/xforms/xforms_services.cxx
index da09e6a911f1..7e03f9967239 100644
--- a/forms/source/xforms/xforms_services.cxx
+++ b/forms/source/xforms/xforms_services.cxx
@@ -46,7 +46,7 @@ Reference<XInterface> Model_CreateInstance(
const Reference<XMultiServiceFactory>& )
throw( RuntimeException )
{
- return static_cast<XPropertySet*>( new xforms::Model );
+ return static_cast<XPropertySet*>( static_cast<PropertySetBase*>( new xforms::Model ) );
}
Reference<XInterface> XForms_CreateInstance(
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 6877658c4f5c..3f2f28782539 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -366,6 +366,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/util,\
UriAbbreviation \
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,\
NSSInitializer \
SEInitializer \
@@ -4072,6 +4075,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/xforms,\
XFormsSupplier \
XFormsUIHelper1 \
XModel \
+ XModel2 \
XSubmission \
))
$(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/xml,\
diff --git a/offapi/com/sun/star/xforms/Model.idl b/offapi/com/sun/star/xforms/Model.idl
new file mode 100644
index 000000000000..186ae88911fb
--- /dev/null
+++ b/offapi/com/sun/star/xforms/Model.idl
@@ -0,0 +1,37 @@
+/* -*- 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: */
diff --git a/offapi/com/sun/star/xforms/XModel2.idl b/offapi/com/sun/star/xforms/XModel2.idl
new file mode 100644
index 000000000000..ec1704d5e8f6
--- /dev/null
+++ b/offapi/com/sun/star/xforms/XModel2.idl
@@ -0,0 +1,44 @@
+/* -*- 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: */
diff --git a/sw/source/core/doc/docxforms.cxx b/sw/source/core/doc/docxforms.cxx
index e027adc802bf..6841e9730822 100644
--- a/sw/source/core/doc/docxforms.cxx
+++ b/sw/source/core/doc/docxforms.cxx
@@ -23,7 +23,8 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.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 <comphelper/processfactory.hxx>
#include <tools/diagnose_ex.h>
@@ -37,7 +38,7 @@ using uno::UNO_QUERY;
using uno::makeAny;
using uno::Exception;
using container::XNameContainer;
-using xforms::XModel;
+using xforms::XModel2;
using frame::XModule;
using xforms::XFormsUIHelper1;
using ::rtl::OUString;
@@ -84,19 +85,13 @@ void SwDoc::initXForms( bool bCreateDefaultModel )
if( bCreateDefaultModel && mxXForms.is() )
{
OUString sName("Model 1");
- Reference<XModel> xModel(
- lcl_createInstance( "com.sun.star.xforms.Model" ),
- UNO_QUERY );
- OSL_ENSURE( xModel.is(), "no model?" );
- if( xModel.is() )
- {
- xModel->setID( sName );
- Reference<XFormsUIHelper1>( xModel, UNO_QUERY )->newInstance(
- OUString("Instance 1"),
- OUString(), sal_True );
- xModel->initialize();
- mxXForms->insertByName( sName, makeAny( xModel ) );
- }
+ Reference<XModel2> xModel = xforms::Model::create( comphelper::getProcessComponentContext() );
+ xModel->setID( sName );
+ Reference<XFormsUIHelper1>( xModel, uno::UNO_QUERY_THROW )->newInstance(
+ OUString("Instance 1"),
+ OUString(), sal_True );
+ xModel->initialize();
+ mxXForms->insertByName( sName, makeAny( xModel ) );
OSL_ENSURE( mxXForms->hasElements(), "can't create XForms model" );
}
diff --git a/xmloff/source/xforms/XFormsBindContext.cxx b/xmloff/source/xforms/XFormsBindContext.cxx
index eee251b22b9c..452156c65e85 100644
--- a/xmloff/source/xforms/XFormsBindContext.cxx
+++ b/xmloff/source/xforms/XFormsBindContext.cxx
@@ -30,7 +30,7 @@
#include <xmloff/nmspmap.hxx>
#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>
@@ -42,7 +42,7 @@ using com::sun::star::uno::UNO_QUERY;
using com::sun::star::uno::UNO_QUERY_THROW;
using com::sun::star::container::XNameContainer;
using com::sun::star::xml::sax::XAttributeList;
-using com::sun::star::xforms::XModel;
+using com::sun::star::xforms::XModel2;
using namespace xmloff::token;
@@ -69,9 +69,9 @@ XFormsBindContext::XFormsBindContext(
SvXMLImport& rImport,
sal_uInt16 nPrefix,
const OUString& rLocalName,
- const Reference<XPropertySet>& xModel ) :
+ const Reference<XModel2>& xModel ) :
TokenContext( rImport, nPrefix, rLocalName, aAttributeMap, aEmptyMap ),
- mxModel( xModel, UNO_QUERY_THROW ),
+ mxModel( xModel ),
mxBinding( NULL )
{
// attach binding to model
diff --git a/xmloff/source/xforms/XFormsBindContext.hxx b/xmloff/source/xforms/XFormsBindContext.hxx
index 0de4cdb2ee65..d376c60f7db3 100644
--- a/xmloff/source/xforms/XFormsBindContext.hxx
+++ b/xmloff/source/xforms/XFormsBindContext.hxx
@@ -31,7 +31,7 @@
namespace com { namespace sun { namespace star {
namespace xml { namespace sax { class XAttributeList; } }
namespace beans { class XPropertySet; }
- namespace xforms { class XModel; }
+ namespace xforms { class XModel2; }
} } }
namespace rtl { class OUString; }
class SvXMLImport;
@@ -41,7 +41,7 @@ class SvXMLImportContext;
/** import the xforms:binding element */
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;
public:
@@ -49,7 +49,7 @@ public:
XFormsBindContext( SvXMLImport& rImport,
sal_uInt16 nPrefix,
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();
diff --git a/xmloff/source/xforms/XFormsInstanceContext.cxx b/xmloff/source/xforms/XFormsInstanceContext.cxx
index e004bf83e54d..abfa9326cdc4 100644
--- a/xmloff/source/xforms/XFormsInstanceContext.cxx
+++ b/xmloff/source/xforms/XFormsInstanceContext.cxx
@@ -28,7 +28,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyValue.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 <xmloff/xmlnmspe.hxx>
@@ -43,7 +43,7 @@ using com::sun::star::uno::Reference;
using com::sun::star::uno::makeAny;
using com::sun::star::uno::UNO_QUERY;
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::PropertyValue;
using com::sun::star::xml::sax::XAttributeList;
@@ -64,9 +64,9 @@ XFormsInstanceContext::XFormsInstanceContext(
SvXMLImport& rImport,
sal_uInt16 nPrefix,
const OUString& rLocalName,
- Reference<XPropertySet> xModel ) :
+ const Reference<XModel2> & xModel ) :
TokenContext( rImport, nPrefix, rLocalName, aAttributes, aEmptyMap ),
- mxModel( Reference<XModel>( xModel, UNO_QUERY ) )
+ mxModel( xModel )
{
DBG_ASSERT( mxModel.is(), "need model" );
}
diff --git a/xmloff/source/xforms/XFormsInstanceContext.hxx b/xmloff/source/xforms/XFormsInstanceContext.hxx
index 631c8f9c80cf..30b50c2176e5 100644
--- a/xmloff/source/xforms/XFormsInstanceContext.hxx
+++ b/xmloff/source/xforms/XFormsInstanceContext.hxx
@@ -32,7 +32,7 @@ namespace com { namespace sun { namespace star {
namespace xml { namespace sax { class XAttributeList; } }
namespace xml { namespace dom { class XDocument; } }
namespace beans { class XPropertySet; }
- namespace xforms { class XModel; }
+ namespace xforms { class XModel2; }
} } }
namespace rtl { class OUString; }
class SvXMLImport;
@@ -42,7 +42,7 @@ class SvXMLImportContext;
/** import the xforms:instance element */
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;
rtl::OUString msId;
rtl::OUString msURL;
@@ -52,7 +52,7 @@ public:
XFormsInstanceContext( SvXMLImport& rImport,
sal_uInt16 nPrfx,
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();
diff --git a/xmloff/source/xforms/XFormsModelContext.cxx b/xmloff/source/xforms/XFormsModelContext.cxx
index 3a47de572501..0cccc425188b 100644
--- a/xmloff/source/xforms/XFormsModelContext.cxx
+++ b/xmloff/source/xforms/XFormsModelContext.cxx
@@ -35,7 +35,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/xml/dom/XDocument.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;
@@ -78,7 +78,7 @@ XFormsModelContext::~XFormsModelContext()
}
-Reference<XPropertySet> XFormsModelContext::getModel()
+Reference<css::xforms::XModel2> XFormsModelContext::getModel()
{
return mxModel;
}
@@ -126,10 +126,7 @@ SvXMLImportContext* XFormsModelContext::HandleChild(
break;
case XML_SCHEMA:
pContext = new SchemaContext(
- GetImport(), nPrefix, rLocalName,
- Reference<com::sun::star::xforms::XModel>( mxModel,
- UNO_QUERY_THROW )
- ->getDataTypeRepository() );
+ GetImport(), nPrefix, rLocalName, mxModel->getDataTypeRepository() );
break;
default:
OSL_FAIL( "Boooo!" );
diff --git a/xmloff/source/xforms/XFormsModelContext.hxx b/xmloff/source/xforms/XFormsModelContext.hxx
index acbb99d8e43e..9339bc59eccd 100644
--- a/xmloff/source/xforms/XFormsModelContext.hxx
+++ b/xmloff/source/xforms/XFormsModelContext.hxx
@@ -22,6 +22,7 @@
#include "TokenContext.hxx"
#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/xforms/XModel2.hpp>
//
@@ -39,7 +40,7 @@ class SvXMLImportContext;
/** import the xforms:model element */
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:
@@ -48,7 +49,7 @@ public:
const ::rtl::OUString& rLName );
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:
diff --git a/xmloff/source/xforms/XFormsSubmissionContext.cxx b/xmloff/source/xforms/XFormsSubmissionContext.cxx
index 7ad50a6a7bdf..23e470cdf619 100644
--- a/xmloff/source/xforms/XFormsSubmissionContext.cxx
+++ b/xmloff/source/xforms/XFormsSubmissionContext.cxx
@@ -32,7 +32,7 @@
#include <sax/tools/converter.hxx>
#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>
@@ -40,7 +40,7 @@ using rtl::OUString;
using com::sun::star::beans::XPropertySet;
using com::sun::star::container::XNameContainer;
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 xmloff::token;
@@ -72,17 +72,15 @@ XFormsSubmissionContext::XFormsSubmissionContext(
SvXMLImport& rImport,
sal_uInt16 nPrefix,
const OUString& rLocalName,
- const Reference<XPropertySet>& xModel ) :
+ const Reference<XModel2>& xModel ) :
TokenContext( rImport, nPrefix, rLocalName, aAttributeMap, aEmptyMap ),
mxSubmission()
{
// register submission with model
DBG_ASSERT( xModel.is(), "need model" );
- Reference<XModel> xXModel( xModel, UNO_QUERY );
- DBG_ASSERT( xXModel.is(), "need XModel" );
- mxSubmission = xXModel->createSubmission().get();
+ mxSubmission = xModel->createSubmission().get();
DBG_ASSERT( mxSubmission.is(), "can't create submission" );
- xXModel->getSubmissions()->insert( makeAny( mxSubmission ) );
+ xModel->getSubmissions()->insert( makeAny( mxSubmission ) );
}
XFormsSubmissionContext::~XFormsSubmissionContext()
diff --git a/xmloff/source/xforms/XFormsSubmissionContext.hxx b/xmloff/source/xforms/XFormsSubmissionContext.hxx
index 6636d7bd6765..0c56d8bec171 100644
--- a/xmloff/source/xforms/XFormsSubmissionContext.hxx
+++ b/xmloff/source/xforms/XFormsSubmissionContext.hxx
@@ -31,6 +31,7 @@
namespace com { namespace sun { namespace star {
namespace xml { namespace sax { class XAttributeList; } }
namespace beans { class XPropertySet; }
+ namespace xforms { class XModel2; }
} } }
namespace rtl { class OUString; }
class SvXMLImport;
@@ -47,7 +48,7 @@ public:
XFormsSubmissionContext( SvXMLImport& rImport,
sal_uInt16 nPrefix,
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();
diff --git a/xmloff/source/xforms/xformsapi.cxx b/xmloff/source/xforms/xformsapi.cxx
index 7a6a6066088e..b73af0ab43ca 100644
--- a/xmloff/source/xforms/xformsapi.cxx
+++ b/xmloff/source/xforms/xformsapi.cxx
@@ -26,7 +26,8 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/xforms/XFormsSupplier.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/xsd/DataTypeClass.hpp>
@@ -48,8 +49,9 @@ using com::sun::star::container::XNameAccess;
using com::sun::star::lang::XMultiServiceFactory;
using com::sun::star::xforms::XFormsSupplier;
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 comphelper::getProcessServiceFactory;
using com::sun::star::uno::makeAny;
using com::sun::star::uno::Any;
using com::sun::star::uno::Exception;
@@ -57,26 +59,16 @@ using com::sun::star::uno::Exception;
using namespace com::sun::star;
using namespace xmloff::token;
-static Reference<XPropertySet> lcl_createPropertySet( const OUString& rServiceName )
+Reference<XModel2> xforms_createXFormsModel()
{
- Reference<XMultiServiceFactory> xFactory = getProcessServiceFactory();
- 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" );
+ Reference<XModel2> xModel = Model::create( comphelper::getProcessComponentContext() );
return xModel;
}
-Reference<XPropertySet> xforms_createXFormsModel()
-{
- return lcl_createPropertySet( "com.sun.star.xforms.Model" );
-}
-
void xforms_addXFormsModel(
const Reference<frame::XModel>& xDocument,
- const Reference<XPropertySet>& xModel )
+ const Reference<xforms::XModel2>& xModel )
{
bool bSuccess = false;
try
@@ -129,7 +121,7 @@ static Reference<XPropertySet> lcl_findXFormsBindingOrSubmission(
sal_Int32 nNames = aNames.getLength();
for( sal_Int32 n = 0; (n < nNames) && !xRet.is(); n++ )
{
- Reference<xforms::XModel> xModel(
+ Reference<xforms::XModel2> xModel(
xForms->getByName( pNames[n] ), UNO_QUERY );
if( xModel.is() )
{
diff --git a/xmloff/source/xforms/xformsapi.hxx b/xmloff/source/xforms/xformsapi.hxx
index b9e0e10ab646..75115b90c1e0 100644
--- a/xmloff/source/xforms/xformsapi.hxx
+++ b/xmloff/source/xforms/xformsapi.hxx
@@ -31,15 +31,15 @@ namespace com { namespace sun { namespace star {
namespace beans { class XPropertySet; }
namespace frame { class XModel; }
namespace uno { template<class A> class Reference; }
- namespace xforms { class XDataTypeRepository; }
+ namespace xforms { class XDataTypeRepository; class XModel2; }
} } }
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(
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& );