00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef IE_IMP_RTF_H
00025 #define IE_IMP_RTF_H
00026
00027 #include <stdio.h>
00028 #include "ie_imp.h"
00029 #include "ut_bytebuf.h"
00030 #include "ut_growbuf.h"
00031 #include "ut_vector.h"
00032 #include "ut_stack.h"
00033 #include "pt_Types.h"
00034 #include "pd_Document.h"
00035 #include "pp_Revision.h"
00036 #include "ut_mbtowc.h"
00037 #include "fl_AutoLists.h"
00038 #include "fl_AutoNum.h"
00039 #include "fl_BlockLayout.h"
00040 #include "ie_Table.h"
00041 #include "ie_imp_RTFParse.h"
00042
00043 class IE_Imp_RTF;
00044 class RTF_msword97_list;
00045 class ie_imp_cell;
00046 class ie_imp_table;
00047 class ie_imp_table_control;
00048 class RTFProps_FrameProps;
00049
00050
00051
00052 struct ABI_EXPORT RTFFontTableItem
00053 {
00054 public:
00055 enum FontFamilyEnum { ffNone, ffRoman, ffSwiss, ffModern, ffScript, ffDecorative, ffTechnical, ffBiDirectional};
00056 enum FontPitch { fpDefault, fpFixed, fpVariable};
00057
00058 RTFFontTableItem(FontFamilyEnum fontFamily, int charSet, int codepage, FontPitch pitch,
00059 const char* panose, const char* pFontName, const char* pAlternativeFontName);
00060 ~RTFFontTableItem();
00061
00062 FontFamilyEnum m_family;
00063 int m_charSet;
00064 int m_codepage;
00065 const char* m_szEncoding;
00066 FontPitch m_pitch;
00067 unsigned char m_panose[10];
00068 char* m_pFontName;
00069 char* m_pAlternativeFontName;
00070 };
00071
00072
00073 class ABI_EXPORT RTFProps_CharProps
00074 {
00075 public:
00076 RTFProps_CharProps(void);
00077 ~RTFProps_CharProps(void);
00078 bool m_deleted;
00079 bool m_bold;
00080 bool m_italic;
00081 bool m_underline;
00082 bool m_overline;
00083 bool m_strikeout;
00084 bool m_topline;
00085 bool m_botline;
00086 bool m_superscript;
00087 double m_superscript_pos;
00088 bool m_subscript;
00089 double m_subscript_pos;
00090 double m_fontSize;
00091 UT_uint32 m_fontNumber;
00092 bool m_hasColour;
00093 UT_uint32 m_colourNumber;
00094 bool m_hasBgColour;
00095 UT_uint32 m_bgcolourNumber;
00096 UT_sint32 m_styleNumber ;
00097 UT_uint32 m_listTag;
00098 const char * m_szLang;
00099 UT_BidiCharType m_dir;
00100 UT_BidiCharType m_dirOverride;
00101 bool m_Hidden;
00102 PP_RevisionType m_eRevision;
00103 UT_uint32 m_iCurrentRevisionId;
00104 };
00105
00106 class ABI_EXPORT RTFProps_bCharProps
00107 {
00108 public:
00109 RTFProps_bCharProps(void);
00110 ~RTFProps_bCharProps(void);
00111
00112 bool bm_deleted;
00113 bool bm_bold;
00114 bool bm_italic;
00115 bool bm_underline;
00116 bool bm_overline;
00117 bool bm_strikeout;
00118 bool bm_topline;
00119 bool bm_botline;
00120 bool bm_superscript;
00121 bool bm_superscript_pos;
00122 bool bm_subscript;
00123 bool bm_subscript_pos;
00124 bool bm_fontSize;
00125 bool bm_fontNumber;
00126 bool bm_hasColour;
00127 bool bm_colourNumber;
00128 bool bm_hasBgColour;
00129 bool bm_bgcolourNumber;
00130 bool bm_listTag;
00131 bool bm_RTL;
00132 bool bm_dirOverride;
00133 bool bm_Hidden;
00134 };
00135
00136 struct ABI_EXPORT _rtfListTable
00137 {
00138 UT_uint32 start_value;
00139 UT_uint32 level;
00140 bool bullet;
00141 bool simple;
00142 bool continueList;
00143 bool hangingIndent;
00144 FL_ListType type;
00145 bool bold;
00146 bool italic;
00147 bool caps;
00148 bool scaps;
00149 bool underline;
00150 bool nounderline;
00151 bool strike;
00152 bool isList;
00153 UT_uint32 forecolor;
00154 UT_uint32 font;
00155 UT_uint32 fontsize;
00156 UT_uint32 indent;
00157 bool prevlist;
00158 char textbefore[129];
00159 char textafter[129];
00160 UT_uint32 iWord97Override;
00161 UT_uint32 iWord97Level;
00162 };
00163
00164 enum rtfCellBorder
00165 {
00166 rtfCellBorderTop,
00167 rtfCellBorderLeft,
00168 rtfCellBorderRight,
00169 rtfCellBorderBot
00170 };
00171
00172 struct ABI_EXPORT RTFProps_CellProps
00173 {
00174 RTFProps_CellProps();
00175 RTFProps_CellProps & operator=(const RTFProps_CellProps&);
00176 bool m_bVerticalMerged;
00177 bool m_bVerticalMergedFirst;
00178 bool m_bHorizontalMerged;
00179 bool m_bHorizontalMergedFirst;
00180 UT_String m_sCellProps;
00181 rtfCellBorder m_iCurBorder;
00182 bool m_bLeftBorder;
00183 bool m_bRightBorder;
00184 bool m_bTopBorder;
00185 bool m_bBotBorder;
00186 UT_sint32 m_iCellx;
00187 };
00188
00189 struct ABI_EXPORT RTFProps_TableProps
00190 {
00191 RTFProps_TableProps();
00192 RTFProps_TableProps& operator=(const RTFProps_TableProps&);
00193 bool m_bAutoFit;
00194 };
00195
00196
00197 struct ABI_EXPORT RTFProps_ParaProps
00198 {
00199 enum ParaJustification { pjLeft, pjCentre, pjRight, pjFull};
00200
00201 RTFProps_ParaProps();
00202 RTFProps_ParaProps& operator=(const RTFProps_ParaProps&);
00203
00204 ParaJustification m_justification;
00205 UT_uint32 m_spaceBefore;
00206 UT_uint32 m_spaceAfter;
00207 UT_sint32 m_indentLeft;
00208 UT_sint32 m_indentRight;
00209 UT_sint32 m_indentFirst;
00210 double m_lineSpaceVal;
00211 bool m_lineSpaceExact;
00212 UT_NumberVector m_tabStops;
00213 UT_NumberVector m_tabTypes;
00214 UT_NumberVector m_tabLeader;
00215 bool m_isList;
00216 UT_sint32 m_level;
00217 char m_pszStyle[30];
00218 UT_uint32 m_rawID;
00219 UT_uint32 m_rawParentID;
00220 char m_pszListDecimal[64];
00221 char m_pszListDelim[64];
00222 char m_pszFieldFont[64];
00223 UT_uint32 m_startValue;
00224 eTabType m_curTabType;
00225 eTabLeader m_curTabLeader;
00226 UT_uint32 m_iOverride;
00227 UT_uint32 m_iOverrideLevel;
00228 _rtfListTable m_rtfListTable;
00229 UT_sint32 m_styleNumber ;
00230 UT_BidiCharType m_dir;
00231 UT_sint32 m_tableLevel;
00232 bool m_bInTable;
00233 PP_RevisionType m_eRevision;
00234 UT_uint32 m_iCurrentRevisionId;
00235 };
00236
00237
00238 class ABI_EXPORT RTFProps_bParaProps
00239 {
00240 public:
00241 RTFProps_bParaProps(void);
00242 ~RTFProps_bParaProps(void);
00243
00244 bool bm_justification;
00245 bool bm_spaceBefore;
00246 bool bm_spaceAfter;
00247 bool bm_indentLeft;
00248 bool bm_indentRight;
00249 bool bm_indentFirst;
00250 bool bm_lineSpaceVal;
00251 bool bm_lineSpaceExact;
00252 bool bm_tabStops;
00253 bool bm_tabTypes;
00254 bool bm_tabLeader;
00255 bool bm_curTabType;
00256 bool bm_curTabLeader;
00257 bool bm_rtfListTable;
00258 bool bm_dom_dir;
00259 };
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273 class ABI_EXPORT RTF_msword97_level
00274 {
00275 public:
00276 RTF_msword97_level( RTF_msword97_list * pmsword97List, UT_uint32 level);
00277 ~RTF_msword97_level();
00278 void buildAbiListProperties( const char ** szListID,
00279 const char ** szParentID,
00280 const char ** szLevel,
00281 const char ** szStartat,
00282 const char ** szFieldFont,
00283 const char ** szListDelim,
00284 const char ** szListDecimal,
00285 const char ** szAlign,
00286 const char ** szIndent,
00287 const char ** szListStyle);
00288 bool ParseLevelText(const UT_String & szLevelText,const UT_String & szLevelNumbers, UT_uint32 iLevel);
00289 UT_sint32 m_levelStartAt;
00290 UT_uint32 m_AbiLevelID;
00291 static UT_uint32 m_sPreviousLevel;
00292 UT_uint32 m_RTFListType;
00293 UT_String m_listDelim;
00294 char m_cLevelFollow;
00295 bool m_bStartNewList;
00296 bool m_bRestart;
00297 RTFProps_ParaProps * m_pParaProps;
00298 RTFProps_CharProps * m_pCharProps;
00299 RTFProps_bParaProps * m_pbParaProps;
00300 RTFProps_bCharProps * m_pbCharProps;
00301 private:
00302 UT_uint32 m_localLevel;
00303 RTF_msword97_list * m_pMSWord97_list ;
00304 };
00305
00306
00307 class ABI_EXPORT RTF_msword97_list
00308 {
00309 public:
00310 RTF_msword97_list( IE_Imp_RTF * pie_rtf);
00311 ~RTF_msword97_list();
00312 UT_uint32 m_RTF_listID;
00313 UT_uint32 m_RTF_listTemplateID;
00314 RTF_msword97_level * m_RTF_level[9];
00315 IE_Imp_RTF * m_pie_rtf;
00316 };
00317
00318
00319 class ABI_EXPORT RTF_msword97_listOverride
00320 {
00321 public:
00322 RTF_msword97_listOverride( IE_Imp_RTF * pie_rtf);
00323 ~RTF_msword97_listOverride();
00324 void buildAbiListProperties( const char ** szListID,
00325 const char ** szParentID,
00326 const char ** szLevel,
00327 const char ** szStartat,
00328 const char ** szFieldFont,
00329 const char ** szListDelim,
00330 const char ** szListDecimal,
00331 const char ** szAlign,
00332 const char ** szIndent,
00333 const char ** szListStyle,
00334 UT_uint32 iLevel);
00335 UT_uint32 m_RTF_listID;
00336 UT_uint32 m_OverrideCount;
00337 RTFProps_ParaProps * m_pParaProps;
00338 RTFProps_CharProps * m_pCharProps;
00339 RTFProps_bParaProps * m_pbParaProps;
00340 RTFProps_bCharProps * m_pbCharProps;
00341 bool setList(void);
00342 bool isTab(UT_uint32 iLevel);
00343 UT_NumberVector * getTabStopVect(UT_uint32 iLevel);
00344 UT_NumberVector * getTabTypeVect(UT_uint32 iLevel);
00345 UT_NumberVector * getTabLeaderVect(UT_uint32 iLevel);
00346 bool isDeletedChanged(UT_uint32 iLevel);
00347 bool getDeleted(UT_uint32 iLevel);
00348 bool isBoldChanged(UT_uint32 iLevel);
00349 bool getBold(UT_uint32 iLevel);
00350 bool isItalicChanged(UT_uint32 iLevel);
00351 bool getItalic(UT_uint32 iLevel);
00352 bool isUnderlineChanged(UT_uint32 iLevel);
00353 bool getUnderline(UT_uint32 iLevel);
00354 bool isStrikeoutChanged(UT_uint32 iLevel);
00355 bool getStrikeout(UT_uint32 iLevel);
00356 bool isSuperscriptChanged(UT_uint32 iLevel);
00357 bool getSuperscript(UT_uint32 iLevel);
00358 bool isSuperscriptPosChanged(UT_uint32 iLevel);
00359 double getSuperscriptPos(UT_uint32 iLevel);
00360 bool isSubscriptChanged(UT_uint32 iLevel);
00361 bool getSubscript(UT_uint32 iLevel);
00362 bool isSubscriptPosChanged(UT_uint32 iLevel);
00363 double getSubscriptPos(UT_uint32 iLevel);
00364 bool isFontSizeChanged(UT_uint32 iLevel);
00365 double getFontSize(UT_uint32 iLevel);
00366 bool isHasColourChanged(UT_uint32 iLevel);
00367 bool getHasColour(UT_uint32 iLevel);
00368 bool isColourNumberChanged(UT_uint32 iLevel);
00369 UT_uint32 getColourNumber(UT_uint32 iLevel);
00370 bool isHasBgColourChanged(UT_uint32 iLevel);
00371 bool getHasBgColour(UT_uint32 iLevel);
00372 bool isBgColourNumberChanged(UT_uint32 iLevel);
00373 UT_uint32 getBgColourNumber(UT_uint32 iLevel);
00374 bool isFontNumberChanged(UT_uint32 iLevel);
00375 UT_uint32 getFontNumber(UT_uint32 iLevel);
00376
00377 private:
00378 IE_Imp_RTF * m_pie_rtf;
00379 RTF_msword97_list* m_pList;
00380 };
00381
00382 struct ABI_EXPORT RTFProps_ImageProps
00383 {
00384 enum IPSizeType { ipstNone, ipstGoal, ipstScale };
00385
00386 RTFProps_ImageProps ();
00387 IPSizeType sizeType;
00388 UT_uint16 wGoal;
00389 UT_uint16 hGoal;
00390 UT_uint16 scaleX;
00391 UT_uint16 scaleY;
00392 UT_uint32 width;
00393 UT_uint32 height;
00394 bool bCrop;
00395 UT_sint32 cropt;
00396 UT_sint32 cropb;
00397 UT_sint32 cropl;
00398 UT_sint32 cropr;
00399 };
00400
00401
00402 struct ABI_EXPORT RTFProps_SectionProps
00403 {
00404 enum ESectionBreak {sbkNone, sbkColumn, sbkEven, sbkOdd, sbkPage};
00405 enum EPageNumber {pgDecimal, pgURoman, pgLRoman, pgULtr, pgLLtr};
00406
00407 RTFProps_SectionProps();
00408
00409 UT_uint32 m_numCols;
00410 bool m_bColumnLine;
00411 ESectionBreak m_breakType;
00412 EPageNumber m_pageNumFormat;
00413 UT_sint32 m_leftMargTwips;
00414 UT_sint32 m_rightMargTwips;
00415 UT_sint32 m_topMargTwips;
00416 UT_sint32 m_bottomMargTwips;
00417 UT_sint32 m_headerYTwips;
00418 UT_sint32 m_footerYTwips;
00419 UT_sint32 m_gutterTwips;
00420 UT_sint32 m_colSpaceTwips;
00421 UT_BidiCharType m_dir;
00422 };
00423
00424
00431 struct ABI_EXPORT RTFHdrFtr
00432 {
00433 enum HdrFtrType {hftNone,
00434 hftHeader,
00435 hftHeaderEven,
00436 hftHeaderFirst,
00437 hftHeaderLast,
00438 hftFooter,
00439 hftFooterEven,
00440 hftFooterFirst,
00441 hftFooterLast };
00442
00443 RTFHdrFtr () : m_type(hftNone), m_id(0), m_buf(1024) {}
00444
00445 HdrFtrType m_type;
00446 UT_uint32 m_id;
00447 UT_ByteBuf m_buf;
00448 };
00449
00450
00451 struct ABI_EXPORT RTFStateStore
00452 {
00453 RTFStateStore();
00454 RTFStateStore * clone();
00455
00456
00457 enum DestinationStateTypes { rdsNorm, rdsSkip, rdsFootnote, rdsHeader, rdsFooter, rdsField };
00458 enum InternalStateTypes { risNorm, risBin, risHex };
00459
00460 DestinationStateTypes m_destinationState;
00461 InternalStateTypes m_internalState;
00462 RTFProps_CharProps m_charProps;
00463 RTFProps_ParaProps m_paraProps;
00464 RTFProps_SectionProps m_sectionProps;
00465 RTFProps_CellProps m_cellProps;
00466 RTFProps_TableProps m_tableProps;
00467 UT_uint32 m_unicodeAlternateSkipCount;
00468 UT_uint32 m_unicodeInAlternate;
00469 UT_UTF8String m_revAttr;
00470 bool m_bInKeywordStar;
00471 };
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493 class ABI_EXPORT ABI_Paste_Table
00494 {
00495 public:
00496 ABI_Paste_Table(void);
00497 virtual ~ABI_Paste_Table(void);
00498 bool m_bHasPastedTableStrux;
00499 bool m_bHasPastedCellStrux;
00500 UT_sint32 m_iRowNumberAtPaste;
00501 bool m_bHasPastedBlockStrux;
00502 UT_sint32 m_iMaxRightCell;
00503 UT_sint32 m_iCurRightCell;
00504 UT_sint32 m_iCurTopCell;
00505 bool m_bPasteAfterRow;
00506 UT_sint32 m_iPrevPasteTop;
00507 UT_sint32 m_iNumRows;
00508 };
00509
00510
00511
00512
00513 class ABI_EXPORT ABI_RTF_Annotation
00514 {
00515 public:
00516 ABI_RTF_Annotation();
00517 virtual ~ABI_RTF_Annotation() {}
00518 UT_sint32 m_iAnnNumber;
00519 UT_UTF8String m_sAuthor;
00520 UT_UTF8String m_sDate;
00521 UT_UTF8String m_sTitle;
00522 pf_Frag * m_pInsertFrag;
00523 PT_DocPosition m_Annpos;
00524 UT_sint32 m_iRTFLevel;
00525 };
00526
00527
00528
00529 class ABI_EXPORT IE_Imp_RTF_Sniffer : public IE_ImpSniffer
00530 {
00531 friend class IE_Imp;
00532
00533 public:
00534 IE_Imp_RTF_Sniffer();
00535 virtual ~IE_Imp_RTF_Sniffer() {}
00536
00537 virtual const IE_SuffixConfidence * getSuffixConfidence ();
00538 virtual const IE_MimeConfidence * getMimeConfidence ();
00539 virtual UT_Confidence_t recognizeContents (const char * szBuf,
00540 UT_uint32 iNumbytes);
00541 virtual bool getDlgLabels (const char ** szDesc,
00542 const char ** szSuffixList,
00543 IEFileType * ft);
00544 virtual UT_Error constructImporter (PD_Document * pDocument,
00545 IE_Imp ** ppie);
00546
00547 };
00548
00549 class ABI_EXPORT IE_Imp_RTF : public IE_Imp
00550 {
00551 public:
00552 IE_Imp_RTF(PD_Document * pDocument);
00553 ~IE_Imp_RTF();
00554
00555 virtual bool supportsLoadStylesOnly() {return true;}
00556 virtual bool pasteFromBuffer(PD_DocumentRange * pDocRange,
00557 const unsigned char * pData,
00558 UT_uint32 lenData,
00559 const char * szEncoding = 0);
00560 UT_sint32 get_vecWord97ListsCount(void)
00561 { return m_vecWord97Lists.getItemCount();}
00562 RTF_msword97_list * get_vecWord97NthList(UT_sint32 i)
00563 { return m_vecWord97Lists.getNthItem(i);}
00564 bool isWord97Lists(void) const
00565 { return (m_vecWord97Lists.getItemCount() > 0);}
00566
00567 enum PictFormat {
00568 picNone,
00569 picPNG,
00570 picJPEG,
00571 picBMP,
00572 picWMF,
00573 picPICT,
00574 picEMF,
00575 picGIF
00576 };
00577
00578 protected:
00579 virtual UT_Error _loadFile(GsfInput * input);
00580 UT_Error _parseFile(GsfInput * fp);
00581 UT_Error _writeHeader(GsfInput * fp);
00582 UT_Error _parseHdrFtr ();
00583 UT_Error _parseText();
00584
00585
00586
00587 private:
00588
00589
00590 typedef enum {
00591 RBT_START = 0,
00592 RBT_END
00593 } RTFBookmarkType;
00594
00595 bool AddChar(UT_UCSChar ch);
00596 public:
00597 bool FlushStoredChars(bool forceInsertPara = false);
00598 private:
00599 bool StartNewPara();
00600 bool HandleParKeyword();
00601 bool StartNewSection();
00602 public:
00603 bool PushRTFState();
00604 bool PopRTFState();
00605 bool ParseChar(UT_UCSChar ch,bool no_convert=1);
00606 void setStruxImage(bool b)
00607 { m_bStruxImage = b;}
00608 bool isStruxImage(void) const
00609 { return m_bStruxImage;}
00610 private:
00611 bool ParseRTFKeyword();
00612 bool ReadCharFromFileWithCRLF(unsigned char* pCh);
00613 bool ReadCharFromFile(unsigned char* pCh);
00614 bool ReadContentFromFile(UT_UTF8String & str);
00615 UT_UCS4Char ReadHexChar(void);
00616 bool SkipBackChar(unsigned char ch);
00617 bool ReadKeyword(unsigned char* pKeyword, UT_sint32* pParam,
00618 bool* pParamUsed,
00619 UT_uint32 keywordBuffLen);
00620 bool TranslateKeyword(unsigned char* pKeyword, UT_sint32 param,
00621 bool fParam);
00622 public:
00623 bool TranslateKeywordID(RTF_KEYWORD_ID keywordID,
00624 UT_sint32 param, bool fParam);
00625 bool insertStrux(PTStruxType pts , const gchar ** attrs=NULL, const gchar ** props=NULL);
00626
00627
00628 bool StandardKeywordParser(IE_Imp_RTFGroupParser *parser);
00629 private:
00630 RTF_KEYWORD_ID KeywordToID(const char * keyword);
00631
00632 bool HandleStarKeyword();
00633
00634 bool HandlePCData(UT_UTF8String & str);
00635
00636 bool ReadColourTable();
00637 bool ReadFontTable();
00638 bool RegisterFont(RTFFontTableItem::FontFamilyEnum fontFamily,
00639 RTFFontTableItem::FontPitch pitch,
00640 UT_uint16 fontIndex,
00641 int charSet, int codepage,
00642 UT_UTF8String sFontNames[]);
00643 bool PostProcessAndValidatePanose(UT_UTF8String &Panose);
00644 bool ReadRevisionTable();
00645 void setEncoding();
00646 public:
00647 bool HandlePicture();
00648 void clearImageName(void)
00649 { m_sImageName.clear();}
00650
00651 private:
00652 bool HandleObject();
00653 bool HandleField();
00654 bool HandleStyleDefinition(void);
00655 bool HandleHeaderFooter(RTFHdrFtr::HdrFtrType hftype, UT_uint32 & headerID);
00656 public:
00657 bool SkipCurrentGroup(bool bConsumeLastBrace = false);
00658 private:
00659 bool StuffCurrentGroup(UT_ByteBuf & buf);
00660 bool LoadPictData(PictFormat format, const char * image_name,
00661 struct RTFProps_ImageProps & imgProps,
00662 bool isBinary = false, long binaryLen = 0);
00663 bool InsertImage (const UT_ByteBuf * buf, const char * image_name,
00664 const struct RTFProps_ImageProps & imgProps);
00665
00666 RTFFontTableItem* GetNthTableFont(UT_uint32 fontNum);
00667 UT_uint32 GetNthTableColour(UT_uint32 colNum);
00668 UT_sint32 GetNthTableBgColour(UT_uint32 colNum);
00669
00670
00671 bool ReadListTable(void);
00672 bool HandleListLevel(RTF_msword97_list * pList, UT_uint32 levelCount );
00673 bool HandleTableList(void);
00674 char * getCharsInsideBrace(void);
00675 bool ParseCharParaProps(unsigned char * pKeyword,
00676 UT_sint32 param, bool fParam,
00677 RTFProps_CharProps * pChars,
00678 RTFProps_ParaProps * pParas,
00679 RTFProps_bCharProps * pbChars,
00680 RTFProps_bParaProps * pbParas);
00681 bool ReadListOverrideTable(void);
00682 bool HandleTableListOverride(void);
00683
00684 bool buildAllProps( UT_String & s, RTFProps_ParaProps * pParas,
00685 RTFProps_CharProps * pChars,
00686 RTFProps_bParaProps * pbParas,
00687 RTFProps_bCharProps * pbChars);
00688
00689
00690
00691 bool ResetCharacterAttributes();
00692 bool buildCharacterProps(UT_String & propBuffer);
00693 bool ApplyCharacterAttributes();
00694 bool HandleBoolCharacterProp(bool state, bool* pProp);
00695 bool HandleDeleted(bool state);
00696 bool HandleBold(bool state);
00697 bool HandleItalic(bool state);
00698 bool HandleHidden(bool state);
00699 bool HandleUnderline(bool state);
00700 bool HandleOverline(bool state);
00701 bool HandleStrikeout(bool state);
00702 bool HandleTopline(bool state);
00703 bool HandleBotline(bool state);
00704 bool HandleSuperscript(bool state);
00705 bool HandleSuperscriptPosition(UT_uint32 pos);
00706 bool HandleSubscript(bool state);
00707 bool HandleSubscriptPosition(UT_uint32 pos);
00708 bool HandleFontSize(long sizeInHalfPoints);
00709 bool HandleBookmark (RTFBookmarkType type);
00710 bool HandleListTag(long id);
00711
00712 bool HandleRevisedText(PP_RevisionType eType, UT_uint32 iId);
00713 bool HandleRevisedTextTimestamp(UT_uint32 iDttm);
00714
00715
00716 bool HandleFloatCharacterProp(double val, double* pProp);
00717 bool HandleU32CharacterProp(UT_uint32 val, UT_uint32* pProp);
00718 bool HandleFace(UT_uint32 fontNumber);
00719 bool HandleColour(UT_uint32 colourNumber);
00720 bool HandleBackgroundColour (UT_uint32 colourNumber);
00721
00722
00723 bool ResetParagraphAttributes();
00724 bool ApplyParagraphAttributes(bool bDontInsert = false);
00725 bool SetParaJustification(RTFProps_ParaProps::ParaJustification just);
00726 bool AddTabstop(UT_sint32 stopDist, eTabType tabType, eTabLeader tableader);
00727 bool AddTabstop(UT_sint32 stopDist, eTabType tabType,
00728 eTabLeader tabLeader, RTFProps_ParaProps * pParas);
00729
00730
00731
00732 public:
00733 bool HandleAbiTable(void);
00734 bool HandleAbiCell(void);
00735 bool HandleAbiEndTable(void);
00736 bool HandleAbiEndCell(void);
00737 bool HandleAbiLists(void);
00738 bool HandleAbiMathml(void);
00739 bool HandleAbiEmbed(void);
00740 bool isPastedTableOpen(void);
00741 bool markPasteBlock(void);
00742 bool isBlockNeededForPasteTable(void);
00743
00744 bool HandleLists(_rtfListTable & rtfListTable );
00745 UT_uint32 mapID(UT_uint32 id);
00746 UT_uint32 mapParentID(UT_uint32 id);
00747
00748
00749 bool ResetCellAttributes(void);
00750 bool ResetTableAttributes(void);
00751 ie_imp_table * getTable(void);
00752 ie_imp_cell * getCell(void);
00753 void FlushCellProps(void);
00754 void FlushTableProps(void);
00755 void OpenTable(bool bDontFlush = false);
00756 void CloseTable(bool bForceClose = false);
00757 void SaveRowInfo(void);
00758 void RemoveRowInfo(void);
00759 void HandleCell(void);
00760 void HandleCellX(UT_sint32 cellx);
00761 void HandleRow(void);
00762 UT_sint32 getPasteDepth(void);
00763 void closePastedTableIfNeeded(void);
00764
00765 private:
00766
00767 void HandleNote();
00768 void HandleAnnotation();
00769 void HandleNoteReference();
00770
00771 void HandleShape(void);
00772 void HandleShapePict(void);
00773
00774 public:
00775 void HandleShapeText(RTFProps_FrameProps & frame);
00776 void addFrame(RTFProps_FrameProps & frame);
00777 bool isFrameIn(void)
00778 { return m_bFrameStruxIn;}
00779
00780 bool bUseInsertNotAppend(void);
00781
00782 private:
00783
00784
00785 bool HandleInfoMetaData(void);
00786
00787 void _setStringProperty(UT_String & sPropString,
00788 const char * szProp, const char * szVal);
00789
00790
00791 bool ApplySectionAttributes();
00792 bool ResetSectionAttributes();
00793 typedef enum {
00794 RTF_TOKEN_NONE = 0,
00795 RTF_TOKEN_OPEN_BRACE,
00796 RTF_TOKEN_CLOSE_BRACE,
00797 RTF_TOKEN_KEYWORD,
00798 RTF_TOKEN_DATA,
00799 RTF_TOKEN_ERROR = -1
00800 } RTFTokenType;
00801 RTFTokenType NextToken (unsigned char *pKeyword, UT_sint32* pParam,
00802 bool* pParamUsed, UT_uint32 len,
00803 bool bIgnoreWhiteSpace = false);
00804
00805 UT_Error _isBidiDocument();
00806 bool _appendSpan();
00807 bool _insertSpan();
00808 void _formRevisionAttr(UT_String & s,UT_String & props, const gchar * style);
00809
00810
00811 private:
00812
00813 static bool digVal(char ch, int& value, int base);
00814 static bool hexVal(char c, int& value);
00815
00816
00817
00818 private:
00819
00820 static bool keywordSorted;
00821 static void _initialKeywordSort(void);
00822
00823 UT_GrowBuf m_gbBlock;
00824 char *m_szFileDirName;
00825
00826 int m_groupCount;
00827 bool m_newParaFlagged;
00828 bool m_newSectionFlagged;
00829 int m_cbBin;
00830
00831
00832
00833
00834
00835
00836 UT_uint32 m_currentHdrID;
00837 UT_uint32 m_currentFtrID;
00838 UT_uint32 m_currentHdrEvenID;
00839 UT_uint32 m_currentFtrEvenID;
00840 UT_uint32 m_currentHdrFirstID;
00841 UT_uint32 m_currentFtrFirstID;