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