Tag: cws_src680_fwk29
User: as      
Date: 06/01/10 02:46:40

Modified:
 /dba/dbaccess/source/core/dataaccess/
  documentdefinition.cxx, documentdefinition.hxx

Log:
 #i59272# remove frame from desktop tree ALWAYS

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.32.6.2&r2=1.32.6.3
Delta lines:  +32 -38
---------------------
--- documentdefinition.cxx      6 Jan 2006 13:43:14 -0000       1.32.6.2
+++ documentdefinition.cxx      10 Jan 2006 10:46:16 -0000      1.32.6.3
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: documentdefinition.cxx,v $
  *
- *  $Revision: 1.32.6.2 $
+ *  $Revision: 1.32.6.3 $
  *
- *  last change: $Author: as $ $Date: 2006/01/06 13:43:14 $
+ *  last change: $Author: as $ $Date: 2006/01/10 10:46:16 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -45,6 +45,7 @@
 #ifndef _TOOLS_DEBUG_HXX
 #include <tools/debug.hxx>
 #endif
+#include <tools/diagnose_ex.h>
 #ifndef _COMPHELPER_PROPERTY_HXX_
 #include <comphelper/property.hxx>
 #endif
@@ -559,7 +560,7 @@
        ::osl::MutexGuard aGuard(m_aMutex);
        closeObject();
        ::comphelper::disposeComponent(m_xListener);
-       m_xFrameLoader = NULL;
+       m_xDesktop = NULL;
 }
 // 
-----------------------------------------------------------------------------
 
IMPLEMENT_TYPEPROVIDER3(ODocumentDefinition,OContentHelper,OPropertyStateContainer,ODocumentDefinition_Base);
@@ -626,6 +627,16 @@
 }
 
 // 
-----------------------------------------------------------------------------
+void ODocumentDefinition::impl_removeFrameFromDesktop_throw( const Reference< 
XFrame >& _rxFrame )
+{
+    if ( !m_xDesktop.is() )
+               m_xDesktop.set( m_xORB->createInstance( SERVICE_FRAME_DESKTOP 
), UNO_QUERY_THROW );
+
+       Reference< XFrames > xFrames( m_xDesktop->getFrames(), UNO_QUERY_THROW 
);
+    xFrames->remove( _rxFrame );
+}
+
+// 
-----------------------------------------------------------------------------
 void ODocumentDefinition::impl_onActivateEmbeddedObject( bool 
_bOpenedInDesignMode )
 {
     try
@@ -634,51 +645,34 @@
         Reference< XController > xController( xModel.is() ? 
xModel->getCurrentController() : Reference< XController >() );
         if ( !xController.is() )
             return;
-           Reference< XFrame > xFrame( xController->getFrame() );
 
-               if ( m_xListener.is() )
-               {
-            // simply raise the window to top
+               if ( !m_xListener.is() )
+            // it's the first time the embedded object has been activated
+            // create an OEmbedObjectHolder
+                       m_xListener = new 
OEmbedObjectHolder(m_xEmbeddedObject,this);
+
+           Reference< XFrame > xFrame( xController->getFrame() );
+        // raise the window to top (especially necessary if this is not the 
first activation)
                        if ( xFrame.is() )
                        {
                                Reference< XTopWindow > xTopWindow( 
xFrame->getContainerWindow(), UNO_QUERY_THROW );
                                xTopWindow->toFront();
                        }
-               }
-               else
-               {
-            // it's the first time the embedded object has been activated
-
-            // 
-            if ( !m_xFrameLoader.is() )
-                               m_xFrameLoader.set( m_xORB->createInstance( 
SERVICE_FRAME_DESKTOP ), UNO_QUERY_THROW );
-
-            // remove the frame from the desktop's frame collection because we 
need full control of it.
-                       Reference< XFramesSupplier > xSup( m_xFrameLoader, 
UNO_QUERY_THROW );
-                       Reference< XFrames > xFrames( xSup->getFrames(), 
UNO_QUERY_THROW );
-            xFrames->remove( xFrame );
-
-            // create an OEmbedObjectHolder
-                       m_xListener = new 
OEmbedObjectHolder(m_xEmbeddedObject,this);
 
             // ensure that we ourself are kept alive as long as the embedded 
object's frame is
             // opened
             LifetimeCoupler::couple( *this, Reference< XComponent >( xFrame, 
UNO_QUERY_THROW ) );
-               }
 
+        // init the edit view
         if ( _bOpenedInDesignMode )
             impl_initObjectEditView( xController );
+
+        // remove the frame from the desktop's frame collection because we 
need full control of it.
+        impl_removeFrameFromDesktop_throw( xFrame );
     }
-    catch( const RuntimeException& e )
+    catch( const RuntimeException& )
     {
-    #if OSL_DEBUG_LEVEL > 0
-       ::rtl::OString sMessage( 
"ODocumentDefinition::impl_onActivateEmbeddedObject: caught an exception!\n" );
-       sMessage += "message:\n";
-       sMessage += ::rtl::OString( e.Message.getStr(), e.Message.getLength(), 
osl_getThreadTextEncoding() );
-       OSL_ENSURE( false, sMessage );
-    #else
-       e; // make compiler happy
-    #endif
+        DBG_UNHANDLED_EXCEPTION();
     }
 }
 

File [changed]: documentdefinition.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/documentdefinition.hxx?r1=1.16&r2=1.16.6.1
Delta lines:  +9 -4
-------------------
--- documentdefinition.hxx      21 Dec 2005 13:36:17 -0000      1.16
+++ documentdefinition.hxx      10 Jan 2006 10:46:35 -0000      1.16.6.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: documentdefinition.hxx,v $
  *
- *  $Revision: 1.16 $
+ *  $Revision: 1.16.6.1 $
  *
- *  last change: $Author: obo $ $Date: 2005/12/21 13:36:17 $
+ *  last change: $Author: as $ $Date: 2006/01/10 10:46:35 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -96,7 +96,7 @@
 {
        ::com::sun::star::uno::Reference< 
::com::sun::star::embed::XEmbeddedObject>                     m_xEmbeddedObject;
        ::com::sun::star::uno::Reference< 
::com::sun::star::embed::XStateChangeListener >       m_xListener;
-       ::com::sun::star::uno::Reference< 
::com::sun::star::frame::XComponentLoader >           m_xFrameLoader;
+       ::com::sun::star::uno::Reference< 
::com::sun::star::frame::XFramesSupplier >            m_xDesktop;
     ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >    
         m_xLastKnownConnection;
 
        OInterceptor*                                                           
                                                                                
m_pInterceptor;
@@ -208,6 +208,11 @@
             the controller which belongs to the XModel of our (active) 
embedded object
     */
     void impl_initObjectEditView( const ::com::sun::star::uno::Reference< 
::com::sun::star::frame::XController >& _rxController );
+
+    /** removes the given frame from the desktop's frame collection
+        @raises ::com::sun::star::uno::RuntimeException
+    */
+    void impl_removeFrameFromDesktop_throw( const 
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame );
 
 protected:
        // OPropertyArrayUsageHelper




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

Reply via email to