Tag: cws_src680_qiq
User: fs      
Date: 06/05/24 07:54:59

Modified:
 /dba/dbaccess/source/core/inc/
  definitioncontainer.hxx

Log:
 #i51143# be an XContainerApproveBroadcaster

File Changes:

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

File [changed]: definitioncontainer.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/inc/definitioncontainer.hxx?r1=1.4.4.1&r2=1.4.4.2
Delta lines:  +87 -40
---------------------
--- definitioncontainer.hxx     24 May 2006 09:09:57 -0000      1.4.4.1
+++ definitioncontainer.hxx     24 May 2006 14:54:55 -0000      1.4.4.2
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: definitioncontainer.hxx,v $
  *
- *  $Revision: 1.4.4.1 $
+ *  $Revision: 1.4.4.2 $
  *
- *  last change: $Author: fs $ $Date: 2006/05/24 09:09:57 $
+ *  last change: $Author: fs $ $Date: 2006/05/24 14:54:55 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -39,8 +39,8 @@
 #ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
 #include <cppuhelper/interfacecontainer.hxx>
 #endif
-#ifndef _CPPUHELPER_IMPLBASE6_HXX_
-#include <cppuhelper/implbase6.hxx>
+#ifndef _CPPUHELPER_IMPLBASE7_HXX_
+#include <cppuhelper/implbase7.hxx>
 #endif
 #ifndef _COMPHELPER_STLTYPES_HXX_
 #include <comphelper/stl_types.hxx>
@@ -75,9 +75,15 @@
 #ifndef _COM_SUN_STAR_BEANS_XVETOABLECHANGELISTENER_HPP_
 #include <com/sun/star/beans/XVetoableChangeListener.hpp>
 #endif
+#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINERAPPROVEBROADCASTER_HPP_
+#include <com/sun/star/container/XContainerApproveBroadcaster.hpp>
+#endif
 #ifndef DBA_CONTENTHELPER_HXX
 #include "ContentHelper.hxx"
 #endif
+#ifndef DBACCESS_CONTAINERAPPROVE_HXX
+#include "containerapprove.hxx"
+#endif
 #ifndef _COMPHELPER_UNO3_HXX_
 #include <comphelper/uno3.hxx>
 #endif
@@ -104,10 +110,11 @@
 //= ODefinitionContainer -     base class of collections of database definition
 //=                                                    documents
 //==========================================================================
-typedef ::cppu::ImplHelper6<           
::com::sun::star::container::XIndexAccess
+typedef ::cppu::ImplHelper7 <   ::com::sun::star::container::XIndexAccess
                                                                ,       
::com::sun::star::container::XNameContainer
                                                                ,       
::com::sun::star::container::XEnumerationAccess
                                                                ,       
::com::sun::star::container::XContainer
+                            ,   
::com::sun::star::container::XContainerApproveBroadcaster
                                                                ,       
::com::sun::star::beans::XPropertyChangeListener
                                                                ,       
::com::sun::star::beans::XVetoableChangeListener
                                                                >       
