User: rt      
Date: 2008-01-30 08:41:48+0000
Modified:
   dba/dbaccess/source/ui/app/AppControllerGen.cxx

Log:
 INTEGRATION: CWS dba24d (1.28.28); FILE MERGED
 2007/11/22 11:47:45 oj 1.28.28.2: #i83805# new command to suspend and shutdown 
the emebedded object
 2007/11/08 14:13:49 fs 1.28.28.1: during #i81658#: string cleanup

File Changes:

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

File [changed]: AppControllerGen.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/app/AppControllerGen.cxx?r1=1.29&r2=1.30
Delta lines:  +44 -71
---------------------
--- AppControllerGen.cxx        2008-01-29 14:07:10+0000        1.29
+++ AppControllerGen.cxx        2008-01-30 08:41:45+0000        1.30
@@ -39,6 +39,11 @@
 #ifndef DBAUI_APPCONTROLLER_HXX
 #include "AppController.hxx"
 #endif
+
+#include <com/sun/star/ucb/Command.hpp>
+#include <com/sun/star/ucb/XCommandProcessor.hpp>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+
 #ifndef _COM_SUN_STAR_SDB_XQUERIESSUPPLIER_HPP_
 #include <com/sun/star/sdb/XQueriesSupplier.hpp>
 #endif
@@ -244,7 +249,7 @@
                 m_aTableCopyHelper.pasteTable( _nFormatId, rClipboard, 
getDatabaseName(), ensureConnection() );
             }
                        else
-                               paste( 
eType,ODataAccessObjectTransferable::extractObjectDescriptor(rClipboard) );
+                               paste( eType, 
ODataAccessObjectTransferable::extractObjectDescriptor( rClipboard ) );
 
                }
                catch(Exception& )
@@ -299,7 +304,7 @@
         if ( xConnection.is() )
         {
                        aArgs[ nArgPos++ ] <<= PropertyValue(
-                               PROPERTY_ACTIVECONNECTION, 0,
+                               PROPERTY_ACTIVE_CONNECTION, 0,
                                makeAny( xConnection ), 
PropertyState_DIRECT_VALUE );
         }
         aArgs.realloc( nArgPos );
@@ -524,27 +529,39 @@
        }
 }
 // 
-----------------------------------------------------------------------------
-sal_Bool OApplicationController::suspendDocument(const TDocuments::key_type& 
_xComponent,sal_Bool _bSuspend)
+sal_Bool OApplicationController::suspendDocument(const TDocuments::value_type& 
_aComponent,sal_Bool _bSuspend)
 {
        sal_Bool bSuspended = sal_True;
        Reference<XController> xController;
-       Reference<XModel> xModel(_xComponent,UNO_QUERY);
+       Reference<XModel> xModel(_aComponent.first,UNO_QUERY);
        if ( xModel.is() )
                xController = xModel->getCurrentController();
        else
        {
-               xController.set(_xComponent,UNO_QUERY);
+               xController.set(_aComponent.first,UNO_QUERY);
                if ( !xController.is() )
                {
-                       Reference<XFrame> xFrame(_xComponent,UNO_QUERY);
+                       Reference<XFrame> xFrame(_aComponent.first,UNO_QUERY);
                        if ( xFrame.is() )
                                xController = xFrame->getController();
                }
        }
 
-
        if ( xController.is() && xController != *this )
+    {
+        Reference< XCommandProcessor > xContent(_aComponent.second,UNO_QUERY);
+               if ( xContent.is() )
+               {
+            if ( _bSuspend )
+            {
+                Command aCommand;
+                aCommand.Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("shutdown"));
+                           
xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference< 
XCommandEnvironment >()) >>= bSuspended;
+            }
+        }
+        else
                bSuspended = xController->suspend(_bSuspend);
+    }
 
        return bSuspended;
 }
@@ -555,12 +572,14 @@
        sal_Bool bSubSuspended = sal_True;
        Reference<XModel> xModel;
        sal_Int32 nSuspendPos = 1;
