1*22e87013SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*22e87013SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*22e87013SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*22e87013SAndrew Rist * distributed with this work for additional information 6*22e87013SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*22e87013SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*22e87013SAndrew Rist * "License"); you may not use this file except in compliance 9*22e87013SAndrew Rist * with the License. You may obtain a copy of the License at 10*22e87013SAndrew Rist * 11*22e87013SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*22e87013SAndrew Rist * 13*22e87013SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*22e87013SAndrew Rist * software distributed under the License is distributed on an 15*22e87013SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*22e87013SAndrew Rist * KIND, either express or implied. See the License for the 17*22e87013SAndrew Rist * specific language governing permissions and limitations 18*22e87013SAndrew Rist * under the License. 19*22e87013SAndrew Rist * 20*22e87013SAndrew Rist *************************************************************/ 21*22e87013SAndrew Rist 22*22e87013SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _DXF2MTF_HXX 25cdf0e10cSrcweir #define _DXF2MTF_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "dxfreprd.hxx" 28cdf0e10cSrcweir #include <vcl/font.hxx> 29cdf0e10cSrcweir #include <vcl/lineinfo.hxx> 30cdf0e10cSrcweir 31cdf0e10cSrcweir // MT: NOOLDSV, someone should change the code... 32cdf0e10cSrcweir enum PenStyle { PEN_NULL, PEN_SOLID, PEN_DOT, PEN_DASH, PEN_DASHDOT }; 33cdf0e10cSrcweir enum BrushStyle { BRUSH_NULL, BRUSH_SOLID, BRUSH_HORZ, BRUSH_VERT, 34cdf0e10cSrcweir BRUSH_CROSS, BRUSH_DIAGCROSS, BRUSH_UPDIAG, BRUSH_DOWNDIAG, 35cdf0e10cSrcweir BRUSH_25, BRUSH_50, BRUSH_75, 36cdf0e10cSrcweir BRUSH_BITMAP }; 37cdf0e10cSrcweir 38cdf0e10cSrcweir 39cdf0e10cSrcweir class DXF2GDIMetaFile { 40cdf0e10cSrcweir private: 41cdf0e10cSrcweir 42cdf0e10cSrcweir VirtualDevice * pVirDev; 43cdf0e10cSrcweir const DXFRepresentation * pDXF; 44cdf0e10cSrcweir sal_Bool bStatus; 45cdf0e10cSrcweir 46cdf0e10cSrcweir sal_uInt16 OptPointsPerCircle; 47cdf0e10cSrcweir 48cdf0e10cSrcweir sal_uLong nMinPercent; 49cdf0e10cSrcweir sal_uLong nMaxPercent; 50cdf0e10cSrcweir sal_uLong nLastPercent; 51cdf0e10cSrcweir sal_uLong nMainEntitiesCount; 52cdf0e10cSrcweir 53cdf0e10cSrcweir long nBlockColor; 54cdf0e10cSrcweir DXFLineInfo aBlockDXFLineInfo; 55cdf0e10cSrcweir long nParentLayerColor; 56cdf0e10cSrcweir DXFLineInfo aParentLayerDXFLineInfo; 57cdf0e10cSrcweir Color aActLineColor; 58cdf0e10cSrcweir Color aActFillColor; 59cdf0e10cSrcweir Font aActFont; 60cdf0e10cSrcweir 61cdf0e10cSrcweir sal_uLong CountEntities(const DXFEntities & rEntities); 62cdf0e10cSrcweir 63cdf0e10cSrcweir void MayCallback(sal_uLong nMainEntitiesProcessed); 64cdf0e10cSrcweir 65cdf0e10cSrcweir Color ConvertColor(sal_uInt8 nColor); 66cdf0e10cSrcweir 67cdf0e10cSrcweir long GetEntityColor(const DXFBasicEntity & rE); 68cdf0e10cSrcweir 69cdf0e10cSrcweir DXFLineInfo LTypeToDXFLineInfo(const char * sLineType); 70cdf0e10cSrcweir 71cdf0e10cSrcweir DXFLineInfo GetEntityDXFLineInfo(const DXFBasicEntity & rE); 72cdf0e10cSrcweir 73cdf0e10cSrcweir sal_Bool SetLineAttribute(const DXFBasicEntity & rE, sal_uLong nWidth=0); 74cdf0e10cSrcweir 75cdf0e10cSrcweir sal_Bool SetAreaAttribute(const DXFBasicEntity & rE); 76cdf0e10cSrcweir 77cdf0e10cSrcweir sal_Bool SetFontAttribute(const DXFBasicEntity & rE, short nAngle, 78cdf0e10cSrcweir sal_uInt16 nHeight, double fWidthScale); 79cdf0e10cSrcweir 80cdf0e10cSrcweir void DrawLineEntity(const DXFLineEntity & rE, const DXFTransform & rTransform); 81cdf0e10cSrcweir 82cdf0e10cSrcweir void DrawPointEntity(const DXFPointEntity & rE, const DXFTransform & rTransform); 83cdf0e10cSrcweir 84cdf0e10cSrcweir void DrawCircleEntity(const DXFCircleEntity & rE, const DXFTransform & rTransform); 85cdf0e10cSrcweir 86cdf0e10cSrcweir void DrawArcEntity(const DXFArcEntity & rE, const DXFTransform & rTransform); 87cdf0e10cSrcweir 88cdf0e10cSrcweir void DrawTraceEntity(const DXFTraceEntity & rE, const DXFTransform & rTransform); 89cdf0e10cSrcweir 90cdf0e10cSrcweir void DrawSolidEntity(const DXFSolidEntity & rE, const DXFTransform & rTransform); 91cdf0e10cSrcweir 92cdf0e10cSrcweir void DrawTextEntity(const DXFTextEntity & rE, const DXFTransform & rTransform); 93cdf0e10cSrcweir 94cdf0e10cSrcweir void DrawInsertEntity(const DXFInsertEntity & rE, const DXFTransform & rTransform); 95cdf0e10cSrcweir 96cdf0e10cSrcweir void DrawAttribEntity(const DXFAttribEntity & rE, const DXFTransform & rTransform); 97cdf0e10cSrcweir 98cdf0e10cSrcweir void DrawPolyLineEntity(const DXFPolyLineEntity & rE, const DXFTransform & rTransform); 99cdf0e10cSrcweir 100cdf0e10cSrcweir void Draw3DFaceEntity(const DXF3DFaceEntity & rE, const DXFTransform & rTransform); 101cdf0e10cSrcweir 102cdf0e10cSrcweir void DrawDimensionEntity(const DXFDimensionEntity & rE, const DXFTransform & rTransform); 103cdf0e10cSrcweir 104cdf0e10cSrcweir void DrawLWPolyLineEntity( const DXFLWPolyLineEntity & rE, const DXFTransform & rTransform ); 105cdf0e10cSrcweir 106cdf0e10cSrcweir void DrawHatchEntity( const DXFHatchEntity & rE, const DXFTransform & rTransform ); 107cdf0e10cSrcweir 108cdf0e10cSrcweir void DrawEntities(const DXFEntities & rEntities, 109cdf0e10cSrcweir const DXFTransform & rTransform, 110cdf0e10cSrcweir sal_Bool bTopEntities); 111cdf0e10cSrcweir 112cdf0e10cSrcweir public: 113cdf0e10cSrcweir 114cdf0e10cSrcweir DXF2GDIMetaFile(); 115cdf0e10cSrcweir ~DXF2GDIMetaFile(); 116cdf0e10cSrcweir 117cdf0e10cSrcweir sal_Bool Convert( const DXFRepresentation & rDXF, GDIMetaFile & rMTF, sal_uInt16 nMinPercent, sal_uInt16 nMaxPercent); 118cdf0e10cSrcweir 119cdf0e10cSrcweir }; 120cdf0e10cSrcweir 121cdf0e10cSrcweir 122cdf0e10cSrcweir #endif 123cdf0e10cSrcweir 124cdf0e10cSrcweir 125