C# Class SIL.FieldWorks.TE.TeImporter

This class handles importing of Scripture, back translations, and notes.
Note: this class runs on a background thread. It can't call any UI methods directly!
Inheritance: IFWDisposable
Show file Open project: sillsdev/FieldWorks Class Usage Examples

Protected Properties

Property Type Description
m_BTStrBldrs ITsStrBldr>.Dictionary
m_CurrFootnote IScrFootnote
m_DefaultIntroParaProxy SIL.FieldWorks.TE.ImportStyleProxy
m_DefaultIntroSectionHeadParaProxy SIL.FieldWorks.TE.ImportStyleProxy
m_DefaultScrParaProxy SIL.FieldWorks.TE.ImportStyleProxy
m_ParaBldr SIL.FieldWorks.FDO.Cellar.StTxtParaBldr
m_SavedParaBldr SIL.FieldWorks.FDO.Cellar.StTxtParaBldr
m_ScrSectionHeadParaProxy SIL.FieldWorks.TE.ImportStyleProxy
m_Title IStText
m_cache SIL.FieldWorks.FDO.FdoCache
m_currBtPictureInfo BTPictureInfo
m_currPictureInfo ToolboxPictureInfo
m_currSection IScrSection
m_currentRef SILUBS.SharedScrUtils.BCVRef
m_existingAnnotations IScrScriptureNote>.Dictionary
m_fCurrentSectionIsIntro bool
m_fFoundABook bool
m_fInBookTitle bool
m_fInFootnote bool
m_fInScriptureText bool
m_fInSectionHeading bool
m_fInVerseTextParagraph bool
m_firstImportedRef ScrReference
m_iCurrFootnote int
m_iCurrSection int
m_importCallbacks TeImportUi
m_isDisposed bool
m_nBookNumber int
m_prevRef SILUBS.SharedScrUtils.BCVRef
m_sPrevBook string
m_savedVersionDescription string
m_scr IScripture
m_scrBook IScrBook
m_sectionContent IStText
m_sectionHeading IStText
m_styleSheet FwStyleSheet
m_ttpChapterNumber ITsTextProps
m_undoManager SIL.FieldWorks.TE.UndoImportManager
m_wsAnal int
m_wsVern int

Private Properties

Property Type Description
Pause void
Resume void

Public Methods

Method Description
CheckDisposed ( ) : void

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.

Dispose ( ) : void

Must not be virtual.

Protected Methods

Method Description
CheckPause ( ) : void

Checks to see if a pause has been requested.

Dispose ( bool disposing ) : void

Executes in two distinct scenarios. 1. If disposing is true, the method has been called directly or indirectly by a user's code via the Dispose method. Both managed and unmanaged resources can be disposed. 2. If disposing is false, the method has been called by the runtime from inside the finalizer and you should not reference (access) other managed objects, as they already have been garbage collected. Only unmanaged resources can be disposed.

If any exceptions are thrown, that is fine. If the method is being done in a finalizer, it will be ignored. If it is thrown by client code calling Dispose, it needs to be handled by fixing the bug. If subclasses override this method, they should call the base implementation.

EndFootnote ( ) : void

TeSfmImporter needs to do something for this, but TeXmlImporter doesn't.

FinalizePrevSection ( ) : void

Finalizes section references and checks if the current section has any heading text and content. If not, a single blank paragraph is written for whatever is missing.

FindOrCreateAnnotation ( ScrAnnotationInfo info, ICmObject annotatedObj ) : IScrScriptureNote

Finds or creates an annotation.

GetAnnotDiscussionParaBldr ( ScrAnnotationInfo info ) : SIL.FieldWorks.FDO.Cellar.StTxtParaBldr

Gets a paragraph builder for a simple, single-paragraph Scripture annotation discussion field. The base implementation just returns null, but this is virtual to allow subclasses to return something useful if they don't handle complex annotations.

MakeSection ( ) : void

Add a section, with empty heading and contents. Sets the following members: m_currSection, m_hvoSectionHeading, m_hvoSectionContent

PrepareToImportNewBook ( ) : void

Creates a new book having the "canonical" book number m_nBookNumber. The new book is stored in the saved version. It also creates a title object for the book and puts he hvo of the title in m_hvoTitle.

ResetStateVariablesForNewBook ( ) : void

Resets importer state variables for the new book

SetBookAnnotations ( ) : void

Store the set of annotations that exist for the given book before importing.

StartBookTitle ( ) : void

Set everything up for processing a book title.

StartingNewBook ( ) : void

Updates the previous book name.

UpdateProgressDlgForBook ( string stid ) : void

Update the message in the progress dialog box to reflect the book being imported

Private Methods

Method Description
Pause ( ) : void

Pauses the import.

Resume ( ) : void

Resumes the import.

