CamelotWebFilter Class Reference

This filter is for the new web file format which is the minimilistic form of the new version 2 native file filter. The BaseCamelotFilter provides common functionality for both this and the web file filter as they are essentially the same thing. More...

#include <webfiltr.h>

Inheritance diagram for CamelotWebFilter:

BaseCamelotFilter VectorFilter Filter ListItem CCObject SimpleCCObject CamelotNULLWebFilter List of all members.

Public Member Functions

 CamelotWebFilter ()
 Constructor for the Native save/load filter.
 ~CamelotWebFilter ()
 Tidies up when the filter is destroyed.
BOOL Init ()
 Initalises the Filter ready for use. Will fail if it can not get enough memory to work with.
virtual BOOL IsWebFilter ()
virtual BOOL IsCompactNativeFilter ()
virtual BOOL IsDefaultDocRequired (const TCHAR *pcszPathName)
 Web files need a document to live in, so TRUE is returned.
virtual INT32 HowCompatibleIsFileType (char *pFileType)
virtual double GetSimilarPathTolerance (NodePath *pPath)
virtual INT32 GetMaxPathLookUp ()
 The max number pf paths that should be looked at by the function FindSimilarPath().
virtual BOOL ShouldExportHTMLTag ()
 Public access to the HTML to clipboard.

Protected Member Functions

virtual BaseCamelotFilterCreateNULLFilter (Document *pDocument)
 Creates the relevant NULL filter Scope: Protected.
virtual char * GetExportFileType ()
virtual BOOL BeginDocumentExport ()
 This function is called just before document-related records are written out to the file.
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 OpDescriptorGetDialogueOp (void)
 Obtains a pointer to the OpDescriptor to be used to access the relevant export dialogue.

Protected Attributes

UINT32 FilterNameID
UINT32 FilterInfoID
UINT32 ExportingMsgID

Private Member Functions

 CC_DECLARE_DYNAMIC (CamelotWebFilter)

Private Attributes

BOOL MinWebFormat

Detailed Description

This filter is for the new web file format which is the minimilistic form of the new version 2 native file filter. The BaseCamelotFilter provides common functionality for both this and the web file filter as they are essentially the same thing.

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

Definition at line 124 of file webfiltr.h.


Constructor & Destructor Documentation

CamelotWebFilter::CamelotWebFilter  ) 
 

Constructor for the Native save/load filter.

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

Definition at line 136 of file webfiltr.cpp.

00137 {
00138     // Set up filter descriptions.
00139     FilterNameID = _R(IDS_FILTERNAME_WEB);
00140     FilterInfoID = _R(IDS_WEB_FILTERINFO);
00141     ImportMsgID  = _R(IDS_IMPORTMSG_WEB);
00142     ExportMsgID  = _R(IDS_EXPORTMSG_WEB);
00143 
00144     FilterID = FILTERID_WEB;
00145 
00146     Flags.CanImport = TRUE;
00147 
00148 #ifndef DO_EXPORT
00149     Flags.CanExport = FALSE;
00150 #else
00151     //WEBSTER-Martin-27/01/97
00152 #ifdef WEBSTER
00153     Flags.CanExport = FALSE;
00154 #else
00155     Flags.CanExport = TRUE;
00156 #endif //WEBSTER
00157 #endif
00158 
00159     // Message to show when a problem file is encountered
00160     BadFileMsgID = _R(IDS_NOT_A_WEB_FILE);
00161 
00162     MinWebFormat = FALSE;
00163 }

CamelotWebFilter::~CamelotWebFilter  ) 
 

Tidies up when the filter is destroyed.

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

Definition at line 176 of file webfiltr.cpp.

00177 {
00178 
00179 }


Member Function Documentation

BOOL CamelotWebFilter::BeginDocumentExport  )  [protected, virtual]
 

This function is called just before document-related records are written out to the file.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/8/96
Parameters:
- [INPUTS]
Returns:
TRUE if successful, FALSE otherwise
The web filter writes out a TAG_DOCUMENT record to signify the start of the document WHEN IT'S THE COMPACT NATIVE FILTER!.

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

