1 19 20 package jxl.read.biff; 21 22 import jxl.biff.FormattingRecords; 23 import jxl.biff.FormulaData; 24 import jxl.biff.WorkbookMethods; 25 import jxl.biff.formula.FormulaParser; 26 import jxl.biff.formula.ExternalSheet; 27 import jxl.biff.formula.FormulaException; 28 29 32 public abstract class BaseSharedFormulaRecord extends CellValue 33 implements FormulaData 34 { 35 38 private String formulaString; 39 40 44 private int filePos; 45 46 49 private byte[] tokens; 50 51 54 private ExternalSheet externalSheet; 55 56 59 private WorkbookMethods nameTable; 60 61 71 public BaseSharedFormulaRecord(Record t, 72 FormattingRecords fr, 73 ExternalSheet es, 74 WorkbookMethods nt, 75 SheetImpl si, 76 int pos) 77 { 78 super(t, fr, si); 79 externalSheet = es; 80 nameTable = nt; 81 filePos = pos; 82 } 83 84 90 public String getFormula() throws FormulaException 91 { 92 if (formulaString == null) 93 { 94 FormulaParser fp = new FormulaParser 95 (tokens, this, externalSheet, nameTable, 96 getSheet().getWorkbook().getSettings()); 97 fp.parse(); 98 formulaString = fp.getFormula(); 99 } 100 101 return formulaString; 102 } 103 104 110 void setTokens(byte[] t) 111 { 112 tokens = t; 113 } 114 115 120 protected final byte[] getTokens() 121 { 122 return tokens; 123 } 124 125 130 protected final ExternalSheet getExternalSheet() 131 { 132 return externalSheet; 133 } 134 135 140 protected final WorkbookMethods getNameTable() 141 { 142 return nameTable; 143 } 144 145 151 public Record getRecord() 152 { 153 return super.getRecord(); 154 } 155 156 161 final int getFilePos() 162 { 163 return filePos; 164 } 165 } 166 167 168 169 170 171 172 173 174 175 | Popular Tags |