1 /************************************************************************/ 2 /* */ 3 /* Control words in Read/Write RTF files. */ 4 /* */ 5 /************************************************************************/ 6 7 # ifndef DOC_RTF_CONTROL_WORD_H 8 # define DOC_RTF_CONTROL_WORD_H 9 10 /************************************************************************/ 11 /* */ 12 /* Map control words to functions that handle them. */ 13 /* */ 14 /* This structure will be gradually extended to also cover the */ 15 /* Microsoft WordProcessingML markup language. */ 16 /* */ 17 /************************************************************************/ 18 19 struct RtfControlWord; 20 struct RtfReader; 21 22 typedef int (*RtfApplyWord)( const struct RtfControlWord * rcw, 23 int arg, 24 struct RtfReader * rr ); 25 26 typedef int (*RtfCommitGroup)( const struct RtfControlWord * rcw, 27 struct RtfReader * rr ); 28 29 typedef enum RtfControlType 30 { 31 RTCtypeANY= 0, 32 RTCtypeTOGGLE, 33 RTCtypeDEST, 34 RTCtypeSYMBOL, 35 RTCtypeVALUE, 36 RTCtypeFLAG, 37 RTCtypeENUM, 38 39 RTCtype_COUNT 40 } RtfControlType; 41 42 typedef struct RtfControlWord 43 { 44 const char * rcwWord; 45 int rcwID; 46 unsigned char rcwType; 47 /* 48 * Routine to apply the countrol word. 49 */ 50 RtfApplyWord rcwApply; 51 /* 52 * Integer value that is the implicit argument to 53 * the control word. 54 */ 55 int rcwEnumValue; 56 /* 57 * Routine to prepare for this word. It is used 58 * in combination with de detail words for borders. 59 */ 60 RtfApplyWord rcwPrepare; 61 /* 62 * Method to handle text inside a group for this 63 * control word. 64 */ 65 RtfCommitGroup rwcCommitGroup; 66 67 /* 68 * A terminated array of control words that 69 * follow the control word to give additional 70 * details. (Used for borders) 71 */ 72 struct RtfControlWord * rcwDetailWords; 73 } RtfControlWord; 74 75 # define TEDszRTFCONTROL 32 76 77 /************************************************************************/ 78 /* */ 79 /* Shortcut macros for defining control words. */ 80 /* */ 81 /************************************************************************/ 82 83 # define RTF_DEST_CO( s, id, ap, co ) \ 84 { s, id, RTCtypeDEST, ap, 0, (RtfApplyWord)0, co } 85 # define RTF_DEST_XX( s, id, ap ) \ 86 { s, id, RTCtypeDEST, ap, 0, (RtfApplyWord)0, (RtfCommitGroup)0 } 87 88 /************************************************************************/ 89 /* */ 90 /* Routine declarations. */ 91 /* */ 92 /************************************************************************/ 93 94 # endif /* DOC_RTF_CONTROL_WORD_H */ 95