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 DBACCESS_CORE_API_CROWSETDATACOLUMN_HXX
28 #define DBACCESS_CORE_API_CROWSETDATACOLUMN_HXX
29 
30 #include "datacolumn.hxx"
31 #include "RowSetRow.hxx"
32 #include "RowSetCacheIterator.hxx"
33 #include "columnsettings.hxx"
34 
35 #include <connectivity/CommonTools.hxx>
36 #include <comphelper/proparrhlp.hxx>
37 
38 namespace dbaccess
39 {
40 	class ORowSetDataColumn;
41 	typedef ::comphelper::OPropertyArrayUsageHelper<ORowSetDataColumn> ORowSetDataColumn_PROP;
42 
43 	class ORowSetDataColumn :	public ODataColumn,
44 								public OColumnSettings,
45 								public ORowSetDataColumn_PROP
46 	{
47 	protected:
48 		ORowSetCacheIterator		m_aColumnValue;
49 		::com::sun::star::uno::Any	m_aOldValue;
50 
51         ::rtl::OUString             m_sLabel;
52 		::rtl::OUString				m_aDescription;		// description
53 		ORowSetBase*				m_pRowSet;
54 
55 		virtual ~ORowSetDataColumn();
56 	public:
57 		ORowSetDataColumn(const ::com::sun::star::uno::Reference < ::com::sun::star::sdbc::XResultSetMetaData >& _xMetaData,
58 						  const ::com::sun::star::uno::Reference < ::com::sun::star::sdbc::XRow >& _xRow,
59 						  const ::com::sun::star::uno::Reference < ::com::sun::star::sdbc::XRowUpdate >& _xRowUpdate,
60 						  sal_Int32 _nPos,
61                           const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxDBMeta,
62 						  const ::rtl::OUString& _rDescription,
63                           const ::rtl::OUString& i_sLabel,
64 						  const ORowSetCacheIterator& _rColumnValue);
65 
66 
67 		// com::sun::star::lang::XTypeProvider
68 		virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
69 		// comphelper::OPropertyArrayUsageHelper
70 		virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
71 
72 		// cppu::OPropertySetHelper
73 		virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
74 
75 		virtual sal_Bool SAL_CALL convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue,
76 															::com::sun::star::uno::Any & rOldValue,
77 															sal_Int32 nHandle,
78 															const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException);
79 		virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
80 		virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue )throw (::com::sun::star::uno::Exception);
81 
82 		virtual void fireValueChange(const ::connectivity::ORowSetValue& _rOldValue);
83     protected:
84         using ODataColumn::getFastPropertyValue;
85 	};
86 	// -------------------------------------------------------------------------
87 //	typedef connectivity::ORefVector< ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> >
88 //			ORowSetDataColumns_COLLECTION;
89 
90 	typedef connectivity::sdbcx::OCollection ORowSetDataColumns_BASE;
91 	class ORowSetDataColumns : public ORowSetDataColumns_BASE
92 	{
93 		::vos::ORef< ::connectivity::OSQLColumns> m_aColumns;
94 	protected:
95 		virtual connectivity::sdbcx::ObjectType createObject(const ::rtl::OUString& _rName);
96 		virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
97 	public:
98 		ORowSetDataColumns(
99 						sal_Bool _bCase,
100 						const ::vos::ORef< ::connectivity::OSQLColumns>& _rColumns,
101 						::cppu::OWeakObject& _rParent,
102 						::osl::Mutex& _rMutex,
103 						const ::std::vector< ::rtl::OUString> &_rVector
104 						);
105 		virtual ~ORowSetDataColumns();
106 		// only the name is identical to ::cppu::OComponentHelper
107 		virtual void SAL_CALL disposing(void);
108 		void assign(const ::vos::ORef< ::connectivity::OSQLColumns>& _rColumns,const ::std::vector< ::rtl::OUString> &_rVector);
109 	};
110 }
111 
112 #endif
113 
114