Package org.formulacompiler.spreadsheet.internal

Examples of org.formulacompiler.spreadsheet.internal.CellIndex


    return sb.toString();
  }

  private static void appendRangeRef( final StringBuilder _sb, final Range _range, final int _sheetIndex )
  {
    final CellIndex cellFrom = (CellIndex) _range.getTopLeft();
    final CellIndex cellTo = (CellIndex) _range.getBottomRight();
    if (_sheetIndex != cellFrom.getSheetIndex() || _sheetIndex != cellTo.getSheetIndex()) {
      if (cellFrom.getSheetIndex() != cellTo.getSheetIndex()) {
        final String fromSheetName = cellFrom.getSheet().getName();
        final String toSheetName = cellTo.getSheet().getName();
        final boolean quoted = needsQuotes( fromSheetName ) || needsQuotes( toSheetName );
        if (quoted) _sb.append( QUOTE );
        _sb.append( escapeSheetName( fromSheetName ) );
        _sb.append( RANGE_SEPARATOR );
        _sb.append( escapeSheetName( toSheetName ) );
        if (quoted) _sb.append( QUOTE );
      }
      else {
        final String sheetName = cellFrom.getSheet().getName();
        final boolean quoted = needsQuotes( sheetName );
        if (quoted) _sb.append( QUOTE );
        _sb.append( escapeSheetName( sheetName ) );
        if (quoted) _sb.append( QUOTE );
      }
      _sb.append( SHEET_NAME_SEPARATOR );
    }
    CellIndex.appendNameA1ForCellIndex( _sb, cellFrom );
    if (cellFrom.getColumnIndex() != cellTo.getColumnIndex() ||
        cellFrom.getRowIndex() != cellTo.getRowIndex()) {
      _sb.append( RANGE_SEPARATOR );
      CellIndex.appendNameA1ForCellIndex( _sb, cellTo );
    }
  }
View Full Code Here


      final String name = expressionNodeForCell.getName();
      if (name != null) {
        _stringBuilder.append( name );
      }
      else {
        final CellIndex cellIndex = expressionNodeForCell.getCellIndex();
        _stringBuilder.append( '[' );
        RefFormatter.append( _stringBuilder, cellIndex, _baseCell );
        _stringBuilder.append( ']' );
      }
    }
View Full Code Here

  }

  @Override
  protected final Object makeCell( Token _cell, Object _baseCell )
  {
    final CellIndex relativeTo = _baseCell != null ? (CellIndex) _baseCell : this.cellIndex;
    return CellRefParser.R1C1.getCellIndexForCanonicalName( _cell.image, relativeTo );
  }
View Full Code Here

  protected SpreadsheetExpressionParser( String _exprText, BaseSpreadsheet _workbook, CellRefFormat _cellRefFormat )
  {
    super( _exprText, _cellRefFormat );
    this.workbook = _workbook;
    this.cellIndex = new CellIndex( _workbook, CellAddressImpl.BROKEN_REF, CellAddressImpl.BROKEN_REF, CellAddressImpl.BROKEN_REF );
  }
View Full Code Here

  protected final ExpressionNode makeNamedRangeRef( Token _name )
  {
    final String name = _name.image;
    final CellRange range = parseNamedRef( name );
    if (range instanceof CellIndex) {
      final CellIndex cell = (CellIndex) range;
      return new ExpressionNodeForCell( cell, name );
    }
    else {
      return new ExpressionNodeForRange( range, name );
    }
View Full Code Here

  @Override
  protected final ExpressionNode makeNodeForReference( Object _reference )
  {
    if (_reference instanceof CellIndex) {
      final CellIndex cell = (CellIndex) _reference;
      return new ExpressionNodeForCell( cell );
    }
    else if (_reference instanceof CellRange) {
      final CellRange range = (CellRange) _reference;
      return new ExpressionNodeForRange( range );
View Full Code Here

    }
    else if (!_allowRanges && node instanceof ExpressionNodeForRange) {
      try {
        final ExpressionNodeForRange nodeForRange = (ExpressionNodeForRange) node;
        final CellRange range = nodeForRange.getRange();
        final CellIndex cell = range.getCellIndexRelativeTo( this.cellIndex );
        _nodeSource.setExpressionNode( new ExpressionNodeForCell( cell, nodeForRange.getName() ) );
      } catch (SpreadsheetException e) {
        throw new InnerParserException( e );
      }
    }
View Full Code Here

  }

  @Override
  protected Object makeCell( final Token _cell, final Object _baseCell )
  {
    final CellIndex relativeTo = _baseCell != null ? (CellIndex) _baseCell : this.cellIndex;
    return CellRefParser.A1.parseCellA1ODF( _cell.image, relativeTo );
  }
View Full Code Here

    else if (_exprDef instanceof ExpressionNodeForConstantValue) {
      final ExpressionNodeForConstantValue cst = (ExpressionNodeForConstantValue) _exprDef;
      return new ExpressionNodeForConstantValue( adjustConstantValue( cst.value() ) );
    }
    else if (_exprDef instanceof ExpressionNodeForCell) {
      final CellIndex cell = ((ExpressionNodeForCell) _exprDef).getCellIndex();
      return buildExpressionModelForCell( cell );
    }
    else if (_exprDef instanceof ExpressionNodeForRangeShape) {
      final ExpressionNode expressionNode = _exprDef.arguments().get( 0 );
      final CellRange range;
View Full Code Here

      super();
      this.parent = _parent;
      this.range = _range;
      this.shaped = _shaped;
      this.stepOutOnly = _stepOutOnly;
      final CellIndex from = range.getFrom();
      final CellIndex to = range.getTo();
      this.sheets = to.getSheetIndex() - from.getSheetIndex() + 1;
      this.rows = to.getRowIndex() - from.getRowIndex() + 1;
      this.cols = to.getColumnIndex() - from.getColumnIndex() + 1;
    }
View Full Code Here

TOP

Related Classes of org.formulacompiler.spreadsheet.internal.CellIndex

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.