#include <webfiltr.h>
Inheritance diagram for CamelotWebFilter:
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 BaseCamelotFilter * | CreateNULLFilter (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 OpDescriptor * | GetDialogueOp (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 |
Definition at line 124 of file webfiltr.h.
|
Constructor for the Native save/load filter.
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 }
|
|
Tidies up when the filter is destroyed.
Definition at line 176 of file webfiltr.cpp.
|
|
This function is called just before document-related records are written out to the file.
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 }
|
|
|
|
Creates the relevant NULL filter Scope: Protected.
Implements BaseCamelotFilter. Definition at line 272 of file webfiltr.cpp. 00273 { 00274 BaseCamelotFilter* pFilter = new CamelotNULLWebFilter(this,pDocument); 00275 00276 return pFilter; 00277 }
|
|
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.
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 }
|
|
Obtains a pointer to the OpDescriptor to be used to access the relevant export dialogue.
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 }
|
|
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 }
|
|
The max number pf paths that should be looked at by the function FindSimilarPath().
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 }
|
|
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 }
|
|
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 }
|
|
Initalises the Filter ready for use. Will fail if it can not get enough memory to work with.
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 }
|
|
Implements BaseCamelotFilter. Definition at line 136 of file webfiltr.h. 00136 { return !BaseCamelotFilter::GetMinimalWebFormat(); } // TRUE by default
|
|
Web files need a document to live in, so TRUE is returned.
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 }
|
|
Implements BaseCamelotFilter. Definition at line 135 of file webfiltr.h. 00135 { return BaseCamelotFilter::GetMinimalWebFormat(); } // FALSE by default
|
|
Public access to the HTML to clipboard.
Reimplemented from BaseCamelotFilter. Reimplemented in CamelotNULLWebFilter. Definition at line 434 of file webfiltr.cpp. 00435 { 00436 return BaseCamelotFilter::HTMLToClipboard; 00437 }
|
|
Reimplemented from BaseCamelotFilter. Definition at line 167 of file webfiltr.h. |
|
Reimplemented from BaseCamelotFilter. Definition at line 162 of file webfiltr.h. |
|
Reimplemented from BaseCamelotFilter. Definition at line 161 of file webfiltr.h. |
|
Definition at line 170 of file webfiltr.h. |