BaseCamelotFilter Class Reference

This filter is for the new web file format which is the minimilistic form of the new version 2 native file filter. Derive off VectorFilter as this is what this file format defines. More...

#include <camfiltr.h>

Inheritance diagram for BaseCamelotFilter:

VectorFilter Filter ListItem CCObject SimpleCCObject CamelotNativeFilter CamelotWebFilter CamelotNULLNativeFilter FlareTemplateFilter PluginNativeFilter CamelotNULLWebFilter List of all members.

Public Member Functions

 BaseCamelotFilter ()
 Constructor for the base Camelot save/load filter off which are derived the v2 native file and web filters. This filter provides common functionality for these derived filters.
 ~BaseCamelotFilter ()
 Tidies up when the filter is destroyed.
virtual BOOL Init ()
 Initalises the Filter ready for use. Will fail if it can not get enough memory to work with. This is the base class filter and so should be overridden by the derived classes.
virtual void Deinit ()
 Deinits the filter when the program shuts down.
virtual INT32 HowCompatible (PathName &Filename, ADDR HeaderStart, UINT32 HeaderSize, UINT32 FileSize)
virtual INT32 HowCompatibleIsFileType (char *pFileType)=0
virtual BOOL DoExport (Operation *, CCLexFile *, PathName *, Document *, BOOL)
 Exports the current document out to file. Uses the virtual functions of this class. Do not override unless really necessary.
virtual BOOL DoImport (SelOperation *, CCLexFile *, Document *, BOOL AutoChosen=FALSE, ImportPosition *Pos=NULL, KernelBitmap **ppImportedBitmap=NULL, DocCoord *pPosTranslate=NULL, String_256 *=NULL)
 Read the data from the specified file.
virtual BOOL IsWebFilter ()=0
virtual BOOL IsCompactNativeFilter ()=0
virtual BOOL IsImporting ()
 Used to see if the doc is being imported into an existing doc, loaded into a fresh doc.
virtual BOOL IsImportingAtPosition ()
 This will return TRUE only if we are importing into an existing doc AND at a specific position.
virtual BOOL IsDefaultDocRequired (const TCHAR *pcszPathName)
 Works out if opening a file of this type requires a default document to be loaded. If the file format supplies the document then return FALSE otherwise return TRUE. An example would be opening a bitmap file. This has no document defined in the file format and so we need to load the default document before importing the bitmap into this file. In this baseclass version return FALSE and hence assume that the filters that need to will override this function to return TRUE.
virtual INT32 GetMaxPathLookUp ()
 The max number pf paths that should be looked at by the function FindSimilarPath().
INT32 StartRecord (UINT32 Tag, INT32 Size)
INT32 StartStreamedRecord (UINT32 Tag, INT32 Size)
BOOL EndRecord ()
BOOL EndStreamedRecord ()
UINT32 GetRecordTag ()
INT32 GetRecordNum ()
void SetCoordOrigin (const DocCoord &Origin)
 Sets the origin for all coords that are written to or read from the file.
DocCoord GetCoordOrigin ()
 The Get function.
BOOL Write (BYTE b)
BOOL Write (UINT32 n)
BOOL Write (INT32 n)
BOOL Write (const DocCoord &Coord)
BOOL Write (TCHAR *pStr)
BOOL Write (BYTE *pBuf, UINT32 BufSize)
BOOL Write (FLOAT f)
BOOL WriteWCHAR (WCHAR w)
BOOL WriteASCII (TCHAR *pStr)
BOOL WriteUnicode (TCHAR *pStr)
BOOL WriteZeroSizedRecord (UINT32 Tag)
 Helper function that makes it easy to write out a zero-sized record.
UINT32 Write (CXaraFileRecord *pRecord)
UINT32 WriteDefinitionRecord (CXaraFileRecord *pRecord)
BOOL WriteCCPanose (const CCPanose &Panose)
INT32 WriteFontDefinition (WORD FontHandle, BOOL IsBold, BOOL IsItalic)
 Writes a font definition record to the file, and returns with the record number of the record.
BOOL WriteBitmapSource (const BitmapSource &Source, UINT32 Height)
INT32 WriteRecord (DocColour *pDocColour)
 Writes out the given colour to the file, returning the record number.
INT32 WriteRecord (KernelBitmap *pBitmap)
 Writes out the given bitmap to the file, returning the record number.
ColourListComponentGetColourDocComponent ()
BitmapListComponentGetBitmapDocComponent ()
UnitListComponentGetUnitDocComponent ()
DocInfoComponentGetDocInfoComponent ()
ViewComponentGetViewDocComponent ()
PrintComponentGetPrintComponent ()
FontComponentGetFontComponent ()
FilePos GetFilePos ()
UINT32 GetNumBytesWritten ()
virtual DocumentGetDocument ()
virtual SpreadGetSpread ()
virtual void GotError (UINT32 errorID)
 Sets an error using the given resource string All it does is call the mirror function in the attached CXaraFile.
virtual void GotError (UINT32 errorID, const TCHAR *errorString)
 Sets an error using the given resource string All it does is call the mirror function in the attached CXaraFile.
virtual void EndOfFile ()
virtual void SetTotalNumBytesToRead (UINT32 s)
virtual BOOL InvalidateRegion (Node *pNode)
 Invalidates the area of the document covered by the node, causing it to redraw.
