cxfrec.h

Go to the documentation of this file.
00001 // $Id: cxfrec.h 1237 2006-06-01 17:40:10Z gerry $
00002 // Header for the controlling class of the v2 file format
00003 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00004 ================================XARAHEADERSTART===========================
00005  
00006                Xara LX, a vector drawing and manipulation program.
00007                     Copyright (C) 1993-2006 Xara Group Ltd.
00008        Copyright on certain contributions may be held in joint with their
00009               respective authors. See AUTHORS file for details.
00010 
00011 LICENSE TO USE AND MODIFY SOFTWARE
00012 ----------------------------------
00013 
00014 This file is part of Xara LX.
00015 
00016 Xara LX is free software; you can redistribute it and/or modify it
00017 under the terms of the GNU General Public License version 2 as published
00018 by the Free Software Foundation.
00019 
00020 Xara LX and its component source files are distributed in the hope
00021 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00022 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00023 See the GNU General Public License for more details.
00024 
00025 You should have received a copy of the GNU General Public License along
00026 with Xara LX (see the file GPL in the root directory of the
00027 distribution); if not, write to the Free Software Foundation, Inc., 51
00028 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00029 
00030 
00031 ADDITIONAL RIGHTS
00032 -----------------
00033 
00034 Conditional upon your continuing compliance with the GNU General Public
00035 License described above, Xara Group Ltd grants to you certain additional
00036 rights. 
00037 
00038 The additional rights are to use, modify, and distribute the software
00039 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00040 library and any other such library that any version of Xara LX relased
00041 by Xara Group Ltd requires in order to compile and execute, including
00042 the static linking of that library to XaraLX. In the case of the
00043 "CDraw" library, you may satisfy obligation under the GNU General Public
00044 License to provide source code by providing a binary copy of the library
00045 concerned and a copy of the license accompanying it.
00046 
00047 Nothing in this section restricts any of the rights you have under
00048 the GNU General Public License.
00049 
00050 
00051 SCOPE OF LICENSE
00052 ----------------
00053 
00054 This license applies to this program (XaraLX) and its constituent source
00055 files only, and does not necessarily apply to other Xara products which may
00056 in part share the same code base, and are subject to their own licensing
00057 terms.
00058 
00059 This license does not apply to files in the wxXtra directory, which
00060 are built into a separate library, and are subject to the wxWindows
00061 license contained within that directory in the file "WXXTRA-LICENSE".
00062 
00063 This license does not apply to the binary libraries (if any) within
00064 the "libs" directory, which are subject to a separate license contained
00065 within that directory in the file "LIBS-LICENSE".
00066 
00067 
00068 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00069 ----------------------------------------------
00070 
00071 Subject to the terms of the GNU Public License (see above), you are
00072 free to do whatever you like with your modifications. However, you may
00073 (at your option) wish contribute them to Xara's source tree. You can
00074 find details of how to do this at:
00075   http://www.xaraxtreme.org/developers/
00076 
00077 Prior to contributing your modifications, you will need to complete our
00078 contributor agreement. This can be found at:
00079   http://www.xaraxtreme.org/developers/contribute/
00080 
00081 Please note that Xara will not accept modifications which modify any of
00082 the text between the start and end of this header (marked
00083 XARAHEADERSTART and XARAHEADEREND).
00084 
00085 
00086 MARKS
00087 -----
00088 
00089 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00090 designs are registered or unregistered trademarks, design-marks, and/or
00091 service marks of Xara Group Ltd. All rights in these marks are reserved.
00092 
00093 
00094       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00095                         http://www.xara.com/
00096 
00097 =================================XARAHEADEREND============================
00098  */
00099 
00100 #ifndef INC_CXFREC
00101 #define INC_CXFREC
00102 
00103 #include "doccoord.h"
00104 #include "cxfdefs.h"
00105 
00106 class DocCoord;
00107 class Matrix;
00108 class Path;
00109 class BaseCamelotFilter;
00110 class CCPanose;
00111 class CCLexFile;
00112 
00113 class FTTypeList;
00114 
00115 //---------------------------------------------------------
00116 
00117 #define CXF_RECORD_CHUNK 256
00118 
00119 /********************************************************************************************
00120 
00121 >   class CXaraFileRecord : public CCObject
00122 
00123     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00124     Created:    22/5/96
00125     Purpose:    This is the class that encapsulates a record in the new v2 format.
00126 
00127 ********************************************************************************************/
00128 
00129 class CXaraFileRecord : public CCObject
00130 {
00131     // Give my name in memory dumps
00132     CC_DECLARE_DYNAMIC(CXaraFileRecord);
00133 
00134 public:
00135     CXaraFileRecord(UINT32 Tag,INT32 Size = -1);
00136     virtual ~CXaraFileRecord();
00137 
00138     void DumpTypes(void);
00139     void WriteAsText(CCLexFile* pFile);
00140 
00141     virtual CXaraFileRecord* GetCopy();     // Returns a ptr to an exact copy
00142 
00143     virtual BOOL Init(BOOL ZeroMemBlock = FALSE);
00144     virtual BOOL Reinit(UINT32 ThisTag,INT32 Size);
00145 
00146     virtual BOOL WriteBYTE(BYTE b);
00147     virtual BOOL WriteUINT32(UINT32 n);
00148     virtual BOOL WriteINT32(INT32 n);
00149     virtual BOOL WriteReference(INT32 n);
00150     virtual BOOL WriteUINT16(UINT16 n);
00151     virtual BOOL WriteINT16(INT16 n);
00152     virtual BOOL WriteBuffer(BYTE* pBuf,size_t BufSize);
00153     virtual BOOL WriteFLOAT(FLOAT f);
00154     virtual BOOL WriteDOUBLE(double d);
00155     virtual BOOL WriteFIXED16(FIXED16 n);
00156     virtual BOOL WriteANGLE(ANGLE a);
00157     virtual BOOL WriteWCHAR(WCHAR w);
00158     virtual BOOL WriteWCHARs(const WCHAR* pw, UINT32 Count);
00159 
00160     virtual BOOL WriteCoord(const DocCoord& Coord);
00161     virtual BOOL WriteCoordTrans(const DocCoord& Coord,INT32 dx,INT32 dy);
00162     virtual BOOL WriteCoordInterleaved(const DocCoord& Coord);
00163     virtual BOOL WriteCoordTransInterleaved(const DocCoord& Coord,INT32 dx,INT32 dy);
00164     virtual BOOL WritePath(Path* pPath);
00165     virtual BOOL WritePathRelative(Path* pPath);
00166     virtual BOOL WritePathTrans(Path* pPath,INT32 dx,INT32 dy);
00167     virtual BOOL WritePathRelativeTrans(Path* pPath,INT32 dx,INT32 dy);
00168     virtual BOOL WriteXOrd(INT32 XOrdinate);
00169     virtual BOOL WriteYOrd(INT32 YOrdinate);
00170     virtual BOOL WriteCCPanose(const CCPanose &MyCCPanose);
00171 
00172     virtual BOOL WriteASCII(const TCHAR* pStr);
00173     virtual BOOL WriteUnicode(const TCHAR* pStr);
00174 PORTNOTE("other","WriteBSTR removed - Windows concept")
00175 #ifndef EXCLUDE_FROM_XARALX
00176     virtual BOOL WriteBSTR(_bstr_t bstr);
00177 #endif
00178     virtual BOOL WriteUTF16STR(const StringVar& pvstr);
00179 
00180     virtual BOOL WriteMatrix(const Matrix & m);
00181     virtual BOOL WriteMatrixTrans(const Matrix & m,INT32 dx,INT32 dy);
00182 
00183     virtual UINT32 GetTag()             { return Tag; }
00184     virtual UINT32 GetSize();
00185     virtual BYTE* GetBuffer()           { return (BYTE*)pBuffer; }
00186 
00187     virtual FTTypeList* GetTypeList(void)   { return(m_pTypeList); };
00188 
00189     virtual INT32  GetRecordNumber();
00190     virtual void  SetRecordNumber(UINT32 n);
00191 
00192     virtual BOOL IsDataSectionFull()    { return (!(SizeIsKnown && CurrentPos < KnownSize)); }
00193 
00194     virtual void ResetReadPos();    // Resets read pos to beginning of the record
00195 
00196     virtual BOOL ReadBYTE(BYTE* pb);
00197     virtual BOOL ReadBYTEtoBOOL(BOOL* pb);          // This function reads byte into BOOL
00198     virtual BOOL ReadBYTEnoError(BYTE* pb);
00199     virtual BOOL ReadUINT32(UINT32* pn);
00200     virtual BOOL ReadINT32(INT32* pn);
00201     virtual BOOL ReadINT32noError(INT32* pn);
00202     virtual BOOL ReadUINT16(UINT16* pn);
00203     virtual BOOL ReadINT16(INT16* pn);
00204     virtual BOOL ReadBuffer(BYTE* pBuf,UINT32 BufSize);
00205     virtual BOOL ReadBuffernoError(BYTE* pBuf,UINT32 BufSize);
00206     virtual BOOL ReadFLOAT(FLOAT* pf);
00207     virtual BOOL ReadDOUBLE(double* pd);
00208     virtual BOOL ReadDOUBLEnoError(double* pd);
00209     virtual BOOL ReadFIXED16(FIXED16 *pn);
00210     virtual BOOL ReadANGLE(ANGLE *pa);
00211     virtual BOOL ReadWCHAR(WCHAR *pw);
00212 
00213     virtual BOOL ReadCoord(DocCoord* pCoord);
00214     virtual BOOL ReadCoordTrans(DocCoord* pCoord,INT32 dx,INT32 dy);
00215     virtual BOOL ReadCoordInterleaved(DocCoord* pCoord);
00216     virtual BOOL ReadCoordTransInterleaved(DocCoord* pCoord,INT32 dx,INT32 dy);
00217     virtual BOOL ReadPath(Path* pPath);
00218     virtual BOOL ReadPathRelative(Path* pPath);
00219     virtual BOOL ReadPathTrans(Path* pPath,INT32 dx,INT32 dy);
00220     virtual BOOL ReadPathRelativeTrans(Path* pPath,INT32 dx,INT32 dy);
00221     virtual BOOL ReadXOrd(INT32* pXOrdinate);
00222     virtual BOOL ReadYOrd(INT32* pYOrdinate);
00223     virtual BOOL ReadCCPanose(CCPanose *pPanose);
00224 
00225     virtual BOOL ReadUnicode(StringBase* pStr);
00226     virtual BOOL ReadUnicode(TCHAR* pStr,UINT32 MaxChars);
00227     virtual BOOL ReadASCII(TCHAR* pStr,UINT32 MaxChars);
00228 #if defined(_UNICODE)
00229     virtual BOOL ReadASCII( char *pStr, UINT32 MaxChars );
00230 #endif
00231 PORTNOTE("other","WriteBSTR removed - Windows concept")
00232 #ifndef EXCLUDE_FROM_XARALX
00233     virtual BOOL ReadBSTR(_bstr_t* bstr, UINT32 MaxChars);
00234 #endif
00235     virtual BOOL ReadUTF16STR(StringVar* pvstr, UINT32 MaxChars);
00236 
00237     virtual BOOL ReadMatrix(Matrix *pMatrix);
00238     virtual BOOL ReadMatrixTrans(Matrix *pMatrix,INT32 dx,INT32 dy);
00239 
00240 private:
00241     void SetUpVars(UINT32 ThisTag,INT32 Size);
00242 
00243     void FreeBuffer();
00244     BOOL AllocBuffer(INT32 Size);
00245     BOOL ExtendBuffer(INT32 Size);
00246 
00247     BOOL    Initialised;
00248 
00249     UINT32  Tag;
00250     UINT32  BufferSize;
00251     UINT32  KnownSize;
00252     BOOL    SizeIsKnown;
00253     INT32   RecordNumber;
00254 
00255     void*   pBuffer;
00256     UINT32  CurrentPos;
00257     BOOL    Overflow;
00258 
00259     FTTypeList* m_pTypeList;
00260 };
00261 
00262 
00263 /********************************************************************************************
00264 
00265 >   class CamelotFileRecord : public CXaraFileRecord
00266 
00267     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00268     Created:    24/6/96
00269     Purpose:    This derived class does all the things that are Camelot-specific.
00270 
00271 ********************************************************************************************/
00272 
00273 class CamelotFileRecord : public CXaraFileRecord
00274 {
00275     // Give my name in memory dumps
00276     CC_DECLARE_DYNAMIC(CamelotFileRecord);
00277 
00278 public:
00279     CamelotFileRecord(BaseCamelotFilter* pFilter,UINT32 Tag,INT32 Size = -1);
00280     ~CamelotFileRecord();
00281 
00282 #if !defined(EXCLUDE_FROM_XARLIB)
00283     // Translates the coords and the paths automatically on writing
00284     virtual BOOL WriteCoord(const DocCoord& Coord);
00285     virtual BOOL WriteCoordInterleaved(const DocCoord& Coord);
00286     virtual BOOL WritePath(Path* pPath);
00287     virtual BOOL WritePathRelative(Path* pPath);
00288     virtual BOOL WriteMatrix(const Matrix & m);
00289     virtual BOOL WriteXOrd(INT32 XOrdinate);
00290     virtual BOOL WriteYOrd(INT32 YOrdinate);
00291 
00292     // Translates the coords and the paths automatically on reading
00293     virtual BOOL ReadCoord(DocCoord* pCoord);
00294     virtual BOOL ReadCoordInterleaved(DocCoord* pCoord);
00295     virtual BOOL ReadPath(Path* pPath);
00296     virtual BOOL ReadPathRelative(Path* pPath);
00297     virtual BOOL ReadMatrix(Matrix *pMatrix);
00298     virtual BOOL ReadXOrd(INT32* pXOrdinate);
00299     virtual BOOL ReadYOrd(INT32* pYOrdinate);
00300 
00301 private:
00302     DocCoord CoordOrigin;
00303 #endif  // EXCLUDE_FROM_XARLIB
00304 };
00305 
00306 #endif  // INC_CXFREC

Generated on Sat Nov 10 03:44:57 2007 for Camelot by  doxygen 1.4.4