User: rt      
Date: 2007-07-06 07:58:34+0000
Modified:
   dba/dbaccess/source/ui/app/AppControllerGen.cxx

Log:
 INTEGRATION: CWS oj14 (1.14.4); FILE MERGED
 2007/06/19 08:00:47 fs 1.14.4.9: merging (nearly all) changes from CWS dba23ui 
herein, which fixes #i78642
 2007/05/29 13:07:25 lla 1.14.4.8: #77407# handle close of embedded objects 
better
 2006/12/18 16:16:40 oj 1.14.4.7: RESYNC: (1.23-1.24); FILE MERGED
 2006/11/07 09:09:40 oj 1.14.4.6: RESYNC: (1.18-1.23); FILE MERGED
 2006/07/04 07:45:48 oj 1.14.4.5: RESYNC: (1.15-1.18); FILE MERGED
 2006/04/25 13:00:32 oj 1.14.4.4: new include
 2006/03/20 07:48:06 oj 1.14.4.3: use of module client helper
 2006/01/03 13:18:33 oj 1.14.4.2: RESYNC: (1.14-1.15); FILE MERGED
 2006/01/03 07:48:57 oj 1.14.4.1: changed module client

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.25&r2=1.26
Delta lines:  +71 -5
--------------------
--- AppControllerGen.cxx        2007-06-12 05:32:26+0000        1.25
+++ AppControllerGen.cxx        2007-07-06 07:58:32+0000        1.26
@@ -139,6 +139,8 @@
 #include "defaultobjectnamecheck.hxx"
 #endif
 
+#include <com/sun/star/lang/XEventListener.hpp>
+
 //........................................................................
 namespace dbaui
 {
@@ -158,6 +160,35 @@
 using namespace ::com::sun::star::ucb;
 //........................................................................
 // 
-----------------------------------------------------------------------------
+
+class CloseChecker : public ::cppu::WeakImplHelper1< 
com::sun::star::lang::XEventListener >
+{
+    sal_Bool m_bClosed;
+public:
+    CloseChecker()
+            :m_bClosed(sal_False)
+        {
+            // DBG_CTOR(CloseChecker,NULL);
+
+        }
+    virtual ~CloseChecker()
+        {
+            // DBG_DTOR(CloseChecker,NULL);
+        }
+    
+       sal_Bool isClosed()
+       {
+               return m_bClosed;
+       }
+       // interface ::com::sun::star::lang::XEventListener
+    virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& 
Source) throw( ::com::sun::star::uno::RuntimeException )
+        {
+            (void)Source;
+            m_bClosed = sal_True;
+        }
+
+};
+// 
-----------------------------------------------------------------------------
 void OApplicationController::convertToView(const ::rtl::OUString& _sName)
 {
        try
@@ -267,7 +298,7 @@
                // create the dialog
                Reference< XExecutableDialog > xAdminDialog;
                xAdminDialog = Reference< XExecutableDialog >(
-                       
m_xMultiServiceFacatory->createInstanceWithArguments(_sServiceName,aArgs), 
UNO_QUERY);
+                       
getORB()->createInstanceWithArguments(_sServiceName,aArgs), UNO_QUERY);
 
                // execute it
                if (xAdminDialog.is())
@@ -485,6 +516,7 @@
 
        return bSuspended;
 }
+
 // 
-----------------------------------------------------------------------------
 sal_Bool OApplicationController::suspendDocuments(sal_Bool bSuspend)
 {
@@ -543,17 +575,51 @@
 
                                if ( xController.is() && xController != *this )
                                {
-                                       Reference< 
com::sun::star::util::XCloseable> xCloseable(xController->getFrame(),UNO_QUERY);
-                                       if ( xCloseable.is() )
-                                               xCloseable->close(sal_True);
+                                       // 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<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;
+                                               }
+                        if (xComponent.is())
+                        {
+                            xComponent->removeEventListener( 
xCloseChecker.get() );
+                        }
+                                       }
+                                       catch(Exception &e)
+                                       {
+                                          (void)e;
+                                          // bCheck = sal_False;
+                                       }
                                }
                        }
                }
                catch(Exception)
                {
                }
+               if (bSubSuspended == sal_True)
+               {
+                       // remove the document only at save or discard, but not 
at cancel state.
                m_aDocuments.clear();
        }
+       }
        else // resuspend the documents again
        {
                TDocuments::iterator aIter = m_aDocuments.begin();




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

Reply via email to