+    
        try
        {
-           TDocuments::iterator aIter = m_aDocuments.begin();
-           TDocuments::iterator aEnd = m_aDocuments.end();
+        TDocuments aCopy = m_aDocuments;
+           TDocuments::iterator aIter = aCopy.begin();
+           TDocuments::iterator aEnd = aCopy.end();
                for (; aIter != aEnd && bSubSuspended; ++aIter,++nSuspendPos)
-                       bSubSuspended = suspendDocument(aIter->first,bSuspend);
+                       bSubSuspended = suspendDocument(*aIter,bSuspend);
        }
        catch(Exception)
        {
@@ -576,77 +595,31 @@
                                Reference< XComponent > xDocument = 
document->first;
                                if ( xDocument.is() )
                                        
xDocument->removeEventListener(static_cast<XFrameActionListener*>(this));
-                       }
-                       document = m_aDocuments.begin();
-                       // first of all we have to set the second to NULL
-                       for (; document != documentEnd ;  )
-                       {
-                               TDocuments::iterator aPos = document++;
-                               aPos->second = NULL; // this may also dispose 
the document
-                       }
-                       // work on copy
-                       TDocuments      aDocuments = m_aDocuments;
-                       document = aDocuments.begin();
-                       documentEnd = aDocuments.end();
-                       for (; document != documentEnd ; ++document )
-                       {
-                               Reference<XController> xController;
-                               xModel.set(document->first,UNO_QUERY);
-                               if ( xModel.is() )
-                                       xController = 
xModel->getCurrentController();
-                               else
-                               {
-                                       
xController.set(document->first,UNO_QUERY);
-                                       if ( !xController.is() )
-                                       {
+                
                                                Reference<XFrame> 
xFrame(document->first,UNO_QUERY);
                                                if ( xFrame.is() )
-                                                       xController = 
xFrame->getController();
-                                       }
-                               }
-
-                               if ( xController.is() && xController != *this )
                                {
-                                       // Reference< 
com::sun::star::util::XCloseable> xCloseable(xController->getFrame(),UNO_QUERY);
-                                       // if ( xCloseable.is() )
-                                       //      xCloseable->close(sal_True);
-                                       ::com::sun::star::util::URL aUrl;// 
getURLForId(DISPATCH_CLOSEWIN);
-                                       aUrl.Complete = 
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:CloseDoc"));
-                    if (m_xUrlTransformer.is())
-                        m_xUrlTransformer->parseStrict(aUrl);
-                    try
+                    Reference<XController> xController = 
xFrame->getController();
+                    if ( xController.is() )
                     {
-                                               Reference<XDispatchProvider> 
xFrame(xController->getFrame(),UNO_QUERY);
-
-                        rtl::Reference< CloseChecker > xCloseChecker = new 
CloseChecker();
-                        Reference<XComponent> xComponent(xFrame, UNO_QUERY);
-                        if (xComponent.is())
-                        {
-                            xComponent->addEventListener( xCloseChecker.get() 
);
-                        }
-                        xFrame->queryDispatch(aUrl, 
rtl::OUString::createFromAscii("_self"), 0)->dispatch( aUrl, Sequence< 
PropertyValue >() );
-
-                                               if (! xCloseChecker->isClosed())
-                                               {
-                                                       bSubSuspended = 
sal_False;
+                        Reference< com::sun::star::util::XCloseable> 
xCloseable(xController->getFrame(),UNO_QUERY);
+                        if ( xCloseable.is() )
+                            xCloseable->close(sal_True);
                                                }
-                        if (xComponent.is())
-                        {
-                            xComponent->removeEventListener( 
xCloseChecker.get() );
                         }
                                        }
-                                       catch(Exception &e)
+                       document = m_aDocuments.begin();
+                       // first of all we have to set the second to NULL
+                       for (; document != documentEnd ;  )
                                        {
-                                          (void)e;
-                                          // bCheck = sal_False;
-                                       }
-                               }
+                               TDocuments::iterator aPos = document++;
+                               aPos->second = NULL; // this may also dispose 
the document
                        }
                }
                catch(Exception)
                {
                }
-               if (bSubSuspended == sal_True)
+               if ( bSubSuspended )
                {
                        // remove the document only at save or discard, but not 
at cancel state.
                        m_aDocuments.clear();
@@ -659,7 +632,7 @@
                try
                {
                        for (; aIter != aEnd && nSuspendPos ; 
++aIter,--nSuspendPos)
-                               suspendDocument(aIter->first,!bSuspend);
+                               suspendDocument(*aIter,!bSuspend);
                }
                catch(Exception)
                {




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

Reply via email to