KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > hwpf > usermodel > CharacterProperties


1
2 /* ====================================================================
3    Copyright 2003-2004 Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16 ==================================================================== */

17
18
19 package org.apache.poi.hwpf.usermodel;
20
21 import org.apache.poi.hwpf.model.types.CHPAbstractType;
22
23 /**
24  * @author Ryan Ackley
25  */

26 public class CharacterProperties
27   extends CHPAbstractType implements Cloneable JavaDoc
28 {
29   public final static short SPRM_FRMARKDEL = (short)0x0800;
30   public final static short SPRM_FRMARK = 0x0801;
31   public final static short SPRM_FFLDVANISH = 0x0802;
32   public final static short SPRM_PICLOCATION = 0x6A03;
33   public final static short SPRM_IBSTRMARK = 0x4804;
34   public final static short SPRM_DTTMRMARK = 0x6805;
35   public final static short SPRM_FDATA = 0x0806;
36   public final static short SPRM_SYMBOL = 0x6A09;
37   public final static short SPRM_FOLE2 = 0x080A;
38   public final static short SPRM_HIGHLIGHT = 0x2A0C;
39   public final static short SPRM_OBJLOCATION = 0x680E;
40   public final static short SPRM_ISTD = 0x4A30;
41   public final static short SPRM_FBOLD = 0x0835;
42   public final static short SPRM_FITALIC = 0x0836;
43   public final static short SPRM_FSTRIKE = 0x0837;
44   public final static short SPRM_FOUTLINE = 0x0838;
45   public final static short SPRM_FSHADOW = 0x0839;
46   public final static short SPRM_FSMALLCAPS = 0x083A;
47   public final static short SPRM_FCAPS = 0x083B;
48   public final static short SPRM_FVANISH = 0x083C;
49   public final static short SPRM_KUL = 0x2A3E;
50   public final static short SPRM_DXASPACE = (short)0x8840;
51   public final static short SPRM_LID = 0x4A41;
52   public final static short SPRM_ICO = 0x2A42;
53   public final static short SPRM_HPS = 0x4A43;
54   public final static short SPRM_HPSPOS = 0x4845;
55   public final static short SPRM_ISS = 0x2A48;
56   public final static short SPRM_HPSKERN = 0x484B;
57   public final static short SPRM_YSRI = 0x484E;
58   public final static short SPRM_RGFTCASCII = 0x4A4F;
59   public final static short SPRM_RGFTCFAREAST = 0x4A50;
60   public final static short SPRM_RGFTCNOTFAREAST = 0x4A51;
61   public final static short SPRM_CHARSCALE = 0x4852;
62   public final static short SPRM_FDSTRIKE = 0x2A53;
63   public final static short SPRM_FIMPRINT = 0x0854;
64   public final static short SPRM_FSPEC = 0x0855;
65   public final static short SPRM_FOBJ = 0x0856;
66   public final static short SPRM_PROPRMARK = (short)0xCA57;
67   public final static short SPRM_FEMBOSS = 0x0858;
68   public final static short SPRM_SFXTEXT = 0x2859;
69   public final static short SPRM_DISPFLDRMARK = (short)0xCA62;
70   public final static short SPRM_IBSTRMARKDEL = 0x4863;
71   public final static short SPRM_DTTMRMARKDEL = 0x6864;
72   public final static short SPRM_BRC = 0x6865;
73   public final static short SPRM_SHD = 0x4866;
74   public final static short SPRM_IDSIRMARKDEL = 0x4867;
75   public final static short SPRM_CPG = 0x486B;
76   public final static short SPRM_NONFELID = 0x486D;
77   public final static short SPRM_FELID = 0x486E;
78   public final static short SPRM_IDCTHINT = 0x286F;
79
80   int _ico24 = -1; // default to -1 so we can ignore it for word 97 files
81

82   public CharacterProperties()
83   {
84     field_17_fcPic = -1;
85     field_22_dttmRMark = new DateAndTime();
86     field_23_dttmRMarkDel = new DateAndTime();
87     field_36_dttmPropRMark = new DateAndTime();
88     field_40_dttmDispFldRMark = new DateAndTime();
89     field_41_xstDispFldRMark = new byte[36];
90     field_42_shd = new ShadingDescriptor();
91     field_43_brc = new BorderCode();
92     field_7_hps = 20;
93     field_24_istd = 10;
94     field_16_wCharScale = 100;
95     field_13_lidDefault = 0x0400;
96     field_14_lidFE = 0x0400;
97   }
98
99   public boolean isMarkedDeleted()
100   {
101     return isFRMarkDel();
102   }
103
104   public void markDeleted(boolean mark)
105   {
106     super.setFRMarkDel(mark);
107   }
108
109   public boolean isBold()
110   {
111     return isFBold();
112   }
113
114   public void setBold(boolean bold)
115   {
116     super.setFBold(bold);
117   }
118
119   public boolean isItalic()
120   {
121     return isFItalic();
122   }
123
124   public void setItalic(boolean italic)
125   {
126     super.setFItalic(italic);
127   }
128
129   public boolean isOutlined()
130   {
131     return isFOutline();
132   }
133
134   public void setOutline(boolean outlined)
135   {
136     super.setFOutline(outlined);
137   }
138
139   public boolean isFldVanished()
140   {
141     return isFFldVanish();
142   }
143
144   public void setFldVanish(boolean fldVanish)
145   {
146     super.setFFldVanish(fldVanish);
147   }
148
149   public boolean isSmallCaps()
150   {
151     return isFSmallCaps();
152   }
153
154   public void setSmallCaps(boolean smallCaps)
155   {
156     super.setFSmallCaps(smallCaps);
157   }
158
159   public boolean isCapitalized()
160   {
161     return isFCaps();
162   }
163
164   public void setCapitalized(boolean caps)
165   {
166     super.setFCaps(caps);
167   }
168
169   public boolean isVanished()
170   {
171     return isFVanish();
172   }
173
174   public void setVanished(boolean vanish)
175   {
176     super.setFVanish(vanish);
177
178   }
179   public boolean isMarkedInserted()
180   {
181     return isFRMark();
182   }
183
184   public void markInserted(boolean mark)
185   {
186     super.setFRMark(mark);
187   }
188
189   public boolean isStrikeThrough()
190   {
191     return isFStrike();
192   }
193
194   public void strikeThrough(boolean strike)
195   {
196     super.setFStrike(strike);
197   }
198
199   public boolean isShadowed()
200   {
201     return isFShadow();
202   }
203
204   public void setShadow(boolean shadow)
205   {
206     super.setFShadow(shadow);
207
208   }
209
210   public boolean isEmbossed()
211   {
212     return isFEmboss();
213   }
214
215   public void setEmbossed(boolean emboss)
216   {
217     super.setFEmboss(emboss);
218   }
219
220   public boolean isImprinted()
221   {
222     return isFImprint();
223   }
224
225   public void setImprinted(boolean imprint)
226   {
227     super.setFImprint(imprint);
228   }
229
230   public boolean isDoubleStrikeThrough()
231   {
232     return isFDStrike();
233   }
234
235   public void setDoubleStrikeThrough(boolean dstrike)
236   {
237     super.setFDStrike(dstrike);
238   }
239
240   public int getFontSize()
241   {
242     return getHps();
243   }
244
245   public void setFontSize(int halfPoints)
246   {
247     super.setHps(halfPoints);
248   }
249
250   public int getCharacterSpacing()
251   {
252     return getDxaSpace();
253   }
254
255   public void setCharacterSpacing(int twips)
256   {
257     super.setDxaSpace(twips);
258   }
259
260   public short getSubSuperScriptIndex()
261   {
262     return getIss();
263   }
264
265   public void setSubSuperScriptIndex(short iss)
266   {
267     super.setDxaSpace(iss);
268   }
269
270   public int getUnderlineCode()
271   {
272     return super.getKul();
273   }
274
275   public void setUnderlineCode(int kul)
276   {
277     super.setKul((byte)kul);
278   }
279
280   public int getColor()
281   {
282     return super.getIco();
283   }
284
285   public void setColor(int color)
286   {
287     super.setIco((byte)color);
288   }
289
290   public int getVerticalOffset()
291   {
292     return super.getHpsPos();
293   }
294
295   public void setVerticalOffset(int hpsPos)
296   {
297     super.setHpsPos(hpsPos);
298   }
299
300   public int getKerning()
301   {
302     return super.getHpsKern();
303   }
304
305   public void setKerning(int kern)
306   {
307     super.setHpsKern(kern);
308   }
309
310   public boolean isHighlighted()
311   {
312     return super.isFHighlight();
313   }
314
315   public void setHighlighted(byte color)
316   {
317     super.setIcoHighlight(color);
318   }
319
320   /**
321   * Get the ico24 field for the CHP record.
322   */

323   public int getIco24()
324   {
325     if ( _ico24 == -1 )
326     {
327       switch(field_11_ico) // convert word 97 colour numbers to 0xBBGGRR value
328
{
329         case 0: // auto
330
return -1;
331         case 1: // black
332
return 0x000000;
333         case 2: // blue
334
return 0xFF0000;
335         case 3: // cyan
336
return 0xFFFF00;
337         case 4: // green
338
return 0x00FF00;
339         case 5: // magenta
340
return 0xFF00FF;
341         case 6: // red
342
return 0x0000FF;
343         case 7: // yellow
344
return 0x00FFFF;
345         case 8: // white
346
return 0x0FFFFFF;
347         case 9: // dark blue
348
return 0x800000;
349         case 10: // dark cyan
350
return 0x808000;
351         case 11: // dark green
352
return 0x008000;
353         case 12: // dark magenta
354
return 0x800080;
355         case 13: // dark red
356
return 0x000080;
357         case 14: // dark yellow
358
return 0x008080;
359         case 15: // dark grey
360
return 0x808080;
361         case 16: // light grey
362
return 0xC0C0C0;
363       }
364     }
365     return _ico24;
366   }
367
368   /**
369    * Set the ico24 field for the CHP record.
370    */

371   public void setIco24(int colour24)
372   {
373     _ico24 = colour24 & 0xFFFFFF; // only keep the 24bit 0xBBGGRR colour
374
}
375
376   public Object JavaDoc clone()
377     throws CloneNotSupportedException JavaDoc
378   {
379     CharacterProperties cp = (CharacterProperties)super.clone();
380     cp.field_22_dttmRMark = (DateAndTime)field_22_dttmRMark.clone();
381     cp.field_23_dttmRMarkDel = (DateAndTime)field_23_dttmRMarkDel.clone();
382     cp.field_36_dttmPropRMark = (DateAndTime)field_36_dttmPropRMark.clone();
383     cp.field_40_dttmDispFldRMark = (DateAndTime)field_40_dttmDispFldRMark.clone();
384     cp.field_41_xstDispFldRMark = (byte[])field_41_xstDispFldRMark.clone();
385     cp.field_42_shd = (ShadingDescriptor)field_42_shd.clone();
386
387     cp._ico24 = _ico24;
388
389     return cp;
390   }
391
392
393 }
394
Popular Tags