Tag: cws_dev300_dba31b
User: oj      
Date: 2008-08-15 10:34:31+0000
Modified:
   dba/dbaccess/source/core/misc/ContainerMediator.cxx
   dba/dbaccess/source/ui/dlg/adtabdlg.cxx
   dba/dbaccess/source/ui/inc/TableWindow.hxx
   dba/dbaccess/source/ui/inc/TableWindowListBox.hxx
   dba/dbaccess/source/ui/querydesign/TableWindow.cxx
   dba/dbaccess/source/ui/querydesign/TableWindowListBox.cxx

Log:
 #i44447# recognize when a table changed or a new,drop

File Changes:

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

File [changed]: ContainerMediator.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/misc/ContainerMediator.cxx?r1=1.11&r2=1.11.42.1
Delta lines:  +3 -3
-------------------
--- ContainerMediator.cxx       2008-06-06 14:04:43+0000        1.11
+++ ContainerMediator.cxx       2008-08-15 10:34:28+0000        1.11.42.1
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: ContainerMediator.cxx,v $
- * $Revision: 1.11 $
+ * $Revision: 1.11.42.1 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -166,7 +166,7 @@
                m_aForwardList.erase(sElementName);
         try
         {
-               Reference<XNameContainer> xNameContainer( m_xSettings, 
UNO_QUERY_THROW );
+               Reference<XNameContainer> xNameContainer( m_xSettings, 
UNO_QUERY );
                if ( xNameContainer.is() && m_xSettings->hasByName( 
sElementName ) )
                        xNameContainer->removeByName( sElementName );
         }

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

File [changed]: adtabdlg.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/dlg/adtabdlg.cxx?r1=1.30&r2=1.30.68.1
Delta lines:  +78 -51
---------------------
--- adtabdlg.cxx        2008-04-10 14:41:55+0000        1.30
+++ adtabdlg.cxx        2008-08-15 10:34:28+0000        1.30.68.1
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: adtabdlg.cxx,v $
- * $Revision: 1.30 $
+ * $Revision: 1.30.68.1 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -30,74 +30,36 @@
 
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_dbaccess.hxx"
-#ifndef DBAUI_QYDLGTAB_HXX
+
 #include "adtabdlg.hxx"
-#endif
-#ifndef DBAUI_ADTABDLG_HRC
 #include "adtabdlg.hrc"
-#endif
-#ifndef _DBAUI_SQLMESSAGE_HXX_
 #include "sqlmessage.hxx"
-#endif
-#ifndef _TOOLS_DEBUG_HXX
 #include <tools/debug.hxx>
-#endif
-#ifndef TOOLS_DIAGNOSE_EX_H
 #include <tools/diagnose_ex.h>
-#endif
-#ifndef _SVTOOLS_LOCALRESACCESS_HXX_
 #include <svtools/localresaccess.hxx>
-#endif
-#ifndef _DBA_DBACCESS_HELPID_HRC_
 #include "dbaccess_helpid.hrc"
-#endif
-#ifndef _DBU_RESOURCE_HRC_
 #include "dbu_resource.hrc"
-#endif
-#ifndef _DBU_DLG_HRC_
 #include "dbu_dlg.hrc"
-#endif
-#ifndef _SFXSIDS_HRC
 #include <sfx2/sfxsids.hrc>
-#endif
-#ifndef DBAUI_QUERYTABLEVIEW_HXX
 #include "QueryTableView.hxx"
-#endif
-#ifndef DBAUI_QUERYDESIGNVIEW_HXX
 #include "QueryDesignView.hxx"
-#endif
-#ifndef DBAUI_QUERYCONTROLLER_HXX
 #include "querycontroller.hxx"
-#endif
-#ifndef _CONNECTIVITY_DBTOOLS_HXX_
 #include <connectivity/dbtools.hxx>
-#endif
-#ifndef DBACCESS_UI_BROWSER_ID_HXX
 #include "browserids.hxx"
