Tag: cws_src680_dba24 User: oj Date: 05/02/18 04:27:24 Modified: /dba/dbaccess/source/ui/app/ AppController.cxx, AppController.hxx, AppControllerDnD.cxx, AppControllerGen.cxx
Log: #i42460# changes for the separation of datasource and database document(model) File Changes: Directory: /dba/dbaccess/source/ui/app/ ======================================= File [changed]: AppController.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/AppController.cxx?r1=1.12.4.2&r2=1.12.4.3 Delta lines: +43 -41 --------------------- --- AppController.cxx 7 Feb 2005 13:06:01 -0000 1.12.4.2 +++ AppController.cxx 18 Feb 2005 12:27:20 -0000 1.12.4.3 @@ -2,9 +2,9 @@ * * $RCSfile: AppController.cxx,v $ * - * $Revision: 1.12.4.2 $ + * $Revision: 1.12.4.3 $ * - * last change: $Author: oj $ $Date: 2005/02/07 13:06:01 $ + * last change: $Author: oj $ $Date: 2005/02/18 12:27:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,6 +92,9 @@ #ifndef _COM_SUN_STAR_SDBCX_XAPPEND_HPP_ #include <com/sun/star/sdbcx/XAppend.hpp> #endif +#ifndef _COM_SUN_STAR_SDB_XOFFICEDATABASEDOCUMENT_HPP_ +#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp> +#endif #ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #endif @@ -416,16 +419,21 @@ clearConnections(); try { - if ( m_xDataSource.is() ) - { - Reference<XModel> xModel(m_xDataSource,UNO_QUERY); - if ( xModel.is() ) + Reference < XFrame > xFrame; + attachFrame( xFrame ); + + m_xDataSource->removePropertyChangeListener(::rtl::OUString(), this); + Reference< XModifyBroadcaster > xBroadcaster(m_xModel, UNO_QUERY); + if ( xBroadcaster.is() ) + xBroadcaster->removeModifyListener(static_cast<XModifyListener*>(this)); + + if ( m_xDataSource.is() && m_xModel.is() ) { - ::rtl::OUString sUrl = xModel->getURL(); + ::rtl::OUString sUrl = m_xModel->getURL(); if ( sUrl.getLength() ) { ::rtl::OUString aFilter; - INetURLObject aURL( xModel->getURL() ); + INetURLObject aURL( m_xModel->getURL() ); const SfxFilter* pFilter = getStandardDatabaseFilter(); if ( pFilter ) aFilter = pFilter->GetFilterName(); @@ -437,20 +445,12 @@ getStrippedDatabaseName(), ::rtl::OUString() ); } - xModel->disconnectController( this ); + m_xModel->disconnectController( this ); // forces the data source to reload - xModel->attachResource(xModel->getURL(),xModel->getArgs()); } - Reference < XFrame > xFrame; - attachFrame( xFrame ); - - m_xDataSource->removePropertyChangeListener(::rtl::OUString(), this); - Reference< XModifyBroadcaster > xBroadcaster(m_xDataSource, UNO_QUERY); - if ( xBroadcaster.is() ) - xBroadcaster->removeModifyListener(static_cast<XModifyListener*>(this)); m_xDataSource = NULL; - } + m_xModel = NULL; } catch(Exception) { @@ -568,7 +568,7 @@ return sal_False; sal_Bool bCheck = sal_True; - Reference<XModifiable> xModi(m_xDataSource,UNO_QUERY); + Reference<XModifiable> xModi(m_xModel,UNO_QUERY); if ( m_bCurrentlyModified || (xModi.is() && xModi->isModified()) ) { switch (ExecuteQuerySaveDocument(getView(),getStrippedDatabaseName())) @@ -1038,7 +1038,7 @@ break; case ID_BROWSER_SAVEDOC: { - Reference<XStorable> xStore(m_xDataSource,UNO_QUERY); + Reference<XStorable> xStore(m_xModel,UNO_QUERY); if ( xStore.is() ) { xStore->store(); @@ -1062,7 +1062,7 @@ if ( aFileDlg.Execute() == ERRCODE_NONE ) { - Reference<XStorable> xStore(m_xDataSource,UNO_QUERY); + Reference<XStorable> xStore(m_xModel,UNO_QUERY); if ( xStore.is() ) { INetURLObject aURL( aFileDlg.GetPath() ); @@ -2292,13 +2292,15 @@ Reference< XModel > SAL_CALL OApplicationController::getModel(void) throw( RuntimeException ) { ::osl::MutexGuard aGuard(m_aMutex); - return Reference< XModel >(m_xDataSource,UNO_QUERY); + return m_xModel; } // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > & xModel) throw( RuntimeException ) { ::osl::MutexGuard aGuard(m_aMutex); - m_xDataSource.set(xModel,UNO_QUERY); + m_xModel = xModel; + Reference<XOfficeDatabaseDocument> xOfficeDoc(m_xModel,UNO_QUERY); + m_xDataSource.set(xOfficeDoc.is() ? xOfficeDoc->getDataSource() : Reference<XDataSource>(),UNO_QUERY); if ( m_xDataSource.is() ) { try @@ -2314,7 +2316,7 @@ m_xDataSource->addPropertyChangeListener(PROPERTY_TABLETYPEFILTER, this); m_xDataSource->addPropertyChangeListener(PROPERTY_USER, this); // to get the 'modified' for the data source - Reference< XModifyBroadcaster > xBroadcaster(m_xDataSource, UNO_QUERY); + Reference< XModifyBroadcaster > xBroadcaster(m_xModel, UNO_QUERY); if ( xBroadcaster.is() ) xBroadcaster->addModifyListener(static_cast<XModifyListener*>(this)); File [changed]: AppController.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/AppController.hxx?r1=1.8.4.1&r2=1.8.4.2 Delta lines: +2 -1 ------------------- --- AppController.hxx 3 Feb 2005 13:53:47 -0000 1.8.4.1 +++ AppController.hxx 18 Feb 2005 12:27:20 -0000 1.8.4.2 @@ -161,6 +161,7 @@ TDataSourceConnections m_aDataSourceConnections; TransferableDataHelper m_aSystemClipboard; // content of the clipboard ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xDataSource; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel; TContainerVector m_aCurrentContainers; // the containers where we are listener on TDocuments m_aDocuments; ODsnTypeCollection m_aTypeCollection; File [changed]: AppControllerDnD.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/AppControllerDnD.cxx?r1=1.8.4.2&r2=1.8.4.3 Delta lines: +10 -11 --------------------- --- AppControllerDnD.cxx 7 Feb 2005 13:06:00 -0000 1.8.4.2 +++ AppControllerDnD.cxx 18 Feb 2005 12:27:21 -0000 1.8.4.3 @@ -518,7 +518,7 @@ // ----------------------------------------------------------------------------- sal_Bool OApplicationController::isDataSourceReadOnly() const { - Reference<XStorable> xStore(m_xDataSource,UNO_QUERY); + Reference<XStorable> xStore(m_xModel,UNO_QUERY); return !xStore.is() || xStore->isReadonly(); } // ----------------------------------------------------------------------------- @@ -559,7 +559,7 @@ { case E_REPORT: // TODO: seperate handling of forms and reports { - Reference< XReportDocumentsSupplier > xSupp(m_xDataSource,UNO_QUERY); + Reference< XReportDocumentsSupplier > xSupp(m_xModel,UNO_QUERY); OSL_ENSURE(xSupp.is(),"Data source doesn't return a XReportDocumentsSupplier -> GPF"); if ( xSupp.is() ) xElements = xSupp->getReportDocuments(); @@ -567,7 +567,7 @@ break; case E_FORM: { - Reference< XFormDocumentsSupplier > xSupp(m_xDataSource,UNO_QUERY); + Reference< XFormDocumentsSupplier > xSupp(m_xModel,UNO_QUERY); OSL_ENSURE(xSupp.is(),"Data source doesn't return a XFormDocumentsSupplier -> GPF"); if ( xSupp.is() ) xElements = xSupp->getFormDocuments(); @@ -631,11 +631,10 @@ } } - Reference<XModifiable> xModi(m_xDataSource,UNO_QUERY); + Reference<XModifiable> xModi(m_xModel,UNO_QUERY); m_bCurrentlyModified = (xModi.is() && xModi->isModified()); sal_Bool bNew = sal_False; - Reference<XModel> xModel(m_xDataSource,UNO_QUERY); - if ( bInteractive && xModel.is() && !xModel->getURL().getLength() && getView() ) + if ( bInteractive && m_xModel.is() && !m_xModel->getURL().getLength() && getView() ) { WinBits nBits(WB_STDMODAL|WB_SAVEAS); ::sfx2::FileDialogHelper aFileDlg( ::sfx2::FILESAVE_AUTOEXTENSION,static_cast<sal_uInt32>(nBits) ,getView()); @@ -662,9 +661,9 @@ try { Sequence< PropertyValue > aArgs; - xModel->attachResource(sFileName,aArgs); - attachModel(xModel); - Reference<XStorable> xStr(xModel,UNO_QUERY); + m_xModel->attachResource(sFileName,aArgs); + attachModel(m_xModel); + Reference<XStorable> xStr(m_xModel,UNO_QUERY); if ( xStr.is() ) xStr->store(); @@ -710,14 +709,14 @@ { case E_FORM: { - Reference< XFormDocumentsSupplier > xSupp(m_xDataSource,UNO_QUERY); + Reference< XFormDocumentsSupplier > xSupp(m_xModel,UNO_QUERY); if ( xSupp.is() ) xNameAccess = xSupp->getFormDocuments(); break; } case E_REPORT: { - Reference< XReportDocumentsSupplier > xSupp(m_xDataSource,UNO_QUERY); + Reference< XReportDocumentsSupplier > xSupp(m_xModel,UNO_QUERY); if ( xSupp.is() ) xNameAccess = xSupp->getReportDocuments(); break; File [changed]: AppControllerGen.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/AppControllerGen.cxx?r1=1.9.4.1&r2=1.9.4.2 Delta lines: +1 -1 ------------------- --- AppControllerGen.cxx 3 Feb 2005 13:53:47 -0000 1.9.4.1 +++ AppControllerGen.cxx 18 Feb 2005 12:27:21 -0000 1.9.4.2 @@ -365,7 +365,7 @@ } EventObject aEvt; - aEvt.Source = m_xDataSource; + aEvt.Source = m_xModel; modified(aEvt); } // ----------------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
