merge the formfield patch from ooo-build
[ooovba.git] / goodies / source / filter.vcl / idxf / dxfblkrd.cxx
blob2dbbee7bb8dde6769b318348b787d2763e685ae3
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: dxfblkrd.cxx,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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_goodies.hxx"
34 #include <string.h>
35 #include <dxfblkrd.hxx>
38 //----------------------------------------------------------------------------
39 //---------------- DXFBlock --------------------------------------------------
40 //----------------------------------------------------------------------------
43 DXFBlock::DXFBlock()
45 pSucc=NULL;
49 DXFBlock::~DXFBlock()
54 void DXFBlock::Read(DXFGroupReader & rDGR)
56 sName[0]=0;
57 sAlsoName[0]=0;
58 aBasePoint.fx=0.0;
59 aBasePoint.fy=0.0;
60 aBasePoint.fz=0.0;
61 nFlags=0;
62 sXRef[0]=0;
64 while (rDGR.Read()!=0)
66 switch (rDGR.GetG())
68 case 2: strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
69 case 3: strncpy( sAlsoName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
70 case 70: nFlags=rDGR.GetI(); break;
71 case 10: aBasePoint.fx=rDGR.GetF(); break;
72 case 20: aBasePoint.fy=rDGR.GetF(); break;
73 case 30: aBasePoint.fz=rDGR.GetF(); break;
74 case 1: strncpy( sXRef, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
77 DXFEntities::Read(rDGR);
81 //----------------------------------------------------------------------------
82 //---------------- DXFBlocks -------------------------------------------------
83 //----------------------------------------------------------------------------
86 DXFBlocks::DXFBlocks()
88 pFirst=NULL;
92 DXFBlocks::~DXFBlocks()
94 Clear();
98 void DXFBlocks::Read(DXFGroupReader & rDGR)
100 DXFBlock * pB, * * ppSucc;
102 ppSucc=&pFirst;
103 while (*ppSucc!=NULL) ppSucc=&((*ppSucc)->pSucc);
105 for (;;) {
106 while (rDGR.GetG()!=0) rDGR.Read();
107 if (strcmp(rDGR.GetS(),"ENDSEC")==0 ||
108 strcmp(rDGR.GetS(),"EOF")==0) break;
109 if (strcmp(rDGR.GetS(),"BLOCK")==0) {
110 pB=new DXFBlock;
111 pB->Read(rDGR);
112 *ppSucc=pB;
113 ppSucc=&(pB->pSucc);
115 else rDGR.Read();
120 DXFBlock * DXFBlocks::Search(const char * sName) const
122 DXFBlock * pB;
123 for (pB=pFirst; pB!=NULL; pB=pB->pSucc) {
124 if (strcmp(sName,pB->sName)==0) break;
126 return pB;
130 void DXFBlocks::Clear()
132 DXFBlock * ptmp;
134 while (pFirst!=NULL) {
135 ptmp=pFirst;
136 pFirst=ptmp->pSucc;
137 delete ptmp;