Пример #1
0
        public override NSView GetViewForItem(NSTableView tableView, NSTableColumn tableColumn, int row, NSObject obj, Func <NSObject, int, object> getItem)
        {
            var view = tableView.MakeView(tableColumn.Identifier, tableView) as CellView;

            if (view == null)
            {
                view      = new CellView();
                view.Cell = new EtoLabelFieldCell {
                    VerticalAlignment = VerticalAlignment.Center
                };
                view.Identifier       = tableColumn.Identifier;
                view.Selectable       = false;
                view.DrawsBackground  = false;
                view.Bezeled          = false;
                view.Bordered         = false;
                view.AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable;

                view.Cell.Wraps              = false;
                view.Cell.Scrollable         = true;
                view.Cell.UsesSingleLineMode = true;
                var col = Array.IndexOf(tableView.TableColumns(), tableColumn);
                view.BecameFirstResponder += (sender, e) =>
                {
                    var control = (CellView)sender;
                    var r       = (int)control.Tag;
                    var item    = getItem(control.Item, r);
                    var ee      = new GridViewCellEventArgs(ColumnHandler.Widget, r, (int)col, item);
                    ColumnHandler.DataViewHandler.Callback.OnCellEditing(ColumnHandler.DataViewHandler.Widget, ee);
                };
                view.EditingEnded += (sender, e) =>
                {
                    var notification = (NSNotification)sender;
                    var control      = (CellView)notification.Object;
                    var r            = (int)control.Tag;
                    var item         = getItem(control.Item, r);
                    SetObjectValue(item, control.ObjectValue);

                    var ee = new GridViewCellEventArgs(ColumnHandler.Widget, r, (int)col, item);
                    ColumnHandler.DataViewHandler.Callback.OnCellEdited(ColumnHandler.DataViewHandler.Widget, ee);
                    control.ObjectValue = GetObjectValue(item);
                };
                view.ResignedFirstResponder += (sender, e) =>
                {
                    var control = (CellView)sender;
                    var r       = (int)control.Tag;
                    var item    = getItem(control.Item, r);
                    SetObjectValue(item, control.ObjectValue);

                    var ee = new GridViewCellEventArgs(ColumnHandler.Widget, r, (int)col, item);
                    ColumnHandler.DataViewHandler.Callback.OnCellEdited(ColumnHandler.DataViewHandler.Widget, ee);
                };
                view.Bind("editable", tableColumn, "editable", null);
            }
            view.Item = obj;
            view.Tag  = row;
            var args = new MacCellFormatArgs(ColumnHandler.Widget, getItem(obj, row), row, view);

            ColumnHandler.DataViewHandler.OnCellFormatting(args);
            return(view);
        }
Пример #2
0
        public override NSView GetViewForItem(NSTableView tableView, NSTableColumn tableColumn, int row, NSObject obj, Func <NSObject, int, object> getItem)
        {
            var view = tableView.MakeView(tableColumn.Identifier, tableView) as CellView;

            if (view == null)
            {
                view = new CellView {
                    Title = string.Empty
                };
                view.Identifier = tableColumn.Identifier;
                view.SetButtonType(NSButtonType.Switch);
                view.Bind("enabled", tableColumn, "editable", null);

                var col = Array.IndexOf(tableView.TableColumns(), tableColumn);
                view.Activated += (sender, e) =>
                {
                    var control = (CellView)sender;
                    var r       = (int)control.Tag;
                    var item    = getItem(control.Item, r);
                    var ee      = new GridViewCellEventArgs(ColumnHandler.Widget, r, col, item);
                    ColumnHandler.DataViewHandler.Callback.OnCellEditing(ColumnHandler.DataViewHandler.Widget, ee);
                    SetObjectValue(item, control.ObjectValue);
                    control.ObjectValue = GetObjectValue(item);

                    ColumnHandler.DataViewHandler.Callback.OnCellEdited(ColumnHandler.DataViewHandler.Widget, ee);
                };
            }
            view.Tag  = row;
            view.Item = obj;
            var args = new MacCellFormatArgs(ColumnHandler.Widget, getItem(obj, row), row, view);

            ColumnHandler.DataViewHandler.OnCellFormatting(args);
            return(view);
        }
Пример #3
0
    private Vector2 GetMoveToPositionOf(CellView cellView)
    {
        float posX = cellView.gameObject.GetComponentInParent <Transform>().transform.position.x;
        float posY = cellView.transform.position.y;

        return(new Vector2(posX, posY));
    }
Пример #4
0
        private void CreateCellEntity(Vector3Int position, CellView cellView)
        {
            var cellEntity = _world.NewEntity();

            cellEntity.Get <CellViewRef>().Value = cellView;
            cellEntity.Get <Position>().value    = position;
        }
Пример #5
0
        public void Run()
        {
            if (!Input.GetMouseButtonDown(0))
            {
                return;
            }

            Vector3      mousePos   = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            Vector2      mousePos2D = new Vector2(mousePos.x, mousePos.y);
            RaycastHit2D hit        = Physics2D.Raycast(mousePos2D, Vector2.zero);

            if (hit.collider == null)
            {
                return;
            }

            CellView cellView = hit.collider.GetComponent <CellView>();

            if (cellView == null)
            {
                return;
            }

            cellView.Entity.Set <SelectCellAnimationRequest>();
            cellView.Entity.Set <Selected>();
        }
Пример #6
0
        public void Test_Construct(int eNodebId, byte sectorId, bool outdoor, string indoor,
                                   double height, double eTilt, double mTilt, int tac)
        {
            var cell = new Cell
            {
                ENodebId  = eNodebId,
                SectorId  = sectorId,
                IsOutdoor = outdoor,
                Height    = height,
                ETilt     = eTilt,
                MTilt     = mTilt,
                Tac       = tac
            };
            var view = CellView.ConstructView(cell, _repository.Object);

            if (eNodebId > 0 && eNodebId <= 3)
            {
                Assert.AreEqual(view.ENodebName, "ENodeb-" + eNodebId);
            }
            else
            {
                Assert.IsNull(view.ENodebName);
            }
            Assert.AreEqual(view.ENodebId, eNodebId);
            Assert.AreEqual(view.SectorId, sectorId);
            Assert.AreEqual(view.Indoor, indoor);
            Assert.AreEqual(view.Height, height);
            Assert.AreEqual(view.DownTilt, eTilt + mTilt);
            Assert.AreEqual(view.Tac, tac);
        }
Пример #7
0
        static NSCell CreateCell(NSTableView table, CompositeCell source, CellView cell, int column)
        {
            ICellRenderer cr = null;

            if (cell is ITextCellViewFrontend)
            {
                cr = new TextTableCell();
            }
            else if (cell is IImageCellViewFrontend)
            {
                cr = new ImageTableCell();
            }
            else if (cell is ICanvasCellViewFrontend)
            {
                cr = new CanvasTableCell();
            }
            else if (cell is ICheckBoxCellViewFrontend)
            {
                cr = new CheckBoxTableCell();
            }
            else
            {
                throw new NotImplementedException();
            }
            cr.Backend = new CellViewBackend(table, column);
            ICellViewFrontend fr = cell;

            fr.AttachBackend(null, cr.Backend);
            return((NSCell)cr);
        }
