diff options
author | Noel Grandin <noel@peralex.com> | 2013-03-01 16:32:32 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-03-04 10:13:20 +0200 |
commit | b313e37a92a18bc663ea5eb97ea0a569c6b0a962 (patch) | |
tree | d23b3a673046bfe4dbb78d145aab4e9f425b8860 /sw/source/core/doc/docxforms.cxx | |
parent | fb0f7c2415321a3bcae00802b98ae76144ea4e79 (diff) |
fdo#46808, convert xforms::Model to new style
the service already existed, it just needed an IDL file.
Change-Id: Id8f33183d9332f9defd855b3a3c7413fde24a61b
Diffstat (limited to 'sw/source/core/doc/docxforms.cxx')
-rw-r--r-- | sw/source/core/doc/docxforms.cxx | 25 |
1 files changed, 10 insertions, 15 deletions
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" ); } |