nss: upgrade to release 3.73
[LibreOffice.git] / filter / source / graphicfilter / idxf / dxfentrd.hxx
blob35b05bdbf4dc22be3229609d9d226e5bd7c866cc
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 #ifndef INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IDXF_DXFENTRD_HXX
21 #define INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IDXF_DXFENTRD_HXX
23 #include "dxfgrprd.hxx"
24 #include "dxfvec.hxx"
25 #include <tools/long.hxx>
27 #include <memory>
28 #include <vector>
30 enum DXFEntityType {
31 DXF_LINE,
32 DXF_POINT,
33 DXF_CIRCLE,
34 DXF_ARC,
35 DXF_TRACE,
36 DXF_SOLID,
37 DXF_TEXT,
38 DXF_SHAPE,
39 DXF_INSERT,
40 DXF_ATTDEF,
41 DXF_ATTRIB,
42 DXF_POLYLINE,
43 DXF_VERTEX,
44 DXF_SEQEND,
45 DXF_3DFACE,
46 DXF_DIMENSION,
47 DXF_LWPOLYLINE,
48 DXF_HATCH
51 // base class of an entity
53 class DXFBasicEntity {
55 public:
57 DXFBasicEntity * pSucc;
58 // pointer to next entity (in the list of DXFEntities.pFirst)
60 DXFEntityType eType;
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
72 protected:
74 DXFBasicEntity(DXFEntityType eThisType);
75 // always initialize the constructors of entities with default values
77 public:
79 virtual ~DXFBasicEntity();
80 void Read(DXFGroupReader & rDGR);
81 // Reads a parameter till the next 0-group
83 protected:
85 virtual void EvaluateGroup(DXFGroupReader & rDGR);
86 // This method will be called by Read() for every parameter (respectively
87 // for every group).
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 {
98 public:
100 DXFVector aP0; // 10,20,30
101 DXFVector aP1; // 11,21,31
103 DXFLineEntity();
105 protected:
107 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
110 class DXFPointEntity : public DXFBasicEntity {
112 public:
114 DXFVector aP0; // 10,20,30
116 DXFPointEntity();
118 protected:
120 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
123 class DXFCircleEntity : public DXFBasicEntity {
125 public:
127 DXFVector aP0; // 10,20,30
128 double fRadius; // 40
130 DXFCircleEntity();
132 protected:
134 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
137 class DXFArcEntity : public DXFBasicEntity {
139 public:
141 DXFVector aP0; // 10,20,30
142 double fRadius; // 40
143 double fStart; // 50
144 double fEnd; // 51
146 DXFArcEntity();
148 protected:
150 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
153 class DXFTraceEntity : public DXFBasicEntity {
155 public:
157 DXFVector aP0; // 10,20,30
158 DXFVector aP1; // 11,21,31
159 DXFVector aP2; // 12,22,32
160 DXFVector aP3; // 13,23,33
162 DXFTraceEntity();
164 protected:
166 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
169 class DXFSolidEntity : public DXFBasicEntity {
171 public:
173 DXFVector aP0; // 10,20,30
174 DXFVector aP1; // 11,21,31
175 DXFVector aP2; // 12,22,32
176 DXFVector aP3; // 13,23,33
178 DXFSolidEntity();
180 protected:
182 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
185 class DXFTextEntity : public DXFBasicEntity {
187 public:
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
201 DXFTextEntity();
203 protected:
205 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
208 class DXFShapeEntity : public DXFBasicEntity {
210 DXFVector aP0; // 10,20,30
211 double fSize; // 40
212 OString m_sName; // 2
213 double fRotAngle; // 50
214 double fXScale; // 41
215 double fOblAngle; // 51
217 public:
219 DXFShapeEntity();
221 protected:
223 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
226 class DXFInsertEntity : public DXFBasicEntity {
228 public:
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
242 DXFInsertEntity();
244 protected:
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
267 public:
269 DXFAttDefEntity();
271 protected:
273 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
276 class DXFAttribEntity : public DXFBasicEntity {
278 public:
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
295 DXFAttribEntity();
297 protected:
299 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
302 class DXFPolyLineEntity : public DXFBasicEntity {
304 public:
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
315 DXFPolyLineEntity();
317 protected:
319 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
322 class DXFLWPolyLineEntity : public DXFBasicEntity
324 sal_Int32 nIndex;
325 sal_Int32 nCount; // 90
327 public:
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();
338 protected:
340 virtual void EvaluateGroup( DXFGroupReader & rDGR ) override;
344 struct DXFEdgeType
346 sal_Int32 nEdgeType;
348 virtual ~DXFEdgeType(){};
349 virtual bool EvaluateGroup( DXFGroupReader & /*rDGR*/ ){ return true; };
351 protected:
353 DXFEdgeType( sal_Int32 EdgeType ):nEdgeType(EdgeType){};
356 struct DXFEdgeTypeLine : public DXFEdgeType
358 DXFVector aStartPoint; // 10,20
359 DXFVector aEndPoint; // 11,21
360 DXFEdgeTypeLine();
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
396 DXFEdgeTypeSpline();
397 virtual bool EvaluateGroup( DXFGroupReader & rDGR ) override;
400 struct DXFBoundaryPathData
402 private:
403 sal_Int32 nPointCount; // 93
404 public:
405 sal_Int32 nFlags; // 92
406 sal_Int32 nHasBulgeFlag; // 72
407 sal_Int32 nIsClosedFlag; // 73
408 double fBulge; // 42
409 sal_Int32 nSourceBoundaryObjects; // 97
410 sal_Int32 nEdgeCount; // 93
412 bool bIsPolyLine;
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;
429 public:
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;
445 DXFHatchEntity();
447 protected:
449 virtual void EvaluateGroup( DXFGroupReader & rDGR ) override;
452 class DXFVertexEntity : public DXFBasicEntity {
454 public:
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)
459 double fBulge; // 42
460 tools::Long nFlags; // 70
461 double fCFTDir; // 50
463 DXFVertexEntity();
465 protected:
467 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
470 class DXFSeqEndEntity : public DXFBasicEntity {
472 public:
474 DXFSeqEndEntity();
477 class DXF3DFaceEntity : public DXFBasicEntity {
479 public:
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
487 DXF3DFaceEntity();
489 protected:
491 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
494 class DXFDimensionEntity : public DXFBasicEntity {
496 public:
498 OString m_sPseudoBlock; // 2
500 DXFDimensionEntity();
502 protected:
504 virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
508 // read and represent the set of entities
509 class DXFEntities {
511 public:
513 DXFEntities()
514 : pFirst(nullptr)
515 , mbBeingDrawn(false)
519 ~DXFEntities()
521 Clear();
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)
532 void Clear();
533 // deletes all entities
536 #endif
539 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */