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 .
20 #ifndef INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IDXF_DXFENTRD_HXX
21 #define INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IDXF_DXFENTRD_HXX
23 #include "dxfgrprd.hxx"
25 #include <tools/long.hxx>
51 // base class of an entity
53 class DXFBasicEntity
{
57 DXFBasicEntity
* pSucc
;
58 // pointer to next entity (in the list of DXFEntities.pFirst)
61 // entity kind (line or circle or what)
63 // properties that all entities have, each
64 // commented with group codes:
65 OString m_sLayer
; // 8
66 OString m_sLineType
; // 6
67 double fThickness
; // 39
68 tools::Long nColor
; // 62
69 tools::Long nSpace
; // 67
70 DXFVector aExtrusion
; // 210,220,230
74 DXFBasicEntity(DXFEntityType eThisType
);
75 // always initialize the constructors of entities with default values
79 virtual ~DXFBasicEntity();
80 void Read(DXFGroupReader
& rDGR
);
81 // Reads a parameter till the next 0-group
85 virtual void EvaluateGroup(DXFGroupReader
& rDGR
);
86 // This method will be called by Read() for every parameter (respectively
88 // As far as the group code of the entity is known, the corresponding
89 // parameter is fetched.
94 // the different kinds of entities
96 class DXFLineEntity
: public DXFBasicEntity
{
100 DXFVector aP0
; // 10,20,30
101 DXFVector aP1
; // 11,21,31
107 virtual void EvaluateGroup(DXFGroupReader
& rDGR
) override
;
110 class DXFPointEntity
: public DXFBasicEntity
{
114 DXFVector aP0
; // 10,20,30
120 virtual void EvaluateGroup(DXFGroupReader
& rDGR
) override
;
123 class DXFCircleEntity
: public DXFBasicEntity
{
127 DXFVector aP0
; // 10,20,30
128 double fRadius
; // 40
134 virtual void EvaluateGroup(DXFGroupReader
& rDGR
) override
;
137 class DXFArcEntity
: public DXFBasicEntity
{
141 DXFVector aP0
; // 10,20,30
142 double fRadius
; // 40
150 virtual void EvaluateGroup(DXFGroupReader
& rDGR
) override
;
153 class DXFTraceEntity
: public DXFBasicEntity
{
157 DXFVector aP0
; // 10,20,30
158 DXFVector aP1
; // 11,21,31
159 DXFVector aP2
; // 12,22,32
160 DXFVector aP3
; // 13,23,33
166 virtual void EvaluateGroup(DXFGroupReader
& rDGR
) override
;
169 class DXFSolidEntity
: public DXFBasicEntity
{
173 DXFVector aP0
; // 10,20,30
174 DXFVector aP1
; // 11,21,31
175 DXFVector aP2
; // 12,22,32
176 DXFVector aP3
; // 13,23,33
182 virtual void EvaluateGroup(DXFGroupReader
& rDGR
) override
;
185 class DXFTextEntity
: public DXFBasicEntity
{
189 DXFVector aP0
; // 10,20,30
190 double fHeight
; // 40
191 OString m_sText
; // 1
192 double fRotAngle
; // 50
193 double fXScale
; // 41
194 double fOblAngle
; // 42
195 OString m_sStyle
; // 7
196 tools::Long nGenFlags
; // 71
197 tools::Long nHorzJust
; // 72
198 tools::Long nVertJust
; // 73
199 DXFVector aAlign
; // 11,21,31
205 virtual void EvaluateGroup(DXFGroupReader
& rDGR
) override
;
208 class DXFShapeEntity
: public DXFBasicEntity
{
210 DXFVector aP0
; // 10,20,30
212 OString m_sName
; // 2
213 double fRotAngle
; // 50
214 double fXScale
; // 41
215 double fOblAngle
; // 51
223 virtual void EvaluateGroup(DXFGroupReader
& rDGR
) override
;
226 class DXFInsertEntity
: public DXFBasicEntity
{
230 tools::Long nAttrFlag
; // 66
231 OString m_sName
; // 2
232 DXFVector aP0
; // 10,20,30
233 double fXScale
; // 41
234 double fYScale
; // 42
235 double fZScale
; // 43
236 double fRotAngle
; // 50
237 tools::Long nColCount
; // 70
238 tools::Long nRowCount
; // 71
239 double fColSpace
; // 44
240 double fRowSpace
; // 45
246 virtual void EvaluateGroup(DXFGroupReader
& rDGR
) override
;
249 class DXFAttDefEntity
: public DXFBasicEntity
{
251 DXFVector aP0
; // 10,20,30
252 double fHeight
; // 40
253 OString m_sDefVal
; // 1
254 OString m_sPrompt
; // 3
255 OString m_sTagStr
; // 2
256 tools::Long nAttrFlags
; // 70
257 tools::Long nFieldLen
; // 73
258 double fRotAngle
; // 50
259 double fXScale
; // 41
260 double fOblAngle
; // 51
261 OString m_sStyle
; // 7
262 tools::Long nGenFlags
; // 71
263 tools::Long nHorzJust
; // 72
264 tools::Long nVertJust
; // 74
265 DXFVector aAlign
; // 11,21,31
273 virtual void EvaluateGroup(DXFGroupReader
& rDGR
) override
;
276 class DXFAttribEntity
: public DXFBasicEntity
{
280 DXFVector aP0
; // 10,20,30
281 double fHeight
; // 40
282 OString m_sText
; // 1
283 OString m_sTagStr
; // 2
284 tools::Long nAttrFlags
; // 70
285 tools::Long nFieldLen
; // 73
286 double fRotAngle
; // 50
287 double fXScale
; // 41
288 double fOblAngle
; // 51
289 OString m_sStyle
; // 7
290 tools::Long nGenFlags
; // 71
291 tools::Long nHorzJust
; // 72
292 tools::Long nVertJust
; // 74
293 DXFVector aAlign
; // 11,21,31
299 virtual void EvaluateGroup(DXFGroupReader
& rDGR
) override
;
302 class DXFPolyLineEntity
: public DXFBasicEntity
{
306 tools::Long nFlags
; // 70
307 double fSWidth
; // 40
308 double fEWidth
; // 41
309 tools::Long nMeshMCount
; // 71
310 tools::Long nMeshNCount
; // 72
311 tools::Long nMDensity
; // 73
312 tools::Long nNDensity
; // 74
313 tools::Long nCSSType
; // 75
319 virtual void EvaluateGroup(DXFGroupReader
& rDGR
) override
;
322 class DXFLWPolyLineEntity
: public DXFBasicEntity
325 sal_Int32 nCount
; // 90
329 sal_Int32 nFlags
; // 70 1 = closed, 128 = plinegen
330 double fConstantWidth
; // 43 (optional - default: 0, not used if fStartWidth and/or fEndWidth is used)
331 double fStartWidth
; // 40
332 double fEndWidth
; // 41
334 std::vector
<DXFVector
> aP
;
336 DXFLWPolyLineEntity();
340 virtual void EvaluateGroup( DXFGroupReader
& rDGR
) override
;
348 virtual ~DXFEdgeType(){};
349 virtual bool EvaluateGroup( DXFGroupReader
& /*rDGR*/ ){ return true; };
353 DXFEdgeType( sal_Int32 EdgeType
):nEdgeType(EdgeType
){};
356 struct DXFEdgeTypeLine
: public DXFEdgeType
358 DXFVector aStartPoint
; // 10,20
359 DXFVector aEndPoint
; // 11,21
361 virtual bool EvaluateGroup( DXFGroupReader
& rDGR
) override
;
364 struct DXFEdgeTypeCircularArc
: public DXFEdgeType
366 DXFVector aCenter
; // 10,20
367 double fRadius
; // 40
368 double fStartAngle
; // 50
369 double fEndAngle
; // 51
370 sal_Int32 nIsCounterClockwiseFlag
; // 73
371 DXFEdgeTypeCircularArc();
372 virtual bool EvaluateGroup( DXFGroupReader
& rDGR
) override
;
375 struct DXFEdgeTypeEllipticalArc
: public DXFEdgeType
377 DXFVector aCenter
; // 10,20
378 DXFVector aEndPoint
; // 11,21
379 double fLength
; // 40
380 double fStartAngle
; // 50
381 double fEndAngle
; // 51
382 sal_Int32 nIsCounterClockwiseFlag
; // 73
384 DXFEdgeTypeEllipticalArc();
385 virtual bool EvaluateGroup( DXFGroupReader
& rDGR
) override
;
388 struct DXFEdgeTypeSpline
: public DXFEdgeType
390 sal_Int32 nDegree
; // 94
391 sal_Int32 nRational
; // 73
392 sal_Int32 nPeriodic
; // 74
393 sal_Int32 nKnotCount
; // 75
394 sal_Int32 nControlCount
; // 76
397 virtual bool EvaluateGroup( DXFGroupReader
& rDGR
) override
;
400 struct DXFBoundaryPathData
403 sal_Int32 nPointCount
; // 93
405 sal_Int32 nFlags
; // 92
406 sal_Int32 nHasBulgeFlag
; // 72
407 sal_Int32 nIsClosedFlag
; // 73
409 sal_Int32 nSourceBoundaryObjects
; // 97
410 sal_Int32 nEdgeCount
; // 93
413 sal_Int32 nPointIndex
;
415 std::vector
<DXFVector
> aP
;
416 std::vector
<std::unique_ptr
<DXFEdgeType
>> aEdges
;
418 DXFBoundaryPathData();
419 ~DXFBoundaryPathData();
421 bool EvaluateGroup( DXFGroupReader
& rDGR
);
424 class DXFHatchEntity
: public DXFBasicEntity
426 bool bIsInBoundaryPathContext
;
427 sal_Int32 nCurrentBoundaryPathIndex
;
431 sal_Int32 nFlags
; // 70 (solid fill = 1, pattern fill = 0)
432 sal_Int32 nAssociativityFlag
; // 71 (associative = 1, non-associative = 0)
433 sal_Int32 nBoundaryPathCount
; // 91
434 sal_Int32 nHatchStyle
; // 75 (odd parity = 0, outmost area = 1, entire area = 2 )
435 sal_Int32 nHatchPatternType
; // 76 (user defined = 0, predefined = 1, custom = 2)
436 double fHatchPatternAngle
; // 52 (pattern fill only)
437 double fHatchPatternScale
; // 41 (pattern fill only:scale or spacing)
438 sal_Int32 nHatchDoubleFlag
; // 77 (pattern fill only:double = 1, not double = 0)
439 sal_Int32 nHatchPatternDefinitionLines
; // 78
440 double fPixelSize
; // 47
441 sal_Int32 nNumberOfSeedPoints
; // 98
443 std::unique_ptr
<DXFBoundaryPathData
[]> pBoundaryPathData
;
449 virtual void EvaluateGroup( DXFGroupReader
& rDGR
) override
;
452 class DXFVertexEntity
: public DXFBasicEntity
{
456 DXFVector aP0
; // 10,20,30
457 double fSWidth
; // 40 (if <0.0, then one has DXFPolyLine::fSWidth)
458 double fEWidth
; // 41 (if <0.0, then one has DXFPolyLine::fEWidth)
460 tools::Long nFlags
; // 70
461 double fCFTDir
; // 50
467 virtual void EvaluateGroup(DXFGroupReader
& rDGR
) override
;
470 class DXFSeqEndEntity
: public DXFBasicEntity
{
477 class DXF3DFaceEntity
: public DXFBasicEntity
{
481 DXFVector aP0
; // 10,20,30
482 DXFVector aP1
; // 11,21,31
483 DXFVector aP2
; // 12,22,32
484 DXFVector aP3
; // 13,23,33
485 tools::Long nIEFlags
; // 70
491 virtual void EvaluateGroup(DXFGroupReader
& rDGR
) override
;
494 class DXFDimensionEntity
: public DXFBasicEntity
{
498 OString m_sPseudoBlock
; // 2
500 DXFDimensionEntity();
504 virtual void EvaluateGroup(DXFGroupReader
& rDGR
) override
;
508 // read and represent the set of entities
515 , mbBeingDrawn(false)
524 DXFBasicEntity
* pFirst
; // list of entities, READ ONLY!
525 mutable bool mbBeingDrawn
; // guard for loop in entity parsing
527 void Read(DXFGroupReader
& rDGR
);
528 // read entities by rGDR of a DXF file until a
529 // ENDBLK, ENDSEC or EOF (of group 0).
530 // (all unknown thing will be skipped)
533 // deletes all entities
539 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */