1 /* AbiWord 2 * Copyright (C) 1998 AbiSource, Inc. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 17 * 02110-1301 USA. 18 */ 19 20 21 #ifndef PF_FRAG_TEXT_H 22 #define PF_FRAG_TEXT_H 23 24 #include "ut_types.h" 25 #include "pt_Types.h" 26 #include "pf_Frag.h" 27 #include <string> 28 29 /*! 30 pf_Frag_Text represents a fragment of text in the document. 31 Note that it does not contain a PT_DocPosition -- the fragment 32 does not know where it is in the document; it only knows its 33 buffer position. 34 */ 35 36 class ABI_EXPORT pf_Frag_Text : public pf_Frag 37 { 38 public: 39 pf_Frag_Text(pt_PieceTable * pPT, 40 PT_BufIndex bufIndex, 41 UT_uint32 length, 42 PT_AttrPropIndex indexAP, 43 fd_Field * m_pField); 44 virtual ~pf_Frag_Text(); 45 46 virtual bool createSpecialChangeRecord(PX_ChangeRecord ** ppcr, 47 PT_DocPosition dpos, 48 PT_BlockOffset blockOffset) const; 49 virtual bool createSpecialChangeRecord(PX_ChangeRecord ** ppcr, 50 PT_DocPosition dpos, 51 PT_BlockOffset blockOffset, 52 PT_BlockOffset startFragOffset, 53 PT_BlockOffset endFragOffset) const; getBufIndex(void)54 inline PT_BufIndex getBufIndex(void) const 55 { 56 return m_bufIndex; 57 } 58 59 void changeLength(UT_uint32 newLength); 60 void adjustOffsetLength(PT_BufIndex bi, UT_uint32 newLength); 61 void setField(fd_Field * pField); 62 usesXID()63 virtual bool usesXID() const {return false;} 64 65 #ifdef PT_TEST 66 virtual void __dump(FILE * fp) const; 67 #endif 68 69 std::string toString() const; 70 71 protected: 72 virtual bool _isContentEqual(const pf_Frag & f2) const; 73 PT_BufIndex m_bufIndex; 74 }; 75 76 #endif /* PF_FRAG_TEXT_H */ 77