KickJava   Java API By Example, From Geeks To Geeks.

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


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 /**
23  * Enumeration class for Escher record types
24  */

25 final class EscherRecordType
26 {
27   /**
28    * The code of the item within the escher stream
29    */

30   private int value;
31
32   /**
33    * All escher types
34    */

35   private static EscherRecordType[] types = new EscherRecordType[0];
36
37   /**
38    * Constructor
39    *
40    * @param val the escher record value
41    */

42   private EscherRecordType(int val)
43   {
44     value = val;
45
46     EscherRecordType[] newtypes = new EscherRecordType[types.length+1];
47     System.arraycopy(types, 0, newtypes, 0, types.length);
48     newtypes[types.length] = this;
49     types = newtypes;
50   }
51
52   /**
53    * Accessor for the escher record value
54    *
55    * @return the escher record value
56    */

57   public int getValue()
58   {
59     return value;
60   }
61
62   /**
63    * Accessor to get the item from a particular value
64    *
65    * @param val the escher record value
66    * @return the type corresponding to val, or UNKNOWN if a match could not
67    * be found
68    */

69   public static EscherRecordType getType(int val)
70   {
71     EscherRecordType type = UNKNOWN;
72
73     for (int i = 0; i < types.length; i++)
74     {
75       if (val == types[i].value)
76       {
77         type = types[i];
78         break;
79       }
80     }
81
82     return type;
83   }
84
85   public static final EscherRecordType UNKNOWN = new EscherRecordType(0x0);
86   public static final EscherRecordType DGG_CONTAINER =
87     new EscherRecordType(0xf000);
88   public static final EscherRecordType BSTORE_CONTAINER =
89     new EscherRecordType(0xf001);
90   public static final EscherRecordType DG_CONTAINER =
91     new EscherRecordType(0xf002);
92   public static final EscherRecordType SPGR_CONTAINER =
93     new EscherRecordType(0xf003);
94   public static final EscherRecordType SP_CONTAINER =
95     new EscherRecordType(0xf004);
96
97   public static final EscherRecordType DGG = new EscherRecordType(0xf006);
98   public static final EscherRecordType BSE = new EscherRecordType(0xf007);
99   public static final EscherRecordType DG = new EscherRecordType(0xf008);
100   public static final EscherRecordType SPGR = new EscherRecordType(0xf009);
101   public static final EscherRecordType SP = new EscherRecordType(0xf00a);
102   public static final EscherRecordType OPT = new EscherRecordType(0xf00b);
103   public static final EscherRecordType CLIENT_ANCHOR =
104     new EscherRecordType(0xf010);
105   public static final EscherRecordType CLIENT_DATA =
106     new EscherRecordType(0xf011);
107   public static final EscherRecordType CLIENT_TEXT_BOX =
108     new EscherRecordType(0xf00d);
109   public static final EscherRecordType SPLIT_MENU_COLORS =
110     new EscherRecordType(0xf11e);
111 }
112
Popular Tags