Tag: cws_src680_asyncdialogs2
User: pb      
Date: 2008-04-07 09:30:40+0000
Removed:
   dba/dbaccess/source/core/misc/propertybag.cxx
   dba/dbaccess/source/core/misc/propertybag.hxx
   dba/dbaccess/source/ui/inc/componentclientmonitor.hxx
   dba/dbaccess/source/ui/misc/componentclientmonitor.cxx
   dba/dbaccess/uiconfig/dbbrowser/menubar/menubar.xml
   dba/dbaccess/uiconfig/dbbrowser/toolbar/browserobjectbar.xml
   dba/dbaccess/uiconfig/dbbrowser/toolbar/copyobjectbar.xml

Modified:
   dba/dbaccess/source/ui/app/AppController.cxx
   dba/dbaccess/source/ui/app/AppController.hxx

Log:
 RESYNC:; FILE REMOVED

File Changes:

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

File [removed]: propertybag.cxx

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

File [removed]: propertybag.hxx

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

File [changed]: AppController.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/AppController.cxx?r1=1.37.34.11&r2=1.37.34.12
Delta lines:  +223 -155
-----------------------
--- AppController.cxx   2008-02-04 05:19:31+0000        1.37.34.11
+++ AppController.cxx   2008-04-07 09:29:40+0000        1.37.34.12
@@ -41,81 +41,35 @@
 #include "advancedsettingsdlg.hxx"
 
 /** === begin UNO includes === **/
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
-#include <com/sun/star/container/XNameContainer.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMEACCESS_HPP_
-#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UNO_XNAMINGSERVICE_HPP_
-#include <com/sun/star/uno/XNamingService.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XDATASOURCE_HPP_
-#include <com/sun/star/sdbc/XDataSource.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
+#include <com/sun/star/beans/NamedValue.hpp>
 #include <com/sun/star/container/XChild.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINER_HPP_
 #include <com/sun/star/container/XContainer.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XBOOKMARKSSUPPLIER_HPP_
-#include <com/sun/star/sdb/XBookmarksSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XCONTENTENUMERATIONACCESS_HPP_
 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XAPPEND_HPP_
-#include <com/sun/star/sdbcx/XAppend.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XALTERVIEW_HPP_
-#include <com/sun/star/sdbcx/XAlterView.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XOFFICEDATABASEDOCUMENT_HPP_
-#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
-#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XRENAME_HPP_
-#include <com/sun/star/sdbcx/XRename.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XVIEWSSUPPLIER_HPP_
-#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/container/XHierarchicalNameContainer.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
 #include <com/sun/star/sdb/CommandType.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_
 #include <com/sun/star/sdb/SQLContext.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XQUERYDEFINITIONSSUPPLIER_HPP_
+#include <com/sun/star/sdb/XBookmarksSupplier.hpp>
+#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
 #include <com/sun/star/sdb/XQueryDefinitionsSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTER_HPP_
-#include <com/sun/star/util/XNumberFormatter.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMECONTAINER_HPP_
-#include <com/sun/star/container/XHierarchicalNameContainer.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UTIL_XMODIFYBROADCASTER_HPP_
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UTIL_XMODIFIABLE_HPP_
-#include <com/sun/star/util/XModifiable.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FRAME_XSTORABLE_HPP_
-#include <com/sun/star/frame/XStorable.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
-#include <com/sun/star/frame/FrameSearchFlag.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UTIL_XFLUSHABLE_HPP_
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/sdbcx/XAlterView.hpp>
+#include <com/sun/star/sdbcx/XAppend.hpp>
+#include <com/sun/star/sdbcx/XRename.hpp>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/uno/XNamingService.hpp>
 #include <com/sun/star/util/XFlushable.hpp>
-#endif
-#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
-#include "com/sun/star/beans/NamedValue.hpp"
-
+#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/document/XEmbeddedScripts.hpp>
+#include <com/sun/star/frame/XModel2.hpp>
 /** === end UNO includes === **/
 
 #ifndef _TOOLS_DEBUG_HXX
@@ -130,9 +84,15 @@
 #ifndef _COMPHELPER_TYPES_HXX_
 #include <comphelper/types.hxx>
 #endif
+#ifndef COMPHELPER_COMPONENTCONTEXT_HXX
+#include <comphelper/componentcontext.hxx>
+#endif
 #ifndef _SV_MSGBOX_HXX
 #include <vcl/msgbox.hxx>
 #endif
+#ifndef _VCL_STDTEXT_HXX
+#include <vcl/stdtext.hxx>
+#endif
 #ifndef _FILEDLGHELPER_HXX
 #include <sfx2/filedlghelper.hxx>
 #endif
@@ -253,19 +213,19 @@
 #ifndef _COMPHELPER_SEQUENCE_HXX_
 #include <comphelper/sequence.hxx>
 #endif
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
 #ifndef _DBACCESS_SLOTID_HRC_
 #include "dbaccess_slotid.hrc"
 #endif
+
 #include <boost/mem_fn.hpp>
 #include <boost/bind.hpp>
 #include <boost/utility.hpp>
 #include <algorithm>
 #include <functional>
 
-#define APP_SIZE_WIDTH 350
-#define APP_SIZE_HEIGHT        250
-
-
 extern "C" void SAL_CALL createRegistryInfo_ODBApplication()
 {
        static ::dbaui::OMultiInstanceAutoRegistration< 
::dbaui::OApplicationController > aAutoRegistration;
@@ -288,6 +248,8 @@
 using namespace ::com::sun::star::sdbc;
 using namespace ::com::sun::star::sdbcx;
 using namespace ::com::sun::star::datatransfer;
+using namespace ::com::sun::star::ui::dialogs;
+using ::com::sun::star::document::XEmbeddedScripts;
 
 
//------------------------------------------------------------------------------
 ::rtl::OUString SAL_CALL OApplicationController::getImplementationName() 
throw( RuntimeException )
@@ -343,9 +305,9 @@
        ,m_aTableCopyHelper(this)
        ,m_pClipbordNotifier(NULL)
        ,m_nAsyncDrop(0)
+    ,m_aControllerConnectedEvent( LINK( this, OApplicationController, 
OnFirstControllerConnected ) )
        ,m_ePreviewMode(E_PREVIEWNONE)
-       ,m_eOldType(E_NONE)
-       ,m_bPreviewEnabled(sal_True)
+       ,m_eCurrentType(E_NONE)
        ,m_bNeedToReconnect(sal_False)
        ,m_bSuspended( sal_False )
        ,m_bEmptyFilter( sal_False)
@@ -402,6 +364,8 @@
 //--------------------------------------------------------------------
 void SAL_CALL OApplicationController::disposing()
 {
+    m_aControllerConnectedEvent.CancelCall();
+
        
::std::for_each(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),XContainerFunctor(this));
        m_aCurrentContainers.clear();
 
@@ -579,7 +543,7 @@
 
     if ( m_bSuspended != bSuspend )
     {
-           if ( bSuspend && !suspendDocuments( bSuspend ))
+           if ( bSuspend && !closeSubComponents() )
                    return sal_False;
 
            Reference<XModifiable> xModi(m_xModel,UNO_QUERY);
@@ -588,12 +552,10 @@
            if  (   bSuspend
             &&  xStor.is()
             &&  !xStor->isReadonly()
-            &&  (   m_bCurrentlyModified
-                ||  (   xModi.is()
+            &&  (   xModi.is()
                     &&  xModi->isModified()
                     )
                 )
-            )
            {
                    switch 
(ExecuteQuerySaveDocument(getView(),getStrippedDatabaseName()))
                    {
@@ -666,7 +628,7 @@
                                aReturn.bEnabled = sal_True;
                                break;
                        case ID_BROWSER_SAVEDOC:
-                               aReturn.bEnabled = !isDataSourceReadOnly() && 
m_bCurrentlyModified;
+                               aReturn.bEnabled = !isDataSourceReadOnly() && 
m_xDocumentModify.is() && m_xDocumentModify->isModified();
                                break;
                        case ID_BROWSER_SAVEASDOC:
                                aReturn.bEnabled = sal_True;
@@ -743,6 +705,21 @@
                        case ID_DIRECT_SQL:
                                aReturn.bEnabled = sal_True;
                                break;
+            case ID_MIGRATE_SCRIPTS:
+            {
+                // Our document supports embedding scripts into it, if and 
only if there are no
+                // forms/reports with macros/scripts into them. So, we need to 
enable migration
+                // if and only if the database document does *not* support 
embedding scripts.
+//                bool bAvailable = !Reference< XEmbeddedScripts >( m_xModel, 
UNO_QUERY ).is();
+                // TODO: revert to the disabled code. The current version is 
just to be able
+                // to integrate an intermediate version of the CWS, which 
should behave as
+                // if no macros in DB docs are allowed
+                bool bAvailable = false;
+                aReturn.bEnabled = bAvailable;
+                if ( !bAvailable )
+                    aReturn.bInvisible = true;
+            }
+            break;
                        case SID_APP_NEW_FOLDER:
                                aReturn.bEnabled = !isDataSourceReadOnly() && 
getContainer()->getSelectionCount() <= 1;
                                if ( aReturn.bEnabled )
@@ -1130,10 +1107,7 @@
                                {
                                        Reference<XStorable> 
xStore(m_xModel,UNO_QUERY);
                                        if ( xStore.is() )
-                                       {
                                                xStore->store();
-                                               m_bCurrentlyModified = 
sal_False;
-                                       }
                                }
                                break;
                        case ID_BROWSER_SAVEASDOC:
@@ -1243,7 +1217,7 @@
                     SharedConnection xConnection( ensureConnection() );
                                        if ( xConnection.is() )
                                        {
-                                               QueryDesigner aDesigner( 
getORB(), this, m_xCurrentFrame, true, SID_DB_NEW_VIEW_SQL == _nId );
+                                               QueryDesigner aDesigner( 
getORB(), this, getFrame(), true, SID_DB_NEW_VIEW_SQL == _nId );
 
                         Reference< XDataSource > xDataSource( m_xDataSource, 
UNO_QUERY );
                                                Reference< XComponent > 
xComponent( aDesigner.createNew( xDataSource ), UNO_QUERY );
@@ -1292,7 +1266,7 @@
                                        SharedConnection xConnection( 
ensureConnection() );
                                        if ( xConnection.is() )
                                        {
-                                               RelationDesigner aDesigner( 
getORB(), this, m_xCurrentFrame );
+                                               RelationDesigner aDesigner( 
getORB(), this, getFrame() );
                         Reference< XDataSource > xDataSource( m_xDataSource, 
UNO_QUERY );
                                                Reference< XComponent > 
xComponent( aDesigner.createNew( xDataSource ), UNO_QUERY );
                                                addDocumentListener( 
xComponent, NULL );
@@ -1332,17 +1306,20 @@
                                                openDirectSQLDialog();
                                }
                                break;
+            case ID_MIGRATE_SCRIPTS:
+                impl_migrateScripts_nothrow();
+                break;
                        case SID_DB_APP_VIEW_TABLES:
-                               getContainer()->changeContainer(E_TABLE);
+                               getContainer()->selectContainer(E_TABLE);
                                break;
                        case SID_DB_APP_VIEW_QUERIES:
-                               getContainer()->changeContainer(E_QUERY);
+                               getContainer()->selectContainer(E_QUERY);
                                break;
                        case SID_DB_APP_VIEW_FORMS:
-                               getContainer()->changeContainer(E_FORM);
+                               getContainer()->selectContainer(E_FORM);
                                break;
                        case SID_DB_APP_VIEW_REPORTS:
-                               getContainer()->changeContainer(E_REPORT);
+                               getContainer()->selectContainer(E_REPORT);
                                break;
                        case SID_DB_APP_DISABLE_PREVIEW:
                                m_ePreviewMode = E_PREVIEWNONE;
@@ -1360,7 +1337,7 @@
                                {
                                        SfxMailModel aSendMail;
                     if ( aSendMail.AttachDocument(rtl::OUString(),getModel(), 
rtl::OUString()) == SfxMailModel::SEND_MAIL_OK )
-                                               aSendMail.Send(m_xCurrentFrame);
+                                               aSendMail.Send( getFrame() );
                                }
                                break;
                        case SID_DB_APP_SENDREPORTASMAIL:
@@ -1400,7 +1377,6 @@
                                        }
                                }
                        }
-
                }
        }
         catch( const Exception& )
@@ -1492,6 +1468,7 @@
     implDescribeSupportedFeature( ".uno:DBConvertToView",    
SID_DB_APP_CONVERTTOVIEW,  CommandGroup::EDIT );
     implDescribeSupportedFeature( ".uno:DBRefreshTables",    
SID_DB_APP_REFRESH_TABLES, CommandGroup::APPLICATION );
     implDescribeSupportedFeature( ".uno:DBDirectSQL",        ID_DIRECT_SQL,    
         CommandGroup::APPLICATION );
+    implDescribeSupportedFeature( ".uno:DBMigrateScripts",   
ID_MIGRATE_SCRIPTS,        CommandGroup::APPLICATION );
     implDescribeSupportedFeature( ".uno:DBViewTables",       
SID_DB_APP_VIEW_TABLES,    CommandGroup::VIEW );
     implDescribeSupportedFeature( ".uno:DBViewQueries",      
SID_DB_APP_VIEW_QUERIES,   CommandGroup::VIEW );
     implDescribeSupportedFeature( ".uno:DBViewForms",        
SID_DB_APP_VIEW_FORMS,     CommandGroup::VIEW );
@@ -1680,12 +1657,10 @@
 sal_Bool OApplicationController::onContainerSelect(ElementType _eType)
 {
        OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
-    Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager = 
getLayoutManager(getFrame());
 
-    if ( xLayoutManager.is() && m_eOldType != _eType)
+    if ( m_eCurrentType != _eType && _eType != E_NONE )
        {
-               sal_Bool bAdd = _eType != E_TABLE;
-               if ( !bAdd )
+               if ( _eType == E_TABLE )
                {
                        try
                        {
@@ -1702,13 +1677,16 @@
                                        return sal_False;
                                }
                        }
-                       catch(Exception)
+                       catch( const Exception& )
                        {
                                return sal_False;
                        }
                }
+        Reference< XLayoutManager > xLayoutManager = getLayoutManager( 
getFrame() );
+        if ( xLayoutManager.is() )
+        {
                ::rtl::OUString sToolbar = lcl_getToolBarResource(_eType);
-               ::rtl::OUString sDestroyToolbar = 
lcl_getToolBarResource(m_eOldType);
+                   ::rtl::OUString sDestroyToolbar = 
lcl_getToolBarResource(m_eCurrentType);
 
                xLayoutManager->lock();
                xLayoutManager->destroyElement( sDestroyToolbar );
@@ -1719,7 +1697,9 @@
                }
                xLayoutManager->unlock();
                xLayoutManager->doLayout();
-               if ( bAdd && getContainer()->getDetailView() )
+        }
+
+               if ( _eType != E_TABLE && getContainer()->getDetailView() )
                {
                        Reference< XNameAccess > xContainer = 
getElements(_eType);
                        addContainerListener(xContainer);
@@ -1731,7 +1711,7 @@
         m_aSelectionListeners.forEach<XSelectionChangeListener>(
                    
::boost::bind(&XSelectionChangeListener::selectionChanged,_1,boost::cref(aEvent)));
        }
