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 #ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_
24 #define _CONNECTIVITY_SDBCX_COLUMN_HXX_
25 
26 #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
27 #include <com/sun/star/container/XNamed.hpp>
28 #include <comphelper/IdPropArrayHelper.hxx>
29 #include <cppuhelper/compbase2.hxx>
30 #include <cppuhelper/implbase1.hxx>
31 #include "connectivity/CommonTools.hxx"
32 #include <comphelper/broadcasthelper.hxx>
33 #include "connectivity/sdbcx/VDescriptor.hxx"
34 #include "connectivity/dbtoolsdllapi.hxx"
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 
37 namespace connectivity
38 {
39 	namespace sdbcx
40 	{
41 		class OColumn;
42 		typedef ::comphelper::OIdPropertyArrayUsageHelper<OColumn> OColumn_PROP;
43 
44         typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::container::XNamed,
45 												  ::com::sun::star::lang::XServiceInfo> OColumnDescriptor_BASE;
46 		typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XDataDescriptorFactory > OColumn_BASE;
47 
48 
49 		class OOO_DLLPUBLIC_DBTOOLS OColumn :
50                                     public comphelper::OBaseMutex,
51 									public OColumn_BASE,
52 									public OColumnDescriptor_BASE,
53 									public OColumn_PROP,
54 									public ODescriptor
55 		{
56 		protected:
57 			::rtl::OUString m_TypeName;
58 			::rtl::OUString m_Description;
59 			::rtl::OUString m_DefaultValue;
60 
61 			sal_Int32		m_IsNullable;
62 			sal_Int32		m_Precision;
63 			sal_Int32		m_Scale;
64 			sal_Int32		m_Type;
65 
66 			sal_Bool		m_IsAutoIncrement;
67 			sal_Bool		m_IsRowVersion;
68 			sal_Bool		m_IsCurrency;
69 
70 			using OColumnDescriptor_BASE::rBHelper;
71 			virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
72 			virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
73 
74 			virtual ~OColumn();
75 		public:
76 			virtual void	SAL_CALL acquire() throw();
77 			virtual void	SAL_CALL release() throw();
78 
79 			OColumn(	sal_Bool _bCase);
80 			OColumn(	const ::rtl::OUString& _Name,
81 								const ::rtl::OUString& _TypeName,
82 								const ::rtl::OUString& _DefaultValue,
83                                 const ::rtl::OUString& _Description,
84 								sal_Int32		_IsNullable,
85 								sal_Int32		_Precision,
86 								sal_Int32		_Scale,
87 								sal_Int32		_Type,
88 								sal_Bool		_IsAutoIncrement,
89 								sal_Bool		_IsRowVersion,
90 								sal_Bool		_IsCurrency,
91 								sal_Bool		_bCase);
92 
93 			DECLARE_SERVICE_INFO();
94 			//XInterface
95 			virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
96 			//XTypeProvider
97 			virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
98 			// ODescriptor
99 			virtual void construct();
100 			// ::cppu::OComponentHelper
101 			virtual void SAL_CALL disposing(void);
102 			// XPropertySet
103             virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
104 			// XNamed
105 			virtual ::rtl::OUString SAL_CALL getName(  ) throw(::com::sun::star::uno::RuntimeException);
106 			virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
107 			// XDataDescriptorFactory
108 			virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor(  ) throw(::com::sun::star::uno::RuntimeException);
109 		};
110 	}
111 }
112 
113 #endif // _CONNECTIVITY_SDBCX_COLUMN_HXX_
114 
115