1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dxf2mtf.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include "dxfreprd.hxx"
35 #include <vcl/font.hxx>
36 #include <vcl/lineinfo.hxx>
38 // MT: NOOLDSV, someone should change the code...
39 enum PenStyle
{ PEN_NULL
, PEN_SOLID
, PEN_DOT
, PEN_DASH
, PEN_DASHDOT
};
40 enum BrushStyle
{ BRUSH_NULL
, BRUSH_SOLID
, BRUSH_HORZ
, BRUSH_VERT
,
41 BRUSH_CROSS
, BRUSH_DIAGCROSS
, BRUSH_UPDIAG
, BRUSH_DOWNDIAG
,
42 BRUSH_25
, BRUSH_50
, BRUSH_75
,
46 class DXF2GDIMetaFile
{
49 VirtualDevice
* pVirDev
;
50 const DXFRepresentation
* pDXF
;
53 USHORT OptPointsPerCircle
;
58 ULONG nMainEntitiesCount
;
61 DXFLineInfo aBlockDXFLineInfo
;
62 long nParentLayerColor
;
63 DXFLineInfo aParentLayerDXFLineInfo
;
68 ULONG
CountEntities(const DXFEntities
& rEntities
);
70 void MayCallback(ULONG nMainEntitiesProcessed
);
72 Color
ConvertColor(BYTE nColor
);
74 long GetEntityColor(const DXFBasicEntity
& rE
);
76 DXFLineInfo
LTypeToDXFLineInfo(const char * sLineType
);
78 DXFLineInfo
GetEntityDXFLineInfo(const DXFBasicEntity
& rE
);
80 BOOL
SetLineAttribute(const DXFBasicEntity
& rE
, ULONG nWidth
=0);
82 BOOL
SetAreaAttribute(const DXFBasicEntity
& rE
);
84 BOOL
SetFontAttribute(const DXFBasicEntity
& rE
, short nAngle
,
85 USHORT nHeight
, double fWidthScale
);
87 void DrawLineEntity(const DXFLineEntity
& rE
, const DXFTransform
& rTransform
);
89 void DrawPointEntity(const DXFPointEntity
& rE
, const DXFTransform
& rTransform
);
91 void DrawCircleEntity(const DXFCircleEntity
& rE
, const DXFTransform
& rTransform
);
93 void DrawArcEntity(const DXFArcEntity
& rE
, const DXFTransform
& rTransform
);
95 void DrawTraceEntity(const DXFTraceEntity
& rE
, const DXFTransform
& rTransform
);
97 void DrawSolidEntity(const DXFSolidEntity
& rE
, const DXFTransform
& rTransform
);
99 void DrawTextEntity(const DXFTextEntity
& rE
, const DXFTransform
& rTransform
);
101 void DrawInsertEntity(const DXFInsertEntity
& rE
, const DXFTransform
& rTransform
);
103 void DrawAttribEntity(const DXFAttribEntity
& rE
, const DXFTransform
& rTransform
);
105 void DrawPolyLineEntity(const DXFPolyLineEntity
& rE
, const DXFTransform
& rTransform
);
107 void Draw3DFaceEntity(const DXF3DFaceEntity
& rE
, const DXFTransform
& rTransform
);
109 void DrawDimensionEntity(const DXFDimensionEntity
& rE
, const DXFTransform
& rTransform
);
111 void DrawLWPolyLineEntity( const DXFLWPolyLineEntity
& rE
, const DXFTransform
& rTransform
);
113 void DrawHatchEntity( const DXFHatchEntity
& rE
, const DXFTransform
& rTransform
);
115 void DrawEntities(const DXFEntities
& rEntities
,
116 const DXFTransform
& rTransform
,
124 BOOL
Convert( const DXFRepresentation
& rDXF
, GDIMetaFile
& rMTF
, USHORT nMinPercent
, USHORT nMaxPercent
);