Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Drawing
Imports System.Data
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Imports System.Windows.Forms
Imports GrapeCity.Spreadsheet
Imports FarPoint.Win.Spread
Imports Spread.Common.Features.Spread.Common.Features.Sample

Namespace Features
    Partial Public Class FormulaTracing
        Inherits BaseSampleControl
        Public Sub New()
            InitializeComponent()
            Using s As New System.IO.MemoryStream(Resources.SudokuSolver)

                fpSpread1.OpenExcel(s)
                ' fix up columns
                Dim wb As IWorkbook = fpSpread1.AsWorkbook()
                Dim ws As IWorksheet = wb.ActiveSheet
                ' intialize a puzzle
                Const O As Object = Nothing
                ws.SetValue(4, 1, New Object(,) {{3, O, 2, O, 7, O,
                    5, O, 4}, {O, O, O, O, O, O,
                    O, O, O}, {O, O, 6, 2, 5, 4,
                    O, O, O}, {O, 9, O, O, O, O,
                    6, O, O}, {O, O, 8, 9, 6, 5,
                    1, O, O}, {O, O, 5, O, O, O,
                    O, 2, O},
                    {O, O, O, 1, 9, 7,
                    8, O, O}, {O, O, O, O, O, O,
                    O, O, O}, {5, O, 7, O, 8, O,
                    2, O, 6}})
                AutoFit(1, 1)
                AutoFit(22, 22)
                AutoFit(30, 30)
                AutoFit(39, 39)
                AutoFit(48, 48)
                AutoFit(52, 52)
                ' unprotect sheet so formulas can be edited
                ws.Unprotect(Nothing)
                ' setup iterations and calculation hokey
                wb.WorkbookSet.CalculationEngine.Iterative = True
                wb.WorkbookSet.CalculationEngine.MaximumIterations = 1
                fpSpread1.GetActionMap().Put("Recalculate", New RecalculateAction())
                fpSpread1.GetInputMap(InputMapMode.WhenFocused).Put(New Keystroke(Keys.F9, Keys.None), "Recalculate")
            End Using
        End Sub

        Private Sub AutoFit(ByVal column As Integer, ByVal column2 As Integer)
            Dim sheetView As SheetView = fpSpread1.ActiveSheet
            For i As Integer = column To column2
                sheetView.SetColumnWidth(i, sheetView.GetPreferredColumnWidth(i, True, True, True))
            Next
        End Sub

        Private Sub OpenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles openToolStripMenuItem.Click
               Dim ofd As New OpenFileDialog()
               ofd.Filter = "Excel Spreadsheet (*.xlsx;*.xlsm;*.xls)|*.xlsx;*.xlsm;*.xls|All Files (*.*)|*.*"
               ofd.FilterIndex = 0
               ofd.Title = "Open Spreadsheet"
               If DialogResult.OK = ofd.ShowDialog() Then
                    fpSpread1.Open(ofd.FileName)
                    ' unprotect sheets so formulas can be edited
                    For Each sv As SheetView In fpSpread1.Sheets
                         sv.Protect = False
                    Next
               End If
          End Sub



          Private Sub ShowDependentsToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles showDependentsToolStripMenuItem.Click
               fpSpread1.ShowDependents(fpSpread1.ActiveSheetIndex, fpSpread1.ActiveSheet.ActiveRowIndex, fpSpread1.ActiveSheet.ActiveColumnIndex)
          End Sub

          Private Sub ShowPrecedentsToolStripMenuItem_Click(sender As Object, e As EventArgs)
            fpSpread1.ShowPrecedents(fpSpread1.ActiveSheetIndex, fpSpread1.ActiveSheet.ActiveRowIndex, fpSpread1.ActiveSheet.ActiveColumnIndex)
        End Sub

        Private Sub RemoveArrowsToolStripMenuItem_Click(sender As Object, e As EventArgs)
            For i As Integer = 0 To fpSpread1.Sheets.Count - 1
                fpSpread1.HideDependents(i)
                fpSpread1.HidePrecedents(i)
            Next
        End Sub

        Private Sub GenerateReportToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
            Dim row, rowStart As Integer
            Dim wb As IWorkbook = fpSpread1.AsWorkbook()
            Dim wb2 As IWorkbook = fpSpread2.AsWorkbook()
            Dim wks As IWorksheet = wb2.ActiveSheet
            Dim targetCell As IRange = wb.ActiveSheet.Cells(fpSpread1.ActiveSheet.ActiveRowIndex, fpSpread1.ActiveSheet.ActiveColumnIndex)
            If Not CBool(targetCell.HasFormula) Then
                MessageBox.Show("You must select a cell containing a formula to analyze first!")
                Return
            End If
            Dim direct_dependents As IAreas = targetCell.DirectDependents.Areas
            Dim direct_precedents As IAreas = targetCell.DirectPrecedents.Areas
            Dim all_dependents As IAreas = targetCell.Dependents.Areas
            Dim all_precedents As IAreas = targetCell.Precedents.Areas
            Dim sv As SheetView = fpSpread2.ActiveSheet
            sv.RowCount = Integer.MaxValue
            sv.Cells(0, 0).Text = "Tracing Formula in cell " & targetCell.Address(False, False, ReferenceStyle.A1, False, targetCell) & ":"
            wks.Cells(0, 0).ApplyStyle(BuiltInStyle.Percent60Accent6)
            wks.Cells(0, 0).ApplyStyle(BuiltInStyle.Title)
            wks.Rows(0).AutoFit()
            sv.Cells(1, 0).Text = If(targetCell.HasArray, targetCell.FormulaArray, targetCell.Formula)
            sv.Cells(1, 0).ColumnSpan = 2
            wks.Cells(1, 0).Style.VerticalAlignment = VerticalAlignment.Top
            wks.Cells(1, 0).Style.WrapText = True
            sv.SetRowHeight(1, sv.GetPreferredCellSize(1, 0).Height)
            wks.Cells(1, 0).ApplyStyle(BuiltInStyle.Percent20Accent6)
            wks.Cells(1, 0).ApplyStyle(BuiltInStyle.Calculation)
            row = 3
            sv.Cells(row, 0).Text = "Direct Dependents"
            sv.Cells(row, 0).Note = "Direct Depedents are cells which are directly referenced in the target cell formula."
            sv.Cells(row, 0).ColumnSpan = 2
            wks.Cells(row, 0).ApplyStyle(BuiltInStyle.Percent40Accent6)
            wks.Cells(row, 0).ApplyStyle(BuiltInStyle.Title)
            wks.Rows(row).RowHeight = wks.Rows(0).RowHeight
            row += 1
            rowStart = row
            sv.Cells(row, 0).Text = "Cell"
            sv.Cells(row, 1).Text = "Formula/Value"
            row += 1
            Dim i As Integer = 0
            While i < direct_dependents.Count
                sv.Cells(row, 0).Text = direct_dependents(i).Address(False, False, ReferenceStyle.A1, False, direct_dependents(i))
                sv.Cells(row, 1).Text = If(CBool(direct_dependents(i).HasFormula), (If(direct_dependents(i).HasArray, direct_dependents(i).FormulaArray, direct_dependents(i).Formula)), direct_dependents(i).Text)
                row += 1
                i += 1
            End While
            sv.AddTable(rowStart, 0, row - rowStart, 2)
            For i = 0 To direct_dependents.Count - 1
                If CBool(direct_dependents(i).HasFormula) Then
                    wks.Cells(rowStart + 1 + i, 1).ApplyStyle(BuiltInStyle.Calculation)
                    wks.Cells(rowStart + 1 + i, 1).Style.WrapText = True
                    sv.SetRowHeight(rowStart + 1 + i, sv.GetPreferredCellSize(rowStart + 1 + i, 1).Height)
                End If
            Next
            row += 2
            sv.Cells(row, 0).Text = "Direct Precedents"
            sv.Cells(row, 0).Note = "Direct Precedents are cells which directly reference the target cell."
            sv.Cells(row, 0).ColumnSpan = 2
            wks.Cells(row, 0).ApplyStyle(BuiltInStyle.Percent40Accent6)
            wks.Cells(row, 0).ApplyStyle(BuiltInStyle.Title)
            wks.Rows(row).RowHeight = wks.Rows(0).RowHeight
            row += 1
            rowStart = row
            sv.Cells(row, 0).Text = "Cell"
            sv.Cells(row, 1).Text = "Formula/Value"
            row += 1
            i = 0
            While i < direct_precedents.Count
                sv.Cells(row, 0).Text = direct_precedents(i).Address(False, False, ReferenceStyle.A1, False, direct_precedents(i))
                sv.Cells(row, 1).Text = If(CBool(direct_precedents(i).HasFormula), (If(direct_precedents(i).HasArray, direct_precedents(i).FormulaArray, direct_precedents(i).Formula)), direct_precedents(i).Text)
                row += 1
                i += 1
            End While
            sv.AddTable(rowStart, 0, row - rowStart, 2)
            For i = 0 To direct_precedents.Count - 1
                If CBool(direct_precedents(i).HasFormula) Then
                    wks.Cells(rowStart + 1 + i, 1).ApplyStyle(BuiltInStyle.Calculation)
                    wks.Cells(rowStart + 1 + i, 1).Style.WrapText = True
                    sv.SetRowHeight(rowStart + 1 + i, sv.GetPreferredCellSize(rowStart + 1 + i, 1).Height)
                End If
            Next
            If all_dependents.Count > direct_dependents.Count Then
                row += 2
                sv.Cells(row, 0).Text = "All Dependents"
                sv.Cells(row, 0).Note = "Depedents are cells which are directly referenced in the target cell formula, and all cells which are directly referenced in those cell formulas, and so on."
                sv.Cells(row, 0).ColumnSpan = 2
                wks.Cells(row, 0).ApplyStyle(BuiltInStyle.Percent40Accent6)
                wks.Cells(row, 0).ApplyStyle(BuiltInStyle.Title)
                wks.Rows(row).RowHeight = wks.Rows(0).RowHeight
                row += 1
                rowStart = row
                sv.Cells(row, 0).Text = "Cell"
                sv.Cells(row, 1).Text = "Formula/Value"
                row += 1
                i = 0
                While i < all_dependents.Count
                    sv.Cells(row, 0).Text = all_dependents(i).Address(False, False, ReferenceStyle.A1, False, all_dependents(i))
                    sv.Cells(row, 1).Text = If(CBool(all_dependents(i).HasFormula), (If(all_dependents(i).HasArray, all_dependents(i).FormulaArray, all_dependents(i).Formula)), all_dependents(i).Text)
                    row += 1
                    i += 1
                End While
                sv.AddTable(rowStart, 0, row - rowStart, 2)
                For i = 0 To all_dependents.Count - 1
                    If CBool(all_dependents(i).HasFormula) Then
                        wks.Cells(rowStart + 1 + i, 1).ApplyStyle(BuiltInStyle.Calculation)
                        wks.Cells(rowStart + 1 + i, 1).Style.WrapText = True
                        sv.SetRowHeight(rowStart + 1 + i, sv.GetPreferredCellSize(rowStart + 1 + i, 1).Height)
                    End If
                Next
            End If
            If all_precedents.Count > direct_precedents.Count Then
                row += 2
                sv.Cells(row, 0).Text = "All Precedents"
                sv.Cells(row, 0).Note = "Precedents are cells which directly reference the target cell, and all cells which directly reference those cells, and so on."
                sv.Cells(row, 0).ColumnSpan = 2
                wks.Cells(row, 0).ApplyStyle(BuiltInStyle.Percent40Accent6)
                wks.Cells(row, 0).ApplyStyle(BuiltInStyle.Title)
                wks.Rows(row).RowHeight = wks.Rows(0).RowHeight
                row += 1
                rowStart = row
                sv.Cells(row, 0).Text = "Cell"
                sv.Cells(row, 1).Text = "Formula/Value"
                row += 1
                i = 0
                While i < all_precedents.Count
                    sv.Cells(row, 0).Text = all_precedents(i).Address(False, False, ReferenceStyle.A1, False, all_precedents(i))
                    sv.Cells(row, 1).Text = If(CBool(all_precedents(i).HasFormula), (If(all_precedents(i).HasArray, all_precedents(i).FormulaArray, all_precedents(i).Formula)), all_precedents(i).Text)
                    row += 1
                    i += 1
                End While
                sv.AddTable(rowStart, 0, row - rowStart, 2)
                For i = 0 To all_precedents.Count - 1
                    If CBool(all_precedents(i).HasFormula) Then
                        wks.Cells(rowStart + 1 + i, 1).ApplyStyle(BuiltInStyle.Calculation)
                        wks.Cells(rowStart + 1 + i, 1).Style.WrapText = True
                        sv.SetRowHeight(rowStart + 1 + i, sv.GetPreferredCellSize(rowStart + 1 + i, 1).Height)
                    End If
                Next
            End If
            wks.RowCount = sv.GetLastNonEmptyRow(NonEmptyItemFlag.Data) + 1
            sv.SetColumnWidth(1, 500)
            sv.ColumnCount = 2
            splitContainer3.Panel2Collapsed = False
            fpSpread2.Visible = True
            hideReportPaneToolStripMenuItem.Visible = True
        End Sub
        Private Sub hideReportPaneToolStripMenuItem_Click(sender As Object, e As EventArgs)
            splitContainer3.Panel2Collapsed = True
            hideReportPaneToolStripMenuItem.Visible = False
        End Sub

          Private Sub linkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) 'Handles linkLabel1.LinkClicked
               linkLabel1.LinkVisited = True
               System.Diagnostics.Process.Start("https://templates.office.com/en-us/Sudoku-puzzle-solver-TM10080972")
          End Sub
     End Class
