1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 5 * This Source Code Form is subject to the terms of the Mozilla Public 6 * License, v. 2.0. If a copy of the MPL was not distributed with this 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 11 * Licensed to the Apache Software Foundation (ASF) under one or more 12 * contributor license agreements. See the NOTICE file distributed 13 * with this work for additional information regarding copyright 14 * ownership. The ASF licenses this file to you under the Apache 15 * License, Version 2.0 (the "License"); you may not use this file 16 * except in compliance with the License. You may obtain a copy of 17 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 18 */ 19 #pragma once 20 21 #include <com/sun/star/beans/XPropertySet.hpp> 22 #include <tools/long.hxx> 23 #include "TypeInfo.hxx" 24 25 class SvStream; 26 27 namespace dbaui 28 { 29 class OFieldDescription; 30 class OTableRow 31 { 32 private: 33 OFieldDescription* m_pActFieldDescr; 34 sal_Int32 m_nPos; 35 bool m_bReadOnly; 36 bool m_bOwnsDescriptions; 37 38 protected: 39 public: 40 OTableRow(); 41 OTableRow( const OTableRow& rRow, tools::Long nPosition = -1 ); 42 ~OTableRow(); 43 GetActFieldDescr() const44 OFieldDescription* GetActFieldDescr() const { return m_pActFieldDescr; } isValid() const45 bool isValid() const { return GetActFieldDescr() != nullptr; } 46 47 void SetFieldType( const TOTypeInfoSP& _pType, bool _bForce = false ); 48 49 void SetPrimaryKey( bool bSet ); 50 bool IsPrimaryKey() const; 51 52 /** returns the current position in the table. 53 @return 54 the current position in the table 55 */ GetPos() const56 sal_Int32 GetPos() const { return m_nPos; } SetPos(sal_Int32 _nPos)57 void SetPos(sal_Int32 _nPos) { m_nPos = _nPos; } 58 59 /** set the row readonly 60 @param _bRead 61 if <TRUE/> then the row is readonly, otherwise not 62 */ SetReadOnly(bool _bRead=true)63 void SetReadOnly( bool _bRead=true ){ m_bReadOnly = _bRead; } 64 65 /** returns if the row is readonly 66 @return 67 <TRUE/> if readonly, otherwise <FALSE/> 68 */ IsReadOnly() const69 bool IsReadOnly() const { return m_bReadOnly; } 70 71 friend SvStream& WriteOTableRow( SvStream& rStr,const OTableRow& _rRow ); 72 friend SvStream& ReadOTableRow( SvStream& rStr, OTableRow& _rRow ); 73 }; 74 75 } 76 77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 78