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