xref: /AOO42X/main/dbaccess/source/core/inc/definitioncontainer.hxx (revision 9bce9b0d387299c68bd81d539e1478357a103de5)
12e2212a7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
32e2212a7SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
42e2212a7SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
52e2212a7SAndrew Rist  * distributed with this work for additional information
62e2212a7SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
72e2212a7SAndrew Rist  * to you under the Apache License, Version 2.0 (the
82e2212a7SAndrew Rist  * "License"); you may not use this file except in compliance
92e2212a7SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
112e2212a7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
132e2212a7SAndrew Rist  * Unless required by applicable law or agreed to in writing,
142e2212a7SAndrew Rist  * software distributed under the License is distributed on an
152e2212a7SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
162e2212a7SAndrew Rist  * KIND, either express or implied.  See the License for the
172e2212a7SAndrew Rist  * specific language governing permissions and limitations
182e2212a7SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
202e2212a7SAndrew Rist  *************************************************************/
212e2212a7SAndrew Rist 
222e2212a7SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _DBA_CORE_DEFINITIONCONTAINER_HXX_
25cdf0e10cSrcweir #define _DBA_CORE_DEFINITIONCONTAINER_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
28cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx>
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #ifndef _CPPUHELPER_IMPLBASE7_HXX_
31cdf0e10cSrcweir #include <cppuhelper/implbase7.hxx>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef _COMPHELPER_STLTYPES_HXX_
34cdf0e10cSrcweir #include <comphelper/stl_types.hxx>
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #ifndef _OSL_MUTEX_HXX_
37cdf0e10cSrcweir #include <osl/mutex.hxx>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
40cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
43cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
44cdf0e10cSrcweir #endif
45cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XCONTAINER_HPP_
46cdf0e10cSrcweir #include <com/sun/star/container/XContainer.hpp>
47cdf0e10cSrcweir #endif
48cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_
49cdf0e10cSrcweir #include <com/sun/star/container/XEnumerationAccess.hpp>
50cdf0e10cSrcweir #endif
51cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
52cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp>
53cdf0e10cSrcweir #endif
54cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
55cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
56cdf0e10cSrcweir #endif
57cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
58cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
59cdf0e10cSrcweir #endif
60cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_
61cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyChangeListener.hpp>
62cdf0e10cSrcweir #endif
63cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XVETOABLECHANGELISTENER_HPP_
64cdf0e10cSrcweir #include <com/sun/star/beans/XVetoableChangeListener.hpp>
65cdf0e10cSrcweir #endif
66cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XCONTAINERAPPROVEBROADCASTER_HPP_
67cdf0e10cSrcweir #include <com/sun/star/container/XContainerApproveBroadcaster.hpp>
68cdf0e10cSrcweir #endif
69cdf0e10cSrcweir #ifndef DBA_CONTENTHELPER_HXX
70cdf0e10cSrcweir #include "ContentHelper.hxx"
71cdf0e10cSrcweir #endif
72cdf0e10cSrcweir #ifndef DBACCESS_CONTAINERAPPROVE_HXX
73cdf0e10cSrcweir #include "containerapprove.hxx"
74cdf0e10cSrcweir #endif
75cdf0e10cSrcweir #ifndef _COMPHELPER_UNO3_HXX_
76cdf0e10cSrcweir #include <comphelper/uno3.hxx>
77cdf0e10cSrcweir #endif
78cdf0e10cSrcweir #ifndef _RTL_REF_HXX_
79cdf0e10cSrcweir #include <rtl/ref.hxx>
80cdf0e10cSrcweir #endif
81cdf0e10cSrcweir #ifndef _DBASHARED_APITOOLS_HXX_
82cdf0e10cSrcweir #include "apitools.hxx"
83cdf0e10cSrcweir #endif
84cdf0e10cSrcweir //........................................................................
85cdf0e10cSrcweir namespace dbaccess
86cdf0e10cSrcweir {
87cdf0e10cSrcweir //........................................................................
88cdf0e10cSrcweir 
89cdf0e10cSrcweir class ODefinitionContainer_Impl : public OContentHelper_Impl
90cdf0e10cSrcweir {
91cdf0e10cSrcweir public:
92cdf0e10cSrcweir     typedef ::std::map< ::rtl::OUString, TContentPtr >  NamedDefinitions;
93cdf0e10cSrcweir     typedef NamedDefinitions::iterator                  iterator;
94cdf0e10cSrcweir     typedef NamedDefinitions::const_iterator            const_iterator;
95cdf0e10cSrcweir 
96cdf0e10cSrcweir private:
97cdf0e10cSrcweir     NamedDefinitions    m_aDefinitions;
98cdf0e10cSrcweir 
99cdf0e10cSrcweir public:
size() const100cdf0e10cSrcweir     inline size_t size() const { return m_aDefinitions.size(); }
101cdf0e10cSrcweir 
begin() const102cdf0e10cSrcweir     inline const_iterator begin() const   { return m_aDefinitions.begin(); }
end() const103cdf0e10cSrcweir     inline const_iterator end() const     { return m_aDefinitions.end(); }
104cdf0e10cSrcweir 
find(const::rtl::OUString & _rName) const105cdf0e10cSrcweir     inline const_iterator find( const ::rtl::OUString& _rName ) const { return m_aDefinitions.find( _rName ); }
106cdf0e10cSrcweir            const_iterator find( TContentPtr _pDefinition ) const;
107cdf0e10cSrcweir 
erase(const::rtl::OUString & _rName)108cdf0e10cSrcweir     inline void erase( const ::rtl::OUString& _rName ) { m_aDefinitions.erase( _rName ); }
109cdf0e10cSrcweir     void erase( TContentPtr _pDefinition );
110cdf0e10cSrcweir 
insert(const::rtl::OUString & _rName,TContentPtr _pDefinition)111cdf0e10cSrcweir     inline void insert( const ::rtl::OUString& _rName, TContentPtr _pDefinition )
112cdf0e10cSrcweir     {
113cdf0e10cSrcweir         m_aDefinitions.insert( NamedDefinitions::value_type( _rName, _pDefinition ) );
114cdf0e10cSrcweir     }
115cdf0e10cSrcweir 
116cdf0e10cSrcweir private:
117cdf0e10cSrcweir     iterator find( TContentPtr _pDefinition );
118cdf0e10cSrcweir         // (for the moment, this is private. Make it public if needed. If really needed.)
119cdf0e10cSrcweir };
120cdf0e10cSrcweir 
121cdf0e10cSrcweir //==========================================================================
122cdf0e10cSrcweir //= ODefinitionContainer -  base class of collections of database definition
123cdf0e10cSrcweir //=                         documents
124cdf0e10cSrcweir //==========================================================================
125cdf0e10cSrcweir typedef ::cppu::ImplHelper7 <   ::com::sun::star::container::XIndexAccess
126cdf0e10cSrcweir                             ,   ::com::sun::star::container::XNameContainer
127cdf0e10cSrcweir                             ,   ::com::sun::star::container::XEnumerationAccess
128cdf0e10cSrcweir                             ,   ::com::sun::star::container::XContainer
129cdf0e10cSrcweir                             ,   ::com::sun::star::container::XContainerApproveBroadcaster
130cdf0e10cSrcweir                             ,   ::com::sun::star::beans::XPropertyChangeListener
131cdf0e10cSrcweir                             ,   ::com::sun::star::beans::XVetoableChangeListener
132cdf0e10cSrcweir                             >   ODefinitionContainer_Base;
133cdf0e10cSrcweir 
134cdf0e10cSrcweir class ODefinitionContainer
135cdf0e10cSrcweir             :public OContentHelper
136cdf0e10cSrcweir             ,public ODefinitionContainer_Base
137cdf0e10cSrcweir {
138cdf0e10cSrcweir protected:
139cdf0e10cSrcweir     DECLARE_STL_USTRINGACCESS_MAP(::com::sun::star::uno::WeakReference< ::com::sun::star::ucb::XContent >, Documents);
140cdf0e10cSrcweir     DECLARE_STL_VECTOR(Documents::iterator, DocumentsIndexAccess);
141cdf0e10cSrcweir 
142cdf0e10cSrcweir     enum ContainerOperation
143cdf0e10cSrcweir     {
144cdf0e10cSrcweir         E_REPLACED,
145cdf0e10cSrcweir         E_REMOVED,
146cdf0e10cSrcweir         E_INSERTED
147cdf0e10cSrcweir     };
148cdf0e10cSrcweir 
149cdf0e10cSrcweir     enum ListenerType
150cdf0e10cSrcweir     {
151cdf0e10cSrcweir         ApproveListeners,
152cdf0e10cSrcweir         ContainerListemers
153cdf0e10cSrcweir     };
154cdf0e10cSrcweir 
155cdf0e10cSrcweir private:
156cdf0e10cSrcweir     PContainerApprove   m_pElementApproval;
157cdf0e10cSrcweir 
158cdf0e10cSrcweir protected:
159cdf0e10cSrcweir     // we can't just hold a vector of XContentRefs, as after initialization they're all empty
160cdf0e10cSrcweir     // cause we load them only on access
161cdf0e10cSrcweir     DocumentsIndexAccess    m_aDocuments;               // for a efficient index access
162cdf0e10cSrcweir     Documents               m_aDocumentMap;             // for a efficient name access
163cdf0e10cSrcweir 
164cdf0e10cSrcweir     ::cppu::OInterfaceContainerHelper
165cdf0e10cSrcweir                             m_aApproveListeners;
166cdf0e10cSrcweir     ::cppu::OInterfaceContainerHelper
167cdf0e10cSrcweir                             m_aContainerListeners;
168cdf0e10cSrcweir 
169cdf0e10cSrcweir     sal_Bool                m_bInPropertyChange;
170cdf0e10cSrcweir     bool                    m_bCheckSlash;
171cdf0e10cSrcweir 
172cdf0e10cSrcweir protected:
173cdf0e10cSrcweir     /** Additionally to our own approvals which new elements must pass, derived classes
174*674f8708SJohn Bampton         can specify an additional approval instance here.
175cdf0e10cSrcweir 
176cdf0e10cSrcweir         Every time a new element is inserted into the container (or an element is replaced
177cdf0e10cSrcweir         with a new one), this new element must pass our own internal approval, plus the approval
178cdf0e10cSrcweir         given here.
179cdf0e10cSrcweir     */
setElementApproval(PContainerApprove _pElementApproval)180cdf0e10cSrcweir     void                setElementApproval( PContainerApprove _pElementApproval ) { m_pElementApproval = _pElementApproval; }
getElementApproval() const181cdf0e10cSrcweir     PContainerApprove   getElementApproval() const { return m_pElementApproval; }
182cdf0e10cSrcweir 
183cdf0e10cSrcweir protected:
184cdf0e10cSrcweir     virtual ~ODefinitionContainer();
185cdf0e10cSrcweir 
getDefinitions() const186cdf0e10cSrcweir     inline const ODefinitionContainer_Impl& getDefinitions() const
187cdf0e10cSrcweir     {
188cdf0e10cSrcweir         return dynamic_cast< const ODefinitionContainer_Impl& >( *m_pImpl.get() );
189cdf0e10cSrcweir     }
190cdf0e10cSrcweir 
getDefinitions()191cdf0e10cSrcweir     inline       ODefinitionContainer_Impl&  getDefinitions()
192cdf0e10cSrcweir     {
193cdf0e10cSrcweir         return dynamic_cast<       ODefinitionContainer_Impl& >( *m_pImpl.get() );
194cdf0e10cSrcweir     }
195cdf0e10cSrcweir public:
196cdf0e10cSrcweir     /** constructs the container.
197cdf0e10cSrcweir     */
198cdf0e10cSrcweir     ODefinitionContainer(
199cdf0e10cSrcweir           const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB
200cdf0e10cSrcweir         , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >&  _xParentContainer
201cdf0e10cSrcweir         , const TContentPtr& _pImpl
202cdf0e10cSrcweir         , bool _bCheckSlash = true
203cdf0e10cSrcweir         );
204cdf0e10cSrcweir 
205cdf0e10cSrcweir // ::com::sun::star::uno::XInterface
206cdf0e10cSrcweir     DECLARE_XINTERFACE( )
207cdf0e10cSrcweir // com::sun::star::lang::XTypeProvider
208cdf0e10cSrcweir     DECLARE_TYPEPROVIDER( );
209cdf0e10cSrcweir 
210cdf0e10cSrcweir // ::com::sun::star::lang::XServiceInfo
211cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
212cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
213cdf0e10cSrcweir 
214cdf0e10cSrcweir // ::com::sun::star::container::XElementAccess
215cdf0e10cSrcweir     virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw(::com::sun::star::uno::RuntimeException);
216cdf0e10cSrcweir     virtual sal_Bool SAL_CALL hasElements(  ) throw(::com::sun::star::uno::RuntimeException);
217cdf0e10cSrcweir 
218cdf0e10cSrcweir // ::com::sun::star::container::XEnumerationAccess
219cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(  ) throw(::com::sun::star::uno::RuntimeException);
220cdf0e10cSrcweir 
221cdf0e10cSrcweir // ::com::sun::star::container::XIndexAccess
222cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getCount(  ) throw(::com::sun::star::uno::RuntimeException);
223cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 _nIndex ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
224cdf0e10cSrcweir 
225cdf0e10cSrcweir // ::com::sun::star::container::XNameContainer
226cdf0e10cSrcweir     virtual void SAL_CALL insertByName( const ::rtl::OUString& _rName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
227cdf0e10cSrcweir     virtual void SAL_CALL removeByName( const ::rtl::OUString& _rName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
228cdf0e10cSrcweir 
229cdf0e10cSrcweir // ::com::sun::star::container::XNameReplace
230cdf0e10cSrcweir     virtual void SAL_CALL replaceByName( const ::rtl::OUString& _rName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
231cdf0e10cSrcweir 
232cdf0e10cSrcweir // ::com::sun::star::container::XNameAccess
233cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
234cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw(::com::sun::star::uno::RuntimeException);
235cdf0e10cSrcweir     virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
236cdf0e10cSrcweir 
237cdf0e10cSrcweir // ::com::sun::star::container::XContainer
238cdf0e10cSrcweir     virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
239cdf0e10cSrcweir     virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
240cdf0e10cSrcweir 
241cdf0e10cSrcweir     // XContainerApproveBroadcaster
242cdf0e10cSrcweir     virtual void SAL_CALL addContainerApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerApproveListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
243cdf0e10cSrcweir     virtual void SAL_CALL removeContainerApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerApproveListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
244cdf0e10cSrcweir 
245cdf0e10cSrcweir // ::com::sun::star::lang::XEventListener
246cdf0e10cSrcweir     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
247cdf0e10cSrcweir 
248cdf0e10cSrcweir     // XPropertyChangeListener
249cdf0e10cSrcweir     virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
250cdf0e10cSrcweir     // XVetoableChangeListener
251cdf0e10cSrcweir     virtual void SAL_CALL vetoableChange( const ::com::sun::star::beans::PropertyChangeEvent& aEvent ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
252cdf0e10cSrcweir 
253cdf0e10cSrcweir protected:
254cdf0e10cSrcweir     // helper
255cdf0e10cSrcweir     virtual void SAL_CALL disposing();
256cdf0e10cSrcweir 
257cdf0e10cSrcweir     /** create a object from it's persistent data within the configuration. To be overwritten by derived classes.
258cdf0e10cSrcweir         @param      _rName          the name the object has within the container
259*674f8708SJohn Bampton         @return                     the newly created object or an empty reference if something went wrong
260cdf0e10cSrcweir     */
261cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent > createObject(
262cdf0e10cSrcweir         const ::rtl::OUString& _rName) = 0;
263cdf0e10cSrcweir 
264cdf0e10cSrcweir     /** get the object specified by the given name. If desired, the object will be read if not already done so.<BR>
265cdf0e10cSrcweir         @param      _rName              the object name
266cdf0e10cSrcweir         @param      _bReadIfNeccessary  if sal_True, the object will be created if necessary
267cdf0e10cSrcweir         @return                         the property set interface of the object. Usually the return value is not NULL, but
268cdf0e10cSrcweir                                         if so, then the object could not be read from the configuration
269cdf0e10cSrcweir         @throws                         NoSuchElementException if there is no object with the given name.
270cdf0e10cSrcweir         @see    createObject
271cdf0e10cSrcweir     */
272cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >
273cdf0e10cSrcweir                 implGetByName(const ::rtl::OUString& _rName, sal_Bool _bCreateIfNecessary) throw (::com::sun::star::container::NoSuchElementException);
274cdf0e10cSrcweir 
27530acf5e8Spfg     /** quickly checks if there already is an element with a given name. No access to the configuration occurs, i.e.
276cdf0e10cSrcweir         if there is such an object which is not already loaded, it won't be loaded now.
277cdf0e10cSrcweir         @param      _rName      the object name to check
278cdf0e10cSrcweir         @return                 sal_True if there already exists such an object
279cdf0e10cSrcweir     */
280cdf0e10cSrcweir     virtual sal_Bool checkExistence(const ::rtl::OUString& _rName);
281cdf0e10cSrcweir 
282cdf0e10cSrcweir     /** append a new object to the container. No plausibility checks are done, e.g. if the object is non-NULL or
283cdf0e10cSrcweir         if the name is already used by another object or anything like this. This method is for derived classes
284cdf0e10cSrcweir         which may support different methods to create and/or append objects, and don't want to deal with the
285cdf0e10cSrcweir         internal structures of this class.<BR>
286cdf0e10cSrcweir         The old component will not be disposed, this is the callers responsibility, too.
287cdf0e10cSrcweir         @param      _rName          the name of the new object
288cdf0e10cSrcweir         @param      _rxNewObject    the new object (not surprising, is it ?)
289cdf0e10cSrcweir         @see        createConfigKey
290cdf0e10cSrcweir         @see        implReplace
291cdf0e10cSrcweir         @see        implRemove
292cdf0e10cSrcweir     */
293cdf0e10cSrcweir     void    implAppend(
294cdf0e10cSrcweir         const ::rtl::OUString& _rName,
295cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& _rxNewObject
296cdf0e10cSrcweir         );
297cdf0e10cSrcweir 
298cdf0e10cSrcweir     /** remove all references to an object from the container. No plausibility checks are done, e.g. whether
299cdf0e10cSrcweir         or not there exists an object with the given name. This is the responsibility of the caller.<BR>
300cdf0e10cSrcweir         Additionally the node for the given object will be removed from the registry (including all sub nodes).<BR>
301cdf0e10cSrcweir         The old component will not be disposed, this is the callers responsibility, too.
302cdf0e10cSrcweir         @param          _rName      the objects name
303cdf0e10cSrcweir         @see            implReplace
304cdf0e10cSrcweir         @see            implAppend
305cdf0e10cSrcweir     */
306cdf0e10cSrcweir     void implRemove(const ::rtl::OUString& _rName);
307cdf0e10cSrcweir 
308cdf0e10cSrcweir     /** remove a object in the container. No plausibility checks are done, e.g. whether
309cdf0e10cSrcweir         or not there exists an object with the given name or the object is non-NULL. This is the responsibility of the caller.<BR>
310cdf0e10cSrcweir         Additionally all object-related informations within the registry will be deleted. The new object config node,
311cdf0e10cSrcweir         where the caller may want to store the new objects information, is returned.<BR>
312cdf0e10cSrcweir         The old component will not be disposed, this is the callers responsibility, too.
313cdf0e10cSrcweir         @param          _rName              the objects name
314cdf0e10cSrcweir         @param          _rxNewObject        the new object
315cdf0e10cSrcweir         @param          _rNewObjectNode     the configuration node where the new object may be stored
316cdf0e10cSrcweir         @see            implAppend
317cdf0e10cSrcweir         @see            implRemove
318cdf0e10cSrcweir     */
319cdf0e10cSrcweir     void implReplace(
320cdf0e10cSrcweir         const ::rtl::OUString& _rName,
321cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& _rxNewObject
322cdf0e10cSrcweir         );
323cdf0e10cSrcweir 
324cdf0e10cSrcweir     /** notifies our container/approve listeners
325cdf0e10cSrcweir     */
326cdf0e10cSrcweir     void notifyByName(
327cdf0e10cSrcweir             ::osl::ResettableMutexGuard& _rGuard,
328cdf0e10cSrcweir             const ::rtl::OUString& _rName,
329cdf0e10cSrcweir             const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& _xNewElement,
330cdf0e10cSrcweir             const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& xOldElement,
331cdf0e10cSrcweir             ContainerOperation _eOperation,
332cdf0e10cSrcweir             ListenerType _eType
333cdf0e10cSrcweir         );
334cdf0e10cSrcweir 
operator ::com::sun::star::uno::Reference<::com::sun::star::uno::XInterface>() const335cdf0e10cSrcweir     inline SAL_CALL operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > () const
336cdf0e10cSrcweir     {
337cdf0e10cSrcweir         return const_cast< XContainer* >( static_cast< const XContainer* >( this ) );
338cdf0e10cSrcweir     }
339cdf0e10cSrcweir 
340cdf0e10cSrcweir private:
341cdf0e10cSrcweir     void    addObjectListener(const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& _xNewObject);
342cdf0e10cSrcweir     void    removeObjectListener(const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& _xNewObject);
343cdf0e10cSrcweir 
344cdf0e10cSrcweir     /** approve that the object given may be inserted into the container. Should be overloaded by derived classes,
345cdf0e10cSrcweir         the default implementation just checks the object to be non-void.
346cdf0e10cSrcweir 
347cdf0e10cSrcweir         @throws IllegalArgumentException
348cdf0e10cSrcweir             if the name or the object are invalid
349cdf0e10cSrcweir         @throws ElementExistException
350cdf0e10cSrcweir             if the object already exists in the container, or another object with the same name
351cdf0e10cSrcweir             already exists
352cdf0e10cSrcweir         @throws WrappedTargetException
35330acf5e8Spfg             if another error occurs which prevents insertion of the object into the container
354cdf0e10cSrcweir     */
355cdf0e10cSrcweir     void approveNewObject(
356cdf0e10cSrcweir             const ::rtl::OUString& _sName,
357cdf0e10cSrcweir             const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& _rxObject
358cdf0e10cSrcweir         ) const;
359cdf0e10cSrcweir 
impl_haveAnyListeners_nothrow() const360cdf0e10cSrcweir     inline bool impl_haveAnyListeners_nothrow() const
361cdf0e10cSrcweir     {
362cdf0e10cSrcweir         return ( m_aContainerListeners.getLength() > 0 ) || ( m_aApproveListeners.getLength() > 0 );
363cdf0e10cSrcweir     }
364cdf0e10cSrcweir };
365cdf0e10cSrcweir 
366cdf0e10cSrcweir //........................................................................
367cdf0e10cSrcweir }   // namespace dbaccess
368cdf0e10cSrcweir //........................................................................
369cdf0e10cSrcweir 
370cdf0e10cSrcweir #endif // _DBA_CORE_DEFINITIONCONTAINER_HXX_
371