1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dxftblrd.cxx,v $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_goodies.hxx"
35 #include <dxftblrd.hxx>
37 //----------------------------------DXFLType-----------------------------------
48 void DXFLType::Read(DXFGroupReader
& rDGR
)
52 while (rDGR
.Read()!=0)
56 case 2: strncpy( sName
, rDGR
.GetS(), DXF_MAX_STRING_LEN
+ 1 ); break;
57 case 70: nFlags
=rDGR
.GetI(); break;
58 case 3: strncpy( sDescription
, rDGR
.GetS(), DXF_MAX_STRING_LEN
+ 1 ); break;
64 nDashCount
=rDGR
.GetI();
65 if (nDashCount
>DXF_MAX_DASH_COUNT
)
66 nDashCount
=DXF_MAX_DASH_COUNT
;
69 case 40: fPatternLength
=rDGR
.GetF(); break;
75 if (nDashIndex
<nDashCount
)
76 fDash
[nDashIndex
++]=rDGR
.GetF();
82 //----------------------------------DXFLayer-----------------------------------
93 void DXFLayer::Read(DXFGroupReader
& rDGR
)
95 while (rDGR
.Read()!=0) {
97 case 2: strncpy( sName
, rDGR
.GetS(), DXF_MAX_STRING_LEN
+ 1 ); break;
98 case 70: nFlags
=rDGR
.GetI(); break;
99 case 62: nColor
=rDGR
.GetI(); break;
100 case 6: strncpy( sLineType
, rDGR
.GetS(), DXF_MAX_STRING_LEN
+ 1 ); break;
105 //----------------------------------DXFStyle-----------------------------------
121 void DXFStyle::Read(DXFGroupReader
& rDGR
)
123 while (rDGR
.Read()!=0) {
124 switch(rDGR
.GetG()) {
125 case 2: strncpy( sName
, rDGR
.GetS(), DXF_MAX_STRING_LEN
+ 1 ); break;
126 case 70: nFlags
=rDGR
.GetI(); break;
127 case 40: fHeight
=rDGR
.GetF(); break;
128 case 41: fWidthFak
=rDGR
.GetF(); break;
129 case 50: fOblAngle
=rDGR
.GetF(); break;
130 case 71: nTextGenFlags
=rDGR
.GetI(); break;
131 case 42: fLastHeightUsed
=rDGR
.GetF(); break;
132 case 3: strncpy( sPrimFontFile
, rDGR
.GetS(), DXF_MAX_STRING_LEN
+ 1 ); break;
133 case 4: strncpy( sBigFontFile
, rDGR
.GetS(), DXF_MAX_STRING_LEN
+ 1 ); break;
138 //----------------------------------DXFVPort-----------------------------------
158 aDirection
=DXFVector(0,0,1);
159 aTarget
=DXFVector(0,0,0);
169 nCircleZoomPercent
=0;
178 void DXFVPort::Read(DXFGroupReader
& rDGR
)
180 while (rDGR
.Read()!=0) {
181 switch(rDGR
.GetG()) {
182 case 2: strncpy( sName
, rDGR
.GetS(), DXF_MAX_STRING_LEN
+ 1); break;
183 case 70: nFlags
=rDGR
.GetI(); break;
184 case 10: fMinX
=rDGR
.GetF(); break;
185 case 20: fMinY
=rDGR
.GetF(); break;
186 case 11: fMaxX
=rDGR
.GetF(); break;
187 case 21: fMaxY
=rDGR
.GetF(); break;
188 case 12: fCenterX
=rDGR
.GetF(); break;
189 case 22: fCenterY
=rDGR
.GetF(); break;
190 case 13: fSnapBaseX
=rDGR
.GetF(); break;
191 case 23: fSnapBaseY
=rDGR
.GetF(); break;
192 case 14: fSnapSapcingX
=rDGR
.GetF(); break;
193 case 24: fSnapSpacingY
=rDGR
.GetF(); break;
194 case 15: fGridX
=rDGR
.GetF(); break;
195 case 25: fGridY
=rDGR
.GetF(); break;
196 case 16: aDirection
.fx
=rDGR
.GetF(); break;
197 case 26: aDirection
.fy
=rDGR
.GetF(); break;
198 case 36: aDirection
.fz
=rDGR
.GetF(); break;
199 case 17: aTarget
.fx
=rDGR
.GetF(); break;
200 case 27: aTarget
.fy
=rDGR
.GetF(); break;
201 case 37: aTarget
.fz
=rDGR
.GetF(); break;
202 case 40: fHeight
=rDGR
.GetF(); break;
203 case 41: fAspectRatio
=rDGR
.GetF(); break;
204 case 42: fLensLength
=rDGR
.GetF(); break;
205 case 43: fFrontClipPlane
=rDGR
.GetF(); break;
206 case 44: fBackClipPlane
=rDGR
.GetF(); break;
207 case 51: fTwistAngle
=rDGR
.GetF(); break;
208 case 68: nStatus
=rDGR
.GetI(); break;
209 case 69: nID
=rDGR
.GetI(); break;
210 case 71: nMode
=rDGR
.GetI(); break;
211 case 72: nCircleZoomPercent
=rDGR
.GetI(); break;
212 case 73: nFastZoom
=rDGR
.GetI(); break;
213 case 74: nUCSICON
=rDGR
.GetI(); break;
214 case 75: nSnap
=rDGR
.GetI(); break;
215 case 76: nGrid
=rDGR
.GetI(); break;
216 case 77: nSnapStyle
=rDGR
.GetI(); break;
217 case 78: nSnapIsopair
=rDGR
.GetI(); break;
222 //----------------------------------DXFTables----------------------------------
225 DXFTables::DXFTables()
234 DXFTables::~DXFTables()
240 void DXFTables::Read(DXFGroupReader
& rDGR
)
242 DXFLType
* * ppLT
, * pLT
;
243 DXFLayer
* * ppLa
, * pLa
;
244 DXFStyle
* * ppSt
, * pSt
;
245 DXFVPort
* * ppVP
, * pVP
;
248 while(*ppLT
!=NULL
) ppLT
=&((*ppLT
)->pSucc
);
251 while(*ppLa
!=NULL
) ppLa
=&((*ppLa
)->pSucc
);
254 while(*ppSt
!=NULL
) ppSt
=&((*ppSt
)->pSucc
);
257 while(*ppVP
!=NULL
) ppVP
=&((*ppVP
)->pSucc
);
260 while (rDGR
.GetG()!=0) rDGR
.Read();
261 if (strcmp(rDGR
.GetS(),"EOF")==0 ||
262 strcmp(rDGR
.GetS(),"ENDSEC")==0) break;
263 else if (strcmp(rDGR
.GetS(),"LTYPE")==0) {
269 else if (strcmp(rDGR
.GetS(),"LAYER")==0) {
275 else if (strcmp(rDGR
.GetS(),"STYLE")==0) {
281 else if (strcmp(rDGR
.GetS(),"VPORT")==0) {
292 void DXFTables::Clear()
299 while (pStyles
!=NULL
) {
304 while (pLayers
!=NULL
) {
309 while (pLTypes
!=NULL
) {
314 while (pVPorts
!=NULL
) {
322 DXFLType
* DXFTables::SearchLType(const char * pName
) const
325 for (p
=pLTypes
; p
!=NULL
; p
=p
->pSucc
) {
326 if (strcmp(pName
,p
->sName
)==0) break;
332 DXFLayer
* DXFTables::SearchLayer(const char * pName
) const
335 for (p
=pLayers
; p
!=NULL
; p
=p
->pSucc
) {
336 if (strcmp(pName
,p
->sName
)==0) break;
342 DXFVPort
* DXFTables::SearchVPort(const char * pName
) const
345 for (p
=pVPorts
; p
!=NULL
; p
=p
->pSucc
) {
346 if (strcmp(pName
,p
->sName
)==0) break;