00001 /* -*- c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- */ 00002 /* AbiWord 00003 * Copyright (C) 2004 Hubert Figuiere 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00018 * 02110-1301 USA. 00019 */ 00020 00021 00022 #ifndef _IE_IMP_RTFPARSE_H_ 00023 #define _IE_IMP_RTFPARSE_H_ 00024 00025 #define MAX_KEYWORD_LEN 256 00026 00027 class IE_Imp_RTF; 00028 00029 00030 typedef enum { 00031 CONTEXT_FRAME, 00032 CONTEXT_FONT_FORM_PROP, 00033 CONTEXT_STYLE_SHEET, 00034 NO_CONTEXT 00035 } RTF_CONTEXT; 00036 00037 #include "ie_imp_RTFKeywordIDs.h" 00038 00039 typedef struct { 00040 const char * keyword; 00041 bool hasParam; 00042 bool longParam; 00043 RTF_CONTEXT context; 00044 RTF_KEYWORD_ID id; 00045 } _rtf_keyword; 00046 00047 00048 00055 class ABI_EXPORT IE_Imp_RTFGroupParser 00056 { 00057 public: 00058 IE_Imp_RTFGroupParser() 00059 : m_nested(1) {} 00060 virtual ~IE_Imp_RTFGroupParser() 00061 { } 00063 virtual bool tokenError(IE_Imp_RTF * ie); 00065 virtual bool tokenKeyword(IE_Imp_RTF * ie, RTF_KEYWORD_ID kwID, 00066 UT_sint32 param, bool paramUsed); 00068 virtual bool tokenOpenBrace(IE_Imp_RTF * ie); 00070 virtual bool tokenCloseBrace(IE_Imp_RTF * ie); 00072 virtual bool tokenData(IE_Imp_RTF * ie, UT_UTF8String & data); 00073 00075 virtual bool finalizeParse(void); 00077 int nested(void) const 00078 { return m_nested; } 00079 protected: 00082 int m_nested; 00083 }; 00084 00085 #endif