'-------------------------------------------------------------------------------
'--                                                                           --
'--  FILE          :  OnNextBookMark.vb                                       --
'--                                                                           --
'--  Author(s)     :  Chen Qinghua (Three Swordsmen Team)                     --
'--                                                                           --
'--  NameSpace     :  WomenWC.Menu.Search                                     --
'--                                                                           --
'--  Project       :  WomenWC                                                 --
'--                                                                           --
'--  Solution      :  Women Working with COBOL                                --
'--                                                                           --
'--  Creation Date :  2007/04/10                                              --
'-------------------------------------------------------------------------------
'--  Modifications :                                                          --
'--                                                                           --
'--                                                                           --
'--                                                                           --
'-------------------------------------------------------------------------------
'-- Copyright(C) 2007, Three Swordsmen, Beijing China                         --
'--                                                                           --
'-- This software is released under the GNU General Public License            --
'-------------------------------------------------------------------------------

Imports WomenWC.Forms
Imports WomenWC.Managers.Manager
Imports WomenWCCore.Document
Imports WomenWCCore.Infos.SearchEngine

Namespace Menu.Search
    Public Class OnNextBookMark
        Inherits MenuItemProcessBase

        Private Const STR_COMMENT As String = "次のブックマークの指定行へ移動"

        Public Sub New(ByVal womenWCMainForm As WomenWCMainForm)
            MyBase.New(womenWCMainForm)
        End Sub

        Public Overrides ReadOnly Property Comment() As String
            Get
                Return STR_COMMENT
            End Get
        End Property

        Public Overrides ReadOnly Property IsEnable() As Boolean
            Get
                If DocumentFormManager.CurrentDocumentForm IsNot Nothing Then
                    Return True
                Else
                    Return False
                End If
            End Get
        End Property

        Public Overrides Sub Execute()
            Dim currentDocForm As DocumentForm
            Dim currentDoc As Document
            Dim rtnFind As FindResultInfo
            Dim startRow As Integer

            currentDocForm = DocumentFormManager.CurrentDocumentForm
            If currentDocForm IsNot Nothing Then
                startRow = currentDocForm.WomenWCEditor.CaretPhysicalPosition.Row()
                currentDoc = currentDocForm.Document
                rtnFind = SearchManager.WomenWCSearchEngine.GetNextBookMark(currentDoc, startRow, False)
                If rtnFind IsNot Nothing Then
                    currentDocForm.WomenWCEditor.CaretMoveTo(rtnFind.FindResultRow, 0)
                End If
            End If
        End Sub

    End Class
End Namespace
