User: rt      
Date: 2008-01-30 08:34:41+0000
Modified:
   dba/dbaccess/source/core/dataaccess/documentdefinition.cxx

Log:
 INTEGRATION: CWS dba24d (1.48.6); FILE MERGED
 2007/12/01 21:17:37 fs 1.48.6.5: #i10000#
 2007/12/01 13:40:03 fs 1.48.6.4: RESYNC: (1.49-1.50); FILE MERGED
 2007/11/22 11:47:22 oj 1.48.6.3: #i83805# new command to suspend and shutdown 
the emebedded object
 2007/11/16 12:56:17 fs 1.48.6.2: RESYNC: (1.48-1.49); FILE MERGED
 2007/11/08 14:09:22 fs 1.48.6.1: during #i81658#: string cleanup

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.52&r2=1.53
Delta lines:  +38 -14
---------------------
--- documentdefinition.cxx      2008-01-29 14:29:14+0000        1.52
+++ documentdefinition.cxx      2008-01-30 08:34:38+0000        1.53
@@ -292,7 +292,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:
@@ -300,7 +301,8 @@
                        : TEmbedObjectHolder(m_aMutex)
                        ,m_xBroadCaster(_xBroadCaster)
                        ,m_pDefinition(_pDefinition)
-                       ,m_bInStateChange(sal_False)
+                       ,m_bInStateChange(false)
+            ,m_bInChangingState(false)
                {
                        osl_incrementInterlockedCount( &m_refCount );
             {
@@ -323,22 +325,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;
                }
        }
        //------------------------------------------------------------------
@@ -866,7 +874,7 @@
                        const PropertyValue* pEnd  = pIter + 
aArguments.getLength();
                        for ( ;pIter != pEnd; ++pIter )
                        {
-                               if ( pIter->Name == PROPERTY_ACTIVECONNECTION )
+                               if ( pIter->Name == PROPERTY_ACTIVE_CONNECTION )
                 {
                                        xConnection.set( pIter->Value, 
UNO_QUERY );
                     continue;
@@ -1088,6 +1096,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);
     }
@@ -1786,7 +1801,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
@@ -1795,6 +1818,7 @@
             return false;
         }
     }
+    }
     catch( const Exception& )
     {
        DBG_UNHANDLED_EXCEPTION();




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to