filters.h

Go to the documentation of this file.
00001 // $Id: filters.h 1476 2006-07-19 11:58:34Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 
00099 #ifndef INC_FILTERS
00100 #define INC_FILTERS
00101 
00102 #include "list.h"
00103 #include "pathname.h"
00104 #include "docrect.h"
00105 #include "attr.h"
00106 #include "attrmgr.h"
00107 #include "txtattr.h"
00108 #include "fontclass.h"
00109 #include <limits.h>
00110 #include "oilfltrs.h"
00111 
00112 class DocColour;
00113 class CCLexFile;
00114 class CCDiskFile;
00115 class ArrowRec;
00116 class Pathname;
00117 
00118 
00119 // Every filter should have a unique filter ID which is allocated in this header file. 
00120 #define FILTERID_INVALID            (-1)
00121 
00122 #define FILTERID_USERCHOICE         (UINT_MAX)
00123 #define FILTERID_NONE               (0)
00124 
00125 #define FILTERID_GENERIC            (1)
00126 #define FILTERID_VECTOR             (2)
00127 #define FILTERID_BITMAP             (3)
00128 #define FILTERID_METAFILE           (4)
00129 #define FILTERID_AIEPS              (5)
00130 #define FILTERID_AI5EPS             (6)
00131 #define FILTERID_ARTWORKS_EPS       (7)
00132 #define FILTERID_CAMELOT_EPS        (8)
00133 #define FILTERID_COREL3_EPS         (9)
00134 #define FILTERID_COREL4_EPS         (10)
00135 #define FILTERID_ACORN_DRAW         (11)
00136 #define FILTERID_BMP                (12)
00137 #define FILTERID_EPS                (13)
00138 #define FILTERID_NATIVE             (14)
00139 #define FILTERID_CORELPALETTEFILE   (15)
00140 #define FILTERID_CDR                (16)
00141 #define FILTERID_FREEHAND_EPS       (17)
00142 #define FILTERID_ENHMETAFILE        (18)
00143 
00144 #define BUILD_NATIVE_FILTERS        FALSE
00145 #define FILTERID_NATIVE_EPS         (19)    // The old version 1.1 native filter
00146 #define FILTERID_WEB                (20)
00147 #define FILTERID_CMX16              (21)
00148 #define FILTERID_CMX32              (22)
00149 #define FILTERID_CMXIMPORT          (23)
00150 #define FILTERID_AI8EPS             (24)
00151 
00152 // Flash filter
00153 #define FILTERID_FLASH              (25)    // JCF: added as otherwise returned ID_NONE
00154 
00155 // PhotoShop EPS filter
00156 #define FILTERID_PHOTOSHOPEPS       (26)    // (ChrisG 9/11/00) for the PhotoShop EPS Stub filter
00157 
00158 // Palette filters
00159 #define FILTERID_PALETTE            (30)
00160 #define FILTERID_MSPALETTE          (31)
00161 #define FILTERID_ADOBECOLOURTABLE   (32)
00162 #define FILTERID_ADOBECOLOURSWATCH  (33)
00163 #define FILTERID_PSPPALETTE         (34)
00164 #define FILTERID_JCWPALETTE         (35)
00165 
00166 // Imagemap filter
00167 #define FILTERID_IMAGEMAP           (40)
00168 
00169 
00170 // Following supplied by Accusoft Image Format Library DLL V5
00171 #define FILTERID_ACCUSOFT           (100)
00172 #define FILTERID_ACCUSOFTBMP        (101)
00173 #define FILTERID_BROOKTROUT         (102)
00174 #define FILTERID_CALS               (103)
00175 #define FILTERID_DCX                (104)
00176 #define FILTERID_GIF                (105)
00177 #define FILTERID_GX2                (106)
00178 #define FILTERID_HALOCUT            (107)
00179 #define FILTERID_IFF                (108)
00180 #define FILTERID_IMG                (109)
00181 #define FILTERID_IOCA               (110)
00182 #define FILTERID_JPEG               (111)
00183 #define FILTERID_KOFAX              (112)
00184 #define FILTERID_LASERDATA          (113)
00185 #define FILTERID_MACPAINT           (114)
00186 #define FILTERID_MSICONS            (115)
00187 #define FILTERID_MSPAINT            (116)
00188 #define FILTERID_PCX                (117)
00189 #define FILTERID_PHOTOCD            (118)
00190 #define FILTERID_PHOTOSHOP          (119)
00191 #define FILTERID_PICT               (120)
00192 #define FILTERID_SUN                (121)
00193 #define FILTERID_TARGA              (122)
00194 #define FILTERID_TIFF               (123)
00195 #define FILTERID_WPG                (124)
00196 #define FILTERID_XWINDOWS           (125)
00197 #define FILTERID_PREVIEW            (126)   //WEBSTER-obsolete
00198 
00199 #define FILTERID_TI_GIF             (127)
00200 #define FILTERID_SPRITE             (128)
00201 
00202 #define FILTERID_PPM                (129)
00203 #define FILTERID_PGM                (130)
00204 #define FILTERID_PBM                (131)
00205 
00206 #define FILTERID_DXF                (132)
00207 
00208 #define FILTERID_PNG                (133)
00209 
00210 #define FILTERID_PREVIEW_BMP        (134)
00211 #define FILTERID_PREVIEW_GIF        (135)
00212 #define FILTERID_PREVIEW_JPEG       (136)
00213 #define FILTERID_PREVIEW_PNG        (137)
00214 #define FILTERID_PREVIEW_TIFF       (138)   //WEBSTER new number, no longer FILTERID_PREVIEW
00215 
00216 #define FILTERID_IMPORT_JPEG        (140)
00217 #define FILTERID_EXPORT_JPEG        (141)
00218 
00219 //#define BUILD_TEXT_FILTERS FALSE
00220 #define BUILD_TEXT_FILTERS TRUE     // Olivier 26/03/97 HTML filter
00221 #define BUILD_OTHER_TEXT_FILTERS    FALSE
00222 #define FILTERID_TEXT               (200)
00223 #define FILTERID_TEXT_ASCII         (201)
00224 #define FILTERID_TEXT_UNICODE       (202)
00225 #define FILTERID_TEXT_RTF           (203)
00226 
00227 // HTML Filter Id
00228 #define FILTERID_HTML               (204)
00229 
00230 // Flare Template ID
00231 #define FILTERID_FLARETEMPLATE      (205)
00232 
00233 // external Aldus filters need to have a range of 100 (should be plenty)
00234 #define FILTERID_ALDUS_START        1000
00235 #define FILTERID_ALDUS_END          1099
00236 
00237 // ImageMagick filters IDs 1100-1999 - 900 should be enough
00238 #define FILTERID_IMAGEMAGICK_START  1100
00239 #define FILTERID_IMAGEMAGICK_END    1999
00240 
00241 // !!!!!!!!!!!!!!!!! DON'T ADD ANY MORE TO THE ABOVE LIST !!!!!!!!!!!!!!!!
00242 
00243 enum SelectionType { SELECTION, DRAWING, SPREAD, ABITMAP, SOMEBITMAPS, PAGE };
00244 
00245 
00246 /********************************************************************************************
00247 
00248 >   class FilterFlags
00249 
00250     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00251     Created:    08/03/94
00252     Purpose:    Indicate what functions a filter is capable of.
00253     SeeAlso:    Filter
00254 
00255 ********************************************************************************************/
00256 
00257 class FilterFlags
00258 {
00259 public:
00260     UINT32 CanImport : 1;
00261     UINT32 CanExport : 1;
00262     UINT32 CanExportMultipleImages : 1;
00263     UINT32 ShowFilter : 1;
00264 
00265     BOOL operator==(const FilterFlags Flags);
00266 };
00267 
00268 
00269 /********************************************************************************************
00270 
00271 >   class ImportPosition
00272 
00273     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00274     Created:    29/07/94
00275     Purpose:    Defines where to position an imported file.
00276     SeeAlso:    Filter; Filter::DoImport
00277 
00278 ********************************************************************************************/
00279 
00280 class Spread;
00281 
00282 class ImportPosition
00283 {
00284 public:
00285     Spread *pSpread;
00286     DocCoord Position;
00287 };
00288 
00289 
00290 
00291 
00292 // Forward references for the Filter class.
00293 class GenericFilter;
00294 class SelOperation;
00295 class Operation;
00296 class Document;
00297 class GenericFilter;
00298 class Layer;
00299 class Spread;
00300 class ExportDC;
00301 class RenderRegion;
00302 class AttributeEntry;
00303 class KernelBitmap;
00304 
00305 
00306 // Used to indicate what level of bitmap support a filter has.
00307 enum BitmapFilterSupport 
00308 {
00309     NoBitmapSupport, 
00310     SimpleBitmapSupport, 
00311     IndirectedBitmapSupport
00312 };
00313 
00314 
00315 /********************************************************************************************
00316 
00317 >   class SnapShotItem : public ListItem
00318 
00319     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00320     Created:    27/10/95
00321     Purpose:    Defines what is saved during a current attribute snap shot.
00322 
00323 ********************************************************************************************/
00324 
00325 class SnapShotItem : public ListItem
00326 {
00327     CC_DECLARE_MEMDUMP(SnapShotItem);
00328 
00329     friend class SnapShotList;
00330 
00331 public:
00332     SnapShotItem();
00333     ~SnapShotItem();
00334 
00335     INT32 Initialise( AttributeEntry* CurrAttrs );
00336 
00337 private:
00338     // An attribute mask
00339     NodeAttribute **SnapShotAttrs;
00340     AttributeEntry *SnapShotAttrsStack;
00341 };
00342 
00343 
00344 /********************************************************************************************
00345 
00346 >   class SnapShotList : public CC_CLASS_MEMDUMP
00347 
00348     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00349     Created:    27/10/95
00350     Purpose:    Defines what is saved during a current attribute snap shot.
00351 
00352 ********************************************************************************************/
00353 
00354 class SnapShotList : public CC_CLASS_MEMDUMP
00355 {
00356     CC_DECLARE_MEMDUMP(SnapShotList);
00357 
00358     public:
00359          SnapShotList();
00360         ~SnapShotList();
00361 
00362         BOOL            CreateSnapShot(AttributeEntry* CurrAttrs);
00363         void            DestroySnapShot();
00364 
00365         SnapShotItem*   GetCurrentSnapShot();
00366         BOOL            ApplyChangedAttrs(Node* pNode, AttributeEntry* CurrAttrs);
00367         void            PushAttrsBasedOnSnapShot(AttributeEntry* CurrAttrs);
00368         void            PopAttrsBasedOnSnapShot(AttributeEntry* CurrAttrs);
00369     
00370     private:
00371         List            SnapShot;
00372 };
00373 
00374 
00375 
00376 /********************************************************************************************
00377 >   class AttrRecordItem : public ListItem
00378 
00379     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00380     Created:    6/12/95
00381     Purpose:    Used to record the state of an AttributeEntry array.
00382     SeeAlso:    AttrRecordList
00383 ********************************************************************************************/
00384 class AttrRecordItem : public ListItem
00385 {
00386     CC_DECLARE_MEMDUMP(AttrRecordItem);
00387     friend class AttrRecordList;
00388 
00389 public:
00390      AttrRecordItem();
00391     ~AttrRecordItem();
00392 
00393     BOOL Initialise(AttributeEntry* CurrAttrs);
00394     BOOL Restore(AttributeEntry* CurrAttrs);
00395 
00396 protected:
00397     AttributeEntry *RecordedAttrs;
00398 };
00399 
00400 
00401 /********************************************************************************************
00402 >   class AttrRecordList : public CC_CLASS_MEMDUMP
00403 
00404     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00405     Created:    6/12/95
00406     Purpose:    Used to store a stack of AttributeEntry states. Used by filters that need to
00407                 keep an attribute state stack (eg the RTF filter)
00408 ********************************************************************************************/
00409 class AttrRecordList : public CC_CLASS_MEMDUMP
00410 {
00411     CC_DECLARE_MEMDUMP(AttrRecordList);
00412 
00413 public:
00414      AttrRecordList();
00415     ~AttrRecordList();
00416 
00417     BOOL SaveContext(AttributeEntry* CurrAttrs);
00418     BOOL RestoreContext(AttributeEntry* CurrAttrs);
00419     List* GetList()         {return &AttrRecord;}
00420 
00421 protected:
00422     List AttrRecord;
00423 };
00424 
00425 
00426 enum DESTRUCTION_METHOD
00427 {
00428     DM_INVALID          = 0,    // don't use this, it's for catching duff initialization
00429     DM_DELETE_WHEN_DONE = 1,
00430     DM_KEEP_WHEN_DONE
00431 };
00432 
00433 typedef UINT32 ID;
00434 /********************************************************************************************
00435 
00436 >   class Filter : public ListItem
00437 
00438     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00439     Created:    08/03/94
00440     Purpose:    Pure base class for import and export filters.
00441                 Provides static functions to initialise and deinitialise all the
00442                 available filters.
00443     SeeAlso:    OILFilter
00444 
00445 ********************************************************************************************/
00446 
00447 class Filter : public ListItem
00448 {
00449     friend class FilterRenderCallback;
00450 
00451     CC_DECLARE_DYNAMIC(Filter)
00452 
00453 public:
00454     Filter();
00455     virtual ~Filter();
00456 
00457     virtual BOOL Init() = 0;
00458     virtual void Deinit()
00459     {
00460         if (pOILFilter)
00461         {
00462             delete pOILFilter;
00463             pOILFilter = NULL;
00464         }
00465     };
00466 
00467     FilterFlags GetFlags();
00468 
00469     // Use these to override the status-bar messages for typical file exports.  We use it
00470     // to change the "Saving document..." message "Copying to clipboard..." when we
00471     // export native data to the clipboard.
00472     static void ForceStatusExportMessage(UINT32 nMessageID);
00473     static void UnforceStatusExportMessage();
00474 
00475     // Function to load in the first part of a file so it can be validated before
00476     // importing it.
00477     ADDR LoadInitialSegment(PathName& Path, UINT32 *Size, size_t *FileSize);
00478     
00479     // Overloaded version of the above that doesn't open or close the file passed to it.
00480     ADDR LoadInitialSegment(CCLexFile* pFile, UINT32* pSize, size_t *pFileSize);
00481 
00482     // Import filters override these functions:
00483 
00484     // Works out if opening a file of this type requires a default document to be loaded
00485     // or does the file format supply the document.
00486     virtual BOOL IsDefaultDocRequired(const TCHAR* pcszPathName);
00487 
00488     // Function called before HowCompatible so that filters have a chance to do
00489     // something, if required. Baseclass version is present but does nothing.
00490     // Therefore, only needs to be overridden by a filter or set of filters which requires it.
00491     virtual BOOL PreHowCompatible();
00492 
00493     // Graham 11/4/97: The next three functions used to be pure virtual. However,
00494     // this meant that export filters derived from Filter had to override functions
00495     // like DoImport and HowCompatible, which was rather odd. So now these
00496     // base class functions all return NULL values.
00497     
00498     // HowCompatible() returns value in range 0 to 10:
00499     //   0 => "Definitely Not"
00500     //  10 => "Yes Sir, that's my file format"
00501     
00502     virtual INT32 HowCompatible(    PathName& Filename, 
00503                                 ADDR  HeaderStart, 
00504                                 UINT32 HeaderSize,
00505                                 UINT32 FileSize )
00506     {
00507         return 0;
00508     }
00509 
00510     virtual BOOL DoImport(SelOperation*, CCLexFile*, Document*, 
00511                           BOOL AutoChosen = FALSE, ImportPosition *Pos = NULL,
00512                           KernelBitmap** ppImportedBitmap = NULL,
00513                           DocCoord* pPosTranslate = NULL, String_256* URL = NULL
00514                           )
00515     {
00516         return FALSE;
00517     }
00518 
00519     // Export filters override these functions:
00520     virtual BOOL DoExport(Operation*, CCLexFile*, PathName*, Document*, BOOL = TRUE)
00521     {
00522         return FALSE;
00523     }
00524 
00525     virtual BOOL JoinFamily(CCRuntimeClass*);
00526 
00527     virtual BOOL ImportBitmap(CCLexFile*, KernelBitmap**);
00528     virtual BOOL ExportBitmap(KernelBitmap&);
00529 
00530     static GenericFilter* GetGenericFilter() { return pGenericFilter; }
00531 
00532     Document* GetDocument() { return TheDocument; }
00533     AttributeEntry* GetCurrentAttrs() { return CurrentAttrs; }
00534 
00535     virtual INT32 ImportBinary(ADDR pData, INT32 Length);
00536 
00537     virtual BitmapFilterSupport GetBitmapSupportLevel();
00538 
00539     // Functions to help with the inclusion of Preview Bitmaps
00540     virtual BOOL CanIncludePreviewBmp();
00541     void IncludePreviewBmp(BOOL WantBmp);
00542 
00543     // Function which determines if a filter should export invisible layers or not
00544     virtual BOOL ExportVisibleLayersOnly(); 
00545                
00546     // Function which determines if a filter should export the selected items or not
00547     virtual BOOL ExportSelectionOnly(BOOL MaskedRender = FALSE); 
00548 
00549     String_256  FilterName;     // That the user sees to choose from.
00550     String_256  FilterInfo;     // e.g. author, type, version.
00551     UINT32      FilterID;       // Unique ID for this filter (see above).
00552     OILFilter  *pOILFilter;
00553 
00554     // This function produces the "Do you want to replace file?" message
00555     virtual BOOL WillAcceptExistingFile(PathName pthToReplace);
00556 
00557     // Tells Camelot whether or not to include attributes within the saved file. (Only
00558     // used by the native filters.)
00559     virtual void SetSaveAttributes (BOOL DoSave);
00560 
00561     void SetSoleLayer(Layer* pLayer) {m_pSoleLayer = pLayer;}
00562     Layer* GetSoleLayer() {return m_pSoleLayer;}
00563 
00564 protected:
00565     // Support for Filter Preferences
00566     static BOOL DeclareFilterPreferenceSection();
00567     //virtual BOOL DeclareFilterPref(const Preference& preference);
00568 
00569     // This (tries to) override the status-line message displayed when a file exports.
00570     static UINT32 m_nForcedStatusExportMessage;
00571 
00572     // Flag to indicate if we want to attach a Preview bitmap at the end of the export
00573     BOOL WantPreviewBmp;
00574 
00575     // Flags for the filter
00576     FilterFlags Flags;
00577 
00578     // The document associated with this filter
00579     Document* TheDocument;
00580 
00581     // Simple bodge until we position imported files properly.
00582     Layer *GetActiveLayer(Document*);
00583     BOOL MakeSureLayerExists(Document* pDoc);
00584 
00585     // Simple bodge until we allow the user to choose which spread to export.
00586     static Spread* GetFirstSpread(Document*);
00587 
00588     // The string to display when exporting, or 0 if we're not an export filter.
00589     UINT32 ExportMsgID;
00590 
00591     // A message to be displayed when the export has been stopped, such as pressing
00592     // escape when using the progress bar/hourglass.
00593     UINT32 StopExportMsgID;
00594 
00595     // The string to display when importing or 0 if we're not an import filter
00596     UINT32 ImportMsgID;
00597 
00598     // Should attributes be saved?
00599     BOOL SaveAttributes;
00600 
00601     Layer* m_pSoleLayer;
00602 
00603 public:
00604     virtual BOOL OpenExportFile(CCDiskFile* pDiskFile, PathName* pPath);
00605     virtual BOOL DeleteExportFile(CCDiskFile* pDiskFile);
00606 
00607     // Export a spread to an export DC. Now virtual and broken into two parts so that the
00608     // bitmap export can render in strips.
00609     virtual BOOL ExportRender( RenderRegion *pRegion, BOOL MaskedRender = FALSE);
00610     virtual BOOL ExportRenderNodes ( RenderRegion*  pRegion,
00611                                      ExportDC*      pDC,
00612                                      BOOL           VisibleLayersOnly       = FALSE,
00613                                      BOOL           CheckSelected           = FALSE,
00614                                      BOOL           ShowProgress            = TRUE );
00615 
00616     // Functions to put correct information on progress bar during import/export 
00617     virtual String_64 GetImportProgressString(CCLexFile* File, UINT32 ImportingMsgID);
00618     virtual String_64 GetExportProgressString(CCLexFile* File, UINT32 ExportingMsgID);
00619 
00620     // Baseclass functions for returning the import and export message ids.
00621     // Baseclass versions just return the ExportMsgID and ImportMsgID
00622     // Allow somebody to read the export ID and to override it for say multistage exports
00623     virtual UINT32 GetExportMsgID();
00624     virtual UINT32 GetImportMsgID();
00625 
00626 
00627     // this function is used to add (for instance) 'file 1 of 5.' 
00628     virtual BOOL AddStringToProgressString(String_64* Str);
00629 
00630     //Graham 22/5/97
00631     //Determines whether we want to export an HTML tag to the clipboard
00632     virtual BOOL ShouldExportHTMLTag()
00633     {
00634         return FALSE;
00635     }
00636 
00637     //Actually exports the HTML tag to the clipboard
00638     virtual void ExportHTMLTag()
00639     {
00640     }
00641 
00642     //Function to find a filter given a Filter ID
00643     static Filter* FindFilterFromID(const UINT32 FilterID);
00644 
00645 protected:
00646     // The body of ExportRenderNodes:
00647     virtual BOOL WriteNodes ( RenderRegion* pRegion,
00648                               ExportDC*     pDC,
00649                               BOOL          VisibleLayersOnly,
00650                               BOOL          CheckSelected,
00651                               BOOL          ShowProgress);
00652     virtual BOOL EndExportRender ( RenderRegion *pRegion,
00653                                    BOOL         ShowProgress );
00654     
00655     // see just a line above
00656     // see also GetProgressString() for the modifications
00657     String_64 m_StrToAddToProgress;
00658 
00659 
00660     // Functions to make it simple to change the current attributes.
00661     BOOL SetUpCurrentAttrs();
00662     void DeleteCurrentAttrs();
00663     BOOL SetLineColour(DocColour&);
00664     BOOL SetLineWidth(MILLIPOINT);
00665     BOOL SetLineCap(LineCapType);
00666     BOOL SetJoinType(JointType);
00667     BOOL SetLineTransp(UINT32 TranspType, UINT32 Transp);
00668     BOOL SetDashPattern(DashRec&);
00669     BOOL SetStartArrow(ArrowRec&);
00670     BOOL SetEndArrow(ArrowRec&);
00671     BOOL SetMitreLimit(MILLIPOINT);
00672 
00673     BOOL SetTextFont(String_64 *EncodedName, INT32 Millipoint);
00674     BOOL SetTextFontStyle(String_64* FName, INT32 MillFSize, BOOL Bold, BOOL Italic);
00675     BOOL SetTextSize(INT32 Size);
00676     BOOL SetTextTypeFace(String_64* Name, FontClass Class = FC_UNDEFINED);
00677     BOOL SetTextBold(BOOL Bold);
00678     BOOL SetTextItalic(BOOL Italic);
00679     BOOL SetTextUnderline(BOOL Underline);
00680     BOOL SetTextAspectRatio(FIXED16 AspectR);
00681     BOOL SetTextTracking(INT32 Tracking);
00682     BOOL SetTextJustification(Justification Justify);
00683     virtual BOOL SetTextLineSpacing(INT32 Type, INT32 EMLSpace, MILLIPOINT MLSpace, double DLSpace);
00684     BOOL SetTextBaseLine(MILLIPOINT BaseLine);
00685     BOOL SetTextScript(INT32 rise, INT32 pointsize);
00686     BOOL SetTextBoldFont(BOOL Bold);
00687     BOOL SetTextItalicFont(BOOL Italic);
00688     BOOL RemoveTextScript();
00689 
00690     // Whether or not the path/shape/etc should be filled
00691     BOOL SetPathFilled(BOOL Filled);
00692 
00693     // Chromatic fill geometries
00694     BOOL SetFillColour(DocColour&);
00695 
00696     BOOL SetLinearFill(DocColour &StartColour, DocColour &EndColour,
00697                        DocCoord StartPoint, DocCoord EndPoint,
00698                        DocCoord *EndPoint3 = NULL);
00699 
00700     BOOL SetRadialFill(DocColour &StartColour, DocColour &EndColour,
00701                        DocCoord StartPoint, DocCoord EndPoint);
00702 
00703     BOOL SetRadialFill(DocColour &StartColour, DocColour &EndColour,
00704                        DocCoord StartPoint, 
00705                        DocCoord EndPoint1, DocCoord EndPoint2);
00706 
00707     BOOL SetSquareFill(DocColour &StartColour, DocColour &EndColour,
00708                        DocCoord StartPoint, 
00709                        DocCoord EndPoint1, DocCoord EndPoint2);
00710 
00711     BOOL SetConicalFill(DocColour &StartColour, DocColour &EndColour,
00712                         DocCoord StartPoint, DocCoord EndPoint);
00713 
00714     BOOL SetBitmapFill(KernelBitmap *pBitmap,
00715                        DocCoord StartPoint, DocCoord EndPoint, DocCoord EndPoint2,
00716                        DocColour *StartColour = 0, DocColour *EndColour = 0);
00717 
00718     BOOL SetFractalFill(DocColour &StartColour, DocColour &EndColour,
00719                         DocCoord StartPoint, DocCoord EndPoint1, DocCoord EndPoint2,
00720                         INT32 Seed, double Graininess, double Gravity, double Squash, 
00721                         UINT32 DPI, BOOL Tileable);
00722 
00723     // Transparent fill geometries
00724     BOOL SetNoTranspFill();
00725 
00726     BOOL SetFlatTranspFill(UINT32 TranspType, UINT32 Transp);
00727 
00728     BOOL SetLinearTranspFill(UINT32 TranspType, UINT32 StartTransp, UINT32 EndTransp,
00729                              DocCoord StartPoint, DocCoord EndPoint, 
00730                              DocCoord *EndPoint3 = NULL);
00731 
00732     BOOL SetRadialTranspFill(UINT32 TranspType, UINT32 StartTransp, UINT32 EndTransp,
00733                              DocCoord StartPoint, DocCoord EndPoint);
00734 
00735     BOOL SetRadialTranspFill(UINT32 TranspType, UINT32 StartTransp, UINT32 EndTransp,
00736                              DocCoord StartPoint, 
00737                              DocCoord EndPoint1, DocCoord EndPoint2);
00738 
00739     BOOL SetConicalTranspFill(UINT32 TranspType, UINT32 StartTransp, UINT32 EndTransp,
00740                               DocCoord StartPoint, DocCoord EndPoint);
00741 
00742     BOOL SetBitmapTranspFill(UINT32 TranspType, KernelBitmap *pBitmap,
00743                              DocCoord StartPoint, DocCoord EndPoint, DocCoord EndPoint2,
00744                              UINT32 StartTransp = 0, UINT32 EndTransp = 255);
00745 
00746     BOOL SetFractalTranspFill(UINT32 TranspType,
00747                               DocCoord StartPoint, DocCoord EndPoint1, DocCoord EndPoint2,
00748                               INT32 Seed, double Graininess, double Gravity, double Squash, 
00749                               UINT32 DPI, BOOL Tileable,
00750                               UINT32 StartTransp = 0, UINT32 EndTransp = 255);
00751 
00752     // Chromatic fill effects
00753     BOOL SetFadeFillEffect();
00754     BOOL SetRainbowFillEffect();
00755     BOOL SetAltRainbowFillEffect();
00756 
00757     // Fill mappings
00758     BOOL SetLinearFillMapping(INT32 Repeat);
00759     BOOL SetLinearTranspFillMapping(INT32 Repeat);
00760 
00761     // Winding rule
00762     BOOL SetWindingRule(WindingType);
00763 
00764     virtual BOOL GetDragAndDropTranslation(ImportPosition* pPos, DocRect BoundsRect, Coord* Offset);
00765 
00766     // Save and restore the current attrs list
00767     BOOL SnapShotCurrentAttrs();
00768     void PushCurrentAttrsBasedOnSnapShot();
00769     void PopCurrentAttrsBasedOnSnapShot();
00770     void DeleteSnapShot();
00771     void DeleteAttributeList(AttributeEntry* pAttrList);
00772     BOOL ApplyChangedAttrs(Node* pNode);
00773 
00774     // Render callback progress helper
00775     virtual void UpdateFilterProgress(UINT32 increment);
00776 
00777     // Pointer to the current attributes.
00778     AttributeEntry *CurrentAttrs;
00779 
00780     // An attribute mask
00781     SnapShotList FilterSnapShot;
00782 
00783     // Used to remember the fill colour when the fill flag is set
00784     AttributeEntry FillAttr;
00785     BOOL PathFilled; 
00786 
00787 private:
00788     // Pointer to the generic filter used for file drag'n'drop etc.
00789     static GenericFilter* pGenericFilter;
00790 
00791     // The list of filters that Camelot understands.
00792     static List FilterList;
00793 
00794     // Going soon...
00795     static ID       m_NextFilterID;
00796 
00797 protected:
00798     // Minimum line width preference
00799     static INT32 MinLineWidth;
00800 
00801 public:
00802     static BOOL InitFilters();
00803     static BOOL DeinitFilters();
00804     static Filter* GetFirst();
00805     static Filter* GetNext(Filter*);
00806 
00807     // Say goodbye to this...
00808     static List& GetFilters()           {   return FilterList;  }
00809     static ID   GetNewFilterID();
00810     static ID   RegisterFilter( Filter* const pFilter);
00811 
00812 
00813 
00814 
00815     // Colour list preference
00816     static BOOL AddUnnamedColours;
00817 
00818     // Use/don't use layers import preference
00819     static INT32 ImportWithLayers;
00820 
00821     // Use/don't use layers open preference
00822     static BOOL OpenWithLayers;
00823 
00824     // Use/don't use layers when opening/importing bitmaps
00825     // Applies to multiple format bitmaps such as animated GIFs
00826     static BOOL ImportBitmapsOntoLayers;
00827 
00828     static BOOL bDontWarnBitmapNonMixTransp;
00829 
00830 public:
00831     virtual BOOL IncProgressBarCount(UINT32 n)  { return TRUE; }    // do nothing
00832     
00833     // To provide a smooth progress display for large objects
00834     BOOL UpdateExportedNodeCount(UINT32 NumNodes = 1);
00835     
00836     // We need to access the private variables from basebitmap filter
00837     UINT32 GetNumNodes();
00838     UINT32 SetNumNodes(UINT32 NewNumNodes);
00839 
00840 // Graeme 22/9/99
00841 // Changed access permission from private to protected.
00842 protected:
00843     // Used for progress display/update.
00844     static UINT32 NumNodes;
00845     static UINT32 UpdateEvery;
00846     static UINT32 LastExportProgressUpdate;
00847     static UINT32 CurrentProgressLimit;
00848 protected:
00849     static UINT32 ProgressOffset;
00850     static UINT32 m__StripStart;
00851 };
00852 
00853 
00854 
00855 /********************************************************************************************
00856 
00857 >   class FilterRenderCallback : public RenderCallback
00858 
00859     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00860     Created:    30/11/2004
00861     Purpose:    Handling callbacks from RenderTree
00862     Notes:      RenderTree function calls the main function in this class when it's about
00863                 to render any Node.
00864 
00865 ********************************************************************************************/
00866 
00867 class FilterRenderCallback : public RenderCallback
00868 {
00869 public:
00870     FilterRenderCallback(Filter* pFilter, BOOL bCount, BOOL bVisibleLayersOnly, BOOL bSelectedOnly)
00871     {
00872         m_pFilter = pFilter;
00873         m_bCount = bCount;
00874         m_bVisibleLayersOnly = bVisibleLayersOnly;
00875         m_bSelectedOnly = bSelectedOnly;
00876     }
00877 
00878     virtual BOOL BeforeNode(RenderRegion* pRegion, Node* pNode);
00879     virtual BOOL BeforeSubtree(RenderRegion* pRegion,
00880                                 Node* pNode,
00881                                 Node** ppNextNode,
00882                                 BOOL bClip,
00883                                 SubtreeRenderState* pState);
00884 
00885 private:
00886     Filter* m_pFilter;
00887     BOOL m_bCount;
00888     BOOL m_bVisibleLayersOnly;
00889     BOOL m_bSelectedOnly;
00890 };
00891 
00892 /********************************************************************************************
00893 
00894 >   class VectorFilter : public Filter
00895 
00896     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00897     Created:    26/07/94
00898     Purpose:    Allows filter families to contain all vector formats.  All filters that
00899                 load vector-based files (EPS, metafiles, and so on), should be derived from
00900                 this class.
00901                 Vector files often contain bitmaps - if in doubt, derive from the
00902                 VectorFilter.
00903     SeeAlso:    BitmapFilter
00904 
00905 ********************************************************************************************/
00906 
00907 class VectorFilter : public Filter
00908 {
00909     CC_DECLARE_DYNAMIC(VectorFilter)
00910 };
00911 
00912 /********************************************************************************************
00913 
00914 >   class BitmapFilter : public Filter
00915 
00916     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00917     Created:    26/07/94
00918     Purpose:    Allows filter families to contain all bitmap formats. All filters that
00919                 load pure bitmap files (TIFF, JPEG, BMP etc) should be derived from this
00920                 class.
00921                 Some file formats contain mixes of vector and bitmap graphics (e.g. EPS) - in
00922                 this case, always derive from the VectorFilter.
00923     SeeAlso:    VectorFilter
00924 
00925 ********************************************************************************************/
00926 
00927 class BitmapFilter : public Filter
00928 {
00929     CC_DECLARE_DYNAMIC(BitmapFilter)
00930 };
00931 
00932 /********************************************************************************************
00933 
00934 >   class CompatibleFilter : public ListItem
00935 
00936     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00937     Created:    28/03/94
00938     Purpose:    A simple ListItem derived class to allow a list of filters to be
00939                 maintained - the list holds all the filters that claim to understand a
00940                 particular file (see FilterFamily).
00941                 It is not derived from the Filter class itself because although the Filter 
00942                 class is derived from ListItem too, we want to store a list of pointers to 
00943                 existing filters, rather than actual instances of the Filter class.
00944                 For each entry, a 'compatibility rating' is held, to allow the 
00945                 FilterFamily class (the client of this class) to choose the most
00946                 compatible filter from the list.
00947     SeeAlso:    CompatibleFilterList; Filter; ListItem
00948 
00949 ********************************************************************************************/
00950 
00951 class CompatibleFilter : public ListItem
00952 {
00953     CC_DECLARE_MEMDUMP(CompatibleFilter)
00954 
00955 public:
00956     CompatibleFilter(Filter *NewFilter, INT32 NewCompatibility);
00957 
00958     // Pointer to the filter in question.
00959     Filter *pFilter;
00960 
00961     // Compatibility rating for this filter.
00962     INT32 Compatibility;
00963 };
00964 
00965 /********************************************************************************************
00966 
00967 >   class CompatibleFilterList : public List
00968 
00969     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00970     Created:    28/03/94
00971     Purpose:    Simple list class to allow a list of compatible filters to be maintained.
00972     SeeAlso:    CompatibleFilter; Filter; FilterFamily; CompatibleFilterList::AddFilter
00973 
00974 ********************************************************************************************/
00975 
00976 class CompatibleFilterList : public List
00977 {
00978     CC_DECLARE_MEMDUMP(CompatibleFilterList)
00979 public:
00980     BOOL AddFilter(Filter*, INT32 Compatibility);
00981 };
00982 
00983 /********************************************************************************************
00984 
00985 >   class FilterFamily : public Filter
00986 
00987     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
00988     Created:    28/03/94
00989     Purpose:    Special version of an import filter.
00990                 This filter is actually a subset of the installed filters, to allow the user
00991                 to easily specify a broad category of file rather than the exact file
00992                 format and application version that they want to import (because they might
00993                 not actually know!).
00994                 It understands all the files that all the family of filters
00995                 understand, by the simple expedient of being a generic interface to all
00996                 of them.
00997                 i.e. Given any file, this filter asks all the others how compatible they
00998                      are with the file.  It then chooses the filter that has the highest
00999                      compatibility rating, and gets it to import the file.
01000 
01001                 It is also used to implement a 'generic' filter, which includes *all*
01002                 filters, so that the user can just click on a file and not have to specify
01003                 the actual filter to use unless they really want to.  We will also use
01004                 this generic filter to handle files that are dropped on Camelot's window.
01005 
01006     SeeAlso:    Filter; Filter::HowCompatible
01007 
01008 ********************************************************************************************/
01009 
01010 class FilterFamily : public Filter
01011 {
01012     CC_DECLARE_DYNAMIC(FilterFamily)
01013 
01014 public:
01015     FilterFamily();
01016     ~FilterFamily();
01017 
01018     // Works out if opening a file of this type requires a default document to be loaded
01019     // or does the file format supply the document.
01020     virtual BOOL IsDefaultDocRequired(const TCHAR* pcszPathName);
01021 
01022     Filter* GetBestFilter(CCLexFile* pFile, BOOL ShowWarnings = FALSE);
01023 
01024     INT32 HowCompatible(PathName& Filename, ADDR HeaderStart, UINT32 HeaderSize, UINT32 FileSize);
01025     virtual BOOL DoImport(SelOperation*, CCLexFile*, Document*, 
01026                           BOOL Auto = FALSE, ImportPosition* Pos = NULL,
01027                           KernelBitmap** ppImportedBitmap = NULL,
01028                           DocCoord* pPosTranslate = NULL, String_256* = NULL);
01029     virtual BOOL DoExport(Operation*, CCLexFile*, PathName*, Document*, BOOL);
01030 
01031     virtual BOOL ImportBitmap(CCLexFile*, KernelBitmap**);
01032     virtual BOOL JoinFamily(CCRuntimeClass*);
01033 
01034     Filter* pCachedBestFilter;
01035     CCRuntimeClass* pFilterType;
01036 };
01037 
01038 
01039 /********************************************************************************************
01040 
01041 >   class GenericFilter : public FilterFamily
01042 
01043     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
01044     Created:    28/07/94
01045     Purpose:    A filter for all file types.   This is the default filter that the user
01046                 can import with.
01047     SeeAlso:    FilterFamily
01048 
01049 ********************************************************************************************/
01050 
01051 class GenericFilter : public FilterFamily
01052 {
01053     CC_DECLARE_DYNAMIC(GenericFilter);
01054 
01055 public:
01056     GenericFilter();
01057     BOOL Init();
01058 };
01059 
01060 /********************************************************************************************
01061 
01062 >   class VectorFilterFamily : public FilterFamily
01063 
01064     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
01065     Created:    28/07/94
01066     Purpose:    A filter for all vector file types. e.g. EPS, WMF, Draw, etc.
01067     SeeAlso:    FilterFamily
01068 
01069 ********************************************************************************************/
01070 
01071 class VectorFilterFamily : public FilterFamily
01072 {
01073     CC_DECLARE_DYNAMIC(VectorFilterFamily);
01074 
01075 public:
01076     VectorFilterFamily();
01077     BOOL Init();
01078 };
01079 
01080 #if BUILD_TEXT_FILTERS
01081 /********************************************************************************************
01082 >   class TextFilter : public Filter
01083 
01084     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
01085     Created:    24/11/95
01086     Purpose:    Allows filter families to contain all text formats. All filters that
01087                 load textual files should be derived from this class.
01088     SeeAlso:    Filter
01089 ********************************************************************************************/
01090 class TextFilter : public Filter
01091 {
01092     CC_DECLARE_DYNAMIC(TextFilter)
01093 };
01094 #endif
01095 
01096 
01097 /********************************************************************************************
01098 
01099 >   class BitmapFilterFamily : public FilterFamily
01100 
01101     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
01102     Created:    28/07/94
01103     Purpose:    A filter for all bitmap file types. e.g. BMP, JPEG, PCX etc
01104     SeeAlso:    FilterFamily
01105 
01106 ********************************************************************************************/
01107 
01108 class BitmapFilterFamily : public FilterFamily
01109 {
01110     CC_DECLARE_DYNAMIC(BitmapFilterFamily);
01111 
01112 public:
01113     BitmapFilterFamily();
01114     BOOL Init();
01115 };
01116 
01117 
01118 #if BUILD_TEXT_FILTERS
01119 /********************************************************************************************
01120 >   class TextFilterFamily : public FilterFamily
01121 
01122     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
01123     Created:    24/11/95
01124     Purpose:    A filter for all text file types. e.g. TXT, RTF
01125     SeeAlso:    FilterFamily
01126 ********************************************************************************************/
01127 class TextFilterFamily : public FilterFamily
01128 {
01129     CC_DECLARE_DYNAMIC(TextFilterFamily);
01130 
01131 public:
01132     TextFilterFamily();
01133     BOOL Init();
01134 };
01135 #endif
01136 
01137 
01138 /********************************************************************************************
01139 
01140 >   class GenericEPSFilter : public FilterFamily
01141 
01142     Author:     Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
01143     Created:    28/07/94
01144     Purpose:    A filter for all EPS files, regardless of the flavour.
01145     SeeAlso:    FilterFamily; EPSFilter
01146 
01147 ********************************************************************************************/
01148 
01149 class GenericEPSFilter : public FilterFamily
01150 {
01151     CC_DECLARE_DYNAMIC(GenericEPSFilter);
01152 
01153 public:
01154     GenericEPSFilter();
01155     BOOL Init();
01156 };
01157 
01158 
01159 
01160 /********************************************************************************************
01161 >   class PaletteFilterFamily : public FilterFamily
01162 
01163     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
01164     Created:    30/4/96
01165     Purpose:    A filter for all palette files
01166     SeeAlso:    FilterFamily
01167 ********************************************************************************************/
01168 
01169 class PaletteFilterFamily : public FilterFamily
01170 {
01171     CC_DECLARE_DYNAMIC(PaletteFilterFamily);
01172 
01173 public:
01174     PaletteFilterFamily();
01175     BOOL Init();
01176 };
01177 
01178 #endif // INC_FILTERS

Generated on Sat Nov 10 03:45:19 2007 for Camelot by  doxygen 1.4.4