diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index f464ebf1c8f4..f8a2f6562027 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -2073,7 +2073,7 @@ Reference< XComponent > OApplicationController::newElement( ElementType _eType, if ( !aHelper->isConnected() ) break; - xComponent = aHelper->newDocument( _eType == E_FORM ? ID_FORM_NEW_TEXT : ID_REPORT_NEW_TEXT, xDefinition ); + xComponent = aHelper->newDocument( _eType == E_FORM ? ID_FORM_NEW_TEXT : ID_REPORT_NEW_TEXT, i_rAdditionalArguments, xDefinition ); } break; diff --git a/dbaccess/source/ui/inc/linkeddocuments.hxx b/dbaccess/source/ui/inc/linkeddocuments.hxx index c836121e8c60..e7030312cde6 100644 --- a/dbaccess/source/ui/inc/linkeddocuments.hxx +++ b/dbaccess/source/ui/inc/linkeddocuments.hxx @@ -113,8 +113,9 @@ namespace dbaui ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > newDocument( - sal_Int32 _nNewFormId, - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>& _xDefinition + sal_Int32 i_nActionID, + const ::comphelper::NamedValueCollection& i_rCreationArgs, + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_rDefinition ); ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx index 13fcc8a1f0d8..70f297f621f4 100644 --- a/dbaccess/source/ui/misc/linkeddocuments.cxx +++ b/dbaccess/source/ui/misc/linkeddocuments.cxx @@ -348,12 +348,13 @@ namespace dbaui return impl_newWithPilot( "com.sun.star.wizards.query.CallQueryWizard", xDefinition, -1, ::rtl::OUString() ); } //------------------------------------------------------------------ - Reference< XComponent > OLinkedDocumentsAccess::newDocument( sal_Int32 _nNewFormId, Reference< XComponent >& _xDefinition ) + Reference< XComponent > OLinkedDocumentsAccess::newDocument( sal_Int32 i_nActionID, + const ::comphelper::NamedValueCollection& i_rCreationArgs, Reference< XComponent >& o_rDefinition ) { OSL_ENSURE(m_xDocumentContainer.is(), "OLinkedDocumentsAccess::OLinkedDocumentsAccess: invalid document container!"); // determine the URL to use for the new document Sequence aClassId; - switch (_nNewFormId) + switch ( i_nActionID ) { case ID_FORM_NEW_TEXT: aClassId = lcl_GetSequenceClassID(SO3_SW_CLASSID); @@ -372,9 +373,8 @@ namespace dbaui aClassId = comphelper::MimeConfigurationHelper::GetSequenceClassID(SO3_RPT_CLASSID_90); break; - case SID_DB_FORM_NEW_PILOT: default: - OSL_ENSURE(sal_False, "OLinkedDocumentsAccess::newForm: pleas use newFormWithPilot!"); + OSL_ENSURE( sal_False, "OLinkedDocumentsAccess::newForm: please use newFormWithPilot!" ); return Reference< XComponent >(); } @@ -386,30 +386,25 @@ namespace dbaui Reference xORB(m_xDocumentContainer,UNO_QUERY); if ( xORB.is() ) { - Sequence< Any > aArguments(2); + ::comphelper::NamedValueCollection aCreationArgs( i_rCreationArgs ); + aCreationArgs.put( "ClassID", aClassId ); + aCreationArgs.put( (::rtl::OUString)PROPERTY_ACTIVE_CONNECTION, m_xConnection ); - PropertyValue aValue; + Reference< XCommandProcessor > xContent( xORB->createInstanceWithArguments( + SERVICE_SDB_DOCUMENTDEFINITION, + aCreationArgs.getWrappedPropertyValues() + ), + UNO_QUERY_THROW + ); - aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ClassID")); - aValue.Value <<= aClassId; - aArguments[0] <<= aValue; - - aValue.Name = PROPERTY_ACTIVE_CONNECTION; - aValue.Value <<= m_xConnection; - aArguments[1] <<= aValue; - - Reference xContent(xORB->createInstanceWithArguments(SERVICE_SDB_DOCUMENTDEFINITION,aArguments),UNO_QUERY); - if ( xContent.is() ) - { - _xDefinition.set(xContent,UNO_QUERY); - Command aCommand; - aCommand.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("openDesign")); - OpenCommandArgument2 aOpenCommand; - aOpenCommand.Mode = OpenMode::DOCUMENT; - aCommand.Argument <<= aOpenCommand; - WaitObject aWaitCursor( m_pDialogParent ); - xNewDocument.set(xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference< XCommandEnvironment >()),UNO_QUERY); - } + o_rDefinition.set( xContent, UNO_QUERY ); + Command aCommand; + aCommand.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "openDesign" ) ); + OpenCommandArgument2 aOpenCommand; + aOpenCommand.Mode = OpenMode::DOCUMENT; + aCommand.Argument <<= aOpenCommand; + WaitObject aWaitCursor( m_pDialogParent ); + xNewDocument.set( xContent->execute( aCommand, xContent->createCommandIdentifier(), NULL ), UNO_QUERY ); } } catch(const Exception& )