Tag: cws_src680_hsqlcsv
User: fs      
Date: 2008-01-17 02:18:44+0000
Modified:
   dba/dbaccess/source/ui/app/AppControllerGen.cxx

Log:
 RESYNC: (1.24-1.28); FILE MERGED

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.20.36.3&r2=1.20.36.4
Delta lines:  +116 -21
----------------------
--- AppControllerGen.cxx        2006-12-18 07:51:02+0000        1.20.36.3
+++ AppControllerGen.cxx        2008-01-17 02:18:41+0000        1.20.36.4
@@ -96,6 +96,9 @@
 #ifndef _SV_SVAPP_HXX //autogen
 #include <vcl/svapp.hxx>
 #endif
+#ifndef _SV_MNEMONIC_HXX
+#include <vcl/mnemonic.hxx>
+#endif
 #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
 #include <toolkit/unohlp.hxx>
 #endif
@@ -136,6 +139,8 @@
 #include "defaultobjectnamecheck.hxx"
 #endif
 
+#include <com/sun/star/lang/XEventListener.hpp>
+
 //........................................................................
 namespace dbaui
 {
@@ -155,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
@@ -222,10 +256,11 @@
 // 
-----------------------------------------------------------------------------
 void OApplicationController::openDataSourceAdminDialog()
 {
-       
openDialog(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DatasourceAdministrationDialog")));
+       openDialog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"com.sun.star.sdb.DatasourceAdministrationDialog" ) ) );
 }
+
 // 
-----------------------------------------------------------------------------
-void OApplicationController::openDialog(const ::rtl::OUString& _sServiceName)
+void OApplicationController::openDialog( const ::rtl::OUString& _sServiceName )
 {
        try
        {
@@ -233,8 +268,8 @@
                ::osl::MutexGuard aGuard(m_aMutex);
                WaitObject aWO(getView());
 
-        SharedConnection xConnection( getConnection() );
-               Sequence< Any > aArgs(xConnection.is() ? 3 : 2);
+               Sequence< Any > aArgs(3);
+        sal_Int32 nArgPos = 0;
 
                Reference< ::com::sun::star::awt::XWindow> xWindow = 
getTopMostContainerWindow();
                if ( !xWindow.is() )
@@ -244,7 +279,7 @@
                                xWindow = 
VCLUnoHelper::GetInterface(getView()->Window::GetParent());
                }
                // the parent window
-               aArgs[0] <<= PropertyValue( 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentWindow")),
+               aArgs[nArgPos++] <<= PropertyValue( 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentWindow")),
                                                                        0,
                                                                        
makeAny(xWindow),
                                                                        
PropertyState_DIRECT_VALUE);
@@ -253,18 +288,26 @@
                ::rtl::OUString sInitialSelection;
                if ( getContainer() )
                        sInitialSelection = getDatabaseName();
-               aArgs[1] <<= PropertyValue(
-                       
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InitialSelection")), 0,
-                       makeAny(sInitialSelection), PropertyState_DIRECT_VALUE);
+        if ( sInitialSelection.getLength() )
+        {
+                   aArgs[ nArgPos++ ] <<= PropertyValue(
+                           ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"InitialSelection" ) ), 0,
+                           makeAny( sInitialSelection ), 
PropertyState_DIRECT_VALUE );
+        }
+
+        SharedConnection xConnection( getConnection() );
                if ( xConnection.is() )
-                       aArgs[2] <<= PropertyValue(
+        {
+                       aArgs[ nArgPos++ ] <<= PropertyValue(
                                PROPERTY_ACTIVECONNECTION, 0,
-                               makeAny( xConnection ), 
PropertyState_DIRECT_VALUE);
+                               makeAny( xConnection ), 
PropertyState_DIRECT_VALUE );
+        }
+        aArgs.realloc( nArgPos );
 
                // 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())
@@ -278,8 +321,9 @@
 // 
-----------------------------------------------------------------------------
 void OApplicationController::openTableFilterDialog()
 {
-       
openDialog(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.TableFilterDialog")));
+       openDialog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"com.sun.star.sdb.TableFilterDialog" ) ) );
 }
+
 // 
-----------------------------------------------------------------------------
 void OApplicationController::refreshTables()
 {
@@ -305,7 +349,7 @@
 // 
-----------------------------------------------------------------------------
 void OApplicationController::openDirectSQLDialog()
 {
-       openDialog(::rtl::OUString(SERVICE_SDB_DIRECTSQLDIALOG));
+       openDialog( SERVICE_SDB_DIRECTSQLDIALOG );
 }
 // 
-----------------------------------------------------------------------------
 void SAL_CALL OApplicationController::propertyChange( const 
PropertyChangeEvent& evt ) throw (RuntimeException)
@@ -375,7 +419,7 @@
        ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
        ::osl::MutexGuard aGuard(m_aMutex);
 
-       if ( m_xDataSource.is() )
+       if ( m_xDataSource.is() && !isDataSourceReadOnly() )
        {
                try
                {
@@ -482,6 +526,7 @@
 
        return bSuspended;
 }
+
 // 
-----------------------------------------------------------------------------
 sal_Bool OApplicationController::suspendDocuments(sal_Bool bSuspend)
 {
@@ -540,17 +585,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();
@@ -645,7 +724,23 @@
                _xLayoutManager->requestElement( s_sStatusbar );
 
            if ( getContainer() )
-           getContainer()->createIconAutoMnemonics();
+        {
+            // we need to share the "mnemonic space":
+            MnemonicGenerator aMnemonicGenerator;
+            // - the menu already has mnemonics
+            SystemWindow* pSystemWindow = getContainer()->GetSystemWindow();
+            MenuBar* pMenu = pSystemWindow ? pSystemWindow->GetMenuBar() : 
NULL;
+            if ( pMenu )
+            {
+                USHORT nMenuItems = pMenu->GetItemCount();
+                for ( USHORT i = 0; i < nMenuItems; ++i )
+                    aMnemonicGenerator.RegisterMnemonic( pMenu->GetItemText( 
pMenu->GetItemId( i ) ) );
+            }
+            // - the icons should use automatic ones
+           getContainer()->createIconAutoMnemonics( aMnemonicGenerator );
+            // - as well as the entries in the task pane
+            getContainer()->setTaskExternalMnemonics( aMnemonicGenerator );
+        }
 
            Execute( SID_DB_APP_VIEW_FORMS, Sequence< PropertyValue >() );
                InvalidateAll();




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

Reply via email to