Tag: cws_src680_dba24 User: oj Date: 05/02/21 03:03:53 Modified: /dba/dbaccess/source/core/dataaccess/ ModelImpl.cxx, databasedocument.cxx, databasedocument.hxx
Log: merge conflicts resolved File Changes: Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: ModelImpl.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/ModelImpl.cxx?r1=1.1.2.1&r2=1.1.2.2 Delta lines: +55 -28 --------------------- --- ModelImpl.cxx 18 Feb 2005 12:26:36 -0000 1.1.2.1 +++ ModelImpl.cxx 21 Feb 2005 11:03:49 -0000 1.1.2.2 @@ -2,9 +2,9 @@ * * $RCSfile: ModelImpl.cxx,v $ * - * $Revision: 1.1.2.1 $ + * $Revision: 1.1.2.2 $ * - * last change: $Author: oj $ $Date: 2005/02/18 12:26:36 $ + * last change: $Author: oj $ $Date: 2005/02/21 11:03:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -289,19 +289,19 @@ if ( xCon == i->get() ) { *i = OWeakConnection(); - try - { - Reference<XTransactedObject> xTrans(xCon,UNO_QUERY); - if ( bStore = xTrans.is() ) - { - xTrans->commit(); - bStore = commitEmbeddedStorage(); - } - } - catch(Exception&) - { - OSL_ENSURE(0,"Exception Caught: Could not store embedded database!"); - } +// try +// { +// Reference<XTransactedObject> xTrans(xCon,UNO_QUERY); +// if ( bStore = xTrans.is() ) +// { +// xTrans->commit(); +// bStore = commitEmbeddedStorage(); +// } +// } +// catch(Exception&) +// { +// OSL_ENSURE(0,"Exception Caught: Could not store embedded database!"); +// } } } @@ -378,13 +378,22 @@ try { - TStorages::iterator aIter = m_aStorages.begin(); - TStorages::iterator aEnd = m_aStorages.end(); - for (; aIter != aEnd ; ++aIter) + sal_Bool bStore = commitEmbeddedStorage(); + disposeStorages(); + if ( bStore ) + { + try { - ::comphelper::disposeComponent(aIter->second); + Reference<XTransactedObject> xTransact(getStorage(),UNO_QUERY); + if ( xTransact.is() ) + xTransact->commit(); } - m_aStorages.clear(); + catch(Exception) + { + OSL_ENSURE(0,"Exception Caught: Could not store embedded database!"); + } + } + if ( m_bOwnStorage ) ::comphelper::disposeComponent(m_xStorage); } @@ -531,7 +540,7 @@ Reference< XSingleServiceFactory> xStorageFactory; xStorageFactory.set(m_xServiceFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.StorageFactory"))),UNO_QUERY); - if ( xStorageFactory.is() ) + if ( xStorageFactory.is() && m_sFileURL.getLength() ) { Sequence<Any> aArgs(2); const PropertyValue* pEnd = m_aArgs.getConstArray() + m_aArgs.getLength(); @@ -593,9 +602,9 @@ try { xStorage = xMyStorage->openStorageElement(_sStorageName, m_bDocumentReadOnly ? ElementModes::READ : nMode); - Reference<XComponent> xComp(xStorage,UNO_QUERY); - if ( xComp.is() ) - xComp->addEventListener(_xEventListener); + Reference<XTransactionBroadcaster> xBroad(xStorage,UNO_QUERY); + if ( xBroad.is() ) + xBroad->addTransactionListener(this); aFind = m_aStorages.insert(TStorages::value_type(_sStorageName,xStorage)).first; } catch(Exception&) @@ -712,6 +721,24 @@ return m_refCount; } // ----------------------------------------------------------------------------- + oid ODatabaseModelImpl::commitStorages() +{ + try + { + TStorages::iterator aIter = m_aStorages.begin(); + TStorages::iterator aEnd = m_aStorages.end(); + for (; aIter != aEnd ; ++aIter) + { + Reference<XTransactedObject> xTrans(aIter->second,UNO_QUERY); + if ( xTrans.is() ) + xTrans->commit(); + } + } + catch(WrappedTargetException) + { + throw IOException(); + } +} //........................................................................ } // namespace dbaccess //........................................................................ File [changed]: databasedocument.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/databasedocument.cxx?r1=1.8.2.3&r2=1.8.2.4 Delta lines: +10 -1 -------------------- --- databasedocument.cxx 18 Feb 2005 12:25:26 -0000 1.8.2.3 +++ databasedocument.cxx 21 Feb 2005 11:03:50 -0000 1.8.2.4 @@ -209,6 +209,15 @@ if ( xComp.is() ) xComp->addEventListener(this); } + try + { + m_xDocEventBroadcaster.set(m_pImpl->m_xServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.GlobalEventBroadcaster"))), + UNO_QUERY); + } + catch(Exception) + { + OSL_ENSURE(0,"Could not create GlobalEventBroadcaster!"); + } } //-------------------------------------------------------------------------- @@ -1182,7 +1191,7 @@ Sequence< ::rtl::OUString > ODatabaseDocument::getSupportedServiceNames_Static( ) throw (RuntimeException) { Sequence< ::rtl::OUString > aSNS( 2 ); - aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DatabaseDocument")); + aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.OfficeDatabaseDocument")); aSNS[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.OfficeDocument")); return aSNS; } File [changed]: databasedocument.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/databasedocument.hxx?r1=1.1.2.1&r2=1.1.2.2 Delta lines: +11 -3 -------------------- --- databasedocument.hxx 18 Feb 2005 12:26:55 -0000 1.1.2.1 +++ databasedocument.hxx 21 Feb 2005 11:03:50 -0000 1.1.2.2 @@ -2,9 +2,9 @@ * * $RCSfile: databasedocument.hxx,v $ * - * $Revision: 1.1.2.1 $ + * $Revision: 1.1.2.2 $ * - * last change: $Author: oj $ $Date: 2005/02/18 12:26:55 $ + * last change: $Author: oj $ $Date: 2005/02/21 11:03:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -142,6 +142,7 @@ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory; ::com::sun::star::uno::Reference< ::drafts::com::sun::star::ui::XUIConfigurationManager> m_xUIConfigurationManager; + ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener > m_xDocEventBroadcaster; OChildCommitListen_Impl* m_pChildCommitListen; ::cppu::OInterfaceContainerHelper m_aModifyListeners; @@ -288,6 +289,13 @@ // XOfficeDatabaseDocument virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > SAL_CALL getDataSource() throw (::com::sun::star::uno::RuntimeException); + + // XTransactionListener + virtual void SAL_CALL preCommit( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL commited( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL preRevert( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL reverted( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); + // XStorageBasedDocument /* virtual void SAL_CALL loadFromStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescriptor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::frame::DoubleInitializationException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