Пример #8
0
    private void drawline(Vector2Int dest)
    {
        List <Vector3Int> lines = DrawCoordsLine.GetCubeLine(Coords.odd_r_to_cube(SelectedEntity.CurrentPoint), Coords.odd_r_to_cube(dest));

        foreach (Vector3Int cube in lines)
        {
            Vector2Int point    = Coords.cube_to_odd_r(cube);
            CellView   cellview = GameCore.GetRegistServices <MapController>().GetCellView(point);
            if (cellview != null)
            {
                Vector3 v = cellview.transform.position;
                v.y = 10;
                cellview.transform.position = v;
            }
        }
        GameTimer.AwaitSeconds(3, () =>
        {
            foreach (Vector3Int cube in lines)
            {
                Vector2Int point  = Coords.cube_to_odd_r(cube);
                CellView cellview = GameCore.GetRegistServices <MapController>().GetCellView(point);
                if (cellview != null)
                {
                    Vector3 v = cellview.transform.position;
                    v.y       = 0;
                    cellview.transform.position = v;
                }
            }
        });
    }
Пример #9
0
        public IEnumerable <SectorView> QuerySectors(SectorRangeContainer container)
        {
            var cells =
                _repository.GetAllList(container.West, container.East, container.South, container.North)
                .Where(x => x.IsInUse).ToList();

            if (container.ExcludedCells.Any())
            {
                var excludeCells = from cell in cells
                                   join sector in container.ExcludedCells on new
                {
                    CellId = cell.ENodebId,
                    cell.SectorId
                } equals new
                {
                    sector.CellId,
                    sector.SectorId
                }
                select cell;
                cells = cells.Except(excludeCells).ToList();
            }

            return(cells.Any()
                ? Mapper.Map <IEnumerable <CellView>, IEnumerable <SectorView> >(
                       cells.Select(x => CellView.ConstructView(x, _eNodebRepository)))
                : new List <SectorView>());
        }
Пример #10
0
 internal static FrameworkElement CreateCellRenderer(TreeNode node, CellView view)
 {
     if (view is TextCellView)
     {
         DataField field = ((TextCellView) view).TextField;
         int index = field.Index;
         SWC.TextBlock label = new SWC.TextBlock ();
         label.Text = (node.Values[index] ?? "null").ToString();
         label.Padding = new Thickness(2);
         return label;
     }
     else if (view is ImageCellView)
     {
         DataField field = ((ImageCellView)view).ImageField;
         int index = field.Index;
         SWM.ImageSource image = (SWM.ImageSource) WidgetRegistry.GetBackend(node.Values[index]);
         SWC.Image imageCtrl = new SWC.Image
         {
             Source = image,
             Width = image.Width,
             Height = image.Height
         };
         return imageCtrl;
     }
     throw new NotImplementedException ();
 }
Пример #11
0
        private async void CellClicked(object sender, EventArgs e)
        {
            CellView clickedCell = (CellView)sender;

            if (!clickedCell.model.resolved && game.MovePossible(clickedCell.model) && game.IsPlayerTurn())
            {
                resetBackColor(cellBackground);
                game.PlayMove(clickedCell.model);
                roundPictureBox4.Show();
                roundPictureBox1.Hide();

                resetBackColor(cellBackground);
                CheckWin();

                if (!game.IsPlayerTurn())
                {
                    UseWaitCursor = true;
                    label1.Show();
                    int moveIndeks = await Task.Run(() => game.minmax.GetTurn());

                    game.PlayMove(game.currPossibleMoves[moveIndeks]);
                    label1.Hide();
                    UseWaitCursor = false;
                    roundPictureBox4.Hide();
                    roundPictureBox1.Show();

                    CheckWin();
                }
            }
        }
Пример #12
0
 internal static FrameworkElement CreateCellRenderer(TreeNode node, CellView view)
 {
     if (view is TextCellView)
     {
         DataField     field = ((TextCellView)view).TextField;
         int           index = field.Index;
         SWC.TextBlock label = new SWC.TextBlock();
         label.Text    = (node.Values[index] ?? "null").ToString();
         label.Padding = new Thickness(2);
         return(label);
     }
     else if (view is ImageCellView)
     {
         DataField       field     = ((ImageCellView)view).ImageField;
         int             index     = field.Index;
         SWM.ImageSource image     = (SWM.ImageSource)WidgetRegistry.GetBackend(node.Values[index]);
         SWC.Image       imageCtrl = new SWC.Image
         {
             Source = image,
             Width  = image.Width,
             Height = image.Height
         };
         return(imageCtrl);
     }
     throw new NotImplementedException();
 }
Пример #13
0
    public List <CellView> GenerateCellViews(GridModel gridModel, Action <CellView, CellView> OnSelectedTwoCell)
    {
        cellsUI = FindObjectsOfType <CellView>().ToList();
        if (cellsUI != null)
        {
            foreach (var cell in cellsUI)
            {
                Destroy(cell.gameObject);
            }
        }

        if (ClickController)
        {
            //Debug.Log("ClickController");
        }
        ClickController.OnSelectedTwoCell = OnSelectedTwoCell;

        cellsUI = new List <CellView>();
        for (int index = 0; index < gridModel.Size; index++)
        {
            CellView cellView = CreateCellView(gridModel.GetCellByIndex(index));
            cellsUI.Add(cellView);
        }

        return(cellsUI);
    }
Пример #14
0
        internal static FrameworkElementFactory CreateBoundCellRenderer(CellView view, string dataPath = ".")
        {
            TextCellView textView = view as TextCellView;
            if (textView != null) {
                FrameworkElementFactory factory = new FrameworkElementFactory (typeof (SWC.TextBlock));
                factory.SetValue (FrameworkElement.MarginProperty, CellMargins);

                if (textView.TextField != null)
                    factory.SetBinding (SWC.TextBlock.TextProperty, new Binding (dataPath + "[" + textView.TextField.Index + "]"));

                return factory;
            }

            ImageCellView imageView = view as ImageCellView;
            if (imageView != null) {
                FrameworkElementFactory factory = new FrameworkElementFactory (typeof (ImageBox));
                factory.SetValue (FrameworkElement.MarginProperty, CellMargins);

                if (imageView.ImageField != null) {
                    var binding = new Binding (dataPath + "[" + imageView.ImageField.Index + "]")
                    { Converter = new ImageToImageSourceConverter () };

                    factory.SetBinding (ImageBox.ImageSourceProperty, binding);
                }

                return factory;
            }

            throw new NotImplementedException ();
        }
Пример #15
0
 public void Run()
 {
     foreach (var index in _filter)
     {
         CellView view = _filter.Get1(index).View;
         _pool.Stash(view);
     }
 }
 public CellViewModel(CellView v, ICell cell = null)
 {
     ChangeCellStateCommand = new DelegateCommand(ChangeCellState, CanChangeCellState);
     if (cell != null)
     {
         Cell = cell;
     }
 }
