'#Reference {A3B5C45B-F842-44fc-A5E5-50CED69BA86E}#2.0#0#C:\Program Files\Mindjet\MindManager 6\Mm5WebExport.dll#Mm5webexport 2.0 Type Library
'#Uses "ParameterNames.mmbas"
'#Uses "GlobalUtilities.mmbas"

Option Explicit

Sub Main

    Dim addin As Mm5WebExportAddIn
    Dim webex As WebExport

    Set addin = WebExportHelper.WebExportAddIn
    Set webex = addin.ActiveWebExport

    Dim template As String
    Dim onePage As Page
    Dim oneTopic As Topic

    On Error GoTo ReportError

    webex.Trace("Entering GeneratePage", 2)

    ' Need unique index number for images on page to export unique file names
    webex.SetParameter("CustomParameter.ImageCounter", 1)

    ' Boxes must be numbered per page and per type from 0 upwards for cookie code to work
    webex.SetParameter("CustomParameter.BoxCounterTaskPlanning", 0)
    webex.SetParameter("CustomParameter.BoxCounterTextMarkers", 0)
    webex.SetParameter("CustomParameter.BoxCounterDataContainer", 0)
    webex.SetParameter("CustomParameter.BoxCounterComments", 0)

    ' We want the topic text of the first topic on
    ' the page to be the title of the export page
    Set onePage = webex.ActivePage
    Set oneTopic = onePage.GetTopic(1)
    webex.SetParameter("CustomParameter.PageTitle", VerifyTopicText(webex, oneTopic))

    'add the name of the root HTML page here (layout specific)
    template = webex.ReadFile("SoPage.htm")

    ProcessString webex, template
    webex.WriteFile(webex.ActivePage.FileName, template)
    
    webex.Trace("Exiting GeneratePage", 2)
    
    Exit Sub
   
ReportError:
    ProcessError(webex)
    Exit Sub
   
End Sub