-       m_eOldType = _eType;
+       m_eCurrentType = _eType;
 
        return sal_True;
 }
@@ -1803,8 +1783,7 @@
                ::std::auto_ptr<OLinkedDocumentsAccess> aHelper = 
getDocumentsAccess(_eType);
                Reference< XComponent > xDefinition;
                xRet.set(aHelper->open(_sName, 
xDefinition,_eOpenMode),UNO_QUERY);
-               if (_eOpenMode == OLinkedDocumentsAccess::OPEN_DESIGN ||
-               _eType == E_FORM )
+               if (_eOpenMode == OLinkedDocumentsAccess::OPEN_DESIGN || _eType 
== E_FORM )
                {       
                //      // LLA: close only if in EDIT mode
                        addDocumentListener(xRet,xDefinition);
@@ -1829,23 +1808,23 @@
                        if ( _eType == E_TABLE )
                        {
                 if ( impl_isAlterableView_nothrow( _sName ) )
-                    pDesigner.reset( new QueryDesigner( getORB(), this, 
m_xCurrentFrame, true, bQuerySQLMode ) );
+                    pDesigner.reset( new QueryDesigner( getORB(), this, 
getFrame(), true, bQuerySQLMode ) );
                 else
-                    pDesigner.reset( new TableDesigner( getORB(), this, 
m_xCurrentFrame ) );
+                    pDesigner.reset( new TableDesigner( getORB(), this, 
getFrame() ) );
                        }
                        else if ( _eType == E_QUERY )
                        {
-                pDesigner.reset( new QueryDesigner( getORB(), this, 
m_xCurrentFrame, false, bQuerySQLMode ) );
+                pDesigner.reset( new QueryDesigner( getORB(), this, 
getFrame(), false, bQuerySQLMode ) );
                        }
                        else if ( _eType == E_REPORT )
                        {
-                               pDesigner.reset( new ReportDesigner( 
getORB(),this, m_xCurrentFrame ) );
+                               pDesigner.reset( new ReportDesigner( 
getORB(),this, getFrame() ) );
                        }
                        aDataSource <<= m_xDataSource;
                }
                else
                {
-                       pDesigner.reset( new ResultSetBrowser( getORB(), this, 
m_xCurrentFrame, _eType == E_TABLE ) );
+                       pDesigner.reset( new ResultSetBrowser( getORB(), this, 
getFrame(), _eType == E_TABLE ) );
 
                        aArgs.realloc(1);
                        aArgs[0].Name = PROPERTY_SHOWMENU;
@@ -1945,14 +1924,14 @@
                                {
                                        if ( _eType == E_TABLE )
                                        {
-                                               pDesigner.reset( new 
TableDesigner( getORB(), this, m_xCurrentFrame ) );
+                                               pDesigner.reset( new 
TableDesigner( getORB(), this, getFrame() ) );
                                        }
                                        else if ( _eType == E_QUERY )
                                        {
-                                               pDesigner.reset( new 
QueryDesigner( getORB(), this, m_xCurrentFrame, false, _bSQLView ) );
+                                               pDesigner.reset( new 
QueryDesigner( getORB(), this, getFrame(), false, _bSQLView ) );
                                        }
                                        else 
-                                               pDesigner.reset( new 
ReportDesigner( getORB(), this, m_xCurrentFrame ) );
+                                               pDesigner.reset( new 
ReportDesigner( getORB(), this, getFrame() ) );
 
                     Reference< XDataSource > xDataSource( m_xDataSource, 
UNO_QUERY );
                                        Reference< XComponent > xComponent( 
pDesigner->createNew( xDataSource ), UNO_QUERY );
@@ -2217,25 +2196,7 @@
        
        pView->showPreview(xContent);
 }
-//------------------------------------------------------------------------------
-void OApplicationController::frameAction(const FrameActionEvent& aEvent) 
throw( RuntimeException )
-{
-    ::osl::MutexGuard aGuard(m_aMutex);
-       if ((XFrame*)aEvent.Frame.get() == (XFrame*)m_xCurrentFrame.get())
-               switch (aEvent.Action)
-               {
-                       case FrameAction_FRAME_ACTIVATED:
-                       case FrameAction_FRAME_UI_ACTIVATED:
-                               m_bFrameUiActive = sal_True;
-                               break;
-                       case FrameAction_FRAME_DEACTIVATING:
-                       case FrameAction_FRAME_UI_DEACTIVATING:
-                               m_bFrameUiActive = sal_False;
-                               break;
-            default:
-                break;
-               }
-}
+
 
//------------------------------------------------------------------------------
 IMPL_LINK( OApplicationController, OnClipboardChanged, void*, EMPTYARG )
 {
@@ -2482,6 +2443,79 @@
 {
        return m_xModel;
 }
+
+// 
-----------------------------------------------------------------------------
+void OApplicationController::onConnectedModel()
+{
+    sal_Int32 nConnectedControllers( 0 );
+    try
+    {
+        Reference< XModel2 > xModel( m_xModel, UNO_QUERY_THROW );
+        Reference< XEnumeration > xEnumControllers( xModel->getControllers(), 
UNO_SET_THROW );
+        while ( xEnumControllers->hasMoreElements() )
+        {
+            Reference< XController > xController( 
xEnumControllers->nextElement(), UNO_QUERY_THROW );
+            ++nConnectedControllers;
+        }
+    }
+    catch( const Exception& )
+    {
+       DBG_UNHANDLED_EXCEPTION();
+    }
+
+    if ( nConnectedControllers > 1 )
+    {   // we are not the first connected controller, there were already others
+        return;
+    }
+
+    m_aControllerConnectedEvent.Call();
+}
+
+// 
-----------------------------------------------------------------------------
+IMPL_LINK( OApplicationController, OnFirstControllerConnected, void*, /**/ )
+{
+    // if we have forms or reports which contain macros/scripts, then show a 
warning
+    // which suggests the user to migrate them to the database document
+
+    // TODO: remove the following line. The current version is just to be able
+    // to integrate an intermediate version of the CWS, which should behave as
+    // if no macros in DB docs are allowed
+    return 0L;
+/*
+    Reference< XEmbeddedScripts > xDocumentScripts( m_xModel, UNO_QUERY );
+    if ( xDocumentScripts.is() )
+    {
+        // no need to show this warning, obviously the document supports 
embedding scripts
+        // into itself, so there are no "old-style" forms/reports which have 
macros/scripts
+        // themselves
+        return 0L;
+    }
+
+    SQLWarning aWarning;
+    aWarning.Message = String( ModuleRes( STR_SUB_DOCS_WITH_SCRIPTS ) );
+    SQLException aDetail;
+    aDetail.Message = String( ModuleRes( STR_SUB_DOCS_WITH_SCRIPTS_DETAIL ) );
+    aWarning.NextException <<= aDetail;
+
+    try
+    {
+        ::comphelper::ComponentContext aContext( getORB() );
+        Sequence< Any > aArgs(1);
+        aArgs[0] <<= NamedValue( PROPERTY_SQLEXCEPTION, makeAny( aWarning ) );
+        Reference< XExecutableDialog > xDialog(
+            aContext.createComponentWithArguments( 
"com.sun.star.sdb.ErrorMessageDialog", aArgs ),
+            UNO_QUERY_THROW );
+        xDialog->execute();
+    }
+    catch( const Exception& )
+    {
+       DBG_UNHANDLED_EXCEPTION();
+    }
+
+    return 1L;
+*/
+}
+
 // 
-----------------------------------------------------------------------------
 sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel 
> & _rxModel) throw( RuntimeException )
 {
@@ -2499,9 +2533,16 @@
 
     m_xModel = _rxModel;
     if ( _rxModel.is() )
+    {
+        m_xDocumentModify.set( m_xModel, UNO_QUERY_THROW );
         m_aModelConnector = ModelControllerConnector( _rxModel, this );
+        onConnectedModel();
+    }
     else
+    {
+        m_xDocumentModify.clear();
         m_aModelConnector.clear();
+    }
 
     m_xDataSource.set(xOfficeDoc.is() ? xOfficeDoc->getDataSource() : 
Reference<XDataSource>(),UNO_QUERY);
        if ( !m_xDataSource.is() )
@@ -2616,7 +2657,7 @@
                 pIter->Value >>= aSelection;
         }
 
-        getContainer()->changeContainer(eType);
+        getContainer()->selectContainer(eType);
         getContainer()->selectElements(aSelection);
         return sal_True;
     }