Пример #17
0
 public void SetCellBackground(CellView view, bool isRevealed, bool isMarked)
 {
     view.backgroundSprite.color = isRevealed
         ? colorSheet.revealedCellColor
         : isMarked
             ? colorSheet.flaggedCellColor
             : colorSheet.unrevealedCellColor;
 }
Пример #18
0
 public static NSCell CreateCell(ICellSource source, CellView cell)
 {
     if (cell is TextCellView)
         return new TextTableCell ((TextCellView) cell);
     if (cell is ImageCellView)
         return new ImageTableCell ((ImageCellView) cell);
     throw new NotImplementedException ();
 }
Пример #19
0
    private void CreateBonusApplier(CellView cell)
    {
        var bonusApplierPrefab = _gameElementHolder.GetBonusApplier(cell.Cell.CellBonus.Type);
        var bonusApplier       = Instantiate(bonusApplierPrefab, _parentForGameElement);

        bonusApplier.transform.localPosition = cell.transform.localPosition;
        bonusApplier.Apply();
    }
Пример #20
0
 public GridModel(GridScriptableObject gridSO)
 {
     noOfRows       = gridSO.noOfRows;
     noOfColumns    = gridSO.noOfColumns;
     cellGap        = gridSO.cellGap;
     cellPrefab     = gridSO.cellPrefab;
     isCircularGrid = gridSO.isCircularGrid;
 }
Пример #21
0
    public void Init()
    {
        cellView             = GetComponent <CellView>();
        cellView.CountOfCell = CountOfCell;
        cellView.CellAtIndex = CellAtIndex;

        cellView.Init();
    }
Пример #22
0
        public IEnumerable <CellView> GetCellViews(int eNodebId)
        {
            var cells = _repository.GetAllList(eNodebId);

            return(cells.Any()
                ? cells.Select(x => CellView.ConstructView(x, _eNodebRepository))
                : new List <CellView>());
        }
Пример #23
0
    private void OnSelectCell(CellView cell)
    {
        foreach (PieceDO pieceDo in _currentPool)
        {
            pieceDo.Checked            = false;
            pieceDo.Locked             = false;
            pieceDo.View.Cell.IsMarked = false;
        }

        _currentPool.Clear();
        _selectedType = cell.Piece.GetData.Type;

        if (_selectedType == PieceType.MAGIC_DIAMOND)
        {
            for (int i = 0; i < _config.GetGridWidth(); i++)
            {
                _currentPool.Add(_grid[i][0]);
            }

            for (int i = 1; i < _config.GetGridHeight(); i++)
            {
                _currentPool.Add(_grid[cell.Piece.GetData.Col][i]);
            }

            _currentPool.FindAll(x => x.View.Cell != cell && (x.Type == PieceType.FRIEND_DIAMOND || x.Type == PieceType.MAGIC_DIAMOND)).ForEach((x) => _currentPool.Remove(x));
        }
        else if (_selectedType == PieceType.FRIEND_DIAMOND)
        {
            CheckForMatches();
            List <PieceDO[]> matches = new List <PieceDO[]>(_matches);
            _currentPool.Add(cell.Piece.GetData);

            _coroutineCreator.StartCoroutine(AnimateFriendDiamonds(matches));

            return;
        }
        else
        {
            LookForMatches(cell, _selectedType);

            if (_currentPool.Count <= 2)
            {
                //TODO show this match has failed
                _gameView.AddDiamondProgress((int)DiamondBarState.Miss);
                foreach (var pieceDo in _currentPool)
                {
                    pieceDo.Checked            = false;
                    pieceDo.Locked             = false;
                    pieceDo.View.Cell.IsMarked = false;
                }

                _currentPool.Clear();
                return;
            }
        }

        SetMatch();
    }
Пример #24
0
        /**
         * Accessor for the image dimensions.  See technotes for Bill's explanation
         * of the calculation logic
         *
         * @return  approximate drawing size in pixels
         */
        private double getWidthInPoints()
        {
            if (sheet == null)
            {
                //logger.warn("calculating image width:  sheet is null");
                return(0);
            }

            // The start and end row numbers
            int firstCol = (int)x;
            int lastCol  = (int)Math.Ceiling(x + width) - 1;

            // **** MAGIC NUMBER ALERT ***
            // multiply the point size of the font by 0.59 to give the point size
            // I know of no explanation for this yet, other than that it seems to
            // give the right answer

            // Get the width of the image within the first col, allowing for
            // fractional offsets
            CellView cellView           = sheet.getColumnView(firstCol);
            int      firstColWidth      = cellView.getSize();
            double   firstColImageWidth = (1 - (x - firstCol)) * firstColWidth;
            double   pointSize          = (cellView.getFormat() != null) ?
                                          cellView.getFormat().getFont().getPointSize() : DEFAULT_FONT_SIZE;
            double firstColWidthInPoints = firstColImageWidth * 0.59 * pointSize / 256;

            // Get the height of the image within the last row, allowing for
            // fractional offsets
            int    lastColWidth         = 0;
            double lastColImageWidth    = 0;
            double lastColWidthInPoints = 0;

            if (lastCol != firstCol)
            {
                cellView          = sheet.getColumnView(lastCol);
                lastColWidth      = cellView.getSize();
                lastColImageWidth = (x + width - lastCol) * lastColWidth;
                pointSize         = (cellView.getFormat() != null) ?
                                    cellView.getFormat().getFont().getPointSize() : DEFAULT_FONT_SIZE;
                lastColWidthInPoints = lastColImageWidth * 0.59 * pointSize / 256;
            }

            // Now get all the columns in between
            double newWidth = 0;

            for (int i = 0; i < lastCol - firstCol - 1; i++)
            {
                cellView  = sheet.getColumnView(firstCol + 1 + i);
                pointSize = (cellView.getFormat() != null) ? cellView.getFormat().getFont().getPointSize() : DEFAULT_FONT_SIZE;
                newWidth += cellView.getSize() * 0.59 * pointSize / 256;
            }

            // Add on the first and last row contributions to get the height in twips
            double widthInPoints = newWidth +
                                   firstColWidthInPoints + lastColWidthInPoints;

            return(widthInPoints);
        }
        public override NSView GetViewForItem(NSTableView tableView, NSTableColumn tableColumn, int row, NSObject obj, Func <NSObject, int, object> getItem)
        {
            var view = tableView.MakeView(tableColumn.Identifier, tableView) as CellView;

            if (view == null)
            {
                view = new CellView
                {
                    WeakHandler = new WeakReference(this),
                    Identifier  = tableColumn.Identifier,
                };

                var col = Array.IndexOf(tableView.TableColumns(), tableColumn);
                view.BecameFirstResponder += (sender, e) =>
                {
                    var control = (CellView)sender;
                    var r       = (int)control.Tag;
                    var item    = getItem(control.Item, r);
                    var ee      = MacConversions.CreateCellEventArgs(ColumnHandler.Widget, tableView, r, col, item);
                    ColumnHandler.DataViewHandler.OnCellEditing(ee);
                };
                view.EditingEnded += (sender, e) =>
                {
                    var notification = (NSNotification)sender;
                    var control      = (CellView)notification.Object;
                    var r            = (int)control.Tag;
                    var item         = getItem(control.Item, r);
                    SetObjectValue(item, control.ObjectValue);

                    var ee = MacConversions.CreateCellEventArgs(ColumnHandler.Widget, tableView, r, col, item);
                    ColumnHandler.DataViewHandler.OnCellEdited(ee);
                    control.ObjectValue = GetObjectValue(item) ?? new NSString(string.Empty);
                };
                view.ResignedFirstResponder += (sender, e) =>
                {
                    var control = (CellView)sender;
                    var r       = (int)control.Tag;
                    var item    = getItem(control.Item, r);
                    SetObjectValue(item, control.ObjectValue);

                    var ee = MacConversions.CreateCellEventArgs(ColumnHandler.Widget, tableView, r, col, item);
                    ColumnHandler.DataViewHandler.OnCellEdited(ee);
                };
                view.Bind(editableBinding, tableColumn, "editable", null);
            }

            var cell = view.Cell;

            cell.VerticalAlignment = VerticalAlignment;
            cell.Alignment         = TextAlignment.ToNS();

            view.Item = obj;
            view.Tag  = row;
            var args = new MacCellFormatArgs(ColumnHandler.Widget, getItem(obj, row), row, view);

            ColumnHandler.DataViewHandler.OnCellFormatting(args);
            return(view);
        }
