import { IQuestion , LocalizableString , QuestionBooleanModel } from 'survey-core' ; import { SurveyPDF } from '../survey' ; import { IPoint , DocController } from '../doc_controller' ; import { FlatQuestion } from './flat_question' ; import { FlatRepository } from './flat_repository' ; import { IPdfBrick } from '../pdf_render/pdf_brick' ; import { TextBrick } from '../pdf_render/pdf_text' ; import { BooleanItemBrick } from '../pdf_render/pdf_booleanitem' ; import { CompositeBrick } from '../pdf_render/pdf_composite' ; import { SurveyHelper } from '../helper_survey' ; export class FlatBoolean extends FlatQuestion { protected question : QuestionBooleanModel ; constructor ( protected survey , question , protected controller ) { super ( survey , question , controller ) ; this . question = < QuestionBooleanModel > question ; } public async generateFlatsContent ( point ) { const compositeFlat = new CompositeBrick ( ) ; const height = this . controller . unitHeight ; const itemFlat = new BooleanItemBrick ( this . question , this . controller , SurveyHelper . moveRect ( SurveyHelper . scaleRect ( SurveyHelper . createRect ( point , height , height ) , SurveyHelper . SELECT_ITEM_FLAT_SCALE ) , point . xLeft ) ) ; compositeFlat . addBrick ( itemFlat ) ; const textPoint = SurveyHelper . clone ( point ) ; textPoint . xLeft = itemFlat . xRight + this . controller . unitWidth * SurveyHelper . GAP_BETWEEN_ITEM_TEXT ; const locLabelText = this . question . isIndeterminate ? null : this . question . checkedValue ? this . question . locLabelTrue : this . question . locLabelFalse ; if ( locLabelText !== null && locLabelText . renderedHtml !== null ) { compositeFlat . addBrick ( await SurveyHelper . createTextFlat ( textPoint , this . question , this . controller , locLabelText , TextBrick ) ) ; } return [ compositeFlat ] ; } } FlatRepository . getInstance ( ) . register ( 'boolean' , FlatBoolean ) ;