Tag: cws_src680_dba201b User: fs Date: 05/06/09 01:55:18 Modified: /dba/dbaccess/source/core/dataaccess/ documentdefinition.cxx, documentdefinition.hxx, intercept.cxx
Log: #i49370# do a prepareClose/suspend when a close-command is intercepted File Changes: Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: documentdefinition.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/documentdefinition.cxx?r1=1.26.18.2&r2=1.26.18.3 Delta lines: +35 -2 -------------------- --- documentdefinition.cxx 8 Jun 2005 14:48:11 -0000 1.26.18.2 +++ documentdefinition.cxx 9 Jun 2005 08:55:15 -0000 1.26.18.3 @@ -2,9 +2,9 @@ * * $RCSfile: documentdefinition.cxx,v $ * - * $Revision: 1.26.18.2 $ + * $Revision: 1.26.18.3 $ * - * last change: $Author: fs $ $Date: 2005/06/08 14:48:11 $ + * last change: $Author: fs $ $Date: 2005/06/09 08:55:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1325,6 +1325,39 @@ bRet = xModel.is() && xModel->isModified(); } return bRet; +} +// ----------------------------------------------------------------------------- +bool ODocumentDefinition::prepareClose() +{ + if ( !m_xEmbeddedObject.is() ) + return true; + + try + { + // suspend the controller. Embedded objects are not allowed to rais + // own UI on their own decision, instead, this has always to be triggered + // by the embedding component. Thus, we do the suspend call here. + // #i49370# / 2005-06-09 / [EMAIL PROTECTED] + + Reference< XModel > xModel( getComponent(), UNO_QUERY ); + Reference< XController > xController; + if ( xModel.is() ) + xController = xModel->getCurrentController(); + OSL_ENSURE( xController.is(), "ODocumentDefinition::prepareClose: no controller!" ); + if ( xController.is() && !xController->suspend( sal_True ) ) + // controller vetoed the closing + return false; + + if ( isModified() && !save( sal_True ) ) + // saving failed or was cancelled + return false; + } + catch( const Exception& ) + { + OSL_ENSURE( sal_False, "ODocumentDefinition::prepareClose: caught an exception!" ); + } + + return true; } // ----------------------------------------------------------------------------- void ODocumentDefinition::setModelReadOnly(sal_Bool _bReadOnly) File [changed]: documentdefinition.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/documentdefinition.hxx?r1=1.12&r2=1.12.36.1 Delta lines: +14 -3 -------------------- --- documentdefinition.hxx 18 Mar 2005 16:33:00 -0000 1.12 +++ documentdefinition.hxx 9 Jun 2005 08:55:15 -0000 1.12.36.1 @@ -2,9 +2,9 @@ * * $RCSfile: documentdefinition.hxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.12.36.1 $ * - * last change: $Author: kz $ $Date: 2005/03/18 16:33:00 $ + * last change: $Author: fs $ $Date: 2005/06/09 08:55:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -211,6 +211,17 @@ void closeObject(); sal_Bool isModified(); void fillReportData(sal_Bool _bFill = sal_True); + + /** prepares closing the document component + + The method suspends the controller associated with the document, and saves the document + if necessary. + + @return + <TRUE/> if and only if the document component can be closed + */ + bool prepareClose(); + protected: // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; File [changed]: intercept.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/intercept.cxx?r1=1.3&r2=1.3.58.1 Delta lines: +8 -11 -------------------- --- intercept.cxx 16 Feb 2005 15:59:59 -0000 1.3 +++ intercept.cxx 9 Jun 2005 08:55:16 -0000 1.3.58.1 @@ -2,9 +2,9 @@ * * $RCSfile: intercept.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.3.58.1 $ * - * last change: $Author: vg $ $Date: 2005/02/16 15:59:59 $ + * last change: $Author: fs $ $Date: 2005/06/09 08:55:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -235,16 +235,13 @@ || _URL.Complete == m_aInterceptedURL[DISPATCH_CLOSEFRAME] ) { - if ( m_pContentHolder->isModified() ) + if ( m_pContentHolder->prepareClose() ) { - if ( !m_pContentHolder->save(sal_True) ) - return; - } - Reference< XDispatch > xDispatch = m_xSlaveDispatchProvider->queryDispatch( _URL, ::rtl::OUString::createFromAscii( "_self" ), 0 ); if ( xDispatch.is() ) xDispatch->dispatch( _URL, Arguments ); + } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
