Filter Class Reference

Pure base class for import and export filters. Provides static functions to initialise and deinitialise all the available filters. More...

#include <filters.h>

Inheritance diagram for Filter:

ListItem CCObject SimpleCCObject BitmapFilter FilterFamily HTMLExportFilter PaletteFilter PreviewFilter VectorFilter BaseBitmapFilter BitmapFilterFamily GenericEPSFilter GenericFilter PaletteFilterFamily VectorFilterFamily ImagemapFilter AdobeColourSwatchFilter AdobeColourTableFilter CorelPaletteFilter JCWColourFilter MSPaletteFilter PaintShopProPaletteFilter AcornDrawFilter BaseCamelotFilter CDRFilter CMXFilter CMXImportFilter EPSFilter FlashFilter MetaFileFilter List of all members.

Public Member Functions

 Filter ()
 Set the Filter object up to be in a clean state.
virtual ~Filter ()
 Destroys the OILFilter object and the current attribute array/values associated with this Filter.
virtual BOOL Init ()=0
 Declares a preference that allows you to clear memory in delete().
virtual void Deinit ()
FilterFlags GetFlags ()
 Get the flags for a specified filter.
ADDR LoadInitialSegment (PathName &Path, UINT32 *Size, size_t *FileSize)
ADDR LoadInitialSegment (CCLexFile *pFile, UINT32 *pSize, size_t *pFileSize)
 Determine if this filter can load the specified file. The filter is provided with the first n bytes of the file, where n is HeaderSize. It should look at this data and/or the pathname to determine if it can load this file. NB. Base class function is pure virtual - override it!Loads in the first n bytes of a file, in order to investigate whether a filter (or number of filters in the case of the FilterFamily class), is compatible with the file - i.e. how well this file recognises the file header. The last byte in the block is set to 0, to prevent ASCII lexers from going trundling off the end.
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 laod 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 BOOL PreHowCompatible ()
 Allows a filter or set of filters to take some action or set up variables before being called by HowCompatible. A group of filters which share common code may require some variable set up before being asked to check the type. Base class does nothing and so works for all filters which do not require it.
virtual INT32 HowCompatible (PathName &Filename, ADDR HeaderStart, UINT32 HeaderSize, UINT32 FileSize)
virtual BOOL DoImport (SelOperation *, CCLexFile *, Document *, BOOL AutoChosen=FALSE, ImportPosition *Pos=NULL, KernelBitmap **ppImportedBitmap=NULL, DocCoord *pPosTranslate=NULL, String_256 *URL=NULL)
virtual BOOL DoExport (Operation *, CCLexFile *, PathName *, Document *, BOOL=TRUE)
virtual BOOL JoinFamily (CCRuntimeClass *)
 Allow a filter to choose whether or not it wants to become part of a filter 'family', e.g. a filter family such as "EPS files", or "Bitmap files". The default implementation checks to see if the filter is of the same kind of filter, using IsKindOf(), and if so, it consents to be in the filter family. Filters should only over-ride this if they need different behaviour for some bizarre reason.
virtual BOOL ImportBitmap (CCLexFile *, KernelBitmap **)
 

virtual BOOL ExportBitmap (KernelBitmap &)
 Virtual function to export a bitmap to a file. This base class version always does nothing and returns TRUE, so formats which do not support bitmaps need do nothing. Formats that support bitmaps should over-ride this function to do the necessary work required to embed the bitmap into the file.
DocumentGetDocument ()
AttributeEntryGetCurrentAttrs ()
virtual INT32 ImportBinary (ADDR pData, INT32 Length)
 Read in binary data from the file and place it in the buffer supplied by the caller. This is over-ridden by filters to do whatever translation is necessary, e.g. EPS filters convert ASCII Hexadecimal data to binary.
virtual BitmapFilterSupport GetBitmapSupportLevel ()
 Determine how well this filter supports bitmaps when exporting.
virtual BOOL CanIncludePreviewBmp ()
 Allows you to find out if a particular filter can produce a Preview Bitmap in it.
void IncludePreviewBmp (BOOL WantBmp)
 Asks the filter to include a Preview bitmap or not. NOTE: This only has any effect if the Filter answered TRUE to a call to CanIncludePreviewBmp. NOTE2: All the filters hang around even if they are not doing any filtering, so if you set this flag one way it will stay like that for all future uses of the filter until it is set again. The best method will be to swtich it on if required, do the import and then switch it off again immediatly afterwards.
virtual BOOL ExportVisibleLayersOnly ()
 Determines if the filter wants to export only visible layers. NB. This base class version does the default action of making the filter export everything including hidden layers.
virtual BOOL ExportSelectionOnly (BOOL MaskedRender=FALSE)
 Determines if the filter wants to export only selected items. In the filters baseclass version the default action will be to export all objects by default Only used by bitmap export and in particular masked gif rendering at present.
