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