virtual UINT32 GetCurrentRecordSize ()
 Function to get the current size of the record that has been read in by the CXaraFile and RecordHandlers and are currently processing. This can be used by streamed record handlers, such as bitmaps, which need to know the size of the recordso that they can update the progress bar size by a proportion of this amount on loading. (Not require on saving as the streamed record handlers can supply what value they like to the progress system and hence update with whatever value they require.
virtual BOOL InsertNode (Node *pNode)
 This inserts the given node relative to the current context node.
virtual BOOL IncInsertLevel ()
 Tells the tree building system that the next nodes should be added to the next level of the tree.
virtual BOOL DecInsertLevel ()
 Tells the tree building system that the next nodes should be added to the previous level of the tree.
virtual NodeGetInsertContextNode ()
 Returns the node to add the next node to.
virtual void SetInsertContextNode (Node *pNode)
 Sets the context node to the node provided.
virtual void InsertNextNodeAsChild ()
 This call ensures that the next node inserted via InsertNode() will be inserted as a child of the context node.
virtual void InsertNextNodeAsSibling ()
 This call ensures that the next node inserted via InsertNode() will be inserted as a sibling of the context node.
virtual InsertTreeContextGetInsertContext (void)
 If you wish to use SetInsertcontextNode to alter where the filter imports to, then chances are you'll want to save & restore the insertion state so that subsequent importing can continue where it left off. If this is the case, bracket your subtree import with code like this: InsertTreeContext *pContext = pFilter->GetInsertContext(); ... import your subtree or whatever ... pFilter->RestoreInsertContext(pContext);.
virtual void RestoreInsertContext (InsertTreeContext *pOldState)
 If you wish to use SetInsertcontextNode to alter where the filter imports to, then chances are you'll want to save & restore the insertion state so that subsequent importing can continue where it left off. If this is the case, bracket your subtree import with code like this: InsertTreeContext *pContext = pFilter->GetInsertContext(); ... import your subtree or whatever ... pFilter->RestoreInsertContext(pContext);.
virtual BOOL IncProgressBarCount (UINT32 n)
 Func to incrementing the progress bar count. If there is a progress bar available, it is updated by this call. Scope: Protected.
virtual UINT32 GetProgressBarCount ()
virtual BOOL SetTotalProgressBarCount (UINT32 n)
 Func to set total the progress bar count. If there is a progress bar available, it is updated by this call. Scope: Protected.
virtual WebPrefsDlgParamGetCachedExportOptions ()
BOOL UnrecognisedTag (UINT32 Tag)
 Informs the filter that it didn't recognise the given tag.
BOOL MergeSameNamedLayers ()
 We have imported layers of the same name in the document. Merge these layers together and if these layers are the special rollover layers make these button and bar names unique. See Also: SliceHelper::MeshImportedLayersWithExistingButtonBars.
void AppendWarning (UINT32 WarningId)
 Appends a warning saying that it's come across some data it doesn't recognise. This allows the user to be warned about things like:- bitmap definitions not being loaded colour definitions not being loaded.
virtual BOOL WriteNodes (Node *pNode)
 This is the main tree traversal routine that writes out the document in the v2 file format.
virtual BOOL WriteNodeAndSubNodes (Node *pNode)
 This recursively writes the document, asking each node to write itself out, in the correct renderable order.
virtual BOOL ReadPostChildren (Node *pNode)
 Informs a node that all its children have been imported Calls either the Native or Web varient of the function, depending on the type of filter this is.
virtual BOOL ReadFileUntil (INT32 tag)
 Reads in the file until the specified tag is hit.
virtual char * GetExportFileType ()=0
virtual void SetImportFileType (char *pFileType)
 Sets the file type of the imported file.
virtual BOOL IsOpeningMinimalWebFormat ()
 It will only return TRUE if the file is the minimal web format, and we are OPENING the file and NOT importing it into a new document.
SelOperationGetImportSelOp () const
void AddAtomicTag (AtomicTagListItem *pItem)
 Adds the item to the list of atomic tags compiled during import.
void AddEssentialTag (EssentialTagListItem *pItem)
 Adds the item to the list of Essential tags compiled during import.
BOOL IsTagInAtomicList (UINT32 Tag)
 Searches the atomic tag list to see of the given tag is in the list.
BOOL IsTagInEssentialList (UINT32 Tag)
 Searches the Essential tag list to see of the given tag is in the list.
TagDescriptionListItemGetTagDescription (UINT32 Tag)
 Searches the tag description list to see of the given tag is in the list.
virtual void AddTagDescription (UINT32 Tag, UINT32 ID)
 Adds the description for the given tag export.
BOOL SetDocumentNudgeSize (UINT32 newVal)
 Sets the nudge size for the current document.
virtual void WriteTagDescriptionRecord ()
 WEBSTER - markn 11/2/97.
BOOL WriteNudgeSizeRecord ()
 Writes out the documents nudge size.
BOOL WriteBitmapSmoothingRecord ()
 Writes out the document's bitmap smoothing setting. The first byte is a flags byte. LSB bitmap smoothing flag bits 2-8 reserved There are 4 reserved bytes for future use (other bitmap settings).
BOOL WriteDuplicationOffsetRecord ()
 Writes out the documents duplication offset.
BOOL WriteRemainingAtomicTagDefinitions ()
 All compound nodes (e.g. bevels, contours, shadows, clipview) are now defined as being atomic. This is so that they can be backwards compatible with CX2.
UINT32 WriteXPEBitmapPlaceHolder (String_256 &strBitmapName)
 Writes out an XPE placeholder record to notify the loader to regenerate the bitmap from the XPE info in the bitmap properties.
virtual BOOL AddTagDescription (TagDescriptionListItem *pItem)
 Adds the item to the list of tag descriptions compiled during import or export.
virtual void AddPathRecordRefToList (NodePath *pNodePath, UINT32 RecordNumber)
 Adds a path record reference to the list.
virtual UINT32 FindPathRecordRefRecordNumber (NodePath *pNodePath)
 Finds the record number for the given path.
virtual NodePathFindPathRecordRefPath (UINT32 RecordNumber)
 Finds the path for the given record number.
virtual BOOL FindSimilarPath (NodePath *pPath, UINT32 *pOtherPathRecNum, Matrix *pTransform)
 Finds a similar path to the one provided that has previously been output to the file.
virtual double GetSimilarPathTolerance (NodePath *pPath)=0
virtual void AddNodeGroupRefToList (Node *pNode, NodeGroup *pGroup)
 Adds a text story group reference to the listFinds the group associated with the text storyFinds the text story associated with the groupAdds a node/group reference to the list.
virtual NodeGroupFindGroupForThisNode (Node *pNode)
 Finds the group associated with the node.
virtual BOOL WriteNodeAsOutlines (Node *pNode)
 Converts the node into a group of paths, and then outputs that group to the filter.
BOOL SetLastRecordHandler (CXaraFileRecordHandler *pHandler, UINT32 Tag)
 Sets the handler used to handle the last record that was imported. It also sets the tag value of the last handled record.
DocumentGetLastDocumentInserted ()
ChapterGetLastChapterInserted ()
SpreadGetLastSpreadInserted ()
LayerGetLastLayerInserted ()
NodePathGetLastNodePathInserted ()
NodeAttributeGetLastCurrentAttrInserted ()
void SetLastDocumentInserted (Document *pNode)
void SetLastChapterInserted (Chapter *pNode)
void SetLastSpreadInserted (Spread *pNode)
void SetLastLayerInserted (Layer *pNode)
void SetLastNodePathInserted (NodePath *pNode)
void SetLastCurrentAttrInserted (NodeAttribute *pNode)
UINT32 GetDocumentInsertedCount ()
UINT32 GetChapterInsertedCount ()
UINT32 GetSpreadInsertedCount ()
UINT32 GetLayerInsertedCount ()
UINT32 GetSetSentinelInsertedCount ()
void IncDocumentInsertedCount ()
void IncChapterInsertedCount ()
void IncSpreadInsertedCount ()
void IncLayerInsertedCount ()
void IncSetSentinelInsertedCount ()
virtual void ExportHTMLTag (PathName *ppthToUse)
 Exports an HTML tag to the clipboard that can be used in a page of HTML to embed the file that is being exported.
virtual void SetInsertMode (InsertMode newInsertMode, CCRuntimeClass *pAttrGroup=NULL)
 Set Mode for AttachNode function.
virtual InsertMode GetInsertMode ()
virtual SelectionType GetSelType ()
virtual void SetSelType (SelectionType ThisSelType)
virtual LayerGetFirstImportedLayer ()
virtual void SetFirstImportedLayer (Layer *pLayer)
virtual BOOL SetCompression (BOOL NewState)
 Function to turn Compression on or off on the underlying CCFile.
virtual BOOL StartCompression ()
 Function to turn Compression on when we are writing to the file. It asks the underlying CCFile and CXaraFile to start the compression process up.
virtual BOOL StopCompression ()
 Function to turn Compression off when we are writing to the file. It asks the underlying CCFile and CXaraFile to stop the compression process.
virtual BOOL SetPreCompression (UINT32 Flags)
 Sets the precompression used in this file.
virtual UINT32 GetPreCompression ()
virtual CCLexFileGetCCFile ()
 Function to give public access to the underlying CCFile that is being used to save out the data. Note: only people who have a genuine reason need to access this - e.g. bitmap savers.
virtual INT32 GetBitmapCompression ()
 Public access to the current bitmap compression which the user has requested to use when saving bitmaps in the web format. 0 means maximum compression e.g. use JPEG filter at 0% lossy compression 100 means minimum compression e.g. use JPEG filter at 100% lossy compression 101 - 200 means lossless compression e.g. us PNG filter. Could use the no bitmap compression at all e.g. use BMP filter. Unused at present. (Very much like the JPEG compression percentage). Note: Virtual so that can be overriden in native filter to save in the proper native state.
virtual INT32 SetBitmapCompression (INT32 NewBmpComp)
 Set up a new state for the the current bitmap compression. 200 = no compression, 0 = full compression. (Very much like the JPEG compression percentage).
virtual BOOL GetPreviewBitmapExport ()
 Public access to the current export preview bitmap which the user has requested to use when saving bitmaps in the web format. True means export a preview bitmap, False means do not. Note: Virtual so that can be overriden in native filter to save in the proper native state.
virtual BOOL SetPreviewBitmapExport (BOOL NewExportPreviewBmp)
 Set up a new state for the the current export preview bitmap. True means export a preview bitmap, False means do not.
virtual BOOL GetConvertTextToOutlines ()
 Public access to the current convert text to outlines which the user has requested to use when saving in the web format. True means convert text to outlines, False means do not. Note: Virtual so that can be overriden in native filter to save in the proper native state.
virtual BOOL SetConvertTextToOutlines (BOOL NewConvertTextToOutlines)
 Set up a new state for the the convert text to outlines. True means convert text to outlines, False means do not.
virtual BOOL GetConvertBlendsToOutlines ()
 Public access to the current convert text to outlines which the user has requested to use when saving in the web format. True means convert blends to outlines, False means do not.
virtual BOOL SetConvertBlendsToOutlines (BOOL NewConvertBlendsToOutlines)
 Set up a new state for the the convert blends to outlines. True means convert blends to outlines, False means do not.
virtual BOOL GetRemoveInvisibleLayers ()
 Public access to the current remove invisible layers which the user has requested to use when saving in the web format. True means remove invisible layers, False means do not. Note: Virtual so that can be overriden in native filter to save in the proper native state.
virtual BOOL SetRemoveInvisibleLayers (BOOL NewRemoveInvisibleLayers)
 Set up a new state for the the remove invisible layers. True means remove invisible layers, False means do not.
virtual BOOL GetRemoveUnusedColours ()
 Public access to the current remove unused colours which the user has requested to use when saving in the web format. True means remove unused colours, False means do not. Note: Virtual so that can be overriden in native filter to save in the proper native state.
virtual BOOL SetRemoveUnusedColours (BOOL NewRemoveUnusedColours)
 Set up a new state for the the remove unused colours. True means remove unused colours, False means do not.
virtual BOOL GetMinimalWebFormat ()
 Public access function.
virtual BOOL SetMinimalWebFormat (BOOL NewMinimalWebFormat)
 Set up a new state for the min web format flag.
virtual BOOL GetSaveXPEBitmaps ()
 Public access function.
virtual BOOL SetSaveXPEBitmaps (BOOL NewSaveXPEBitmaps)
 Set up a new state for the save XPE bitmaps flag.
virtual BOOL ShouldExportHTMLTag ()
 Public access to the HTML to clipboard.
virtual BOOL SetHTMLToClipboard (BOOL NewHTMLToClipboard)
 Set a new state for HTMLToClipboard.
virtual String_256 GetDontConvertTheseFontsToOutlinesString ()
 Access func to that fint list dude.
virtual BOOL GetNativeCheckSimilarPaths ()
 Public access to the current Native check similar paths flag setting.
virtual MILLIPOINT GetWebSimilarPathTolerence ()
 Public access to the current Web similar path tolerence setting. It is measured in millipoints.
virtual BOOL WriteSpecificRegularShapes ()
virtual BoundsWriteLevel GetBoundsWriteLevel ()

Static Public Member Functions

static BOOL SkipToPreviewBitmap (CCLexFile *pFile, BOOL *IsNewNativeFile, UINT32 *pFilterId=NULL)
 Function used by the gallery thumb nail code to check the file is the native/web format and then get to the preview bitmap record and leave the file pointer sitting at the bitmap image. Assumes file is already opened and ready for reading at the start of the file. Notes: Added pFilterId argument for open dialog Martin-20/01/97.
static BOOL SkipToIndexInformation (CCLexFile *pFile, String_256 *pString, BOOL *IsNewNativeFile)
 Function used by the gallery index generation code to check the file is the native/web format and then get to the index information record. Assumes file is already opened and ready for reading at the start of the file. Could share some common functionality with the above but we need speed so just duplicate the code. This function must also be different as we need to use the CXaraFile code as we need to read the string from the document comment record. Hence, we can get this to do some of the work such as checking the id is present etc.
static BOOL WritePathsInRelativeFormat ()
static ListGetRecordHandlers ()
static BOOL SetNativeCompression (BOOL NewState)
 Set the preference as to whether we are to compress the native files or not.
static BOOL GetNativeCompression ()
 Set the prefernece as to whether we are to compress the native files or not.
static BOOL ShouldSaveXPEBitmaps ()
 Find out whether we should save XPE bitmap data or just the information needed to rebuild the bitmap.

Static Public Attributes

static String_256 DefaultExportPath
 String to hold the default path for the optional web export path.
static BOOL ExportWebFile = TRUE
 Flag for whether the user has requested to export a web file when native saving.

Protected Member Functions

void AppendIgnoredDataWarning (UINT32 Tag)
 Appends a warning saying that it's come across some data it doesn't recognise.
void UnkownEssentialDataError (UINT32 Tag)
 Errors that a tag is not recognised, yet it is an essential tag (i.e. one that must be recognised in order to load the file correctly).
virtual BOOL StartProgressBar (String_64 *pMessage)
 Starts up the progress bar. If it fails it returns FALSE, but it's no problem if you continue - i.e. you shouldn't about import/export just because you can't get a progress bar going.
virtual void EndProgressBar ()
 If a progress bar already exists, it's deleted.
virtual void ResetImportExportVars ()
 Resets all the vars that are common to both import & export. This should be the last thing that's called when import/export has finished.
virtual BOOL PrepareImportExportVars ()
 Prepares all the vars that are common to both import & export. This should be the first thing that's called when import/export starts.
virtual CXaraFileCreateCXaraFile ()
 This is a central place where the CXaraFile object is created. It is a virtual func to allow derived classes to create different flavours of CXaraFile.
virtual BaseCamelotFilterCreateNULLFilter (Document *pDocument)=0
virtual BOOL PrepareToExport (CCLexFile *pFile)
 Gets things ready for the export. This opens the CXaraFile object and writes out the file header.
virtual void CleanUpAfterExport (BOOL Success)
 Cleans up the memory allocated by BaseCamelotFilter::PrepareToExport() - used when the export process ends, either normally or abnormally.
virtual BOOL FindDocComponents ()
 Finds ptrs to all the doc components the filter is interested in. If it can't find all of them, FALSE will be returned.
virtual BOOL StartExportDocComponents (BOOL BeforeCompression)
 Tells all the doc components attached to the document that we are about to export to either the web or native file format.
virtual BOOL EndExportDocComponents (BOOL Success)
 Tells all the doc components attached to the document that we have finished exporting the document.
virtual BOOL BeginDocumentExport ()
 This function is called just before document-related records are written out to the file. EndDocumentExport() is called after all the doc records have been saved.
virtual BOOL EndDocumentExport ()
 This function is called after document-related records have been are written out to the file. BeginDocumentExport() is called before the doc records are saved.
virtual NodeGetExportNode ()
 Returns a pointer to the first node to export.
virtual BOOL WriteDocument (Operation *pExportOp)
 Exports the document pointed to by TheDocument.
virtual BOOL WritePreChildren (Node *pNode)
 Asks the node to write itself out. Calls either the Native or Web varient of the function, depending on the type of filter this is.
virtual BOOL CanWriteChildren (Node *pNode)
 Asks the node if it's OK to automatically write out its children. Calls either the Native or Web varient of the function, depending on the type of filter this is.
virtual BOOL WritePostChildren (Node *pNode)
 Asks the node to write itself out. Calls either the Native or Web varient of the function, depending on the type of filter this is.
virtual BOOL WriteBeginChildRecords (Node *pNode)
 Informs a node that its child records are about to be written Calls either the Native or Web varient of the function, depending on the type of filter this is.
virtual BOOL WriteEndChildRecords (Node *pNode)
 Informs a node that its child records have been written Calls either the Native or Web varient of the function, depending on the type of filter this is.
virtual BOOL WriteCurrentAttributes ()
 Write out all current attributes.
virtual BOOL WriteSelectedNodes (Operation *pExportOp, Node *pNode, SelRange *pSelection)
 Exports the selection and any additional nodes required, starting from pNode.
virtual BOOL WriteSelectedLayerAndNodes (Operation *pExportOp, Node *pNode, SelRange *pSelection)
 Exports a layer node and everything selected below it (i.e. all it's selected children) out through the filter.
virtual BOOL WriteHeader ()
 Writes out the header record to the file.
virtual BOOL GetExportOptions (WebPrefsDlgParam *pPrefs)
 Allows the user to be prompted to get information for export. This overriden version returns True so that nothing happens. Scope: Protected.
virtual OpDescriptorGetDialogueOp (void)
 Obtains a pointer to the OpDescriptor to be used to access the relevant export dialogue.
virtual BOOL ExportPreviewBitmap (CCLexFile *pFile, Operation *pOp, PathName *pPath, Document *pDoc)
 Exports a preview bitmap into the file in the correct format.
virtual BOOL CorrectFileHeader (CCLexFile *pFile)
 Corrects the file header so that it contains the correct information now that we have correctly reached the end of the file.
virtual UINT32 CalcExportSize (Document *pDocument)
 Calcs the number of bytes that will be exported to the file. It is used to maintain a progress display.
BOOL InitRecordHandlers ()
 Calls all the record handlers via their BeginImport() function. It also registers the list of handlers with the attached CXaraFile object.
BOOL DeinitRecordHandlers ()
 Calls all the record handlers via their EndImport() function. It also registers the list of handlers with the attached CXaraFile object.
virtual BOOL PrepareToImport (CCLexFile *pFile)
 To get this filter ready to import a file.
virtual void CleanUpAfterImport (BOOL Successful)
 Happens at the end of the import to allow the filters to clean up after themselves.
virtual BOOL PrepareTreeBuilding ()
 This does the setting up of the tree building functions (InsertNode(), etc).
virtual void CleanUpTreeBuilding ()
 This deinits the tree building system.
virtual BOOL EnsureFrameLayerIntegrity (Spread *pSpread)
 Happens at the end of the import to allow the layers to be cleaned up. Mainly used by Webster so that we can ensure that frame layers are the order of the day. Do now as the layers are stable and have all their flags present. We cannot decide when we get the layer record as we would need to wait until we have the layer details record. Then this would not be the complete information until we have seen or not seen as the case may be the frame properties record.
virtual BOOL EnsureLayerIntegrity (Spread *pSpread)
 Happens at the end of the import to allow the layers to be cleaned up. Mainly used by Camelot so that we can see whether we are using a framed document or a layered document. We must check that:-
  • If the document has frame layers in then we must convert all new layers into frames
  • If the document has no frame layers in, then we must convert all frames into layers.

virtual BOOL StartImportDocComponents ()
 Tells all the doc components attached to the document that we are about to Import to either the web or native file format.
virtual BOOL EndImportDocComponents (BOOL Successful)
 Tells all the doc components attached to the document that we have finished Importing the document.
virtual BOOL ReadFile ()
 Reads in the file.
virtual BOOL SetFileCompressionState (BOOL NewState)
 Set a new file compression status into action.
virtual BOOL GetFileCompressionState ()
 Get the current file compression state. True if compressing.
virtual BOOL AttachNode (Node *pNewNode, Node *pContextNode, AttachNodeDirection Direction)
 Attachs one node to another. This will attach the node undoably when it has to. At the mo, insertion is only performed undoably when all the following conditions are met:-.

Static Protected Member Functions

static BOOL CreateRecordHandlers ()
static void DestroyRecordHandlers ()
 Destroys all the record handlers associated with the camelot v2 file format filters.

Protected Attributes

WebPrefsDlgParampPrefs
UINT32 FilterNameID
UINT32 FilterInfoID
UINT32 ExportingMsgID
UINT32 BadFileMsgID
FilePos FileStart
FilePos FileEnd
FilePos FileHeaderRecord
UINT32 FileSize
INT32 CompressionType
BOOL CompressionOn
double FileVersionNumber
double BuildVersionNumber
BOOL EndOfFileFlag
BOOL EscapePressed
NodepInsertContextNode
BOOL InsertNextAsChild
UINT32 InsertLevel
InsertLevelStackpInsertLevelStack
CXaraFilepCXaraFile
ColourListComponentpColComponent
BitmapListComponentpBmpComponent
UnitListComponentpUnitsComponent
DocInfoComponentpInfoComponent
ViewComponentpViewComponent
PrintComponentpPrintComponent
FontComponentpFontComponent
SpreadpTheSpread
struct {
   SelOperation *   pOp
   ImportPosition *   pPos
ImportInfo
UINT32 ProgressBarCount
ProgresspProgress
String_64 ProgressBarMessage
UINT32 TotalProgressBarCount

Static Protected Attributes

static List RecordHandlerList
static BOOL RecordHandlersCreated = FALSE
static BOOL PreviewBitmapExport = FALSE
 Flag for whether the user has requested a preview bitmap when exporting as a web file. True means do export a preview bitmap.
static INT32 BitmapCompression = 75
 How much compression the user has requested when saving bitmaps. 0 means maximum compression e.g. use JPEG filter at 0% lossy compression 99 means minimum compression e.g. use JPEG filter at 99% lossy compression 101 - 201 means lossless compression e.g. us PNG filter. Range stores the old compression setting. Could use the BMPZIP filter instead. (Very much like the JPEG compression percentage).
static BOOL CompressNative = TRUE
 Flag for whether we compress the native files saved from Xara Studio. True means do compress the files.
static BOOL SaveXPEBitmaps = FALSE
 Flag for whether we compress the native files saved from Xara Studio. True means do save the XPE bitmaps. False means don't save them, just save the XPE info and rebuild when loading.
static BOOL ConvertTextToOutlines = FALSE
 Flag for whether the user has requested a convert text to outlines when exporting as a web file. True means do convert text to outlines.
static INT32 PreviewBitmapFilterType = 1
 What type of preview bitmap filter we should be using when exporting as a web or native file. 0 - means BMP. 1 - means GIF. 2 - means JPEG. 3 - means PNG. 4 - means TIFF.
static BOOL RemoveInvisibleLayers = 1
 Whether invisible layers should be removed or not when exporting as a web or native file.
static BOOL RemoveUnusedColours = TRUE
 Whether unused colours should be removed or not when exporting as a web or native file.
static BOOL HTMLToClipboard = FALSE
 Whether to export an HTML tag to the clipboard when exporting a Web file.
static BOOL MinimalWebFormat = 0
 Whether we should use the minimal web format or not when exporting as a web file. The alternative is to be a lot closer to native format.
static BOOL WriteRelativePaths = 1
 When this is 1, all paths will be written out in a relative format 0 means use an absolute format.
static String_256 DontConvertTheseFontsToOutlines
 This string defines the list of font typefaces that won't be converted to outlines when exporting to the web format.
static BOOL NativeCheckSimilarPaths = 0
 When this is 1, the default, paths will be checked for similarities during saving. When 0 this check is not made.
static INT32 WebSimilarPathTolerence = 200
 This determines the tolerence that is used when checking for similar paths in web files. It is measured in millipoints.
static BOOL ConvertBlendsToOutlines = FALSE
 Flag for whether the user has requested a convert text to outlines when exporting as a web file. True means do convert text to outlines.
static BOOL ImportNonFramesOntoActivelayer = TRUE
 When this is 1, the default, import of non-frame layers will happen onto the active layer. When 0, import of non-frame layers will be onto the first non-frame layer in the import.

Private Member Functions

 CC_DECLARE_DYNAMIC (BaseCamelotFilter)
void UpdateLastSafeToRenderNode (Node *pNode)
BOOL IsThisASelectedTemplate (Node *pNode)
 Determines whether or not this node is a selected template node.
BOOL DeleteNode (Node *pNode)
 deletes the given node by removing it from the tree
BOOL PreExportShadows (Node *pRoot)
 Prep shadows for export. We do the following steps:.
BOOL PostExportShadows (Node *pRoot)
 Repair the document tree after shadow export. We do the following steps:.
BOOL PostImportShadows ()
 We factor out common attributes on all NodeShadowControllers in the document.

Private Attributes

NodepLastUnsafeToRenderNode
String_256 IgnoredDataString
String_256 WarningsString
char ImportFileType [4]
AtomicTagListpAtomicTagList
EssentialTagListpEssentialTagList
TagDescriptionListpTagDescriptionList
CXaraFilePathRecordRefListpPathRecordRefList
CXaraFileNodeGroupRefListpNodeGroupRefList
DocumentpLastDocument
ChapterpLastChapter
SpreadpLastSpread
LayerpLastLayer
NodePathpLastNodePath
NodeAttributepLastCurrentAttr
UINT32 DocumentCount
UINT32 ChapterCount
UINT32 SpreadCount
UINT32 LayerCount
UINT32 SetSentinelCount
LayerpImportLayer
UINT32 PreCompFlags
InsertMode m_InsertMode
CCRuntimeClassm_pCurrentAttrGroup
DocCoord CoordOrigin
Layerm_pFirstImportedLayer
Layerm_pActiveLayerBeforeImport
SelectionType SelType

Detailed Description

This filter is for the new web file format which is the minimilistic form of the new version 2 native file filter. Derive off VectorFilter as this is what this file format defines.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/5/96

Definition at line 201 of file camfiltr.h.


Constructor & Destructor Documentation

BaseCamelotFilter::BaseCamelotFilter  ) 
 

Constructor for the base Camelot save/load filter off which are derived the v2 native file and web filters. This filter provides common functionality for these derived filters.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/5/96

Definition at line 607 of file camfiltr.cpp.

00608 {
00609     // We are a hidden filter which just contains common functionality
00610     // This filter should never be set up or seen, the derived classes just use it.
00611 
00612     // Items to handle the file compression
00613     CompressionType = 0;    // type of compression in use (0 at present)
00614     CompressionOn   = FALSE;// on/off flag
00615 
00616     FileVersionNumber   = 0.0;
00617     BuildVersionNumber  = 0.0;
00618 
00619     pColComponent   = NULL;
00620     pBmpComponent   = NULL;
00621     pUnitsComponent = NULL;
00622     pInfoComponent  = NULL;
00623     pViewComponent  = NULL;
00624     pPrintComponent = NULL;
00625     pFontComponent  = NULL;
00626     
00627     pTheSpread      = NULL;
00628 
00629     pUnitsComponent = NULL;
00630     pInfoComponent  = NULL;
00631 
00632     pInsertContextNode  = NULL;
00633     InsertNextAsChild   = FALSE;
00634     pInsertLevelStack   = NULL;
00635 
00636     pCXaraFile              = NULL;
00637     pProgress               = NULL;
00638     ProgressBarCount        = 0;
00639     TotalProgressBarCount   = 0;
00640 
00641     pPrefs = NULL;
00642 
00643     CoordOrigin = DocCoord(0,0);    // Zero origin
00644 
00645     pLastDocument       = NULL;
00646     pLastChapter        = NULL;
00647     pLastSpread         = NULL;
00648     pLastLayer          = NULL;
00649     pLastNodePath       = NULL;
00650     pLastCurrentAttr    = NULL;
00651     DocumentCount       = 0;
00652     ChapterCount        = 0;
00653     SpreadCount         = 0;
00654     LayerCount          = 0;
00655     SetSentinelCount    = 0;
00656 
00657     pImportLayer = NULL;
00658 
00659     EscapePressed = FALSE;
00660 
00661     pAtomicTagList      = NULL;
00662     pEssentialTagList   = NULL;
00663     pTagDescriptionList = NULL;
00664 
00665     pPathRecordRefList  = NULL;
00666 // WEBSTER - markn 31/1/97
00667 // Replaced with general system
00668 //  pTextStoryGroupRefList = NULL;
00669 
00670     // WEBSTER - markn 29/1/97
00671     // Part of the general form of the system used to convert text to outlines in v1.5
00672     pNodeGroupRefList = NULL;
00673 
00674     PreCompFlags = 0;
00675 
00676     // WEBSTER - markn 15/2/97
00677     // Bug fix for selection type save option
00678     SelType = DRAWING;
00679 
00680     // reset our import layer variables
00681     m_pFirstImportedLayer       = NULL;
00682     m_pActiveLayerBeforeImport  = NULL;
00683 
00684     // Make sure this is safely initialised as NodeSetSentinel hackery relies on it
00685     // being null except when really in use.
00686     ImportInfo.pOp = 0;
00687 
00688     // State variables that help to switch functionality of AttachNode from adding nodes
00689     // to the tree to making current attributes
00690     // Used by Current Attribute loading mechanism
00691     m_InsertMode            = INSERTMODE_ATTACHTOTREE;
00692     m_pCurrentAttrGroup = NULL;
00693 }

BaseCamelotFilter::~BaseCamelotFilter  ) 
 

Tidies up when the filter is destroyed.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/5/96

Definition at line 706 of file camfiltr.cpp.

00707 {
00708     ResetImportExportVars();
00709 //  DestroyRecordHandlers();
00710 
00711     // If we have our preferences class present, then destory it
00712 #ifdef DO_EXPORT
00713     if (pPrefs)
00714     {
00715         PORTNOTETRACE("other","BaseCamelotFilter::~BaseCamelotFilter - removed delete pPrefs");
00716 #ifndef EXCLUDE_FROM_XARALX
00717         delete pPrefs;
00718 #endif
00719         pPrefs = NULL;
00720     }
00721 #endif
00722 }


Member Function Documentation

void BaseCamelotFilter::AddAtomicTag AtomicTagListItem pItem  ) 
 

Adds the item to the list of atomic tags compiled during import.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/8/96
Parameters:
pItem = ptr to an atomic list item [INPUTS]
Returns:
-
See also:
BaseCamelotFilter::PrepareToImport; BaseCamelotFilter::DoImport Scope: Protected

Definition at line 6636 of file camfiltr.cpp.

06637 {
06638     if (pAtomicTagList == NULL)
06639         pAtomicTagList = new AtomicTagList;
06640 
06641     if (pAtomicTagList != NULL)
06642         pAtomicTagList->AddTail(pItem);
06643 }

void BaseCamelotFilter::AddEssentialTag EssentialTagListItem pItem  ) 
 

Adds the item to the list of Essential tags compiled during import.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/8/96
Parameters:
pItem = ptr to an Essential list item [INPUTS]
Returns:
-
See also:
BaseCamelotFilter::PrepareToImport; BaseCamelotFilter::DoImport Scope: Protected

Definition at line 6660 of file camfiltr.cpp.

06661 {
06662     if (pEssentialTagList == NULL)
06663         pEssentialTagList = new EssentialTagList;
06664 
06665     if (pEssentialTagList != NULL)
06666         pEssentialTagList->AddTail(pItem);
06667 }

void BaseCamelotFilter::AddNodeGroupRefToList Node pNode,
NodeGroup pGroup
[virtual]
 

Adds a text story group reference to the listFinds the group associated with the text storyFinds the text story associated with the groupAdds a node/group reference to the list.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/1/97
Parameters:
pNode = ptr to a node in the tree [INPUTS] pGroup = ptr to a group of paths that represent the node, which is not linked into the tree
Returns:
-
WEBSTER - markn 29/1/97 Part of the general form of the system used to convert text to outlines in v1.5

See also:
BaseCamelotFilter::PrepareToImport; BaseCamelotFilter::DoImport Scope: Protected

Reimplemented in CamelotNULLNativeFilter, and CamelotNULLWebFilter.

Definition at line 7545 of file camfiltr.cpp.

