Beispiel #1
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);
        }
 public Ptg Get3DReferencePtg(CellReference cr, SheetIdentifier sheet)
 {
     int extIx = GetSheetExtIx(sheet);
     return new Ref3DPtg(cr, extIx);
 }
 public Ptg Get3DReferencePtg(AreaReference areaRef, SheetIdentifier sheet)
 {
     int extIx = GetSheetExtIx(sheet);
     return new Area3DPtg(areaRef, extIx);
 }
 public Ptg GetNameXPtg(String name, SheetIdentifier sheet)
 {
     int sheetRefIndex = GetSheetExtIx(sheet);
     return _iBook.GetNameXPtg(name, sheetRefIndex, _uBook.GetUDFFinder());
 }
        private int GetSheetExtIx(SheetIdentifier sheetIden)
        {
            int extIx;
            if (sheetIden == null)
            {
                extIx = -1;
            }
            else
            {
                String workbookName = sheetIden.BookName;
                String firstSheetName = sheetIden.SheetId.Name;
                String lastSheetName = firstSheetName;

                if (sheetIden is SheetRangeIdentifier)
                {
                    lastSheetName = ((SheetRangeIdentifier)sheetIden).LastSheetIdentifier.Name;
                }

                if (workbookName == null)
                {
                    int firstSheetIndex = _uBook.GetSheetIndex(firstSheetName);
                    int lastSheetIndex = _uBook.GetSheetIndex(lastSheetName);
                    extIx = _iBook.checkExternSheet(firstSheetIndex, lastSheetIndex);
                }
                else
                {
                    extIx = _iBook.GetExternalSheetIndex(workbookName, firstSheetName, lastSheetName);
                }
            }
            return extIx;
        }
Beispiel #6
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);
        }
Beispiel #7
0
 private int GetSheetExtIx(SheetIdentifier sheetIden)
 {
     int extIx;
     if (sheetIden == null)
     {
         extIx = int.MaxValue;
     }
     else
     {
         String sName = sheetIden.SheetId.Name;
         if (sheetIden.BookName == null)
         {
             extIx = _book.GetExternalSheetIndex(sName);
         }
         else
         {
             extIx = _book.GetExternalSheetIndex(sheetIden.BookName, sName);
         }
     }
     return extIx;
 }
 public Ptg Get3DReferencePtg(AreaReference area, SheetIdentifier sheet)
 {
     if (sheet._bookName != null)
     {
         int bookIndex = ResolveBookIndex(sheet._bookName);
         return new Area3DPxg(bookIndex, sheet, area);
     }
     else
     {
         return new Area3DPxg(sheet, area);
     }
 }
 public Ptg Get3DReferencePtg(CellReference cell, SheetIdentifier sheet)
 {
     if (sheet._bookName != null)
     {
         int bookIndex = ResolveBookIndex(sheet._bookName);
         return new Ref3DPxg(bookIndex, sheet, cell);
     }
     else
     {
         return new Ref3DPxg(sheet, cell);
     }
 }
        public Ptg GetNameXPtg(String name, SheetIdentifier sheet)
        {
            IndexedUDFFinder udfFinder = (IndexedUDFFinder)GetUDFFinder();
            FreeRefFunction func = udfFinder.FindFunction(name);
            if (func != null)
            {
                return new NameXPxg(null, name);
            }

            // Otherwise, try it as a named range
            if (sheet == null)
            {
                if (_uBook.GetNameIndex(name) > -1)
                {
                    return new NameXPxg(null, name);
                }
                return null;
            }
            if (sheet._sheetIdentifier == null)
            {
                // Workbook + Named Range only
                int bookIndex = ResolveBookIndex(sheet._bookName);
                return new NameXPxg(bookIndex, null, name);
            }

            // Use the sheetname and process
            String sheetName = sheet._sheetIdentifier.Name;

            if (sheet._bookName != null)
            {
                int bookIndex = ResolveBookIndex(sheet._bookName);
                return new NameXPxg(bookIndex, sheetName, name);
            }
            else
            {
                return new NameXPxg(sheetName, name);
            }
        }