Package org.apache.poi.ss.formula.ptg

Examples of org.apache.poi.ss.formula.ptg.Ref3DPtg


    if (ptg instanceof AreaErrPtg ||ptg instanceof RefErrorPtg
        || ptg instanceof DeletedArea3DPtg || ptg instanceof DeletedRef3DPtg) {
        return ErrorEval.REF_INVALID;
    }
    if (ptg instanceof Ref3DPtg) {
      Ref3DPtg rptg = (Ref3DPtg) ptg;
      return ec.getRef3DEval(rptg.getRow(), rptg.getColumn(), rptg.getExternSheetIndex());
    }
    if (ptg instanceof Area3DPtg) {
      Area3DPtg aptg = (Area3DPtg) ptg;
      return ec.getArea3DEval(aptg.getFirstRow(), aptg.getFirstColumn(), aptg.getLastRow(), aptg.getLastColumn(), aptg.getExternSheetIndex());
    }
    if (ptg instanceof RefPtg) {
      RefPtg rptg = (RefPtg) ptg;
      return ec.getRefEval(rptg.getRow(), rptg.getColumn());
    }
    if (ptg instanceof AreaPtg) {
      AreaPtg aptg = (AreaPtg) ptg;
      return ec.getAreaEval(aptg.getFirstRow(), aptg.getFirstColumn(), aptg.getLastRow(), aptg.getLastColumn());
    }
View Full Code Here


                if (ptg instanceof Area3DPtg) {
                    Area3DPtg a3p = (Area3DPtg) ((OperandPtg) ptg).copy();
                    a3p.setExternSheetIndex(newExtSheetIx);
                    ptgs[i] = a3p;
                } else if (ptg instanceof Ref3DPtg) {
                    Ref3DPtg r3p = (Ref3DPtg) ((OperandPtg) ptg).copy();
                    r3p.setExternSheetIndex(newExtSheetIx);
                    ptgs[i] = r3p;
                }
            }
            NameRecord newNameRecord = workbook.createBuiltInName(NameRecord.BUILTIN_FILTER_DB, newSheetIndex+1);
            newNameRecord.setNameDefinition(ptgs);
View Full Code Here

        //  all the ptgs give back the right things
        Ptg[] ptgs = fRecs[0].getParsedExpression();
        assertEquals(1, ptgs.length);
        assertTrue(ptgs[0] instanceof Ref3DPtg);

        Ref3DPtg ptg = (Ref3DPtg)ptgs[0];
        HSSFEvaluationWorkbook book = HSSFEvaluationWorkbook.create(stubHSSF);
        assertEquals("Sheet1!A1", ptg.toFormulaString(book));


        // Now check we get the right formula back for
        //  a few sample ones
        FormulaRecord fr;
View Full Code Here

    if (ptg instanceof AreaErrPtg ||ptg instanceof RefErrorPtg
        || ptg instanceof DeletedArea3DPtg || ptg instanceof DeletedRef3DPtg) {
        return ErrorEval.REF_INVALID;
    }
    if (ptg instanceof Ref3DPtg) {
      Ref3DPtg rptg = (Ref3DPtg) ptg;
      return ec.getRef3DEval(rptg.getRow(), rptg.getColumn(), rptg.getExternSheetIndex());
    }
    if (ptg instanceof Area3DPtg) {
      Area3DPtg aptg = (Area3DPtg) ptg;
      return ec.getArea3DEval(aptg.getFirstRow(), aptg.getFirstColumn(), aptg.getLastRow(), aptg.getLastColumn(), aptg.getExternSheetIndex());
    }
    if (ptg instanceof RefPtg) {
      RefPtg rptg = (RefPtg) ptg;
      return ec.getRefEval(rptg.getRow(), rptg.getColumn());
    }
    if (ptg instanceof AreaPtg) {
      AreaPtg aptg = (AreaPtg) ptg;
      return ec.getAreaEval(aptg.getFirstRow(), aptg.getFirstColumn(), aptg.getLastRow(), aptg.getLastColumn());
    }
