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 .
21 #include "dxftblrd.hxx"
23 //----------------------------------DXFLType-----------------------------------
34 void DXFLType::Read(DXFGroupReader
& rDGR
)
36 tools::Long nDashIndex
=-1;
38 while (rDGR
.Read()!=0)
43 m_sName
= rDGR
.GetS();
46 m_sDescription
= rDGR
.GetS();
57 nDashCount
=rDGR
.GetI();
58 if (nDashCount
>DXF_MAX_DASH_COUNT
)
60 nDashCount
=DXF_MAX_DASH_COUNT
;
64 case 40: fPatternLength
=rDGR
.GetF(); break;
71 if (nDashIndex
< nDashCount
)
78 fDash
[nDashIndex
++] = rDGR
.GetF();
85 //----------------------------------DXFLayer-----------------------------------
94 void DXFLayer::Read(DXFGroupReader
& rDGR
)
96 while (rDGR
.Read()!=0)
101 m_sName
= rDGR
.GetS();
104 m_sLineType
= rDGR
.GetS();
116 //----------------------------------DXFStyle-----------------------------------
129 void DXFStyle::Read(DXFGroupReader
& rDGR
)
131 while (rDGR
.Read()!=0)
136 m_sName
= rDGR
.GetS();
139 m_sPrimFontFile
= rDGR
.GetS();
142 m_sBigFontFile
= rDGR
.GetS();
151 fWidthFak
=rDGR
.GetF();
154 fLastHeightUsed
=rDGR
.GetF();
157 fOblAngle
=rDGR
.GetF();
160 nTextGenFlags
=rDGR
.GetI();
166 //----------------------------------DXFVPort-----------------------------------
183 , aDirection(DXFVector(0.0, 0.0, 1.0))
187 , fFrontClipPlane(0.0)
188 , fBackClipPlane(0.0)
193 , nCircleZoomPercent(0)
203 void DXFVPort::Read(DXFGroupReader
& rDGR
)
205 while (rDGR
.Read()!=0)
210 m_sName
= rDGR
.GetS();
212 case 10: fMinX
=rDGR
.GetF(); break;
213 case 11: fMaxX
=rDGR
.GetF(); break;
214 case 12: fCenterX
=rDGR
.GetF(); break;
215 case 13: fSnapBaseX
=rDGR
.GetF(); break;
216 case 14: fSnapSpacingX
=rDGR
.GetF(); break;
217 case 15: fGridX
=rDGR
.GetF(); break;
218 case 16: aDirection
.fx
=rDGR
.GetF(); break;
219 case 17: aTarget
.fx
=rDGR
.GetF(); break;
220 case 20: fMinY
=rDGR
.GetF(); break;
221 case 21: fMaxY
=rDGR
.GetF(); break;
222 case 22: fCenterY
=rDGR
.GetF(); break;
223 case 23: fSnapBaseY
=rDGR
.GetF(); break;
224 case 24: fSnapSpacingY
=rDGR
.GetF(); break;
225 case 25: fGridY
=rDGR
.GetF(); break;
226 case 26: aDirection
.fy
=rDGR
.GetF(); break;
227 case 27: aTarget
.fy
=rDGR
.GetF(); break;
228 case 36: aDirection
.fz
=rDGR
.GetF(); break;
229 case 37: aTarget
.fz
=rDGR
.GetF(); break;
230 case 40: fHeight
=rDGR
.GetF(); break;
231 case 41: fAspectRatio
=rDGR
.GetF(); break;
232 case 42: fLensLength
=rDGR
.GetF(); break;
233 case 43: fFrontClipPlane
=rDGR
.GetF(); break;
234 case 44: fBackClipPlane
=rDGR
.GetF(); break;
235 case 51: fTwistAngle
=rDGR
.GetF(); break;
236 case 68: nStatus
=rDGR
.GetI(); break;
237 case 69: nID
=rDGR
.GetI(); break;
238 case 70: nFlags
=rDGR
.GetI(); break;
239 case 71: nMode
=rDGR
.GetI(); break;
240 case 72: nCircleZoomPercent
=rDGR
.GetI(); break;
241 case 73: nFastZoom
=rDGR
.GetI(); break;
242 case 74: nUCSICON
=rDGR
.GetI(); break;
243 case 75: nSnap
=rDGR
.GetI(); break;
244 case 76: nGrid
=rDGR
.GetI(); break;
245 case 77: nSnapStyle
=rDGR
.GetI(); break;
246 case 78: nSnapIsopair
=rDGR
.GetI(); break;
251 //----------------------------------DXFTables----------------------------------
254 DXFTables::DXFTables()
263 DXFTables::~DXFTables()
269 void DXFTables::Read(DXFGroupReader
& rDGR
)
271 DXFLType
* * ppLT
, * pLT
;
272 DXFLayer
* * ppLa
, * pLa
;
273 DXFStyle
* * ppSt
, * pSt
;
274 DXFVPort
* * ppVP
, * pVP
;
277 while(*ppLT
!=nullptr) ppLT
=&((*ppLT
)->pSucc
);
280 while(*ppLa
!=nullptr) ppLa
=&((*ppLa
)->pSucc
);
283 while(*ppSt
!=nullptr) ppSt
=&((*ppSt
)->pSucc
);
286 while(*ppVP
!=nullptr) ppVP
=&((*ppVP
)->pSucc
);
289 while (rDGR
.GetG()!=0) rDGR
.Read();
290 if (rDGR
.GetS() == "EOF" ||
291 rDGR
.GetS() == "ENDSEC") break;
292 else if (rDGR
.GetS() == "LTYPE") {
298 else if (rDGR
.GetS() == "LAYER") {
304 else if (rDGR
.GetS() == "STYLE") {
310 else if (rDGR
.GetS() == "VPORT") {
321 void DXFTables::Clear()
328 while (pStyles
!=nullptr) {
333 while (pLayers
!=nullptr) {
338 while (pLTypes
!=nullptr) {
343 while (pVPorts
!=nullptr) {
351 DXFLType
* DXFTables::SearchLType(std::string_view rName
) const
354 for (p
=pLTypes
; p
!=nullptr; p
=p
->pSucc
) {
355 if (rName
== p
->m_sName
) break;
361 DXFLayer
* DXFTables::SearchLayer(std::string_view rName
) const
364 for (p
=pLayers
; p
!=nullptr; p
=p
->pSucc
) {
365 if (rName
== p
->m_sName
) break;
371 DXFVPort
* DXFTables::SearchVPort(std::string_view rName
) const
374 for (p
=pVPorts
; p
!=nullptr; p
=p
->pSucc
) {
375 if (rName
== p
->m_sName
) break;
381 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */