android: Update app-specific/MIME type icons
[LibreOffice.git] / vcl / source / filter / idxf / dxfentrd.hxx
blobc4cf22fac0f93d4d6f30e9a1ed7c4e4dfa7fb2f3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include "dxfgrprd.hxx"
23 #include "dxfvec.hxx"
24 #include <tools/long.hxx>
26 #include <memory>
27 #include <vector>
29 enum DXFEntityType {
30 DXF_LINE,
31 DXF_POINT,
32 DXF_CIRCLE,
33 DXF_ARC,
34 DXF_TRACE,
35 DXF_SOLID,
36 DXF_TEXT,
37 DXF_SHAPE,
38 DXF_INSERT,
39 DXF_ATTDEF,
40 DXF_ATTRIB,
41 DXF_POLYLINE,
42 DXF_VERTEX,
43 DXF_SEQEND,
44 DXF_3DFACE,
45 DXF_DIMENSION,
46 DXF_LWPOLYLINE,
47 DXF_HATCH
50 // base class of an entity
52 class DXFBasicEntity {
54 public:
56 DXFBasicEntity * pSucc;
57 // pointer to next entity (in the list of DXFEntities.pFirst)
59 DXFEntityType eType;
60 // entity kind (line or circle or what)
62 // properties that all entities have, each
63 // commented with group codes:
64 OString m_sLayer; // 8
65 OString m_sLineType; // 6
66 double fThickness; // 39
67 tools::Long nColor; // 62
68 tools::Long nSpace; // 67
69 DXFVector aExtrusion; // 210,220,230
71 protected:
73 DXFBasicEntity(DXFEntityType eThisType);
74 // always initialize the constructors of entities with default values
76 public:
78 virtual ~DXFBasicEntity();
79 void Read(DXFGroupReader & rDGR);
80 // Reads a parameter till the next 0-group
82 protected:
84 virtual void EvaluateGroup(DXFGroupReader & rDGR);
85 // This method will be called by Read() for every parameter (respectively
86 // for every group).
87 // As far as the group code of the entity is known, the corresponding
88 // parameter is fetched.
93 // the different kinds of entities
95 class DXFLineEntity : public DXFBasicEntity {
97 public:
99 DXFVector aP0; // 10,20,30
100 DXFVector aP1; // 11,21,31
102 DXFLineEntity();
104 protected:
106 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
109 class DXFPointEntity : public DXFBasicEntity {
111 public:
113 DXFVector aP0; // 10,20,30
115 DXFPointEntity();
117 protected:
119 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
122 class DXFCircleEntity : public DXFBasicEntity {
124 public:
126 DXFVector aP0; // 10,20,30
127 double fRadius; // 40
129 DXFCircleEntity();
131 protected:
133 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
136 class DXFArcEntity : public DXFBasicEntity {
138 public:
140 DXFVector aP0; // 10,20,30
141 double fRadius; // 40
142 double fStart; // 50
143 double fEnd; // 51
145 DXFArcEntity();
147 protected:
149 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
152 class DXFTraceEntity : public DXFBasicEntity {
154 public:
156 DXFVector aP0; // 10,20,30
157 DXFVector aP1; // 11,21,31
158 DXFVector aP2; // 12,22,32
159 DXFVector aP3; // 13,23,33
161 DXFTraceEntity();
163 protected:
165 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
168 class DXFSolidEntity : public DXFBasicEntity {
170 public:
172 DXFVector aP0; // 10,20,30
173 DXFVector aP1; // 11,21,31
174 DXFVector aP2; // 12,22,32
175 DXFVector aP3; // 13,23,33
177 DXFSolidEntity();
179 protected:
181 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
184 class DXFTextEntity : public DXFBasicEntity {
186 public:
188 DXFVector aP0; // 10,20,30
189 double fHeight; // 40
190 OString m_sText; // 1
191 double fRotAngle; // 50
192 double fXScale; // 41
193 double fOblAngle; // 42
194 OString m_sStyle; // 7
195 tools::Long nGenFlags; // 71
196 tools::Long nHorzJust; // 72
197 tools::Long nVertJust; // 73
198 DXFVector aAlign; // 11,21,31
200 DXFTextEntity();
202 protected:
204 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
207 class DXFShapeEntity : public DXFBasicEntity {
209 DXFVector aP0; // 10,20,30
210 double fSize; // 40
211 OString m_sName; // 2
212 double fRotAngle; // 50
213 double fXScale; // 41
214 double fOblAngle; // 51
216 public:
218 DXFShapeEntity();
220 protected:
222 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
225 class DXFInsertEntity : public DXFBasicEntity {
227 public:
229 tools::Long nAttrFlag; // 66
230 OString m_sName; // 2
231 DXFVector aP0; // 10,20,30
232 double fXScale; // 41
233 double fYScale; // 42
234 double fZScale; // 43
235 double fRotAngle; // 50
236 tools::Long nColCount; // 70
237 tools::Long nRowCount; // 71
238 double fColSpace; // 44
239 double fRowSpace; // 45
241 DXFInsertEntity();
243 protected:
245 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
248 class DXFAttDefEntity : public DXFBasicEntity {
250 DXFVector aP0; // 10,20,30
251 double fHeight; // 40
252 OString m_sDefVal; // 1
253 OString m_sPrompt; // 3
254 OString m_sTagStr; // 2
255 tools::Long nAttrFlags; // 70
256 tools::Long nFieldLen; // 73
257 double fRotAngle; // 50
258 double fXScale; // 41
259 double fOblAngle; // 51
260 OString m_sStyle; // 7
261 tools::Long nGenFlags; // 71
262 tools::Long nHorzJust; // 72
263 tools::Long nVertJust; // 74
264 DXFVector aAlign; // 11,21,31
266 public:
268 DXFAttDefEntity();
270 protected:
272 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
275 class DXFAttribEntity : public DXFBasicEntity {
277 public:
279 DXFVector aP0; // 10,20,30
280 double fHeight; // 40
281 OString m_sText; // 1
282 OString m_sTagStr; // 2
283 tools::Long nAttrFlags; // 70
284 tools::Long nFieldLen; // 73
285 double fRotAngle; // 50
286 double fXScale; // 41
287 double fOblAngle; // 51
288 OString m_sStyle; // 7
289 tools::Long nGenFlags; // 71
290 tools::Long nHorzJust; // 72
291 tools::Long nVertJust; // 74
292 DXFVector aAlign; // 11,21,31
294 DXFAttribEntity();
296 protected:
298 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
301 class DXFPolyLineEntity : public DXFBasicEntity {
303 public:
305 tools::Long nFlags; // 70
306 double fSWidth; // 40
307 double fEWidth; // 41
308 tools::Long nMeshMCount; // 71
309 tools::Long nMeshNCount; // 72
310 tools::Long nMDensity; // 73
311 tools::Long nNDensity; // 74
312 tools::Long nCSSType; // 75
314 DXFPolyLineEntity();
316 protected:
318 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
321 class DXFLWPolyLineEntity : public DXFBasicEntity
323 sal_Int32 nIndex;
324 sal_Int32 nCount; // 90
326 public:
328 sal_Int32 nFlags; // 70 1 = closed, 128 = plinegen
329 double fConstantWidth; // 43 (optional - default: 0, not used if fStartWidth and/or fEndWidth is used)
330 double fStartWidth; // 40
331 double fEndWidth; // 41
333 std::vector<DXFVector> aP;
335 DXFLWPolyLineEntity();
337 protected:
339 virtual void EvaluateGroup( DXFGroupReader & rDGR ) override;
343 struct DXFEdgeType
345 sal_Int32 nEdgeType;
347 virtual ~DXFEdgeType(){};
348 virtual bool EvaluateGroup( DXFGroupReader & /*rDGR*/ ){ return true; };
350 protected:
352 DXFEdgeType( sal_Int32 EdgeType ):nEdgeType(EdgeType){};
355 struct DXFEdgeTypeLine : public DXFEdgeType
357 DXFVector aStartPoint; // 10,20
358 DXFVector aEndPoint; // 11,21
359 DXFEdgeTypeLine();
360 virtual bool EvaluateGroup( DXFGroupReader & rDGR ) override;
363 struct DXFEdgeTypeCircularArc : public DXFEdgeType
365 DXFVector aCenter; // 10,20
366 double fRadius; // 40
367 double fStartAngle; // 50
368 double fEndAngle; // 51
369 sal_Int32 nIsCounterClockwiseFlag; // 73
370 DXFEdgeTypeCircularArc();
371 virtual bool EvaluateGroup( DXFGroupReader & rDGR ) override;
374 struct DXFEdgeTypeEllipticalArc : public DXFEdgeType
376 DXFVector aCenter; // 10,20
377 DXFVector aEndPoint; // 11,21
378 double fLength; // 40
379 double fStartAngle; // 50
380 double fEndAngle; // 51
381 sal_Int32 nIsCounterClockwiseFlag; // 73
383 DXFEdgeTypeEllipticalArc();
384 virtual bool EvaluateGroup( DXFGroupReader & rDGR ) override;
387 struct DXFEdgeTypeSpline : public DXFEdgeType
389 sal_Int32 nDegree; // 94
390 sal_Int32 nRational; // 73
391 sal_Int32 nPeriodic; // 74
392 sal_Int32 nKnotCount; // 75
393 sal_Int32 nControlCount; // 76
395 DXFEdgeTypeSpline();
396 virtual bool EvaluateGroup( DXFGroupReader & rDGR ) override;
399 struct DXFBoundaryPathData
401 private:
402 sal_Int32 nPointCount; // 93
403 public:
404 sal_Int32 nFlags; // 92
405 sal_Int32 nHasBulgeFlag; // 72
406 sal_Int32 nIsClosedFlag; // 73
407 double fBulge; // 42
408 sal_Int32 nSourceBoundaryObjects; // 97
409 sal_Int32 nEdgeCount; // 93
411 bool bIsPolyLine;
412 sal_Int32 nPointIndex;
414 std::vector<DXFVector> aP;
415 std::vector<std::unique_ptr<DXFEdgeType>> aEdges;
417 DXFBoundaryPathData();
419 bool EvaluateGroup( DXFGroupReader & rDGR );
422 class DXFHatchEntity : public DXFBasicEntity
424 bool bIsInBoundaryPathContext;
425 sal_Int32 nCurrentBoundaryPathIndex;
427 public:
429 sal_Int32 nFlags; // 70 (solid fill = 1, pattern fill = 0)
430 sal_Int32 nAssociativityFlag; // 71 (associative = 1, non-associative = 0)
431 sal_Int32 nMaxBoundaryPathCount; // 91
432 sal_Int32 nHatchStyle; // 75 (odd parity = 0, outmost area = 1, entire area = 2 )
433 sal_Int32 nHatchPatternType; // 76 (user defined = 0, predefined = 1, custom = 2)
434 double fHatchPatternAngle; // 52 (pattern fill only)
435 double fHatchPatternScale; // 41 (pattern fill only:scale or spacing)
436 sal_Int32 nHatchDoubleFlag; // 77 (pattern fill only:double = 1, not double = 0)
437 sal_Int32 nHatchPatternDefinitionLines; // 78
438 double fPixelSize; // 47
439 sal_Int32 nNumberOfSeedPoints; // 98
441 std::vector<DXFBoundaryPathData> aBoundaryPathData;
443 DXFHatchEntity();
445 protected:
447 virtual void EvaluateGroup( DXFGroupReader & rDGR ) override;
450 class DXFVertexEntity : public DXFBasicEntity {
452 public:
454 DXFVector aP0; // 10,20,30
455 double fSWidth; // 40 (if <0.0, then one has DXFPolyLine::fSWidth)
456 double fEWidth; // 41 (if <0.0, then one has DXFPolyLine::fEWidth)
457 double fBulge; // 42
458 tools::Long nFlags; // 70
459 double fCFTDir; // 50
461 DXFVertexEntity();
463 protected:
465 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
468 class DXFSeqEndEntity : public DXFBasicEntity {
470 public:
472 DXFSeqEndEntity();
475 class DXF3DFaceEntity : public DXFBasicEntity {
477 public:
479 DXFVector aP0; // 10,20,30
480 DXFVector aP1; // 11,21,31
481 DXFVector aP2; // 12,22,32
482 DXFVector aP3; // 13,23,33
483 tools::Long nIEFlags; // 70
485 DXF3DFaceEntity();
487 protected:
489 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
492 class DXFDimensionEntity : public DXFBasicEntity {
494 public:
496 OString m_sPseudoBlock; // 2
498 DXFDimensionEntity();
500 protected:
502 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
506 // read and represent the set of entities
507 class DXFEntities {
509 public:
511 DXFEntities()
512 : pFirst(nullptr)
513 , mbBeingDrawn(false)
517 ~DXFEntities()
519 Clear();
522 DXFBasicEntity * pFirst; // list of entities, READ ONLY!
523 mutable bool mbBeingDrawn; // guard for loop in entity parsing
525 void Read(DXFGroupReader & rDGR);
526 // read entities by rGDR of a DXF file until a
527 // ENDBLK, ENDSEC or EOF (of group 0).
528 // (all unknown thing will be skipped)
530 void Clear();
531 // deletes all entities
534 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */