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