1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _DBA_CORE_TABLECONTAINER_HXX_
29 #define _DBA_CORE_TABLECONTAINER_HXX_
30 
31 #ifndef _CPPUHELPER_IMPLBASE1_HXX_
32 #include <cppuhelper/implbase1.hxx>
33 #endif
34 #ifndef _COMPHELPER_STLTYPES_HXX_
35 #include <comphelper/stl_types.hxx>
36 #endif
37 #ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_
38 #include <com/sun/star/container/XEnumerationAccess.hpp>
39 #endif
40 #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
41 #include <com/sun/star/container/XNameAccess.hpp>
42 #endif
43 #ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
44 #include <com/sun/star/container/XIndexAccess.hpp>
45 #endif
46 #ifndef _COM_SUN_STAR_UTIL_XREFRESHABLE_HPP_
47 #include <com/sun/star/util/XRefreshable.hpp>
48 #endif
49 #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
50 #include <com/sun/star/lang/XServiceInfo.hpp>
51 #endif
52 #ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
53 #include <com/sun/star/uno/Sequence.hxx>
54 #endif
55 #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
56 #include <com/sun/star/sdbc/XConnection.hpp>
57 #endif
58 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
59 #include <com/sun/star/beans/XPropertySet.hpp>
60 #endif
61 #ifndef _COM_SUN_STAR_CONTAINER_XCONTAINERLISTENER_HPP_
62 #include <com/sun/star/container/XContainerListener.hpp>
63 #endif
64 #ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
65 #include <com/sun/star/container/XNameContainer.hpp>
66 #endif
67 #ifndef DBACCESS_CORE_FILTERED_CONTAINER_HXX
68 #include "FilteredContainer.hxx"
69 #endif
70 #ifndef DBTOOLS_WARNINGSCONTAINER_HXX
71 #include <connectivity/warningscontainer.hxx>
72 #endif
73 #ifndef DBA_CORE_REFRESHLISTENER_HXX
74 #include "RefreshListener.hxx"
75 #endif
76 #ifndef _DBASHARED_APITOOLS_HXX_
77 #include "apitools.hxx"
78 #endif
79 
80 namespace dbaccess
81 {
82 	typedef ::cppu::ImplHelper1< ::com::sun::star::container::XContainerListener> OTableContainer_Base;
83 
84 	//==========================================================================
85 	//= OTableContainer
86 	//==========================================================================
87 	class OTable;
88 	class OTableContainer;
89 	class OContainerMediator;
90 
91 	class OTableContainer :  public OFilteredContainer,
92 							 public OTableContainer_Base
93 	{
94 		::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >	m_xTableDefinitions;
95         ::rtl::Reference< OContainerMediator >                                          m_pTableMediator;
96 		sal_Bool				m_bInDrop;					// set when we are in the drop method
97 
98 
99 		// OFilteredContainer
100 		virtual void addMasterContainerListener();
101 		virtual void removeMasterContainerListener();
102         virtual ::rtl::OUString getTableTypeRestriction() const;
103 
104 		// ::connectivity::sdbcx::OCollection
105 		virtual connectivity::sdbcx::ObjectType		createObject(const ::rtl::OUString& _rName);
106 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >	createDescriptor();
107         virtual connectivity::sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
108 		virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName);
109 
110 		virtual void SAL_CALL disposing();
111 
112         inline virtual void SAL_CALL acquire() throw(){ OFilteredContainer::acquire();}
113 		inline virtual void SAL_CALL release() throw(){ OFilteredContainer::release();}
114 	// ::com::sun::star::lang::XServiceInfo
115 		DECLARE_SERVICE_INFO();
116 
117 		// XEventListener
118 		virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
119 		// XContainerListener
120 		virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
121 		virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
122 		virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
123 
124 	public:
125 		/** ctor of the container. The parent has to support the <type scope="com::sun::star::sdbc">XConnection</type>
126 			interface.<BR>
127 			@param			_rParent			the object which acts as parent for the container.
128 												all refcounting is rerouted to this object
129 			@param			_rMutex				the access safety object of the parent
130 			@param			_rTableFilter		restricts the visible tables by name
131 			@param			_rTableTypeFilter	restricts the visible tables by type
132 			@see			construct
133 		*/
134 		OTableContainer( ::cppu::OWeakObject& _rParent,
135 			::osl::Mutex& _rMutex,
136 			const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xCon,
137 			sal_Bool _bCase,
138 			const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >&	_xTableDefinitions,
139 			IRefreshListener*	_pRefreshListener,
140 			::dbtools::IWarningsContainer* _pWarningsContainer,
141             oslInterlockedCount& _nInAppend
142 			);
143 
144 		virtual ~OTableContainer();
145 	};
146 }
147 #endif // _DBA_CORE_TABLECONTAINER_HXX_
148 
149 
150