User: kz Date: 2008-06-25 12:36:07+0000 Modified: dba/dbaccess/source/ui/app/AppControllerGen.cxx
Log: INTEGRATION: CWS dba30d (1.35.10); FILE MERGED 2008/06/23 06:20:56 oj 1.35.10.5: #i90929# fix for sending reports as e-mail 2008/06/10 06:40:57 fs 1.35.10.4: RESYNC: (1.35-1.36); FILE MERGED 2008/06/01 21:02:32 fs 1.35.10.3: #i80943# more preparations for context menu interception, including some re-factoring 2008/05/30 10:55:38 oj 1.35.10.2: #i88750# special handling for reports as mail 2008/05/29 11:36:13 fs 1.35.10.1: #i80943# XContextMenuInterception (not yet finally done) File Changes: Directory: /dba/dbaccess/source/ui/app/ ======================================= File [changed]: AppControllerGen.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/AppControllerGen.cxx?r1=1.36&r2=1.37 Delta lines: +40 -7 -------------------- --- AppControllerGen.cxx 2008-06-06 14:07:27+0000 1.36 +++ AppControllerGen.cxx 2008-06-25 12:36:04+0000 1.37 @@ -101,8 +101,11 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; using namespace ::com::sun::star::ucb; -using ::com::sun::star::util::XCloseable; +/** === begin UNO using === **/ +using ::com::sun::star::util::XCloseable; +using ::com::sun::star::ui::XContextMenuInterceptor; +/** === end UNO using === **/ namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject; namespace ErrorCondition = ::com::sun::star::sdb::ErrorCondition; @@ -582,6 +585,19 @@ } // ----------------------------------------------------------------------------- +void SAL_CALL OApplicationController::registerContextMenuInterceptor( const Reference< XContextMenuInterceptor >& _Interceptor ) throw (RuntimeException) +{ + if ( _Interceptor.is() ) + m_aContextMenuInterceptors.addInterface( _Interceptor ); +} + +// ----------------------------------------------------------------------------- +void SAL_CALL OApplicationController::releaseContextMenuInterceptor( const Reference< XContextMenuInterceptor >& _Interceptor ) throw (RuntimeException) +{ + m_aContextMenuInterceptors.removeInterface( _Interceptor ); +} + +// ----------------------------------------------------------------------------- void OApplicationController::previewChanged( sal_Int32 _nMode ) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); @@ -659,6 +675,7 @@ { return ::dbaui::getStrippedDatabaseName(m_xDataSource,m_sDatabaseName); } + // ----------------------------------------------------------------------------- void OApplicationController::addDocumentListener(const Reference< XComponent >& _xDocument,const Reference< XComponent >& _xDefintion) { @@ -710,7 +727,7 @@ if ( bEnabled && bCompareRes && E_TABLE == eType ) { ::std::vector< ::rtl::OUString> aList; - const_cast<OApplicationController*>(this)->getSelectionElementNames(aList); + getSelectionElementNames(aList); try { @@ -769,6 +786,13 @@ ::std::vector< ::rtl::OUString> aList; getSelectionElementNames(aList); ElementType eType = getContainer()->getElementType(); + ::comphelper::NamedValueCollection aArguments; + ElementOpenMode eOpenMode = _eOpenMode; + if ( eType == E_REPORT && E_OPEN_FOR_MAIL == _eOpenMode ) + { + aArguments.put("Hidden",true); + eOpenMode = E_OPEN_NORMAL; + } ::std::vector< ::std::pair< ::rtl::OUString ,Reference< XModel > > > aCompoments; ::std::vector< ::rtl::OUString>::iterator aEnd = aList.end(); @@ -778,7 +802,7 @@ convertToView(*aIter); else { - Reference< XModel > xModel( openElement( *aIter, eType, _eOpenMode, _nId ), UNO_QUERY ); + Reference< XModel > xModel( openElementWithArguments( *aIter, eType, eOpenMode, _nId,aArguments ), UNO_QUERY ); aCompoments.push_back( ::std::pair< ::rtl::OUString, Reference< XModel > >( *aIter, xModel ) ); } } @@ -786,6 +810,7 @@ // special handling for mail, if more than one document is selected attach them all if ( _eOpenMode == E_OPEN_FOR_MAIL ) { + ::std::vector< ::std::pair< ::rtl::OUString ,Reference< XModel > > >::iterator componentIter = aCompoments.begin(); ::std::vector< ::std::pair< ::rtl::OUString ,Reference< XModel > > >::iterator componentEnd = aCompoments.end(); ::rtl::OUString aDocTypeString; @@ -793,10 +818,18 @@ SfxMailModel::SendMailResult eResult = SfxMailModel::SEND_MAIL_OK; for (; componentIter != componentEnd && SfxMailModel::SEND_MAIL_OK == eResult; ++componentIter) { + try + { Reference< XModel > xModel(componentIter->second,UNO_QUERY); // Send document as e-Mail using stored/default type eResult = aSendMail.AttachDocument(aDocTypeString,xModel,componentIter->first); + ::comphelper::disposeComponent(xModel); + } + catch(const Exception&) + { + DBG_UNHANDLED_EXCEPTION(); + } } if ( !aSendMail.IsEmpty() ) aSendMail.Send( getFrame() ); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
