00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 #ifndef CMXIFLTR_H
00101 #define CMXIFLTR_H
00102
00103
00104
00105
00106
00107
00108 #include "cmxistut.h"
00109
00110 class CMXImportFilterDataSet;
00111 class CMXImportColourList;
00112 class CMXImportRImage;
00113 class CMXImportBitmap;
00114 class Progress;
00115 class SelOperation;
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127 class CMXImportFilter : public VectorFilter
00128 {
00129 CC_DECLARE_DYNAMIC(CMXImportFilter);
00130 friend class CMXImportRImage;
00131 friend class CMXImportBitmap;
00132
00133 public:
00134 CMXImportFilter();
00135 BOOL Init();
00136
00137 INT32 HowCompatible(PathName& Filename,
00138 ADDR HeaderStart,
00139 UINT32 HeaderSize,
00140 UINT32 FileSize);
00141
00142 BOOL DoImport(SelOperation*, CCLexFile*, Document*,
00143 BOOL AutoChosen = FALSE, ImportPosition *Pos = NULL,
00144 KernelBitmap** ppImportedBitmap = NULL,
00145 DocCoord* pPosTranslate = NULL, String_256* = NULL);
00146
00147 BOOL DoExport(Operation*, CCLexFile*, PathName*, Document*, BOOL) {return FALSE;};
00148
00149 virtual BOOL IsDefaultDocRequired(const TCHAR* pcszPathName) {return TRUE;};
00150
00151
00152
00153 static BOOL SkipToPreviewBitmap(CCLexFile * pFile);
00154
00155 protected:
00156
00157 BOOL ReadData(void *Out, char *Instructions);
00158 BOOL ReadPointList(Path **ppPath);
00159 CMXImportColourList *ReadColourList(void);
00160 BOOL LocateRootLevelRIFFSection(DWORD Section);
00161 void Seek(INT32 to) {pFile->seekIn(to + StartPosition);};
00162 INT32 Tell(void) {return pFile->tellIn() - StartPosition;};
00163 BOOL GotoSectionFromIndex(INT32 MasterIndexEntry, DWORD PredictedRIFFType, BOOL NonExistanceIsFormatError, BOOL *Found = NULL, INT32 *Size = NULL);
00164
00165
00166 BOOL Stage1_ReadHeader(Spread *pSpread);
00167 BOOL Stage2_ReadMasterIndex(void);
00168 BOOL Stage3_ConvertDescriptionSections(void);
00169 BOOL Stage4_ConvertPage(void);
00170 BOOL Stage5_PlaceObjectsInTree(Spread *pSpread, SelOperation *pOp, ImportPosition *pPos);
00171 BOOL ProcessCommand(INT32 *ProgressThingy = NULL);
00172
00173
00174 BOOL Process_BeginPage(void);
00175 BOOL Process_EndPage(void);
00176 BOOL Process_BeginLayer(void);
00177 BOOL Process_EndLayer(void);
00178 BOOL Process_BeginGroup(void);
00179 BOOL Process_EndGroup(void);
00180 BOOL Process_EndSection(void);
00181 BOOL Process_PolyCurve(void);
00182 BOOL Process_PolyCurveContainer(cmxiPolyCurve &pc);
00183 BOOL Process_Rectangle ( void );
00184 BOOL Process_AddGlobalTransform(void);
00185 BOOL Process_SetGlobalTransform(void);
00186 BOOL Process_RestoreLastGlobalTransform(void);
00187 BOOL Process_DrawImage(void);
00188 BOOL Process_DrawImage_Cropped(cmxiDrawImage &db);
00189 BOOL Process_AddClippingRegion(void);
00190 BOOL Process_RemoveLastClippingRegion(void);
00191 BOOL Process_ClearClipping(void);
00192 BOOL Process_BeginTextStream(void);
00193 BOOL Process_TextFrame(void);
00194 BOOL Process_Characters(void);
00195 BOOL Process_CharInfo(void);
00196 BOOL Process_BeginParagraph(void);
00197 BOOL Process_EndParagraph(void);
00198 BOOL Process_EndTextStream(void);
00199
00200
00201
00202 BOOL TransformNode(Node *pNode);
00203 BOOL SetAttributesForNode(Node *pNode, void *pAttr, BOOL DeleteStuff = TRUE);
00204 BOOL ClipNode(Node **pNode);
00205 BOOL ApplyAttributesToNode(Node *pNode);
00206
00207
00208 BOOL SetNoFill(Node *pNode);
00209 BOOL SetNoStroke(Node *pNode);
00210 BOOL SetAttributesFountain(Node *pNode, cmxiFillSpec *Fill);
00211 BOOL SetAttributesLinearGrad(Node *pNode, cmxiFillSpec *GFill, DocRect &BBox, DocColour *StartColour, DocColour *EndColour);
00212 BOOL SetAttributesConicalGrad(Node *pNode, cmxiFillSpec *GFill, DocRect &BBox, DocColour *StartColour, DocColour *EndColour);
00213 BOOL SetAttributesRadialGrad(Node *pNode, cmxiFillSpec *GFill, DocRect &BBox, DocColour *StartColour, DocColour *EndColour, BOOL IsSquare = FALSE);
00214 BOOL SetAttributesBitmapFill(Node *pNode, INT32 VectorReference, cmxiTiling *Tile);
00215 BOOL SetAttributesTwoColourBitmapFill(Node *pNode, cmxiFillSpec *Fill);
00216 BOOL GetCorelBBox(NodeRenderableBounded *pNode, DocRect *BBox);
00217 BOOL GetTilingPoints(DocRect *BBox, cmxiTiling *Tile, DocCoord *StartPoint, DocCoord *EndPoint, DocCoord *EndPoint2);
00218 void SetNonTextAttributeIgnore();
00219 void SetNonTextAttributeNotIgnore();
00220 void SetTextAttributeIgnore();
00221 void SetTextAttributeNotIgnore();
00222
00223
00224
00225 void CleanUpAfterImport(void);
00226
00227
00228 void AttributeApproximated(void);
00229 void ClippingApproximated(void);
00230 void ObjectApproximated(void);
00231
00232
00233 BOOL ConvertColours(void);
00234 DocColour *GetColourFromReference(INT32 Ref);
00235 BOOL AddColoursToDocument(void);
00236 BOOL ConvertPens(void);
00237 BOOL ConvertOutlines(void);
00238 BOOL ConvertLineStyles(void);
00239 BOOL ConvertDotDashes(void);
00240 BOOL ConvertArrowShapes(void);
00241 BOOL ConvertArrowheads(void);
00242 BOOL ReadEmbeddedFileIndex(void);
00243 BOOL ReadProcedureIndex(void);
00244 BOOL ReadBitmapIndex(void);
00245 BOOL ConvertFonts(void);
00246 BOOL ReadFontIndex(void);
00247
00248
00249 public:
00250 Matrix *GetBaseMatrix(void);
00251 Matrix *GetCurrentMatrix(void);
00252 void SetMatrix(Matrix *pNewMatrix);
00253 void SetClippingPath(Path *pClipper = NULL);
00254
00255 private:
00256 CCLexFile *pFile;
00257 BOOL Is32Bit;
00258 BOOL CorelDraw7;
00259 INT32 StartPosition;
00260
00261
00262 CMXImportFilterDataSet *Data;
00263
00264 #ifdef _DEBUG
00265 public:
00266 static void FormatErrorBreakingFunction(void);
00267 #endif // _DEBUG
00268 };
00269
00270
00271 #ifdef _DEBUG
00272 #define CMXFORMATERROR(ret) {Error::SetError(IDT_CMXFILTER_CMXERROR, 0); \
00273 CMXImportFilter::FormatErrorBreakingFunction(); return ret;}
00274 #else
00275 #define CMXFORMATERROR(ret) {Error::SetError(IDT_CMXFILTER_CMXERROR, 0); return ret;}
00276 #endif
00277
00278
00279
00280 #endif // CMXIFLTR_H