User: ihi     
Date: 2007-11-21 15:37:48+0000
Modified:
   dba/dbaccess/source/core/dataaccess/databasedocument.cxx

Log:
 INTEGRATION: CWS dba24c (1.34.4); FILE MERGED
 2007/10/22 21:00:41 fs 1.34.4.3: during #i73705# #i52527#: 
ODatabaseModelImpl::m_aContainer not publicly accessible anymore / some other 
small refactoring
 2007/10/22 10:27:19 fs 1.34.4.2: todo
 2007/10/22 08:25:24 fs 1.34.4.1: #i52527#/#i73705#: connectController: check 
the DB doc's macro mode

File Changes:

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

File [changed]: databasedocument.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/databasedocument.cxx?r1=1.35&r2=1.36
Delta lines:  +28 -9
--------------------
--- databasedocument.cxx        2007-11-09 08:11:44+0000        1.35
+++ databasedocument.cxx        2007-11-21 15:37:45+0000        1.36
@@ -45,6 +45,7 @@
 #include "dbastrings.hrc"
 #endif
 #include <comphelper/documentconstants.hxx>
+#include <comphelper/namedvaluecollection.hxx>
 #include <comphelper/enumhelper.hxx>
 #ifndef _COM_SUN_STAR_EMBED_XTRANSACTEDOBJECT_HPP_
 #include <com/sun/star/embed/XTransactedObject.hpp>
@@ -208,7 +209,6 @@
 void lcl_stripLoadArguments( ::comphelper::MediaDescriptor& _rDescriptor, 
Sequence< PropertyValue >& _rArgs )
 {
     _rDescriptor.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"StatusIndicator" ) ) );
-    _rDescriptor.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"InteractionHandler" ) ) );
        _rDescriptor.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"Model" ) ) );
     _rDescriptor >> _rArgs;
 }
@@ -259,6 +259,7 @@
        }
        catch(const Exception&)
        {
+        DBG_UNHANDLED_EXCEPTION();
                m_pImpl->m_xStorage = NULL;
        }
 
@@ -340,7 +341,25 @@
 void SAL_CALL ODatabaseDocument::connectController( const Reference< 
XController >& _xController ) throw (RuntimeException)
 {
     ModelMethodGuard aGuard( *this );
+
     m_aControllers.push_back( _xController );
+
+    if ( m_aControllers.size() == 1 )
+    {
+        // check/adjust our macro mode. Note: This is only temporary. When we 
fully support the
+        // XEmbeddedScripts interface, then the controller is able to do this 
itself, since
+        // we'll then have a UNO method for this.
+        //
+        // Also, the same has to happen in the loader then, since the checks 
must be made
+        // *before* OnLoad events are triggered - finally, the user can bind 
events to OnLoad ...
+        // (This, at the latest, implies we need a UNO equivalent for 
checkMacrosOnLoading, else
+        //  the loader can't call it.)
+        //
+        // For now, as long as we do not have own macros, but only those in 
the embedded
+        // forms/reports, it's sufficient to do the check here.
+        //
+        m_pImpl->checkMacrosOnLoading();
+    }
 }
 // 
-----------------------------------------------------------------------------
 void SAL_CALL ODatabaseDocument::disconnectController( const Reference< 
XController >& _xController ) throw (RuntimeException)
@@ -358,6 +377,11 @@
 
     if ( m_aControllers.empty() )
     {
+        // reset the macro mode: in case the our impl struct stays alive (e.g. 
because our DataSource
+        // object still exists), and somebody subsequently re-opens the 
document, we want to have
+        // the security warning, again.
+        m_pImpl->resetMacroExecutionMode();
+
         // if this was the last view, close the document as a whole
         // #i51157# / 2006-03-16 / [EMAIL PROTECTED]
         try
@@ -525,7 +549,7 @@
 
         if ( !xStorage.is() )
         {
-            // TODO: localize this
+            // TODO: resource
             ::rtl::OUString sMessage = ::rtl::OUString::createFromAscii( 
"Could not store the database document to '" );
             sMessage += _rURL;
             sMessage += ::rtl::OUString::createFromAscii( "'." );
@@ -747,13 +771,8 @@
     Reference< XNameAccess > xContainer = rContainerRef;
        if ( !xContainer.is() )
        {
-               if ( !m_pImpl->m_aContainer[ _eType ].get() )
-               {
-                       m_pImpl->m_aContainer[ _eType ] = TContentPtr( new 
ODefinitionContainer_Impl );
-                       m_pImpl->m_aContainer[ _eType ]->m_pDataSource = 
m_pImpl.get();
-                       m_pImpl->m_aContainer[ _eType ]->m_aProps.aTitle = 
::rtl::OUString::createFromAscii( bFormsContainer ? "forms" : "reports" );
-               }
-        rContainerRef = xContainer = new ODocumentContainer( 
m_pImpl->m_xServiceFactory, *this, m_pImpl->m_aContainer[ _eType ], 
bFormsContainer );
+        TContentPtr& rContainerData( m_pImpl->getObjectContainer( _eType ) );
+        rContainerRef = xContainer = new ODocumentContainer( 
m_pImpl->m_xServiceFactory, *this, rContainerData, bFormsContainer );
         impl_reparent_nothrow( xContainer );
        }
        return xContainer;




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

Reply via email to