-#endif
-#ifndef _COM_SUN_STAR_SDB_XQUERIESSUPPLIER_HPP_
 #include <com/sun/star/sdb/XQueriesSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XVIEWSSUPPLIER_HPP_
 #include <com/sun/star/sdbcx/XViewsSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
 #include <com/sun/star/container/XNameAccess.hpp>
-#endif
-#ifndef DBAUI_TOOLS_HXX
 #include "UITools.hxx"
-#endif
-#ifndef DBACCESS_IMAGEPROVIDER_HXX
 #include "imageprovider.hxx"
-#endif
 
+#include <comphelper/containermultiplexer.hxx>
+#include "cppuhelper/basemutex.hxx"
 #include <algorithm>
 
 // slot ids
 using namespace dbaui;
+using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::container;
 using namespace ::com::sun::star::sdb;
@@ -115,21 +77,33 @@
 
//==============================================================================
 //= TableListFacade
 
//==============================================================================
-class TableListFacade : public TableObjectListFacade
+class TableListFacade : public ::cppu::BaseMutex
+                    ,   public TableObjectListFacade
+                    ,   public ::comphelper::OContainerListener
 {
     OTableTreeListBox&          m_rTableList;
     Reference< XConnection >    m_xConnection;
+    ::rtl::Reference< comphelper::OContainerListenerAdapter>                   
 
+                                m_pContainerListener;
+    bool                        m_bAllowViews;
 
 public:
     TableListFacade( OTableTreeListBox& _rTableList, const Reference< 
XConnection >& _rxConnection )
-        :m_rTableList( _rTableList )
+        : ::comphelper::OContainerListener(m_aMutex)
+        ,m_rTableList( _rTableList )
         ,m_xConnection( _rxConnection )
+        ,m_bAllowViews(true)
     {
     }
 
+private:
     virtual void    updateTableObjectList( bool _bAllowViews );
     virtual String  getSelectedName( String& _out_rAliasName ) const;
     virtual bool    isLeafSelected() const;
+    // OContainerListener
+    virtual void _elementInserted( const 
::com::sun::star::container::ContainerEvent& _rEvent ) 
throw(::com::sun::star::uno::RuntimeException);
+       virtual void _elementRemoved( const  
::com::sun::star::container::ContainerEvent& _rEvent ) 
throw(::com::sun::star::uno::RuntimeException);
+       virtual void _elementReplaced( const 
::com::sun::star::container::ContainerEvent& _rEvent ) 
throw(::com::sun::star::uno::RuntimeException);
 };
 
 
//------------------------------------------------------------------------------
@@ -174,21 +148,44 @@
     _out_rAliasName = aTableName;
     return aComposedName;
 }
