00001 /* AbiWord 00002 * Copyright (C) 1998 AbiSource, Inc. 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 * 02110-1301 USA. 00018 */ 00019 00020 00021 #ifndef PX_CHANGERECORD_SPAN_H 00022 #define PX_CHANGERECORD_SPAN_H 00023 00024 #include "ut_types.h" 00025 #include "px_ChangeRecord.h" 00026 00027 class fd_Field; 00028 00029 // PX_ChangeRecord_Span describes an insertSpan or 00030 // deleteSpan change made to the document. 00031 // This description should be sufficient to allow undo to 00032 // work and sufficient to allow the formatter to do a 00033 // partial format and screen update (if appropriate). 00034 // The change record must be free of pointers, since it 00035 // represents what was done to the document -- and not 00036 // how it was done (that is, not what was done to various 00037 // intermediate data structures). this also lets it be 00038 // cached to disk (for autosave and maybe multi-session 00039 // undo). 00040 // 00041 // m_position contains the absolute document position of 00042 // the text span at the time the change was made. 00043 // m_bufIndex,m_length describe the actual contents 00044 // of the text span. 00045 00046 00047 class ABI_EXPORT PX_ChangeRecord_Span : public PX_ChangeRecord 00048 { 00049 public: 00050 PX_ChangeRecord_Span(PXType type, 00051 PT_DocPosition position, 00052 PT_AttrPropIndex indexAP, 00053 PT_BufIndex bufIndex, 00054 UT_uint32 length, 00055 PT_BlockOffset blockOffset, 00056 fd_Field * pField); 00057 00058 ~PX_ChangeRecord_Span(); 00059 00060 virtual PX_ChangeRecord * reverse(void) const; 00061 00062 UT_uint32 getLength(void) const; 00063 PT_BufIndex getBufIndex(void) const; 00064 void coalesce(const PX_ChangeRecord_Span * pcr); 00065 PT_BlockOffset getBlockOffset(void) const; 00066 fd_Field * getField(void) const {return m_pField;}; 00067 void AdjustBlockOffset(PT_BlockOffset iBlk) const 00068 { m_blockOffset = iBlk;} 00069 00070 #ifdef PT_TEST 00071 virtual void __dump(FILE * fp) const; 00072 #endif 00073 00074 protected: 00075 PT_BufIndex m_bufIndex; /* bufIndex to our text */ 00076 UT_uint32 m_length; /* length of our text */ 00077 mutable PT_BlockOffset m_blockOffset; /* offset of span from beginning of paragraph */ 00078 fd_Field * m_pField; 00079 }; 00080 00081 #endif /* PX_CHANGERECORD_SPAN_H */