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