View Full Code Here

      }
      RefPtg rptg = (RefPtg)ptg;
      return rowMoveRefPtg(rptg);
    }
    if(ptg instanceof Ref3DPtg) {
      Ref3DPtg rptg = (Ref3DPtg)ptg;
      if (_externSheetIndex != rptg.getExternSheetIndex()) {
        // only move 3D refs that refer to the sheet with cells being moved
        // (currentExternSheetIx is irrelevant)
        return null;
      }
      return rowMoveRefPtg(rptg);
View Full Code Here

  }

    private Ptg adjustPtgDueToShiftMove(Ptg ptg) {
        Ptg updatedPtg = null;
        if(ptg instanceof Ref3DPtg) {
            Ref3DPtg ref = (Ref3DPtg)ptg;
            if(ref.getExternSheetIndex() == _srcSheetIndex){
                ref.setExternSheetIndex(_dstSheetIndex);
                updatedPtg = ref;
            } else if (ref.getExternSheetIndex() == _dstSheetIndex){
                ref.setExternSheetIndex(_srcSheetIndex);
                updatedPtg = ref;
            }
        }
        return updatedPtg;
    }
View Full Code Here

  private static Ptg createDeletedRef(Ptg ptg) {
    if (ptg instanceof RefPtg) {
      return new RefErrorPtg();
    }
    if (ptg instanceof Ref3DPtg) {
      Ref3DPtg rptg = (Ref3DPtg) ptg;
      return new DeletedRef3DPtg(rptg.getExternSheetIndex());
    }
    if (ptg instanceof AreaPtg) {
      return new AreaErrPtg();
    }
    if (ptg instanceof Area3DPtg) {
View Full Code Here

            if (ptg instanceof Area3DPtg) {
                Area3DPtg a3p = (Area3DPtg) ((OperandPtg) ptg).copy();
                a3p.setExternSheetIndex(newExtSheetIx);
                ptgs[i] = a3p;
            } else if (ptg instanceof Ref3DPtg) {
                Ref3DPtg r3p = (Ref3DPtg) ((OperandPtg) ptg).copy();
                r3p.setExternSheetIndex(newExtSheetIx);
                ptgs[i] = r3p;
            }
        }
        NameRecord newNameRecord = createBuiltInName(NameRecord.BUILTIN_FILTER_DB, newSheetIndex+1);
        newNameRecord.setNameDefinition(ptgs);
View Full Code Here

            if (evaluationName.getNameDefinition().length > 1) {
               throw new RuntimeException("Complex name formulas not supported yet");
            }
            Ptg ptg = evaluationName.getNameDefinition()[0];
            if(ptg instanceof Ref3DPtg){
               Ref3DPtg ref3D = (Ref3DPtg)ptg;
               int sheetIndex = refWorkbookEvaluator.getSheetIndexByExternIndex(ref3D.getExternSheetIndex());
               String sheetName = refWorkbookEvaluator.getSheetName(sheetIndex);
               SheetRefEvaluator sre = createExternSheetRefEvaluator(workbookName, sheetName);
               return new LazyRefEval(ref3D.getRow(), ref3D.getColumn(), sre);
            }else if(ptg instanceof Area3DPtg){
               Area3DPtg area3D = (Area3DPtg)ptg;
               int sheetIndex = refWorkbookEvaluator.getSheetIndexByExternIndex(area3D.getExternSheetIndex());
               String sheetName = refWorkbookEvaluator.getSheetName(sheetIndex);
               SheetRefEvaluator sre = createExternSheetRefEvaluator(workbookName, sheetName);
View Full Code Here

    //  all the ptgs give back the right things
    Ptg[] ptgs = fRecs[0].getParsedExpression();
    assertEquals(1, ptgs.length);
    assertTrue(ptgs[0] instanceof Ref3DPtg);

    Ref3DPtg ptg = (Ref3DPtg)ptgs[0];
    HSSFEvaluationWorkbook book = HSSFEvaluationWorkbook.create(stubHSSF);
    assertEquals("Sheet1!A1", ptg.toFormulaString(book));


    // Now check we get the right formula back for
    //  a few sample ones
    FormulaRecord fr;
View Full Code Here

TOP

Related Classes of org.apache.poi.ss.formula.ptg.Ref3DPtg

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.