User: kz      
Date: 2008-05-05 16:31:33+0000
Modified:
   dba/dbaccess/source/core/dataaccess/databasecontext.cxx

Log:
 INTEGRATION: CWS dba30b (1.38.4); FILE MERGED
 2008/04/15 22:12:08 fs 1.38.4.4: RESYNC: (1.38-1.39); FILE MERGED
 2008/03/17 10:54:22 fs 1.38.4.3: for convenience: as long as 'macros in 
database documents' are not implemented, still add the 'ThisDatabaseDocument' 
variable to the BasicManager of a form/report
 2008/03/17 10:11:03 fs 1.38.4.2: #i87121# corrected assertion
 2008/03/17 09:27:17 fs 1.38.4.1: #i85010# provide an interaction handler and 
macro execution mode when newly-creating a database document

File Changes:

Directory: /dba/dbaccess/source/core/dataaccess/
================================================

File [changed]: databasecontext.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/databasecontext.cxx?r1=1.40&r2=1.41
Delta lines:  +20 -8
--------------------
--- databasecontext.cxx 2008-04-22 15:52:23+0000        1.40
+++ databasecontext.cxx 2008-05-05 16:31:31+0000        1.41
@@ -53,6 +53,7 @@
 #include <com/sun/star/task/InteractionClassification.hpp>
 #include <com/sun/star/ucb/InteractiveIOException.hpp>
 #include <com/sun/star/ucb/IOErrorCode.hpp>
+#include <com/sun/star/document/MacroExecMode.hpp>
 /** === end UNO includes === **/
 
 #include <basic/basmgr.hxx>
@@ -333,14 +334,15 @@
     {
                pExistent.set( new ODatabaseModelImpl( _rName, 
m_aContext.getLegacyServiceFactory(), this ) );
 
-           Sequence< PropertyValue > aArgs(1);
-           aArgs[0].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FileName"));
-           aArgs[0].Value <<= _sURL;
+        ::comphelper::NamedValueCollection aArgs;
+        aArgs.put( "FileName", _sURL );
+        aArgs.put( "MacroExecutionMode", MacroExecMode::USE_CONFIG );
+        aArgs.put( "InteractionHandler", m_aContext.createComponent( 
"com.sun.star.sdb.InteractionHandler" ) );
 
            Reference< XModel > xModel = 
pExistent->createNewModel_deliverOwnership();
         DBG_ASSERT( xModel.is(), "ODatabaseContext::loadObjectFromURL: no 
model?" );
         // calls registerPrivate in attachResource
-           xModel->attachResource( _sURL, aArgs );
+           xModel->attachResource( _sURL, aArgs.getPropertyValues() );
 
         ::utl::CloseableComponent aEnsureClose( xModel );
     }
@@ -473,8 +475,10 @@
     {
            m_aDatasourceProperties[ _rModelImpl.m_sName ] = 
aRememberProps.getPropertyValues();
     }
-    else {
-        OSL_ENSURE( false, "ODatabaseContext::storeTransientProperties: don't 
know this data source!s" );
+    else
+    {
+        OSL_ENSURE( ( sDocumentURL.getLength() == 0 ) && ( 
_rModelImpl.m_sName.getLength() == 0 ),
+            "ODatabaseContext::storeTransientProperties: a non-empty data 
source which I do not know?!" );
     }
 }
 
@@ -691,9 +695,17 @@
 // 
-----------------------------------------------------------------------------
 void ODatabaseContext::onBasicManagerCreated( const Reference< XModel >& 
_rxForDocument, BasicManager& _rBasicManager )
 {
-    // if it's a database document whose BasicManager has just been created, 
add the global
-    // DatabaseDocument variable to its scope.
+    // if it's a database document ...
     Reference< XOfficeDatabaseDocument > xDatabaseDocument( _rxForDocument, 
UNO_QUERY );
+    // ... or a sub document of a database document ...
+    if ( !xDatabaseDocument.is() )
+    {
+        Reference< XChild > xDocAsChild( _rxForDocument, UNO_QUERY );
+        if ( xDocAsChild.is() )
+            xDatabaseDocument.set( xDocAsChild->getParent(), UNO_QUERY );
+    }
+
+    // ... whose BasicManager has just been created, then add the global 
DatabaseDocument variable to its scope.
     if ( xDatabaseDocument.is() )
         _rBasicManager.SetGlobalUNOConstant( "ThisDatabaseDocument", makeAny( 
xDatabaseDocument ) );
 }




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

Reply via email to