virtual BOOL WillAcceptExistingFile (PathName pthToReplace)
 Checks to see if this filter will accept an existing file to export to.
virtual void SetSaveAttributes (BOOL DoSave)
 Informs the filter whether or not it should record the attribute settings along with the file data. This allows templates to have default colours other than the standard Camelot values, whilst not encumbering save files with this extra information.
void SetSoleLayer (Layer *pLayer)
LayerGetSoleLayer ()
virtual BOOL OpenExportFile (CCDiskFile *pDiskFile, PathName *pPath)
 Opens up the file ready for exporting into. Assumes the file has already been constructed with the correct buffers etc..
virtual BOOL DeleteExportFile (CCDiskFile *pDiskFile)
 Used for when either an export has been aborted by the user half way through or when an error has occured. It closes up the export file, if open, and then deletes it.
virtual BOOL ExportRender (RenderRegion *pRegion, BOOL MaskedRender=FALSE)
 Export a file to a given render region. It is the responsibility of the derived filter to create a render region of the correct type, and then pass it to this function.
virtual BOOL ExportRenderNodes (RenderRegion *pRegion, ExportDC *pDC, BOOL VisibleLayersOnly=FALSE, BOOL CheckSelected=FALSE, BOOL ShowProgress=TRUE)
 Sets up the file to do an export of the nodes in the tree, by initialising the file, and any slow-job code. It then calls the WriteNodes method to do the actual work, and EndExportRender to complete the task.
virtual String_64 GetImportProgressString (CCLexFile *File, UINT32 ImportingMsgID)
 Works out what progress bar string to use during importing of the file. This consists of a basic message plus, if it will fit, a truncated form of the filename being imported.
virtual String_64 GetExportProgressString (CCLexFile *File, UINT32 ExportingMsgID)
 Works out what progress bar string to use during exporting of the file. This consists of a basic message plus, if it will fit, a truncated form of the filename being exported.
virtual UINT32 GetExportMsgID ()
 Used to get the message id to be used during export. Virtual, so that two stage exporters can change the message.
virtual UINT32 GetImportMsgID ()
 Used to get the message id to be used during export. Virtual, so that multi-stage importers can change the message.
virtual BOOL AddStringToProgressString (String_64 *Str)
virtual BOOL ShouldExportHTMLTag ()
virtual void ExportHTMLTag ()
virtual BOOL IncProgressBarCount (UINT32 n)
BOOL UpdateExportedNodeCount (UINT32 NumNodes=1)
 Update the progress display according to the number passed in. The NumNodes parameter indicates how many nodes have just been saved. Most nodes won't call this when exporting as they are only '1' node. Nodes such as blenders or bitmaps may call this to update the progress more smoothly. E.g. a bitmap might say that it is 20 nodes if it has 20 scanlines. It could then call this function after each scanline is saved with the value 1. It should not call it with more than the number of nodes it claims to be, e.g. the example bitmap above should only ever call with NumNodes in the range 1 to 20. And the cumulative total of NumNodesSaved passed in by one node should never be more than the number of nodes it claims to be either.
UINT32 GetNumNodes ()
 Allows access to the stored numbers of nodes which is currently set up to be used for a progress bar.
UINT32 SetNumNodes (UINT32 NewNumNodes)
 Allows setting of the stored numbers of nodes which is currently set up to be used for a progress bar.

Static Public Member Functions

static void ForceStatusExportMessage (UINT32 nMessageID)
 Overrides the status-line message shown when a file is exported. This is used by the clipboard code to change "Saving document..." to "Copying to clipboard...".
static void UnforceStatusExportMessage ()
 Resets the message override on export back to "no override".
static GenericFilterGetGenericFilter ()
static FilterFindFilterFromID (const UINT32 FilterID)
 Provides the Filter given its ID.
static BOOL InitFilters ()
 Scans all filters to find out which filters are available for use, and instantiates one of each, and holds them in a list.
static BOOL DeinitFilters ()
 Destroy all the Filter objects.
static FilterGetFirst ()
 Iterating through the list of filters known to Camelot. This function returns the first filter.
static FilterGetNext (Filter *)
 Iterating through the list of filters known to Camelot. This function returns the next filter.
static ListGetFilters ()
static ID GetNewFilterID ()
 Support function providing an unique ID for each newly registered Filter.
static ID RegisterFilter (Filter *const pFilter)
 Permits the filter to be used by the FilterManager. For an import filter to be present on the Import dialog the filter should associate itself with the requisite FileFormats via AssociateFilterWithFormat().

Public Attributes

String_256 FilterName
String_256 FilterInfo
UINT32 FilterID
OILFilterpOILFilter