Reimplemented from BaseCamelotFilter.

Definition at line 328 of file webfiltr.cpp.

00329 {
00330     BOOL ok = TRUE;
00331 
00332     // If it's the hybrid format, do as the native filter does
00333     if (IsCompactNativeFilter())
00334     {
00335         // Writes out a document rec followed by a down rec
00336         // This will ensure that all doc-related records appear as a child of the doc record
00337         if (ok) ok = WriteZeroSizedRecord(TAG_DOCUMENT);
00338         if (ok) ok = WriteZeroSizedRecord(TAG_DOWN);
00339     }
00340 
00341     return ok;
00342 }

CamelotWebFilter::CC_DECLARE_DYNAMIC CamelotWebFilter   )  [private]
 

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

Creates the relevant NULL filter Scope: Protected.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/6/96
Parameters:
pDocument = ptr to the document [INPUTS]
Returns:
ptr to a filter that can be used to count the number of exported bytes NULL if there's an error

Implements BaseCamelotFilter.

Definition at line 272 of file webfiltr.cpp.

00273 {
00274     BaseCamelotFilter* pFilter = new CamelotNULLWebFilter(this,pDocument);
00275 
00276     return pFilter;
00277 }

BOOL CamelotWebFilter::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:
16/8/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:
CamelotWebFilter::BeginDocumentExport() Scope: Protected

Reimplemented from BaseCamelotFilter.

Definition at line 362 of file webfiltr.cpp.

00363 {
00364     BOOL ok = TRUE;
00365 
00366     // If it's the hybrid format, do as the native filter does
00367     if (IsCompactNativeFilter())
00368     {
00369         // Writes out an up rec
00370         // This will ensure that all doc-related records appear as a child of the doc record
00371         // by matching the down rec written out by BeginDocumentExport()
00372         if (ok) ok = WriteZeroSizedRecord(TAG_UP);
00373     }
00374 
00375     return ok;
00376 }

OpDescriptor * CamelotWebFilter::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 from BaseCamelotFilter.

Definition at line 479 of file webfiltr.cpp.

00480 {
00481     // Just return the found OpDescriptor.
00482     return OpDescriptor::FindOpDescriptor ( CC_RUNTIME_CLASS ( WebPrefsDlg ) );
00483 }

char * CamelotWebFilter::GetExportFileType  )  [protected, virtual]
 

Implements BaseCamelotFilter.

Definition at line 393 of file webfiltr.cpp.

00394 {
00395     if (IsCompactNativeFilter())
00396         return EXPORT_FILETYPE_WEB;
00397     else
00398         return EXPORT_FILETYPE_MIN;
00399 }

INT32 CamelotWebFilter::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:
11/2/97
Parameters:
- [INPUTS]
Returns:
100 always
WEBSTER - markn 11/2/97 Added to Webster so saving .web files isn't so slow for certain git files

See also:
BaseCamelotFilter::GetMaxPathLookUp; Scope: Protected

Reimplemented from BaseCamelotFilter.

Definition at line 457 of file webfiltr.cpp.

00458 {
00459 #ifdef WEBSTER
00460     return 100;
00461 #else
00462     return -1;
00463 #endif // WEBSTER
00464 }

double CamelotWebFilter::GetSimilarPathTolerance NodePath pPath  )  [virtual]
 

Implements BaseCamelotFilter.

Definition at line 401 of file webfiltr.cpp.

00402 {
00403     double Tolerance = 0.0;
00404 
00405     if (pPath != NULL)
00406     {
00407         // Don't get attribute-related bounds because the path might not be in the tree
00408         // (e.g. it may be generated by the 'convert text to outlines' system which keeps
00409         // all paths created from text stories in out-of-line groups)
00410         // The TRUE parameter means don't bother with attributes
00411         DocRect Rect = pPath->GetBoundingRect(TRUE);
00412         INT32 MaxDist = min(Rect.Width(),Rect.Height());
00413 
00414         Tolerance = double(MaxDist)*0.01;
00415         if (Tolerance > GetWebSimilarPathTolerence())
00416             Tolerance = GetWebSimilarPathTolerence(); 
00417     }
00418 
00419     return Tolerance;
00420 }

