cmxibits.h

Go to the documentation of this file.
00001 // $Id: cmxibits.h 1282 2006-06-09 09:46:49Z 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 // bits and pieces for the CMX import filter
00099 
00100 #ifndef CMXIBITS_H
00101 #define CMXIBITS_H
00102 
00103 //#include "list.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00104 //#include "fixst256.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00105 #include "colourix.h"
00106 //#include "attr.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00107 //#include "arrows.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00108 #include "cmxistut.h"
00109 
00110 
00111 class Node;
00112 class Layer;
00113 class CMXImportFilter;
00114 class CMXImportFilterDataSet;
00115 class DocColour;
00116 
00117 // class for storing layer info
00118 class CMXImportLayer : public ListItem
00119 {
00120     CC_DECLARE_DYNAMIC(CMXImportLayer);
00121 
00122 public:
00123     CMXImportLayer();
00124     ~CMXImportLayer();
00125 
00126     // access functions
00127     Node *GetSubTree(void) {return pSubTree;};
00128     void UseSubTree(void) {Used = TRUE;};
00129     Node *GetLastAdded(void) {return pLastNodeAdded;};
00130     void SetName(StringBase *pString) {LayerName = *pString;};
00131 
00132     // stuff for adding bits
00133     BOOL AddNode(Node *pNode);
00134     BOOL StartGroup(void);
00135     BOOL EndGroup(void);
00136 
00137     // handy bits
00138     Layer *UseSubTreeAsLayer(void);
00139 
00140 private:
00141     Node *pSubTree;
00142     Node *pLastNodeAdded;
00143     String_256 LayerName;
00144     BOOL Used;
00145     Node *pGroup;
00146     INT32 GroupLevel;
00147 };
00148 
00149 #define cmxiSTACKTYPE_NOTHING       0
00150 #define cmxiSTACKTYPE_TRANSFORM     1
00151 #define cmxiSTACKTYPE_CLIPPER       2
00152 
00153 class CMXImportStack;
00154 
00155 // class for stackable items
00156 class CMXImportStackableItem : public ListItem
00157 {
00158     CC_DECLARE_DYNAMIC(CMXImportStackableItem);
00159 
00160 public:
00161     virtual INT32 GetStackType(void) = 0;
00162 
00163     // function to be called when it's popped on a stack (after being added to the list)
00164     virtual BOOL PlacedOnStack(CMXImportStack *pStack) {return TRUE;};
00165     // function to be called to activate this stack item
00166     virtual BOOL Activate(CMXImportStack *) = 0;
00167     // function to be called to deactivate this stack item
00168     // if it's the last thing on the stack, IsLastItemOnStack is set
00169     // to let the thingy know that another item isn't going to be activated
00170     virtual BOOL Deactivate(CMXImportStack *, BOOL IsLastItemOnStack) = 0;
00171     // called when the thingy is being removed from the stack
00172     virtual BOOL RemovedFromStack(CMXImportStack *pStack) {return TRUE;};
00173 };
00174 
00175 // stack class
00176 class CMXImportStack : public List
00177 {
00178     CC_DECLARE_DYNAMIC(CMXImportStack);
00179 
00180 public:
00181     CMXImportStack(INT32 St, CMXImportFilter *pFil) {StackType = St; pTheFilter = pFil;};
00182     ~CMXImportStack();
00183 
00184     CMXImportFilter *GetFilter(void) {return pTheFilter;};
00185 
00186     BOOL Push(CMXImportStackableItem *pItem);
00187     CMXImportStackableItem *Pop(void);
00188 
00189 private:
00190     INT32 StackType;
00191     CMXImportFilter *pTheFilter;
00192 };
00193 
00194 // transform class
00195 class CMXImportTransform : public CMXImportStackableItem
00196 {
00197     CC_DECLARE_DYNAMIC(CMXImportTransform);
00198 
00199 public:
00200     CMXImportTransform(Matrix *pTheMatrix, BOOL Concat) {TheMatrix = *pTheMatrix; Concatenate = Concat;};
00201 
00202     INT32 GetStackType(void) {return cmxiSTACKTYPE_TRANSFORM;};
00203 
00204     BOOL PlacedOnStack(CMXImportStack *pStack);
00205     BOOL Activate(CMXImportStack *pStack);
00206     BOOL Deactivate(CMXImportStack *pStack, BOOL IsLastItemOnStack);
00207 
00208 private:
00209     Matrix TheMatrix;           // matrix found in the file
00210     Matrix CompoundMatrix;      // matrix made from all the previous ones and the base matrix
00211     BOOL Concatenate;           // whether this matrix is concatonated to previous ones, or just replaces them
00212 };
00213 
00214 // transform class
00215 class CMXImportClipper : public CMXImportStackableItem
00216 {
00217     CC_DECLARE_DYNAMIC(CMXImportClipper);
00218 
00219 public:
00220     CMXImportClipper(Path *ptClipPath, BOOL tIntersect) {pClipPath = ptClipPath; Intersect = tIntersect;};
00221 
00222     INT32 GetStackType(void) {return cmxiSTACKTYPE_CLIPPER;};
00223 
00224     BOOL PlacedOnStack(CMXImportStack *pStack);
00225     BOOL Activate(CMXImportStack *pStack);
00226     BOOL Deactivate(CMXImportStack *pStack, BOOL IsLastItemOnStack);
00227 
00228 private:
00229     Path *pClipPath;
00230     BOOL Intersect;             // whether this path is intersected with the previous one
00231 };
00232 
00233 // colour class
00234 class CMXImportColour : public SimpleCCObject
00235 {
00236 public:
00237     CMXImportColour() {Used = FALSE; pIndexedColour = NULL; pColour = NULL;};
00238     ~CMXImportColour() {delete pColour; if(!Used) delete pIndexedColour;};
00239 
00240     DocColour *GetColour(void) {Used = TRUE; return pColour;};
00241     BOOL IsUsed(void) {return Used;};
00242     IndexedColour *GetIndexedColour(void) {return pIndexedColour;};
00243 
00244     // if I use the proper type, none of the files which include this
00245     // one will compile, and try as I may, I can't get it to work.
00246     // I don't think this is me being silly, but I've given up on this
00247     // one and lost the lovely type checking. Shouldn't be too much of 
00248     // a problem as these functions are only called in one place.
00249     BOOL Convert(/*cmxiColour*/ void *pCol);
00250 
00251 private:
00252     BOOL Used;
00253     IndexedColour *pIndexedColour;
00254     DocColour *pColour;
00255 };
00256 
00257 // dot dash pattern class
00258 class CMXImportDotDash : public SimpleCCObject
00259 {
00260 public:
00261     CMXImportDotDash() {pElements = NULL;};
00262     ~CMXImportDotDash() {if(pElements != NULL) delete [] pElements;};
00263 
00264     // see above reason why this is not properly typed
00265     BOOL Convert(/*cmxiDotDash*/ void *pDotDash);
00266 
00267     INT32 NDots;
00268     DashElement *pElements;
00269 };
00270 
00271 // arrowhead shape class
00272 class CMXImportArrowShape : public SimpleCCObject
00273 {
00274 public:
00275     // see above reason why this is not properly typed
00276     BOOL Convert(/*cmxiArrowShape*/ void *pArrowShape, BOOL Is32Bit);
00277 
00278     ArrowRec Arrow;
00279     INT32 LineOffset;
00280 };
00281 
00282 // arrowheads class
00283 class CMXImportArrowheads : public SimpleCCObject
00284 {
00285 public:
00286     CMXImportArrowheads() {pStart = NULL; pEnd = NULL;};
00287 
00288     // see above reason why this is not properly typed
00289     BOOL Convert(/*cmxiArrowheads*/ void *pArrowheads, CMXImportFilterDataSet *Data);
00290 
00291     CMXImportArrowShape *pStart;
00292     CMXImportArrowShape *pEnd;
00293 };
00294 
00295 // outline class
00296 class CMXImportOutline : public SimpleCCObject
00297 {
00298 public:
00299     CMXImportOutline() {pDots = NULL; pArrowheads = NULL;};
00300 
00301     // see above reason why this is not properly typed
00302     BOOL Convert(/*cmxiOutline*/ void *pOut, CMXImportFilterDataSet *Data);
00303 
00304     INT32 ColourReference;
00305     INT32 Width;
00306     JointType Join;
00307     LineCapType Cap;
00308     CMXImportDotDash *pDots;
00309     CMXImportArrowheads *pArrowheads;
00310     BOOL NoStroke;
00311 };
00312 
00313 // pen class
00314 class CMXImportPen : public SimpleCCObject
00315 {
00316 public:
00317     // see above reason why this is not properly typed
00318     BOOL Convert(/*cmxiPen*/ void *pPen);
00319 
00320     INT32 Width;
00321 };
00322 
00323 class CMXImportFont : public SimpleCCObject
00324 {
00325 public:
00326     BOOL Convert(/*cmxiFont*/ void *pFont);
00327     StringBase* mFont;
00328     BOOL mIsItalic;
00329     BOOL mIsBold;
00330 };
00331 
00332 
00333 // line style class
00334 class CMXImportLineStyle : public SimpleCCObject
00335 {
00336 public:
00337     // see above reason why this is not properly typed
00338     BOOL Convert(/*cmxiLineStyle*/ void *pStyle);
00339 
00340     JointType Join;
00341     LineCapType Cap;
00342     BOOL DotDash;
00343     BOOL NoStroke;
00344 };
00345 
00346 // colour list class
00347 class CMXImportColourList : public List
00348 {
00349     CC_DECLARE_DYNAMIC(CMXImportColourList);
00350 
00351 public:
00352     CMXImportColourList() {};
00353     ~CMXImportColourList() {DeleteAll();};
00354 
00355     BOOL AddColour(INT32 Reference, INT32 Position);
00356     INT32 GetColourRefClosestToPosition(INT32 Position);
00357 };
00358 
00359 // colour list item class
00360 class CMXImportColourListItem : public ListItem
00361 {
00362     CC_DECLARE_DYNAMIC(CMXImportColourListItem);
00363 
00364 public:
00365     INT32 Reference;
00366     INT32 Position;
00367 };
00368 
00369 class CMXImportProcedure : public SimpleCCObject
00370 {
00371 public:
00372     CMXImportProcedure() {Position = 0;};
00373     
00374     BOOL Read(/*cmxiProcedureIndexEntry*/ void *pEn);
00375 
00376     INT32 Position;
00377 };
00378 
00379 
00380 #endif // CMXIBITS_H
00381 

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