Method Details

CheckDisposed() public method

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.
public CheckDisposed ( ) : void
return void

CheckPause() protected method

Checks to see if a pause has been requested.
protected CheckPause ( ) : void
return void

Dispose() public method

Must not be virtual.
public Dispose ( ) : void
return void

Dispose() protected method

Executes in two distinct scenarios. 1. If disposing is true, the method has been called directly or indirectly by a user's code via the Dispose method. Both managed and unmanaged resources can be disposed. 2. If disposing is false, the method has been called by the runtime from inside the finalizer and you should not reference (access) other managed objects, as they already have been garbage collected. Only unmanaged resources can be disposed.
If any exceptions are thrown, that is fine. If the method is being done in a finalizer, it will be ignored. If it is thrown by client code calling Dispose, it needs to be handled by fixing the bug. If subclasses override this method, they should call the base implementation.
protected Dispose ( bool disposing ) : void
disposing bool
return void

EndFootnote() protected method

TeSfmImporter needs to do something for this, but TeXmlImporter doesn't.
protected EndFootnote ( ) : void
return void

FinalizePrevSection() protected method

Finalizes section references and checks if the current section has any heading text and content. If not, a single blank paragraph is written for whatever is missing.
protected FinalizePrevSection ( ) : void
return void

FindOrCreateAnnotation() protected method

Finds or creates an annotation.
protected FindOrCreateAnnotation ( ScrAnnotationInfo info, ICmObject annotatedObj ) : IScrScriptureNote
info ScrAnnotationInfo The information about a annotation being imported.
annotatedObj ICmObject The annotated object (a book or paragraph).
return IScrScriptureNote

GetAnnotDiscussionParaBldr() protected method

Gets a paragraph builder for a simple, single-paragraph Scripture annotation discussion field. The base implementation just returns null, but this is virtual to allow subclasses to return something useful if they don't handle complex annotations.
protected GetAnnotDiscussionParaBldr ( ScrAnnotationInfo info ) : SIL.FieldWorks.FDO.Cellar.StTxtParaBldr
info ScrAnnotationInfo The information about a annotation being imported.
return SIL.FieldWorks.FDO.Cellar.StTxtParaBldr

MakeSection() protected method

Add a section, with empty heading and contents. Sets the following members: m_currSection, m_hvoSectionHeading, m_hvoSectionContent
protected MakeSection ( ) : void
return void

PrepareToImportNewBook() protected method

Creates a new book having the "canonical" book number m_nBookNumber. The new book is stored in the saved version. It also creates a title object for the book and puts he hvo of the title in m_hvoTitle.
protected PrepareToImportNewBook ( ) : void
return void

ResetStateVariablesForNewBook() protected method

Resets importer state variables for the new book
protected ResetStateVariablesForNewBook ( ) : void
return void

SetBookAnnotations() protected method

Store the set of annotations that exist for the given book before importing.
protected SetBookAnnotations ( ) : void
return void

StartBookTitle() protected method

Set everything up for processing a book title.
protected StartBookTitle ( ) : void
return void

StartingNewBook() protected method

Updates the previous book name.
protected StartingNewBook ( ) : void
return void

UpdateProgressDlgForBook() protected method

Update the message in the progress dialog box to reflect the book being imported
protected UpdateProgressDlgForBook ( string stid ) : void
stid string The resource id for the format string to use
return void

Property Details

m_BTStrBldrs protected property

String builders to construct back-trans paragraph strings.
protected Dictionary m_BTStrBldrs
return ITsStrBldr>.Dictionary

m_CurrFootnote protected property

The current footnote; null if m_fInFootnote is both false.
protected IScrFootnote m_CurrFootnote
return IScrFootnote

m_DefaultIntroParaProxy protected property

Default Background paragraph style proxy
protected ImportStyleProxy,SIL.FieldWorks.TE m_DefaultIntroParaProxy
return SIL.FieldWorks.TE.ImportStyleProxy

m_DefaultIntroSectionHeadParaProxy protected property

Background Section Head paragraph style proxy
protected ImportStyleProxy,SIL.FieldWorks.TE m_DefaultIntroSectionHeadParaProxy
return SIL.FieldWorks.TE.ImportStyleProxy

m_DefaultScrParaProxy protected property

Default Scripture paragraph style proxy
protected ImportStyleProxy,SIL.FieldWorks.TE m_DefaultScrParaProxy
return SIL.FieldWorks.TE.ImportStyleProxy

m_ParaBldr protected property

String builder to construct paragraph strings.
protected StTxtParaBldr,SIL.FieldWorks.FDO.Cellar m_ParaBldr
return SIL.FieldWorks.FDO.Cellar.StTxtParaBldr

m_SavedParaBldr protected property