INT32 CamelotWebFilter::HowCompatibleIsFileType char *  pFileType  )  [virtual]
 

Implements BaseCamelotFilter.

Definition at line 378 of file webfiltr.cpp.

00379 {
00380     MinWebFormat = TRUE;        // Default to needing default doc
00381     INT32 compatibility = 10;
00382 
00383     if (strcmp(pFileType,EXPORT_FILETYPE_WEB) == 0)         // If web file, not minimal so no default doc required
00384         MinWebFormat = FALSE;
00385     else if (strcmp(pFileType,EXPORT_FILETYPE_MIN) == 0)    // If Minimal web file, default doc is required
00386         MinWebFormat = TRUE;
00387     else
00388         compatibility = 9;                                  // You what?
00389 
00390     return compatibility;
00391 }

BOOL CamelotWebFilter::Init void   )  [virtual]
 

Initalises the Filter ready for use. Will fail if it can not get enough memory to work with.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/5/96
Returns:
TRUE if it worked, FALSE if it failed

Reimplemented from BaseCamelotFilter.

Definition at line 193 of file webfiltr.cpp.

00194 {
00195     // Get the OILFilter object
00196     pOILFilter = new WebOILFilter(this);
00197     if (pOILFilter == NULL)
00198         return FALSE;
00199 
00200     // Load the description strings
00201     FilterName.Load(FilterNameID);
00202     FilterInfo.Load(FilterInfoID);
00203 
00204     BOOL ok = TRUE;
00205 
00206 #ifdef DO_EXPORT
00207     // Init the export web file options dialog
00208     ok = WebPrefsDlg::Init();
00209 #endif
00210 
00211     if (ok) ok = CreateRecordHandlers();
00212 
00213     BaseCamelotFilter::DontConvertTheseFontsToOutlines = String_256(_R(IDS_WEB_GUARANTEED_FONTS));
00214 
00215     if (Camelot.DeclareSection("Filters", 15))
00216     {
00217         // Preferences form the web export options dialog box
00218 
00219         // Preference for bitmap compression requested by the user
00220         // 101 -201 means use PNG but remember old JPEG setting
00221         // 0-100 use JPEG with this quality setting
00222         Camelot.DeclarePref( NULL, "BitmapCompression", &BaseCamelotFilter::BitmapCompression, 0, 201 );
00223         // Preference for whether we export a preview bitmap in web files
00224         Camelot.DeclarePref( NULL, "ExportPreviewBitmap", &BaseCamelotFilter::PreviewBitmapExport, 0, 1 );
00225         // Preference for whether we convert all text to outlines in web files (baring some assumed fonts)
00226         Camelot.DeclarePref( NULL, "ConvertTextToOutlines", &BaseCamelotFilter::ConvertTextToOutlines, 0, 1 );
00227         // Preference for whether we export invisible layers in web files or not (only applicable in non-minimal mode)
00228         Camelot.DeclarePref( NULL, "RemoveInvisibleLayers", &BaseCamelotFilter::RemoveInvisibleLayers, 0, 1 );
00229         // Preference for whether we export unused colours in web files or not (only applicable in non-minimal mode)
00230         Camelot.DeclarePref( NULL, "RemoveUnusedColours", &BaseCamelotFilter::RemoveUnusedColours, 0, 1 );
00231         // Preference for whether we export an HTML tag to the clipboard
00232         Camelot.DeclarePref( NULL, "HTMLToClipboard", &BaseCamelotFilter::HTMLToClipboard, 0, 1 );
00233         // Preference for whether we export a minimal web file or a stripped down native file
00234         Camelot.DeclarePref( NULL, "MinimalWebFormat", &BaseCamelotFilter::MinimalWebFormat, 0, 1 );
00235         
00236         // WEBSTER - markn 28/1/97
00237         // Preference for whether we convert all blends to outlines in web files
00238         Camelot.DeclarePref( NULL, "ConvertBlendsToOutlines", &BaseCamelotFilter::ConvertBlendsToOutlines, 0, 1 );
00239 
00240         // Other preferences
00241         // Preference for whether we write relative paths or not
00242         Camelot.DeclarePref( NULL, "WriteRelativePaths", &BaseCamelotFilter::WriteRelativePaths, 0, 1 );
00243         // Preference which lists the fonts not to be converted into outlines
00244         Camelot.DeclarePref( NULL, "DontConvertTheseFontsToOutlines", &BaseCamelotFilter::DontConvertTheseFontsToOutlines);
00245         // Preference for the tolerence we use to test for similar paths
00246         Camelot.DeclarePref( NULL, "WebSimilarPathTolerence", &BaseCamelotFilter::WebSimilarPathTolerence, 0, 500 );
00247 
00248         // Webster - Neville 29/7/97
00249         // Whether non-frame layers in an imported file are combined onto the active layer or the
00250         // first non-frame layer in the import
00251         Camelot.DeclarePref( NULL, "ImportNonFramesOntoActivelayer", &BaseCamelotFilter::ImportNonFramesOntoActivelayer, 0, 1 );
00252     }
00253 
00254     // All ok?
00255     return ok;
00256 }

