Tag: cws_src680_dba24d User: oj Date: 2007-11-22 11:47:25+0000 Modified: dba/dbaccess/source/core/dataaccess/documentdefinition.cxx
Log: #i83805# new command to suspend and shutdown the emebedded object 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.48.6.2&r2=1.48.6.3 Delta lines: +40 -16 --------------------- --- documentdefinition.cxx 2007-11-16 12:56:17+0000 1.48.6.2 +++ documentdefinition.cxx 2007-11-22 11:47:22+0000 1.48.6.3 @@ -4,9 +4,9 @@ * * $RCSfile: documentdefinition.cxx,v $ * - * $Revision: 1.48.6.2 $ + * $Revision: 1.48.6.3 $ * - * last change: $Author: fs $ $Date: 2007/11/16 12:56:17 $ + * last change: $Author: oj $ $Date: 2007/11/22 11:47:22 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -286,7 +286,8 @@ { Reference< XEmbeddedObject > m_xBroadCaster; ODocumentDefinition* m_pDefinition; - sal_Bool m_bInStateChange; + bool m_bInStateChange; + bool m_bInChangingState; protected: virtual void SAL_CALL disposing(); public: @@ -294,7 +295,8 @@ : TEmbedObjectHolder(m_aMutex) ,m_xBroadCaster(_xBroadCaster) ,m_pDefinition(_pDefinition) - ,m_bInStateChange(sal_False) + ,m_bInStateChange(false) + ,m_bInChangingState(false) { osl_incrementInterlockedCount( &m_refCount ); { @@ -317,22 +319,28 @@ m_pDefinition = NULL; } //------------------------------------------------------------------ - void SAL_CALL OEmbedObjectHolder::changingState( const ::com::sun::star::lang::EventObject& /*aEvent*/, ::sal_Int32 /*nOldState*/, ::sal_Int32 /*nNewState*/ ) throw (::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::RuntimeException) + void SAL_CALL OEmbedObjectHolder::changingState( const ::com::sun::star::lang::EventObject& /*aEvent*/, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) throw (::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::RuntimeException) { + if ( !m_bInChangingState && nNewState == EmbedStates::RUNNING && nOldState == EmbedStates::ACTIVE && m_pDefinition ) + { + m_bInChangingState = true; + //m_pDefinition->save(sal_False); + m_bInChangingState = false; + } } //------------------------------------------------------------------ void SAL_CALL OEmbedObjectHolder::stateChanged( const ::com::sun::star::lang::EventObject& aEvent, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) throw (::com::sun::star::uno::RuntimeException) { if ( !m_bInStateChange && nNewState == EmbedStates::RUNNING && nOldState == EmbedStates::ACTIVE && m_pDefinition ) { - m_bInStateChange = sal_True; + m_bInStateChange = true; Reference<XInterface> xInt(static_cast< ::cppu::OWeakObject* >(m_pDefinition),UNO_QUERY); { Reference<XEmbeddedObject> xEmbeddedObject(aEvent.Source,UNO_QUERY); if ( xEmbeddedObject.is() ) xEmbeddedObject->changeState(EmbedStates::LOADED); } - m_bInStateChange = sal_False; + m_bInStateChange = false; } } //------------------------------------------------------------------ @@ -996,6 +1004,13 @@ dispose(); } + else if ( aCommand.Name.compareToAscii( "shutdown" ) == 0 ) + { + bool bClose = prepareClose(); + if ( bClose && m_xEmbeddedObject.is() ) + m_xEmbeddedObject->changeState(EmbedStates::LOADED); + aRet <<= bClose; + } else aRet = OContentHelper::execute(aCommand,CommandId,Environment); } @@ -1574,7 +1589,15 @@ // controller vetoed the closing return false; - if ( isModified() && !save( sal_True ) ) + if ( isModified() ) + { + Reference< XFrame > xFrame( xController->getFrame() ); + if ( xFrame.is() ) + { + Reference< XTopWindow > xTopWindow( xFrame->getContainerWindow(), UNO_QUERY_THROW ); + xTopWindow->toFront(); + } + if ( !save( sal_True ) ) { if ( bCouldSuspend ) // revert suspension @@ -1583,6 +1606,7 @@ return false; } } + } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
