VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "ProcessorMasterDoc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Implements AProcessor

Public word_ As API_WordWrapper

Public countProcessed_ As Long
Public countAll_ As Long

Public Function Init()
  countProcessed_ = 0
  countAll_ = 0
  
  Set word_ = New API_WordWrapper: Call word_.CreateApplication
  Call word_.NewDocument
  word_.Document.ActiveWindow.ActivePane.View.Type = wdOutlineView
  word_.Document.ActiveWindow.View = wdMasterView
End Function

Public Function Finalize()

End Function

Public Function AProcessor_ProcessSource(iSource As IteratorSource)
  countAll_ = countAll_ + 1
  
  On Error GoTo FAILED_TO_ADD
  Call word_.Document.Subdocuments.AddFromFile(iSource.Path, ConfirmConversions:=True, ReadOnly:=False, Revert:=False)
  On Error GoTo 0
  
  countProcessed_ = countProcessed_ + 1

  Exit Function
FAILED_TO_ADD:
End Function
