camfiltr.h

Go to the documentation of this file.
00001 // $Id: camfiltr.h 1688 2006-08-10 12:05:20Z gerry $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 //
00099 // This filter forms the base filter for the v2 Native and Web file filters.
00100 
00101 #ifndef INC_CAMFILTER
00102 #define INC_CAMFILTER
00103 
00104 #include "filters.h"
00105 #include "ccfile.h"     // FilePos
00106 #include "doccoord.h"   
00107 #include "node.h"       // AttachNodeDirection 
00108 
00109 class CXaraFile;
00110 class CXaraFileRecord;
00111 class CXaraFileRecordHandler;
00112 class Node;
00113 class DocColour;
00114 class KernelBitmap;
00115 class ColourListComponent;
00116 class BitmapListComponent;
00117 class UnitListComponent;
00118 class DocInfoComponent;
00119 class ViewComponent;
00120 class FontComponent;
00121 class PrintComponent;
00122 class Progress;
00123 class WebPrefsDlgParam;
00124 class CCPanose;
00125 class BitmapSource;
00126 class NodePath;
00127 class TextStory;
00128 class NodeGroup;
00129 
00130 class AtomicTagList;
00131 class InsertLevelStack;
00132 class EssentialTagList;
00133 class TagDescriptionList;
00134 class AtomicTagListItem;
00135 class EssentialTagListItem;
00136 class TagDescriptionListItem;
00137 class CXaraFilePathRecordRefList;
00138 // WEBSTER - markn 31/1/97
00139 // Replaced with general system
00140 //class CXaraFileTextStoryGroupRefList;
00141 class CXaraFileNodeGroupRefList;
00142 
00143 #define EXPORT_FILETYPE_WEB     "CXW"   // The .web format
00144 #define EXPORT_FILETYPE_MIN     "CXM"   // The minimal web format
00145 #define EXPORT_FILETYPE_NATIVE  "CXN"   // The native format
00146 
00147 typedef enum 
00148 {
00149     INSERTMODE_ATTACHTOTREE,
00150     INSERTMODE_SETCURRENTATTRIBUTE
00151 } InsertMode;
00152 
00153 
00154 typedef enum
00155 {
00156     BWL_NONE = 0,
00157     BWL_COMPOUND,
00158     BWL_ALL
00159 } BoundsWriteLevel;
00160 
00161 
00162 /********************************************************************************************
00163 
00164 >   struct InsertTreeContext
00165 
00166     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00167     Created:    5/3/97
00168     Purpose:    Structure for saving and restoring tree insertion contexts. This is used
00169                 by things like print marks and brush stroke definitions, which embed a 
00170                 subtree definition in the file, but want to import it somewhere other than
00171                 into the document tree.
00172 
00173                 This structure encapsulates the current insertion position in the tree
00174                 so that it can be saved & restored around such out-of-doc subtrees.
00175 
00176     SeeAlso:    BaseCamelotFilter::GetInsertContext;
00177                 BaseCamelotFilter::RestoreInsertContext
00178 
00179 ********************************************************************************************/
00180 
00181 typedef struct
00182 {
00183     Node *pContextNode;
00184     BOOL InsertAsChild;
00185 } InsertTreeContext;
00186 
00187 
00188 
00189 /********************************************************************************************
00190 
00191 >   class BaseCamelotFilter : public Filter
00192 
00193     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00194     Created:    29/5/96
00195     Purpose:    This filter is for the new web file format which is the minimilistic form of
00196                 the new version 2 native file filter.
00197                 Derive off VectorFilter as this is what this file format defines. 
00198 
00199 ********************************************************************************************/
00200 
00201 class BaseCamelotFilter : public VectorFilter
00202 {
00203     // Give my name in memory dumps
00204     CC_DECLARE_DYNAMIC(BaseCamelotFilter);
00205 
00206 public:
00207     // Construction and initialisation
00208     BaseCamelotFilter();
00209     ~BaseCamelotFilter();
00210     virtual BOOL Init();
00211     virtual void Deinit();
00212 
00213     // Function used by the gallery thumb nail code to check the file is the native/web format
00214     // and then get to the preview bitmap record and leave the file pointer sitting at the bitmap image
00215     // WEBSTER-Martin-added extra parameter for non-Accusoft previews
00216     static BOOL SkipToPreviewBitmap(CCLexFile * pFile, BOOL *IsNewNativeFile, UINT32 * pFilterId = NULL);
00217 
00218     // Function used by the gallery index generation code to check the file is the native/web format
00219     // and then get to the index information record and load the information into the string
00220     static BOOL SkipToIndexInformation(CCLexFile * pFile, String_256 *pString, BOOL *IsNewNativeFile);
00221 
00222 
00223     // HowCompatible() returns value in range 0 to 10:
00224     //   0 => "Definitely Not"
00225     //  10 => "Yes Sir, that's my file format"
00226     virtual INT32 HowCompatible( PathName& Filename, ADDR  HeaderStart, UINT32 HeaderSize,
00227                                UINT32 FileSize );
00228 
00229     virtual INT32 HowCompatibleIsFileType(char* pFileType) = 0;
00230 
00231     // Filters can override these functions, if required:
00232     // Public  - Exporting
00233     virtual BOOL DoExport(Operation*, CCLexFile*, PathName*, Document*, BOOL);
00234 
00235     // Public  - Importing
00236     virtual BOOL DoImport(SelOperation*, CCLexFile*, Document*, 
00237                           BOOL AutoChosen = FALSE, ImportPosition *Pos = NULL,
00238                           KernelBitmap** ppImportedBitmap = NULL,
00239                           DocCoord* pPosTranslate = NULL, String_256* = NULL);
00240 
00241     virtual BOOL IsWebFilter() = 0;             // Is it the proper web format?
00242     virtual BOOL IsCompactNativeFilter() = 0;   // Is it the compact native format?
00243 
00244     virtual BOOL IsImporting();             // Importing into existing doc?  Use this func to find out.
00245     virtual BOOL IsImportingAtPosition();   // Importing into existing doc and at a specific point
00246 
00247     virtual BOOL IsDefaultDocRequired(const TCHAR* pcszPathName);
00248 
00249     virtual INT32 GetMaxPathLookUp();
00250 
00251     static BOOL WritePathsInRelativeFormat() { return WriteRelativePaths; }
00252 
00253     // Record writing functions
00254     INT32   StartRecord(UINT32 Tag,INT32 Size);
00255     INT32   StartStreamedRecord(UINT32 Tag,INT32 Size);
00256     BOOL    EndRecord();
00257     BOOL    EndStreamedRecord();
00258 
00259     // These are used during writing????
00260     UINT32  GetRecordTag();
00261     INT32   GetRecordNum();
00262 
00263     void        SetCoordOrigin(const DocCoord& Origin);
00264     DocCoord    GetCoordOrigin();
00265 
00266     BOOL    Write(BYTE b);
00267     BOOL    Write(UINT32 n);
00268     BOOL    Write(INT32 n);
00269     BOOL    Write(const DocCoord& Coord);
00270     BOOL    Write(TCHAR* pStr);                 // Calls WriteUnicode() (Use WriteASCII() for ASCII writing)
00271     BOOL    Write(BYTE* pBuf,UINT32 BufSize);
00272     BOOL    Write(FLOAT f);
00273 
00274     BOOL    WriteWCHAR(WCHAR w);
00275 
00276     BOOL    WriteASCII(TCHAR* pStr);
00277     BOOL    WriteUnicode(TCHAR* pStr);
00278     BOOL    WriteZeroSizedRecord(UINT32 Tag);
00279 
00280     UINT32  Write(CXaraFileRecord* pRecord);
00281     UINT32  WriteDefinitionRecord(CXaraFileRecord* pRecord);
00282 
00283     BOOL    WriteCCPanose(const CCPanose & Panose);
00284     INT32   WriteFontDefinition(WORD FontHandle, BOOL IsBold, BOOL IsItalic);
00285 
00286     BOOL    WriteBitmapSource(const BitmapSource& Source, UINT32 Height);
00287     
00288     INT32   WriteRecord(DocColour* pDocColour);
00289     INT32   WriteRecord(KernelBitmap* pBitmap);
00290 
00291     ColourListComponent*    GetColourDocComponent() { return pColComponent; }
00292     BitmapListComponent*    GetBitmapDocComponent() { return pBmpComponent; }
00293     UnitListComponent*      GetUnitDocComponent()   { return pUnitsComponent; }
00294     DocInfoComponent*       GetDocInfoComponent()   { return pInfoComponent; }
00295     ViewComponent*          GetViewDocComponent()   { return pViewComponent; }
00296     PrintComponent*         GetPrintComponent()     { return pPrintComponent; }
00297     FontComponent*          GetFontComponent()      { return pFontComponent; }
00298 
00299     FilePos GetFilePos();
00300     UINT32  GetNumBytesWritten();
00301 
00302     virtual Document* GetDocument() { return TheDocument; }
00303     virtual Spread* GetSpread() { return pTheSpread; }
00304 
00305     virtual void GotError(UINT32 errorID);
00306     virtual void GotError( UINT32 errorID , const TCHAR* errorString);
00307 
00308     // Read-related functions
00309     virtual void EndOfFile() { EndOfFileFlag = TRUE; }
00310     virtual void SetTotalNumBytesToRead(UINT32 s);
00311 
00312     virtual BOOL InvalidateRegion(Node* pNode);
00313 
00314     // Allows say a streamed record handler, to get at the size of the record
00315     // currently being processed, so that it can know what value it has been allocated
00316     // to update the progress bar by.
00317     virtual UINT32 GetCurrentRecordSize();
00318 
00319     // Tree building functions (these should probably be protected...)
00320     virtual BOOL    InsertNode(Node* pNode);
00321     virtual BOOL    IncInsertLevel();
00322     virtual BOOL    DecInsertLevel();
00323     virtual Node*   GetInsertContextNode();             // See below if you want to save & restore the context
00324     virtual void    SetInsertContextNode(Node* pNode);
00325     virtual void    InsertNextNodeAsChild();
00326     virtual void    InsertNextNodeAsSibling();
00327 
00328     // Saving & restoring tree-building contexts
00329     virtual InsertTreeContext *GetInsertContext(void);
00330     virtual void RestoreInsertContext(InsertTreeContext *pOldState);
00331 
00332     // Progress bar functions
00333     virtual BOOL IncProgressBarCount(UINT32 n);
00334     virtual UINT32 GetProgressBarCount()    { return ProgressBarCount; }
00335     virtual BOOL SetTotalProgressBarCount(UINT32 n);
00336 
00337     static List* GetRecordHandlers() { return &RecordHandlerList; }
00338 
00339     virtual WebPrefsDlgParam* GetCachedExportOptions() { return pPrefs; }
00340 
00341     // Error and warning handling
00342     BOOL UnrecognisedTag(UINT32 Tag);
00343 
00344     BOOL MergeSameNamedLayers();
00345 
00346 private:
00347     void UpdateLastSafeToRenderNode(Node* pNode);
00348 
00349     Node* pLastUnsafeToRenderNode;
00350 
00351     // Do we want to export this template node?
00352     BOOL IsThisASelectedTemplate ( Node *pNode );
00353 
00354 protected:
00355     // Ways of warning the user about problems when loading a document
00356     // These warn about tags and data which are unknown
00357     void AppendIgnoredDataWarning(UINT32 Tag);
00358     void UnkownEssentialDataError(UINT32 Tag);
00359 
00360 public:
00361     // This allows the user to be warned about things like bitmap definitions not be loadable 
00362     // Needs to be public as items like the colour and bitmap components need access
00363     void AppendWarning(UINT32 WarningId);
00364     //void AppendWarning(String_256 *pString);
00365 
00366 public:
00367     virtual BOOL WriteNodes(Node* pNode);
00368     virtual BOOL WriteNodeAndSubNodes (Node* pNode);
00369 
00370 private:
00371     String_256 IgnoredDataString;
00372     String_256 WarningsString;
00373 
00374 public:
00375     virtual BOOL ReadPostChildren(Node* pNode);
00376     virtual BOOL ReadFileUntil(INT32 tag);
00377 
00378 protected:
00379 
00380     virtual BOOL StartProgressBar(String_64* pMessage);
00381     virtual void EndProgressBar();
00382 
00383     virtual void ResetImportExportVars();
00384     virtual BOOL PrepareImportExportVars();
00385 
00386     virtual CXaraFile* CreateCXaraFile();
00387     virtual BaseCamelotFilter* CreateNULLFilter(Document* pDocument) = 0;
00388     
00389     // Exporting
00390     virtual BOOL PrepareToExport(CCLexFile* pFile);
00391     virtual void CleanUpAfterExport(BOOL Success);
00392 
00393     virtual BOOL FindDocComponents();
00394     virtual BOOL StartExportDocComponents(BOOL BeforeCompression);
00395     virtual BOOL EndExportDocComponents(BOOL Success);
00396 
00397     virtual BOOL BeginDocumentExport();
00398     virtual BOOL EndDocumentExport();
00399 
00400     virtual Node* GetExportNode();
00401     
00402     virtual BOOL WriteDocument(Operation * pExportOp);
00403     virtual BOOL WritePreChildren(Node* pNode);
00404     virtual BOOL CanWriteChildren(Node* pNode);
00405     virtual BOOL WritePostChildren(Node* pNode);
00406     virtual BOOL WriteBeginChildRecords(Node* pNode);
00407     virtual BOOL WriteEndChildRecords(Node* pNode);
00408     virtual BOOL WriteCurrentAttributes();
00409 
00410     // Functions to write out nodes that are either selected, or necessary for the
00411     //  selected nodes to be exported correctly.
00412     virtual BOOL WriteSelectedNodes (Operation * pExportOp, Node * pNode, SelRange * pSelection);
00413     virtual BOOL WriteSelectedLayerAndNodes (Operation * pExportOp, Node * pNode, SelRange * pSelection);
00414 
00415     virtual BOOL WriteHeader();
00416 
00417     // Function to get export options, if any
00418     virtual BOOL GetExportOptions( WebPrefsDlgParam *pPrefs );
00419     virtual OpDescriptor* GetDialogueOp ( void );
00420 
00421     // The data we get from the export options dialog box
00422     WebPrefsDlgParam *pPrefs;
00423 
00424     // Function to export a preview bitmap
00425     virtual BOOL ExportPreviewBitmap(CCLexFile* pFile, Operation* pOp,
00426                                      PathName* pPath, Document* pDoc);
00427 
00428     // Function to go and correct the file header once we have exported everything
00429     virtual BOOL CorrectFileHeader(CCLexFile* pFile);
00430 
00431     // Calcs an estimate of the number of bytes that will be written to the file
00432     virtual UINT32 CalcExportSize(Document* pDocument);
00433 
00434     // Importing
00435     static BOOL CreateRecordHandlers();
00436     static void DestroyRecordHandlers();
00437     BOOL InitRecordHandlers();
00438     BOOL DeinitRecordHandlers();
00439 
00440     virtual BOOL PrepareToImport(CCLexFile* pFile);
00441     virtual void CleanUpAfterImport(BOOL Successful);
00442     virtual BOOL PrepareTreeBuilding();
00443     virtual void CleanUpTreeBuilding();
00444 
00445     virtual BOOL EnsureFrameLayerIntegrity(Spread* pSpread);
00446     virtual BOOL EnsureLayerIntegrity(Spread* pSpread);
00447 
00448     virtual BOOL StartImportDocComponents();
00449     virtual BOOL EndImportDocComponents(BOOL Successful);
00450 
00451     virtual BOOL ReadFile();
00452 
00453 public:
00454     // Function to find the file type for this filter
00455     virtual char*   GetExportFileType() = 0;
00456     virtual void    SetImportFileType(char* pFileType);
00457     virtual BOOL    IsOpeningMinimalWebFormat();
00458 
00459 private:
00460     char ImportFileType[4];
00461 
00462 protected:
00463     // Resource IDs of the strings that describe this filter.
00464     UINT32 FilterNameID;
00465     UINT32 FilterInfoID;
00466 
00467     // The string to display when actually exporting rather than rendering.
00468     // 0 if we're not an export filter.
00469     // ExportMsgID is used in ExportRender when we are rendering the bitmap
00470     UINT32 ExportingMsgID;
00471 
00472     // Message to show when a bad file is found
00473     UINT32 BadFileMsgID;
00474 
00475     // Somewhere to keep the info about where various file sections
00476     // Start and end
00477     FilePos FileStart;
00478     FilePos FileEnd;
00479 
00480     // The start of the file header record
00481     FilePos FileHeaderRecord;
00482 
00483     // Our note of the uncompressed file size
00484     UINT32 FileSize;
00485 
00486     // Items to handle the file compression
00487     INT32 CompressionType;  // type of compression in use (0 at present)
00488     BOOL CompressionOn;     // on/off flag
00489 
00490     virtual BOOL SetFileCompressionState(BOOL NewState); 
00491     virtual BOOL GetFileCompressionState(); 
00492 
00493     double FileVersionNumber;
00494     double BuildVersionNumber;
00495 
00496     // Read vars
00497     BOOL EndOfFileFlag;
00498     BOOL EscapePressed;
00499 
00500     // Tree building vars
00501     Node*               pInsertContextNode;
00502     BOOL                InsertNextAsChild;
00503     UINT32              InsertLevel;
00504     InsertLevelStack*   pInsertLevelStack;
00505 
00506     // ptrs to vital objects
00507     CXaraFile*              pCXaraFile;
00508 
00509     ColourListComponent*    pColComponent;
00510     BitmapListComponent*    pBmpComponent;
00511     UnitListComponent*      pUnitsComponent;
00512     DocInfoComponent*       pInfoComponent;
00513     ViewComponent*          pViewComponent;
00514     PrintComponent*         pPrintComponent;
00515     FontComponent*          pFontComponent;
00516 
00517     Spread*                 pTheSpread;         // The spread we are importing into /exporting from
00518 
00519     // List of record handlers used to import files
00520     static List RecordHandlerList;
00521     static BOOL RecordHandlersCreated;
00522 
00523     struct
00524     {
00525         SelOperation*   pOp;    // The operation that caused the import
00526         ImportPosition* pPos;   // Where the file was dropped for drag'n'drop, or NULL if drag'n'drop was not used.
00527     } ImportInfo;
00528 
00529 public:
00530     // Returns the SelOperation that initiated this import, needed by
00531     // TemplateAttrRecordHandler::HandleRecord for attaching undoably
00532     // to NodeSetSentinel.
00533     SelOperation* GetImportSelOp() const    { return ImportInfo.pOp; }
00534 
00535     // Tag management functions
00536     void AddAtomicTag(AtomicTagListItem* pItem);
00537     void AddEssentialTag(EssentialTagListItem* pItem);
00538 
00539     BOOL IsTagInAtomicList(UINT32 Tag);
00540     BOOL IsTagInEssentialList(UINT32 Tag);
00541 
00542     TagDescriptionListItem* GetTagDescription(UINT32 Tag);
00543 
00544     // WEBSTER - markn 11/2/97
00545     // System for writing tag descriptions to the file (introduced for the TAG_MOULD_BOUNDS record)
00546     virtual void AddTagDescription(UINT32 Tag,UINT32 ID);
00547     BOOL SetDocumentNudgeSize(UINT32 newVal);
00548     virtual void WriteTagDescriptionRecord();
00549     BOOL WriteNudgeSizeRecord();
00550     BOOL WriteBitmapSmoothingRecord();
00551     BOOL WriteDuplicationOffsetRecord();
00552     BOOL WriteRemainingAtomicTagDefinitions();
00553     UINT32 WriteXPEBitmapPlaceHolder(String_256& strBitmapName);
00554 
00555     // Don't use this version of AddTagDescription() unless you know what you're doing
00556     virtual BOOL AddTagDescription(TagDescriptionListItem* pItem);
00557 
00558 private:
00559     // Tag management variables
00560     AtomicTagList*      pAtomicTagList;
00561     EssentialTagList*   pEssentialTagList;
00562     TagDescriptionList* pTagDescriptionList;
00563 
00564 public:
00565     // List management - used for import & export
00566 
00567     // Path record references
00568     virtual void        AddPathRecordRefToList(NodePath* pNodePath, UINT32 RecordNumber);
00569     virtual UINT32      FindPathRecordRefRecordNumber(NodePath* pNodePath);
00570     virtual NodePath*   FindPathRecordRefPath(UINT32 RecordNumber);
00571     virtual BOOL        FindSimilarPath(NodePath* pPath,UINT32* pOtherPathRecNum,Matrix* pTransform);
00572     virtual double      GetSimilarPathTolerance(NodePath* pPath) = 0;
00573 
00574     // Text story & group references
00575     // WEBSTER - markn 31/1/97
00576     // Replaced with general system
00577 //  virtual void        AddTextStoryGroupRefToList(TextStory* pStory,NodeGroup* pGroup);
00578 //  virtual NodeGroup*  FindTextStoryGroupRefGroup(TextStory* pStory);
00579 //  virtual TextStory*  FindTextStoryGroupRefTextStory(NodeGroup* pGroup);
00580 
00581     // WEBSTER - markn 29/1/97
00582     // Part of the general form of the system used to convert text to outlines in v1.5
00583     // Node & group references
00584     virtual void        AddNodeGroupRefToList(Node* pNode,NodeGroup* pGroup);
00585     virtual NodeGroup*  FindGroupForThisNode(Node* pNode);
00586     virtual BOOL        WriteNodeAsOutlines(Node *pNode);
00587 
00588 private:
00589     // List management vars
00590 
00591     // Path record reference list
00592     CXaraFilePathRecordRefList* pPathRecordRefList;
00593 
00594     // WEBSTER - markn 31/1/97
00595     // Replaced with general system
00596     // Text story & group reference list
00597     //CXaraFileTextStoryGroupRefList*   pTextStoryGroupRefList;
00598 
00599     // WEBSTER - markn 29/1/97
00600     // Part of the general form of the system used to convert text to outlines in v1.5
00601     // Node & group reference list
00602     CXaraFileNodeGroupRefList*  pNodeGroupRefList;
00603 
00604 public:
00605     BOOL SetLastRecordHandler(CXaraFileRecordHandler* pHandler,UINT32 Tag);
00606 
00607 public:
00608     // Function calls used for building the document structure when loading
00609     Document*   GetLastDocumentInserted()           { return pLastDocument; }
00610     Chapter*    GetLastChapterInserted()            { return pLastChapter; }
00611     Spread*     GetLastSpreadInserted()             { return pLastSpread; }
00612     Layer*      GetLastLayerInserted()              { return pLastLayer; }
00613     NodePath*   GetLastNodePathInserted()           { return pLastNodePath; }
00614     NodeAttribute*  GetLastCurrentAttrInserted()    { return pLastCurrentAttr; }
00615 
00616     void    SetLastDocumentInserted(Document* pNode)            { pLastDocument = pNode; }
00617     void    SetLastChapterInserted(Chapter* pNode)              { pLastChapter = pNode; }
00618     void    SetLastSpreadInserted(Spread* pNode)                { pLastSpread = pNode; }
00619     void    SetLastLayerInserted(Layer* pNode)                  { pLastLayer = pNode; }
00620     void    SetLastNodePathInserted(NodePath* pNode)            { pLastNodePath = pNode; }
00621     void    SetLastCurrentAttrInserted(NodeAttribute* pNode)    { pLastCurrentAttr = pNode; }
00622 
00623     UINT32  GetDocumentInsertedCount()      { return DocumentCount; }
00624     UINT32  GetChapterInsertedCount()       { return ChapterCount; }
00625     UINT32  GetSpreadInsertedCount()        { return SpreadCount; }
00626     UINT32  GetLayerInsertedCount()         { return LayerCount; }
00627     UINT32  GetSetSentinelInsertedCount()   { return SetSentinelCount; }
00628 
00629     void    IncDocumentInsertedCount()      { DocumentCount++; }
00630     void    IncChapterInsertedCount()       { ChapterCount++; }
00631     void    IncSpreadInsertedCount()        { SpreadCount++; }
00632     void    IncLayerInsertedCount()         { LayerCount++; }
00633     void    IncSetSentinelInsertedCount()   { SetSentinelCount++; }
00634 
00635     //Graham 22/5/97    Function to export HTML to the clipboard
00636 public:
00637     virtual void        ExportHTMLTag(PathName* ppthToUse);
00638 
00639     virtual void        SetInsertMode(InsertMode newInsertMode, CCRuntimeClass* pAttrGroup = NULL);
00640     virtual InsertMode  GetInsertMode() {return m_InsertMode;}
00641 
00642 protected:
00643     virtual BOOL    AttachNode(Node* pNewNode, Node* pContextNode, AttachNodeDirection Direction);
00644 
00645 private:
00646     // Private vars used for building the document structure when loading
00647     Document*   pLastDocument;
00648     Chapter*    pLastChapter;
00649     Spread*     pLastSpread;
00650     Layer*      pLastLayer;
00651     NodePath*   pLastNodePath;
00652     NodeAttribute* pLastCurrentAttr;
00653 
00654     UINT32      DocumentCount;
00655     UINT32      ChapterCount;
00656     UINT32      SpreadCount;
00657     UINT32      LayerCount;
00658     UINT32      SetSentinelCount;
00659 
00660     Layer*      pImportLayer;
00661     BOOL        DeleteNode(Node* pNode);
00662 
00663     UINT32      PreCompFlags;
00664 
00665     InsertMode  m_InsertMode;
00666     CCRuntimeClass* m_pCurrentAttrGroup;
00667 
00668 protected:
00669     // Progress bar variables
00670     UINT32      ProgressBarCount;           // Current progress bar count
00671     Progress*   pProgress;                  // ptr to the progress bar object
00672     String_64   ProgressBarMessage;         // Progress bar message
00673     UINT32      TotalProgressBarCount;      // Total progress bar count
00674 
00675 private:
00676     DocCoord    CoordOrigin;                // The origin of all spread coords
00677 
00678     Layer *     m_pFirstImportedLayer;      // The first imported layer
00679     Layer *     m_pActiveLayerBeforeImport; // The active layer before import started
00680 
00681 public:
00682     // WEBSTER - markn 15/2/97
00683     // Bug fix for selection type save option
00684     virtual SelectionType   GetSelType()                            { return SelType; }
00685     virtual void            SetSelType(SelectionType ThisSelType)   { SelType = ThisSelType; }
00686 
00687     // Access functions to the first layer to be imported in the document 
00688     virtual Layer * GetFirstImportedLayer() { return m_pFirstImportedLayer; }
00689     virtual void SetFirstImportedLayer(Layer * pLayer) { m_pFirstImportedLayer = pLayer; }
00690 
00691 private:
00692     // WEBSTER - markn 15/2/97
00693     // Bug fix for selection type save option
00694     SelectionType   SelType;
00695     
00696 public:
00697     // String to hold the default path for the optional web export path
00698     static String_256 DefaultExportPath;
00699     // whether the user has requested to export a web file when native saving
00700     static BOOL ExportWebFile;
00701 
00702 protected:
00703     // whether the user has requested a preview bitmap
00704     static BOOL PreviewBitmapExport;
00705     // How much compression the user has requested when saving bitmaps
00706     static INT32 BitmapCompression;
00707     // compression preference flag
00708     static BOOL CompressNative;
00709     // save xpe bitmaps or just xpe info flag
00710     static BOOL SaveXPEBitmaps;
00711     // whether the user has requested a convert text to outlines
00712     static BOOL ConvertTextToOutlines;
00713     // what type of preview bitmap filter we should be using
00714     static INT32 PreviewBitmapFilterType;
00715     // whether invisible layers should be removed or not
00716     static BOOL RemoveInvisibleLayers;
00717     // whether unused colours should be removed or not
00718     static BOOL RemoveUnusedColours;
00719     // whether to export an HTML tag to the clipboard or not
00720     static BOOL HTMLToClipboard;
00721     // whether we export a web file in the minimal format or not
00722     static BOOL MinimalWebFormat;
00723     // Save paths in a relative format?
00724     static BOOL WriteRelativePaths;
00725     // List of fonts that never need converting to outlines when exporting to web format
00726     static String_256 DontConvertTheseFontsToOutlines;
00727 
00728     // Switches the path similarity checks on or off when saving native files.
00729     static BOOL NativeCheckSimilarPaths;
00730     // The tolerence that is used when checking for similar paths in web files. It is measured in millipoints.
00731     static INT32 WebSimilarPathTolerence;
00732 
00733     // WEBSTER - markn 28/1/97
00734     // whether the user has requested a convert blends to outlines
00735     static BOOL ConvertBlendsToOutlines;
00736     
00737     // Webster - Neville 29/7/97
00738     // Whether non-frame layers in an imported file are combined onto the active layer or the
00739     // first non-frame layer in the import
00740     static BOOL ImportNonFramesOntoActivelayer;
00741 
00742 public:
00743     // Control over whether we compress native files or not. 
00744     static BOOL SetNativeCompression(BOOL NewState);
00745     static BOOL GetNativeCompression();
00746     static BOOL ShouldSaveXPEBitmaps();
00747 
00748     // Functions to turn Compression on or off on the underlying CCFile
00749     // Reading
00750     virtual BOOL SetCompression(BOOL NewState);
00751     // Writing
00752     virtual BOOL StartCompression();
00753     virtual BOOL StopCompression();
00754 
00755     virtual BOOL  SetPreCompression(UINT32 Flags);
00756     virtual UINT32 GetPreCompression()              { return PreCompFlags; }
00757 
00758     // This allows people access to the CCFile which is being used
00759     // Note: only people who have a genuine reason need to access this - e.g. bitmap savers
00760     virtual CCLexFile* GetCCFile();
00761 
00762     // Find out how much compression is required for bitmaps
00763     virtual INT32 GetBitmapCompression(); 
00764     virtual INT32 SetBitmapCompression(INT32 NewBmpComp);
00765 
00766     // Find out whether the user has requested a preview bitmap
00767     virtual BOOL GetPreviewBitmapExport(); 
00768     virtual BOOL SetPreviewBitmapExport(BOOL NewExportPreviewBmp);
00769 
00770     // Find out whether the user has requested convert text to outlines
00771     virtual BOOL GetConvertTextToOutlines(); 
00772     virtual BOOL SetConvertTextToOutlines(BOOL NewConvertTextToOutlines);
00773     
00774     // WEBSTER - markn 28/1/97
00775     // Find out whether the user has requested convert blends to outlines
00776     virtual BOOL GetConvertBlendsToOutlines(); 
00777     virtual BOOL SetConvertBlendsToOutlines(BOOL NewConvertBlendsToOutlines);
00778     
00779     // Find out whether the user has requested remove invisible layers
00780     virtual BOOL GetRemoveInvisibleLayers(); 
00781     virtual BOOL SetRemoveInvisibleLayers(BOOL NewRemoveInvisibleLayers);
00782 
00783     // Find out whether the user has requested to remove unused colours
00784     virtual BOOL GetRemoveUnusedColours(); 
00785     virtual BOOL SetRemoveUnusedColours(BOOL NewRemoveUnusedColours);
00786 
00787     // Find out whether the user has requested to remove unused colours
00788     virtual BOOL GetMinimalWebFormat(); 
00789     virtual BOOL SetMinimalWebFormat(BOOL NewMinimalWebFormat);
00790 
00791     // Find out whether to save XPE bitmaps
00792     virtual BOOL GetSaveXPEBitmaps(); 
00793     virtual BOOL SetSaveXPEBitmaps(BOOL NewSaveXPEBitmaps);
00794 
00795     // Find out whether the user wants an HTML tag put on the clipboard
00796     virtual BOOL ShouldExportHTMLTag(); 
00797     virtual BOOL SetHTMLToClipboard(BOOL NewHTMLToClipboard);
00798 
00799 
00800     // Returns the string that lists the fonts you don't need to convert to text
00801     virtual String_256 GetDontConvertTheseFontsToOutlinesString();
00802     
00803     // Returns whether the path similarity checks are on or off when saving native files.
00804     virtual BOOL GetNativeCheckSimilarPaths();
00805     // Returns the tolerence that is used when checking for similar paths in web files.
00806     // It is measured in millipoints.
00807     virtual MILLIPOINT GetWebSimilarPathTolerence();
00808 
00809     // This function allows filters derived from the native format filter to 
00810     // output regular shapes as the specific forms like the Web filter does
00811     virtual BOOL WriteSpecificRegularShapes() { return(FALSE); }
00812 
00813     // This function allows derived filters to cause objects to output
00814     // bounding box records
00815     virtual BoundsWriteLevel GetBoundsWriteLevel() { return(BWL_NONE); }
00816 
00817     // Karim 08/02/2001 Required for saving/loading of shadows.
00818 private:
00819     BOOL PreExportShadows(Node* pRoot);
00820     BOOL PostExportShadows(Node* pRoot);
00821     BOOL PostImportShadows();
00822 };
00823 
00824 #endif  // INC_CAMFILTER

Generated on Sat Nov 10 03:44:38 2007 for Camelot by  doxygen 1.4.4