KickJava   Java API By Example, From Geeks To Geeks.

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


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

16
17 package org.apache.poi.hwpf.usermodel;
18
19 import org.apache.poi.util.LittleEndian;
20
21 /**
22  * This class is used to determine line spacing for a paragraph.
23  *
24  * @author Ryan Ackley
25  */

26 public class LineSpacingDescriptor
27   implements Cloneable JavaDoc
28 {
29   short _dyaLine;
30   short _fMultiLinespace;
31
32   public LineSpacingDescriptor()
33   {
34   }
35
36   public LineSpacingDescriptor(byte[] buf, int offset)
37   {
38     _dyaLine = LittleEndian.getShort(buf, offset);
39     _fMultiLinespace = LittleEndian.getShort(buf, offset + LittleEndian.SHORT_SIZE);
40   }
41
42   public Object JavaDoc clone()
43     throws CloneNotSupportedException JavaDoc
44   {
45     return super.clone();
46   }
47
48   public void setMultiLinespace(short fMultiLinespace)
49   {
50     _fMultiLinespace = fMultiLinespace;
51   }
52
53   public int toInt()
54   {
55     byte[] intHolder = new byte[4];
56     serialize(intHolder, 0);
57     return LittleEndian.getInt(intHolder);
58   }
59
60   public void serialize(byte[] buf, int offset)
61   {
62     LittleEndian.putShort(buf, offset, _dyaLine);
63     LittleEndian.putShort(buf, offset + LittleEndian.SHORT_SIZE, _fMultiLinespace);
64   }
65
66   public void setDyaLine(short dyaLine)
67   {
68     _dyaLine = dyaLine;
69   }
70   public boolean equals(Object JavaDoc o)
71   {
72     LineSpacingDescriptor lspd = (LineSpacingDescriptor)o;
73
74     return _dyaLine == lspd._dyaLine && _fMultiLinespace == lspd._fMultiLinespace;
75   }
76 }
77
Popular Tags