End Namespace

'
'
'

Namespace Features
	Partial Class FormulaTracing
		''' <summary> 
		''' Required designer variable.
		''' </summary>
		Private components As System.ComponentModel.IContainer = Nothing

        ''' <summary> 
        ''' Clean up any resources being used.
        ''' </summary>
        ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        Protected Overloads Sub Dispose(disposing As Boolean)
            If disposing AndAlso (components IsNot Nothing) Then
                components.Dispose()
            End If
            MyBase.Dispose(disposing)
        End Sub

#Region "Component Designer generated code"

        ''' <summary> 
        ''' Required method for Designer support - do not modify 
        ''' the contents of this method with the code editor.
        ''' </summary>
        Private Sub InitializeComponent()
               Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(FormulaTracing))
               Me.splitContainer1 = New System.Windows.Forms.SplitContainer()
               Me.splitContainer2 = New System.Windows.Forms.SplitContainer()
               Me.linkLabel1 = New System.Windows.Forms.LinkLabel()
               Me.nameBox1 = New FarPoint.Win.Spread.NameBox()
               Me.fpSpread1 = New FarPoint.Win.Spread.FpSpread(FarPoint.Win.Spread.LegacyBehaviors.None, CType(resources.GetObject("splitContainer2.Panel1.Controls"), Object))
               Me.fpSpread2_Sheet1 = Me.fpSpread1.GetSheet(0)
               Me.formulaTextBox1 = New FarPoint.Win.Spread.FormulaTextBox()
               Me.splitContainer3 = New System.Windows.Forms.SplitContainer()
               Me.menuStrip1 = New System.Windows.Forms.MenuStrip()
               Me.fileToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
               Me.openToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
               Me.toolStripMenuItem1 = New System.Windows.Forms.ToolStripSeparator()
               Me.formulaTracingToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
               Me.showDependentsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
               Me.showPrecedentsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
               Me.removeArrowsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
               Me.toolStripMenuItem2 = New System.Windows.Forms.ToolStripSeparator()
               Me.generateReportToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
               Me.hideReportPaneToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
               CType(Me.splitContainer1, System.ComponentModel.ISupportInitialize).BeginInit()
               Me.splitContainer1.Panel1.SuspendLayout()
               Me.splitContainer1.Panel2.SuspendLayout()
               Me.splitContainer1.SuspendLayout()
               CType(Me.splitContainer2, System.ComponentModel.ISupportInitialize).BeginInit()
               Me.splitContainer2.Panel1.SuspendLayout()
               Me.splitContainer2.Panel2.SuspendLayout()
               Me.splitContainer2.SuspendLayout()
               CType(Me.fpSpread1, System.ComponentModel.ISupportInitialize).BeginInit()
               CType(Me.splitContainer3, System.ComponentModel.ISupportInitialize).BeginInit()
               Me.splitContainer3.Panel1.SuspendLayout()
               Me.splitContainer3.SuspendLayout()
               Me.menuStrip1.SuspendLayout()
               Me.SuspendLayout()
               '
               'pnlMain
               '
               Me.pnlMain.Size = New System.Drawing.Size(908, 791)
               '
               'pnlControls
               '
               Me.pnlControls.Size = New System.Drawing.Size(300, 791)
               '
               'splitContainer1
               '
               Me.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill
               Me.splitContainer1.Location = New System.Drawing.Point(0, 24)
               Me.splitContainer1.Name = "splitContainer1"
               Me.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal
               '
               'splitContainer1.Panel1
               '
               Me.splitContainer1.Panel1.Controls.Add(Me.splitContainer2)
               '
               'splitContainer1.Panel2
               '
               Me.splitContainer1.Panel2.Controls.Add(Me.splitContainer3)
               Me.splitContainer1.Size = New System.Drawing.Size(1209, 767)
               Me.splitContainer1.SplitterDistance = 45
               Me.splitContainer1.TabIndex = 0
               '
               'splitContainer2
               '
               Me.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill
               Me.splitContainer2.Location = New System.Drawing.Point(0, 0)
               Me.splitContainer2.Name = "splitContainer2"
               '
               'splitContainer2.Panel1
               '
               Me.splitContainer2.Panel1.Controls.Add(Me.linkLabel1)
               Me.splitContainer2.Panel1.Controls.Add(Me.nameBox1)
               '
               'splitContainer2.Panel2
               '
               Me.splitContainer2.Panel2.Controls.Add(Me.formulaTextBox1)
               Me.splitContainer2.Size = New System.Drawing.Size(1209, 45)
               Me.splitContainer2.SplitterDistance = 401
               Me.splitContainer2.TabIndex = 0
               '
               'linkLabel1
               '
               Me.linkLabel1.AutoSize = True
               Me.linkLabel1.Location = New System.Drawing.Point(13, 28)
               Me.linkLabel1.Name = "linkLabel1"
               Me.linkLabel1.Size = New System.Drawing.Size(300, 13)
               Me.linkLabel1.TabIndex = 1
               Me.linkLabel1.TabStop = True
               Me.linkLabel1.Text = "Excel template available here from Microsoft Office Templates "
               '
               'nameBox1
               '
               Me.nameBox1.Dock = System.Windows.Forms.DockStyle.Fill
               Me.nameBox1.Location = New System.Drawing.Point(0, 0)
               Me.nameBox1.MaxLength = 255
               Me.nameBox1.Name = "nameBox1"
               Me.nameBox1.Size = New System.Drawing.Size(401, 21)
               Me.nameBox1.TabIndex = 0
               Me.nameBox1.Attach(FpSpread1)
               '
               'fpSpread1
               '
               Me.fpSpread1.AccessibleDescription = "fpSpread1, Sheet1, Row 0, Column 0"
               Me.fpSpread1.BackColor = System.Drawing.SystemColors.Control
               Me.fpSpread1.Dock = System.Windows.Forms.DockStyle.Fill
               Me.fpSpread1.Font = New System.Drawing.Font("Calibri", 11.0!)
               Me.fpSpread1.Location = New System.Drawing.Point(0, 0)
               Me.fpSpread1.Name = "fpSpread1"
               Me.fpSpread1.RightToLeft = System.Windows.Forms.RightToLeft.No
               Me.fpSpread1.Size = New System.Drawing.Size(1209, 718)
               Me.fpSpread1.TabIndex = 0
               '
               'formulaTextBox1
               '
               Me.formulaTextBox1.Dock = System.Windows.Forms.DockStyle.Fill
               Me.formulaTextBox1.Location = New System.Drawing.Point(0, 0)
               Me.formulaTextBox1.Name = "formulaTextBox1"
               Me.formulaTextBox1.Size = New System.Drawing.Size(804, 45)
               Me.formulaTextBox1.TabIndex = 0
               'Attach formulaTextBox1 to fpSpread1
               Me.formulaTextBox1.Attach(Me.fpSpread1)
               '
               'splitContainer3
               '
               Me.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill
               Me.splitContainer3.Location = New System.Drawing.Point(0, 0)
               Me.splitContainer3.Name = "splitContainer3"
               '
               'splitContainer3.Panel1
               '
               Me.splitContainer3.Panel1.Controls.Add(Me.fpSpread1)
               Me.splitContainer3.Panel2Collapsed = True
               Me.splitContainer3.Panel2MinSize = 0
               Me.splitContainer3.Size = New System.Drawing.Size(1209, 718)
               Me.splitContainer3.SplitterDistance = 517
               Me.splitContainer3.TabIndex = 0
               '
               'menuStrip1
               '
               Me.menuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.fileToolStripMenuItem, Me.formulaTracingToolStripMenuItem})
               Me.menuStrip1.Location = New System.Drawing.Point(0, 0)
               Me.menuStrip1.Name = "menuStrip1"
               Me.menuStrip1.Size = New System.Drawing.Size(1209, 24)
               Me.menuStrip1.TabIndex = 1
               Me.menuStrip1.Text = "menuStrip2"
               '
               'fileToolStripMenuItem
               '
               Me.fileToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.openToolStripMenuItem, Me.toolStripMenuItem1})
               Me.fileToolStripMenuItem.Name = "fileToolStripMenuItem"
               Me.fileToolStripMenuItem.Size = New System.Drawing.Size(37, 20)
               Me.fileToolStripMenuItem.Text = "&File"
               '
               'openToolStripMenuItem
               '
               Me.openToolStripMenuItem.Name = "openToolStripMenuItem"
               Me.openToolStripMenuItem.Size = New System.Drawing.Size(103, 22)
               Me.openToolStripMenuItem.Text = "&Open"
               '
               'toolStripMenuItem1
               '
               Me.toolStripMenuItem1.Name = "toolStripMenuItem1"
               Me.toolStripMenuItem1.Size = New System.Drawing.Size(100, 6)
               '
               'formulaTracingToolStripMenuItem
               '
               Me.formulaTracingToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.showDependentsToolStripMenuItem, Me.showPrecedentsToolStripMenuItem, Me.removeArrowsToolStripMenuItem, Me.toolStripMenuItem2, Me.generateReportToolStripMenuItem, Me.hideReportPaneToolStripMenuItem})
               Me.formulaTracingToolStripMenuItem.Name = "formulaTracingToolStripMenuItem"
               Me.formulaTracingToolStripMenuItem.Size = New System.Drawing.Size(105, 20)
               Me.formulaTracingToolStripMenuItem.Text = "Formula &Tracing"
               '
               'showDependentsToolStripMenuItem
               '
               Me.showDependentsToolStripMenuItem.Name = "showDependentsToolStripMenuItem"
               Me.showDependentsToolStripMenuItem.Size = New System.Drawing.Size(169, 22)
               Me.showDependentsToolStripMenuItem.Text = "Show &Dependents"
               '
               'showPrecedentsToolStripMenuItem
               '
               Me.showPrecedentsToolStripMenuItem.Name = "showPrecedentsToolStripMenuItem"
               Me.showPrecedentsToolStripMenuItem.Size = New System.Drawing.Size(169, 22)
               Me.showPrecedentsToolStripMenuItem.Text = "Show &Precedents"
               '
               'removeArrowsToolStripMenuItem
               '
               Me.removeArrowsToolStripMenuItem.Name = "removeArrowsToolStripMenuItem"
               Me.removeArrowsToolStripMenuItem.Size = New System.Drawing.Size(169, 22)
               Me.removeArrowsToolStripMenuItem.Text = "Remove Arrows"
               '
               'toolStripMenuItem2
               '
               Me.toolStripMenuItem2.Name = "toolStripMenuItem2"
               Me.toolStripMenuItem2.Size = New System.Drawing.Size(166, 6)
               '
               'generateReportToolStripMenuItem
               '
               Me.generateReportToolStripMenuItem.Name = "generateReportToolStripMenuItem"
               Me.generateReportToolStripMenuItem.Size = New System.Drawing.Size(169, 22)
               Me.generateReportToolStripMenuItem.Text = "Generate &Report"
               '
               'hideReportPaneToolStripMenuItem
               '
               Me.hideReportPaneToolStripMenuItem.Name = "hideReportPaneToolStripMenuItem"
               Me.hideReportPaneToolStripMenuItem.Size = New System.Drawing.Size(169, 22)
               Me.hideReportPaneToolStripMenuItem.Text = "&Hide Report Pane"
               Me.hideReportPaneToolStripMenuItem.Visible = False
               '
               'FormulaTracing
               '
               Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
               Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
               Me.Controls.Add(Me.splitContainer1)
               Me.Controls.Add(Me.menuStrip1)
               Me.Name = "Formula Tracing"
               Me.Size = New System.Drawing.Size(1209, 791)
               Me.Controls.SetChildIndex(Me.menuStrip1, 0)
               Me.Controls.SetChildIndex(Me.splitContainer1, 0)
               Me.splitContainer1.Panel1.ResumeLayout(False)
               Me.splitContainer1.Panel2.ResumeLayout(False)
               CType(Me.splitContainer1, System.ComponentModel.ISupportInitialize).EndInit()
               Me.splitContainer1.ResumeLayout(False)
               Me.splitContainer2.Panel1.ResumeLayout(False)
               Me.splitContainer2.Panel1.PerformLayout()
               Me.splitContainer2.Panel2.ResumeLayout(False)
               CType(Me.splitContainer2, System.ComponentModel.ISupportInitialize).EndInit()
               Me.splitContainer2.ResumeLayout(False)
               CType(Me.fpSpread1, System.ComponentModel.ISupportInitialize).EndInit()
               Me.splitContainer3.Panel1.ResumeLayout(False)
               CType(Me.splitContainer3, System.ComponentModel.ISupportInitialize).EndInit()
               Me.splitContainer3.ResumeLayout(False)
               Me.menuStrip1.ResumeLayout(False)
               Me.menuStrip1.PerformLayout()
               Me.ResumeLayout(False)
               Me.PerformLayout()

          End Sub

