1 19 20 package jxl.write.biff; 21 22 import java.util.List ; 23 24 import jxl.write.Number; 25 import jxl.biff.Type; 26 import jxl.biff.IntegerHelper; 27 import jxl.biff.WritableRecordData; 28 29 32 class MulRKRecord extends WritableRecordData 33 { 34 37 private int row; 38 41 private int colFirst; 42 45 private int colLast; 46 49 private int[] rknumbers; 50 53 private int[] xfIndices; 54 55 60 public MulRKRecord(List numbers) 61 { 62 super(Type.MULRK); 63 row = ((Number )numbers.get(0)).getRow(); 64 colFirst = ((Number )numbers.get(0)).getColumn(); 65 colLast = colFirst + numbers.size() - 1; 66 67 rknumbers = new int[numbers.size()]; 68 xfIndices = new int[numbers.size()]; 69 70 for (int i = 0; i < numbers.size(); i++) 71 { 72 rknumbers[i] = (int) ((Number )numbers.get(i)).getValue(); 73 xfIndices[i] = ( (CellValue) numbers.get(i)).getXFIndex(); 74 } 75 } 76 77 82 public byte[] getData() 83 { 84 byte[] data = new byte[rknumbers.length * 6 + 6]; 85 86 IntegerHelper.getTwoBytes(row, data, 0); 88 IntegerHelper.getTwoBytes(colFirst, data, 2); 89 90 int pos = 4; 92 int rkValue = 0; 93 int rkBits = 0; 94 byte[] rkBytes = new byte[4]; 95 for (int i = 0; i < rknumbers.length; i++) 96 { 97 IntegerHelper.getTwoBytes(xfIndices[i], data, pos); 98 99 102 rkValue = rknumbers[i] << 2; 104 105 rkValue |= 0x2; 107 IntegerHelper.getFourBytes(rkValue, data, pos+2); 108 109 pos+=6; 110 } 111 112 IntegerHelper.getTwoBytes(colLast, data, pos); 114 115 return data; 116 } 117 } 118 119 120 121 122 | Popular Tags |