Static Public Attributes

static BOOL AddUnnamedColours = FALSE
 If it is TRUE then any colours used in the imported file but not explicitly named by whatever colour table structure the file uses will be created as named colours (usu. of the form Unnamed 1, Unnamed 2 and so on). If FALSE, immediate colours will be used, and will not appear on the document's colour bar. Defaults to FALSE.
static INT32 ImportWithLayers = 2
 Controls how files are imported: TRUE => Layers are imported/created as necessary when importing. FALSE => Layers are ignore when importing, and the whole imported file is placed in the document as a group.
static BOOL OpenWithLayers = TRUE
 Controls how files are opened: TRUE => Layers are imported/created as necessary when opening a file. FALSE => Layers are ignore when importing, and the whole opened file is placed in the document as a group. Note: Does not affect v2 Native file formats such as xar and web.
static BOOL ImportBitmapsOntoLayers = TRUE
 Controls how bitmap files are opened/imported: TRUE => each bitmap is placed on a new layer. FALSE => each bitmaps is placed on the current layer. Applies to multiple format bitmaps such as animated GIFs.
static BOOL bDontWarnBitmapNonMixTransp = FALSE
 Controls how bitmap files are opened/imported: TRUE => each bitmap is placed on a new layer. FALSE => each bitmaps is placed on the current layer. Applies to multiple format bitmaps such as animated GIFs.

Protected Member Functions

LayerGetActiveLayer (Document *)
 Find the active layer of the first spread of the specified document.
BOOL MakeSureLayerExists (Document *pDoc)
 This functions checks that there is a layer to put nodes onto during an import, and will create a new layer if there are none. This means that filters can call this function just before they try and insert a new node into the tree and be sure that there will be a layer for it to go onto. The function will return TRUE if there is a layer in the document (even if this function had to create the layer). It will return FALSE only if there are no layers and it was unable to create any new ones.
virtual BOOL WriteNodes (RenderRegion *pRegion, ExportDC *pDC, BOOL VisibleLayersOnly, BOOL CheckSelected, BOOL ShowProgress)
 Actually export the nodes to the given render region showing a progress bar as we go. Assumes everything has been set up by ExportRender. Assumes that either a progress bar has been started and will be ended by the caller or that it should start and end the progress bar itself.
virtual BOOL EndExportRender (RenderRegion *pRegion, BOOL ShowProgress)
 Shuts down the export render process.
BOOL SetUpCurrentAttrs ()
 Obtains an attribute array from the attribute manager. This array is the set of default attributes - the filter should use them to maintain its set of current attributes while importing. It then asks the attribute manager to add the correct attributes to each node based on this array. This should be called when importing, not when intialising, otherwise all filters will have this array hanging around all the time, which is bad.
void DeleteCurrentAttrs ()
 Deallocates any objects used to hold the current attributes for the filter. Should be called after import has finished, so the attribute table isn't hanging around all the time.
BOOL SetLineColour (DocColour &)
 Updates the current attribute for line colour to reflect the value passed in.
BOOL SetLineWidth (MILLIPOINT)
 Updates the current attribute for line width to reflect the value passed in.
BOOL SetLineCap (LineCapType)
 Updates the current attribute for line cap style to reflect the value passed in.
BOOL SetJoinType (JointType)
 Updates the current attribute for line join style to reflect the value passed in.
BOOL SetLineTransp (UINT32 TranspType, UINT32 Transp)
 Updates the current attribute for line transparency to reflect the value passed in.
BOOL SetDashPattern (DashRec &)
 Updates the current attribute for dash pattern to reflect the value passed in.
BOOL SetStartArrow (ArrowRec &)
 Updates the current attribute for Start Arrow to reflect the value passed in.
BOOL SetEndArrow (ArrowRec &)
 Updates the current attribute for End Arrow to reflect the value passed in.
BOOL SetMitreLimit (MILLIPOINT)
 Updates the current attribute for the Mitre Limit to reflect the value passed in.
BOOL SetTextFont (String_64 *EncodedName, INT32 Millipoint)
 Set the font specified in the encoded font name. The font which actually gets set in the attribute stack is one found by GetCompatibleFont(), a super new fontmanager call.
BOOL SetTextFontStyle (String_64 *FName, INT32 MillFSize, BOOL Bold, BOOL Italic)
 This function creates attributes for the typeface, the pointsize, bold and italic all at once.
BOOL SetTextSize (INT32 Size)
 Updates the current attribute for TextSize to reflect the value passed in.
BOOL SetTextTypeFace (String_64 *Name, FontClass Class=FC_UNDEFINED)
 Updates the current attribute for TextSize to reflect the value passed in.
BOOL SetTextBold (BOOL Bold)
 Updates the current attribute for Bold to reflect the value passed in.
