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