Пример #26
0
        public IEnumerable <SectorView> QuerySectors(double west, double east, double south, double north)
        {
            var cells = _repository.GetAllList(west, east, south, north);

            return(cells.Any()
                ? Mapper.Map <IEnumerable <CellView>, IEnumerable <SectorView> >(
                       cells.Select(x => CellView.ConstructView(x, _eNodebRepository)))
                : new List <SectorView>());
        }
Пример #27
0
		private void AddControlForView (CellView view)
		{
			FrameworkElement elem = CellUtil.CreateCellRenderer (Node, view);
			if (elem == null)
				return;
			
			DockPanel.Children.Add (elem);
			SWC.DockPanel.SetDock (elem, SWC.Dock.Left);
		}
Пример #28
0
 public void AddNewCellViews(List <CellModel> cellModels)
 {
     cellsUI = FindObjectsOfType <CellView>().ToList();
     for (int i = 0; i < cellModels.Count; i++)
     {
         CellView cellView = CreateCellView(cellModels[i]);
         cellsUI.Add(cellView);
     }
 }
Пример #29
0
        public IEnumerable <SectorView> QuerySectors(int eNodebId)
        {
            var cells = _repository.GetAllList(eNodebId);

            return(cells.Any()
                ? Mapper.Map <IEnumerable <CellView>, IEnumerable <SectorView> >(
                       cells.Select(x => CellView.ConstructView(x, _eNodebRepository)))
                : new List <SectorView>());
        }
Пример #30
0
        public IEnumerable <CellView> QueryByRruName(string rruName)
        {
            var rrus = _rruRepository.GetAllList(x => x.RruName.Contains(rruName));

            return(from rru in rrus
                   select _repository.FirstOrDefault(x => x.ENodebId == rru.ENodebId && x.LocalSectorId == rru.LocalSectorId)
                   into cell where cell != null
                   select CellView.ConstructView(cell, _eNodebRepository));
        }
Пример #31
0
        public CellController(Cell model, CellView view)
        {
            _model = model;
            _view  = view;

            _view.Initialize(_model);

            SubscribeEvents();
        }
Пример #32
0
    public Vector2 GetMoveDownPosition()
    {
        int x = playerPosition.x;
        int y = playerPosition.y + 1;

        CellView cellView = viewGrid[x, y];

        return(GetMoveToPositionOf(cellView));
    }
Пример #33
0
        public IEnumerable <SectorView> QuerySectorsInUse(int eNodebId)
        {
            var cells = _repository.GetAllInUseList().Where(x => x.ENodebId == eNodebId).ToList();

            return(cells.Any()
                ? Mapper.Map <IEnumerable <CellView>, IEnumerable <SectorView> >(
                       cells.Select(x => CellView.ConstructView(x, _eNodebRepository)))
                : new List <SectorView>());
        }
Пример #34
0
 public bool InputValue(CellView cellView, int value)
 {
     if (!sudokuInstance.IsValidInput(cellView.cell, value))
     {
         return(false);
     }
     cellView.cell.value = value;
     return(true);
 }
Пример #35
0
 static NSCell CreateCell(CompositeCell source, CellView cell)
 {
     if (cell is ITextCellViewFrontend)
         return new TextTableCell ((ITextCellViewFrontend) cell);
     if (cell is IImageCellViewFrontend)
         return new ImageTableCell ((IImageCellViewFrontend) cell);
     if (cell is ICanvasCellViewFrontend)
         return new CanvasTableCell ((ICanvasCellViewFrontend) cell);
     if (cell is ICheckBoxCellViewFrontend)
         return new CheckBoxTableCell ((ICheckBoxCellViewFrontend) cell);
     throw new NotImplementedException ();
 }
Пример #36
0
		static NSCell CreateCell (NSTableView table, CompositeCell source, CellView cell, int column)
		{
			ICellRenderer cr = null;

			if (cell is ITextCellViewFrontend)
				cr = new TextTableCell ();
			else if (cell is IImageCellViewFrontend)
				cr = new ImageTableCell ();
			else if (cell is ICanvasCellViewFrontend)
				cr = new CanvasTableCell ();
			else if (cell is ICheckBoxCellViewFrontend)
				cr = new CheckBoxTableCell ();
			else
				throw new NotImplementedException ();
			cr.Backend = new CellViewBackend (table, column);
			ICellViewFrontend fr = cell;
			fr.AttachBackend (null, cr.Backend);
			return (NSCell)cr;
		}
Пример #37
0
 public static Gtk.CellRenderer CreateCellRenderer(ICellRendererTarget col, object target, CellView view)
 {
     if (view is TextCellView) {
         Gtk.CellRendererText cr = new Gtk.CellRendererText ();
         col.PackStart (target, cr, false);
         col.AddAttribute (target, cr, "text", ((TextCellView)view).TextField.Index);
         return cr;
     }
     else if (view is CheckBoxCellView) {
         Gtk.CellRendererToggle cr = new Gtk.CellRendererToggle ();
         col.PackStart (target, cr, false);
         col.AddAttribute (target, cr, "active", ((CheckBoxCellView)view).ActiveField.Index);
         return cr;
     }
     else if (view is ImageCellView) {
         Gtk.CellRendererPixbuf cr = new Gtk.CellRendererPixbuf ();
         col.PackStart (target, cr, false);
         col.AddAttribute (target, cr, "pixbuf", ((ImageCellView)view).ImageField.Index);
         return cr;
     }
     throw new NotSupportedException ("Unknown cell view type: " + view.GetType ());
 }
Пример #38
0
        public Rectangle GetCellBounds(int row, CellView cell, bool includeMargin)
        {
            var col = GetCellColumn (cell);
            var cr = GetCellRenderer (cell);
            Gtk.TreePath path = new Gtk.TreePath (new [] { row });

            Gtk.TreeIter iter;
            if (!Widget.Model.GetIterFromString (out iter, path.ToString ()))
                return Rectangle.Zero;

            if (includeMargin)
                return ((ICellRendererTarget)this).GetCellBackgroundBounds (col, cr, iter);
            else
                return ((ICellRendererTarget)this).GetCellBounds (col, cr, iter);
        }
Пример #39
0
 public void StartEditingCell(int row, CellView cell)
 {
     var col = GetCellColumn (cell);
     if (col != null)
         Widget.SetCursor (new Gtk.TreePath (new [] { row }), col, true);
 }
Пример #40
0
        /**
         * Write out loads of labels, in order to test the shared string table
         */
        private void writeLabelsSheet(WritableSheet ws)
        {
            ws.getSettings().setProtected(true);
            ws.getSettings().setPassword("jxl");
            ws.getSettings().setVerticalFreeze(5);
            ws.getSettings().setDefaultRowHeight(25 * 20);

            WritableFont wf = new WritableFont(WritableFont.ARIAL, 12);
            wf.setItalic(true);

            WritableCellFormat wcf = new WritableCellFormat(wf);

            CellView cv = new CellView();
            cv.setSize(25 * 256);
            cv.setFormat(wcf);
            ws.setColumnView(0, cv);
            ws.setColumnView(1, 15);

            for (int i = 0; i < 61; i++)
                {
                Label l1 = new Label(0, i, "Common Label");
                Label l2 = new Label(1, i, "Distinct label number " + i);
                ws.addCell(l1);
                ws.addCell(l2);
                }

            // Frig this test record - it appears exactly on the boundary of an SST
            // continue record

            Label l3 = new Label(0, 61, "Common Label", wcf);
            Label l4 = new Label(1, 61, "1-1234567890", wcf);
            Label l5 = new Label(2, 61, "2-1234567890", wcf);
            ws.addCell(l3);
            ws.addCell(l4);
            ws.addCell(l5);

            for (int i = 62; i < 200; i++)
                {
                Label l1 = new Label(0, i, "Common Label");
                Label l2 = new Label(1, i, "Distinct label number " + i);
                ws.addCell(l1);
                ws.addCell(l2);
                }

            // Add in a last label which doesn't take the jxl.common.format
            wf = new WritableFont(WritableFont.TIMES, 10, WritableFont.BOLD);
            wf.setColour(Colour.RED);
            WritableCellFormat wcf2 = new WritableCellFormat(wf);
            wcf2.setWrap(true);
            Label l = new Label(0, 205, "Different format", wcf2);
            ws.addCell(l);

            // Add some labels to column 5 for autosizing
            Label l6 = new Label(5, 2, "A column for autosizing", wcf2);
            ws.addCell(l6);
            l6 = new Label(5, 4, "Another label, longer this time and " +
                           "in a different font");
            ws.addCell(l6);

            CellView cf = new CellView();
            cf.setAutosize(true);
            ws.setColumnView(5, cf);
        }
Пример #41
0
 public Rectangle GetCellBounds(int row, CellView cell, bool includeMargin)
 {
     throw new NotImplementedException();
 }
Пример #42
0
        internal static FrameworkElementFactory CreateBoundCellRenderer(CellView view, string dataPath = ".")
        {
            TextCellView textView = view as TextCellView;
            if (textView != null) {
                // if it's an editable textcontrol, use a TextBox, if not use a TextBlock. Reason for this is that
                // a user usually expects to be able to edit a text if a text cursor is appearing above a field.
                FrameworkElementFactory factory;
                if (textView.EditableField == null)
                {
                    if (textView.Editable)
                    {
                        factory = new FrameworkElementFactory(typeof(SWC.TextBox));
                        factory.SetValue(FrameworkElement.MarginProperty, CellMargins);
                        factory.SetValue(SWC.TextBox.IsReadOnlyProperty, false);
                        if (textView.TextField != null)
                        {
                            factory.SetBinding(SWC.TextBox.TextProperty, new Binding(dataPath + "[" + textView.TextField.Index + "]"));
                        }
                    }
                    else
                    {
                        factory = new FrameworkElementFactory(typeof(SWC.TextBlock));
                        factory.SetValue(FrameworkElement.MarginProperty, CellMargins);
                        if (textView.TextField != null)
                        {
                            factory.SetBinding(SWC.TextBlock.TextProperty, new Binding(dataPath + "[" + textView.TextField.Index + "]"));
                        }
                    }
                }
                else
                {
                    factory = new FrameworkElementFactory(typeof(SWC.TextBox));
                    factory.SetValue(FrameworkElement.MarginProperty, CellMargins);
                    factory.SetBinding(SWC.TextBox.IsEnabledProperty, new Binding(dataPath + "[" + textView.EditableField.Index + "]"));
                    if (textView.TextField != null)
                    {
                        factory.SetBinding(SWC.TextBox.TextProperty, new Binding(dataPath + "[" + textView.TextField.Index + "]"));
                    }
                }

                return factory;
            }

            ImageCellView imageView = view as ImageCellView;
            if (imageView != null) {
                FrameworkElementFactory factory = new FrameworkElementFactory (typeof (ImageBox));
                factory.SetValue (FrameworkElement.MarginProperty, CellMargins);

                if (imageView.ImageField != null) {
                    var binding = new Binding (dataPath + "[" + imageView.ImageField.Index + "]")
                    { Converter = new ImageToImageSourceConverter () };

                    factory.SetBinding (ImageBox.ImageSourceProperty, binding);
                }

                return factory;
            }

            CanvasCellView canvasView = view as CanvasCellView;
            if (canvasView != null)
            {
                FrameworkElementFactory factory = new FrameworkElementFactory(typeof(CanvasCellViewBackend));
                factory.SetValue(FrameworkElement.MarginProperty, CellMargins);

                factory.SetValue(CanvasCellViewBackend.CellViewProperty, view);

                return factory;
            }

            CheckBoxCellView cellView = view as CheckBoxCellView;
                    if (cellView != null)
                    {
                        FrameworkElementFactory factory = new FrameworkElementFactory(typeof(SWC.CheckBox));
                        if (cellView.EditableField == null)
                        {
                            factory.SetValue(FrameworkElement.IsEnabledProperty, cellView.Editable);
                        }
                        else
                        {
                            factory.SetBinding(SWC.CheckBox.IsEnabledProperty, new Binding(dataPath + "[" + cellView.EditableField.Index + "]"));
                        }

                        factory.SetValue(SWC.CheckBox.IsThreeStateProperty, cellView.AllowMixed);
                        factory.SetValue(FrameworkElement.MarginProperty, CellMargins);
                        if (cellView.ActiveField != null)
                        {
                                factory.SetBinding(SWC.CheckBox.IsCheckedProperty, new Binding(dataPath + "[" + cellView.ActiveField.Index + "]"));
                        }

                        return factory;
                    }

            throw new NotImplementedException ();
        }