BOOL SetTextItalic (BOOL Italic)
 Updates the current attribute for Italic to reflect the value passed in.
BOOL SetTextUnderline (BOOL Underline)
 Updates the current attribute for Underline to reflect the value passed in.
BOOL SetTextAspectRatio (FIXED16 AspectR)
 Updates the current attribute for AspectRatio to reflect the value passed in.
BOOL SetTextTracking (INT32 Tracking)
 Updates the current attribute for TextSize to reflect the value passed in.
BOOL SetTextJustification (Justification Justify)
 Updates the current attribute for TextSize to reflect the value passed in.
virtual BOOL SetTextLineSpacing (INT32 Type, INT32 EMLSpace, MILLIPOINT MLSpace, double DLSpace)
 Updates the current attribute for line spacing to reflect the value passed in. One of three values will be used depending on the type (as above).
BOOL SetTextBaseLine (MILLIPOINT BaseLine)
 Updates the current attribute for BaseLine shift to reflect the value passed in.
BOOL SetTextScript (INT32 rise, INT32 pointsize)
 Updates the current attribute for subscript or superscript.
BOOL SetTextBoldFont (BOOL Bold)
 This function simply sets the bold style flag in the current font typeface attribute (to be applied to the next created character).
BOOL SetTextItalicFont (BOOL Italic)
 This function simply sets the italic style flag in the current font typeface attribute (to be applied to the next created character).
BOOL RemoveTextScript ()
 Removes any script attribute which is currently active.
BOOL SetPathFilled (BOOL Filled)
 Indicate whether paths should be filled or not. This is independent of the current fill attribute, so, for example, if this function is called to set the paths to be unfilled, and then called again to set them to be filled, then afterwards all paths filled will be filled with whatever fill attribute was last set.
BOOL SetFillColour (DocColour &)
 Updates the current attribute for fill colour to reflect the value passed in.
BOOL SetLinearFill (DocColour &StartColour, DocColour &EndColour, DocCoord StartPoint, DocCoord EndPoint, DocCoord *EndPoint3=NULL)
 Updates the current attribute for gradfill colour to reflect the value passed in.
BOOL SetRadialFill (DocColour &StartColour, DocColour &EndColour, DocCoord StartPoint, DocCoord EndPoint)
 Updates the current attribute for gradfill colour to reflect the value passed in.
BOOL SetRadialFill (DocColour &StartColour, DocColour &EndColour, DocCoord StartPoint, DocCoord EndPoint1, DocCoord EndPoint2)
 Updates the current attribute for gradfill colour to reflect the value passed in.
BOOL SetSquareFill (DocColour &StartColour, DocColour &EndColour, DocCoord StartPoint, DocCoord EndPoint1, DocCoord EndPoint2)
 Updates the current attribute for gradfill colour to reflect the value passed in.
BOOL SetConicalFill (DocColour &StartColour, DocColour &EndColour, DocCoord StartPoint, DocCoord EndPoint)
 Updates the current attribute for gradfill colour to reflect the value passed in.
BOOL SetBitmapFill (KernelBitmap *pBitmap, DocCoord StartPoint, DocCoord EndPoint, DocCoord EndPoint2, DocColour *StartColour=0, DocColour *EndColour=0)
 Updates the current attribute for fill colour to reflect the value passed in.
BOOL SetFractalFill (DocColour &StartColour, DocColour &EndColour, DocCoord StartPoint, DocCoord EndPoint1, DocCoord EndPoint2, INT32 Seed, double Graininess, double Gravity, double Squash, UINT32 DPI, BOOL Tileable)
 Updates the current attribute for colour fill geometry to be a fractal fill using the values passed in.
BOOL SetNoTranspFill ()
 Set the current transparency fill for this import operation to be none, i.e. there is no transparency.
BOOL SetFlatTranspFill (UINT32 TranspType, UINT32 Transp)
 Set the current transparency fill for this import operation to be a flat transparency value.
BOOL SetLinearTranspFill (UINT32 TranspType, UINT32 StartTransp, UINT32 EndTransp, DocCoord StartPoint, DocCoord EndPoint, DocCoord *EndPoint3=NULL)
 Updates the current attribute for transparency fill to be a linear transparent fill as specified by the values passed in.
BOOL SetRadialTranspFill (UINT32 TranspType, UINT32 StartTransp, UINT32 EndTransp, DocCoord StartPoint, DocCoord EndPoint)
 Updates the current attribute for transparency fill to be a circular transparent fill as specified by the values passed in.
BOOL SetRadialTranspFill (UINT32 TranspType, UINT32 StartTransp, UINT32 EndTransp, DocCoord StartPoint, DocCoord EndPoint1, DocCoord EndPoint2)
 Updates the current attribute for transparency fill to be an elliptical transparent fill as specified by the values passed in.