@@ -2648,6 +2689,33 @@
     return makeAny(aCurrentSelection);
 }
 
+// 
-----------------------------------------------------------------------------
+void OApplicationController::impl_migrateScripts_nothrow()
+{
+    try
+    {
+        ::rtl::OUString sDialogService( RTL_CONSTASCII_USTRINGPARAM( 
"com.sun.star.sdb.application.MacroMigrationWizard" ) );
+        ::comphelper::ComponentContext aContext( getORB() );
+        Sequence< Any > aDialogArgs(1);
+        aDialogArgs[0] <<= Reference< XOfficeDatabaseDocument >( m_xModel, 
UNO_QUERY_THROW );
+        Reference< XExecutableDialog > xDialog(
+            aContext.createComponentWithArguments( sDialogService, aDialogArgs 
),
+            UNO_QUERY );
+
+        if ( !xDialog.is() )
+        {
+            ShowServiceNotAvailableError( getView(), sDialogService, true );
+            return;
+        }
+
+        xDialog->execute();
+    }
+    catch( const Exception& )
+    {
+       DBG_UNHANDLED_EXCEPTION();
+    }
+}
+
 //........................................................................
 }      // namespace dbaui
 //........................................................................

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

File [changed]: AppController.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/AppController.hxx?r1=1.15.38.8&r2=1.15.38.9
Delta lines:  +50 -97
---------------------
--- AppController.hxx   2008-02-04 05:19:34+0000        1.15.38.8
+++ AppController.hxx   2008-04-07 09:29:44+0000        1.15.38.9
@@ -36,68 +36,31 @@
 #ifndef DBAUI_APPCONTROLLER_HXX
 #define DBAUI_APPCONTROLLER_HXX
 
