import { ISettings } from "./DocumentFacade" ; import { RTFJSError } from "./Helper" ; import { IColor } from "./parser/destinations/ColortblDestinations" ; import { FonttblDestinationSub } from "./parser/destinations/FonttblDestinations" ; import { Renderer } from "./renderer/Renderer" ; export class Document { public _settings : ISettings ; public _meta : { [ key ] : any ; } ; public _fonts : FonttblDestinationSub [ ] ; public _colors : IColor [ ] ; public _autoColor : number ; public _stylesheets : { index : number ; name : string ; } [ ] ; public _ins : ( string | ( ( renderer : Renderer ) => void ) ) [ ] ; constructor ( settings ) { this . _settings = settings || { } ; this . _meta = { } ; this . _fonts = [ ] ; this . _colors = [ ] ; this . _autoColor = null ; this . _stylesheets = [ ] ; this . _ins = [ ] ; } public _lookupColor ( idx ) { if ( idx === 0 ) { if ( this . _autoColor == null ) { return null ; } return this . _colors [ this . _autoColor ] ; } if ( idx < 0 || idx >= this . _colors . length ) { throw new RTFJSError ( "Invalid color index" ) ; } return this . _colors [ idx ] ; } public addIns ( ins ) { this . _ins . push ( ins ) ; } }