-
+// 
-----------------------------------------------------------------------------
+void TableListFacade::_elementInserted( const container::ContainerEvent& 
/*_rEvent*/ )  throw(::com::sun::star::uno::RuntimeException)
+{
+    updateTableObjectList(m_bAllowViews);
+}
+// 
-----------------------------------------------------------------------------
+void TableListFacade::_elementRemoved( const container::ContainerEvent& 
/*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException)
+{
+    updateTableObjectList(m_bAllowViews);
+}
+// 
-----------------------------------------------------------------------------
+void TableListFacade::_elementReplaced( const container::ContainerEvent& 
/*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException)
+{
+}
 
//------------------------------------------------------------------------------
 void TableListFacade::updateTableObjectList( bool _bAllowViews )
 {
+    m_bAllowViews = _bAllowViews;
     m_rTableList.Clear();
     try
     {
            Reference< XTablesSupplier > xTableSupp( m_xConnection, 
UNO_QUERY_THROW );
+        
            Reference< XViewsSupplier > xViewSupp;
            Reference< XNameAccess > xTables, xViews;
            Sequence< ::rtl::OUString > sTables, sViews;
 
            xTables = xTableSupp->getTables();
            if ( xTables.is() )
+        {
+            if ( !m_pContainerListener.is() )
+            {
+                Reference< XContainer> xContainer(xTables,uno::UNO_QUERY);
+                if ( xContainer.is() )
+                    m_pContainerListener = new 
::comphelper::OContainerListenerAdapter(this,xContainer);
+            }
                    sTables = xTables->getElementNames();
+        } // if ( xTables.is() )
        
            xViewSupp.set( xTableSupp, UNO_QUERY );
            if ( xViewSupp.is() )
@@ -241,22 +238,47 @@
 
//==============================================================================
 //= QueryListFacade
 
//==============================================================================
-class QueryListFacade : public TableObjectListFacade
+class QueryListFacade : public ::cppu::BaseMutex
+                    ,   public TableObjectListFacade
+                    ,   public ::comphelper::OContainerListener
 {
     SvTreeListBox&              m_rQueryList;
     Reference< XConnection >    m_xConnection;
+    ::rtl::Reference< comphelper::OContainerListenerAdapter>                   
 
+                                m_pContainerListener;
 
 public:
     QueryListFacade( SvTreeListBox& _rQueryList, const Reference< XConnection 
>& _rxConnection )
-        :m_rQueryList( _rQueryList )
+        : ::comphelper::OContainerListener(m_aMutex)
+        ,m_rQueryList( _rQueryList )
         ,m_xConnection( _rxConnection )
     {
     }
-
+private:
     virtual void    updateTableObjectList( bool _bAllowViews );
     virtual String  getSelectedName( String& _out_rAliasName ) const;
     virtual bool    isLeafSelected() const;
+    // OContainerListener
+    virtual void _elementInserted( const 
::com::sun::star::container::ContainerEvent& _rEvent ) 
throw(::com::sun::star::uno::RuntimeException);
+       virtual void _elementRemoved( const  
::com::sun::star::container::ContainerEvent& _rEvent ) 
throw(::com::sun::star::uno::RuntimeException);
+       virtual void _elementReplaced( const 
::com::sun::star::container::ContainerEvent& _rEvent ) 
throw(::com::sun::star::uno::RuntimeException);
 };
+// 
-----------------------------------------------------------------------------
+void QueryListFacade::_elementInserted( const container::ContainerEvent& 
_rEvent )  throw(::com::sun::star::uno::RuntimeException)
+{
+    ::rtl::OUString sName;
+    if ( _rEvent.Accessor >>= sName )
+        m_rQueryList.InsertEntry( sName );
+}
+// 
-----------------------------------------------------------------------------
+void QueryListFacade::_elementRemoved( const container::ContainerEvent& 
/*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException)
+{
+    updateTableObjectList(true);
+}
+// 
-----------------------------------------------------------------------------
+void QueryListFacade::_elementReplaced( const container::ContainerEvent& 
/*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException)
+{
+}
 
 
//------------------------------------------------------------------------------
 void QueryListFacade::updateTableObjectList( bool /*_bAllowViews*/ )
@@ -275,6 +297,11 @@
 
         Reference< XQueriesSupplier > xSuppQueries( m_xConnection, 
UNO_QUERY_THROW );
         Reference< XNameAccess > xQueries( xSuppQueries->getQueries(), 
UNO_QUERY_THROW );
+        if ( !m_pContainerListener.is() )
+        {
+            Reference< XContainer> xContainer(xQueries,UNO_QUERY_THROW);
+            m_pContainerListener = new 
::comphelper::OContainerListenerAdapter(this,xContainer);
+        }
         Sequence< ::rtl::OUString > aQueryNames = xQueries->getElementNames();
 
         const ::rtl::OUString* pQuery = aQueryNames.getConstArray();

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

File [changed]: TableWindow.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/inc/TableWindow.hxx?r1=1.19&r2=1.19.68.1
Delta lines:  +14 -17
---------------------
--- TableWindow.hxx     2008-04-10 15:19:25+0000        1.19
+++ TableWindow.hxx     2008-08-15 10:34:28+0000        1.19.68.1
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: TableWindow.hxx,v $
- * $Revision: 1.19 $
+ * $Revision: 1.19.68.1 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -30,28 +30,17 @@
 #ifndef DBAUI_TABLEWINDOW_HXX
 #define DBAUI_TABLEWINDOW_HXX
 
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
 #include <com/sun/star/container/XNameAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
 #include <com/sun/star/beans/XPropertySet.hpp>