Пример #43
0
        internal static FrameworkElementFactory CreateBoundCellRenderer(ApplicationContext ctx, Widget parent, CellView view, string dataPath = ".")
        {
            ICellViewFrontend fr = view;
            TextCellView textView = view as TextCellView;
            if (textView != null) {
                // if it's an editable textcontrol, use a TextBox, if not use a TextBlock. Reason for this is that
                // a user usually expects to be able to edit a text if a text cursor is appearing above a field.
                FrameworkElementFactory factory;
                if (textView.Editable || textView.EditableField != null)
                {
                    factory = new FrameworkElementFactory(typeof(SWC.TextBox));
                    if (textView.Editable)
                        factory.SetValue(SWC.TextBox.IsReadOnlyProperty, false);
                    else
                        factory.SetBinding(SWC.TextBox.IsEnabledProperty, new Binding(dataPath + "[" + textView.EditableField.Index + "]"));

                    if (textView.TextField != null)
                        factory.SetBinding(SWC.TextBox.TextProperty, new Binding(dataPath + "[" + textView.TextField.Index + "]"));
                    else
                        factory.SetValue(SWC.TextBox.TextProperty, textView.Text);
                }
                else
                {
                    factory = new FrameworkElementFactory(typeof(SWC.TextBlock));

                    if (textView.MarkupField != null)
                        factory.SetBinding(SWC.TextBlock.TextProperty, new Binding(dataPath + "[" + textView.MarkupField.Index + "]") { Converter = new MarkupToPlainTextConverter () });
                    else if (textView.TextField != null)
                        factory.SetBinding(SWC.TextBlock.TextProperty, new Binding(dataPath + "[" + textView.TextField.Index + "]"));
                    else
                        factory.SetValue(SWC.TextBlock.TextProperty, textView.Text);
                }

                var cb = new CellViewBackend();
                cb.Initialize(view, factory);
                fr.AttachBackend(parent, cb);
                return factory;
            }

            ImageCellView imageView = view as ImageCellView;
            if (imageView != null) {
                FrameworkElementFactory factory = new FrameworkElementFactory (typeof (ImageBox));

                if (imageView.ImageField != null) {
                    var binding = new Binding (dataPath + "[" + imageView.ImageField.Index + "]");
                    binding.Converter = new ImageToImageSourceConverter (ctx);

                    factory.SetBinding (ImageBox.ImageSourceProperty, binding);
                }

                var cb = new CellViewBackend();
                cb.Initialize(view, factory);
                fr.AttachBackend(parent, cb);
                return factory;
            }

            CanvasCellView canvasView = view as CanvasCellView;
            if (canvasView != null)
            {
                var cb = new CanvasCellViewBackend();
                FrameworkElementFactory factory = new FrameworkElementFactory(typeof(CanvasCellViewPanel));
                factory.SetValue(CanvasCellViewPanel.CellViewBackendProperty, cb);

                cb.Initialize(view, factory);
                fr.AttachBackend(parent, cb);
                return factory;
            }

            CheckBoxCellView cellView = view as CheckBoxCellView;
            if (cellView != null) {
                FrameworkElementFactory factory = new FrameworkElementFactory (typeof(SWC.CheckBox));
                if (cellView.EditableField == null)
                    factory.SetValue (FrameworkElement.IsEnabledProperty, cellView.Editable);
                else
                    factory.SetBinding (SWC.CheckBox.IsEnabledProperty, new Binding (dataPath + "[" + cellView.EditableField.Index + "]"));

                factory.SetValue (SWC.CheckBox.IsThreeStateProperty, cellView.AllowMixed);
                if (cellView.ActiveField != null)
                    factory.SetBinding (SWC.CheckBox.IsCheckedProperty, new Binding (dataPath + "[" + cellView.ActiveField.Index + "]"));

                var cb = new CellViewBackend ();
                cb.Initialize (view, factory);
                fr.AttachBackend (parent, cb);
                return factory;
            }

            throw new NotImplementedException ();
        }
Пример #44
0
 public void Initialize(CellView cellView, FrameworkElementFactory factory)
 {
     CellView = cellView;
 }
Пример #45
0
	public void SetCellView(CellView v, int layerOrder)
	{
		cellView = v;
		cellView.gameObject.name = id;
		cellView.gameObject.transform.localPosition = new Vector3(col, -row, 0);
		cellView.TintColor(color);
		cellView.SetLayerOrder(layerOrder);
	}
Пример #46
0
		public Rectangle GetCellBounds (TreePosition pos, CellView cell, bool includeMargin)
		{
			var col = GetCellColumn (cell);
			var cr = GetCellRenderer (cell);
			Gtk.TreeIter iter = ((IterPos)pos).Iter;

			var rect = includeMargin ? ((ICellRendererTarget)this).GetCellBackgroundBounds (col, cr, iter) : ((ICellRendererTarget)this).GetCellBounds (col, cr, iter);
			return rect;
		}
Пример #47
0
 public void StartEditingCell(int row, CellView cell)
 {
     // TODO
 }
Пример #48
0
 public static Gtk.Widget CreateCellRenderer(CellView view)
 {
     if (view is TextCellView) {
         Gtk.Label lab = new Gtk.Label ();
         lab.Xalign = 0;
     //				lab.Text = ((TextCellView)view).TextField;
         return lab;
     }
     throw new NotImplementedException ();
 }
Пример #49
0
        public Rectangle GetCellBounds(int row, CellView cell, bool includeMargin)
        {
            var col = GetCellColumn (cell);
            var cr = GetCellRenderer (cell);
            Gtk.TreePath path = new Gtk.TreePath (new [] { row });

            Gtk.TreeIter iter;
            if (!Widget.Model.GetIterFromString (out iter, path.ToString ()))
                return Rectangle.Zero;

            col.CellSetCellData (Widget.Model, iter, false, false);

            Gdk.Rectangle rect = includeMargin ? Widget.GetBackgroundArea (path, col) : Widget.GetCellArea (path, col);

            int x, y, w, h;
            col.CellGetPosition (cr, out x, out w);
            col.CellGetSize (rect, out x, out y, out w, out h);

            return new Rectangle (x, y, w, h);
        }
