Example #1
0
        public void SetCell(Cell cell)
        {
            if(LargeTextBox != null)
                LargeTextBox.Visibility = Visibility.Collapsed;
            
            if(LargeTextBlock != null)
                LargeTextBlock.Visibility = Visibility.Collapsed;
            disableNotification = true; 
            if (LargeTextBox != null)
            {
                CurrentCell = cell;
                LargeTextBox.IsReadOnly = cell.Column.ReadOnly;           
                if (cell.DisplayData is List<Run>)
                {
                    LargeTextBlock.Visibility = Visibility.Visible;

                    LargeTextBlock.Inlines.Clear();
                    foreach(Run run in (List<Run>)cell.DisplayData)
                    {
                        LargeTextBlock.Inlines.Add(run);
                    }
                }
                else
                {
                    LargeTextBox.Visibility = Visibility.Visible;
                LargeTextBox.Text = cell.DisplayData.ToString();
                }
            }

            disableNotification = false;
        }
Example #2
0
 public void ShowTextEditor(Cell cell)
 {
   
     editorText.SetValue(Grid.ColumnProperty, cell.Col);
     editorText.SetValue(Grid.RowProperty, cell.Row);
     editorText.EditingCell = cell;
     editorText.Visibility = Visibility.Visible;
 }
Example #3
0
        public void ShowAutoDropdown(Cell cell)
        {
          
            autoDropdown.SetValue(Grid.ColumnProperty, cell.Col);
            autoDropdown.SetValue(Grid.RowProperty, cell.Row + 1);
            autoDropdown.SetValue(Grid.RowSpanProperty, 15);
            autoDropdown.SetValue(Grid.ColumnSpanProperty, 3);
            autoDropdown.SetValue(Canvas.LeftProperty, cell.Position.X);

            double ddHeight = autoDropdown.HeightApprox;

            if (cell.Position.Y + cell.rowHandler.Height + ddHeight > cell.rowHandler.ExcelParams.GridControl.grdMain.ActualHeight)
                autoDropdown.SetValue(Canvas.TopProperty, cell.Position.Y - ddHeight);
            else
                autoDropdown.SetValue(Canvas.TopProperty, cell.Position.Y + cell.rowHandler.Height);

            
            autoDropdown.Visibility = Visibility.Visible;
        }
Example #4
0
 public object CopyData(Cell cell, object displayData)
 {
     return displayData;
 }
Example #5
0
        void ProcessFillCell(Cell cell)
        {
                Cell newCell = cell;

                Cell lastCell = ExcelParams.Rows[cell.Row - 1].Cells[cell.Col];

                object newData = (string)lastCell.rawData;

                ExcelColumn.ColumnTypes useType = lastCell.Column.ColumnType;

                // If increment isn't turned on assume the identity of an unknown column.
                if (!newCell.Column.FillIncrement)
                    useType = ExcelColumn.ColumnTypes.Unknown;


                switch (useType)
                {
                    case ExcelColumn.ColumnTypes.Text:
                    case ExcelColumn.ColumnTypes.Note:
                        newData = IncreaseByOne((string)lastCell.Data);
                        break;
                    case ExcelColumn.ColumnTypes.Number:
                        if (newCell.Column.FillIncrement)
                            newData = (((int)lastCell.Data) + 1);
                        break;
                    case ExcelColumn.ColumnTypes.Custom:
                    case ExcelColumn.ColumnTypes.Unknown:
                    case ExcelColumn.ColumnTypes.Choice:
                        newData = (string)lastCell.rawData;
                        break;
                    default:
                        break;
                }

                newCell.UpdateData(newData, false, true);
                
        }
Example #6
0
 internal void UnSelectRows()
 {
     startRow = null;
     endRow = null;
     CurrentEditCell = null;         
 }
Example #7
0
 internal void Unselect()
 {
     if(selectControl != null)
         selectControl.Visibility = Visibility.Collapsed;            
     CurrentEditCell = null;
 }
Example #8
0
        internal void ChangeSelection(SelectTypes type, int rowStart, int rowEnd, int cellStart, int cellEnd, Cell cell)
        {
            Debug.WriteLine(string.Format("select:({0},{1}) ({2} {3})", cellStart, rowStart, cellEnd, rowEnd ));
            
            if (ExcelParams.GlobalRowSelect)
            {
                if (type == SelectTypes.Multi)
                {
                    rowEnd -= 1;
                }
                type = SelectTypes.Row;
                rowStart = rowEnd;

            }
                    

            SelectType = type;
    
            if (CurrentEditCell != cell || (cell == null && CurrentEditCell == null))
            {
                if (CurrentEditCell != null)
                    CurrentEditCell.IsSelected = false;

                if (type == SelectTypes.Single)
                {
                    CurrentEditCell = cell;
                    if (CurrentEditCell != null)
                    {
                        CurrentEditCell.IsSelected = true;
                        CellAnchor = new Point(CurrentEditCell.Col, CurrentEditCell.Row);
                        Debug.WriteLine(string.Format("{0}, {1}", CellAnchor.X, CellAnchor.Y));
                    }
                }

                // Unselect Rows
                HighlightRows(false);
                startRow = null;
                endRow = null;

                if(selectControl != null)
                    selectControl.DisableConfig();
                        
                switch (SelectType)
                {
                    case SelectTypes.Single:
                        DisplaySelectControl(cellStart, rowStart, 1, 1);
                        break;
                    case SelectTypes.Multi:
                        double oldBottom = multiArea.Bottom;
                        if (selectControl.filling)
                            cellEnd = (int)multiArea.Right;
                        DisplaySelectControl(cellStart, rowStart,cellEnd - cellStart, rowEnd - rowStart);

                        if (multiArea.Height > 1 && !selectControl.filling)
                            selectControl.DisableFill();

                        if ((int)multiArea.Width == 1)
                            if (GetCell(cellStart, 0).Column.ProcessMultiCellConfig != null)
                                selectControl.EnableConfig();
                            

                        if (oldBottom != rowEnd && selectControl.filling)
                        {
                            fillHandler.ProcessFill();
                        }
                        break;
                    case SelectTypes.Row:
                        if (rowStart >= ExcelParams.Rows.Count)
                        {
                            rowStart = ExcelParams.Rows.Count - 1;
                            rowEnd = rowStart;
                        }

                        if (rowEnd <= rowStart)
                            rowEnd = rowStart;
                        startRow = ExcelParams.Rows[rowStart];
                        endRow = ExcelParams.Rows[rowEnd];
                        HighlightRows(true);
                        if(CurrentEditCell != null)
                            CurrentEditCell.rowHandler.Update();
                        DisplaySelectControl(0, rowStart, ExcelParams.Columns.Count, rowEnd - rowStart + 1);
                        
                        selectControl.DisableFill();
                        
                        if (startRow == endRow)
                            ExcelParams.RowSelected(startRow);
                        break;
                    case SelectTypes.None:
                        break;
                    default:
                        break;
                }
            }  
        }