BOOL SetConicalTranspFill (UINT32 TranspType, UINT32 StartTransp, UINT32 EndTransp, DocCoord StartPoint, DocCoord EndPoint)
 Updates the current attribute for gradfill colour to reflect the value passed in.
BOOL SetBitmapTranspFill (UINT32 TranspType, KernelBitmap *pBitmap, DocCoord StartPoint, DocCoord EndPoint, DocCoord EndPoint2, UINT32 StartTransp=0, UINT32 EndTransp=255)
 Updates the current attribute for fill colour to reflect the value passed in.
BOOL SetFractalTranspFill (UINT32 TranspType, DocCoord StartPoint, DocCoord EndPoint1, DocCoord EndPoint2, INT32 Seed, double Graininess, double Gravity, double Squash, UINT32 DPI, BOOL Tileable, UINT32 StartTransp=0, UINT32 EndTransp=255)
 Updates the current attribute for colour fill geometry to be a fractal fill using the values passed in.
BOOL SetFadeFillEffect ()
BOOL SetRainbowFillEffect ()
BOOL SetAltRainbowFillEffect ()
BOOL SetLinearFillMapping (INT32 Repeat)
BOOL SetLinearTranspFillMapping (INT32 Repeat)
BOOL SetWindingRule (WindingType)
 Updates the current attribute for winding rule to reflect the value passed in.
virtual BOOL GetDragAndDropTranslation (ImportPosition *pPos, DocRect BoundsRect, Coord *Offset)
 Given an drag'n'drop point (in pPos), calculate the translation necessary to position the imported objects at this position on the spread. It ensures that bounding rectangles smaller than the spread are wholly contained within the spread. i.e. if you drag a file right to the edge of a spread, the translation will move it closer to the centre of the spread so that it is wholly contained within the spread.
BOOL SnapShotCurrentAttrs ()
 This function grabs a snap shot of the filter managers current attributes. It simply makes a new List identical to that of CurrentAttrs.
void PushCurrentAttrsBasedOnSnapShot ()
 This function uses the snap shot facility. It checks the snap shot list against the current attribute list to find attributes which differ. Those that do are obviously new attributes. ie attributes which have been parsed by the filter after the snap shot was taken. This function takes the current attrubute list and removes all those attributes which have changed in this way. It resets them to their default none temp attribute types.
void PopCurrentAttrsBasedOnSnapShot ()
 This function uses the snap shot facility. It checks the snap shot list against the current attribute list to find attributes which differ. Those that do are obviously new attributes. ie attributes which have been parsed by the filter after the snap shot was taken. This function takes the current attrubute list and removes all those attributes which have changed in this way. It resets them to their default none temp attribute types.
void DeleteSnapShot ()
 This function removes the snap shot list allocated during SnapShotCurrentAttrs(). It should be called to match any successfull return of its sister function. ie SnapShotCurrentAttrs() and DeleteSnapShot() should be paired. Note, the calls are not recursive. ie a SnapShot SnapShot Delete Delete is not currently supported.
void DeleteAttributeList (AttributeEntry *pAttrList)
 This function removes all temp attributes from the attribute list provided All temp attributes will have their list entries updated with NULL pointers.
BOOL ApplyChangedAttrs (Node *pNode)
 This function uses the snapshot facility to work out which of the current attributes have changed. Obviously it expects a snap shot to have been taken some time earlier. Only those attributes that have changes will be applied to the node described on entry. Note, any changed attributes which now match defaults will not be applied as the function calls ApplyBasedOnDefaults() with the changes list.
virtual void UpdateFilterProgress (UINT32 increment)
 Shuts down the export render process.

Static Protected Member Functions

static BOOL DeclareFilterPreferenceSection ()
 Ensures all filter related preferences go to the same section.
static SpreadGetFirstSpread (Document *)
 Find the first spread of the specified document.

Protected Attributes

BOOL WantPreviewBmp
FilterFlags Flags
DocumentTheDocument
UINT32 ExportMsgID
UINT32 StopExportMsgID
UINT32 ImportMsgID
BOOL SaveAttributes
Layerm_pSoleLayer
String_64 m_StrToAddToProgress
AttributeEntryCurrentAttrs
SnapShotList FilterSnapShot
AttributeEntry FillAttr
BOOL PathFilled

Static Protected Attributes

static UINT32 m_nForcedStatusExportMessage = 0
static INT32 MinLineWidth = 250
 Controls how line widths are handled - if a line width thinner than the value of this preference is found, then the line width is forced to be this width. E.g. set it to 500 to make all imported lines be at least 0.5 points wide. (It defaults to 0.25pt).
