KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jxl > biff > drawing > Sp


1 /*********************************************************************
2 *
3 * Copyright (C) 2003 Andrew Khan
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 ***************************************************************************/

19
20 package jxl.biff.drawing;
21
22 import common.Logger;
23 import jxl.biff.IntegerHelper;
24
25 class Sp extends EscherAtom
26 {
27   /**
28    * The logger
29    */

30   private static Logger logger = Logger.getLogger(Sp.class);
31
32   private byte[] data;
33   private int shapeType;
34   private int shapeId;
35   private int persistenceFlags;
36
37   /**
38    * Constructor
39    *
40    * @param erd
41    */

42   public Sp(EscherRecordData erd)
43   {
44     super(erd);
45     shapeType = getInstance();
46     byte[] bytes = getBytes();
47     shapeId = IntegerHelper.getInt(bytes[0], bytes[1], bytes[2], bytes[3]);
48     persistenceFlags = IntegerHelper.getInt(bytes[4], bytes[5],
49                                            bytes[6], bytes[7]);
50   }
51
52   /**
53    * Constructor
54    *
55    * @param st
56    * @param sid
57    * @param p
58    */

59   public Sp(ShapeType st, int sid, int p)
60   {
61     super(EscherRecordType.SP);
62     setVersion(2);
63     shapeType = st.value;
64     shapeId = sid;
65     persistenceFlags = p;
66     setInstance(shapeType);
67   }
68
69   int getShapeId()
70   {
71     return shapeId;
72   }
73
74   int getShapeType()
75   {
76     return shapeType;
77   }
78
79   byte[] getData()
80   {
81     data = new byte[8];
82     IntegerHelper.getFourBytes(shapeId, data, 0);
83     IntegerHelper.getFourBytes(persistenceFlags, data, 4);
84     return setHeaderData(data);
85   }
86 }
87
Popular Tags