1*2e2212a7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2e2212a7SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2e2212a7SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2e2212a7SAndrew Rist  * distributed with this work for additional information
6*2e2212a7SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2e2212a7SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2e2212a7SAndrew Rist  * "License"); you may not use this file except in compliance
9*2e2212a7SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2e2212a7SAndrew Rist  *
11*2e2212a7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2e2212a7SAndrew Rist  *
13*2e2212a7SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2e2212a7SAndrew Rist  * software distributed under the License is distributed on an
15*2e2212a7SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2e2212a7SAndrew Rist  * KIND, either express or implied.  See the License for the
17*2e2212a7SAndrew Rist  * specific language governing permissions and limitations
18*2e2212a7SAndrew Rist  * under the License.
19*2e2212a7SAndrew Rist  *
20*2e2212a7SAndrew Rist  *************************************************************/
21*2e2212a7SAndrew Rist 
22*2e2212a7SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _DBA_CORE_TABLECONTAINER_HXX_
25cdf0e10cSrcweir #define _DBA_CORE_TABLECONTAINER_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef _CPPUHELPER_IMPLBASE1_HXX_
28cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #ifndef _COMPHELPER_STLTYPES_HXX_
31cdf0e10cSrcweir #include <comphelper/stl_types.hxx>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_
34cdf0e10cSrcweir #include <com/sun/star/container/XEnumerationAccess.hpp>
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
37cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
40cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UTIL_XREFRESHABLE_HPP_
43cdf0e10cSrcweir #include <com/sun/star/util/XRefreshable.hpp>
44cdf0e10cSrcweir #endif
45cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
46cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
47cdf0e10cSrcweir #endif
48cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
49cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
50cdf0e10cSrcweir #endif
51cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
52cdf0e10cSrcweir #include <com/sun/star/sdbc/XConnection.hpp>
53cdf0e10cSrcweir #endif
54cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
55cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
56cdf0e10cSrcweir #endif
57cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XCONTAINERLISTENER_HPP_
58cdf0e10cSrcweir #include <com/sun/star/container/XContainerListener.hpp>
59cdf0e10cSrcweir #endif
60cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
61cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
62cdf0e10cSrcweir #endif
63cdf0e10cSrcweir #ifndef DBACCESS_CORE_FILTERED_CONTAINER_HXX
64cdf0e10cSrcweir #include "FilteredContainer.hxx"
65cdf0e10cSrcweir #endif
66cdf0e10cSrcweir #ifndef DBTOOLS_WARNINGSCONTAINER_HXX
67cdf0e10cSrcweir #include <connectivity/warningscontainer.hxx>
68cdf0e10cSrcweir #endif
69cdf0e10cSrcweir #ifndef DBA_CORE_REFRESHLISTENER_HXX
70cdf0e10cSrcweir #include "RefreshListener.hxx"
71cdf0e10cSrcweir #endif
72cdf0e10cSrcweir #ifndef _DBASHARED_APITOOLS_HXX_
73cdf0e10cSrcweir #include "apitools.hxx"
74cdf0e10cSrcweir #endif
75cdf0e10cSrcweir 
76cdf0e10cSrcweir namespace dbaccess
77cdf0e10cSrcweir {
78cdf0e10cSrcweir 	typedef ::cppu::ImplHelper1< ::com::sun::star::container::XContainerListener> OTableContainer_Base;
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	//==========================================================================
81cdf0e10cSrcweir 	//= OTableContainer
82cdf0e10cSrcweir 	//==========================================================================
83cdf0e10cSrcweir 	class OTable;
84cdf0e10cSrcweir 	class OTableContainer;
85cdf0e10cSrcweir 	class OContainerMediator;
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 	class OTableContainer :  public OFilteredContainer,
88cdf0e10cSrcweir 							 public OTableContainer_Base
89cdf0e10cSrcweir 	{
90cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >	m_xTableDefinitions;
91cdf0e10cSrcweir         ::rtl::Reference< OContainerMediator >                                          m_pTableMediator;
92cdf0e10cSrcweir 		sal_Bool				m_bInDrop;					// set when we are in the drop method
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 		// OFilteredContainer
96cdf0e10cSrcweir 		virtual void addMasterContainerListener();
97cdf0e10cSrcweir 		virtual void removeMasterContainerListener();
98cdf0e10cSrcweir         virtual ::rtl::OUString getTableTypeRestriction() const;
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 		// ::connectivity::sdbcx::OCollection
101cdf0e10cSrcweir 		virtual connectivity::sdbcx::ObjectType		createObject(const ::rtl::OUString& _rName);
102cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >	createDescriptor();
103cdf0e10cSrcweir         virtual connectivity::sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
104cdf0e10cSrcweir 		virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName);
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 		virtual void SAL_CALL disposing();
107cdf0e10cSrcweir 
acquire()108cdf0e10cSrcweir         inline virtual void SAL_CALL acquire() throw(){ OFilteredContainer::acquire();}
release()109cdf0e10cSrcweir 		inline virtual void SAL_CALL release() throw(){ OFilteredContainer::release();}
110cdf0e10cSrcweir 	// ::com::sun::star::lang::XServiceInfo
111cdf0e10cSrcweir 		DECLARE_SERVICE_INFO();
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 		// XEventListener
114cdf0e10cSrcweir 		virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
115cdf0e10cSrcweir 		// XContainerListener
116cdf0e10cSrcweir 		virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
117cdf0e10cSrcweir 		virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
118cdf0e10cSrcweir 		virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 	public:
121cdf0e10cSrcweir 		/** ctor of the container. The parent has to support the <type scope="com::sun::star::sdbc">XConnection</type>
122cdf0e10cSrcweir 			interface.<BR>
123cdf0e10cSrcweir 			@param			_rParent			the object which acts as parent for the container.
124cdf0e10cSrcweir 												all refcounting is rerouted to this object
125cdf0e10cSrcweir 			@param			_rMutex				the access safety object of the parent
126cdf0e10cSrcweir 			@param			_rTableFilter		restricts the visible tables by name
127cdf0e10cSrcweir 			@param			_rTableTypeFilter	restricts the visible tables by type
128cdf0e10cSrcweir 			@see			construct
129cdf0e10cSrcweir 		*/
130cdf0e10cSrcweir 		OTableContainer( ::cppu::OWeakObject& _rParent,
131cdf0e10cSrcweir 			::osl::Mutex& _rMutex,
132cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xCon,
133cdf0e10cSrcweir 			sal_Bool _bCase,
134cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >&	_xTableDefinitions,
135cdf0e10cSrcweir 			IRefreshListener*	_pRefreshListener,
136cdf0e10cSrcweir 			::dbtools::IWarningsContainer* _pWarningsContainer,
137cdf0e10cSrcweir             oslInterlockedCount& _nInAppend
138cdf0e10cSrcweir 			);
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 		virtual ~OTableContainer();
141cdf0e10cSrcweir 	};
142cdf0e10cSrcweir }
143cdf0e10cSrcweir #endif // _DBA_CORE_TABLECONTAINER_HXX_
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 
146