merge the formfield patch from ooo-build
[ooovba.git] / goodies / source / filter.vcl / idxf / dxfentrd.hxx
blob021c1c487364e4366a9c7ba29746646967a54414
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dxfentrd.hxx,v $
10 * $Revision: 1.5 $
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 ************************************************************************/
31 #ifndef _DXFENTRD_HXX
32 #define _DXFENTRD_HXX
34 #include <dxfgrprd.hxx>
35 #include <dxfvec.hxx>
37 #include <deque>
39 typedef std::deque< Point > DXFPointArray;
41 //------------------------------------------------------------------------------
42 //------------------------- Art eines Entity -----------------------------------
43 //------------------------------------------------------------------------------
45 enum DXFEntityType {
46 DXF_LINE,
47 DXF_POINT,
48 DXF_CIRCLE,
49 DXF_ARC,
50 DXF_TRACE,
51 DXF_SOLID,
52 DXF_TEXT,
53 DXF_SHAPE,
54 DXF_INSERT,
55 DXF_ATTDEF,
56 DXF_ATTRIB,
57 DXF_POLYLINE,
58 DXF_VERTEX,
59 DXF_SEQEND,
60 DXF_3DFACE,
61 DXF_DIMENSION,
62 DXF_LWPOLYLINE,
63 DXF_HATCH
66 //------------------------------------------------------------------------------
67 //---------------------- Basisklasse fuer ein Entity ---------------------------
68 //------------------------------------------------------------------------------
70 class DXFBasicEntity {
72 public:
74 DXFBasicEntity * pSucc;
75 // Zeiger auf naechstes Entity (in der Liste DXFEntities.pFirst)
77 DXFEntityType eType;
78 // Art des Entitys (Linie oder Kreis oder was)
80 // Eigenschaftenm, die alle Entities besitzen, jeweils
81 // durch den Gruppencode kommentiert:
82 char sLayer[DXF_MAX_STRING_LEN+1]; // 8
83 char sLineType[DXF_MAX_STRING_LEN+1]; // 6
84 double fElevation; // 38
85 double fThickness; // 39
86 long nColor; // 62
87 long nSpace; // 67
88 DXFVector aExtrusion; // 210,220,230
90 protected:
92 DXFBasicEntity(DXFEntityType eThisType);
93 // Konstruktoren der Entities initialiseren immer mit Defaultwerten.
95 public:
97 virtual ~DXFBasicEntity();
98 virtual void Read(DXFGroupReader & rDGR);
99 // Liest die Prameter ein, bis zur naechten 0-Gruppe
101 protected:
103 virtual void EvaluateGroup(DXFGroupReader & rDGR);
104 // Diese Methode wird durch Read() fuer jeden Parameter (bzw. fuer jede
105 // Gruppe) aufgerufen.
106 // Sofern der Gruppencode dem Entity bekannt ist, wird der entsprechende
107 // Parameter geholt.
111 //------------------------------------------------------------------------------
112 //---------------- die verschiedenen Arten von Entyties ------------------------
113 //------------------------------------------------------------------------------
115 //--------------------------Line------------------------------------------------
117 class DXFLineEntity : public DXFBasicEntity {
119 public:
121 DXFVector aP0; // 10,20,30
122 DXFVector aP1; // 11,21,31
124 DXFLineEntity();
126 protected:
128 virtual void EvaluateGroup(DXFGroupReader & rDGR);
131 //--------------------------Point-----------------------------------------------
133 class DXFPointEntity : public DXFBasicEntity {
135 public:
137 DXFVector aP0; // 10,20,30
139 DXFPointEntity();
141 protected:
143 virtual void EvaluateGroup(DXFGroupReader & rDGR);
146 //--------------------------Circle----------------------------------------------
148 class DXFCircleEntity : public DXFBasicEntity {
150 public:
152 DXFVector aP0; // 10,20,30
153 double fRadius; // 40
155 DXFCircleEntity();
157 protected:
159 virtual void EvaluateGroup(DXFGroupReader & rDGR);
162 //--------------------------Arc-------------------------------------------------
164 class DXFArcEntity : public DXFBasicEntity {
166 public:
168 DXFVector aP0; // 10,20,30
169 double fRadius; // 40
170 double fStart; // 50
171 double fEnd; // 51
173 DXFArcEntity();
175 protected:
177 virtual void EvaluateGroup(DXFGroupReader & rDGR);
180 //--------------------------Trace-----------------------------------------------
182 class DXFTraceEntity : public DXFBasicEntity {
184 public:
186 DXFVector aP0; // 10,20,30
187 DXFVector aP1; // 11,21,31
188 DXFVector aP2; // 12,22,32
189 DXFVector aP3; // 13,23,33
191 DXFTraceEntity();
193 protected:
195 virtual void EvaluateGroup(DXFGroupReader & rDGR);
198 //--------------------------Solid-----------------------------------------------
200 class DXFSolidEntity : public DXFBasicEntity {
202 public:
204 DXFVector aP0; // 10,20,30
205 DXFVector aP1; // 11,21,31
206 DXFVector aP2; // 12,22,32
207 DXFVector aP3; // 13,23,33
209 DXFSolidEntity();
211 protected:
213 virtual void EvaluateGroup(DXFGroupReader & rDGR);
216 //--------------------------Text------------------------------------------------
218 class DXFTextEntity : public DXFBasicEntity {
220 public:
222 DXFVector aP0; // 10,20,30
223 double fHeight; // 40
224 char sText[DXF_MAX_STRING_LEN+1]; // 1
225 double fRotAngle; // 50
226 double fXScale; // 41
227 double fOblAngle; // 42
228 char sStyle[DXF_MAX_STRING_LEN+1]; // 7
229 long nGenFlags; // 71
230 long nHorzJust; // 72
231 long nVertJust; // 73
232 DXFVector aAlign; // 11,21,31
234 DXFTextEntity();
236 protected:
238 virtual void EvaluateGroup(DXFGroupReader & rDGR);
241 //--------------------------Shape-----------------------------------------------
243 class DXFShapeEntity : public DXFBasicEntity {
245 public:
247 DXFVector aP0; // 10,20,30
248 double fSize; // 40
249 char sName[DXF_MAX_STRING_LEN+1]; // 2
250 double fRotAngle; // 50
251 double fXScale; // 41
252 double fOblAngle; // 51
254 DXFShapeEntity();
256 protected:
258 virtual void EvaluateGroup(DXFGroupReader & rDGR);
261 //--------------------------Insert----------------------------------------------
263 class DXFInsertEntity : public DXFBasicEntity {
265 public:
267 long nAttrFlag; // 66
268 char sName[DXF_MAX_STRING_LEN+1]; // 2
269 DXFVector aP0; // 10,20,30
270 double fXScale; // 41
271 double fYScale; // 42
272 double fZScale; // 43
273 double fRotAngle; // 50
274 long nColCount; // 70
275 long nRowCount; // 71
276 double fColSpace; // 44
277 double fRowSpace; // 45
279 DXFInsertEntity();
281 protected:
283 virtual void EvaluateGroup(DXFGroupReader & rDGR);
286 //--------------------------AttDef----------------------------------------------
288 class DXFAttDefEntity : public DXFBasicEntity {
290 public:
292 DXFVector aP0; // 10,20,30
293 double fHeight; // 40
294 char sDefVal[DXF_MAX_STRING_LEN+1]; // 1
295 char sPrompt[DXF_MAX_STRING_LEN+1]; // 3
296 char sTagStr[DXF_MAX_STRING_LEN+1]; // 2
297 long nAttrFlags; // 70
298 long nFieldLen; // 73
299 double fRotAngle; // 50
300 double fXScale; // 41
301 double fOblAngle; // 51
302 char sStyle[DXF_MAX_STRING_LEN+1]; // 7
303 long nGenFlags; // 71
304 long nHorzJust; // 72
305 long nVertJust; // 74
306 DXFVector aAlign; // 11,21,31
308 DXFAttDefEntity();
310 protected:
312 virtual void EvaluateGroup(DXFGroupReader & rDGR);
315 //--------------------------Attrib----------------------------------------------
317 class DXFAttribEntity : public DXFBasicEntity {
319 public:
321 DXFVector aP0; // 10,20,30
322 double fHeight; // 40
323 char sText[DXF_MAX_STRING_LEN+1]; // 1
324 char sTagStr[DXF_MAX_STRING_LEN+1]; // 2
325 long nAttrFlags; // 70
326 long nFieldLen; // 73
327 double fRotAngle; // 50
328 double fXScale; // 41
329 double fOblAngle; // 51
330 char sStyle[DXF_MAX_STRING_LEN+1]; // 7
331 long nGenFlags; // 71
332 long nHorzJust; // 72
333 long nVertJust; // 74
334 DXFVector aAlign; // 11,21,31
336 DXFAttribEntity();
338 protected:
340 virtual void EvaluateGroup(DXFGroupReader & rDGR);
343 //--------------------------PolyLine--------------------------------------------
345 class DXFPolyLineEntity : public DXFBasicEntity {
347 public:
349 double fElevation; // 30
350 long nFlags; // 70
351 double fSWidth; // 40
352 double fEWidth; // 41
353 long nMeshMCount; // 71
354 long nMeshNCount; // 72
355 long nMDensity; // 73
356 long nNDensity; // 74
357 long nCSSType; // 75
359 DXFPolyLineEntity();
361 protected:
363 virtual void EvaluateGroup(DXFGroupReader & rDGR);
366 class DXFLWPolyLineEntity : public DXFBasicEntity
368 sal_Int32 nIndex;
370 public :
372 sal_Int32 nCount; // 90
373 sal_Int32 nFlags; // 70 1 = closed, 128 = plinegen
374 double fConstantWidth; // 43 (optional - default: 0, not used if fStartWidth and/or fEndWidth is used)
375 double fStartWidth; // 40
376 double fEndWidth; // 41
378 DXFVector* pP;
380 DXFLWPolyLineEntity();
381 ~DXFLWPolyLineEntity();
383 protected :
385 virtual void EvaluateGroup( DXFGroupReader & rDGR );
389 //-------------------------- Hatch ---------------------------------------------
391 struct DXFEdgeType
393 sal_Int32 nEdgeType;
395 virtual ~DXFEdgeType(){};
396 virtual sal_Bool EvaluateGroup( DXFGroupReader & /*rDGR*/ ){ return sal_True; };
398 protected :
400 DXFEdgeType( sal_Int32 EdgeType ):nEdgeType(EdgeType){};
402 struct DXFEdgeTypeLine : public DXFEdgeType
404 DXFVector aStartPoint; // 10,20
405 DXFVector aEndPoint; // 11,21
406 DXFEdgeTypeLine();
407 virtual ~DXFEdgeTypeLine();
408 virtual sal_Bool EvaluateGroup( DXFGroupReader & rDGR );
410 struct DXFEdgeTypeCircularArc : public DXFEdgeType
412 DXFVector aCenter; // 10,20
413 double fRadius; // 40
414 double fStartAngle; // 50
415 double fEndAngle; // 51
416 sal_Int32 nIsCounterClockwiseFlag; // 73
417 DXFEdgeTypeCircularArc();
418 virtual ~DXFEdgeTypeCircularArc();
419 virtual sal_Bool EvaluateGroup( DXFGroupReader & rDGR );
421 struct DXFEdgeTypeEllipticalArc : public DXFEdgeType
423 DXFVector aCenter; // 10,20
424 DXFVector aEndPoint; // 11,21
425 double fLength; // 40
426 double fStartAngle; // 50
427 double fEndAngle; // 51
428 sal_Int32 nIsCounterClockwiseFlag; // 73
430 DXFEdgeTypeEllipticalArc();
431 virtual ~DXFEdgeTypeEllipticalArc();
432 virtual sal_Bool EvaluateGroup( DXFGroupReader & rDGR );
434 struct DXFEdgeTypeSpline : public DXFEdgeType
436 sal_Int32 nDegree; // 94
437 sal_Int32 nRational; // 73
438 sal_Int32 nPeriodic; // 74
439 sal_Int32 nKnotCount; // 75
440 sal_Int32 nControlCount; // 76
442 DXFEdgeTypeSpline();
443 virtual ~DXFEdgeTypeSpline();
444 virtual sal_Bool EvaluateGroup( DXFGroupReader & rDGR );
447 typedef std::deque< DXFEdgeType* > DXFEdgeTypeArray;
449 struct DXFBoundaryPathData
451 sal_Int32 nFlags; // 92
452 sal_Int32 nHasBulgeFlag; // 72
453 sal_Int32 nIsClosedFlag; // 73
454 sal_Int32 nPointCount; // 93
455 double fBulge; // 42
456 sal_Int32 nSourceBoundaryObjects; // 97
457 sal_Int32 nEdgeCount; // 93
459 sal_Bool bIsPolyLine;
460 sal_Int32 nPointIndex;
462 DXFVector* pP;
463 DXFEdgeTypeArray aEdges;
465 DXFBoundaryPathData();
466 ~DXFBoundaryPathData();
468 sal_Bool EvaluateGroup( DXFGroupReader & rDGR );
471 class DXFHatchEntity : public DXFBasicEntity
473 sal_Bool bIsInBoundaryPathContext;
474 sal_Int32 nCurrentBoundaryPathIndex;
476 public :
478 DXFVector aElevationPoint;
479 sal_Int32 nFlags; // 70 (solid fill = 1, pattern fill = 0)
480 sal_Int32 nAssociativityFlag; // 71 (assoiciative = 1, non-associative = 0)
481 sal_Int32 nBoundaryPathCount; // 91
482 sal_Int32 nHatchStyle; // 75 (odd parity = 0, outmost area = 1, entire area = 2 )
483 sal_Int32 nHatchPatternType; // 76 (user defined = 0, predefined = 1, custom = 2)
484 double fHatchPatternAngle; // 52 (pattern fill only)
485 double fHatchPatternScale; // 41 (pattern fill only:scale or spacing)
486 sal_Int32 nHatchDoubleFlag; // 77 (pattern fill only:double = 1, not double = 0)
487 sal_Int32 nHatchPatternDefinitionLines; // 78
488 double fPixelSize; // 47
489 sal_Int32 nNumberOfSeedPoints; // 98
491 DXFBoundaryPathData* pBoundaryPathData;
493 DXFHatchEntity();
494 ~DXFHatchEntity();
496 protected :
498 virtual void EvaluateGroup( DXFGroupReader & rDGR );
502 //--------------------------Vertex----------------------------------------------
504 class DXFVertexEntity : public DXFBasicEntity {
506 public:
508 DXFVector aP0; // 10,20,30
509 double fSWidth; // 40 (Wenn <0.0, dann gilt DXFPolyLine::fSWidth)
510 double fEWidth; // 41 (Wenn <0.0, dann gilt DXFPolyLine::fEWidth)
511 double fBulge; // 42
512 long nFlags; // 70
513 double fCFTDir; // 50
515 DXFVertexEntity();
517 protected:
519 virtual void EvaluateGroup(DXFGroupReader & rDGR);
522 //--------------------------SeqEnd----------------------------------------------
524 class DXFSeqEndEntity : public DXFBasicEntity {
526 public:
528 DXFSeqEndEntity();
531 //--------------------------3DFace----------------------------------------------
533 class DXF3DFaceEntity : public DXFBasicEntity {
535 public:
537 DXFVector aP0; // 10,20,30
538 DXFVector aP1; // 11,21,31
539 DXFVector aP2; // 12,22,32
540 DXFVector aP3; // 13,23,33
541 long nIEFlags; // 70
543 DXF3DFaceEntity();
545 protected:
547 virtual void EvaluateGroup(DXFGroupReader & rDGR);
550 //--------------------------Dimension-------------------------------------------
552 class DXFDimensionEntity : public DXFBasicEntity {
554 public:
556 char sPseudoBlock[DXF_MAX_STRING_LEN+1]; // 2
558 DXFDimensionEntity();
560 protected:
562 virtual void EvaluateGroup(DXFGroupReader & rDGR);
565 //------------------------------------------------------------------------------
566 //----------- Eine Menge von Entities lesen und repraesentieren ----------------
567 //------------------------------------------------------------------------------
569 class DXFEntities {
571 public:
573 DXFEntities();
574 ~DXFEntities();
576 DXFBasicEntity * pFirst; // Liste von Entities, READ ONLY!
578 void Read(DXFGroupReader & rDGR);
579 // Liest Entitis per rGDR aus einer DXF-Datei bis zu
580 // einem ENDBLK, ENDSEC oder EOF (der Gruppe 0).
581 // (Alle unbekannten Dinge werden uebersprungen)
583 void Clear();
584 // Loescht alle Entities
587 //------------------------------------------------------------------------------
588 //--------------------------------- inlines ------------------------------------
589 //------------------------------------------------------------------------------
591 inline DXFEntities::DXFEntities()
593 pFirst=NULL;
597 inline DXFEntities::~DXFEntities()
599 Clear();
603 #endif