07546 {
07547     ERROR3IF(pNode  == NULL,"Null node entry param");
07548     ERROR3IF(pGroup == NULL,"Null node group entry param");
07549 
07550     if (pNodeGroupRefList == NULL)
07551         pNodeGroupRefList = new CXaraFileNodeGroupRefList;
07552 
07553     if (pNodeGroupRefList != NULL)
07554     {
07555         CXaraFileNodeGroupRefListItem* pItem = new CXaraFileNodeGroupRefListItem(pNode,pGroup);
07556         if (pItem != NULL)
07557             pNodeGroupRefList->AddTail(pItem);
07558     }
07559 }

void BaseCamelotFilter::AddPathRecordRefToList NodePath pNodePath,
UINT32  RecordNumber
[virtual]
 

Adds a path record reference to the list.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/8/96
Parameters:
pNodePath = ptr to a node path object [INPUTS] RecordNumber = the record number of the record that holds this path
Returns:
-
See also:
BaseCamelotFilter::PrepareToImport; BaseCamelotFilter::DoImport Scope: Protected

Definition at line 7142 of file camfiltr.cpp.

07143 {
07144     ERROR3IF(pNodePath == NULL,"Null entry param");
07145     ERROR3IF(RecordNumber == 0,"Zero entry record number");
07146 
07147     if (pPathRecordRefList == NULL)
07148         pPathRecordRefList = new CXaraFilePathRecordRefList;
07149 
07150     if (pPathRecordRefList != NULL)
07151     {
07152         CXaraFilePathRecordRefListItem* pItem = new CXaraFilePathRecordRefListItem(pNodePath,RecordNumber);
07153         if (pItem != NULL)
07154             pPathRecordRefList->AddTail(pItem);
07155     }
07156 }

BOOL BaseCamelotFilter::AddTagDescription TagDescriptionListItem pItem  )  [virtual]
 

Adds the item to the list of tag descriptions compiled during import or export.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/8/96
Parameters:
pItem = ptr to an Essential list item (if NULL it is just ignored_ [INPUTS]
Returns:
TRUE if added, FALSE if not
WEBSTER - markn 11/2/97 Doesn't add a description if it's already there, and returns FALSE in this case. Also it copes nicely with a null pItem ptr

Graeme (8-2-00) - Changed Mark's code so that repeated tags don't return FALSE, but are simply ignored. This fixes a problem that they're causing with some WebStyle templates.

See also:
BaseCamelotFilter::PrepareToImport; BaseCamelotFilter::DoImport Scope: Protected

Definition at line 6692 of file camfiltr.cpp.

06693 {
06694     // WEBSTER - markn 11/2/96
06695     // Check to see if a description for this tag has already been added
06696     if ( pItem != NULL )
06697     {
06698         if (pTagDescriptionList == NULL)
06699             pTagDescriptionList = new TagDescriptionList;
06700 
06701         if (pTagDescriptionList != NULL)
06702         {
06703             // Graeme (8-2-00) - Moved the GetTagDescription line here, so that items are
06704             // only added if they're not a repeated tag. This should maintain compatability,
06705             // and prevent the errors being thrown as before.
06706             if ( GetTagDescription ( pItem->GetTag () ) == NULL )
06707             {
06708                 pTagDescriptionList->AddTail(pItem);
06709             }
06710             else
06711             {
06712                 // MRH 10/5/00 - If we`re skipping it then we should be deleting it !!!
06713                 delete pItem;
06714                 pItem = NULL;
06715             }
06716 
06717             return TRUE;
06718         }
06719     }
06720 
06721     return FALSE;
06722 }

void BaseCamelotFilter::AddTagDescription UINT32  Tag,
UINT32  ID
[virtual]
 

Adds the description for the given tag export.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/2/97
Parameters:
Tag = tag of the record you're describing [INPUTS] ID = string ID of the resourced description text
Returns:
-
WEBSTER - markn 11/2/97

See also:
BaseCamelotFilter::PrepareToImport; BaseCamelotFilter::DoImport Scope: Protected

Reimplemented in CamelotNULLNativeFilter, and CamelotNULLWebFilter.

Definition at line 6764 of file camfiltr.cpp.

06765 {
06766     String_256* pDesc = new String_256(ID);
06767     if (pDesc != NULL)
06768     {
06769         TagDescriptionListItem* pItem = new TagDescriptionListItem(Tag,pDesc);
06770         if (pItem != NULL)
06771         {
06772             if (!AddTagDescription(pItem))
06773                 delete pItem;
06774         }
06775     }
06776 }

void BaseCamelotFilter::AppendIgnoredDataWarning UINT32  Tag  )  [protected]
 

Appends a warning saying that it's come across some data it doesn't recognise.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/8/96
Parameters:
Tag = tag of the record not recognised [INPUTS]
Returns:
-
See also:
BaseCamelotFilter::PrepareToExport; BaseCamelotFilter::DoExport Scope: Protected

Definition at line 5366 of file camfiltr.cpp.

05367 {
05368     // We will only add items until we are close to the end of the string's capacity.
05369     // Otherwise, seeing half entries will look strange.
05370     if (IgnoredDataString.IsEmpty())
05371         IgnoredDataString = String_256(_R(IDS_TAG_WARNING_IGNORED_DATA));
05372 
05373     String_256 Sep(_R(IDS_TAG_ERROR_LIST_SEP)); 
05374 
05375     TagDescriptionListItem* pDesc = GetTagDescription(Tag);
05376     String_256 Temp;
05377     if (pDesc != NULL && pDesc->GetString() != NULL)
05378         Temp = *(pDesc->GetString());
05379     else
05380         Temp.MakeMsg(_R(IDS_TAG_ERROR_TAG_NUMBER),Tag);
05381     
05382     // Only add it if there is enough room to fit it all in
05383     if (Sep.Length() + Temp.Length() + IgnoredDataString.Length() < IgnoredDataString.MaxLength())
05384     {
05385         IgnoredDataString += Sep;
05386         IgnoredDataString += Temp;
05387     }
05388 }

void BaseCamelotFilter::AppendWarning UINT32  WarningId  ) 
 

Appends a warning saying that it's come across some data it doesn't recognise. This allows the user to be warned about things like:- bitmap definitions not being loaded colour definitions not being loaded.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/8/96
Parameters:
WarningId = id of resource to be added [INPUTS]
Returns:
-
See also:
BaseCamelotFilter::PrepareToExport; BaseCamelotFilter::DoExport Scope: Public

Definition at line 5332 of file camfiltr.cpp.

05333 {
05334     // We will only add items until we are close to the end of the string's capacity.
05335     // Otherwise, seeing half entries will look strange.
05336     if (WarningsString.IsEmpty())
05337         WarningsString = String_256(_R(IDS_NATIVE_DATAWARNING));
05338 
05339     String_256 Sep(_R(IDS_TAG_ERROR_LIST_SEP)); 
05340 
05341     String_256 Temp(WarningId);
05342     // Only add it if there is enough room to fit it all in
05343     if (Sep.Length() + Temp.Length() + WarningsString.Length() < WarningsString.MaxLength())
05344     {
05345         WarningsString += Sep;
05346         WarningsString += Temp;
05347     }
05348 }

BOOL BaseCamelotFilter::AttachNode Node pNewNode,
Node pContextNode,
AttachNodeDirection  Direction
[protected, virtual]
 

Attachs one node to another. This will attach the node undoably when it has to. At the mo, insertion is only performed undoably when all the following conditions are met:-.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/8/96
Parameters:
pNewNode = ptr to node to attach to pContextNode [INPUTS] pContextNode = the context node Direction = how to attach it to pContextNode
Returns:
TRUE if ok, FALSE otherwise
1) We are importing, and not opening the file; 2) pNewNode is a layer, or pContextNode is a NodeSetSentinel and pNewNode is being attached/inserted as a child of it; 3) we have a ptr to an undoable op;

See also:
BaseCamelotFilter::PrepareToImport; BaseCamelotFilter::DoImport Scope: Protected

Definition at line 6265 of file camfiltr.cpp.

06267 {
06268     // JCF: further bodged this already 'orrible bodge to allow undoable attaching of
06269     // child attributes of NodeSetSentinel.
06270     if (IsImporting() && ImportInfo.pOp != 0)
06271     {
06272         // Insert a layer with undo.
06273         if (pNewNode->IsLayer())
06274             return ImportInfo.pOp->DoInsertNewNode((Layer*) pNewNode, pContextNode,
06275                                                    Direction, FALSE);
06276 
06277         // If the context is the sentinel as parent then create a hide action.
06278         else if (IS_A(pContextNode, NodeSetSentinel) &&
06279                     (Direction == FIRSTCHILD || Direction == LASTCHILD))
06280         {
06281             // Attach and create an action to hide the new child when we undo.
06282             HideNodeAction* pHideAct;
06283             pNewNode->AttachNode(pContextNode, Direction);
06284             if (AC_FAIL == HideNodeAction::Init(ImportInfo.pOp,
06285                                                 ImportInfo.pOp->GetUndoActions(),
06286                                                 pNewNode, TRUE, (Action**) &pHideAct))
06287             {
06288                 // Tidy up on fail.
06289                 pNewNode->UnlinkNodeFromTree();
06290                 return FALSE;
06291             }
06292 
06293             return TRUE;
06294         }       
06295     }
06296 
06297     pNewNode->AttachNode(pContextNode, Direction);
06298     return TRUE;
06299 }

BOOL BaseCamelotFilter::BeginDocumentExport  )  [protected, virtual]
 

This function is called just before document-related records are written out to the file. EndDocumentExport() is called after all the doc records have been saved.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/7/96
Parameters:
- [INPUTS]
Returns:
TRUE if successful, FALSE otherwise
This should be called for each document that is saved out to the file.

See also:
BaseCamelotFilter::EndDocumentExport() Scope: Protected

Reimplemented in CamelotNativeFilter, CamelotWebFilter, and PluginNativeFilter.

Definition at line 4888 of file camfiltr.cpp.

04889 {
04890     return TRUE;
04891 }

UINT32 BaseCamelotFilter::CalcExportSize Document pDocument  )  [protected, virtual]
 

Calcs the number of bytes that will be exported to the file. It is used to maintain a progress display.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/6/96
Parameters:
- [INPUTS]
Returns:
The estimated number of bytes that will be exported
See also:
GetExportOptions; PrepareToExport; CleanUpAfterExport;

Definition at line 5181 of file camfiltr.cpp.

05182 {
05183 #ifdef DO_EXPORT
05184     ERROR2IF(pDocument == NULL,0,"pDocument is NULL");
05185 
05186     UINT32 NumBytes = 0;
05187 
05188     BaseCamelotFilter* pFilter = CreateNULLFilter(pDocument);
05189 
05190     if (pFilter != NULL)
05191     {
05192         BOOL ok = TRUE;
05193 
05194         // Prepare to export
05195         if (ok) ok = pFilter->PrepareToExport(NULL);
05196 
05197         // Start doc components (before & after compression)
05198         if (ok) ok = pFilter->StartExportDocComponents(TRUE);
05199         if (ok) ok = pFilter->StartExportDocComponents(FALSE);
05200 
05201         String_64 Str(_R(IDS_PREPARING_TO_SAVE));
05202         if (ok) StartProgressBar(&Str);             // Update status bar
05203         // Export document tree
05204         if (ok) ok = pFilter->WriteDocument(NULL);
05205         if (ok) EndProgressBar();                   // Kill progess bar
05206 
05207         // Tell doc components we have finished
05208         if (ok) ok = pFilter->EndExportDocComponents(TRUE);
05209 
05210         // All done - deallocate dynamic objects and return success.
05211         pFilter->CleanUpAfterExport(ok);
05212 
05213         // Set the main filter's progress total to the final progress count of the NULL filter
05214         SetTotalProgressBarCount(pFilter->GetProgressBarCount());
05215 
05216         delete pFilter;
05217         pFilter = NULL;
05218     }
05219 
05220     return NumBytes;
05221 #else
05222     return 0;
05223 #endif
05224 }

BOOL BaseCamelotFilter::CanWriteChildren Node pNode  )  [protected, virtual]
 

Asks the node if it's OK to automatically write out its children. Calls either the Native or Web varient of the function, depending on the type of filter this is.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/5/96
Parameters:
pNode = ptr to a node to write [INPUTS]
Returns:
TRUE if yes, FALSE if no
See also:
BaseCamelotFilter::PrepareToExport; BaseCamelotFilter::DoExport Scope: Protected

Definition at line 4560 of file camfiltr.cpp.

04561 {
04562 #ifdef DO_EXPORT
04563     if (IsWebFilter())
04564         return pNode->CanWriteChildrenWeb(this);
04565     else
04566         return pNode->CanWriteChildrenNative(this);
04567 #else
04568     return FALSE;
04569 #endif
04570 }

BaseCamelotFilter::CC_DECLARE_DYNAMIC BaseCamelotFilter   )  [private]
 

void BaseCamelotFilter::CleanUpAfterExport BOOL  Success  )  [protected, virtual]
 

Cleans up the memory allocated by BaseCamelotFilter::PrepareToExport() - used when the export process ends, either normally or abnormally.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/5/96
Parameters:
Success - True if everything went swimmingly, False if just a clean up is required. [INPUTS]
See also:
BaseCamelotFilter::PrepareToExport; BaseCamelotFilter::DoExport Scope: Protected

Definition at line 4150 of file camfiltr.cpp.

04151 {
04152 #ifdef DO_EXPORT
04153     // Tell doc components we have finished
04154     // but only if there is a problem as otherwise this should be being called.
04155     // DoExport calls EndExportDocComponents before this as it needs to ensure that all
04156     // document components are exported BEFORE it stops compression so things like unused
04157     // colours are compressed.
04158     // As a double check check to see if the BMP and Colour components are null, if not
04159     // then this indicates the EndExportDocComponents has not been called.
04160     // CalcExportSize is an example where this happens
04161 
04162     if (!Success ||
04163         pColComponent   != NULL ||
04164         pBmpComponent   != NULL ||
04165         pUnitsComponent != NULL ||
04166         pInfoComponent  != NULL ||
04167         pViewComponent  != NULL ||
04168         pPrintComponent != NULL ||
04169         pFontComponent  != NULL)
04170     {
04171         EndExportDocComponents(Success);
04172     }
04173                 
04174     // Get the exported file size
04175     FileSize = GetNumBytesWritten();
04176 
04177     // Reset the vars
04178     ResetImportExportVars();
04179 
04180     // If we have our preferences class allocated then delete it
04181     if (pPrefs)
04182     {
04183         delete pPrefs;
04184         pPrefs = NULL;
04185     }
04186 
04187     // WEBSTER - markn 11/2/97
04188     // The tag description stuff can be used on export now
04189     if (pTagDescriptionList != NULL)
04190     {
04191         pTagDescriptionList->DeleteAll();
04192         delete pTagDescriptionList;
04193         pTagDescriptionList= NULL;
04194     }
04195 
04196     // WEBSTER - markn 15/2/97
04197     // Bug fix for selection type save option
04198     // Reset the default view area to DRAWING
04199     SetSelType(DRAWING);
04200 
04201     // Clean up the current attribute pointer and array.
04202     DeleteCurrentAttrs ();
04203 
04204 #endif
04205 }

void BaseCamelotFilter::CleanUpAfterImport BOOL  Successful  )  [protected, virtual]
 

Happens at the end of the import to allow the filters to clean up after themselves.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> & Mark Neves
Date:
29/5/96
Parameters:
Successful - TRUE if the import went OK, FALSE if it failed [INPUTS]

Definition at line 2328 of file camfiltr.cpp.

02329 {
02330     PORTNOTETRACE("other","BaseCamelotFilter::CleanUpAfterImport - ignoring RalphCriticalSection");
02331 #ifndef EXCLUDE_FROM_XARALX
02332     RalphCriticalSection rcs;
02333 #endif
02334 
02335     EndImportDocComponents(Successful);
02336 
02337     DeinitRecordHandlers();
02338 
02339     Camelot.UpdateSelection();
02340 
02341     if (Successful && TheDocument != NULL)
02342     {
02343         if (pImportLayer != NULL)
02344         {
02345             Node* pChild = pImportLayer->FindFirstChild();
02346             if (pChild == NULL)
02347             {
02348                 DeleteNode(pImportLayer);
02349                 pImportLayer = NULL;
02350             }
02351         }
02352 
02353         Spread* pSpread = TheDocument->GetSelectedSpread();
02354 
02355         ERROR3IF(pSpread == NULL,"We ought to have a selected spread at this point");
02356 
02357         if (pSpread != NULL)
02358         {
02359             pSpread->ValidateBoundingRect();
02360             pSpread->InvalidateBoundingRect(TRUE);
02361 
02362             // Make sure we have an active layer, and let everyone know that layer information has changed
02363 #ifndef WEBSTER
02364             // In Camelot mode, we must now check to see what document we are importing into
02365             // If it has frame layers in then we must convert all new layers into frames
02366             // If it has no frame layers in, then we must convert all frames into layers
02367             EnsureLayerIntegrity(pSpread);
02368             //LayerSGallery::EnsureActiveLayerIntegrity(pSpread);
02369 #else
02370             // In Webster ensure that multiple layers are disallowed unless they are
02371             // frame layers. At the same time ensure that there is an active layer.
02372             EnsureFrameLayerIntegrity(pSpread);
02373 #endif
02374 
02375             MergeSameNamedLayers();
02376             BROADCAST_TO_ALL(SpreadMsg(pSpread, SpreadMsg::LAYERCHANGES));
02377 
02378             // make sure the spread's pasteboard is extended to include all imported objects
02379             Node* pNode = pSpread;
02380             pNode->PostImport();
02381         }
02382 
02383         if (TheDocument->IsNotAClipboard())
02384             TheDocument->ResetInsertionPosition();
02385 
02386         // Warn user if font substitution has occurred.
02387 //      TheDocument->CheckFontSubstitution();
02388         TheDocument->CheckReferences();
02389 
02390 #if !defined(EXCLUDE_FROM_RALPH)
02391         // Make sure all qaulity sliders in the selected doc view get updated
02392 PORTNOTE("other","Removed QualitySliderDescriptor usage")
02393 #ifndef EXCLUDE_FROM_XARALX
02394         QualitySliderDescriptor::Update();
02395 #endif
02396 #endif
02397     }
02398     
02399     CleanUpTreeBuilding();
02400 
02401     ResetImportExportVars();
02402 
02403     // Any warnings to report?
02404     // We will do these as two separate warnings as:-
02405     // - they should both be rare in themselves
02406     // - they are talking about two completely different items
02407     // - they are difficult to add together without taking up a very large warning box
02408     // - they are difficult to add together in a compact and internationalisable way
02409     // Check the unknown but not essential tags found warning first
02410     if (Successful && !IgnoredDataString.IsEmpty())
02411     {
02412 #if !defined(EXCLUDE_FROM_RALPH)
02413         Error::SetError(0,IgnoredDataString,0);
02414         InformWarning();        
02415 #else
02416         // "Non-essential data has been found that is not recognised."
02417         String_256 Err(_R(IDE_IMPORT_RALPH_NEWTAGS));
02418         Error::SetError(0,Err,0);
02419         InformWarning();
02420 #endif
02421     }
02422     // Now check the warning about problem data string
02423     if (Successful && !WarningsString.IsEmpty())
02424     {
02425 #if !defined(EXCLUDE_FROM_RALPH)
02426         String_256 Warning = WarningsString;
02427         // Add the text on the end which mentions about using defaults instead
02428         String_256 Temp(_R(IDS_NATIVE_REPLACEDEFAULTS));
02429         Warning += Temp;
02430         Error::SetError(0,Warning,0);
02431         InformWarning();        
02432 #else
02433         // "Problems have been found with some data. The problems have been fixed with default values."
02434         String_256 Err(_R(IDE_IMPORT_RALPH_WARNING));
02435         Error::SetError(0,Err,0);
02436         InformWarning();
02437 #endif
02438     }
02439 
02440     // Make sure the lists are NULL
02441     if (pAtomicTagList != NULL)
02442     {
02443         pAtomicTagList->DeleteAll();
02444         delete pAtomicTagList;
02445         pAtomicTagList = NULL;
02446     }
02447 
02448     if (pEssentialTagList != NULL)
02449     {
02450         pEssentialTagList->DeleteAll();
02451         delete pEssentialTagList;
02452         pEssentialTagList = NULL;
02453     }
02454 
02455     if (pTagDescriptionList != NULL)
02456     {
02457         pTagDescriptionList->DeleteAll();
02458         delete pTagDescriptionList;
02459         pTagDescriptionList= NULL;
02460     }
02461 
02462     // Clean up the current attribute pointer and array.
02463     DeleteCurrentAttrs ();
02464 }

void BaseCamelotFilter::CleanUpTreeBuilding  )  [protected, virtual]
 

This deinits the tree building system.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/5/96
Parameters:
- [INPUTS]
Returns:
-
It must be called sometime after the last node is added to the tree.

See also:
BaseCamelotFilter::PrepareToImport; BaseCamelotFilter::DoImport Scope: Protected

Definition at line 6476 of file camfiltr.cpp.

06477 {
06478     // Reset the level vars
06479     if (pInsertLevelStack != NULL)
06480     {
06481         delete pInsertLevelStack;
06482         pInsertLevelStack = NULL;
06483     }
06484 
06485     if (TheDocument != NULL)
06486         TheDocument->GetSafeRenderPointer().SetPointerInValid();
06487 }

BOOL BaseCamelotFilter::CorrectFileHeader CCLexFile pFile  )  [protected, virtual]
 

Corrects the file header so that it contains the correct information now that we have correctly reached the end of the file.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/5/96
Parameters:
pFile - the file to put the exported data into [INPUTS]
Returns:
TRUE if worked, FALSE if failed.
See also:
DoExport;

Reimplemented in FlareTemplateFilter.

Definition at line 4109 of file camfiltr.cpp.

04110 {
04111 #ifdef DO_EXPORT
04112     // Seek back to the first thing that needs changing
04113     // The Start of file header record
04114 
04115     if (FileHeaderRecord == 0)
04116     {
04117         ERROR3("The pos of the file header is 0. What went wrong?");
04118         return TRUE;
04119     }
04120 
04121     pFile->seek(FileHeaderRecord+8+3);  // seek to the file size field (skip 8 byte header & file type field)
04122 
04123     ERROR3IF(FileSize == 0,"Erm, the file must be more than 0 bytes in size");
04124 
04125     // Write out the uncompressed length of file
04126     if (pFile->write(&FileSize, 4).fail())
04127         return FALSE;
04128 TRACEUSER( "Neville", _T("Uncompressed file size is %d\n"), FileSize );
04129 
04130     return TRUE;
04131 #else
04132     return FALSE;
04133 #endif
04134 }

CXaraFile * BaseCamelotFilter::CreateCXaraFile  )  [protected, virtual]
 

This is a central place where the CXaraFile object is created. It is a virtual func to allow derived classes to create different flavours of CXaraFile.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/6/96
Parameters:
- [INPUTS]
Returns:
ptr to a CXaraFile object that can be used for import or export NULL if there's an error

Reimplemented in FlareTemplateFilter, CamelotNULLNativeFilter, and CamelotNULLWebFilter.

Definition at line 1907 of file camfiltr.cpp.

01908 {
01909     CXaraFile* pCXaraFile = new CXaraFile;
01910 
01911     if (pCXaraFile != NULL)
01912         pCXaraFile->SetFilter(this);
01913 
01914     return pCXaraFile;
01915 }

virtual BaseCamelotFilter* BaseCamelotFilter::CreateNULLFilter Document pDocument  )  [protected, pure virtual]
 

Implemented in CamelotNativeFilter, and CamelotWebFilter.

BOOL BaseCamelotFilter::CreateRecordHandlers  )  [static, protected]
 

Definition at line 1723 of file camfiltr.cpp.

01724 {
01725     if (!RecordHandlersCreated)
01726     {
01727         RecordHandlerList.DeleteAll();
01728 
01729         // General handlers
01730         NEW_RECORD_HANDLER(GeneralRecordHandler);       // The general record handler
01731         NEW_RECORD_HANDLER(CompressionRecordHandler);   // The compression record handler
01732         NEW_RECORD_HANDLER(DocumentRecordHandler);      // Document record handler
01733         NEW_RECORD_HANDLER(ViewRecordHandler);          // View records handler
01734 
01735         // Reuseable data item handlers
01736         NEW_RECORD_HANDLER(ColourRecordHandler);        // Define colour record handler
01737         NEW_RECORD_HANDLER(BitmapRecordHandler);        // Define bitmap record handler
01738 
01739         // Document related items
01740         NEW_RECORD_HANDLER(DocInfoRecordHandler);       // Document info record handler
01741         NEW_RECORD_HANDLER(UnitsRecordHandler);         // Units record handler
01742 
01743         // Attribute handlers
01744         NEW_RECORD_HANDLER(LineAttrRecordHandler);      // Line attribute record handler
01745         NEW_RECORD_HANDLER(FillAttrRecordHandler);      // Fill attribute record handler
01746         NEW_RECORD_HANDLER(GeneralAttrRecordHandler);   // Misc attribute record handler
01747 
01748         // Object handlers
01749         NEW_RECORD_HANDLER(PathRecordHandler);          // Path record handler
01750         NEW_RECORD_HANDLER(PathFlagsRecordHandler);     // Path flags record handler
01751         NEW_RECORD_HANDLER(GroupRecordHandler);         // Group record handler
01752         NEW_RECORD_HANDLER(BlendRecordHandler);         // Blend-related record handler
01753         NEW_RECORD_HANDLER(MouldRecordHandler);         // Mould-related record handler
01754 
01755         NEW_RECORD_HANDLER(RegularShapeRecordHandler);
01756         NEW_RECORD_HANDLER(EllipseRecordHandler);
01757         NEW_RECORD_HANDLER(RectangleRecordHandler);
01758         NEW_RECORD_HANDLER(PolygonRecordHandler);
01759 
01760         NEW_RECORD_HANDLER(TextObjRecordHandler);
01761         NEW_RECORD_HANDLER(TextAttrRecordHandler);
01762         NEW_RECORD_HANDLER(FontDefRecordHandler);
01763 
01764 PORTNOTE("other","Commented ImagesettingAttrRecordHandler")
01765 #ifndef EXCLUDE_FROM_XARALX
01766         NEW_RECORD_HANDLER(ImagesettingAttrRecordHandler);
01767 #endif
01768         NEW_RECORD_HANDLER(PrintingRecordHandler);
01769 
01770 // Remove from webster builds at present as half complete Neville 6/8/97
01771 // Taken out by vector stroking code Neville 2/10/97
01772 #ifdef VECTOR_STROKING
01773         NEW_RECORD_HANDLER(StrokeAttrRecordHandler);
01774         NEW_RECORD_HANDLER(ShadowRecordHandler);        // Shadow-related record handler
01775         NEW_RECORD_HANDLER(BevelRecordHandler);
01776 #endif
01777 
01778         NEW_RECORD_HANDLER(ContourRecordHandler);
01779         NEW_RECORD_HANDLER(TemplateAttrRecordHandler);
01780 PORTNOTE("other","Commented WizOpStyleRecordHandler")
01781 #ifndef EXCLUDE_FROM_XARALX
01782         NEW_RECORD_HANDLER(WizOpStyleRecordHandler);
01783 #endif
01784         NEW_RECORD_HANDLER(WizOpStyleRefRecordHandler);
01785         NEW_RECORD_HANDLER(ExportHintRecordHandler);
01786 
01787         NEW_RECORD_HANDLER(BrushAttrRecordHandler);
01788         NEW_RECORD_HANDLER(ClipViewRecordHandler);      // ClipView-related record handler
01789 
01790         NEW_RECORD_HANDLER(FeatherRecordHandler);
01791 
01792         // bitmap properties record handler
01793         NEW_RECORD_HANDLER(BitmapPropertiesRecordHandler);  // Define bmp props record handler
01794         NEW_RECORD_HANDLER(BitmapSmoothingRecordHandler);   // Bitmap smoothing document flag
01795 
01796         NEW_RECORD_HANDLER(LiveEffectRecordHandler);
01797 
01798         RecordHandlersCreated = TRUE;
01799     }
01800 
01801     return RecordHandlersCreated;
01802 }

BOOL BaseCamelotFilter::DecInsertLevel  )  [virtual]
 

Tells the tree building system that the next nodes should be added to the previous level of the tree.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/5/96
Parameters:
- [INPUTS]
Returns:
TRUE if ok, FALSE otherwise
This is called when a TAG_UP record is encountered

This also calls the node last inserted on the new current level, to inform it that its sub-tree is complete. This gives complex nodes (such as moulds) as chance to do any initialisation after importing. (See Node::ReadPostChildrenWeb())

See also:
BaseCamelotFilter::PrepareToImport; BaseCamelotFilter::DoImport Scope: Protected

Definition at line 6556 of file camfiltr.cpp.

06557 {
06558     ERROR2IF(pInsertLevelStack == NULL,FALSE,"pInsertLevelStack == NULL");
06559 
06560     // Remove the last level item, as we've moved up a level
06561     InsertLevelStackItem* pItem = pInsertLevelStack->Pop();
06562 
06563     ERROR3IF(pItem == NULL,"no tail item");
06564 
06565     if (pItem != NULL)
06566     {
06567         // We've just gone up a level, which inplies that the last inserted node on the last
06568         // level has a complete child subtree, so inform it of the fact
06569         if (!pItem->InformLastInsertedNodeChildrenComplete())
06570             return FALSE;
06571 
06572         UpdateLastSafeToRenderNode(pItem->GetLastInsertedNode());
06573 
06574         // If there were some nodes inserted on the last level (i.e. the insert count > 0), we
06575         // need to reset the insert context node.
06576         // In this case the new context node is the parent of the current context node
06577 
06578         if (pItem->GetNumNodesInserted() > 0)
06579         {
06580             Node* pContextNode = GetInsertContextNode();
06581             if (pContextNode == NULL)
06582                 return FALSE;
06583 
06584             SetInsertContextNode(pContextNode->FindParent());
06585         }
06586 
06587         delete pItem;
06588     }
06589 
06590     // Insert the next node as a sibling to the current context node
06591     InsertNextNodeAsSibling();
06592 
06593     BOOL ok = TRUE;
06594 
06595     // Find the info item containing data on the current level
06596     InsertLevelStackItem* pCurrentLevelItem = pInsertLevelStack->Get();
06597 
06598     if (pCurrentLevelItem != NULL)
06599     {
06600         // We've just gone up a level, which inplies that the last inserted node on the new current
06601         // level has a complete child subtree, so inform it of the fact
06602         if (!pCurrentLevelItem->InformLastInsertedNodeChildrenComplete())
06603             return FALSE;
06604 
06605         UpdateLastSafeToRenderNode(pCurrentLevelItem->GetLastInsertedNode());
06606 
06607         // Inform the handler that we have finished a subtree
06608         CXaraFileRecordHandler* pHandler = pCurrentLevelItem->GetLastHandler();
06609         if (pHandler != NULL)
06610             pHandler->EndSubtree(pCurrentLevelItem->GetLastHandledTag());
06611         
06612     }
06613 
06614     return ok;
06615 }

void BaseCamelotFilter::Deinit  )  [virtual]
 

Deinits the filter when the program shuts down.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/6/96

Reimplemented from Filter.

Definition at line 754 of file camfiltr.cpp.

00755 {
00756     DestroyRecordHandlers();
00757 }

BOOL BaseCamelotFilter::DeinitRecordHandlers  )  [protected]
 

Calls all the record handlers via their EndImport() function. It also registers the list of handlers with the attached CXaraFile object.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/5/96
Parameters:
- [INPUTS]
Returns:
TRUE if ok; FALSE if not.

Definition at line 1873 of file camfiltr.cpp.

01874 {
01875     ERROR2IF(pCXaraFile == NULL, FALSE,"Can't initialise record handlers without a CXaraFile object");
01876 
01877     // Register the list handlers with thw CXaraFile objects
01878     BOOL ok = pCXaraFile->RegisterRecordHandlers(&RecordHandlerList);
01879 
01880     // Initialise all the handlers
01881     CamelotRecordHandler* pCamelotRecordHandler = (CamelotRecordHandler*)RecordHandlerList.GetHead();
01882     while (ok && pCamelotRecordHandler != NULL)
01883     {
01884         ok = pCamelotRecordHandler->EndImport();
01885 
01886         pCamelotRecordHandler = (CamelotRecordHandler*)RecordHandlerList.GetNext(pCamelotRecordHandler);
01887     }
01888 
01889     return ok;
01890 }

BOOL BaseCamelotFilter::DeleteNode Node pNode  )  [private]
 

deletes the given node by removing it from the tree

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/8/96
Parameters:
pNode = ptr to node to remove from the tree [INPUTS]
Returns:
TRUE if ok, FALSE otherwise
This will delete the node undoably when it has to.

At the mo, deletion is only performed undoably when all the following conditions are met: 1) We are importing, and not openning the file 2) pNewNode is a layer 3) we have a ptr to an undoable op

See also:
BaseCamelotFilter::PrepareToImport; BaseCamelotFilter::DoImport Scope: Protected

Definition at line 6323 of file camfiltr.cpp.

06324 {
06325     BOOL ok = TRUE;
06326 
06327     BOOL DeleteWithUndo = (IsImporting() && pNode->IsLayer() && (ImportInfo.pOp != NULL));
06328 
06329     if (DeleteWithUndo)
06330         ok = ImportInfo.pOp->DoHideNode(pNode,TRUE);
06331     else
06332     {
06333         pNode->CascadeDelete();
06334         delete pNode;
06335     }
06336 
06337     return ok;
06338 }

void BaseCamelotFilter::DestroyRecordHandlers  )  [static, protected]
 

Destroys all the record handlers associated with the camelot v2 file format filters.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/5/96
Parameters:
- [INPUTS]
Returns:
-

Definition at line 1816 of file camfiltr.cpp.

01817 {
01818     RecordHandlerList.DeleteAll();
01819     RecordHandlersCreated = FALSE;
01820 }

BOOL BaseCamelotFilter::DoExport Operation pOp,
CCLexFile pFile,
PathName pPath,
Document pDoc,
BOOL  ShowOptions
[virtual]
 

Exports the current document out to file. Uses the virtual functions of this class. Do not override unless really necessary.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> & Markn
Date:
29/5/96
Parameters:
pOp - the operation that started the export off [INPUTS] pFile - the file to put the exported data into pPath - the pathname of the file to be exported to pDoc - the document to export ShowOptions - Are the export options needed?
Returns:
TRUE if worked, FALSE if failed.
See also:
GetExportOptions; PrepareToExport; CleanUpAfterExport;

Reimplemented from Filter.

Reimplemented in PluginNativeFilter.

Definition at line 4935 of file camfiltr.cpp.

04937 {
04938 #ifdef DO_EXPORT
04939     ERROR2IF(pOp == NULL, FALSE,"BaseCamelotFilter::DoExport no export operation");
04940     ERROR2IF(pFile == NULL, FALSE,"BaseCamelotFilter::DoExport no file to export to");
04941     ERROR2IF(pPath == NULL, FALSE,"BaseCamelotFilter::DoExport no export pathname");
04942     ERROR2IF(pDoc == NULL, FALSE,"BaseCamelotFilter::DoExport no document to export");
04943 
04944     // Set up document pointer
04945     TheDocument = pDoc;
04946 
04947     // Get pointer to the spread to export.
04948     pTheSpread = GetFirstSpread(pDoc);
04949     ERROR2IF(pTheSpread == NULL, FALSE,"BaseCamelotFilter::DoExport no spread to export");
04950 
04951     // We must now check if there is a selection present so that we can set up whether the
04952     // user gets the choice of exporting the selection, drawing or spread if there is a 
04953     // selection present OR just a choice between the spread or drawing if no selection is
04954     // present.
04955     // If have a caret selected in a text story then the selection will be almost zero so trap
04956     // this case as well. 
04957 
04958     SelectionType Selection = DRAWING;
04959     if (ShowOptions)
04960     {
04961         Application * pApp = GetApplication();
04962         ERROR2IF(pApp == NULL, FALSE,"BaseCamelotFilter::DoExport no application!");
04963         SelRange* pRange = pApp->FindSelection();
04964         ERROR2IF(pRange == NULL, FALSE,"BaseCamelotFilter::DoExport no selection range!");
04965         DocRect ClipRect = pRange->GetBoundingRect();
04966         if (ClipRect.IsEmpty())
04967             Selection = DRAWING;        // no selection present, so choose drawing by default
04968         else
04969             Selection = SELECTION;      // selection present, so choose this by default
04970 
04971         if (Selection == DRAWING)
04972         {
04973             // Work out the size of the rectangle encompassing the drawing (visible layers only)
04974             ClipRect = BaseBitmapFilter::GetSizeOfDrawing(pTheSpread);
04975 
04976             // Check that that cliprect is ok, if not then set the spread as the export type
04977             if (ClipRect.IsEmpty())
04978                 Selection = SPREAD;
04979         }
04980     }
04981 
04982     // See if the Camelot filters need some exporting options or not
04983     // First, create the preferences class we use to get the data to and from the dialog box
04984     pPrefs = new WebPrefsDlgParam;
04985 
04986     if (pPrefs == NULL)
04987         return FALSE;
04988 
04989     // Set the viewport selection here.
04990     if (ShowOptions)
04991     {
04992         pPrefs->SetExportSel ( Selection );
04993         pPrefs->SetViewportSel ( Selection );
04994 
04995         // Invoke the dialogue box.
04996         if (!GetExportOptions(pPrefs))
04997         {
04998             // User has cancelled the operation so set our error which will be suppressed
04999             // and return FALSE
05000             Error::SetError(_R(IDN_USER_CANCELLED),0);
05001 
05002             // Clean up the old preferences.
05003             delete pPrefs;
05004             pPrefs = NULL;
05005 
05006             return FALSE;
05007         }
05008     }
05009     else
05010     {
05011         // Do we want the dialogue box for export options? If not, ensure that the export and
05012         // viewport selections don't screw things up.
05013         // Graeme (25/1/00) - Changed SelType to ExportSel and ViewportSel.
05014         pPrefs->SetExportSel ( DRAWING );
05015         pPrefs->SetViewportSel ( DRAWING );
05016     }
05017 
05018 
05019     // Used to open the file up before starting DoExport. But this meant a cancel on the export
05020     // options dialog had filled the file, if it was already present. So now up up here if
05021     // not open already. In the PreviewBitmap case the file will already be open.
05022     if (!pFile->isOpen())
05023     {
05024         if (pFile->IsKindOf(CC_RUNTIME_CLASS(CCDiskFile)))
05025         {       
05026             if (!OpenExportFile((CCDiskFile*) pFile, pPath))
05027             {
05028                 if (pPrefs)
05029                 {
05030                     delete pPrefs;
05031                     pPrefs = NULL;
05032                 }
05033                 return FALSE;
05034             }
05035         }
05036         else
05037         {
05038             TRACEUSER( "JustinF", _T("Tried to open non-CCDiskFile in BaseCamelotFilter::DoExport\n") );
05039             return FALSE;
05040         }
05041     }
05042     
05043     // Get ready for the binary header by setting all our variables to their initial states
05044     FileStart = 0;
05045     FileEnd = 0;
05046     FileHeaderRecord = 0;
05047     FileSize = 0;
05048 
05049     BOOL ok = TRUE;
05050     EscapePressed = FALSE;
05051 
05052     try
05053     {
05054         // This needs to be fixed sensibly as it uses the value that is 
05055         // currently in the TotalProgressBarCount variable
05056         // UINT32 ExportSize = CalcExportSize(TheDocument);
05057 
05058         // This resets any export vars, opens the file and writes the header out
05059         if (ok) ok = PrepareToExport(pFile);
05060 
05061         // After we have exported the header, we must export the preview bitmap, if required.
05062         // Make sure we use the function to get the CCFile pointer or the template version wont
05063         // get written out properly...
05064         if (ok) ok = ExportPreviewBitmap(GetCCFile(), pOp, pPath, pDoc);
05065 
05066         // Start up the progress bar - happends after the preview bmp (in case it starts up a progress bar)
05067         if (ok) StartProgressBar(&ProgressBarMessage);
05068 
05069         // From this point on, everything in the file is related to this document
05070         if (ok) ok = BeginDocumentExport();
05071 
05072         // WEBSTER - markn 11/2/97
05073         // Write out a tag description record if necessary
05074         WriteTagDescriptionRecord();
05075 
05076         // Write out some simple document-scope values
05077         WriteNudgeSizeRecord();
05078         WriteBitmapSmoothingRecord();
05079         WriteDuplicationOffsetRecord();
05080 
05081 /*      // Find all the document components that are required
05082         // Must do this just before we start the doc components export as otherwise things which fail
05083         // will cause clean up to occur and once FindDocComponents is called, it assumes that start
05084         // StartExportDocComponents has been called.
05085         if (ok ok = FindDocComponents(); */
05086 
05087         // Start doc components (before compression is started)
05088         if (ok) ok = StartExportDocComponents(TRUE);
05089 
05090         // Just before we write the main document, we will start compression up, if required
05091         if (ok) ok = StartCompression();
05092 
05093         // Start doc components (after compression started)
05094         if (ok) ok = StartExportDocComponents(FALSE);
05095 
05096         // Write out all remaining automic tags (note brush defintion and stroke definition have already
05097         // been written within the above call).  I am not going to move these into here ....
05098         if (ok) ok = WriteRemainingAtomicTagDefinitions ();     // for bevels, contours, shadows, clipviews, etc.
05099 
05100         // Save out the document tree
05101         if (ok) ok = WriteDocument(pOp);
05102 
05103         // Save out the current attributes...
05104         if (ok) ok = WriteCurrentAttributes();
05105 
05106         // Tell doc components we have finished
05107         if (ok) ok = EndExportDocComponents(TRUE);
05108 
05109         // Just before we write the EOF record and close down the file
05110         // we will stop compression
05111         if (ok) ok = StopCompression();
05112 
05113         // Everything in the document has been saved
05114         if (ok) ok = EndDocumentExport();
05115 
05116         if (ok)
05117         {
05118             // Write out the EOF record as the last record in the file
05119             WriteZeroSizedRecord(TAG_ENDOFFILE);
05120 
05121             // All done - deallocate dynamic objects and return success.
05122             CleanUpAfterExport(TRUE);
05123 
05124             // Detach document
05125             TheDocument = NULL;
05126 
05127             // Find out where the file ended
05128             FileEnd = pFile->tell();
05129 
05130             // Correct the binary header, now we know where everything is
05131             if (!CorrectFileHeader(pFile))
05132             {
05133                 ERROR1(FALSE, _R(IDT_EXPORT_INTERNAL_ERR));
05134             }
05135         }
05136     }
05137     catch (...)
05138     {
05139         TRACE( _T("BaseCamelotFilter::DoExport An error has occurred during export!\n") );
05140         // Flag an error has occurred so that things get cleaned up correctly
05141         ok = FALSE;
05142     }
05143 
05144     // Clean up if we get an error
05145     if (!ok)
05146     {
05147         CleanUpAfterExport(FALSE);
05148 
05149         // If the user has pressed escape then set the proper error
05150         if (EscapePressed)
05151             Error::SetError(_R(IDW_CANCELEXPORT),0);
05152 
05153         return FALSE;
05154     }
05155 
05156     //Graham 22/5/97: Export an HTML tag to the clipboard if necessary
05157     if (ShouldExportHTMLTag())
05158         ExportHTMLTag(pPath);
05159 
05160     return ok;
05161 #else
05162     return FALSE;
05163 #endif
05164 }

BOOL BaseCamelotFilter::DoImport SelOperation pOp,
CCLexFile pFile,
Document pDestDoc,
BOOL  AutoChosen = FALSE,
ImportPosition pPos = NULL,
KernelBitmap **  ppImportedBitmap = NULL,
DocCoord pPosTranslate = NULL,
String_256 URL = NULL
[virtual]
 

Read the data from the specified file.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/5/96
Parameters:
Op - pointer to the operation that this input process is associated with. [INPUTS] pFile - The file that we should load the document from DestDoc - The Document object which should hold the data read in from the file. AutoChosen - pPos - Pos - ppImportedBitmap - this is used mainly in the bitfltr.cpp for the HTML import filter. HTMLFilter::DoImport() needs a pointer to a kernel bitmap to set the background bitmap up into Camelot. pPosTranslate - This is used too by the HTMLFilter in order to do a formatting.
Returns:
TRUE if the input operation worked ok, FALSE if not.

Errors: Fails (returns FALSE) if the document structure is incorrect, or if there is a problem with the file. Assumes the caller will fail and end the operation if False is returned.

Reimplemented from Filter.

Reimplemented in PluginNativeFilter.

Definition at line 3338 of file camfiltr.cpp.

03342 {
03343     ERROR2IF(FALSE, pOp == NULL,"BaseCamelotFilter::DoImport null operation!");
03344     ERROR2IF(FALSE, pFile == NULL,"BaseCamelotFilter::DoImport null file!");
03345     ERROR2IF(FALSE, pDestDoc == NULL,"BaseCamelotFilter::DoImport null document!");
03346 
03347     // Set up document pointer
03348     TheDocument = pDestDoc;
03349 
03350     // Remember operation and position so we can use them to add nodes in other functions.
03351     ImportInfo.pOp = pOp;
03352     ImportInfo.pPos = pPos;
03353 
03354     if (!PrepareToImport(pFile))
03355     {
03356         // Didn't work (no memory)
03357         CleanUpAfterImport(FALSE);
03358         return FALSE;
03359     }
03360 
03361     // Get the right spread...
03362     Spread *pSpread = NULL;
03363 
03364     if (pPos == NULL)
03365     {
03366         // Find the spread on the first page of this document...
03367         pSpread = GetFirstSpread(pDestDoc);
03368     }
03369     else
03370     {
03371         // Use the spread provided
03372         pSpread = pPos->pSpread;
03373     }
03374 
03375     // Set our class variable to point at this spread
03376     pTheSpread = pSpread;
03377 
03378     if (!pSpread)
03379     {
03380         // Didn't work, no spread
03381         // TODO: Add in Error message!
03382         Error::SetError(_R(IDT_CANT_FIND_FILTER));
03383         CleanUpAfterImport(FALSE);
03384         return FALSE;
03385     }
03386 
03387     // Remember it
03388     //ImportInfo.pSpread = pSpread;
03389 
03390     // Get the spread's bounding rectangle and convert it to spread coords.
03391     DocRect SpreadRect = pSpread->GetPasteboardRect();
03392     pSpread->DocCoordToSpreadCoord(&SpreadRect);
03393 
03394     if (pPos == NULL)
03395     {   
03396         // For now, position objects on 1st page of spread 1
03397         Page *pPage = pSpread->FindFirstPageInSpread(); 
03398         ERROR2IF(pPage == NULL,FALSE,"BaseCamelotFilter::DoImport Spread has no pages"); 
03399 
03400         // Use bottom left of page as origin
03401         DocRect PageRect = pPage->GetPageRect();
03402         SetCoordOrigin(PageRect.lo);
03403     }
03404     else
03405     {
03406         // Use position provided
03407         SetCoordOrigin(pPos->Position);
03408     }
03409     
03410     // Try to open the file
03411     // The file is already open when it is passed in
03412 
03413     // Find out the size of the file, in bytes.
03414     size_t filesize = pFile->Size();
03415     if (filesize <= 0)
03416     {
03417         Error::SetError(BadFileMsgID);
03418         return FALSE;
03419     }
03420 
03421     // Set the progress indicator, this next bit might take a while.
03422     // String_64 ImportMessage(ImportMsgID);
03423     // String_64 ImportMessage = GetImportProgressString(pFile, GetImportMsgID());
03424     // BeginSlowJob(filesize, TRUE, &ImportMessage);
03425     
03426     // ContinueSlowJob();
03427 
03428     // Start up the record parser
03429 
03430     BOOL Ok = TRUE;
03431     // Must set the exception throwing flag to True and force reporting of errors to False.
03432     // This means that the caller must report an error if the function returns False.
03433     // Any calls to CCFile::GotError will now throw a file exception and should fall into
03434     // the catch handler at the end of the function.
03435     // Replaces the goto's that handled this before.
03436     BOOL OldThrowingState = pFile->SetThrowExceptions( TRUE );
03437     BOOL OldReportingState = pFile->SetReportErrors( FALSE );
03438 
03439     // Record parser starts here
03440 
03441     try
03442     {
03443         // Load that file 
03444         Ok = ReadFile();
03445     }
03446     catch( ... )
03447     {
03448         Ok = FALSE;
03449     }
03450   
03451     // Must set the exception throwing and reporting flags back to their entry states
03452     pFile->SetThrowExceptions( OldThrowingState );
03453     pFile->SetReportErrors( OldReportingState );
03454   
03455     // If the load failed for any reason, delete the subtree we have created; otherwise
03456     // graft it into the tree (currently bodged to be on the first layer of the second page.
03457     if (!Ok)
03458     {
03459         // Tidy up after ourselves.
03460         CleanUpAfterImport(FALSE);
03461 
03462         // Detach document.
03463         TheDocument = NULL;
03464 
03465         // If the user has pressed escape then set the proper error
03466         if (EscapePressed)
03467             Error::SetError(_R(IDT_IMPORT_USERABORT),0);
03468 
03469         pOp->FailAndExecute();
03470                 
03471         // All work has been completed.
03472         //EndSlowJob();
03473     
03474 #if !defined(EXCLUDE_FROM_RALPH)
03475         // Ensure all the bars are updated to reflect the new document
03476         DialogBarOp::UpdateStateOfAllBars();
03477 #endif
03478         
03479         return FALSE;
03480     }
03481 
03482     // Try to attach any outstanding nodes
03483     //BOOL Success = AttachAllNodes();
03484 
03485     // Tidy up after ourselves
03486     CleanUpAfterImport(TRUE);
03487 
03488     // Flag this as a new format document
03489     // But only flag it if we are opening the document rather than importing into an exisiting one
03490     if (TheDocument && !TheDocument->IsImporting())
03491     {
03492         TheDocument->SetLoadedAsVersion1File(FALSE);
03493 
03494         // allow the font manager to fix the current font
03495         if (!TheDocument->IsAClipboard())
03496             GetApplication()->GetFontManager()->OnDocumentLoaded(TheDocument);
03497     }
03498 
03499 #if !defined(EXCLUDE_FROM_RALPH)
03500     BOOL UpdateBars = TheDocument ? !TheDocument->IsAClipboard() : TRUE;
03501 #endif
03502 
03503     // Detach document.
03504     TheDocument = NULL;
03505 
03506     // End job and inform caller of the success or failure of the venture.
03507     //EndSlowJob();
03508 
03509 #if !defined(EXCLUDE_FROM_RALPH)
03510     // Ensure all the bars are updated to reflect the new document,
03511     // but only if it isn't a clipboard document
03512 PORTNOTE("other","Removed DialogBarOp usage")
03513     if(UpdateBars)
03514         DialogBarOp::UpdateStateOfAllBars();
03515 #endif
03516 
03517     return TRUE;
03518 }

BOOL BaseCamelotFilter::EndDocumentExport  )  [protected, virtual]
 

This function is called after document-related records have been are written out to the file. BeginDocumentExport() is called before the doc records are saved.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/7/96
Parameters:
- [INPUTS]
Returns:
TRUE if successful, FALSE otherwise
This should be called for each document that is saved out to the file.

See also:
BaseCamelotFilter::BeginDocumentExport() Scope: Protected

Reimplemented in CamelotNativeFilter, CamelotWebFilter, and PluginNativeFilter.

Definition at line 4911 of file camfiltr.cpp.

04912 {
04913     return TRUE;
04914 }

BOOL BaseCamelotFilter::EndExportDocComponents BOOL  Success  )  [protected, virtual]
 

Tells all the doc components attached to the document that we have finished exporting the document.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/5/95
Parameters:
Success - True if everything went swimmingly, False if just a clean up is required. [INPUTS]
Returns:
TRUE if worked, FALSE if failed.
See also:
PrepareToExport, StartExportDocComponents

Definition at line 3903 of file camfiltr.cpp.

03904 {
03905 #ifdef DO_EXPORT
03906     ERROR2IF(TheDocument == NULL,FALSE,"NULL document ptr");
03907 
03908     BOOL ok = TRUE;
03909 
03910     // Inform all the document components that we have finished exporting, so they must
03911     // save any pending information now.
03912     DocComponent *pComponent = TheDocument->EnumerateDocComponents(NULL);
03913 
03914     // Cannot use the EscapePressed flag as we MUST call everything on exit to clean up!
03915     while (ok && pComponent != NULL)
03916     {
03917         // Inform this document component that we have finished a Native/Web export.
03918         ok = pComponent->EndExport(this, Success);
03919 
03920         // Look for next doc component
03921         pComponent = TheDocument->EnumerateDocComponents(pComponent);
03922     }
03923 
03924     // Now, go through all DocComponents a second time, telling them to clean up
03925     // their exporting data structures.
03926     if (!ok)
03927         Success = FALSE;
03928 
03929     pComponent = TheDocument->EnumerateDocComponents(NULL);
03930 
03931     // Cannot use the EscapePressed flag as we MUST call everything on exit to clean up!
03932     while (pComponent != NULL)
03933     {
03934         // Inform this document component that we have finished a Native/Web export.
03935         pComponent->CleanUpAfterExport(Success);
03936 
03937         // Look for next doc component
03938         pComponent = TheDocument->EnumerateDocComponents(pComponent);
03939     }
03940 
03941 
03942     // Set the colour and bitmap components back to null
03943     // This also signals the end of the doc components export
03944     pColComponent   = NULL;
03945     pBmpComponent   = NULL;
03946     pUnitsComponent = NULL;
03947     pInfoComponent  = NULL;
03948     pViewComponent  = NULL;
03949     pPrintComponent = NULL;
03950     pFontComponent  = NULL;
03951 
03952     // If the user has pressed escape during export - progress update returns this to us
03953     if (EscapePressed)
03954         return FALSE;
03955 
03956     return ok;
03957 #else
03958     return FALSE;
03959 #endif
03960 }

BOOL BaseCamelotFilter::EndImportDocComponents BOOL  success  )  [protected, virtual]
 

Tells all the doc components attached to the document that we have finished Importing the document.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/5/95
Parameters:
success = bool denoting import success [INPUTS]
Returns:
TRUE if worked, FALSE if failed.
See also:
PrepareToImport, StartImportDocComponents

Definition at line 3214 of file camfiltr.cpp.

03215 {
03216     ERROR2IF(TheDocument == NULL,FALSE,"NULL document ptr");
03217 
03218     BOOL ok = TRUE;
03219 
03220     // Inform all the document components that we have finished Importing
03221     DocComponent *pComponent = TheDocument->EnumerateDocComponents(NULL);
03222 
03223     // Cannot use the EscapeFlag in here as we MUST clean up on failure!
03224     while (ok && pComponent != NULL)
03225     {
03226         // Inform this document component that we have finished a Native/Web Import.
03227         ok = pComponent->EndImport(this,success);
03228 
03229         // Look for next doc component
03230         pComponent = TheDocument->EnumerateDocComponents(pComponent);
03231     }
03232 
03233     pColComponent   = NULL;
03234     pBmpComponent   = NULL;
03235     pUnitsComponent = NULL;
03236     pInfoComponent  = NULL;
03237     pViewComponent  = NULL;
03238     pPrintComponent = NULL;
03239     pFontComponent  = NULL;
03240 
03241     // If the user has pressed escape during export - progress update returns this to us
03242     if (EscapePressed)
03243         return FALSE;
03244 
03245     return ok;
03246 }

virtual void BaseCamelotFilter::EndOfFile  )  [inline, virtual]
 

Definition at line 309 of file camfiltr.h.

00309 { EndOfFileFlag = TRUE; }

void BaseCamelotFilter::EndProgressBar  )  [protected, virtual]
 

If a progress bar already exists, it's deleted.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/7/96
Parameters:
- [INPUTS]
Returns:
-

Definition at line 2079 of file camfiltr.cpp.

02080 {
02081     // Check to see if we need to delete the old one
02082     if (pProgress != NULL)
02083     {
02084         TRACE( _T("Stopping progress bar\n"));
02085         delete pProgress;
02086         pProgress = NULL;
02087     }
02088 }

BOOL BaseCamelotFilter::EndRecord  ) 
 

Definition at line 5593 of file camfiltr.cpp.

05594 {
05595     if (pCXaraFile != NULL)
05596         return pCXaraFile->EndRecord();
05597 
05598     return FALSE;
05599 }

BOOL BaseCamelotFilter::EndStreamedRecord  ) 
 

Definition at line 5601 of file camfiltr.cpp.

05602 {
05603     if (pCXaraFile != NULL)
05604     {
05605         // Ask the CXaraFile class to end that record for us
05606         // Get the function to tell us how big it thinks the record is
05607         // This is the size of the data i.e. does not include the header
05608         UINT32 RecordSize = 0L;
05609         BOOL ok = pCXaraFile->EndStreamedRecord(&RecordSize);
05610         // Update the progress bar count with this amount plus 8 for the header
05611         //IncProgressBarCount(RecordSize + 8);
05612 //TRACEUSER( "Neville", _T("EndStreamedRecord update progress by %d\n"),RecordSize + 8);
05613         return ok;
05614     }
05615 
05616     return FALSE;
05617 }

BOOL BaseCamelotFilter::EnsureFrameLayerIntegrity Spread pSpread  )  [protected, virtual]
 

Happens at the end of the import to allow the layers to be cleaned up. Mainly used by Webster so that we can ensure that frame layers are the order of the day. Do now as the layers are stable and have all their flags present. We cannot decide when we get the layer record as we would need to wait until we have the layer details record. Then this would not be the complete information until we have seen or not seen as the case may be the frame properties record.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/6/97
Parameters:
pSpread - the spread to check the layers on. [INPUTS]

Definition at line 2859 of file camfiltr.cpp.

02860 {
02861     // In Webster, check that we have only frame layers or if not combine all non-frame
02862     // layers onto one frame layer.
02863     // In Camelot do not do this
02864     // In both ensure that we have an active layer
02865 //#ifdef WEBSTER
02866     // Check if we are in a hidden document. This may be the print marks document.
02867     // In this case we should do nothing.
02868     // Unfortunately the hidden flag is not set in the print marks case which is the one
02869     // we are trying to stop. Instead, print marks have been disabled in Webster builds.
02870     if (TheDocument != NULL && !TheDocument->IsAHiddenDoc())
02871     {
02872         // Ensure that all other non-guide and non-background layers are frame layers
02873         UINT32 NonFrameLayersFound = 0;
02874         Layer* pCurrentLayer = NULL;
02875         Layer * pActiveLayer = NULL;
02876         // Search from the first imported layer, so that we only ever combine newly imported
02877         // layers together. Only do when importing.
02878         // Also, find the first active layer in the spread which should be our original active
02879         // layer.
02880         if (m_pFirstImportedLayer == NULL && !IsImporting())
02881             pCurrentLayer = pSpread->FindFirstLayer();
02882         else
02883         {
02884             // Account for minimal web files which do not have a layer and so import onto the
02885             // layer that is constructed for that purpose i.e. pImportLayer
02886             Layer * pActualFirstImportedLayer = m_pFirstImportedLayer;
02887             if (m_pFirstImportedLayer == NULL && pImportLayer != NULL)
02888                 pActualFirstImportedLayer = pImportLayer;
02889             ERROR3IF(pActualFirstImportedLayer == NULL,"BaseCamelotFilter::EnsureFrameLayerIntegrity No first imported layer!");
02890 
02891             pCurrentLayer = pActualFirstImportedLayer;
02892             // Check that the other layers in the document before this are all frame layers
02893             // At present, just mark them as frames as there should always be just one possible
02894             // non-frame layer present. (From the default doc which is not in the new format)
02895             Layer* pLayer = pSpread->FindFirstLayer();
02896             BOOL Finished = FALSE;
02897             while (pLayer != NULL && !Finished)
02898             {
02899                 // Only search up to the first imported layer
02900                 if (pLayer == pActualFirstImportedLayer)
02901                 {
02902                     Finished = TRUE;
02903                 }
02904                 else if (pLayer->IsPseudoFrame() && !pLayer->IsFrame())
02905                 {
02906                     pLayer->SetFrame(TRUE);
02907                     NonFrameLayersFound++;
02908                 }
02909 
02910                 // Note the original active layer, if found 
02911                 if (!Finished && pLayer == m_pActiveLayerBeforeImport) // pLayer->IsPseudoFrame() && pLayer->IsActive())
02912                 {
02913                     pActiveLayer = pLayer;
02914                 }
02915 
02916                 pLayer = pLayer->FindNextLayer();
02917             }
02918 
02919             if (NonFrameLayersFound > 0)
02920             {
02921                 TRACEUSER( "Neville", _T("++++++++++BaseCamelotFilter::EnsureFrameLayerIntegrity fixed %d original non-frame layers\n"),NonFrameLayersFound);
02922                 
02923             }
02924         }
02925 
02926         NonFrameLayersFound = 0;
02927         Layer* pNonFrameLayer = NULL; 
02928         const String_32 CustomMarkName(TEXT("_%CUSTOMMA")); // REM 10 long only
02929         const String_32 PrintMarkName(TEXT("%PRINTMARK"));  // REM 10 long only
02930         while (pCurrentLayer != NULL)
02931         {
02932             // Check if we are one of the uniquely named layers in the print marks document
02933             String_256 LayerName = pCurrentLayer->GetLayerID();
02934             String_32 StartOfName;
02935             LayerName.Left(&StartOfName, 10);  
02936 
02937             // The layer has to pass a lot of tests to be counted!
02938             // Added a visible test so that hidden layers are not included
02939             // If it was a frame layer then it could be invisible but as we don't allow frame layers
02940             // then this ok.
02941             if (pCurrentLayer->IsPseudoFrame() && !pCurrentLayer->IsFrame() && pCurrentLayer->IsVisible() &&
02942                 StartOfName != CustomMarkName && StartOfName != PrintMarkName)
02943             {
02944                 // Note that we have found a non-frame layer.
02945                 if (pNonFrameLayer == NULL)
02946                     pNonFrameLayer = pCurrentLayer;
02947                 NonFrameLayersFound++;
02948             }
02949 
02950             pCurrentLayer = pCurrentLayer->FindNextLayer();
02951         }
02952 
02953         /* if (NonFrameLayersFound == 1 && pNonFrameLayer != NULL)
02954         {
02955             TRACEUSER( "Neville", _T("++++++++++BaseCamelotFilter::EnsureFrameLayerIntegrity found %d non-frame layers\n"),NonFrameLayersFound);
02956             // Just mark the non-frame layer found in the above search as a frame layer.
02957             // We need do nothing else but fall through and fix up the active layer
02958             pNonFrameLayer->SetFrame(TRUE);
02959         }
02960         else */
02961         if (NonFrameLayersFound >= 1 && pNonFrameLayer != NULL)
02962         {
02963             TRACEUSER("Neville", _T("++++++++++BaseCamelotFilter::EnsureFrameLayerIntegrity found %d non-frame layers\n"),NonFrameLayersFound);
02964             // Right, we need to move all the nodes from the all non-frame layers and move them
02965             // to one of the non-frame layers and make this one a frame layer. The user should
02966             // therefore notice no difference in appearance of the document as they would have
02967             // been seeing one frame representing all the non-frame layers in the frame gallery.
02968             
02969             // If we are importing then use the active layer as the destination for all non-frame layers.
02970             BOOL UsingExistingLayer = FALSE;
02971             if (IsImporting() && ImportNonFramesOntoActivelayer)
02972             {
02973                 // If we found an active layer then use this for importing all the non-frames onto
02974                 // if the user has the preference set
02975                 // if (pActiveLayer) This is not always perfect e.g. first import of a web file
02976                 // so use the version we save in PrepareToImport and have checked is still present above
02977                 // i.e. m_pActiveLayerBeforeImport
02978                 if (pActiveLayer)
02979                 {
02980                     pNonFrameLayer = pActiveLayer;
02981                     UsingExistingLayer = TRUE;
02982                 }
02983             }
02984 
02985             if (!UsingExistingLayer)
02986             {
02987                 // First, mark the non-frame layer found in the above search as a frame layer as this
02988                 // is the one that we are going to use as out destination. Then all other non-frame
02989                 // searches will not find it. Also, mark it as edited.
02990                 pNonFrameLayer->SetFrame(TRUE);
02991                 pNonFrameLayer->SetEdited(TRUE);
02992 
02993                 // We will also set the new frames to overlay so that the user sees the old plus the new
02994                 pNonFrameLayer->SetOverlay(TRUE);
02995             }
02996 
02997             // Start a progress bar
02998             Progress CombiningProgress(_R(IDS_COMBINING_LAYERS));
02999             CombiningProgress.Update();
03000 
03001             BOOL ok = TRUE;
03002             BOOL UpdateSelection = FALSE;
03003             BOOL MoveWithUndo = (IsImporting() && (ImportInfo.pOp != NULL));
03004             Layer* pLayer = pSpread->FindFirstLayer();
03005             while (pLayer != NULL)
03006             {
03007                 if (pLayer->IsPseudoFrame() && !pLayer->IsFrame() && ok)
03008                 {
03009                     Node * pNode = NULL;
03010                     // Move all the top level nodes to the new layer
03011                     // We MUST include hidden nodes as these will be in undo records
03012                     // Added a visible test so that hidden layers are not included but are just deleted
03013                     // If it was a frame layer then it could be invisible but as we don't allow frame layers
03014                     // then this ok.
03015                     if (pLayer->IsVisible())
03016                         pNode = pLayer->FindFirstChild();
03017 
03018                     while (pNode && ok)
03019                     {
03020                         // Note the node to move
03021                         Node* pNodeToMove = pNode;
03022                         // and the next node in the tree
03023                         pNode = pNode->FindNext();
03024                         // Note if we have moved at least one selected node
03025                         UpdateSelection |= pNodeToMove->IsSelected();
03026 
03027                         // Find the insertion point, which will be after the last child but
03028                         // BEFORE the insertion node, if present.
03029                         Node * pInsertPoint = pNonFrameLayer->FindLastChild(TRUE);
03030                         // If we have an undoable op then move the node with undo
03031                         if (MoveWithUndo)
03032                         {
03033                             // Importing, so use the undoable op to do the work for us
03034                             if (pInsertPoint)
03035                                 ok = ok && ImportInfo.pOp->DoMoveNode(pNodeToMove, pInsertPoint, NEXT);
03036                             else
03037                                 ok = ok && ImportInfo.pOp->DoMoveNode(pNodeToMove, pNonFrameLayer, LASTCHILD);
03038                         }
03039                         else
03040                         {
03041                             // Loading, so  do it blatently
03042                             if (pInsertPoint)
03043                                 pNodeToMove->MoveNode(pInsertPoint, NEXT);
03044                             else
03045                                 pNodeToMove->MoveNode(pNonFrameLayer, LASTCHILD);
03046                         }
03047 
03048                         // Update the progress display to show we have done something
03049                         CombiningProgress.Update();
03050                     }
03051                     
03052                     // Finally, go and hide that layer
03053                     Layer * pLayerToHide = pLayer;
03054                     // First, invalidate the bounding rect
03055                     pLayerToHide->InvalidateBoundingRect();
03056                     // note the next layer
03057                     pLayer = pLayer->FindNextLayer();
03058                     // and hide the layer itself.
03059                     // This will do it undoably if importing, otherwise blatently
03060                     DeleteNode(pLayerToHide);
03061                     /* // Have to do this ourselves as we are not undoable
03062                     pLayerToHide->CascadeDelete();
03063                     delete pLayerToHide; */
03064                     pLayerToHide = NULL;
03065                 }
03066                 else
03067                     pLayer = pLayer->FindNextLayer();
03068 
03069                 // Update the progress display to show we have done something
03070                 CombiningProgress.Update();
03071             }
03072 
03073             // Make sure that our new frame layer is up to date
03074             pNonFrameLayer->InvalidateBoundingRect();
03075 
03076             //pSpread->ValidateBoundingRect();
03077             //pSpread->InvalidateBoundingRect(TRUE);
03078 
03079             // If we have changed a selected node then update the selection
03080             if (UpdateSelection)
03081             {
03082                 // Update the selection range 
03083                 Camelot.UpdateSelection();
03084             }
03085 
03086             // Update the progress display to show we have done something
03087             CombiningProgress.Update();
03088 
03089             // Finally, select the new frame layer as active and fix the other layers
03090             // and their visibility accordingly
03091             // Use an undoable op, if available
03092 //          UndoableOperation * pUndoOp = NULL;
03093             /* if (IsImporting() && (ImportInfo.pOp != NULL))
03094                 pUndoOp = ImportInfo.pOp; */
03095 PORTNOTE("other","Removed FrameSGallery usage")
03096 #ifndef EXCLUDE_FROM_XARALX
03097             FrameSGallery::MakeActiveLayer(pNonFrameLayer, pUndoOp);
03098 #endif
03099 
03100             // We do this afterwards in the caller
03101             /*  // We need to update the display as one or more layer items have changed status
03102             // So tell ourselves about the change. (We are static and so cannot do it directly!)
03103             BROADCAST_TO_ALL(SpreadMsg(pSpread, SpreadMsg::SpreadReason::LAYERCHANGES)); */
03104 
03105             // We don't want to repeat the code below so return now as everything
03106             // should be set up ok
03107             return TRUE;
03108         }
03109     }
03110 //#endif // WEBSTER
03111 
03112     // In Webster, always pick the top layer to be the active layer.
03113     // Used to do this in EnsureActiveLayerIntegrity but now that we have frames/layers
03114     // in Webster we cannot be this blatent. So do what we want here.
03115     // Only pick the last layer to be active if there is no frame layer in the doc. If there
03116     // is a frame layer present then use the active layer saved in the document.
03117     // Use an undoable op, if available
03118 //  UndoableOperation * pUndoOp = NULL;
03119     /* if (IsImporting() && (ImportInfo.pOp != NULL))
03120         pUndoOp = ImportInfo.pOp; */
03121     // Find out if there is a frame layer or not
03122     Layer * pFrameLayer = pSpread->FindLastFrameLayer();
03123     if (pFrameLayer != NULL)
03124     {
03125         // Frame layer present so just ensure that the active layer is selected
03126         // and there is only one of them.
03127         // If we have just imported something then there will be an active layer in this but it
03128         // will be after the active layer that was present BEFORE the import. Therefore, the original
03129         // active layer will be retained and so the user wont see anything.
03130         // Search from the last frame layer backwards until we find an active layer and then choose
03131         // this as the new active layer
03132         Layer * pActiveFrameLayer = NULL;
03133         while (pFrameLayer != NULL && pActiveFrameLayer == NULL)
03134         {
03135             if (pFrameLayer->IsActive())
03136                 pActiveFrameLayer = pFrameLayer;
03137             
03138             pFrameLayer = pFrameLayer->FindPrevFrameLayer();
03139         }
03140         // Try and switch to this new one
03141 PORTNOTE("other","Removed FrameSGallery usage")
03142 #ifndef EXCLUDE_FROM_XARALX
03143         if (pActiveFrameLayer != NULL)
03144             FrameSGallery::MakeActiveLayer(pActiveFrameLayer, pUndoOp);
03145         else
03146             LayerSGallery::EnsureActiveLayerIntegrity(pSpread);
03147 #endif
03148     }
03149     else
03150     {
03151         // No frame layers so make the active layer the last layer in the spread
03152         // This should never be called now as the non-frame layer fixing code should
03153         // have been invoked, leave it in for safeties sake.
03154 PORTNOTE("other","Removed LayerSGallery usage")
03155 //      LayerSGallery::MakeTopLayerActive(pSpread);
03156     }
03157 
03158     return TRUE;
03159 }

BOOL BaseCamelotFilter::EnsureLayerIntegrity Spread pSpread  )  [protected, virtual]
 

Happens at the end of the import to allow the layers to be cleaned up. Mainly used by Camelot so that we can see whether we are using a framed document or a layered document. We must check that:-

  • If the document has frame layers in then we must convert all new layers into frames
  • If the document has no frame layers in, then we must convert all frames into layers.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/10/97
Parameters:
pSpread - the spread to check the layers on. [INPUTS]
Do now as the layers are stable and have all their flags present. We cannot decide when we get the layer record as we would need to wait until we have the layer details record. Then this would not be the complete information until we have seen or not seen as the case may be the frame properties record.

Definition at line 2684 of file camfiltr.cpp.

02685 {
02686     // Search existing layers, if frame layer in there then must convert all new layers into
02687     // frames. Could use existing code below
02688     // If frame layer not there then just make sure that all new layers are not frames
02689     if (IsImporting())
02690     {
02691         // Check if we are in a hidden document. This may be the print marks document.
02692         // In this case we should do nothing.
02693         // Unfortunately the hidden flag is not set in the print marks case which is the one
02694         // we are trying to stop. Instead, print marks have been disabled in Webster builds.
02695         if (TheDocument != NULL && !TheDocument->IsAHiddenDoc())
02696         {
02697             // Ensure that all other non-guide and non-background layers are frame layers
02698             UINT32 OriginalNonFrameLayersFound = 0;
02699             UINT32 OriginalFrameLayersFound = 0;
02700             Layer* pCurrentLayer = NULL;
02701             Layer * pActiveLayer = NULL;
02702             // Search from the first imported layer, so that we only ever combine newly imported
02703             // layers together. Only do when importing.
02704             // Also, find the first active layer in the spread which should be our original active
02705             // layer.
02706             if (m_pFirstImportedLayer == NULL && !IsImporting())
02707                 pCurrentLayer = pSpread->FindFirstLayer();
02708             else
02709             {
02710                 // Account for minimal web files which do not have a layer and so import onto the
02711                 // layer that is constructed for that purpose i.e. pImportLayer
02712                 Layer * pActualFirstImportedLayer = m_pFirstImportedLayer;
02713                 if (m_pFirstImportedLayer == NULL && pImportLayer != NULL)
02714                     pActualFirstImportedLayer = pImportLayer;
02715                 ERROR3IF(pActualFirstImportedLayer == NULL,"BaseCamelotFilter::EnsureLayerIntegrity No first imported layer!");
02716 
02717                 pCurrentLayer = pActualFirstImportedLayer;
02718                 // Check that the other layers in the document before this are all frame layers
02719                 // At present, just mark them as frames as there should always be just one possible
02720                 // non-frame layer present. (From the default doc which is not in the new format)
02721                 Layer* pLayer = pSpread->FindFirstLayer();
02722                 BOOL Finished = FALSE;
02723                 while (pLayer != NULL && !Finished)
02724                 {
02725                     // Only search up to the first imported layer
02726                     if (pLayer == pActualFirstImportedLayer)
02727                     {
02728                         Finished = TRUE;
02729                     }
02730                     else if (pLayer->IsPseudoFrame())
02731                     {
02732                         if (pLayer->IsFrame())
02733                         {
02734                             OriginalFrameLayersFound++;
02735                         }
02736                         else
02737                         {
02738                             OriginalNonFrameLayersFound++;
02739                         }
02740                     }
02741 
02742                     // Note the original active layer, if found 
02743                     if (!Finished && pLayer == m_pActiveLayerBeforeImport) // pLayer->IsPseudoFrame() && pLayer->IsActive())
02744                     {
02745                         pActiveLayer = pLayer;
02746                     }
02747 
02748                     pLayer = pLayer->FindNextLayer();
02749                 }
02750 
02751                 if (OriginalNonFrameLayersFound > 0 || OriginalFrameLayersFound > 0)
02752                 {
02753                     TRACEUSER( "Neville", _T("++++++++++BaseCamelotFilter::EnsureLayerIntegrity %d original frames and %d layers\n"), OriginalFrameLayersFound,OriginalNonFrameLayersFound);
02754                     
02755                 }
02756             }
02757 
02758             // Search through all the new layers to see potential frame ones are frames and which
02759             // are layers.
02760             UINT32 NonFrameLayersFound = 0;
02761             UINT32 FrameLayersFound = 0;
02762             Layer* pNonFrameLayer = NULL; 
02763             const String_32 CustomMarkName(TEXT("_%CUSTOMMA")); // REM 10 long only
02764             const String_32 PrintMarkName(TEXT("%PRINTMARK"));  // REM 10 long only
02765             while (pCurrentLayer != NULL)
02766             {
02767                 // Check if we are one of the uniquely named layers in the print marks document
02768                 String_256 LayerName = pCurrentLayer->GetLayerID();
02769                 String_32 StartOfName;
02770                 LayerName.Left(&StartOfName, 10);  
02771 
02772                 // The layer has to pass a lot of tests to be counted!
02773                 if (pCurrentLayer->IsPseudoFrame() &&
02774                     StartOfName != CustomMarkName && StartOfName != PrintMarkName)
02775                 {
02776                     if (pCurrentLayer->IsFrame())
02777                     {
02778                         FrameLayersFound++;
02779                     }
02780                     else
02781                     {
02782                         // Note that we have found a non-frame layer.
02783                         if (pNonFrameLayer == NULL)
02784                             pNonFrameLayer = pCurrentLayer;
02785                         NonFrameLayersFound++;
02786                     }
02787                 }
02788 
02789                 pCurrentLayer = pCurrentLayer->FindNextLayer();
02790             }
02791 
02792             if (NonFrameLayersFound > 0 || FrameLayersFound > 0)
02793             {
02794                 TRACEUSER("Neville", _T("++++++++++BaseCamelotFilter::EnsureLayerIntegrity %d new frames and %d layers\n"),FrameLayersFound,NonFrameLayersFound);
02795                 
02796             }
02797 
02798             // Decision time, now that we have decided what layers/frames we had before the import
02799             // and what layers/frames have been loaded
02800             if (OriginalFrameLayersFound > 0)
02801             {
02802                 // We had frames so ensure that we do not have layers in the new document
02803                 // Use the Webster code to strip all extraneous layers into one new frame
02804                 BaseCamelotFilter::EnsureFrameLayerIntegrity(pSpread);
02805 
02806                 // This will ensure that there is an active frame layer so we needn't
02807             }
02808             else
02809             {
02810                 // We had layers so ensure that there are no frames in the new document
02811                 Layer* pLayer = pSpread->FindFirstLayer();
02812                 BOOL Finished = FALSE;
02813                 while (pLayer != NULL && !Finished)
02814                 {
02815                     // Ensure ALL layers are not frames
02816                     pLayer->SetFrame(FALSE);
02817                     // Get next one
02818                     pLayer = pLayer->FindNextLayer();
02819                 }               
02820 
02821 PORTNOTE("other","Removed LayerSGallery usage")
02822                 // Not importing so just ensure that there is one active layer in the document.
02823 #ifndef EXCLUDE_FROM_XARALX
02824                 LayerSGallery::EnsureActiveLayerIntegrity(pSpread);
02825 #endif
02826             }
02827         }       
02828     }
02829     else
02830     {
02831 PORTNOTE("other","Removed LayerSGallery usage")
02832         // Not importing so just ensure that there is one active layer in the document.
02833 #ifndef EXCLUDE_FROM_XARALX
02834         LayerSGallery::EnsureActiveLayerIntegrity(pSpread);
02835 #endif
02836     }
02837 
02838     return TRUE;
02839 }

