import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
import org.apache.poi.ss.formula.ptg.Area3DPtg;
+import org.apache.poi.ss.formula.ptg.Area3DPxg;
import org.apache.poi.ss.formula.ptg.NameXPtg;
import org.apache.poi.ss.formula.ptg.Ptg;
import org.apache.poi.ss.formula.ptg.Ref3DPtg;
SheetRefEvaluator sre = createExternSheetRefEvaluator(rptg.getSheetName(), rptg.getExternalWorkbookNumber());
return new LazyRefEval(rptg.getRow(), rptg.getColumn(), sre);
}
+
public ValueEval getAreaEval(int firstRowIndex, int firstColumnIndex,
int lastRowIndex, int lastColumnIndex) {
SheetRefEvaluator sre = getRefEvaluatorForCurrentSheet();
return new LazyAreaEval(firstRowIndex, firstColumnIndex, lastRowIndex, lastColumnIndex, sre);
}
- public ValueEval getArea3DEval(int firstRowIndex, int firstColumnIndex,
- int lastRowIndex, int lastColumnIndex, int extSheetIndex) {
- SheetRefEvaluator sre = createExternSheetRefEvaluator(extSheetIndex);
- return new LazyAreaEval(firstRowIndex, firstColumnIndex, lastRowIndex, lastColumnIndex, sre);
- }
+ public ValueEval getArea3DEval(Area3DPtg aptg) {
+ SheetRefEvaluator sre = createExternSheetRefEvaluator(aptg.getExternSheetIndex());
+ return new LazyAreaEval(aptg.getFirstRow(), aptg.getFirstColumn(),
+ aptg.getLastRow(), aptg.getLastColumn(), sre);
+ }
+ public ValueEval getArea3DEval(Area3DPxg aptg) {
+ SheetRefEvaluator sre = createExternSheetRefEvaluator(aptg.getSheetName(), aptg.getExternalWorkbookNumber());
+ return new LazyAreaEval(aptg.getFirstRow(), aptg.getFirstColumn(),
+ aptg.getLastRow(), aptg.getLastColumn(), sre);
+ }
+
public ValueEval getNameXEval(NameXPtg nameXPtg) {
+ // TODO Need HSSF and XSSF versions of these
ExternalSheet externSheet = _workbook.getExternalSheet(nameXPtg.getSheetRefIndex());
if(externSheet == null)
return new NameXEval(nameXPtg);
import org.apache.poi.ss.formula.functions.Function;
import org.apache.poi.ss.formula.functions.IfFunc;
import org.apache.poi.ss.formula.ptg.Area3DPtg;
+import org.apache.poi.ss.formula.ptg.Area3DPxg;
import org.apache.poi.ss.formula.ptg.AreaErrPtg;
import org.apache.poi.ss.formula.ptg.AreaPtg;
import org.apache.poi.ss.formula.ptg.AttrPtg;
return ec.getRef3DEval((Ref3DPxg)ptg);
}
if (ptg instanceof Area3DPtg) {
- Area3DPtg aptg = (Area3DPtg) ptg;
- return ec.getArea3DEval(aptg.getFirstRow(), aptg.getFirstColumn(), aptg.getLastRow(), aptg.getLastColumn(), aptg.getExternSheetIndex());
+ return ec.getArea3DEval((Area3DPtg)ptg);
+ }
+ if (ptg instanceof Area3DPxg) {
+ return ec.getArea3DEval((Area3DPxg)ptg);
}
if (ptg instanceof RefPtg) {
RefPtg rptg = (RefPtg) ptg;
import org.apache.poi.util.LittleEndianOutput;
/**
- * Title: Area 3D Ptg - 3D reference (Sheet + Area)<P>
- * Description: Defined a area in Extern Sheet. <P>
- * REFERENCE: <P>
- * @author Libin Roman (Vista Portal LDT. Developer)
- * @author avik
- * @author Jason Height (jheight at chariot dot net dot au)
+ * <p>Title: Area 3D Ptg - 3D reference (Sheet + Area)</p>
+ * <p>Description: Defined an area in Extern Sheet. </p>
+ * <p>REFERENCE: </p>
+ *
+ * <p>This is HSSF only, as it matches the HSSF file format way of
+ * referring to the sheet by an extern index. The XSSF equivalent
+ * is {@link Area3DPxg}
*/
public final class Area3DPtg extends AreaPtgBase implements WorkbookDependentFormula, ExternSheetReferenceToken {
public final static byte sid = 0x3b;
import org.apache.poi.ss.formula.FormulaType;
import org.apache.poi.ss.formula.SheetIdentifier;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
-import org.apache.poi.ss.formula.ptg.Area3DPtg;
+import org.apache.poi.ss.formula.ptg.Area3DPxg;
import org.apache.poi.ss.formula.ptg.NamePtg;
import org.apache.poi.ss.formula.ptg.NameXPtg;
import org.apache.poi.ss.formula.ptg.Ptg;
}
}
public Ptg get3DReferencePtg(AreaReference area, SheetIdentifier sheet) {
- // TODO Implement properly
- return new Area3DPtg(area, getExternalSheetIndex(sheet._sheetIdentifier.getName()));
+ String sheetName = sheet._sheetIdentifier.getName();
+
+ if (sheet._bookName != null) {
+ int bookIndex = resolveBookIndex(sheet._bookName);
+ return new Area3DPxg(bookIndex, sheetName, area);
+ } else {
+ return new Area3DPxg(sheetName, area);
+ }
}
public String resolveNameXText(NameXPtg n) {