#End Region
          Private splitContainer1 As System.Windows.Forms.SplitContainer
		Private splitContainer2 As System.Windows.Forms.SplitContainer
		Private nameBox1 As FarPoint.Win.Spread.NameBox
		Private formulaTextBox1 As FarPoint.Win.Spread.FormulaTextBox
		Private splitContainer3 As System.Windows.Forms.SplitContainer
		Private menuStrip1 As System.Windows.Forms.MenuStrip
		Private fileToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
          Private WithEvents openToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
          Private toolStripMenuItem1 As System.Windows.Forms.ToolStripSeparator
		Private formulaTracingToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
          Private WithEvents showDependentsToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
          Private showPrecedentsToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
		Private removeArrowsToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
		Private toolStripMenuItem2 As System.Windows.Forms.ToolStripSeparator
		Private generateReportToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
          Private hideReportPaneToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
          Private linkLabel1 As System.Windows.Forms.LinkLabel
          Private fpSpread1 As FarPoint.Win.Spread.FpSpread
          Private fpSpread2 As FarPoint.Win.Spread.FpSpread
          Private fpSpread1_Sheet1 As FarPoint.Win.Spread.SheetView
          Private WithEvents fpSpread2_Sheet1 As FarPoint.Win.Spread.SheetView
     End Class
End Namespace

'
'RecalculateAction.vb
'

Namespace Features
	Class RecalculateAction
		Inherits FarPoint.Win.Spread.Action
		Public Overrides Sub PerformAction(sender As Object)
			Dim sv As SpreadView = TryCast(sender, FarPoint.Win.Spread.SpreadView)
			sv.Sheets(sv.ActiveSheetIndex).Recalculate()
		End Sub
	End Class
End Namespace