static UINT32 NumNodes = 0
static UINT32 UpdateEvery = 1
static UINT32 LastExportProgressUpdate = 0
static UINT32 CurrentProgressLimit = 0
static UINT32 ProgressOffset = 0
static UINT32 m__StripStart = 0

Static Private Attributes

static GenericFilterpGenericFilter = NULL
static List FilterList
static ID m_NextFilterID = 1099 + 1

Friends

class FilterRenderCallback

Detailed Description

Pure base class for import and export filters. Provides static functions to initialise and deinitialise all the available filters.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
08/03/94
See also:
OILFilter

Definition at line 447 of file filters.h.


Constructor & Destructor Documentation

Filter::Filter  ) 
 

Set the Filter object up to be in a clean state.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/02/94
See also:
Filter; Filter::~Filter; OILFilter

Definition at line 372 of file filters.cpp.

00373 {
00374     // Ensure destructor will not corrupt heap
00375     pOILFilter = NULL;
00376     CurrentAttrs = NULL;
00377     FillAttr.pAttr = NULL;
00378     FillAttr.Temp = FALSE;
00379     FillAttr.Ignore = FALSE;
00380 
00381     // Set default of no export message
00382     ExportMsgID = 0;
00383     
00384     // Set default message of none (use default message)
00385     StopExportMsgID = 0;
00386 
00387     // Set default of no import message
00388     ImportMsgID = 0;
00389 
00390     // No document yet...
00391     TheDocument = NULL;
00392 
00393     // No Preview Bitmap Please
00394     WantPreviewBmp = FALSE;
00395 
00396     // Ensure these are at known states, set them to do nothing so people have to change them
00397     Flags.CanImport = FALSE;
00398     Flags.CanExport = FALSE;
00399     Flags.CanExportMultipleImages = FALSE;
00400 
00401     // Want to show filters by default, unless the user specificaly requests otherwise
00402     Flags.ShowFilter = TRUE;
00403 
00404     // set the path filled flag to a sensible state
00405     PathFilled = TRUE;
00406 
00407     // Don't save attributes as default.
00408     SaveAttributes = FALSE;
00409 
00410     m_pSoleLayer = NULL;
00411 }

Filter::~Filter  )  [virtual]
 

Destroys the OILFilter object and the current attribute array/values associated with this Filter.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/02/94
See also:
Filter; OILFilter

Definition at line 425 of file filters.cpp.

00426 {
00427     // Destroy the associated OILFilter object
00428     delete pOILFilter;
00429 
00430     // Destory any temporary saved fill attribute
00431     if (FillAttr.Temp)
00432         delete FillAttr.pAttr;
00433 }


Member Function Documentation

BOOL Filter::AddStringToProgressString String_64 Str  )  [virtual]
 

Author:
Olivier_Gascoin (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/04/97
Parameters:
Str - This is the string to add in the ProgressString [INPUTS]
- [OUTPUTS]
Returns:
TRUE
See also:

Definition at line 1696 of file filters.cpp.

01697 {
01698     m_StrToAddToProgress = *Str;
01699 
01700     return TRUE;
01701 }

BOOL Filter::ApplyChangedAttrs Node pNode  )  [protected]
 

This function uses the snapshot facility to work out which of the current attributes have changed. Obviously it expects a snap shot to have been taken some time earlier. Only those attributes that have changes will be applied to the node described on entry. Note, any changed attributes which now match defaults will not be applied as the function calls ApplyBasedOnDefaults() with the changes list.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/10/95
Parameters:
- [INPUTS]
Returns:
TRUE if the changed attributes have been applied to pNode FALSE if nothing has been applied

Definition at line 657 of file filters.cpp.

00658 {
00659     return FilterSnapShot.ApplyChangedAttrs(pNode,CurrentAttrs);
00660 }

BOOL Filter::CanIncludePreviewBmp  )  [virtual]
 

Allows you to find out if a particular filter can produce a Preview Bitmap in it.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/2/95
Returns:
TRUE if the filter is capable of having a preview bitmap put in it somehow. FALSE if it can't. Most filters can not do this.

Reimplemented in CamelotEPSFilter.

Definition at line 466 of file filters.cpp.

00467 {
00468     // Say no. Filters that can will have to say yes
00469     return FALSE;
00470 }

BOOL Filter::DeclareFilterPreferenceSection  )  [static, protected]
 

Ensures all filter related preferences go to the same section.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/10/96
Returns:
TRUE if the preference section was declared correctly FALSE otherwise

Definition at line 447 of file filters.cpp.

00448 {
00449     return( Camelot.DeclareSection( _T("Filters"), 10 ) );
00450 }

virtual void Filter::Deinit void   )  [inline, virtual]
 

Reimplemented in BaseCamelotFilter.