void BaseCamelotFilter::ExportHTMLTag PathName ppthToUse  )  [virtual]
 

Exports an HTML tag to the clipboard that can be used in a page of HTML to embed the file that is being exported.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/5/97
Parameters:
- [INPUTS]
Returns:
-

Definition at line 7617 of file camfiltr.cpp.

07618 {
07619     PORTNOTETRACE("other","BaseCamelotFilter::ExportHTMLTag - do nothing");
07620 #ifndef EXCLUDE_FROM_XARALX
07621     //Check our parameter
07622     if (ppthToUse==NULL)
07623     {
07624         ERROR2RAW("BaseCamelotFilter::ExportHTMLTag - NULL parameter");
07625         return;
07626     }
07627 
07628     //First get the name of the file we are exporting to
07629     String_256 strFileName=ppthToUse->GetFileName(TRUE);
07630 
07631     //Now we need to get the width and height of the document we are exporting,
07632     //scaled by 96 DPI
07633 
07634     //So first find out what are we are exporting
07635     SelectionType stExportArea=GetSelType();
07636 
07637     //And get the DocRect enclosing that area, using this useful static function
07638     DocRect rectExportArea=ImagemapFilterOptions::GetSizeOfExportArea(stExportArea);
07639 
07640     //Scale it to 96 DPI
07641     WinRect wrectExportArea = OSRenderRegion::BitmapDocRectToWin(Matrix(), rectExportArea, 96);
07642 
07643     //Now, put all these values into our formatting string
07644     String_256          strTag;
07645     strTag.MakeMsg( _R(IDS_WEBFILTER_HTMLTAG), &strFileName, wrectExportArea.GetWidth(), 
07646         wrectExportArea.GetHeight() );
07647 
07648     //And put that string on the clipboard
07649     InternalClipboard::CopyText(strTag);
07650 #endif
07651 }

BOOL BaseCamelotFilter::ExportPreviewBitmap CCLexFile pFile,
Operation pOp,
PathName pPath,
Document pDoc
[protected, virtual]
 

Exports a preview bitmap into the file in the correct format.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/5/96
Parameters:
pFile - the file to put the exported data into [INPUTS] pOp - the operation that started the export off pPath - the pathname of the file being exported pDoc - the document to export
Returns:
TRUE if worked, FALSE if failed.
See also:
DoExport;

Definition at line 3979 of file camfiltr.cpp.

03981 {
03982 #ifdef DO_EXPORT
03983     ERROR2IF(pOp == NULL, FALSE,"BaseCamelotFilter::ExportPreviewBitmap no export operation");
03984     ERROR2IF(pFile == NULL, FALSE,"BaseCamelotFilter::ExportPreviewBitmap no file to export to");
03985     ERROR2IF(pPath == NULL, FALSE,"BaseCamelotFilter::ExportPreviewBitmap no PathName to export to");
03986     ERROR2IF(pDoc == NULL, FALSE,"BaseCamelotFilter::ExportPreviewBitmap no document to export");
03987 
03988     // Do we want a Preview Bitmap while we are here?
03989     // We should always want it in native files
03990     // In Web files we will only want them if the user requests them
03991     BOOL WantPreviewBmp = GetPreviewBitmapExport(); //TRUE;
03992     //if (IsWebFilter() && !PreviewBitmapExport)
03993     //  WantPreviewBmp = FALSE; 
03994 
03995     if (WantPreviewBmp)
03996     {
03997         // Go and find the correct Preview Bitmap Exporter
03998         UINT32 SearchFilter = FILTERID_PREVIEW_GIF;
03999         UINT32 Tag = TAG_PREVIEWBITMAP_GIF;
04000 
04001         // Use the preference to work out which filter we require
04002         switch (PreviewBitmapFilterType)
04003         {
04004             case 0:
04005                 SearchFilter = FILTERID_PREVIEW_BMP;
04006                 Tag = TAG_PREVIEWBITMAP_BMP;
04007                 break;
04008             case 1:
04009                 SearchFilter = FILTERID_PREVIEW_GIF;
04010                 Tag = TAG_PREVIEWBITMAP_GIF;
04011                 break;
04012             case 2:
04013                 SearchFilter = FILTERID_PREVIEW_JPEG;
04014                 Tag = TAG_PREVIEWBITMAP_JPEG;
04015                 // Force the Accusoft filters to use a 75% compression by default
04016                 //WEBSTER-Martin-02/01/97
04017                 //AccusoftFilters::SetExportCompressionQuality(75);
04018                 break;
04019             case 3:
04020                 SearchFilter = FILTERID_PREVIEW_PNG;
04021                 Tag = TAG_PREVIEWBITMAP_PNG;
04022                 break;
04023             case 4:
04024                 SearchFilter = FILTERID_PREVIEW_TIFF;
04025                 Tag = TAG_PREVIEWBITMAP_TIFFLZW;
04026                 break;
04027         }
04028 
04029         Filter* pFilter = NULL;
04030         pFilter = Filter::GetFirst();
04031         while ((pFilter != NULL) && (pFilter->FilterID != SearchFilter))
04032         {
04033             // Try the next filter
04034             pFilter = Filter::GetNext(pFilter);
04035         }
04036 
04037         // Make sure that we found the preview bitmap filter
04038         if ((pFilter != NULL) && (pFilter->IS_KIND_OF(BaseBitmapFilter)))
04039         {
04040             BitmapFillAttribute::m_doBitmapSmoothing = FALSE;           // we don't want bitmaps to be smoothed for previews
04041             BitmapTranspFillAttribute::m_doBitmapSmoothing = FALSE;     // we don't want bitmaps to be smoothed for previews
04042 
04043             // Get the system to start us a streamed preview bitmap record ready
04044             // to take the bitmap data
04045             INT32 RecordNumber =    StartStreamedRecord(Tag, CXF_UNKNOWN_SIZE);
04046             // If we had a problem starting the record up then exit now
04047             if (RecordNumber <= 0)
04048             {
04049                 BitmapFillAttribute::m_doBitmapSmoothing = TRUE;            // turn bitmap smoothing back on for normal rendering/printing
04050                 BitmapTranspFillAttribute::m_doBitmapSmoothing = TRUE;      // turn bitmap smoothing back on for normal rendering/printing
04051                 return TRUE;
04052             }
04053 
04054             // As we are the Native (or Web) file Exporter, then we want to force
04055             // the Preview to a fixed size
04056             //WEBSTER-Martin-10/01/97
04057             INT32 OldPreviewSize = PreviewFilter::PreviewBitmapSize;
04058             // Set the Preview to be just over an inch accross
04059             PreviewFilter::PreviewBitmapSize = 96000;
04060 
04061             // Get as Bitmap Filter and set it up
04062             BaseBitmapFilter* pBitmapFilter = (BaseBitmapFilter*) pFilter;
04063             pBitmapFilter->SetPreviewBitmap(TRUE);
04064 
04065             // Export the Preview to the file
04066             BOOL ok = pFilter->DoExport(pOp, pFile, pPath, TheDocument);
04067             // If the Preview bitmap failed to export then we still need to clean up
04068 
04069             // Set it back
04070             pBitmapFilter->SetPreviewBitmap(FALSE);
04071             // Set the Preview back to its default setting
04072             //WEBSTER-Martin-10/01/97
04073             PreviewFilter::PreviewBitmapSize = OldPreviewSize;
04074 
04075             // Ask for the record to be ended and hence items like the size in the record header
04076             // to be cleaned up and hence made correct
04077             if (ok) ok = EndStreamedRecord();
04078 
04079             BitmapFillAttribute::m_doBitmapSmoothing = TRUE;            // turn bitmap smoothing back on for normal rendering/printing
04080             BitmapTranspFillAttribute::m_doBitmapSmoothing = TRUE;      // turn bitmap smoothing back on for normal rendering/printing
04081             
04082             return ok;
04083         }
04084         
04085         BitmapFillAttribute::m_doBitmapSmoothing = TRUE;            // turn bitmap smoothing back on for normal rendering/printing
04086         BitmapTranspFillAttribute::m_doBitmapSmoothing = TRUE;      // turn bitmap smoothing back on for normal rendering/printing
04087     }
04088 
04089     return TRUE;
04090 #else
04091     return FALSE;
04092 #endif
04093 }

BOOL BaseCamelotFilter::FindDocComponents  )  [protected, virtual]
 

Finds ptrs to all the doc components the filter is interested in. If it can't find all of them, FALSE will be returned.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/7/96
Parameters:
- [INPUTS]
Returns:
TRUE if worked, FALSE if failed.
Notes: This is import as well as export

See also:
PrepareToExport, EndExportDocComponents

Definition at line 3791 of file camfiltr.cpp.

03792 {
03793     // Inform all the document components that we are about to export
03794     DocComponent *pComponent = TheDocument->EnumerateDocComponents(NULL);
03795 
03796     while (pComponent != NULL)
03797     {
03798         if (pComponent->IS_KIND_OF(ColourListComponent))
03799             pColComponent = (ColourListComponent*)pComponent;
03800         else if (pComponent->IS_KIND_OF(BitmapListComponent))
03801             pBmpComponent = (BitmapListComponent*)pComponent;
03802         else if (pComponent->IS_KIND_OF(UnitListComponent))
03803             pUnitsComponent = (UnitListComponent*)pComponent;
03804         else if (pComponent->IS_KIND_OF(DocInfoComponent))
03805             pInfoComponent = (DocInfoComponent*)pComponent;
03806         else if (pComponent->IS_KIND_OF(ViewComponent))
03807             pViewComponent = (ViewComponent*)pComponent;
03808 #if !defined(EXCLUDE_FROM_RALPH)
03809         else if (pComponent->IS_KIND_OF(PrintComponent))
03810             pPrintComponent = (PrintComponent*)pComponent;
03811 #endif
03812         else if (pComponent->IS_KIND_OF(FontComponent))
03813             pFontComponent = (FontComponent*)pComponent;
03814 
03815         // Look for next doc component
03816         pComponent = TheDocument->EnumerateDocComponents(pComponent);
03817     }
03818 
03819     if (    pColComponent   == NULL ||
03820             pBmpComponent   == NULL ||
03821             pUnitsComponent == NULL ||
03822             pInfoComponent  == NULL ||
03823             pViewComponent  == NULL ||
03824             pPrintComponent == NULL ||
03825             pFontComponent  == NULL)
03826     {
03827         ERROR3("Unable to find ptrs to all the objects required for import/export");
03828         return FALSE;
03829     }
03830 
03831     return TRUE;
03832 }

NodeGroup * BaseCamelotFilter::FindGroupForThisNode Node pNode  )  [virtual]
 

Finds the group associated with the node.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/1/97
Parameters:
pNode = ptr to a node [INPUTS]
Returns:
ptr to a group that's associated with the node NULL is returned if the group could not be found
WEBSTER - markn 29/1/97 Part of the general form of the system used to convert text to outlines in v1.5

See also:
BaseCamelotFilter::PrepareToImport; BaseCamelotFilter::DoImport Scope: Protected

Reimplemented in CamelotNULLNativeFilter, and CamelotNULLWebFilter.

Definition at line 7581 of file camfiltr.cpp.

07582 {
07583     ERROR3IF(pNode == NULL,"Null pNode entry param");
07584 
07585     if (pNode != NULL)
07586     {
07587         if (pNodeGroupRefList != NULL)
07588         {
07589             CXaraFileNodeGroupRefListItem* pItem = pNodeGroupRefList->GetHead();
07590             while (pItem != NULL)
07591             {
07592                 if (pItem->GetNode() == pNode)
07593                     return pItem->GetNodeGroup();
07594 
07595                 pItem = pNodeGroupRefList->GetNext(pItem);
07596             }
07597         }
07598     }
07599 
07600     return NULL;
07601 }

NodePath * BaseCamelotFilter::FindPathRecordRefPath UINT32  RecordNumber  )  [virtual]
 

Finds the path for the given record number.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/8/96
Parameters:
RecordNumber = the record number of the record that holds this path [INPUTS]
Returns:
pNodePath = ptr to a node path object NULL is returned if path could not be found
See also:
BaseCamelotFilter::PrepareToImport; BaseCamelotFilter::DoImport Scope: Protected

Definition at line 7214 of file camfiltr.cpp.

07215 {
07216     ERROR3IF(RecordNumber == 0,"Zero entry record number");
07217 
07218     if (RecordNumber != 0)
07219     {
07220         if (pPathRecordRefList != NULL)
07221         {
07222             CXaraFilePathRecordRefListItem* pItem = pPathRecordRefList->GetHead();
07223             while (pItem != NULL)
07224             {
07225                 if (pItem->GetRecordNumber() == RecordNumber)
07226                     return pItem->GetNodePath();
07227 
07228                 pItem = pPathRecordRefList->GetNext(pItem);
07229             }
07230         }
07231     }
07232 
07233     return NULL;
07234 }

UINT32 BaseCamelotFilter::FindPathRecordRefRecordNumber NodePath pNodePath  )  [virtual]
 

Finds the record number for the given path.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/8/96
Parameters:
pNodePath = ptr to a node path object [INPUTS]
Returns:
RecordNumber = the record number of the record that holds this path 0 is returned if path could not be found
See also:
BaseCamelotFilter::PrepareToImport; BaseCamelotFilter::DoImport Scope: Protected

Definition at line 7175 of file camfiltr.cpp.

07176 {
07177     ERROR3IF(pNodePath == NULL,"Null entry param");
07178 
07179     if (pNodePath != NULL)
07180     {
07181         if (pPathRecordRefList != NULL)
07182         {
07183             CXaraFilePathRecordRefListItem* pItem = pPathRecordRefList->GetHead();
07184             while (pItem != NULL)
07185             {
07186                 if (pItem->GetNodePath() == pNodePath)
07187                     return pItem->GetRecordNumber();
07188 
07189                 pItem = pPathRecordRefList->GetNext(pItem);
07190             }
07191         }
07192     }
07193 
07194     return 0;
07195 }

BOOL BaseCamelotFilter::FindSimilarPath NodePath pNodePath,
UINT32 pOtherPathRecNum,
Matrix pTransform
[virtual]
 

Finds a similar path to the one provided that has previously been output to the file.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/9/96
Parameters:
pNodePath = ptr to path to match [INPUTS] pOtherPathRecNum= ptr to place the record number of a similar path, if one's found pTransform = ptr to place transformation matrix
Returns:
TRUE
It scans the list of previously outputted paths

See also:
BaseCamelotFilter::PrepareToImport; BaseCamelotFilter::DoImport Scope: Protected

Definition at line 7256 of file camfiltr.cpp.

07257 {
07258     ERROR2IF(pNodePath == NULL,FALSE,"NULL src path ptr");
07259     ERROR2IF(pOtherPathRecNum == NULL,FALSE,"NULL other rec num ptr");
07260     ERROR2IF(pTransform == NULL,FALSE,"NULL matrix ptr");
07261 
07262     BOOL Found = FALSE;
07263     INT32 PathCount = GetMaxPathLookUp();
07264 
07265     if (pPathRecordRefList != NULL)
07266     {
07267         CXaraFilePathRecordRefListItem* pItem = pPathRecordRefList->GetTail();
07268         while (pItem != NULL && !Found && PathCount != 0)
07269         {
07270             PathCount--;
07271 
07272             NodePath* pOtherNodePath = pItem->GetNodePath();
07273 
07274             if (pOtherNodePath != NULL)
07275             {
07276                 // Is the given path the similar to the other path?
07277                 // First, do a fast check - if the num coords is different, then forget it.
07278                 if (pNodePath->InkPath.GetNumCoords() == pOtherNodePath->InkPath.GetNumCoords())
07279                 {
07280                     // We need the coord origin
07281                     DocCoord Origin = GetCoordOrigin();
07282 
07283                     // Translate the two paths by the coord origin.
07284                     // This turns the path coords into the form in which they appear in the file
07285                     //
07286                     // Remember, all absolute coords of objects (such as path coords) get translated before
07287                     // being output to the file, so that the coord's origin is at the page origin, rather
07288                     // than the spread origin.  This allows us to import the same file into a different doc
07289                     // and still position objects that are the same relative distance from the new page origin
07290                     //
07291                     // The following translation turns the path's coord values into the exact values that
07292                     // appear in the file.  This is important if IsIsometric() creates a transform for us
07293                     // to use.  The transform has to be valid for the path that ends up in the file, and not
07294                     // the one in the document, because that is the path that's going to be read during import.
07295                     
07296                     {
07297                         Matrix          TranslateMat(-Origin.x,-Origin.y);
07298                         Trans2DMatrix   Trans(TranslateMat);
07299                         pNodePath->Transform(Trans);
07300                         pOtherNodePath->Transform(Trans);
07301                     }
07302 
07303                     // Now, can the path be described using the other path and a transform?
07304                     Found = pOtherNodePath->InkPath.IsIsometric(pNodePath->InkPath,pTransform,GetSimilarPathTolerance(pNodePath));
07305                     if (Found)
07306                     {
07307                         // If so, make a note of the record number which contains the source path data
07308                         *pOtherPathRecNum = pItem->GetRecordNumber();
07309                     }
07310 
07311                     // Translate the paths back to the original position
07312                     {
07313                         Matrix          TranslateMat(Origin.x,Origin.y);
07314                         Trans2DMatrix   Trans(TranslateMat);
07315                         pNodePath->Transform(Trans);
07316                         pOtherNodePath->Transform(Trans);
07317                     }
07318                 }
07319             }
07320 
07321             pItem = pPathRecordRefList->GetPrev(pItem);
07322         }
07323     }
07324 
07325     return Found;
07326 }