-#endif
-#ifndef DBAUI_TABLEWINDOWTITLE_HXX
 #include "TableWindowTitle.hxx"
-#endif
-#ifndef _RTTI_HXX
 #include <tools/rtti.hxx>
-#endif
-#ifndef DBAUI_TABLEWINDOWDATA_HXX
+#include <rtl/ref.hxx>
 #include "TableWindowData.hxx"
-#endif
 #include <vector>
-#ifndef _SV_WINDOW_HXX
 #include <vcl/window.hxx>
-#endif
-#ifndef _UNOTOOLS_EVENTLISTENERADAPTER_HXX_
 #include <unotools/eventlisteneradapter.hxx>
-#endif
+#include <comphelper/containermultiplexer.hxx>
+#include "cppuhelper/basemutex.hxx"
 
 class SvLBoxEntry;
 namespace dbaui
@@ -69,7 +58,9 @@
        class OJoinTableView;
        class OTableWindowAccess;
 
-       class OTableWindow : public Window
+       class OTableWindow : public ::cppu::BaseMutex
+                        ,public ::comphelper::OContainerListener
+                        ,public Window
        {
                friend class OTableWindowTitle;
                friend class OTableWindowListBox;
@@ -83,12 +74,18 @@
        private:
         TTableWindowData::value_type           
                                 m_pData;
+        ::rtl::Reference< comphelper::OContainerListenerAdapter>               
     
+                                m_pContainerListener;
                sal_Int32                               m_nMoveCount;           
        // how often the arrow keys was pressed
                sal_Int32                               m_nMoveIncrement;       
        // how many pixel we should move
                UINT16                                  m_nSizingFlags;
                BOOL                                    m_bActive;
 
                void Draw3DBorder( const Rectangle& rRect );
+        // OContainerListener
+        virtual void _elementInserted( const 
::com::sun::star::container::ContainerEvent& _rEvent ) 
throw(::com::sun::star::uno::RuntimeException);
+           virtual void _elementRemoved( const  
::com::sun::star::container::ContainerEvent& _rEvent ) 
throw(::com::sun::star::uno::RuntimeException);
+           virtual void _elementReplaced( const 
::com::sun::star::container::ContainerEvent& _rEvent ) 
throw(::com::sun::star::uno::RuntimeException);
 
        protected:
                virtual void    Resize();

File [changed]: TableWindowListBox.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/inc/TableWindowListBox.hxx?r1=1.11&r2=1.11.68.1
Delta lines:  +2 -7
-------------------
--- TableWindowListBox.hxx      2008-04-10 15:20:16+0000        1.11
+++ TableWindowListBox.hxx      2008-08-15 10:34:29+0000        1.11.68.1
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: TableWindowListBox.hxx,v $
- * $Revision: 1.11 $
+ * $Revision: 1.11.68.1 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -30,13 +30,8 @@
 #ifndef DBAUI_TABLEWINDOWLISTBOX_HXX
 #define DBAUI_TABLEWINDOWLISTBOX_HXX
 
-#ifndef _SVTREEBOX_HXX
 #include <svtools/svtreebx.hxx>
-#endif
-
-#ifndef _DBACCESS_UI_CALLBACKS_HXX_
 #include "callbacks.hxx"
-#endif
 
 struct AcceptDropEvent;
 struct ExecuteDropEvent;

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

File [changed]: TableWindow.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/querydesign/TableWindow.cxx?r1=1.41&r2=1.41.26.1
Delta lines:  +29 -33
---------------------
--- TableWindow.cxx     2008-06-25 12:54:20+0000        1.41
+++ TableWindow.cxx     2008-08-15 10:34:29+0000        1.41.26.1
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: TableWindow.cxx,v $
- * $Revision: 1.41 $
+ * $Revision: 1.41.26.1 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -61,54 +61,26 @@
 #include <vcl/wall.hxx>
 #endif
 
-#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_
 #include <com/sun/star/sdbcx/XKeysSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_
 #include <com/sun/star/sdbcx/KeyType.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
 #include <com/sun/star/container/XNameAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
 #include <com/sun/star/beans/XPropertySet.hpp>
-#endif
-#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEEVENTID_HPP_
 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
-#endif
-#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEROLE_HPP_
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
-#endif
-#ifndef DBAUI_QUERYCONTROLLER_HXX
 #include "querycontroller.hxx"
-#endif
-#ifndef _DBU_QRY_HRC_
 #include "dbu_qry.hrc"
-#endif
-#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
 #include "dbustrings.hrc"
-#endif
-#ifndef DBAUI_QUERY_HRC
 #include "Query.hrc"
-#endif
-#ifndef _COMPHELPER_EXTRACT_HXX_
 #include <comphelper/extract.hxx>
-#endif
-#ifndef DBAUI_TOOLS_HXX
 #include "UITools.hxx"
-#endif
-#ifndef DBACCESS_TABLEWINDOWACCESS_HXX
 #include "TableWindowAccess.hxx"
-#endif
-#ifndef DBACCESS_UI_BROWSER_ID_HXX
 #include "browserids.hxx"
-#endif
+
 
 using namespace dbaui;
 using namespace ::utl;
+using namespace ::com::sun::star;
 using namespace ::com::sun::star::sdb;
 using namespace ::com::sun::star::sdbc;
 using namespace ::com::sun::star::sdbcx;
@@ -131,7 +103,8 @@
 DBG_NAME(OTableWindow)
 
//------------------------------------------------------------------------------
 OTableWindow::OTableWindow( Window* pParent, const 
TTableWindowData::value_type& pTabWinData )
-                 :Window( pParent, WB_3DLOOK|WB_MOVEABLE )
+                 : ::comphelper::OContainerListener(m_aMutex)
+          ,Window( pParent, WB_3DLOOK|WB_MOVEABLE )
           ,m_aTypeImage( this )
                  ,m_aTitle( this )
                  ,m_pListBox(NULL)
@@ -227,6 +200,13 @@
 
//------------------------------------------------------------------------------
 BOOL OTableWindow::FillListBox()
 {
+    m_pListBox->Clear();
+    if ( !m_pContainerListener.is() )
+    {
+        Reference< XContainer> xContainer(m_pData->getColumns(),UNO_QUERY);
+        if ( xContainer.is() )
+            m_pContainerListener = new 
::comphelper::OContainerListenerAdapter(this,xContainer);
+    }
        // mark all primary keys with special image
     ModuleRes TmpRes(isHiContrast(m_pListBox) ? IMG_JOINS_H : IMG_JOINS);
        ImageList aImageList(TmpRes);
@@ -848,3 +828,19 @@
        return m_aTitle.GetText();
 }
 // 
-----------------------------------------------------------------------------
+void OTableWindow::_elementInserted( const container::ContainerEvent& 
/*_rEvent*/ )  throw(::com::sun::star::uno::RuntimeException)
+{
+    FillListBox();
+}
+// 
-----------------------------------------------------------------------------
+void OTableWindow::_elementRemoved( const container::ContainerEvent& 
/*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException)
+{
+    FillListBox();
+}
+// 
-----------------------------------------------------------------------------
+void OTableWindow::_elementReplaced( const container::ContainerEvent& 
/*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException)
+{
+    FillListBox();
+}
+// 
-----------------------------------------------------------------------------
+

File [changed]: TableWindowListBox.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/querydesign/TableWindowListBox.cxx?r1=1.35.26.1&r2=1.35.26.2
Delta lines:  +1 -2
-------------------
--- TableWindowListBox.cxx      2008-08-13 13:13:02+0000        1.35.26.1
+++ TableWindowListBox.cxx      2008-08-15 10:34:29+0000        1.35.26.2
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: TableWindowListBox.cxx,v $
- * $Revision: 1.35.26.1 $
+ * $Revision: 1.35.26.2 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -424,4 +424,3 @@
        }
 }
 // 
-----------------------------------------------------------------------------
-




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

Reply via email to