User: kz Date: 05/03/04 01:44:39 Modified: /dba/dbaccess/source/core/dataaccess/ databasedocument.cxx
Log: INTEGRATION: CWS fwkpostbeta03 (1.9.12); FILE MERGED 2005/02/15 09:10:03 as 1.9.12.1: #i40349# add db models to global model collection; provide document events for all db models File Changes: Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: databasedocument.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/databasedocument.cxx?r1=1.12&r2=1.13 Delta lines: +36 -9 -------------------- --- databasedocument.cxx 1 Mar 2005 19:13:53 -0000 1.12 +++ databasedocument.cxx 4 Mar 2005 09:44:36 -0000 1.13 @@ -134,7 +134,7 @@ using namespace ::com::sun::star::xml::sax; using namespace ::cppu; using namespace ::osl; - +namespace css = ::com::sun::star; //........................................................................ namespace dbaccess { @@ -145,12 +145,12 @@ OSubComponent::dispose(); } // ----------------------------------------------------------------------------- -void SAL_CALL ODatabaseSource::addEventListener( const Reference< XEventListener >& _xListener ) throw (RuntimeException) +void SAL_CALL ODatabaseSource::addEventListener( const Reference< css::lang::XEventListener >& _xListener ) throw (RuntimeException) { OSubComponent::addEventListener(_xListener); } // ----------------------------------------------------------------------------- -void SAL_CALL ODatabaseSource::removeEventListener( const Reference< XEventListener >& _xListener ) throw (RuntimeException) +void SAL_CALL ODatabaseSource::removeEventListener( const Reference< css::lang::XEventListener >& _xListener ) throw (RuntimeException) { OSubComponent::removeEventListener(_xListener); } @@ -556,6 +556,25 @@ } } // ----------------------------------------------------------------------------- +// ::com::sun::star::document::XEventBroadcaster +void SAL_CALL ODatabaseSource::addEventListener(const css::uno::Reference< css::document::XEventListener >& _xListener ) throw (css::uno::RuntimeException) +{ + m_aDocEventListeners.addInterface(_xListener); +} +// ----------------------------------------------------------------------------- +void SAL_CALL ODatabaseSource::removeEventListener( const css::uno::Reference< css::document::XEventListener >& _xListener ) throw (css::uno::RuntimeException) +{ + m_aDocEventListeners.removeInterface(_xListener); +} +// ----------------------------------------------------------------------------- +// ::com::sun::star::document::XEventListener +void SAL_CALL ODatabaseSource::notifyEvent( const css::document::EventObject& aEvent ) throw (css::uno::RuntimeException) +{ + // used only to forward external events (e.g. for doc creation) from the frame loader + // to the global event broadcaster and all other interested doc event listener. + notifyEvent(aEvent.EventName); +} +// ----------------------------------------------------------------------------- // ::com::sun::star::view::XPrintable Sequence< PropertyValue > SAL_CALL ODatabaseSource::getPrinter( ) throw (RuntimeException) { @@ -709,7 +728,7 @@ xStorage = xMyStorage->openStorageElement(_sStorageName, m_bDocumentReadOnly ? ElementModes::READ : nMode); Reference<XTransactionBroadcaster> xBroad(xStorage,UNO_QUERY); if ( xBroad.is() ) - xBroad->addTransactionListener(this); + xBroad->addTransactionListener(static_cast< css::embed::XTransactionListener* >(this)); aFind = m_aStorages.insert(TStorages::value_type(_sStorageName,xStorage)).first; } catch(Exception&) @@ -1081,10 +1100,17 @@ // ----------------------------------------------------------------------------- void ODatabaseSource::notifyEvent(const ::rtl::OUString& _sEventName) { - if ( m_xDocEventBroadcaster.is() ) + try + { + ResettableMutexGuard _rGuard(m_aMutex); + if (OComponentHelper::rBHelper.bDisposed) + throw DisposedException(); + + css::document::EventObject aEvt(*this, _sEventName); + NOTIFY_LISTERNERS(m_aDocEventListeners,css::document::XEventListener,notifyEvent) + } + catch(Exception&) { - ::com::sun::star::document::EventObject aEvent(*this, _sEventName); - m_xDocEventBroadcaster->notifyEvent(aEvent); } } // ----------------------------------------------------------------------------- @@ -1161,4 +1187,5 @@ //........................................................................ } // namespace dbaccess //........................................................................ + --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
