User: ihi     
Date: 2006/08/28 08:07:08

Modified:
   dba/dbaccess/source/ui/dlg/dbwizsetup.cxx

Log:
 INTEGRATION: CWS dba205a (1.18.12); FILE MERGED
 2006/07/27 07:19:47 fs 1.18.12.1: #i66049# when loading an existing document, 
do this asynchronously, and use the Desktop's frame loader

File Changes:

Directory: /dba/dbaccess/source/ui/dlg/
=======================================

File [changed]: dbwizsetup.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/dlg/dbwizsetup.cxx?r1=1.18&r2=1.19
Delta lines:  +59 -29
---------------------
--- dbwizsetup.cxx      20 Jun 2006 03:06:31 -0000      1.18
+++ dbwizsetup.cxx      28 Aug 2006 15:07:06 -0000      1.19
@@ -108,6 +108,9 @@
 #ifndef _DBAUI_DBADMIN_HRC_
 #include "dbadmin.hrc"
 #endif
+#ifndef DBAUI_ASYNCRONOUSLINK_HXX
+#include "AsyncronousLink.hxx"
+#endif
 #ifndef _COM_SUN_STAR_FRAME_XSTORABLE_HPP_
 #include <com/sun/star/frame/XStorable.hpp>
 #endif
@@ -168,6 +171,9 @@
 #ifndef _COMPHELPER_SEQUENCEASHASHMAP_HXX_
 #include <comphelper/sequenceashashmap.hxx>
 #endif
+#ifndef TOOLS_DIAGNOSE_EX_H
+#include <tools/diagnose_ex.h>
+#endif
 
 #ifndef _COM_SUN_STAR_UCB_IOERRORCODE_HPP_
 #include <com/sun/star/ucb/IOErrorCode.hpp>
@@ -1087,13 +1093,6 @@
 
 
     //-------------------------------------------------------------------------
-    short ODbTypeWizDialogSetup::Execute()
-    {
-        short nResult = ModalDialog::Execute();
-        return nResult;
-    }
-
-    //-------------------------------------------------------------------------
     sal_Bool ODbTypeWizDialogSetup::callSaveAsDialog()
     {
         sal_Bool bRet = sal_False;
@@ -1179,36 +1178,67 @@
     }
 
     // 
-----------------------------------------------------------------------------
+    namespace
+    {
+        // 
.............................................................................
+        class AsyncLoader
+        {
+        private:
+            Reference< XComponentLoader >   m_xFrameLoader;
+            ::rtl::OUString                 m_sURL;
+            OAsyncronousLink                m_aAsyncCaller;
+
+        public:
+            AsyncLoader( const Reference< XComponentLoader >& _rxLoader, const 
::rtl::OUString& _rURL )
+                :m_xFrameLoader( _rxLoader )
+                ,m_sURL( _rURL )
+                ,m_aAsyncCaller( LINK( this, AsyncLoader, OnOpenDocument ) )
+            {
+            }
+
+            void doLoadAsync()
+            {
+                m_aAsyncCaller.Call( NULL );
+            }
+
+        private:
+            DECL_LINK( OnOpenDocument, void* );
+        };
+
+        // 
.............................................................................
+        IMPL_LINK( AsyncLoader, OnOpenDocument, void*, /*_pEmptyArg*/ )
+        {
+            m_xFrameLoader->loadComponentFromURL( m_sURL,
+                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ), 
FrameSearchFlag::ALL, Sequence<PropertyValue >() );
+            delete this;
+            return 0L;
+        }
+    }
+
+    // 
-----------------------------------------------------------------------------
     sal_Bool ODbTypeWizDialogSetup::onFinish(sal_Int32 _nResult)
     {
         if ( m_pGeneralPage->GetDatabaseCreationMode() == 
OGeneralPage::eOpenExisting )
         {
-            if ( !OWizardMachine::onFinish( _nResult ) )
+            // we're not going to re-use the XModel we have - since the 
document the user
+            // wants us to load could be a non-database document. Instead, we 
asynchronously
+            // open the selected document. Thus, the wizard's return value is 
RET_CANCEL,
+            // which means to not continue loading the database document
+            if ( !OWizardMachine::onFinish( RET_CANCEL ) )
                 return sal_False;
 
-            Reference< XModel > xModel( m_pImpl->getCurrentModel() );
-            DBG_ASSERT( xModel.is(), "ODbTypeWizDialogSetup::onFinish: no 
model?" );
-            if ( xModel.is() )
-            {
-                OGeneralPage::DocumentDescriptor aDocument( 
m_pGeneralPage->GetSelectedDocument() );
-
-                ::comphelper::SequenceAsHashMap aLoadArgs;
-                aLoadArgs.createItemIfMissing( ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "FileName" ) ),
-                    ::rtl::OUString( aDocument.sURL ) );
-                aLoadArgs.createItemIfMissing( ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "URL" ) ),
-                    ::rtl::OUString( aDocument.sURL ) );
-                aLoadArgs.createItemIfMissing( ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) ),
-                    ::rtl::OUString( aDocument.sFilter ) );
+            Reference< XComponentLoader > xFrameLoader;
                 try
                 {
-                    xModel->attachResource( aDocument.sURL, 
aLoadArgs.getAsConstPropertyValueList() );
+                xFrameLoader = Reference< XComponentLoader >( 
getORB()->createInstance( SERVICE_FRAME_DESKTOP ), UNO_QUERY_THROW );
                 }
-                catch( const Exception& e )
+            catch( const Exception& )
                 {
-                    DBG_ERROR( "ODbTypeWizDialogSetup::onFinish: caught an 
exception while loading the document!" );
-                    (void)e;
-                }
+                DBG_UNHANDLED_EXCEPTION();
             }
+
+            AsyncLoader* pAsyncLoader = new AsyncLoader( xFrameLoader, 
m_pGeneralPage->GetSelectedDocument().sURL );
+            pAsyncLoader->doLoadAsync();
 
             return sal_True;
         }




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

Reply via email to