User: rt      
Date: 2008-01-30 08:30:59+0000
Modified:
   dba/dbaccess/source/core/api/viewcontainer.cxx

Log:
 INTEGRATION: CWS dba24d (1.25.170); FILE MERGED
 2007/12/04 09:24:09 oj 1.25.170.3: #i81644# add new common var to block 
elementInserted events
 2007/12/01 13:39:45 fs 1.25.170.2: RESYNC: (1.25-1.26); FILE MERGED
 2007/11/23 12:52:12 oj 1.25.170.1: #i81644# elementRemoved impl

File Changes:

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

File [changed]: viewcontainer.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/viewcontainer.cxx?r1=1.26&r2=1.27
Delta lines:  +63 -68
---------------------
--- viewcontainer.cxx   2007-11-21 15:35:25+0000        1.26
+++ viewcontainer.cxx   2008-01-30 08:30:56+0000        1.27
@@ -125,13 +125,15 @@
 //==========================================================================
 DBG_NAME(OViewContainer)
 
//------------------------------------------------------------------------------
-OViewContainer::OViewContainer(::cppu::OWeakObject& _rParent, 
-                                                                ::osl::Mutex& 
_rMutex,
-                                                                const 
Reference< XConnection >& _xCon,
-                                                                sal_Bool 
_bCase,
-                                                                
IRefreshListener*      _pRefreshListener,
-                                                                
IWarningsContainer* _pWarningsContainer)
-       
:OFilteredContainer(_rParent,_rMutex,_xCon,_bCase,_pRefreshListener,_pWarningsContainer)
+OViewContainer::OViewContainer(::cppu::OWeakObject& _rParent
+                                                                ,::osl::Mutex& 
_rMutex
+                                                                ,const 
Reference< XConnection >& _xCon
+                                                                ,sal_Bool 
_bCase
+                                                                
,IRefreshListener*     _pRefreshListener
+                                                                
,IWarningsContainer* _pWarningsContainer
+                                 ,oslInterlockedCount& _nInAppend)
+       
:OFilteredContainer(_rParent,_rMutex,_xCon,_bCase,_pRefreshListener,_pWarningsContainer,_nInAppend)
+    ,m_bInElementRemoved(false)
 {
     DBG_CTOR(OViewContainer, NULL);
 }
@@ -190,31 +192,6 @@
        return xRet;
 }
 // 
-----------------------------------------------------------------------------
-namespace
-{
-    template <typename TYPE>
-    class EnsureReset
-    {
-    public:
-        EnsureReset( TYPE& _rValueLocation, const TYPE& _rResetValue )
-            :m_rValueLocation( _rValueLocation )
-            ,m_aResetValue( _rResetValue )
-        {
-        }
-
-        ~EnsureReset()
-        {
-            m_rValueLocation = m_aResetValue;
-        }
-
-    private:
-        TYPE&   m_rValueLocation;
-        TYPE    m_aResetValue;
-    };
-
-    typedef EnsureReset< ::rtl::OUString >  EnsureStringReset;
-}
-// 
-----------------------------------------------------------------------------
 // XAppend
 ObjectType OViewContainer::appendObject( const ::rtl::OUString& _rForName, 
const Reference< XPropertySet >& descriptor )
 {
@@ -225,8 +202,7 @@
        Reference< XPropertySet > xProp = descriptor;
        if(xAppend.is())
        {
-        m_sAppendingCurrenly = aName;
-        EnsureStringReset aReset( m_sAppendingCurrenly, ::rtl::OUString() );
+        EnsureReset aReset(m_nInAppend);
 
         xAppend->appendByDescriptor(descriptor);
                if(m_xMasterContainer->hasByName(aName))
@@ -263,6 +239,8 @@
 // XDrop
 void OViewContainer::dropObject(sal_Int32 _nPos,const ::rtl::OUString 
_sElementName)
 {
+    if ( !m_bInElementRemoved )
+    {
        Reference< XDrop > xDrop(m_xMasterContainer,UNO_QUERY);
        if(xDrop.is())
                xDrop->dropByName(_sElementName);
@@ -295,6 +273,7 @@
                        ::comphelper::disposeComponent(xStmt);
                }
        }
+    }
 }
 // 
-----------------------------------------------------------------------------
 void SAL_CALL OViewContainer::elementInserted( const ContainerEvent& Event ) 
throw (RuntimeException)
@@ -302,7 +281,7 @@
        ::osl::MutexGuard aGuard(m_rMutex);
        ::rtl::OUString sName;
        if  (   ( Event.Accessor >>= sName )
-        &&  ( m_sAppendingCurrenly != sName )
+        &&  ( !m_nInAppend )
         &&  ( !hasByName( sName ) )
         )
        {
@@ -314,8 +293,24 @@
        }
 }
 // 
-----------------------------------------------------------------------------
-void SAL_CALL OViewContainer::elementRemoved( const ContainerEvent& /*Event*/ 
) throw (RuntimeException)
+void SAL_CALL OViewContainer::elementRemoved( const ContainerEvent& Event ) 
throw (RuntimeException)
 {
+    ::osl::MutexGuard aGuard(m_rMutex);
+       ::rtl::OUString sName;
+       if ( (Event.Accessor >>= sName) && hasByName(sName) )
+       {
+        m_bInElementRemoved = true;
+        try
+        {
+            dropByName(sName);
+        }
+           catch(Exception&)
+           {
+                   m_bInElementRemoved = sal_False;
+                   throw;
+           }
+        m_bInElementRemoved = false;
+       }
 }
 // 
-----------------------------------------------------------------------------
 void SAL_CALL OViewContainer::disposing( const 
::com::sun::star::lang::EventObject& /*Source*/ ) throw (RuntimeException)




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

Reply via email to