1 # include "docBuf.h" 2 3 # ifndef DOC_RECALCULATE_FIELDS_H 4 # define DOC_RECALCULATE_FIELDS_H 5 6 # include "docBuf.h" 7 8 /************************************************************************/ 9 /* */ 10 /* Pass through information for recalculating fields. */ 11 /* */ 12 /* MERGEFIELDs and report generation. */ 13 /* */ 14 /************************************************************************/ 15 16 typedef int (*FieldDataProvider)( int * pCalculated, 17 MemoryBuffer * mbResult, 18 const char * fieldName, 19 void * through ); 20 21 typedef enum StreamPosition 22 { 23 StreamFirstInstance= 0, 24 StreamNextInstance, 25 StreamReady 26 } StreamPosition; 27 28 typedef int (*InstanceStreamProvider)( int * pCalculated, 29 const char * streamName, 30 int streamPosition, 31 void * through ); 32 33 /************************************************************************/ 34 /* */ 35 /* Pass through information for recalculating fields. */ 36 /* */ 37 /************************************************************************/ 38 39 typedef struct RecalculateFields 40 { 41 struct BufferDocument * rfDocument; 42 struct DocumentTree * rfTree; 43 struct DocumentTree * rfSelectedTree; 44 void * rfMergeValueTree; 45 DOC_CLOSE_OBJECT rfCloseObject; 46 unsigned int rfFieldsUpdated; 47 unsigned int rfUpdateFlags; 48 EditPosition rfSelHead; 49 EditPosition rfSelTail; 50 51 const struct BufferItem * rfBodySectNode; 52 int rfBodySectPage; 53 54 FieldDataProvider rfFieldDataProvider; 55 InstanceStreamProvider rfInstanceStreamProvider; 56 void * rfMergeThrough; 57 } RecalculateFields; 58 59 /************************************************************************/ 60 /* */ 61 /* Routine declarations. */ 62 /* */ 63 /************************************************************************/ 64 65 extern void docInitRecalculateFields( RecalculateFields * rf ); 66 67 extern void docRenumberNotes( int * pChanged, 68 BufferDocument * bd ); 69 70 extern int docRenumberSeqFields( int * pChanged, 71 DocumentTree * dt, 72 BufferDocument * bd ); 73 74 extern int docRenumberSeqField( int * pChanged, 75 DocumentField * df, 76 BufferDocument * bd ); 77 78 extern int docFieldReplaceContents( 79 int * pStroff, 80 int * pStroffShift, 81 int * pTextAttrNr, 82 struct BufferItem * paraBi, 83 int part, 84 int partCount, 85 int stroffShift, 86 const char * addedString, 87 int addedStrlen, 88 const RecalculateFields * rf ); 89 90 extern int docRecalculateTextLevelFields( RecalculateFields * rf, 91 struct BufferItem * bi ); 92 93 extern int docRecalculateTextLevelFieldsInDocumentTree( 94 RecalculateFields * rf, 95 DocumentTree * dt, 96 const struct BufferItem * sectBi, 97 int page ); 98 99 extern int docRecalculateFieldParticulesFromString( 100 int * pCalculated, 101 int * pPartShift, 102 int * pStroffShift, 103 struct BufferItem * paraBi, 104 int part, 105 int partCount, 106 const MemoryBuffer * mbResult, 107 const RecalculateFields * rf ); 108 109 # endif /* DOC_RECALCULATE_FIELDS_H */ 110