00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 #ifndef INC_TEXTFLTR
00103 #define INC_TEXTFLTR
00104
00105
00106
00107 #include "stack.h"
00108
00109
00110 #if BUILD_TEXT_FILTERS
00111
00112 class Page;
00113 class TextStory;
00114 class VisibleTextNode;
00115 class RTFTextFilter;
00116 class Pathname;
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127 class BaseTextFilter : public TextFilter
00128 {
00129 CC_DECLARE_DYNAMIC(BaseTextFilter);
00130
00131 public:
00132 BaseTextFilter();
00133 ~BaseTextFilter();
00134
00135
00136 protected:
00137 TextStory* CreateImportStory(DocCoord Pos);
00138 VisibleTextNode* AddCharToStory(TextStory* pStory, WCHAR NewChar);
00139 BOOL AddNewLineToStory(TextStory* pStory);
00140 BOOL AddTabToStory(TextStory* pStory, MILLIPOINT TabLength = 4000);
00141 };
00142
00143
00144 #if BUILD_OTHER_TEXT_FILTER
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155 class ANSITextFilter : public BaseTextFilter
00156 {
00157 CC_DECLARE_DYNAMIC(ANSITextFilter);
00158
00159 public:
00160 ANSITextFilter();
00161 ~ANSITextFilter();
00162 BOOL Init();
00163
00164
00165
00166 virtual BOOL IsDefaultDocRequired(const TCHAR* pcszPathName);
00167 INT32 HowCompatible(PathName& Filename, ADDR HeaderStart, UINT32 HeaderSize, UINT32 FileSize);
00168
00169 BOOL DoImport(SelOperation* Op, CCLexFile*, Document* DestDoc,
00170 BOOL AutoChosen, ImportPosition* Pos = NULL);
00171 BOOL DoExport(Operation*, CCLexFile*, PathName*, Document*);
00172
00173 protected:
00174 BOOL PrepareToImport();
00175 void CleanUpAfterImport();
00176 virtual BOOL DoInternalImport(TextStory* pImportStory, CCLexFile* pFile);
00177 virtual BOOL SkipHeader(CCLexFile* pFile);
00178 virtual WCHAR GetNextCharacter(CCLexFile* pFile);
00179
00180 UINT32 BytesReadSoFar;
00181 BOOL EscapeWasPressed;
00182 };
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195 class UnicodeTextFilter : public ANSITextFilter
00196 {
00197 CC_DECLARE_DYNAMIC(UnicodeTextFilter);
00198
00199 public:
00200 UnicodeTextFilter();
00201 ~UnicodeTextFilter();
00202 BOOL Init();
00203
00204 INT32 HowCompatible(PathName& Filename, ADDR HeaderStart, UINT32 HeaderSize, UINT32 FileSize);
00205
00206 protected:
00207 virtual BOOL SkipHeader(CCLexFile* pFile);
00208 virtual WCHAR GetNextCharacter(CCLexFile* pFile);
00209 };
00210
00211
00212
00213 typedef INT32 TWIP;
00214 const INT32 TwipToMillpoint = 1000/20;
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227 class RTFColourTable : public List
00228 {
00229 CC_DECLARE_DYNAMIC(RTFColourTable);
00230
00231 public:
00232 DocColour GetColourAt(INT32 TableIndex);
00233 };
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243 class RTFColourTableEntry : public ListItem
00244 {
00245 CC_DECLARE_DYNAMIC(RTFColourTableEntry);
00246
00247 public:
00248 DocColour Colour;
00249 };
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260 class RTFFontTable : public List
00261 {
00262 CC_DECLARE_DYNAMIC(RTFFontTable);
00263
00264 public:
00265 BOOL GetIndexedFont(INT32 TableIndex, String_64* FontName);
00266 };
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277 class RTFFontTableEntry : public ListItem
00278 {
00279 CC_DECLARE_DYNAMIC(RTFFontTableEntry);
00280
00281 public:
00282 enum FontFamilyType {FamNil = 0, FamRoman, FamSwiss, FamModern, FamScript, FamDecor, FamTech, FamBiDi};
00283
00284 RTFFontTableEntry();
00285 ~RTFFontTableEntry();
00286
00287 String_64 RealFontName;
00288 String_64 ApplyFontName;
00289 FontFamilyType FontFamily;
00290 INT32 CharacterSet;
00291 INT32 CodePage;
00292 INT32 FontIndex;
00293 };
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309 class RTFControlAction : public CC_CLASS_MEMDUMP
00310 {
00311 public:
00312 CC_DECLARE_MEMDUMP(RTFControlAction)
00313 RTFControlAction(RTFTextFilter* pFilt, INT32 Param);
00314
00315 virtual BOOL ExecuteControl() = 0;
00316
00317 protected:
00318 static BOOL ExecuteControlCarefully(RTFControlAction* pAction);
00319
00320 INT32 Parameter;
00321 RTFTextFilter* pFilter;
00322 };
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333 class RTFAttributeAction : public RTFControlAction
00334 {
00335 public:
00336 CC_DECLARE_MEMDUMP(RTFAttributeAction)
00337 RTFAttributeAction(RTFTextFilter* pFilt, INT32 Param);
00338 };
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349 class RTFEnterSkipDest : public RTFControlAction
00350 {
00351 public:
00352 CC_DECLARE_MEMDUMP(RTFEnterSkipDest)
00353 RTFEnterSkipDest(RTFTextFilter* pFilt);
00354
00355 static BOOL IsThisAction(StringBase* pControl);
00356 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
00357 BOOL ExecuteControl();
00358 };
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369 class RTFColourTableAction : public RTFControlAction
00370 {
00371 public:
00372 CC_DECLARE_MEMDUMP(RTFColourTableAction)
00373 RTFColourTableAction(RTFTextFilter* pFilt);
00374
00375 static BOOL IsThisAction(StringBase* pControl);
00376 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
00377 BOOL ExecuteControl();
00378 };
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388 class RTFFontTableAction : public RTFControlAction
00389 {
00390 public:
00391 CC_DECLARE_MEMDUMP(RTFFontTableAction)
00392 RTFFontTableAction(RTFTextFilter* pFilt);
00393
00394 static BOOL IsThisAction(StringBase* pControl);
00395 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
00396 BOOL ExecuteControl();
00397 };
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407 class RTFNewParaAction : public RTFControlAction
00408 {
00409 public:
00410 CC_DECLARE_MEMDUMP(RTFNewParaAction)
00411 RTFNewParaAction(RTFTextFilter* pFilt);
00412
00413 static BOOL IsThisAction(StringBase* pControl);
00414 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
00415
00416 BOOL ExecuteControl();
00417 };
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428 class RTFBoldAttribute : public RTFAttributeAction
00429 {
00430 public:
00431 CC_DECLARE_MEMDUMP(RTFBoldAttribute)
00432 RTFBoldAttribute(RTFTextFilter* pFilt, INT32 Param = 1);
00433
00434 static BOOL IsThisAction(StringBase* pControl);
00435 static BOOL CreateAndExecute(INT32 Param, BOOL UseParam, RTFTextFilter* pFilter);
00436 BOOL ExecuteControl();
00437 };
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448 class RTFItalicAttribute : public RTFAttributeAction
00449 {
00450 public:
00451 CC_DECLARE_MEMDUMP(RTFItalicAttribute)
00452 RTFItalicAttribute(RTFTextFilter* pFilt, INT32 Param = 1);
00453
00454 static BOOL IsThisAction(StringBase* pControl);
00455 static BOOL CreateAndExecute(INT32 Param, BOOL UseParam, RTFTextFilter* pFilter);
00456 BOOL ExecuteControl();
00457 };
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468 class RTFTextSizeAttribute : public RTFAttributeAction
00469 {
00470 public:
00471 CC_DECLARE_MEMDUMP(RTFTextSizeAttribute)
00472 RTFTextSizeAttribute(RTFTextFilter* pFilt, MILLIPOINT Param);
00473
00474 static BOOL IsThisAction(StringBase* pControl);
00475 static BOOL CreateAndExecute(TWIP Param, BOOL UseParam, RTFTextFilter* pFilter);
00476 BOOL ExecuteControl();
00477 };
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488 class RTFSuperscriptAttribute : public RTFAttributeAction
00489 {
00490 public:
00491 CC_DECLARE_MEMDUMP(RTFSuperscriptAttribute)
00492 RTFSuperscriptAttribute(RTFTextFilter* pFilt);
00493
00494 static BOOL IsThisAction(StringBase* pControl);
00495 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
00496 BOOL ExecuteControl();
00497 };
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508 class RTFSubscriptAttribute : public RTFAttributeAction
00509 {
00510 public:
00511 CC_DECLARE_MEMDUMP(RTFSubscriptAttribute)
00512 RTFSubscriptAttribute(RTFTextFilter* pFilt);
00513
00514 static BOOL IsThisAction(StringBase* pControl);
00515 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
00516 BOOL ExecuteControl();
00517 };
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527 class RTFNoscriptAttribute : public RTFAttributeAction
00528 {
00529 public:
00530 CC_DECLARE_MEMDUMP(RTFNoscriptAttribute)
00531 RTFNoscriptAttribute(RTFTextFilter* pFilt);
00532
00533 static BOOL IsThisAction(StringBase* pControl);
00534 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
00535 BOOL ExecuteControl();
00536 };
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546 class RTFTextColourAttribute : public RTFAttributeAction
00547 {
00548 public:
00549 CC_DECLARE_MEMDUMP(RTFTextColourAttribute)
00550 RTFTextColourAttribute(RTFTextFilter* pFilt, INT32 ColourNumber = 0);
00551
00552 static BOOL IsThisAction(StringBase* pControl);
00553 static BOOL CreateAndExecute(INT32 Param, BOOL UseParam, RTFTextFilter* pFilter);
00554 BOOL ExecuteControl();
00555 };
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565 class RTFTextFontAttribute : public RTFAttributeAction
00566 {
00567 public:
00568 CC_DECLARE_MEMDUMP(RTFTextFontAttribute)
00569 RTFTextFontAttribute(RTFTextFilter* pFilt, INT32 FontNumber = 0);
00570
00571 static BOOL IsThisAction(StringBase* pControl);
00572 static BOOL CreateAndExecute(INT32 Param, BOOL UseParam, RTFTextFilter* pFilter);
00573 BOOL ExecuteControl();
00574 };
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584 class RTFQPTrackingAttribute : public RTFAttributeAction
00585 {
00586 public:
00587 CC_DECLARE_MEMDUMP(RTFQPTrackingAttribute)
00588 RTFQPTrackingAttribute(RTFTextFilter* pFilt, INT32 Gap = 0);
00589
00590 static BOOL IsThisAction(StringBase* pControl);
00591 static BOOL CreateAndExecute(INT32 Param, BOOL UseParam, RTFTextFilter* pFilter);
00592 BOOL ExecuteControl();
00593 };
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604 class RTFTWIPTrackingAttribute : public RTFAttributeAction
00605 {
00606 public:
00607 CC_DECLARE_MEMDUMP(RTFTWIPTrackingAttribute)
00608 RTFTWIPTrackingAttribute(RTFTextFilter* pFilt, INT32 Gap = 0);
00609
00610 static BOOL IsThisAction(StringBase* pControl);
00611 static BOOL CreateAndExecute(TWIP Param, BOOL UseParam, RTFTextFilter* pFilter);
00612 BOOL ExecuteControl();
00613 };
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624 class RTFPaperWidth : public RTFControlAction
00625 {
00626 public:
00627 CC_DECLARE_MEMDUMP(RTFPaperWidth)
00628 RTFPaperWidth(RTFTextFilter* pFilt, MILLIPOINT Width);
00629
00630 static BOOL IsThisAction(StringBase* pControl);
00631 static BOOL CreateAndExecute(RTFTextFilter* pFilter, TWIP Width);
00632 BOOL ExecuteControl();
00633 };
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644 class RTFPaperHeight : public RTFControlAction
00645 {
00646 public:
00647 CC_DECLARE_MEMDUMP(RTFPaperHeight)
00648 RTFPaperHeight(RTFTextFilter* pFilt, MILLIPOINT Height);
00649
00650 static BOOL IsThisAction(StringBase* pControl);
00651 static BOOL CreateAndExecute(RTFTextFilter* pFilter, TWIP Height);
00652 BOOL ExecuteControl();
00653 };
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664 class RTFLeftMargin : public RTFControlAction
00665 {
00666 public:
00667 CC_DECLARE_MEMDUMP(RTFLeftMargin)
00668 RTFLeftMargin(RTFTextFilter* pFilt, MILLIPOINT LeftMargin);
00669
00670 static BOOL IsThisAction(StringBase* pControl);
00671 static BOOL CreateAndExecute(RTFTextFilter* pFilter, TWIP LeftMargin);
00672 BOOL ExecuteControl();
00673 };
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684 class RTFRightMargin : public RTFControlAction
00685 {
00686 public:
00687 CC_DECLARE_MEMDUMP(RTFRightMargin)
00688 RTFRightMargin(RTFTextFilter* pFilt, MILLIPOINT RightMargin);
00689
00690 static BOOL IsThisAction(StringBase* pControl);
00691 static BOOL CreateAndExecute(RTFTextFilter* pFilter, MILLIPOINT RightMargin);
00692 BOOL ExecuteControl();
00693 };
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704 class RTFTopMargin : public RTFControlAction
00705 {
00706 public:
00707 CC_DECLARE_MEMDUMP(RTFTopMargin)
00708 RTFTopMargin(RTFTextFilter* pFilt, MILLIPOINT TopMargin);
00709
00710 static BOOL IsThisAction(StringBase* pControl);
00711 static BOOL CreateAndExecute(RTFTextFilter* pFilter, TWIP TopMargin);
00712 BOOL ExecuteControl();
00713 };
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724 class RTFBottomMargin : public RTFControlAction
00725 {
00726 public:
00727 CC_DECLARE_MEMDUMP(RTFBottomMargin)
00728 RTFBottomMargin(RTFTextFilter* pFilt, MILLIPOINT BottomMargin);
00729
00730 static BOOL IsThisAction(StringBase* pControl);
00731 static BOOL CreateAndExecute(RTFTextFilter* pFilter, TWIP BottomMargin);
00732 BOOL ExecuteControl();
00733 };
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744 class RTFResetCharAttrs : public RTFControlAction
00745 {
00746 public:
00747 CC_DECLARE_MEMDUMP(RTFResetCharAttrs)
00748 RTFResetCharAttrs(RTFTextFilter* pFilt);
00749
00750 static BOOL IsThisAction(StringBase* pControl);
00751 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
00752 BOOL ExecuteControl();
00753 };
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764 class RTFResetParaAttrs : public RTFControlAction
00765 {
00766 public:
00767 CC_DECLARE_MEMDUMP(RTFResetParaAttrs)
00768 RTFResetParaAttrs(RTFTextFilter* pFilt);
00769
00770 static BOOL IsThisAction(StringBase* pControl);
00771 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
00772 BOOL ExecuteControl();
00773 };
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784 class RTFTableRowAction : public RTFControlAction
00785 {
00786 public:
00787 CC_DECLARE_MEMDUMP(RTFTableRowAction)
00788 RTFTableRowAction(RTFTextFilter* pFilt);
00789
00790 static BOOL IsThisAction(StringBase* pControl);
00791 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
00792 BOOL ExecuteControl();
00793 };
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804 class RTFTableCellAction : public RTFControlAction
00805 {
00806 public:
00807 CC_DECLARE_MEMDUMP(RTFTableCellAction)
00808 RTFTableCellAction(RTFTextFilter* pFilt);
00809
00810 static BOOL IsThisAction(StringBase* pControl);
00811 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
00812 BOOL ExecuteControl();
00813 };
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824 class RTFTabAction : public RTFControlAction
00825 {
00826 public:
00827 CC_DECLARE_MEMDUMP(RTFTabAction)
00828 RTFTabAction(RTFTextFilter* pFilt);
00829
00830 static BOOL IsThisAction(StringBase* pControl);
00831 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
00832 BOOL ExecuteControl();
00833 };
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844 class RTFSingleCharAction : public RTFControlAction
00845 {
00846 public:
00847 CC_DECLARE_MEMDUMP(RTFSingleCharAction)
00848 protected:
00849 RTFSingleCharAction(RTFTextFilter* pFilt, WCHAR Character);
00850
00851 public:
00852 BOOL ExecuteControl();
00853 };
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864 class RTFHexCharAction : public RTFSingleCharAction
00865 {
00866 public:
00867 CC_DECLARE_MEMDUMP(RTFHexCharAction)
00868 RTFHexCharAction(RTFTextFilter* pFilt, WCHAR Character);
00869
00870 static BOOL IsThisAction(StringBase* pControl);
00871 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
00872 };
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883 class RTFEmDashAction : public RTFSingleCharAction
00884 {
00885 public:
00886 CC_DECLARE_MEMDUMP(RTFEmDashAction)
00887 RTFEmDashAction(RTFTextFilter* pFilt);
00888
00889 static BOOL IsThisAction(StringBase* pControl);
00890 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
00891 };
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902 class RTFEnDashAction : public RTFSingleCharAction
00903 {
00904 public:
00905 CC_DECLARE_MEMDUMP(RTFEnDashAction)
00906 RTFEnDashAction(RTFTextFilter* pFilt);
00907
00908 static BOOL IsThisAction(StringBase* pControl);
00909 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
00910 };
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921 class RTFEmSpaceAction : public RTFSingleCharAction
00922 {
00923 public:
00924 CC_DECLARE_MEMDUMP(RTFEmSpaceAction)
00925 RTFEmSpaceAction(RTFTextFilter* pFilt);
00926
00927 static BOOL IsThisAction(StringBase* pControl);
00928 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
00929 };
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940 class RTFEnSpaceAction : public RTFSingleCharAction
00941 {
00942 public:
00943 CC_DECLARE_MEMDUMP(RTFEnSpaceAction)
00944 RTFEnSpaceAction(RTFTextFilter* pFilt);
00945
00946 static BOOL IsThisAction(StringBase* pControl);
00947 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
00948 };
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959 class RTFBulletAction : public RTFSingleCharAction
00960 {
00961 public:
00962 CC_DECLARE_MEMDUMP(RTFBulletAction)
00963 RTFBulletAction(RTFTextFilter* pFilt);
00964
00965 static BOOL IsThisAction(StringBase* pControl);
00966 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
00967 };
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978 class RTFSingleLeftQuoteAction : public RTFSingleCharAction
00979 {
00980 public:
00981 CC_DECLARE_MEMDUMP(RTFSingleLeftQuoteAction)
00982 RTFSingleLeftQuoteAction(RTFTextFilter* pFilt);
00983
00984 static BOOL IsThisAction(StringBase* pControl);
00985 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
00986 };
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997 class RTFSingleRightQuoteAction : public RTFSingleCharAction
00998 {
00999 public:
01000 CC_DECLARE_MEMDUMP(RTFSingleRightQuoteAction)
01001 RTFSingleRightQuoteAction(RTFTextFilter* pFilt);
01002
01003 static BOOL IsThisAction(StringBase* pControl);
01004 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
01005 };
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016 class RTFDoubleLeftQuoteAction : public RTFSingleCharAction
01017 {
01018 public:
01019 CC_DECLARE_MEMDUMP(RTFDoubleLeftQuoteAction)
01020 RTFDoubleLeftQuoteAction(RTFTextFilter* pFilt);
01021
01022 static BOOL IsThisAction(StringBase* pControl);
01023 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
01024 };
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035 class RTFDoubleRightQuoteAction : public RTFSingleCharAction
01036 {
01037 public:
01038 CC_DECLARE_MEMDUMP(RTFDoubleRightQuoteAction)
01039 RTFDoubleRightQuoteAction(RTFTextFilter* pFilt);
01040
01041 static BOOL IsThisAction(StringBase* pControl);
01042 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
01043 };
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054 class RTFNonBreakSpaceAction : public RTFSingleCharAction
01055 {
01056 public:
01057 CC_DECLARE_MEMDUMP(RTFNonBreakSpaceAction)
01058 RTFNonBreakSpaceAction(RTFTextFilter* pFilt);
01059
01060 static BOOL IsThisAction(StringBase* pControl);
01061 static BOOL CreateAndExecute(RTFTextFilter* pFilter);
01062 };
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074 class StateStore : public ListItem
01075 {
01076 CC_DECLARE_DYNAMIC(StateStore)
01077
01078 public:
01079 StateStore();
01080 ~StateStore();
01081
01082 StateStore& operator=(const StateStore&);
01083
01084 enum DestinationStateTypes { rdsNorm, rdsSkip };
01085 enum InternalStateTypes { risNorm, risBin };
01086
01087 DestinationStateTypes DestinationState;
01088 InternalStateTypes InternalState;
01089 MILLIPOINT InterCharGap;
01090
01091 };
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103 class RTFDefaultAttributes : public CC_CLASS_MEMDUMP
01104 {
01105 public:
01106 String_64 FontName;
01107 };
01108
01109
01110
01111
01112
01113
01114
01115
01116
01117
01118
01119 class RTFTextFilter : public BaseTextFilter
01120 {
01121 CC_DECLARE_DYNAMIC(RTFTextFilter);
01122
01123 public:
01124 friend class RTFTextOILFilter;
01125
01126 RTFTextFilter();
01127 ~RTFTextFilter();
01128
01129
01130 BOOL Init();
01131 virtual BOOL IsDefaultDocRequired(const TCHAR* pcszPathName);
01132 INT32 HowCompatible(PathName& Filename, ADDR HeaderStart, UINT32 HeaderSize, UINT32 FileSize);
01133 BOOL DoImport(SelOperation* Op, CCLexFile*, Document* DestDoc,
01134 BOOL AutoChosen, ImportPosition* Pos = NULL);
01135 BOOL DoExport(Operation*, CCLexFile*, PathName*, Document*);
01136
01137
01138 BOOL SetBold(BOOL On) {return SetTextBold(On);}
01139 BOOL SetItalic(BOOL On) {return SetTextItalic(On);}
01140 BOOL SetSize(MILLIPOINT NewSize) {return SetTextSize(NewSize);}
01141 MILLIPOINT GetTextSize()
01142 {return ((TxtFontSizeAttribute*) CurrentAttrs[ATTR_TXTFONTSIZE].pAttr)->FontSize;}
01143 BOOL SetSuperscript();
01144 BOOL SetSubscript();
01145 BOOL SetNoscript() {return RemoveTextScript();}
01146 BOOL SetTextColour(DocColour& NewCol) {return SetFillColour(NewCol);}
01147 BOOL SetFont(String_64* pName) {return SetTextTypeFace(pName);}
01148
01149 BOOL ResetCharacterAttributes();
01150 BOOL ResetParagraphAttributes();
01151
01152
01153 void SetSkipping() {CurrentState.DestinationState = StateStore::rdsSkip;}
01154 BOOL StartNewLine() {return AddNewLineToStory(pImportStory);}
01155 BOOL InsertTab() {return AddTabToStory(pImportStory);}
01156 BOOL InsertChar(WCHAR Char) {return ParseChar(Char);}
01157
01158
01159 BOOL ReadColourTable();
01160 RTFColourTable* GetColourTable() {return &ColourTable;}
01161 BOOL ReadFontTable();
01162 RTFFontTable* GetFontTable() {return &FontTable;}
01163
01164 BOOL ReadCharFromFile(TCHAR* ch, BOOL SkipCR = TRUE);
01165
01166 protected:
01167
01168 BOOL PrepareToImport();
01169 void CleanUpAfterImport();
01170 BOOL DoInternalImport();
01171
01172 BOOL InitialiseInfo();
01173
01174
01175 BOOL PushRTFState();
01176 BOOL PopRTFState();
01177 BOOL ParseRTFKeyword();
01178 BOOL ParseChar(WCHAR Char);
01179 BOOL TranslateKeyword(StringBase* pKeyword, INT32 param, BOOL fParam);
01180
01181 BOOL EndGroupAction(StateStore::DestinationStateTypes rds);
01182
01183
01184 BOOL ReadKeyword(StringBase* pKeyword, INT32* pParam, BOOL* pParamUsed);
01185 BOOL SkipBackChar(INT32 Count = 1);
01186 BOOL ReadOneFontFromTable();
01187
01188
01189 RTFDefaultAttributes DefaultAttrs;
01190 StateStore CurrentState;
01191 INT32 cbBin;
01192 BOOL fSkipDestIfUnk;
01193
01194 UINT32 BytesReadSoFar;
01195 TextStory* pImportStory;
01196 CCLexFile* pImportFile;
01197 BOOL EscapeWasPressed;
01198 BOOL ImportHasFinished;
01199
01200
01201 MarkedStack StateStack;
01202 AttrRecordList PreviousAttributes;
01203 RTFColourTable ColourTable;
01204 RTFFontTable FontTable;
01205
01206
01207 MILLIPOINT PaperWidth;
01208 MILLIPOINT PaperHeight;
01209 MILLIPOINT LeftMargin;
01210 MILLIPOINT RightMargin;
01211 MILLIPOINT TopMargin;
01212 MILLIPOINT BottomMargin;
01213
01214 public:
01215
01216 void SetPaperWidth(MILLIPOINT NewWidth) {PaperWidth = NewWidth;}
01217 void SetPaperHeight(MILLIPOINT NewHeight) {PaperHeight = NewHeight;}
01218 void SetLeftMargin(MILLIPOINT NewMargin) {LeftMargin = NewMargin;}
01219 void SetRightMargin(MILLIPOINT NewMargin) {RightMargin = NewMargin;}
01220 void SetTopMargin(MILLIPOINT NewMargin) {TopMargin = NewMargin;}
01221 void SetBottomMargin(MILLIPOINT NewMargin) {BottomMargin = NewMargin;}
01222
01223 void SetInterCharGap(MILLIPOINT NewGap) {CurrentState.InterCharGap = NewGap;}
01224 };
01225
01226 #endif //#if BUILD_OTHER_TEXT_FILTER
01227
01228 #endif //include
01229 #endif //#if BUILD_TEXT_FILTERS