xref: /trunk/main/dbaccess/source/ui/inc/TableRow.hxx (revision 2e2212a7)
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 DBAUI_TABLEROW_HXX
24 #define DBAUI_TABLEROW_HXX
25 
26 #ifndef _COMPHELPER_STLTYPES_HXX_
27 #include <comphelper/stl_types.hxx>
28 #endif
29 #ifndef _STRING_HXX
30 #include <tools/string.hxx>
31 #endif
32 #ifndef _STREAM_HXX
33 #include <tools/stream.hxx>
34 #endif
35 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #endif
38 #ifndef DBAUI_TYPEINFO_HXX
39 #include "TypeInfo.hxx"
40 #endif
41 
42 
43 namespace dbaui
44 {
45 //	class OTableRow;
46 //	friend SvStream& operator<<( SvStream& rStr, OTableRow& _rRow );
47 
48 	class OFieldDescription;
49 	class OTypeInfo;
50 	class OTableRow
51 	{
52 	private:
53 		OFieldDescription*		m_pActFieldDescr;
54 		long					m_nPos;
55 		bool					m_bReadOnly;
56 		bool					m_bOwnsDescriptions;
57 
58 	protected:
59 	public:
60 		OTableRow();
61 		OTableRow(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAffectedCol);
62 		OTableRow( const OTableRow& rRow, long nPosition = -1 );
63 		~OTableRow();
64 
GetActFieldDescr() const65 		inline OFieldDescription* GetActFieldDescr() const { return m_pActFieldDescr; }
isValid() const66 		inline bool isValid() const { return GetActFieldDescr() != NULL; }
67 
68 		void SetFieldType( const TOTypeInfoSP& _pType, sal_Bool _bForce = sal_False );
69 
70 		void SetPrimaryKey( sal_Bool bSet );
71 		sal_Bool IsPrimaryKey() const;
72 
73 		/** returns the current position in the table.
74 			@return
75 				the current position in the table
76 		*/
GetPos() const77 		inline long GetPos() const { return m_nPos; }
SetPos(sal_Int32 _nPos)78 		inline void SetPos(sal_Int32 _nPos) { m_nPos = _nPos; }
79 
80 		/** set the row readonly
81 			@param	_bRead
82 				if <TRUE/> then the row is redonly, otherwise not
83 		*/
SetReadOnly(bool _bRead=true)84 		inline void SetReadOnly( bool _bRead=true ){ m_bReadOnly = _bRead; }
85 
86 		/** returns if the row is readonly
87 			@return
88 				<TRUE/> if readonly, otherwise <FALSE/>
89 		*/
IsReadOnly() const90 		inline bool IsReadOnly() const { return m_bReadOnly; }
91 
92 		friend SvStream& operator<<( SvStream& rStr,const OTableRow& _rRow );
93 		friend SvStream& operator>>( SvStream& rStr, OTableRow& _rRow );
94 	};
95 }
96 #endif // DBAUI_TABLEROW_HXX
97 
98