-#ifndef DBAUI_GENERICCONTROLLER_HXX
-#include "genericcontroller.hxx"
-#endif
-#ifndef _SV_TIMER_HXX
-#include <vcl/timer.hxx>
-#endif
-#ifndef _CPPUHELPER_IMPLBASE3_HXX_
-#include <cppuhelper/implbase3.hxx>
-#endif
-#ifndef _COMPHELPER_STLTYPES_HXX_
-#include <comphelper/stl_types.hxx>
-#endif
-#ifndef _COMPHELPER_UNO3_HXX_
-#include <comphelper/uno3.hxx>
-#endif
-#ifndef _TRANSFER_HXX
-#include <svtools/transfer.hxx>
-#endif
-#ifndef _SVX_DATACCESSDESCRIPTOR_HXX_
-#include <svx/dataaccessdescriptor.hxx>
-#endif
-#ifndef DBAUI_APPELEMENTTYPE_HXX
 #include "AppElementType.hxx"
-#endif
-#ifndef _SOT_STORAGE_HXX
-#include <sot/storage.hxx>
-#endif
-#ifndef DBAUI_IAPPELEMENTNOTIFICATION_HXX
+#include "callbacks.hxx"
+#include "commontypes.hxx"
+#include "documentcontroller.hxx"
+#include "dsntypes.hxx"
+#include "genericcontroller.hxx"
 #include "IAppElementNotification.hxx"
-#endif
+#include "linkeddocuments.hxx"
+#include "moduledbu.hxx"
+#include "TableCopyHelper.hxx"
+
 /** === begin UNO includes === **/
-#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINERLISTENER_HPP_
-#include <com/sun/star/container/XContainerListener.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_
 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_APPLICATION_XDATABASEDOCUMENTUI_HPP_
+#include <com/sun/star/container/XContainerListener.hpp>
 #include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
-#endif
+#include <com/sun/star/util/XModifiable.hpp>
 /** === end UNO includes === **/