Example #9
0
        public void SelectCell(Cell cell, bool switchToEditIfRead)
        {
            bool validationPassed = true;

            ExcelParams.LargeTextHandler.SetCell(cell);
            if (CurrentEditCell != null)
                {
                    // If the currently editing cell isn't the one just clicked, set it to display
                    if (CurrentEditCell != cell)
                    {
                        if (CurrentEditCell.Mode == Cell.Modes.Editable)
                                validationPassed = CurrentEditCell.rowHandler.ChangeCellMode(CurrentEditCell, Cell.Modes.Display);
                    
                    }
                    if (CurrentEditCell.rowHandler != cell.rowHandler && validationPassed)
                        CurrentEditCell.rowHandler.Update();
                }

                // Check that its possible to select the new cell, if not reselect the old cell
                if (validationPassed)
                {

                    if (CurrentEditCell == cell)
                    {
                        if (cell.Column.ReadOnly)
                        {
                            ExcelParams.StatusHandler.UpdateInfo("Read only", cell.Column.Header + " is a read only field and can't be edited.");
                            validationPassed = false;
                        }
                        else
                        {
                            if(cell.Mode != Cell.Modes.Editable && ExcelParams.Editable && switchToEditIfRead)
                                validationPassed = cell.rowHandler.ChangeCellMode(cell, Cell.Modes.Editable);
                        }
                    }
                    else
                    {
                        ExcelParams.GridControl.clipboardTextbox.Focus();
                    }
                }
                else
                    CurrentEditCell.rowHandler.ValidateRow();

                ChangeSelection(SelectTypes.Single, cell.Row, cell.Row, cell.Col, cell.Col, cell);
        }
Example #10
0
 public void SelectCell(Cell cell)
 {
     SelectCell(cell, true);
 }
Example #11
0
 public void DisableEdit()
 {
     if (CurrentEditCell != null)
         CurrentEditCell.rowHandler.ChangeCellMode(CurrentEditCell, Cell.Modes.Display);
     CurrentEditCell = null;
     
 }
Example #12
0
 public object CopyData(Cell cell, object rawData)
 {
     return DisplayData(rawData);
 }
Example #13
0
 public void ShowAutoDropdownButton(Cell cell)
 {
     AdditionalInfo.SetValue(Grid.ColumnProperty, cell.Col);
     AdditionalInfo.SetValue(Grid.RowProperty, cell.Row);
     AdditionalInfo.Visibility = Visibility.Visible;
 }
Example #14
0
 public override States ChangeMode(Cell.Modes mode, ref string message)
 {
     base.ChangeMode(mode, ref message);
     if (mode == Modes.Display)
         HideDropdown();
     return State;
 }
        internal void SetCell(Cell cell)
        {        
            string map = "";
            string levels = "";
            string activities ="";

            _currentCell = (CellTextMultiActivity)cell;

            ClearSearchParameters();
             
            if (_currentCell.SearchParameters != null) 
                _searchParameters = _currentCell.SearchParameters;                
 
            InitializeSearchAction();

            SearchLinkActivityResults = new ObservableCollection<ActivitySet>();            
            SearchActivityResults = new ObservableCollection<ActivitySet>();
            _activityOldList = new ObservableCollection<ActivitySet>();
                
             if (_currentCell.SearchParameters != null)
             {
                 SetLastSearchParameters(_currentCell.SearchParameters);
             }

             if (_currentCell.ActivityLinks != null && _currentCell.ActivityLinks.Count > 0)
             {
                for (int i = 0; i < _currentCell.ActivityLinks.Count; i++)
                {
                    if (i == _currentCell.ActivityLinks.Count - 1)
                    {
                        if (!map.Contains(_currentCell.ActivityLinks[i].Map)) 
                        map += "'" + _currentCell.ActivityLinks[i].Map+ "'";                        
                        levels += "'" + _currentCell.ActivityLinks[i].Level + "'";
                        activities += _currentCell.ActivityLinks[i].Id;
                    }
                    else
                    {
                        if (!map.Contains(_currentCell.ActivityLinks[i].Map))
                        map += "'" + _currentCell.ActivityLinks[i].Map + "'" + ",";
                        levels += "'" + _currentCell.ActivityLinks[i].Level + "'" + ",";
                        activities += _currentCell.ActivityLinks[i].Id + ",";
                    }                                     
                }
                map = map.TrimEnd(',');
                IsBusy = true;
                _datahandler.GetExisitingActivities(map, levels, activities);                
            }                      
            
            _isModifiedLinks = false;                     
        }