INT32 BaseCamelotFilter::GetBitmapCompression  )  [virtual]
 

Public access to the current bitmap compression which the user has requested to use when saving bitmaps in the web format. 0 means maximum compression e.g. use JPEG filter at 0% lossy compression 100 means minimum compression e.g. use JPEG filter at 100% lossy compression 101 - 200 means lossless compression e.g. us PNG filter. Could use the no bitmap compression at all e.g. use BMP filter. Unused at present. (Very much like the JPEG compression percentage). Note: Virtual so that can be overriden in native filter to save in the proper native state.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/6/96
Parameters:
- [INPUTS]
Returns:
The current state of the bitmap compression.

Reimplemented in FlareTemplateFilter, CamelotNativeFilter, and PluginNativeFilter.

Definition at line 903 of file camfiltr.cpp.

00904 {
00905     return BaseCamelotFilter::BitmapCompression;
00906 }

BitmapListComponent* BaseCamelotFilter::GetBitmapDocComponent  )  [inline]
 

Definition at line 292 of file camfiltr.h.

00292 { return pBmpComponent; }

virtual BoundsWriteLevel BaseCamelotFilter::GetBoundsWriteLevel  )  [inline, virtual]
 

Reimplemented in PluginNativeFilter.

Definition at line 815 of file camfiltr.h.

00815 { return(BWL_NONE); }

virtual WebPrefsDlgParam* BaseCamelotFilter::GetCachedExportOptions  )  [inline, virtual]
 

Reimplemented in CamelotNativeFilter, and PluginNativeFilter.

Definition at line 339 of file camfiltr.h.

00339 { return pPrefs; }

CCLexFile * BaseCamelotFilter::GetCCFile  )  [virtual]
 

Function to give public access to the underlying CCFile that is being used to save out the data. Note: only people who have a genuine reason need to access this - e.g. bitmap savers.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/6/96
Parameters:
- [INPUTS]
Returns:
The CCFile that is being used to export the data.

Errors: -

See also:
BitmapListComponent::SaveBitmapDefinition

Definition at line 2001 of file camfiltr.cpp.

02002 {
02003     ERROR2IF(pCXaraFile == NULL,FALSE,"BaseCamelotFilter::GetCCFile pCXaraFile is NULL");
02004     return pCXaraFile->GetCCFile();
02005     
02006 }

UINT32 BaseCamelotFilter::GetChapterInsertedCount  )  [inline]
 

Definition at line 624 of file camfiltr.h.

00624 { return ChapterCount; }

ColourListComponent* BaseCamelotFilter::GetColourDocComponent  )  [inline]
 

Definition at line 291 of file camfiltr.h.

00291 { return pColComponent; }

BOOL BaseCamelotFilter::GetConvertBlendsToOutlines  )  [virtual]
 

Public access to the current convert text to outlines which the user has requested to use when saving in the web format. True means convert blends to outlines, False means do not.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/1/97
Parameters:
- [INPUTS]
Returns:
The current state of the convert blends to outlines.
Added for WEBSTER

Note: Virtual so that can be overriden in native filter to save in the proper native state

Reimplemented in FlareTemplateFilter.

Definition at line 1038 of file camfiltr.cpp.

01039 {
01040 #ifdef _BATCHING
01041     return FALSE;
01042 #else
01043     return BaseCamelotFilter::ConvertBlendsToOutlines;
01044 #endif
01045 }

BOOL BaseCamelotFilter::GetConvertTextToOutlines  )  [virtual]
 

Public access to the current convert text to outlines which the user has requested to use when saving in the web format. True means convert text to outlines, False means do not. Note: Virtual so that can be overriden in native filter to save in the proper native state.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/6/96
Parameters:
- [INPUTS]
Returns:
The current state of the convert text to outlines.

Reimplemented in FlareTemplateFilter, CamelotNativeFilter, and PluginNativeFilter.

Definition at line 990 of file camfiltr.cpp.

00991 {
00992 #ifdef _BATCHING
00993     return FALSE;
00994 #else
00995     return BaseCamelotFilter::ConvertTextToOutlines;
00996 #endif
00997 }

DocCoord BaseCamelotFilter::GetCoordOrigin  ) 
 

The Get function.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/6/96
Parameters:
- [INPUTS]
Returns:
The orgin applied to all spread coords
See also:
Spread::WritePreChildrenWeb(BaseCamelotFilter* pFilter), SetCoordOrigin() Scope: -

Definition at line 5559 of file camfiltr.cpp.

05560 {
05561     return CoordOrigin;
05562 }

UINT32 BaseCamelotFilter::GetCurrentRecordSize  )  [virtual]
 

Function to get the current size of the record that has been read in by the CXaraFile and RecordHandlers and are currently processing. This can be used by streamed record handlers, such as bitmaps, which need to know the size of the recordso that they can update the progress bar size by a proportion of this amount on loading. (Not require on saving as the streamed record handlers can supply what value they like to the progress system and hence update with whatever value they require.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/8/96
Parameters:
- [INPUTS]
Returns:
The size of the current record.

Definition at line 2026 of file camfiltr.cpp.

02027 {
02028     ERROR2IF(pCXaraFile == NULL,FALSE,"BaseCamelotFilter::GetCurrentRecordSize pCXaraFile is NULL");
02029     return pCXaraFile->GetCurrentRecordSize();
02030 }

OpDescriptor * BaseCamelotFilter::GetDialogueOp void   )  [protected, virtual]
 

Obtains a pointer to the OpDescriptor to be used to access the relevant export dialogue.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/10/00
Parameters:
- [INPUTS]
Returns:
The OpDescriptor pointing to the dialogue used by the export proceedure.

Reimplemented in CamelotWebFilter.

Definition at line 3676 of file camfiltr.cpp.

03677 {
03678     // Just return the found OpDescriptor.
03679     return OpDescriptor::FindOpDescriptor( CC_RUNTIME_CLASS( NativePrefsDlg ) );
03680 }

DocInfoComponent* BaseCamelotFilter::GetDocInfoComponent  )  [inline]
 

Definition at line 294 of file camfiltr.h.

00294 { return pInfoComponent; }

virtual Document* BaseCamelotFilter::GetDocument  )  [inline, virtual]
 

Reimplemented from Filter.

Definition at line 302 of file camfiltr.h.

00302 { return TheDocument; }

UINT32 BaseCamelotFilter::GetDocumentInsertedCount  )  [inline]
 

Definition at line 623 of file camfiltr.h.

00623 { return DocumentCount; }

String_256 BaseCamelotFilter::GetDontConvertTheseFontsToOutlinesString  )  [virtual]
 

Access func to that fint list dude.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/8/96
Parameters:
- [INPUTS]
Returns:
The string of fonts that shouldn't be converted to shapes

Definition at line 1284 of file camfiltr.cpp.

01285 {
01286     return DontConvertTheseFontsToOutlines;
01287 }

virtual char* BaseCamelotFilter::GetExportFileType  )  [pure virtual]
 

Implemented in CamelotNativeFilter, CamelotWebFilter, and PluginNativeFilter.

Node * BaseCamelotFilter::GetExportNode  )  [protected, virtual]
 

Returns a pointer to the first node to export.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/02/2005
Returns:
NULL in times of grief

Reimplemented in PluginNativeFilter.

Definition at line 4221 of file camfiltr.cpp.

04222 {
04223     // JCF: changed to begin writing with the first node following the last default attribute,
04224     // and to simply write out every node at the second level of the tree, not only Chapters,
04225     // so the traversal will include the NodeSetSentinel and its children.
04226     Node* pNode = TheDocument->GetFirstNode();
04227     if (pNode != 0 && pNode->FindNext() != 0)
04228     {
04229         pNode = pNode->FindNext()->FindLastChild(CC_RUNTIME_CLASS(NodeAttribute));
04230         if (pNode != 0) pNode = pNode->FindNext();
04231     }
04232 
04233     return(pNode);  
04234 }

BOOL BaseCamelotFilter::GetExportOptions WebPrefsDlgParam pPrefs  )  [protected, virtual]
 

Allows the user to be prompted to get information for export. This overriden version returns True so that nothing happens. Scope: Protected.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/5/96
Parameters:
pPrefs - the WebPrefsDlgParam class which holds all of the preferences that [INPUTS] can be set.
pPrefs - new versions [OUTPUTS]
Returns:
TRUE if OK, FALSE if user pressed Cancel.

Reimplemented in PluginNativeFilter.

Definition at line 3597 of file camfiltr.cpp.

03598 {
03599 // WEBSTER - markn 28/1/97
03600 // Not needed in Webster
03601 #ifdef WEBSTER
03602     return TRUE;
03603 #else
03604 
03605 #ifdef DO_EXPORT
03606     ERROR2IF(pPrefs == NULL, FALSE, "CamelotWebFilter::GetExportOptions null pPrefs");
03607 
03608     // Use the preference option in the baseclass camelot filter
03609     pPrefs->SetCompression(GetNativeCompression());
03610 
03611     // Use the preference option in the baseclass camelot filter;
03612     pPrefs->SetBmpCompression           ( GetBitmapCompression () );
03613     pPrefs->SetExportPreviewBitmap      ( GetPreviewBitmapExport () );
03614     pPrefs->SetConvertTextToOutlines    ( GetConvertTextToOutlines () );
03615     pPrefs->SetConvertBlendsToOutlines  ( GetConvertBlendsToOutlines () );
03616     pPrefs->SetRemoveInvisibleLayers    ( GetRemoveInvisibleLayers () );
03617     pPrefs->SetRemoveUnusedColours      ( GetRemoveUnusedColours () );
03618     pPrefs->SetMinimalWebFormat         ( BaseCamelotFilter::MinimalWebFormat );
03619     pPrefs->SetHTMLToClipboard          ( ShouldExportHTMLTag () );
03620     pPrefs->SetWebOk                    ( FALSE );
03621 
03622     // Find an associated OpDescriptor.
03623     OpDescriptor *pOp = GetDialogueOp ();
03624 
03625     // Call the op.
03626     if ( pOp != NULL )
03627     {
03628         pOp->Invoke ( static_cast <OpParam*> ( pPrefs ) );
03629     }
03630 
03631     // For now, always use the compression option, regardless of ok/cancel used
03632     // Means you can change the native option by using the web options dialog box
03633     // without having to save the file
03634 
03635     // Use the preference option in the baseclass camelot filter
03636     if ( pPrefs->GetWebOk () )
03637     {
03638         // Set up some returned variables as the user has oked them
03639         SetBitmapCompression        ( pPrefs->GetBmpCompression () );
03640         SetPreviewBitmapExport      ( pPrefs->GetExportPreviewBitmap () );
03641         SetConvertTextToOutlines    ( pPrefs->GetConvertTextToOutlines () );
03642         SetRemoveInvisibleLayers    ( pPrefs->GetRemoveInvisibleLayers () );
03643         SetRemoveUnusedColours      ( pPrefs->GetRemoveUnusedColours () );
03644         SetHTMLToClipboard          ( pPrefs->GetHTMLToClipboard () );
03645 
03646         BaseCamelotFilter::MinimalWebFormat = pPrefs->GetMinimalWebFormat ();
03647 
03648         return TRUE;
03649     }
03650 
03651     // It didn't work.
03652     else
03653     {
03654         return FALSE;
03655     }
03656 
03657 #else
03658     return FALSE;
03659 #endif  // DO_EXPORT
03660 #endif  // WEBSTER
03661 }

BOOL BaseCamelotFilter::GetFileCompressionState  )  [protected, virtual]
 

Get the current file compression state. True if compressing.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/5/96
Returns:
The current state of the file compression.

Definition at line 878 of file camfiltr.cpp.

00879 {
00880     return CompressionOn;
00881 }

FilePos BaseCamelotFilter::GetFilePos  ) 
 

Definition at line 5619 of file camfiltr.cpp.

05620 {
05621     if (pCXaraFile != NULL)
05622         return pCXaraFile->GetFilePos();
05623 
05624     return 0;
05625 }

virtual Layer* BaseCamelotFilter::GetFirstImportedLayer  )  [inline, virtual]
 

Definition at line 688 of file camfiltr.h.

00688 { return m_pFirstImportedLayer; }

FontComponent* BaseCamelotFilter::GetFontComponent  )  [inline]
 

Definition at line 297 of file camfiltr.h.

00297 { return pFontComponent; }

SelOperation* BaseCamelotFilter::GetImportSelOp  )  const [inline]
 

Definition at line 533 of file camfiltr.h.

00533 { return ImportInfo.pOp; }

InsertTreeContext * BaseCamelotFilter::GetInsertContext void   )  [virtual]
 

If you wish to use SetInsertcontextNode to alter where the filter imports to, then chances are you'll want to save & restore the insertion state so that subsequent importing can continue where it left off. If this is the case, bracket your subtree import with code like this: InsertTreeContext *pContext = pFilter->GetInsertContext(); ... import your subtree or whatever ... pFilter->RestoreInsertContext(pContext);.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/3/97
Returns:
A pointer to a record from which the current insertion context can be restored at a later date.
See also:
BaseCamelotFilter::RestoreInsertContext

Definition at line 6101 of file camfiltr.cpp.

06102 {
06103     InsertTreeContext *pContext = new InsertTreeContext;
06104     if (pContext != NULL)
06105     {
06106         pContext->pContextNode  = GetInsertContextNode();
06107         pContext->InsertAsChild = InsertNextAsChild;
06108     }
06109 
06110     return(pContext);
06111 }

Node * BaseCamelotFilter::GetInsertContextNode  )  [virtual]
 

Returns the node to add the next node to.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/5/96
Parameters:
- [INPUTS]
Returns:
ptr to the context node
If no context node is found, then a context node is found (and if necessary created) by this function

See also:
BaseCamelotFilter::PrepareToImport; BaseCamelotFilter::DoImport Scope: Protected

Definition at line 5867 of file camfiltr.cpp.

05868 {
05869     if (pInsertContextNode == NULL)
05870     {
05871         ERROR2IF(TheDocument == NULL,FALSE,"TheDocument is NULL!");
05872 
05873         Chapter* pChapter = Node::FindFirstChapter(TheDocument);
05874         if (pChapter != NULL)
05875         {
05876             Spread* pSpread = pChapter->FindFirstSpread();
05877             if (pSpread != NULL)
05878             {
05879                 Layer* pLayer = pSpread->FindFirstLayer();
05880                 if (pLayer == NULL)
05881                 {
05882                     pLayer = new Layer;
05883                     if (pLayer != NULL)
05884                     {
05885                         if (!AttachNode(pLayer,pSpread,LASTCHILD))
05886                             return NULL;
05887 
05888                         String_256 Name1(_R(IDS_K_EPSFILTER_IMPORTED));
05889                         String_256 Name2(_R(IDS_LAYER_DESCRS));
05890                         Name1 += Name2;
05891                         pLayer->SetLayerID(Name1);
05892                         pLayer->EnsureUniqueLayerID();
05893                     }
05894                 }
05895 
05896                 pInsertContextNode = pLayer;
05897                 InsertNextNodeAsChild();
05898             }
05899         }
05900     }
05901 
05902     return pInsertContextNode;
05903 }

virtual InsertMode BaseCamelotFilter::GetInsertMode  )  [inline, virtual]
 

Definition at line 640 of file camfiltr.h.

00640 {return m_InsertMode;}

Chapter* BaseCamelotFilter::GetLastChapterInserted  )  [inline]
 

Definition at line 610 of file camfiltr.h.

00610 { return pLastChapter; }

NodeAttribute* BaseCamelotFilter::GetLastCurrentAttrInserted  )  [inline]
 

Definition at line 614 of file camfiltr.h.

00614 { return pLastCurrentAttr; }

Document* BaseCamelotFilter::GetLastDocumentInserted  )  [inline]
 

Definition at line 609 of file camfiltr.h.

00609 { return pLastDocument; }

Layer* BaseCamelotFilter::GetLastLayerInserted  )  [inline]
 

Definition at line 612 of file camfiltr.h.

00612 { return pLastLayer; }

NodePath* BaseCamelotFilter::GetLastNodePathInserted  )  [inline]
 

Definition at line 613 of file camfiltr.h.

00613 { return pLastNodePath; }

Spread* BaseCamelotFilter::GetLastSpreadInserted  )  [inline]
 

Definition at line 611 of file camfiltr.h.

00611 { return pLastSpread; }

UINT32 BaseCamelotFilter::GetLayerInsertedCount  )  [inline]
 

Definition at line 626 of file camfiltr.h.

00626 { return LayerCount; }

INT32 BaseCamelotFilter::GetMaxPathLookUp  )  [virtual]
 

The max number pf paths that should be looked at by the function FindSimilarPath().

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/9/96
Parameters:
- [INPUTS]
Returns:
-1 always
-1 means no limit

See also:
BaseCamelotFilter::PrepareToImport; BaseCamelotFilter::DoImport Scope: Protected

Reimplemented in CamelotNativeFilter, CamelotWebFilter, and PluginNativeFilter.

Definition at line 7345 of file camfiltr.cpp.

07346 {
07347     return -1;
07348 }

BOOL BaseCamelotFilter::GetMinimalWebFormat  )  [virtual]
 

Public access function.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/1/97
Parameters:
- [INPUTS]
Returns:
The current state of the min web format flag
WEBSTER - 28/1/97 Note:

Reimplemented in FlareTemplateFilter.

Definition at line 1208 of file camfiltr.cpp.

01209 {
01210     return BaseCamelotFilter::MinimalWebFormat;
01211 }

BOOL BaseCamelotFilter::GetNativeCheckSimilarPaths  )  [virtual]
 

Public access to the current Native check similar paths flag setting.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/9/96
Parameters:
- [INPUTS]
Returns:
The current state of the Native check similar paths flag.

Definition at line 1301 of file camfiltr.cpp.

01302 {
01303     return BaseCamelotFilter::NativeCheckSimilarPaths;
01304 }

BOOL BaseCamelotFilter::GetNativeCompression  )  [static]
 

Set the prefernece as to whether we are to compress the native files or not.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/5/96
Parameters:
New state for native file compression, TRUE if want on, FALSE if want off. [INPUTS]
Returns:
The old state of the compression.

Definition at line 795 of file camfiltr.cpp.

00796 {
00797     return CompressNative;
00798 }   

UINT32 BaseCamelotFilter::GetNumBytesWritten  ) 
 

Definition at line 5627 of file camfiltr.cpp.

05628 {
05629     if (pCXaraFile != NULL)
05630         return pCXaraFile->GetNumBytesWritten();
05631 
05632     return 0;
05633 }

virtual UINT32 BaseCamelotFilter::GetPreCompression  )  [inline, virtual]
 

Definition at line 756 of file camfiltr.h.

00756 { return PreCompFlags; }

BOOL BaseCamelotFilter::GetPreviewBitmapExport  )  [virtual]
 

Public access to the current export preview bitmap which the user has requested to use when saving bitmaps in the web format. True means export a preview bitmap, False means do not. Note: Virtual so that can be overriden in native filter to save in the proper native state.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/6/96
Parameters:
- [INPUTS]
Returns:
The current state of the export preview bitmap.

Reimplemented in FlareTemplateFilter, CamelotNativeFilter, and PluginNativeFilter.

Definition at line 945 of file camfiltr.cpp.

00946 {
00947 #ifdef _BATCHING
00948     return FALSE;