-#ifndef _DBACCESS_UI_CALLBACKS_HXX_
-#include "callbacks.hxx"
-#endif
-#ifndef _DBAUI_DSNTYPES_HXX_
-#include "dsntypes.hxx"
-#endif
-#ifndef DBUI_TABLECOPYHELPER_HXX
-#include "TableCopyHelper.hxx"
-#endif
-#ifndef _DBAUI_LINKEDDOCUMENTS_HXX_
-#include "linkeddocuments.hxx"
-#endif
-#ifndef DBACCESS_SOURCE_UI_INC_DOCUMENTCONTROLLER_HXX
-#include "documentcontroller.hxx"
-#endif
-#ifndef _DBAUI_COMMON_TYPES_HXX_
-#include "commontypes.hxx"
-#endif
-#ifndef _DBAUI_MODULE_DBU_HXX_
-#include "moduledbu.hxx"
-#endif
+
+#include <comphelper/stl_types.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <sot/storage.hxx>
+#include <svtools/transfer.hxx>
+#include <svx/dataaccessdescriptor.hxx>
+#include <vcl/timer.hxx>
 
 #include <memory>
 
@@ -115,6 +78,7 @@
 FORWARD_DECLARE_INTERFACE(util,XNumberFormatter)
 FORWARD_DECLARE_INTERFACE(util,XCloseable)
 FORWARD_DECLARE_INTERFACE(ucb,XContent)