Пример #50
0
        public Rectangle GetCellBounds(int row, CellView cell, bool includeMargin)
        {
            ExListViewItem item = ListView.ItemContainerGenerator.ContainerFromIndex (row) as ExListViewItem;
            if (item == null)
                return Rectangle.Zero;

            // this works only if the wpf layout remains the same
            try {
                var stackpanel = VisualTreeHelper.GetChild (item, 0);
                var border = VisualTreeHelper.GetChild (stackpanel, 0);
                var grid = VisualTreeHelper.GetChild (border, 0);
                var rowpresenter = VisualTreeHelper.GetChild (grid, 1) as FrameworkElement;

                if (VisualTreeHelper.GetChildrenCount (rowpresenter) != view.Columns.Count)
                    return Rectangle.Zero;

                var colpresenter =  VisualTreeHelper.GetChild (rowpresenter, cellViews [cell].ColumnIndex) as FrameworkElement;
                var colchild =  VisualTreeHelper.GetChild (colpresenter, 0) as FrameworkElement;

                if (cellViews [cell].Column.Views.Count > 1 && colchild is System.Windows.Controls.StackPanel) {
                    var childStack = colchild as System.Windows.Controls.StackPanel;
                    if (childStack == null || VisualTreeHelper.GetChildrenCount (childStack) < cellViews [cell].CellIndex)
                        return Rectangle.Zero;
                    var cellpresenter = VisualTreeHelper.GetChild (childStack, cellViews [cell].CellIndex) as FrameworkElement;
                    var position = cellpresenter.TransformToAncestor (ListView).Transform(new System.Windows.Point(-ListView.Padding.Left, 0));
                    var rect = new Rect (position, cellpresenter.RenderSize);
                    return rect.ToXwtRect ();
                } else {
                    var position = colchild.TransformToAncestor (ListView).Transform(new System.Windows.Point(-ListView.Padding.Left, 0));
                    var rect = new Rect (position, colchild.RenderSize);
                    return rect.ToXwtRect ();
                }
            } catch (ArgumentOutOfRangeException) {
                return Rectangle.Zero;
            } catch (ArgumentNullException) {
                return Rectangle.Zero;
            }
        }
