/
CDFRAMESET.java
199 lines (173 loc) · 4.8 KB
/
CDFRAMESET.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
package org.openntf.domino.nsfdata.structs.cd;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;
import org.openntf.domino.nsfdata.structs.COLOR_VALUE;
import org.openntf.domino.nsfdata.structs.FRAMESETLENGTH;
import org.openntf.domino.nsfdata.structs.SIG;
/**
* A FRAMESETLENGTH structure will follow depending on the value found in either RowQty or ColQty. There could be multiple FRAMESETLENGTH
* structures defining the RowQty and ColQty values. (fsods.h)
*
* @author jgallagher
* @since Lotus Notes/Domino 5.0.1
*
*/
public class CDFRAMESET extends CDRecord {
public CDFRAMESET(final SIG signature, final ByteBuffer data) {
super(signature, data);
}
/**
* @return fFSxxxxxxx as defined below. Unused bits must be set to 0
*/
public int getFlags() {
// TODO make enum
return getData().getInt(getData().position() + 0);
}
/**
* @return HTML FRAMEBORDER attribute
*/
public boolean getBorderEnable() {
return getData().get(getData().position() + 4) != 0;
}
/**
* Reserved, must be 0
*/
public byte getAvailable1() {
return getData().get(getData().position() + 5);
}
/**
* Reserved, must be 0
*/
public short getReserved1() {
return getData().getShort(getData().position() + 6);
}
/**
* Reserved, must be 0
*/
public short getReserved2() {
return getData().getShort(getData().position() + 8);
}
/**
* @return HTML BORDER attribute
*/
public int getFrameBorderWidth() {
return getData().getShort(getData().position() + 10) & 0xFFFF;
}
/**
* Reserved, must be 0
*/
public short getReserved3() {
return getData().getShort(getData().position() + 12);
}
/**
* @return HTML FRAMESPACING attribute
*/
public int getFrameSpacingWidth() {
return getData().getShort(getData().position() + 14) & 0xFFFF;
}
/**
* Reserved, must be 0
*/
public short getReserved4() {
return getData().getShort(getData().position() + 16);
}
/**
* reserved for future use
*/
public COLOR_VALUE getReservedColor1() {
ByteBuffer data = getData().duplicate();
data.order(ByteOrder.LITTLE_ENDIAN);
data.position(data.position() + 18);
data.limit(data.position() + 6);
return new COLOR_VALUE(data);
}
/**
* reserved for future use
*/
public COLOR_VALUE getReservedColor2() {
ByteBuffer data = getData().duplicate();
data.order(ByteOrder.LITTLE_ENDIAN);
data.position(data.position() + 24);
data.limit(data.position() + 6);
return new COLOR_VALUE(data);
}
/**
* @return The number of FRAMESETLENGTH structures defining row information
*/
public int getRowQty() {
return getData().getShort(getData().position() + 30) & 0xFFFF;
}
/**
* @return The number of FRAMESETLENGTH structures defining column information
*/
public int getColQty() {
return getData().getShort(getData().position() + 32) & 0xFFFF;
}
/**
* Reserved, must be 0
*/
public short getReserved5() {
return getData().getShort(getData().position() + 34);
}
/**
* Reserved, must be 0
*/
public short getReserved6() {
return getData().getShort(getData().position() + 36);
}
/**
* @return HTML BORDERCOLOR attribute
*/
public COLOR_VALUE getFrameBorderColor() {
ByteBuffer data = getData().duplicate();
data.order(ByteOrder.LITTLE_ENDIAN);
data.position(data.position() + 38);
data.limit(data.position() + 6);
return new COLOR_VALUE(data);
}
/**
* @return Theme Setting
* @since IBM Notes/Domino 8.5
*/
public byte getThemeSetting() {
// TODO make enum?
return getData().get(getData().position() + 44);
}
/**
* Reserved, must be 0
*/
public byte getReserved7() {
return getData().get(getData().position() + 45);
}
public FRAMESETLENGTH[] getRows() {
int count = getRowQty();
FRAMESETLENGTH[] result = new FRAMESETLENGTH[count];
for (int i = 0; i < count; i++) {
ByteBuffer data = getData().duplicate();
data.position(data.position() + 46 + (4 * i));
data.limit(data.position() + 4);
result[i] = new FRAMESETLENGTH(data);
}
return result;
}
public FRAMESETLENGTH[] getCols() {
int preceding = 4 * getRowQty();
int count = getColQty();
FRAMESETLENGTH[] result = new FRAMESETLENGTH[count];
for (int i = 0; i < count; i++) {
ByteBuffer data = getData().duplicate();
data.position(data.position() + 46 + preceding + (4 * i));
data.limit(data.position() + 4);
result[i] = new FRAMESETLENGTH(data);
}
return result;
}
@Override
public String toString() {
return "[" + getClass().getSimpleName() + ", BorderEnable: " + getBorderEnable() + ", FrameBorderWidth: " + getFrameBorderWidth()
+ ", FrameSpacingWidth: " + getFrameSpacingWidth() + ", FrameBorderColor: " + getFrameBorderColor() + ", ThemeSetting: "
+ getThemeSetting() + ", RowQty: " + getRowQty() + ", ColQty: " + getColQty() + ", Rows: " + Arrays.asList(getRows())
+ ", Cols: " + Arrays.asList(getCols()) + "]";
}
}