+
 //........................................................................
 namespace dbaui
 {
@@ -139,7 +103,6 @@
                        ,public IContainerFoundListener
                        ,public IViewChangeListener
        {
-               friend class OConnectionChangeBroadcaster;
        public:
         typedef ::com::sun::star::uno::Reference< 
::com::sun::star::container::XContainer > TContainer;
                typedef ::std::vector< TContainer >                             
                    TContainerVector;
@@ -160,6 +123,8 @@
                ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySet >   m_xDataSource;
         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
                                 m_xModel;
+        ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable >
+                                m_xDocumentModify;
         ModelControllerConnector
                                 m_aModelConnector;
                TContainerVector                m_aCurrentContainers;   // the 
containers where we are listener on
@@ -170,13 +135,16 @@
                                                                
m_pClipbordNotifier;            // notifier for changes in the clipboard
                mutable ::rtl::OUString m_sDatabaseName;
                sal_Int32                               m_nAsyncDrop;
+        OAsyncronousLink        m_aControllerConnectedEvent;
                PreviewMode                             m_ePreviewMode;         
                // the mode of the preview
-               ElementType                             m_eOldType;
-               sal_Bool                                m_bPreviewEnabled;      
                // true when the preview should enabled
+               ElementType                             m_eCurrentType;
                sal_Bool                                m_bNeedToReconnect;     
                // true when the settings of the data source were modified and 
the connection is no longer up to date
-               sal_Bool                                m_bSuspended            
: 1;    // is true when the controller was already suspended
+        sal_Bool                m_bSuspended;               // is true when 
the controller was already suspended
                BOOL                                    m_bEmptyFilter;
-               ::std::auto_ptr<sfx2::FileDialogHelper> m_pDlgHelper;
+        ::std::auto_ptr<sfx2::FileDialogHelper>
+                                m_pDlgHelper;
+
+    private:
 
                OApplicationView*               getContainer() const;
 
@@ -296,14 +264,6 @@
                /// copies the current object into clipboard
                TransferableHelper* copyObject();
 
-               /** fills all elements of the wanted type into the list.
-                       @param  _eType
-                               The type.
-                       @param  _rList
-                               The list to fill.
-               */
-               void getElements(ElementType _eType,::std::vector< 
::rtl::OUString>& _rList);
-
                /// returns the nameaccess
                ::com::sun::star::uno::Reference< 
::com::sun::star::container::XNameAccess > getElements(ElementType _eType);
 
@@ -392,18 +352,6 @@
                */
                void askToReconnect();
 
-               /** suspend one document.
-                       @return
-                               <TRUE/> if the document could be suspended, 
otherwise <FALSE/>.
-               */
-               sal_Bool suspendDocument(const TDocuments::value_type& 
_xComponent,sal_Bool _bSuspend);
-
-               /** suspend all open documents.
-                       @return
-                               <TRUE/> if all documents could be suspended, 
otherwise <FALSE/>.
-               */
-               sal_Bool suspendDocuments(sal_Bool bSuspend);
-
                /** add event listener and remember the document
                        @param  _xDocument
                                the new document, may be <NULL/>
@@ -456,14 +404,23 @@
         /** select the give entry
         */
         void selectEntry(const ElementType _eType,const ::rtl::OUString& 
_sName);
-       protected:
-               // 
----------------------------------------------------------------
-               // initalizing members
-               /** forces usage of a connection which we do not own
-                       <p>To be used from within XInitialization::initialize 
only.</p>
+
+        /** called when we just connected to a new, non-NULL model
+
+            In particular, this is called *after* the controller has been 
announced to the model
+            (XModel::connectController)
+        */
+        void onConnectedModel();
+
+        /// determines whether the given table name denotes a view which can 
be altered
+        bool    impl_isAlterableView_nothrow( const ::rtl::OUString& 
_rTableOrViewName ) const;
+
+        /** does the macro/script migration, where macros/scripts in 
forms/reports are moved
+            to the database document itself.
                */
-               void                                    initializeConnection( 
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& 
_rxForeignConn );
+        void    impl_migrateScripts_nothrow();
 
+       protected:
                // state of a feature. 'feature' may be the handle of a 
::com::sun::star::util::URL somebody requested a dispatch interface for OR a 
toolbar slot.
                virtual FeatureState    GetState(sal_uInt16 nId) const;
                // execute a feature
@@ -479,7 +436,6 @@
                // OGenericUnoController
                virtual void                    updateTitle( );
         virtual void            onLoadedMenu( const 
::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& 
_xLayoutManager );
-               virtual void            impl_initialize();
 
                virtual ~OApplicationController();
 
@@ -503,9 +459,6 @@
                virtual sal_Bool SAL_CALL attachModel(const 
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel) 
throw( ::com::sun::star::uno::RuntimeException );
                virtual ::com::sun::star::uno::Reference< 
::com::sun::star::frame::XModel >  SAL_CALL getModel(void) throw( 
::com::sun::star::uno::RuntimeException );
 
-               // ::com::sun::star::frame::XFrameActionListener
-               virtual void SAL_CALL frameAction(const 
::com::sun::star::frame::FrameActionEvent& aEvent) throw( 
::com::sun::star::uno::RuntimeException );
-
                // ::com::sun::star::container::XContainerListener
                virtual void SAL_CALL elementInserted(const 
::com::sun::star::container::ContainerEvent& Event) throw( 
::com::sun::star::uno::RuntimeException );
                virtual void SAL_CALL elementRemoved(const 
::com::sun::star::container::ContainerEvent& Event) throw( 
::com::sun::star::uno::RuntimeException );
@@ -518,8 +471,10 @@
         virtual ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XDataSource > SAL_CALL getDataSource() throw 
(::com::sun::star::uno::RuntimeException);
         virtual ::com::sun::star::uno::Reference< 
::com::sun::star::awt::XWindow > SAL_CALL getApplicationMainWindow() throw 
(::com::sun::star::uno::RuntimeException);
         virtual ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XConnection > SAL_CALL getActiveConnection() throw 
(::com::sun::star::uno::RuntimeException);
+        virtual ::com::sun::star::uno::Sequence< 
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > > 
SAL_CALL getSubComponents() throw (::com::sun::star::uno::RuntimeException);
         virtual ::sal_Bool SAL_CALL isConnected(  ) throw 
(::com::sun::star::uno::RuntimeException);
         virtual ::sal_Bool SAL_CALL connect(  ) throw 
(::com::sun::star::uno::RuntimeException);
+        virtual ::sal_Bool SAL_CALL closeSubComponents(  ) throw 
(::com::sun::star::uno::RuntimeException);
 
         // XSelectionSupplier
         virtual ::sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& 
xSelection ) throw (::com::sun::star::lang::IllegalArgumentException, 
::com::sun::star::uno::RuntimeException);
@@ -566,6 +521,7 @@
                DECL_LINK( OnClipboardChanged, void* );
                DECL_LINK( OnAsyncDrop, void* );
                DECL_LINK( OnCreateWithPilot, void* );
+        DECL_LINK( OnFirstControllerConnected, void* );
                DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper* );
 
                // IContainerFoundListener
@@ -591,9 +547,6 @@
 
                // OComponentHelper
                virtual void SAL_CALL disposing();
-
-    private:
-        bool    impl_isAlterableView_nothrow( const ::rtl::OUString& 
_rTableOrViewName ) const;
        };
 
 //........................................................................

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

File [removed]: componentclientmonitor.hxx

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

File [removed]: componentclientmonitor.cxx

Directory: /dba/dbaccess/uiconfig/dbbrowser/menubar/
====================================================

File [removed]: menubar.xml

Directory: /dba/dbaccess/uiconfig/dbbrowser/toolbar/
====================================================

File [removed]: browserobjectbar.xml

Directory: /dba/dbaccess/uiconfig/dbbrowser/toolbar/
====================================================

File [removed]: copyobjectbar.xml




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

Reply via email to