Used to save and restore an "outer" string builder when creating "nested" paragraphs, such as footnotes.
protected StTxtParaBldr,SIL.FieldWorks.FDO.Cellar m_SavedParaBldr
return SIL.FieldWorks.FDO.Cellar.StTxtParaBldr

m_ScrSectionHeadParaProxy protected property

Scripture Section Head paragraph style proxy
protected ImportStyleProxy,SIL.FieldWorks.TE m_ScrSectionHeadParaProxy
return SIL.FieldWorks.TE.ImportStyleProxy

m_Title protected property

ID of title
protected IStText m_Title
return IStText

m_cache protected property

The cache
protected FdoCache,SIL.FieldWorks.FDO m_cache
return SIL.FieldWorks.FDO.FdoCache

m_currBtPictureInfo protected property

Information about the current BT picture being processed (for Toolbox-style markup)
protected BTPictureInfo,SIL.FieldWorks.TE m_currBtPictureInfo
return BTPictureInfo

m_currPictureInfo protected property

Information about the current picture being processed (for Toolbox-style markup)
protected ToolboxPictureInfo m_currPictureInfo
return ToolboxPictureInfo

m_currSection protected property

Current section we are adding to
protected IScrSection m_currSection
return IScrSection

m_currentRef protected property

Reference of current segment
protected BCVRef,SILUBS.SharedScrUtils m_currentRef
return SILUBS.SharedScrUtils.BCVRef

m_existingAnnotations protected property

the set of annotations for the current book existing before import
protected Dictionary m_existingAnnotations
return IScrScriptureNote>.Dictionary

m_fCurrentSectionIsIntro protected property

Indicates whether the current section being worked on is an intro section
protected bool m_fCurrentSectionIsIntro
return bool

m_fFoundABook protected property

Gets set to true if a book is found during the import
protected bool m_fFoundABook
return bool

m_fInBookTitle protected property

Currently processing a book title
protected bool m_fInBookTitle
return bool

m_fInFootnote protected property

Currently processing a footnote
protected bool m_fInFootnote
return bool

m_fInScriptureText protected property

We have begun processing actual Scripture text for the current book (as opposed to background materials, etc.) If true, the current section is a scripture text section. One implication of this distinction is that for Scripture sections, the caption bar will display the range of references.
protected bool m_fInScriptureText
return bool

m_fInSectionHeading protected property

Currently processing a section heading
protected bool m_fInSectionHeading
return bool

m_fInVerseTextParagraph protected property

Currently processing a paragraph whose context is ContextValues.Text and structure is StructureValues.Body.
protected bool m_fInVerseTextParagraph
return bool

m_firstImportedRef protected property

the first imported reference
protected ScrReference m_firstImportedRef
return ScrReference

m_iCurrFootnote protected property

The index of the next footnote to insert (for the current book)
protected int m_iCurrFootnote
return int

m_iCurrSection protected property

Index of current section (0-based).
protected int m_iCurrSection
return int

m_importCallbacks protected property

UI Callbacks
protected TeImportUi,SIL.FieldWorks.TE m_importCallbacks
return TeImportUi

m_isDisposed protected property

True, if the object has been disposed.
protected bool m_isDisposed
return bool

m_nBookNumber protected property

Current book number, based on cannonical order (e.g., Gen = 1)
protected int m_nBookNumber
return int

m_prevRef protected property

Last (previous) reference found (typically equal to m_currentRef only at the start of the import process)
protected BCVRef,SILUBS.SharedScrUtils m_prevRef
return SILUBS.SharedScrUtils.BCVRef

m_sPrevBook protected property

Previous book number (in a string)
protected string m_sPrevBook
return string

m_savedVersionDescription protected property

The description to use if the user wants to make a saved version.
protected string m_savedVersionDescription
return string

m_scr protected property

The data model Scripture object
protected IScripture m_scr
return IScripture

m_scrBook protected property

Book we are currently adding to
protected IScrBook m_scrBook
return IScrBook

m_sectionContent protected property

StText that is the section content
protected IStText m_sectionContent
return IStText

m_sectionHeading protected property

StText that is the section heading
protected IStText m_sectionHeading
return IStText

m_styleSheet protected property

Stylesheet used for importing
protected FwStyleSheet m_styleSheet
return FwStyleSheet

m_ttpChapterNumber protected property

Text props for chapter number character style
protected ITsTextProps m_ttpChapterNumber
return ITsTextProps

m_undoManager protected property

Info needed to undo, including the archived draft where we save existing books
protected UndoImportManager,SIL.FieldWorks.TE m_undoManager
return SIL.FieldWorks.TE.UndoImportManager

m_wsAnal protected property

The writing system we use for all non-vernacular text.
protected int m_wsAnal
return int

m_wsVern protected property

The writing system we use for all vernacular text.
protected int m_wsVern
return int