'#Reference {A3B5C45B-F842-44fc-A5E5-50CED69BA86E}#2.0#0#C:\Program Files\Mindjet\MindManager 6\Mm5WebExport.dll#Mm5webexport 2.0 Type Library
' Clickable Imagemap page: only called once

'#Uses "ParameterNames.mmbas"
'#Uses "GlobalUtilities.mmbas"

Option Explicit

Sub Main

    Dim m_Addin As Mm5WebExportAddIn
    Dim m_Webex As WebExport
    Dim s_Template As String
    Dim m_Page As Page
    Dim m_Topic As Topic

    Set m_Addin = WebExportHelper.WebExportAddIn
    Set m_Webex = m_Addin.ActiveWebExport

    On Error GoTo ReportError

    m_Webex.Trace("Entering GeneratePage", 2)

    Set m_Page = m_Webex.ActivePage
    Set m_Topic = m_Page.GetTopic(1)

    ' Only export once at the Central Topic: the pagination should be set to force this
    If m_Topic.IsCentralTopic Then
        ' Set the title of the exported page
        m_Webex.SetParameter("CustomParameter.PageTitle", VerifyTopicText(m_Webex, m_Topic))
        ' Read template and process it
        s_Template = m_Webex.ReadFile("ImgmapPage.htm")
        ProcessString m_Webex, s_Template
        ' Write file back again
        m_Webex.WriteFile(m_Webex.ActivePage.Filename, s_Template)
    End If
    
    m_Webex.Trace("Exiting GeneratePage", 2)
    Exit Sub
   
ReportError:
    ProcessError(m_Webex)
    Exit Sub
   
End Sub
