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 _CONNECTIVITY_SDBCX_INDEX_HXX_
25 #define _CONNECTIVITY_SDBCX_INDEX_HXX_
26 
27 //#ifndef _OSL_DIAGNOSE_H_
28 //#include <osl/diagnose.h>
29 //#endif
30 #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
31 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
32 #include <com/sun/star/container/XNamed.hpp>
33 #include <comphelper/IdPropArrayHelper.hxx>
34 #include <cppuhelper/compbase2.hxx>
35 #include "connectivity/CommonTools.hxx"
36 #include <comphelper/broadcasthelper.hxx>
37 #include "connectivity/sdbcx/VTypeDef.hxx"
38 #include "connectivity/sdbcx/IRefreshable.hxx"
39 #include "connectivity/sdbcx/VDescriptor.hxx"
40 #include "connectivity/dbtoolsdllapi.hxx"
41 #include <com/sun/star/lang/XServiceInfo.hpp>
42 #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
43 #include <cppuhelper/implbase1.hxx>
44 
45 namespace connectivity
46 {
47 	namespace sdbcx
48 	{
49 		class OCollection;
50 		class OIndex;
51 		typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XDataDescriptorFactory > OIndex_BASE;
52 		typedef ::comphelper::OIdPropertyArrayUsageHelper<OIndex> OIndex_PROP;
53 
54 		class OOO_DLLPUBLIC_DBTOOLS OIndex :
55                                     public comphelper::OBaseMutex,
56 									public ODescriptor_BASE,
57 									public IRefreshableColumns,
58 									public OIndex_PROP,
59 									public ODescriptor,
60 									public OIndex_BASE
61 		{
62 		protected:
63 			::rtl::OUString	m_Catalog;
64 			sal_Bool		m_IsUnique;
65 			sal_Bool		m_IsPrimaryKeyIndex;
66 			sal_Bool		m_IsClustered;
67 
68 			OCollection*	m_pColumns;
69 
70 			using ODescriptor_BASE::rBHelper;
71 			virtual void refreshColumns();
72 			// OPropertyArrayUsageHelper
73 			virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
74 			virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
75 		public:
76 			OIndex(sal_Bool _bCase);
77 			OIndex(	const ::rtl::OUString& _Name,
78 					const ::rtl::OUString& _Catalog,
79 					sal_Bool _isUnique,
80 					sal_Bool _isPrimaryKeyIndex,
81 					sal_Bool _isClustered,
82 					sal_Bool _bCase);
83 
84 			virtual ~OIndex( );
85 
86 			DECLARE_SERVICE_INFO();
87 
88 			//XInterface
89 			virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
90 			virtual void SAL_CALL acquire() throw();
91 			virtual void SAL_CALL release() throw();
92 			//XTypeProvider
93             virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
94 			// ODescriptor
95 			virtual void construct();
96 			// ::cppu::OComponentHelper
97 			virtual void SAL_CALL disposing(void);
98 			// XPropertySet
99             virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
100 			// XColumnsSupplier
101             virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns(  ) throw(::com::sun::star::uno::RuntimeException);
102 
103 			// XNamed
104             virtual ::rtl::OUString SAL_CALL getName(  ) throw(::com::sun::star::uno::RuntimeException);
105             virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
106 			// XDataDescriptorFactory
107 			virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor(  ) throw(::com::sun::star::uno::RuntimeException);
108 		};
109 	}
110 }
111 
112 #endif // _CONNECTIVITY_SDBCX_INDEX_HXX_
113 
114