virtual BOOL CamelotWebFilter::IsCompactNativeFilter  )  [inline, virtual]
 

Implements BaseCamelotFilter.

Definition at line 136 of file webfiltr.h.

00136 { return !BaseCamelotFilter::GetMinimalWebFormat(); } // TRUE by default

BOOL CamelotWebFilter::IsDefaultDocRequired const TCHAR pcszPathName  )  [virtual]
 

Web files need a document to live in, so TRUE is returned.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/6/96
Parameters:
pcszPathName pointer to the pathname to check [INPUTS]
Returns:
TRUE
(Unless it's a stupid hybrid, in which case it returns FALSE).
See also:
Filter; Filter::IsDefaultDocRequired; CCamDoc::OnOpenDocument;

FilterFamily::DoImport; Filter::DoImport;

Reimplemented from BaseCamelotFilter.

Definition at line 295 of file webfiltr.cpp.

00296 {
00297 /*
00298     // If hybrid format, when destory any elegant code that exists in the system with
00299     // stupid special cases.
00300     // The compact native format doesn't need the default doc.
00301     if (IsCompactNativeFilter())
00302         return FALSE;
00303 
00304     return TRUE;
00305 */
00306     return MinWebFormat;    // if min format, default doc is required
00307 }   

virtual BOOL CamelotWebFilter::IsWebFilter  )  [inline, virtual]
 

Implements BaseCamelotFilter.

Definition at line 135 of file webfiltr.h.

00135 { return BaseCamelotFilter::GetMinimalWebFormat(); } // FALSE by default

BOOL CamelotWebFilter::ShouldExportHTMLTag  )  [virtual]
 

Public access to the HTML to clipboard.

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

Reimplemented from BaseCamelotFilter.

Reimplemented in CamelotNULLWebFilter.

Definition at line 434 of file webfiltr.cpp.

00435 {
00436     return BaseCamelotFilter::HTMLToClipboard;
00437 }


Member Data Documentation

UINT32 CamelotWebFilter::ExportingMsgID [protected]
 

Reimplemented from BaseCamelotFilter.

Definition at line 167 of file webfiltr.h.

UINT32 CamelotWebFilter::FilterInfoID [protected]
 

Reimplemented from BaseCamelotFilter.

Definition at line 162 of file webfiltr.h.

UINT32 CamelotWebFilter::FilterNameID [protected]
 

Reimplemented from BaseCamelotFilter.

Definition at line 161 of file webfiltr.h.

BOOL CamelotWebFilter::MinWebFormat [private]
 

Definition at line 170 of file webfiltr.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:51:49 2007 for Camelot by  doxygen 1.4.4