Definition at line 458 of file filters.h.

00459     {
00460         if (pOILFilter)
00461         {
00462             delete pOILFilter;
00463             pOILFilter = NULL;
00464         }
00465     };

BOOL Filter::DeinitFilters  )  [static]
 

Destroy all the Filter objects.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/02/94
See also:
Filter

Definition at line 1028 of file filters.cpp.

01029 {
01030     ListItem* pListItem = FilterList.GetHead();
01031     while (pListItem != NULL)
01032     {
01033         ((Filter*)pListItem)->Deinit();
01034 
01035         pListItem = FilterList.GetNext(pListItem);
01036     }
01037 
01038     // Get rid of our filters
01039     FilterList.DeleteAll();
01040 
01041     // All ok
01042     return TRUE;
01043 }

void Filter::DeleteAttributeList AttributeEntry pAttrList  )  [protected]
 

This function removes all temp attributes from the attribute list provided All temp attributes will have their list entries updated with NULL pointers.

void Filter::DeleteAttributeList(AttributeEntry* pAttrList)

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/10/95
Parameters:
pAttrList = A pointer to the first item in the attribute list [INPUTS]
Returns:
-

Definition at line 575 of file filters.cpp.

00576 {
00577     // Delete any attribute values we created
00578     INT32 NumAttrs = AttributeManager::GetNumAttributes();
00579     for (INT32 i=0; i<NumAttrs; i++)
00580     {
00581         // Delete the object if it is temporary.
00582         if (pAttrList[i].Temp)
00583         {
00584             delete pAttrList[i].pAttr;
00585             pAttrList[i].pAttr = NULL;
00586             pAttrList[i].Temp = FALSE;
00587         }
00588     }
00589 }

void Filter::DeleteCurrentAttrs  )  [protected]
 

Deallocates any objects used to hold the current attributes for the filter. Should be called after import has finished, so the attribute table isn't hanging around all the time.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/04/94
See also:
Filter::SetUpCurrentAttrs

Definition at line 550 of file filters.cpp.

00551 {
00552     // Delete any attribute values we created
00553     if (CurrentAttrs != NULL)
00554     {
00555         DeleteAttributeList(CurrentAttrs);
00556         // Lose the attribute value array
00557         CCFree(CurrentAttrs);
00558         CurrentAttrs = NULL;
00559     }
00560 }

BOOL Filter::DeleteExportFile CCDiskFile pDiskFile  )  [virtual]
 

Used for when either an export has been aborted by the user half way through or when an error has occured. It closes up the export file, if open, and then deletes it.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/12/95
Parameters:
pDiskFile The constructed disk file to use [INPUTS]
Returns:
True if the file has been closed and deleted correctly, False otherwise.
See also:
OpMenuExport::DoWithParam; Filters::DoExport;

ClipboardMapping::ExportToTempFile; OpMenuSave::SaveSpecificFile;

Definition at line 1864 of file filters.cpp.

01865 {
01866 #ifdef DO_EXPORT
01867     ERROR2IF(pDiskFile == NULL, FALSE,"Filter::CloseExportFile null file supplied");
01868 
01869     // Remove the zero length file that we created as part of the process.
01870     
01871     // First, ensure file is closed
01872     if (pDiskFile->isOpen())
01873         pDiskFile->close();
01874     
01875     // Get its pathname 
01876     PathName Path = pDiskFile->GetPathName();
01877 
01878     // And try and remove it, only if it exists
01879     if (Path.IsValid())
01880     {
01881         BOOL Exists = TRUE;
01882         BOOL status = TRUE;
01883         Exists = SGLibOil::FileExists(&Path);
01884         if (Exists)
01885             status = SGLibOil::FileDelete(&Path);
01886         TRACEUSER( "Neville", _T("Filter::DeleteExportFile removed exists status =%d, file status =%d/n"),Exists,status);
01887     }
01888 #endif
01889     return TRUE;
01890 }

void Filter::DeleteSnapShot  )  [protected]
 

This function removes the snap shot list allocated during SnapShotCurrentAttrs(). It should be called to match any successfull return of its sister function. ie SnapShotCurrentAttrs() and DeleteSnapShot() should be paired. Note, the calls are not recursive. ie a SnapShot SnapShot Delete Delete is not currently supported.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/10/95
Parameters:
- [INPUTS]
Returns:
-
See also:
SnapShotCurrentAttrs()

Definition at line 633 of file filters.cpp.

00634 {
00635     FilterSnapShot.DestroySnapShot();
00636 }

virtual BOOL Filter::DoExport Operation ,
CCLexFile ,
PathName ,
Document ,
BOOL  = TRUE
[inline, virtual]
 

