Beispiel #1
0
 private static AreaReference CreateAreaRef(SimpleRangePart part1, SimpleRangePart part2)
 {
     if (!part1.IsCompatibleForArea(part2))
     {
         throw new FormulaParseException("has incompatible parts: '"
                 + part1.Rep + "' and '" + part2.Rep + "'.");
     }
     if (part1.IsRow)
     {
         return AreaReference.GetWholeRow(part1.Rep, part2.Rep);
     }
     if (part1.IsColumn)
     {
         return AreaReference.GetWholeColumn(part1.Rep, part2.Rep);
     }
     return new AreaReference(part1.getCellReference(), part2.getCellReference());
 }
Beispiel #2
0
 /**
  * @return <c>true</c> if the two range parts can be combined in an
  * {@link AreaPtg} ( Note - the explicit range operator (:) may still be valid
  * when this method returns <c>false</c> )
  */
 public bool IsCompatibleForArea(SimpleRangePart part2)
 {
     return _type == part2._type;
 }
Beispiel #3
0
        /**
 *
 * @param sheetIden may be <code>null</code>
 * @param part1
 * @param part2 may be <code>null</code>
 */
        private ParseNode CreateAreaRefParseNode(SheetIdentifier sheetIden, SimpleRangePart part1,
                SimpleRangePart part2)
        {

            int extIx;
            if (sheetIden == null)
            {
                extIx = Int32.MinValue;
            }
            else
            {
                String sName = sheetIden.SheetID.Name;
                if (sheetIden.BookName == null)
                {
                    extIx = _book.GetExternalSheetIndex(sName);
                }
                else
                {
                    extIx = _book.GetExternalSheetIndex(sheetIden.BookName, sName);
                }
            }
            Ptg ptg;
            if (part2 == null)
            {
                CellReference cr = part1.getCellReference();
                if (sheetIden == null)
                {
                    ptg = new RefPtg(cr);
                }
                else
                {
                    ptg = new Ref3DPtg(cr, extIx);
                }
            }
            else
            {
                AreaReference areaRef = CreateAreaRef(part1, part2);

                if (sheetIden == null)
                {
                    ptg = new AreaPtg(areaRef);
                }
                else
                {
                    ptg = new Area3DPtg(areaRef, extIx);
                }
            }
            return new ParseNode(ptg);
        }
Beispiel #4
0
        /**
         *
         * @param sheetIden may be <code>null</code>
         * @param part1
         * @param part2 may be <code>null</code>
         */
        private ParseNode CreateAreaRefParseNode(SheetIdentifier sheetIden, SimpleRangePart part1,
                SimpleRangePart part2)
        {
            Ptg ptg;
            if (part2 == null)
            {
                CellReference cr = part1.CellReference;
                if (sheetIden == null)
                {
                    ptg = new RefPtg(cr);
                }
                else
                {
                    ptg = _book.Get3DReferencePtg(cr, sheetIden);
                }
            }
            else
            {
                AreaReference areaRef = CreateAreaRef(part1, part2);

                if (sheetIden == null)
                {
                    ptg = new AreaPtg(areaRef);
                }
                else
                {
                    ptg = _book.Get3DReferencePtg(areaRef, sheetIden);
                }
            }
            return new ParseNode(ptg);
        }