1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <sal/config.h>
24 #include <string_view>
26 #include "dxfreprd.hxx"
27 #include <vcl/font.hxx>
28 #include <vcl/lineinfo.hxx>
29 #include <vcl/vclptr.hxx>
30 #include <vcl/virdev.hxx>
32 class DXF2GDIMetaFile
{
35 VclPtr
<VirtualDevice
> pVirDev
;
36 const DXFRepresentation
* pDXF
;
39 sal_uInt16 OptPointsPerCircle
;
41 sal_uInt16 nMinPercent
;
42 sal_uInt16 nMaxPercent
;
43 sal_uInt16 nLastPercent
;
44 sal_uInt16 nMainEntitiesCount
;
46 tools::Long nBlockColor
;
47 DXFLineInfo aBlockDXFLineInfo
;
48 tools::Long nParentLayerColor
;
49 DXFLineInfo aParentLayerDXFLineInfo
;
53 const LineInfo aDefaultLineInfo
; // to share between lines to reduce memory
55 static sal_uInt64
CountEntities(const DXFEntities
& rEntities
);
57 Color
ConvertColor(sal_uInt8 nColor
) const;
59 tools::Long
GetEntityColor(const DXFBasicEntity
& rE
) const;
61 DXFLineInfo
LTypeToDXFLineInfo(std::string_view rLineType
) const;
63 DXFLineInfo
GetEntityDXFLineInfo(const DXFBasicEntity
& rE
);
65 bool SetLineAttribute(const DXFBasicEntity
& rE
);
67 bool SetAreaAttribute(const DXFBasicEntity
& rE
);
69 bool SetFontAttribute(const DXFBasicEntity
& rE
, short nAngle
,
72 void DrawLineEntity(const DXFLineEntity
& rE
, const DXFTransform
& rTransform
);
74 void DrawPointEntity(const DXFPointEntity
& rE
, const DXFTransform
& rTransform
);
76 void DrawCircleEntity(const DXFCircleEntity
& rE
, const DXFTransform
& rTransform
);
78 void DrawArcEntity(const DXFArcEntity
& rE
, const DXFTransform
& rTransform
);
80 void DrawTraceEntity(const DXFTraceEntity
& rE
, const DXFTransform
& rTransform
);
82 void DrawSolidEntity(const DXFSolidEntity
& rE
, const DXFTransform
& rTransform
);
84 void DrawTextEntity(const DXFTextEntity
& rE
, const DXFTransform
& rTransform
);
86 void DrawInsertEntity(const DXFInsertEntity
& rE
, const DXFTransform
& rTransform
);
88 void DrawAttribEntity(const DXFAttribEntity
& rE
, const DXFTransform
& rTransform
);
90 void DrawPolyLineEntity(const DXFPolyLineEntity
& rE
, const DXFTransform
& rTransform
);
92 void Draw3DFaceEntity(const DXF3DFaceEntity
& rE
, const DXFTransform
& rTransform
);
94 void DrawDimensionEntity(const DXFDimensionEntity
& rE
, const DXFTransform
& rTransform
);
96 void DrawLWPolyLineEntity( const DXFLWPolyLineEntity
& rE
, const DXFTransform
& rTransform
);
98 void DrawHatchEntity( const DXFHatchEntity
& rE
, const DXFTransform
& rTransform
);
100 void DrawEntities(const DXFEntities
& rEntities
,
101 const DXFTransform
& rTransform
);
103 void DrawLine(const Point
& rA
, const Point
& rB
);
110 bool Convert( const DXFRepresentation
& rDXF
, GDIMetaFile
& rMTF
, sal_uInt16 nMinPercent
, sal_uInt16 nMaxPercent
);
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */