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 #ifndef INC_CXFRECH
00101 #define INC_CXFRECH
00102
00103 #include "listitem.h"
00104 #include "doccoord.h"
00105
00106 #if !defined(EXCLUDE_FROM_XARLIB)
00107 #include "camfiltr.h"
00108 #endif
00109
00110 #define CXFRH_TAG_LIST_END (0xffffffff)
00111
00112 class CXaraFileRecord;
00113 class BaseCamelotFilter;
00114 class DocColour;
00115 class KernelBitmap;
00116 class Node;
00117 class ColourListComponent;
00118 class BitmapListComponent;
00119 class UnitListComponent;
00120 class DocInfoComponent;
00121 class PrintComponent;
00122 class FontComponent;
00123 class CXaraFile;
00124
00125 class Document;
00126 class Chapter;
00127 class Spread;
00128 class Layer;
00129 class NodePath;
00130
00131 class AtomicTagListItem;
00132 class EssentialTagListItem;
00133 class TagDescriptionListItem;
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145 class CXaraFileRecordHandler : public ListItem
00146 {
00147
00148 CC_DECLARE_DYNAMIC(CXaraFileRecordHandler);
00149
00150 public:
00151 CXaraFileRecordHandler();
00152 ~CXaraFileRecordHandler();
00153
00154
00155 virtual UINT32* GetTagList() = 0;
00156 virtual BOOL HandleRecord(CXaraFileRecord* pCXaraFileRecord) = 0;
00157 virtual BOOL HandleStreamedRecord(CXaraFile * pCXFile, UINT32 Tag,UINT32 Size,UINT32 RecordNumber);
00158
00159
00160 virtual BOOL IsStreamed(UINT32 Tag) = 0;
00161
00162 virtual void IncProgressBarCount(UINT32 n) = 0;
00163
00164 virtual BOOL IsTagInList(UINT32 Tag);
00165
00166 #if defined(EXCLUDE_FROM_XARLIB)
00167 virtual BOOL Init(CXaraFile* pCXFile);
00168 #else
00169 virtual BOOL Init(BaseCamelotFilter* pBaseCamelotFilter);
00170 #endif
00171 virtual BOOL BeginImport();
00172 virtual BOOL EndImport();
00173 virtual BOOL BeginSubtree(UINT32 Tag);
00174 virtual BOOL EndSubtree(UINT32 Tag);
00175
00176 #ifdef XAR_TREE_DIALOG
00177 virtual void GetTagText(UINT32 Tag,String_256& Str);
00178 virtual void GetRecordInfo(CXaraFileRecord *pCXaraFileRecord, StringBase *pStr);
00179 virtual void GetRecordDescriptionText(CXaraFileRecord* pCXaraFileRecord,StringBase* Str);
00180 virtual void DescribePath(CXaraFileRecord* pCXaraFileRecord,StringBase* Str);
00181 virtual void DescribePathRelative(CXaraFileRecord* pCXaraFileRecord,StringBase* Str);
00182 #endif
00183 };
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200 class CamelotRecordHandler : public CXaraFileRecordHandler
00201 {
00202
00203 CC_DECLARE_DYNAMIC(CamelotRecordHandler);
00204
00205 public:
00206 CamelotRecordHandler();
00207 ~CamelotRecordHandler();
00208
00209 virtual BOOL IsCamelotHandler() { return TRUE; }
00210
00211 #if defined(EXCLUDE_FROM_XARLIB)
00212 virtual BOOL Init(CXaraFile* pCXFile);
00213 #else
00214 virtual BOOL Init(BaseCamelotFilter* pBaseCamelotFilter);
00215
00216
00217 BOOL GetDocColour(INT32 ColourRef,DocColour* pDocColour);
00218 KernelBitmap* GetReadBitmapReference(INT32 BitmapRef);
00219
00220
00221 ColourListComponent* GetColourDocComponent();
00222 BitmapListComponent* GetBitmapDocComponent();
00223 UnitListComponent* GetUnitDocComponent();
00224 DocInfoComponent* GetDocInfoComponent();
00225 PrintComponent* GetPrintComponent();
00226 FontComponent* GetFontComponent();
00227
00228 BOOL IsImporting();
00229 BOOL IsImportingAtPosition();
00230
00231 BOOL InsertNode(Node* pNode);
00232 BOOL IncInsertLevel();
00233 BOOL DecInsertLevel();
00234 Node* GetInsertContextNode();
00235 void SetInsertContextNode(Node* pNode);
00236 void InsertNextNodeAsChild();
00237 void InsertNextNodeAsSibling();
00238
00239
00240 InsertTreeContext *GetInsertContext(void);
00241 void RestoreInsertContext(InsertTreeContext *pOldState);
00242
00243
00244
00245
00246 Document* GetLastDocumentInserted();
00247 Chapter* GetLastChapterInserted();
00248 Spread* GetLastSpreadInserted();
00249 Layer* GetLastLayerInserted();
00250 NodePath* GetLastNodePathInserted();
00251
00252 void SetLastDocumentInserted(Document* pNode);
00253 void SetLastChapterInserted(Chapter* pNode);
00254 void SetLastSpreadInserted(Spread* pNode);
00255 void SetLastLayerInserted(Layer* pNode);
00256 void SetLastNodePathInserted(NodePath* pNodePath);
00257
00258 Layer * GetFirstImportedLayer();
00259 void SetFirstImportedLayer(Layer* pLayer);
00260
00261 UINT32 GetDocumentInsertedCount();
00262 UINT32 GetChapterInsertedCount();
00263 UINT32 GetSpreadInsertedCount();
00264 UINT32 GetLayerInsertedCount();
00265 UINT32 GetSetSentinelInsertedCount();
00266
00267 void IncDocumentInsertedCount();
00268 void IncChapterInsertedCount();
00269 void IncSpreadInsertedCount();
00270 void IncLayerInsertedCount();
00271 void IncSetSentinelInsertedCount();
00272
00273 BOOL AddTagDescription(TagDescriptionListItem* pItem);
00274 TagDescriptionListItem* GetTagDescription(UINT32 Tag);
00275
00276 BOOL UnrecognisedTag(UINT32 Tag);
00277
00278 BOOL SetDocumentNudgeSize(UINT32 newVal);
00279 #endif
00280
00281 void AddAtomicTag(AtomicTagListItem* pItem);
00282 void AddEssentialTag(EssentialTagListItem* pItem);
00283
00284 BOOL IsTagInAtomicList(UINT32 Tag);
00285 BOOL IsTagInEssentialList(UINT32 Tag);
00286
00287 #if !defined(EXCLUDE_FROM_XARLIB)
00288
00289 void AddPathRecordRefToList(NodePath* pNodePath, UINT32 RecordNumber);
00290 UINT32 FindPathRecordRefRecordNumber(NodePath* pNodePath);
00291 NodePath* FindPathRecordRefPath(UINT32 RecordNumber);
00292
00293
00294
00295 Document* GetDocument();
00296 Spread* GetSpread();
00297
00298 void SetCoordOrigin(const DocCoord& Origin);
00299 DocCoord GetCoordOrigin();
00300
00301 void EndOfFile();
00302 void SetTotalNumBytesToRead(UINT32 s);
00303 void IncProgressBarCount(UINT32 n);
00304 void SetTotalProgressBarCount(UINT32 n);
00305
00306 BaseCamelotFilter* GetBaseCamelotFilter() { return pBaseCamelotFilter; }
00307
00308
00309 virtual BOOL SetPreCompression(UINT32 Flags);
00310 virtual UINT32 GetPreCompression();
00311 #endif
00312
00313 virtual BOOL SetCompression(BOOL NewState);
00314
00315
00316 virtual BOOL IsStreamed(UINT32 Tag);
00317
00318 #if !defined(EXCLUDE_FROM_XARLIB)
00319 virtual void SetImportFileType(char* pFileType);
00320 virtual BOOL IsOpeningMinimalWebFormat();
00321 #endif
00322
00323 protected:
00324 #if !defined(EXCLUDE_FROM_XARLIB)
00325 BaseCamelotFilter* pBaseCamelotFilter;
00326 #else
00327 CXaraFile* m_pCXFile;
00328 #endif
00329 };
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348 class StripSubTreeRecordHandler : public CamelotRecordHandler
00349 {
00350
00351 CC_DECLARE_DYNAMIC(StripSubTreeRecordHandler);
00352
00353 public:
00354 StripSubTreeRecordHandler();
00355
00356 virtual UINT32* GetTagList();
00357 virtual BOOL HandleRecord(CXaraFileRecord* pCXaraFileRecord);
00358 virtual BOOL IsTagInList(UINT32 Tag);
00359 virtual BOOL BeginImport();
00360 virtual void IncProgressBarCount(UINT32 n) {};
00361
00362 virtual void StripSubTreeOn() { StripSubTree = TRUE; }
00363 virtual void StripSubTreeOff() { StripSubTree = FALSE; }
00364 virtual BOOL IsStripSubTreeOn() { return StripSubTree; }
00365
00366 private:
00367 BOOL StripSubTree;
00368 UINT32 LevelCounter;
00369 };
00370
00371 #endif // INC_CXFRECH