User: vg Date: 05/03/10 08:52:25 Modified: /dba/dbaccess/source/ui/misc/ linkeddocuments.cxx
Log: INTEGRATION: CWS dba24 (1.12.4); FILE MERGED 2005/02/07 13:05:56 oj 1.12.4.1: #i42200# some little changes how to start a wizard File Changes: Directory: /dba/dbaccess/source/ui/misc/ ======================================== File [changed]: linkeddocuments.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/linkeddocuments.cxx?r1=1.12&r2=1.13 Delta lines: +26 -92 --------------------- --- linkeddocuments.cxx 21 Jan 2005 17:21:05 -0000 1.12 +++ linkeddocuments.cxx 10 Mar 2005 16:52:22 -0000 1.13 @@ -214,12 +214,14 @@ OLinkedDocumentsAccess::OLinkedDocumentsAccess(Window* _pDialogParent , const Reference< XMultiServiceFactory >& _rxORB , const Reference< XNameAccess >& _rxContainer - ,const Reference< XConnection>& _xConnection + , const Reference< XConnection>& _xConnection + , const ::rtl::OUString& _sDataSourceName ) :m_xORB(_rxORB) ,m_xDocumentContainer(_rxContainer) ,m_pDialogParent(_pDialogParent) ,m_xConnection(_xConnection) + ,m_sDataSourceName(_sDataSourceName) { OSL_ENSURE(m_xORB.is(), "OLinkedDocumentsAccess::OLinkedDocumentsAccess: invalid service factory!"); OSL_ENSURE(m_pDialogParent, "OLinkedDocumentsAccess::OLinkedDocumentsAccess: really need a dialog parent!"); @@ -287,24 +289,26 @@ return xRet; } //------------------------------------------------------------------ - sal_Bool OLinkedDocumentsAccess::newFormWithPilot(const String& _rDataSourceName, const sal_Int32 _nCommandType, - const String& _rObjectName, const Reference< XConnection >& _rxConnection) + void OLinkedDocumentsAccess::newWithPilot(const char* _pWizardService + , const sal_Int32 _nCommandType + , const ::rtl::OUString& _rObjectName + ) { try { ::svx::ODataAccessDescriptor aDesc; - aDesc.setDataSource(::rtl::OUString(_rDataSourceName)); + aDesc.setDataSource(m_sDataSourceName); if ( _nCommandType != -1 ) aDesc[::svx::daCommandType] <<= _nCommandType; - if ( _rObjectName.Len() ) - aDesc[::svx::daCommand] <<= ::rtl::OUString(_rObjectName); - if ( _rxConnection.is() ) - aDesc[::svx::daConnection] <<= _rxConnection; + if ( _rObjectName.getLength() ) + aDesc[::svx::daCommand] <<= _rObjectName; + if ( m_xConnection.is() ) + aDesc[::svx::daConnection] <<= m_xConnection; Reference< XJobExecutor > xFormWizard; { WaitObject aWaitCursor( m_pDialogParent ); - xFormWizard.set(m_xORB->createInstanceWithArguments(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.wizards.form.CallFormWizard")),aDesc.createAnySequence()),UNO_QUERY); + xFormWizard.set(m_xORB->createInstanceWithArguments(::rtl::OUString::createFromAscii(_pWizardService),aDesc.createAnySequence()),UNO_QUERY); } if ( xFormWizard.is() ) xFormWizard->trigger(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("start"))); @@ -312,99 +316,29 @@ } catch(const Exception&) { - OSL_ENSURE(sal_False, "OLinkedDocumentsAccess::newReport: caught an exception while loading the object!"); + OSL_ENSURE(sal_False, "OLinkedDocumentsAccess::newWithPilot: caught an exception while loading the object!"); } - return sal_True; } - //------------------------------------------------------------------ - sal_Bool OLinkedDocumentsAccess::newReportWithPilot(const String& _rDataSourceName, const sal_Int32 _nCommandType, - const String& _rObjectName, const Reference< XConnection >& _rxConnection) - { - try - { - ::svx::ODataAccessDescriptor aDesc; - aDesc.setDataSource(::rtl::OUString(_rDataSourceName)); - if ( _nCommandType != -1 ) - aDesc[::svx::daCommandType] <<= _nCommandType; - if ( _rObjectName.Len() ) - aDesc[::svx::daCommand] <<= ::rtl::OUString(_rObjectName); - if ( _rxConnection.is() ) - aDesc[::svx::daConnection] <<= _rxConnection; - - Reference< XJobExecutor > xReportWizard; - { - WaitObject aWaitCursor( m_pDialogParent ); - xReportWizard.set(m_xORB->createInstanceWithArguments(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.wizards.report.CallReportWizard")),aDesc.createAnySequence()),UNO_QUERY); - } - if ( xReportWizard.is() ) - xReportWizard->trigger(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("start"))); - - } - catch(const Exception&) + void OLinkedDocumentsAccess::newFormWithPilot(const sal_Int32 _nCommandType,const ::rtl::OUString& _rObjectName) { - OSL_ENSURE(sal_False, "OLinkedDocumentsAccess::newReport: caught an exception while loading the object!"); - } - return sal_True; + newWithPilot("com.sun.star.wizards.form.CallFormWizard",_nCommandType,_rObjectName); } - //------------------------------------------------------------------ - sal_Bool OLinkedDocumentsAccess::newTableWithPilot(const String& _rDataSourceName,const Reference< XConnection >& _rxConnection) - { - try - { - ::svx::ODataAccessDescriptor aDesc; - aDesc.setDataSource(::rtl::OUString(_rDataSourceName)); - if ( _rxConnection.is() ) - aDesc[::svx::daConnection] <<= _rxConnection; - - Reference< XJobExecutor > xTableWizard; + void OLinkedDocumentsAccess::newReportWithPilot(const sal_Int32 _nCommandType,const ::rtl::OUString& _rObjectName) { - WaitObject aWaitCursor( m_pDialogParent ); - xTableWizard.set(m_xORB->createInstanceWithArguments(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.wizards.table.CallTableWizard")),aDesc.createAnySequence()),UNO_QUERY); - } - - if ( xTableWizard.is() ) - xTableWizard->trigger(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("start"))); - - } - catch(const Exception&) - { - OSL_ENSURE(sal_False, "OLinkedDocumentsAccess::newTable: caught an exception while loading the object!"); - } - return sal_True; + newWithPilot("com.sun.star.wizards.report.CallReportWizard",_nCommandType,_rObjectName); } //------------------------------------------------------------------ - sal_Bool OLinkedDocumentsAccess::newQueryWithPilot(const String& _rDataSourceName, const sal_Int32 _nCommandType, - const String& _rObjectName, const Reference< XConnection >& _rxConnection) + void OLinkedDocumentsAccess::newTableWithPilot() { - try - { - ::svx::ODataAccessDescriptor aDesc; - if ( _rDataSourceName.Len() ) - aDesc.setDataSource( ::rtl::OUString(_rDataSourceName) ); - if ( _nCommandType != -1 ) - aDesc[::svx::daCommandType] <<= _nCommandType; - if ( _rObjectName.Len() ) - aDesc[::svx::daCommand] <<= ::rtl::OUString(_rObjectName); - if ( _rxConnection.is() ) - aDesc[::svx::daConnection] <<= _rxConnection; - - Reference< XJobExecutor > xQueryWizard; - { - WaitObject aWaitCursor( m_pDialogParent ); - xQueryWizard.set(m_xORB->createInstanceWithArguments(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.wizards.query.CallQueryWizard")),aDesc.createAnySequence()),UNO_QUERY); + newWithPilot("com.sun.star.wizards.table.CallTableWizard"); } - if ( xQueryWizard.is() ) - xQueryWizard->trigger(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("start"))); - - } - catch(const Exception&) + //------------------------------------------------------------------ + void OLinkedDocumentsAccess::newQueryWithPilot(const sal_Int32 _nCommandType,const ::rtl::OUString& _rObjectName) { - OSL_ENSURE(sal_False, "OLinkedDocumentsAccess::newQueryWithPilot: caught an exception while loading the object!"); - } - return sal_True; + newWithPilot("com.sun.star.wizards.query.CallQueryWizard",_nCommandType,_rObjectName); } //------------------------------------------------------------------ Reference< XComponent > OLinkedDocumentsAccess::newForm(sal_Int32 _nNewFormId,Reference< XComponent >& _xDefinition) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