Reimplemented in BaseBitmapFilter, BaseCamelotFilter, CDRFilter, CMXFilter, CMXImportFilter, PaletteFilter, AcornDrawFilter, EPSFilter, FilterFamily, ImagemapFilter, PreviewFilter, PreviewFilterBMP, PreviewFilterGIF, PreviewFilterJPEG, PreviewFilterPNG, ThumbnailFilterPNG, FlashFilter, PluginNativeFilter, and MetaFileFilter.

Definition at line 520 of file filters.h.

00521     {
00522         return FALSE;
00523     }

virtual BOOL Filter::DoImport SelOperation ,
CCLexFile ,
Document ,
BOOL  AutoChosen = FALSE,
ImportPosition Pos = NULL,
KernelBitmap **  ppImportedBitmap = NULL,
DocCoord pPosTranslate = NULL,
String_256 URL = NULL
[inline, virtual]
 

Reimplemented in BaseBitmapFilter, BaseCamelotFilter, CDRFilter, CMXFilter, CMXImportFilter, PaletteFilter, AcornDrawFilter, EPSFilter, FilterFamily, PreviewFilter, FlashFilter, PluginNativeFilter, and MetaFileFilter.

Definition at line 510 of file filters.h.

00515     {
00516         return FALSE;
00517     }

BOOL Filter::EndExportRender RenderRegion pRegion,
BOOL  ShowProgress
[protected, virtual]
 

Shuts down the export render process.

Author:
Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com> (from Neville's original code)
Date:
12/4/00
Parameters:
pRegion - the render region to export to. [INPUTS] ShowProgress - TRUE then start up a progress bar or FALSE assume the caller has done it.
Returns:
TRUE if the export process completed successfully, FALSE if an error occured.
See also:
Filter::ExportRender, Filter::ExportRenderNodes

Definition at line 2369 of file filters.cpp.

02371 {
02372 #ifdef DO_EXPORT
02373 
02374     //TRY
02375     {
02376         // Finished rendering - deinit render region.
02377         pRegion->StopRender ();
02378 
02379         // Shut down the render region.
02380         pRegion->CloseDown ();
02381     }
02382 #if 0
02383     CATCH ( CFileException, e )
02384     {
02385         // Didn't work - report failure to caller.
02386         if ( ShowProgress )
02387             EndSlowJob ();
02388         return FALSE;
02389     }
02390     END_CATCH
02391 #endif
02392     // Close down progress display, if present
02393     if ( ShowProgress )
02394         EndSlowJob ();
02395 
02396     // All OK
02397     return TRUE;
02398 #else
02399     return FALSE;
02400 #endif
02401 }

BOOL Filter::ExportBitmap KernelBitmap  )  [virtual]
 

Virtual function to export a bitmap to a file. This base class version always does nothing and returns TRUE, so formats which do not support bitmaps need do nothing. Formats that support bitmaps should over-ride this function to do the necessary work required to embed the bitmap into the file.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/09/94
Parameters:
TheBitmap - the bitmap to export [INPUTS]
Returns:
TRUE if the bitmap was exported ok (or if it wasn't exported because the file format does not support it; FALSE if an error occured.

Errors: Usual disk/file errors.

See also:
CamelotEPSFilter::ExportBitmap

Reimplemented in CamelotEPSFilter, and CamelotNativeEPSFilter.

Definition at line 2579 of file filters.cpp.

02580 {
02581     // Base class - ignore bitmaps
02582     return TRUE;
02583 }

virtual void Filter::ExportHTMLTag  )  [inline, virtual]
 

Reimplemented in CamelotNULLWebFilter.

Definition at line 638 of file filters.h.

00639     {
00640     }

BOOL Filter::ExportRender RenderRegion pRegion,
BOOL  MaskedRender = FALSE
[virtual]
 

Export a file to a given render region. It is the responsibility of the derived filter to create a render region of the correct type, and then pass it to this function.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/03/94
Parameters:
pRegion - the render region to export to. [INPUTS]
Returns:
TRUE if the export process completed successfully, FALSE if an error occured.

Errors: Render region is not connected to a spread.

See also:
EPSRenderRegion::ExportRender, FlashRenderRegion::ExportRender

Definition at line 1908 of file filters.cpp.

01909 {
01910 #ifdef DO_EXPORT
01911     // Disable bitmap caching but remember the old state so we can set it back
01912     ScopedFlagSetter fsBitmapCacheing(NodeRenderableBounded::bEnableCacheing, FALSE);
01913 
01914     ERROR2IF(pRegion==NULL,FALSE,"Filter::ExportRender null render region supplied");
01915 
01916     // We need special handling for Camelot EPS 
01917     // (NB. but not native files - do not change this to IS_KIND_OF!)
01918     BOOL IsCamelotEPS = IS_A(pRegion, CamelotEPSRenderRegion);