Tag: cws_src680_reportdesign01
User: oj      
Date: 2007-09-07 11:24:03+0000
Modified:
   dba/reportdesign/source/ui/dlg/AddField.cxx

Log:
 #i77141# add container listener

File Changes:

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

File [changed]: AddField.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/ui/dlg/AddField.cxx?r1=1.2&r2=1.2.28.1
Delta lines:  +37 -3
--------------------
--- AddField.cxx        2007-07-09 11:56:29+0000        1.2
+++ AddField.cxx        2007-09-07 11:24:01+0000        1.2.28.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: AddField.cxx,v $
  *
- *  $Revision: 1.2 $
+ *  $Revision: 1.2.28.1 $
  *
- *  last change: $Author: rt $ $Date: 2007/07/09 11:56:29 $
+ *  last change: $Author: oj $ $Date: 2007/09/07 11:24:01 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -213,6 +213,7 @@
 OAddFieldWindow::OAddFieldWindow(::rptui::OReportController& 
_rController,Window* pParent)
                        :FloatingWindow(pParent, 
WinBits(WB_STDMODELESS|WB_SIZEABLE))
                        ,::comphelper::OPropertyChangeListener(m_aMutex)
+            ,::comphelper::OContainerListener(m_aMutex)
             ,m_pListBox(new OAddFieldWindowListBox( this ))
             ,m_rController( _rController )
                        ,m_nCommandType(0)
@@ -249,6 +250,8 @@
 {
        if (m_pChangeListener.is())
                m_pChangeListener->dispose();
+    if ( m_pContainerListener.is() )
+        m_pContainerListener->dispose();
        DBG_DTOR( rpt_OAddFieldWindow,NULL);
 }
 
@@ -310,6 +313,9 @@
 //-----------------------------------------------------------------------
 void OAddFieldWindow::Update()
 {
+    if ( m_pContainerListener.is() )
+        m_pContainerListener->dispose();
+    m_pContainerListener = NULL;
     m_xColumns.clear();
 
     try
@@ -344,12 +350,16 @@
         m_sFilter = sFilter;
 
         // add the columns to the list
-        m_xColumns.clear();
         uno::Reference< sdbc::XConnection> xCon = getConnection();
            if ( xCon.is() && m_aCommandName.getLength() )
                        m_xColumns = dbtools::getFieldsByCommandDescriptor( 
xCon, GetCommandType(), GetCommand(), m_xHoldAlive );
         if ( m_xColumns.is() )
+        {
             lcl_addToList( *m_pListBox, m_xColumns->getElementNames() );
+            uno::Reference< container::XContainer> 
xContainer(m_xColumns,uno::UNO_QUERY);
+            if ( xContainer.is() )
+                m_pContainerListener = new 
::comphelper::OContainerListenerAdapter(this,xContainer);
+        }
 
         // add the parameter columns to the list
         Sequence< ::rtl::OUString > aParamNames( getParameterNames( 
m_rController.getRowSet() ) );
@@ -413,6 +423,30 @@
             _rDescriptor[ ::svx::daColumnObject ] <<= 
m_xColumns->getByName(sColumnName);
     }
 }
+// 
-----------------------------------------------------------------------------
+void OAddFieldWindow::_elementInserted( const container::ContainerEvent& 
_rEvent ) 
+{
+    if ( m_pListBox.get() )
+    {
+        ::rtl::OUString sName;
+        if ( _rEvent.Accessor >>= sName )
+            m_pListBox->InsertEntry(sName);
+    }
+}
+// 
-----------------------------------------------------------------------------
+void OAddFieldWindow::_elementRemoved( const container::ContainerEvent& 
/*_rEvent*/ )
+{
+    if ( m_pListBox.get() )
+    {
+        m_pListBox->Clear();
+        if ( m_xColumns.is() )
+            lcl_addToList( *m_pListBox, m_xColumns->getElementNames() );
+    }
+}
+// 
-----------------------------------------------------------------------------
+void OAddFieldWindow::_elementReplaced( const container::ContainerEvent& 
/*_rEvent*/ )
+{
+}
 // 
=============================================================================
 } // namespace rptui
 // 
=============================================================================




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

Reply via email to