Пример #51
0
        /**
         * Test out the formula parser
         */
        private void writeFormulaSheet(WritableSheet ws)
        {
            // Add some cells to manipulate
            Number nc = new Number(0, 0, 15);
            ws.addCell(nc);

            nc = new Number(0, 1, 16);
            ws.addCell(nc);

            nc = new Number(0, 2, 10);
            ws.addCell(nc);

            nc = new Number(0, 3, 12);
            ws.addCell(nc);

            ws.setColumnView(2, 20);
            WritableCellFormat wcf = new WritableCellFormat();
            wcf.setAlignment(Alignment.RIGHT);
            wcf.setWrap(true);
            CellView cv = new CellView();
            cv.setSize(25 * 256);
            cv.setFormat(wcf);
            ws.setColumnView(3, cv);

            // Add in the formulas
            Formula f = null;
            Label l = null;

            f = new Formula(2, 0, "A1+A2");
            ws.addCell(f);
            l = new Label(3, 0, "a1+a2");
            ws.addCell(l);

            f = new Formula(2, 1, "A2 * 3");
            ws.addCell(f);
            l = new Label(3, 1, "A2 * 3");
            ws.addCell(l);

            f = new Formula(2, 2, "A2+A1/2.5");
            ws.addCell(f);
            l = new Label(3, 2, "A2+A1/2.5");
            ws.addCell(l);

            f = new Formula(2, 3, "3+(a1+a2)/2.5");
            ws.addCell(f);
            l = new Label(3, 3, "3+(a1+a2)/2.5");
            ws.addCell(l);

            f = new Formula(2, 4, "(a1+a2)/2.5");
            ws.addCell(f);
            l = new Label(3, 4, "(a1+a2)/2.5");
            ws.addCell(l);

            f = new Formula(2, 5, "15+((a1+a2)/2.5)*17");
            ws.addCell(f);
            l = new Label(3, 5, "15+((a1+a2)/2.5)*17");
            ws.addCell(l);

            f = new Formula(2, 6, "SUM(a1:a4)");
            ws.addCell(f);
            l = new Label(3, 6, "SUM(a1:a4)");
            ws.addCell(l);

            f = new Formula(2, 7, "SUM(a1:a4)/4");
            ws.addCell(f);
            l = new Label(3, 7, "SUM(a1:a4)/4");
            ws.addCell(l);

            f = new Formula(2, 8, "AVERAGE(A1:A4)");
            ws.addCell(f);
            l = new Label(3, 8, "AVERAGE(a1:a4)");
            ws.addCell(l);

            f = new Formula(2, 9, "MIN(5,4,1,2,3)");
            ws.addCell(f);
            l = new Label(3, 9, "MIN(5,4,1,2,3)");
            ws.addCell(l);

            f = new Formula(2, 10, "ROUND(3.14159265, 3)");
            ws.addCell(f);
            l = new Label(3, 10, "ROUND(3.14159265, 3)");
            ws.addCell(l);

            f = new Formula(2, 11, "MAX(SUM(A1:A2), A1*A2, POWER(A1, 2))");
            ws.addCell(f);
            l = new Label(3, 11, "MAX(SUM(A1:A2), A1*A2, POWER(A1, 2))");
            ws.addCell(l);

            f = new Formula(2, 12, "IF(A2>A1, \"A2 bigger\", \"A1 bigger\")");
            ws.addCell(f);
            l = new Label(3, 12, "IF(A2>A1, \"A2 bigger\", \"A1 bigger\")");
            ws.addCell(l);

            f = new Formula(2, 13, "IF(A2<=A1, \"A2 smaller\", \"A1 smaller\")");
            ws.addCell(f);
            l = new Label(3, 13, "IF(A2<=A1, \"A2 smaller\", \"A1 smaller\")");
            ws.addCell(l);

            f = new Formula(2, 14, "IF(A3<=10, \"<= 10\")");
            ws.addCell(f);
            l = new Label(3, 14, "IF(A3<=10, \"<= 10\")");
            ws.addCell(l);

            f = new Formula(2, 15, "SUM(1,2,3,4,5)");
            ws.addCell(f);
            l = new Label(3, 15, "SUM(1,2,3,4,5)");
            ws.addCell(l);

            f = new Formula(2, 16, "HYPERLINK(\"http://www.andykhan.com/jexcelapi\", \"JExcelApi Home Page\")");
            ws.addCell(f);
            l = new Label(3, 16, "HYPERLINK(\"http://www.andykhan.com/jexcelapi\", \"JExcelApi Home Page\")");
            ws.addCell(l);

            f = new Formula(2, 17, "3*4+5");
            ws.addCell(f);
            l = new Label(3, 17, "3*4+5");
            ws.addCell(l);

            f = new Formula(2, 18, "\"Plain text formula\"");
            ws.addCell(f);
            l = new Label(3, 18, "Plain text formula");
            ws.addCell(l);

            f = new Formula(2, 19, "SUM(a1,a2,-a3,a4)");
            ws.addCell(f);
            l = new Label(3, 19, "SUM(a1,a2,-a3,a4)");
            ws.addCell(l);

            f = new Formula(2, 20, "2*-(a1+a2)");
            ws.addCell(f);
            l = new Label(3, 20, "2*-(a1+a2)");
            ws.addCell(l);

            f = new Formula(2, 21, "'Number Formats'!B1/2");
            ws.addCell(f);
            l = new Label(3, 21, "'Number Formats'!B1/2");
            ws.addCell(l);

            f = new Formula(2, 22, "IF(F22=0, 0, F21/F22)");
            ws.addCell(f);
            l = new Label(3, 22, "IF(F22=0, 0, F21/F22)");
            ws.addCell(l);

            f = new Formula(2, 23, "RAND()");
            ws.addCell(f);
            l = new Label(3, 23, "RAND()");
            ws.addCell(l);

            StringBuilder buf = new StringBuilder();
            buf.Append("'");
            buf.Append(workbook.getSheet(0).getName());
            buf.Append("'!");
            buf.Append(CellReferenceHelper.getCellReference(9, 18));
            buf.Append("*25");
            f = new Formula(2, 24, buf.ToString());
            ws.addCell(f);
            l = new Label(3, 24, buf.ToString());
            ws.addCell(l);

            wcf = new WritableCellFormat(DateFormats.DEFAULT);
            f = new Formula(2, 25, "NOW()", wcf);
            ws.addCell(f);
            l = new Label(3, 25, "NOW()");
            ws.addCell(l);

            f = new Formula(2, 26, "$A$2+A3");
            ws.addCell(f);
            l = new Label(3, 26, "$A$2+A3");
            ws.addCell(l);

            f = new Formula(2, 27, "IF(COUNT(A1:A9,B1:B9)=0,\"\",COUNT(A1:A9,B1:B9))");
            ws.addCell(f);
            l = new Label(3, 27, "IF(COUNT(A1:A9,B1:B9)=0,\"\",COUNT(A1:A9,B1:B9))");
            ws.addCell(l);

            f = new Formula(2, 28, "SUM(A1,A2,A3,A4)");
            ws.addCell(f);
            l = new Label(3, 28, "SUM(A1,A2,A3,A4)");
            ws.addCell(l);

            l = new Label(1, 29, "a1");
            ws.addCell(l);
            f = new Formula(2, 29, "SUM(INDIRECT(ADDRESS(2,29)):A4)");
            ws.addCell(f);
            l = new Label(3, 29, "SUM(INDIRECT(ADDRESS(2,29):A4)");
            ws.addCell(l);

            f = new Formula(2, 30, "COUNTIF(A1:A4, \">=12\")");
            ws.addCell(f);
            l = new Label(3, 30, "COUNTIF(A1:A4, \">=12\")");
            ws.addCell(l);

            f = new Formula(2, 31, "MAX($A$1:$A$4)");
            ws.addCell(f);
            l = new Label(3, 31, "MAX($A$1:$A$4)");
            ws.addCell(l);

            f = new Formula(2, 32, "OR(A1,TRUE)");
            ws.addCell(f);
            l = new Label(3, 32, "OR(A1,TRUE)");
            ws.addCell(l);

            f = new Formula(2, 33, "ROWS(A1:C14)");
            ws.addCell(f);
            l = new Label(3, 33, "ROWS(A1:C14)");
            ws.addCell(l);

            f = new Formula(2, 34, "COUNTBLANK(A1:C14)");
            ws.addCell(f);
            l = new Label(3, 34, "COUNTBLANK(A1:C14)");
            ws.addCell(l);

            f = new Formula(2, 35, "IF(((F1=\"Not Found\")*(F2=\"Not Found\")*(F3=\"\")*(F4=\"\")*(F5=\"\")),1,0)");
            ws.addCell(f);
            l = new Label(3, 35, "IF(((F1=\"Not Found\")*(F2=\"Not Found\")*(F3=\"\")*(F4=\"\")*(F5=\"\")),1,0)");
            ws.addCell(l);

            f = new Formula(2, 36,
               "HYPERLINK(\"http://www.amazon.co.uk/exec/obidos/ASIN/0571058086qid=1099836249/sr=1-3/ref=sr_1_11_3/202-6017285-1620664\",  \"Long hyperlink\")");
            ws.addCell(f);

            f = new Formula(2, 37, "1234567+2699");
            ws.addCell(f);
            l = new Label(3, 37, "1234567+2699");
            ws.addCell(l);

            f = new Formula(2, 38, "IF(ISERROR(G25/G29),0,-1)");
            ws.addCell(f);
            l = new Label(3, 38, "IF(ISERROR(G25/G29),0,-1)");
            ws.addCell(l);

            f = new Formula(2, 39, "SEARCH(\"C\",D40)");
            ws.addCell(f);
            l = new Label(3, 39, "SEARCH(\"C\",D40)");
            ws.addCell(l);

            f = new Formula(2, 40, "#REF!");
            ws.addCell(f);
            l = new Label(3, 40, "#REF!");
            ws.addCell(l);

            nc = new Number(1, 41, 79);
            ws.addCell(nc);
            f = new Formula(2, 41, "--B42");
            ws.addCell(f);
            l = new Label(3, 41, "--B42");
            ws.addCell(l);

            f = new Formula(2, 42, "CHOOSE(3,A1,A2,A3,A4");
            ws.addCell(f);
            l = new Label(3, 42, "CHOOSE(3,A1,A2,A3,A4");
            ws.addCell(l);

            f = new Formula(2, 43, "A4-A3-A2");
            ws.addCell(f);
            l = new Label(3, 43, "A4-A3-A2");
            ws.addCell(l);

            f = new Formula(2, 44, "F29+F34+F41+F48+F55+F62+F69+F76+F83+F90+F97+F104+F111+F118+F125+F132+F139+F146+F153+F160+F167+F174+F181+F188+F195+F202+F209+F216+F223+F230+F237+F244+F251+F258+F265+F272+F279+F286+F293+F300+F305+F308");
            ws.addCell(f);
            l = new Label(3, 44, "F29+F34+F41+F48+F55+F62+F69+F76+F83+F90+F97+F104+F111+F118+F125+F132+F139+F146+F153+F160+F167+F174+F181+F188+F195+F202+F209+F216+F223+F230+F237+F244+F251+F258+F265+F272+F279+F286+F293+F300+F305+F308");
            ws.addCell(l);

            nc = new Number(1, 45, 17);
            ws.addCell(nc);
            f = new Formula(2, 45, "formulavalue+5");
            ws.addCell(f);
            l = new Label(3, 45, "formulavalue+5");
            ws.addCell(l);

            // Errors
            /*
            f = new Formula(2, 25, "PLOP(15)"); // unknown function
            ws.addCell(f);

            f = new Formula(2, 26, "SUM(15,3"); // unmatched parentheses
            ws.addCell(f);

            f = new Formula(2, 27, "SUM15,3)"); // missing opening parentheses
            ws.addCell(f);

            f = new Formula(2, 28, "ROUND(3.14159)"); // missing args
            ws.addCell(f);

            f = new Formula(2, 29, "NONSHEET!A1"); // sheet not found
            ws.addCell(f);
            */
        }