ODefinitionContainer_Base;
@@ -116,16 +123,26 @@
                        :public OContentHelper
                        ,public ODefinitionContainer_Base
 {
-public:
+protected:
        DECLARE_STL_USTRINGACCESS_MAP(::com::sun::star::uno::WeakReference< 
::com::sun::star::ucb::XContent >, Documents);
        DECLARE_STL_VECTOR(Documents::iterator, DocumentsIndexAccess);
 
-       enum ENotifyKind
+       enum ContainerOperation
        {
                E_REPLACED,
                E_REMOVED,
                E_INSERTED
        };
+
+    enum ListenerType
+    {
+        ApproveListeners,
+        ContainerListemers
+    };
+
+private:
+    PContainerApprove   m_pElementApproval;
+
 protected:
        // we can't just hold a vector of XContentRefs, as after initialization 
they're all empty
        // cause we load them only on access
@@ -133,12 +150,26 @@
        Documents                               m_aDocumentMap;                 
        // for a efficient name access
 
        ::cppu::OInterfaceContainerHelper
+                            m_aApproveListeners;
+       ::cppu::OInterfaceContainerHelper
                                                        m_aContainerListeners;
+
        sal_Bool                                m_bInPropertyChange;
 
-       /** looks like the dtor ...
+protected:
+    /** Additionally to our own approvals which new elements must pass, 
derived classes
+        can specifiy an additional approval instance here.
+
+        Every time a new element is inserted into the container (or an element 
is replaced
+        with a new one), this new element must pass our own internal approval, 
plus the approval
+        given here.
        */
+    void                setElementApproval( PContainerApprove 
_pElementApproval ) { m_pElementApproval = _pElementApproval; }
+    PContainerApprove   getElementApproval() const { return 
m_pElementApproval; }
+
+protected:
        virtual ~ODefinitionContainer();
+
 public:
        /** constructs the container.
        */
@@ -184,6 +215,10 @@
     virtual void SAL_CALL addContainerListener( const 
::com::sun::star::uno::Reference< 
::com::sun::star::container::XContainerListener >& xListener ) 
throw(::com::sun::star::uno::RuntimeException);
     virtual void SAL_CALL removeContainerListener( const 
::com::sun::star::uno::Reference< 
::com::sun::star::container::XContainerListener >& xListener ) 
throw(::com::sun::star::uno::RuntimeException);
 
+    // XContainerApproveBroadcaster
+    virtual void SAL_CALL addContainerApproveListener( const 
::com::sun::star::uno::Reference< 
::com::sun::star::container::XContainerApproveListener >& Listener ) throw 
(::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL removeContainerApproveListener( const 
::com::sun::star::uno::Reference< 
::com::sun::star::container::XContainerApproveListener >& Listener ) throw 
(::com::sun::star::uno::RuntimeException);
+
 // ::com::sun::star::lang::XEventListener
        virtual void SAL_CALL disposing( const 
::com::sun::star::lang::EventObject& Source ) 
throw(::com::sun::star::uno::RuntimeException);
 
@@ -191,26 +226,11 @@
        virtual void SAL_CALL propertyChange( const 
::com::sun::star::beans::PropertyChangeEvent& evt ) throw 
(::com::sun::star::uno::RuntimeException);
        // XVetoableChangeListener
        virtual void SAL_CALL vetoableChange( const 
::com::sun::star::beans::PropertyChangeEvent& aEvent ) throw 
(::com::sun::star::beans::PropertyVetoException, 
::com::sun::star::uno::RuntimeException);
+
 protected:
        // helper
        virtual void SAL_CALL disposing();
 
-       /** approve that the object given may be inserted into the container. 
Should be overloaded by derived classes,
-               the default implementation just checks the object to be 
non-void.
-
-        @throws IllegalArgumentException
-            if the name of the object are invalid
-        @throws ElementExistException
-            if the object already exists in the container, or another object 
with the same name
-            already exists
-        @throws WrappedTargetException
-            if another error occures which prevents insertion of the object 
into the container
-       */
-       virtual void approveNewObject(
-            const ::rtl::OUString& _sName,
-            const ::com::sun::star::uno::Reference< 
::com::sun::star::ucb::XContent >& _rxObject
-        ) const;
-
        /** create a object from it's persistent data within the configuration. 
To be overwritten by derived classes.
                @param          _rName                  the name the object has 
within the container
                @return                                         the newly 
created object or an empty reference if somthing went wrong
@@ -220,14 +240,14 @@
 
        /** get the object specified by the given name. If desired, the object 
will be read if not already done so.<BR>
                @param          _rName                          the object name
-               @param          _bReadIfNeccessary      if sal_True, the object 
will be read from the configuration if not already done so
+               @param          _bReadIfNeccessary      if sal_True, the object 
will be created if necessary
                @return                                                 the 
property set interface of the object. Usually the return value is not NULL, but
                                                                                
if so, then the object could not be read from the configuration
                @throws                                                 
NoSuchElementException if there is no object with the given name.
                @see    createObject
        */
        virtual ::com::sun::star::uno::Reference< 
::com::sun::star::ucb::XContent >
-                               implGetByName(const ::rtl::OUString& _rName, 
sal_Bool _bReadIfNeccessary = sal_True) throw 
(::com::sun::star::container::NoSuchElementException);
+                               implGetByName(const ::rtl::OUString& _rName, 
sal_Bool _bCreateIfNecessary) throw 
(::com::sun::star::container::NoSuchElementException);
 
        /** quickly checks if there already is an element with a given name. No 
access to the configuration occures, i.e.
                if there is such an object which is not already loaded, it 
won't be loaded now.
@@ -278,11 +298,16 @@
                const ::com::sun::star::uno::Reference< 
::com::sun::star::ucb::XContent >& _rxNewObject
                );
 
-       void notifyByName( ::osl::ClearableMutexGuard& _rGuard
-                                       ,const ::rtl::OUString& _rName
-                                       ,const 
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& 
_xNewElement
-                                       ,const 
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& xOldElement
-                                       ,ENotifyKind _eHowToNotify);
+    /** notifies our container/approve listeners
+    */
+       void notifyByName(
+            ::osl::ResettableMutexGuard& _rGuard,
+                       const ::rtl::OUString& _rName,
+                       const ::com::sun::star::uno::Reference< 
::com::sun::star::ucb::XContent >& _xNewElement,
+                       const ::com::sun::star::uno::Reference< 
::com::sun::star::ucb::XContent >& xOldElement,
+            ContainerOperation _eOperation,
+            ListenerType _eType
+        );
 
        inline SAL_CALL operator ::com::sun::star::uno::Reference< 
::com::sun::star::uno::XInterface > () const
     {
@@ -292,7 +317,29 @@
 private:
        void    addObjectListener(const ::com::sun::star::uno::Reference< 
::com::sun::star::ucb::XContent >& _xNewObject);
        void    removeObjectListener(const ::com::sun::star::uno::Reference< 
::com::sun::star::ucb::XContent >& _xNewObject);
+
+    /** approve that the object given may be inserted into the container. 
Should be overloaded by derived classes,
+               the default implementation just checks the object to be 
non-void.
+
+        @throws IllegalArgumentException
+            if the name or the object are invalid
+        @throws ElementExistException
+            if the object already exists in the container, or another object 
with the same name
+            already exists
+        @throws WrappedTargetException
+            if another error occures which prevents insertion of the object 
into the container
+       */
+       void approveNewObject(
+            const ::rtl::OUString& _sName,
+            const ::com::sun::star::uno::Reference< 
::com::sun::star::ucb::XContent >& _rxObject
+        ) const;
+
+    inline bool impl_haveAnyListeners_nothrow() const
+    {
+        return ( m_aContainerListeners.getLength() > 0 ) || ( 
m_aApproveListeners.getLength() > 0 );
+    }
 };
+
 //........................................................................
 }      // namespace dbaccess
 //........................................................................




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

Reply via email to