#include "hbclass.ch" CREATE CLASS TFormattedText FROM TText DATA aRichTextRuns INIT {} METHOD New( oParent ) CONSTRUCTOR METHOD Init( oParent ) METHOD Create() METHOD End() METHOD Save() METHOD Load( hData ) METHOD GenerarRenderizable( oContextoEjecucion ) ENDCLASS METHOD New( oParent ) CLASS TFormattedText ::Init( oParent ) RETURN Self METHOD Init( oParent ) CLASS TFormattedText ::Super:Init( oParent ) ::cName := "Texto formateado" ::cType := "TFormattedText" ::aRichTextRuns := {} RETURN Self METHOD Create() CLASS TFormattedText RETURN Self METHOD End() CLASS TFormattedText ::aRichTextRuns := {} RETURN ::Super:End() METHOD Save() CLASS TFormattedText LOCAL hData := ::Super:Save() hData[ "cType" ] := "TFormattedText" hData[ "aRichTextRuns" ] := ::aRichTextRuns RETURN hData METHOD Load( hData ) CLASS TFormattedText ::Super:Load( hData ) ::cType := "TFormattedText" ::aRichTextRuns := iif( HB_ISHASH( hData ) .AND. hb_HHasKey( hData, "aRichTextRuns" ) .AND. HB_ISARRAY( hData[ "aRichTextRuns" ] ), hData[ "aRichTextRuns" ], {} ) RETURN Self METHOD GenerarRenderizable( oContextoEjecucion ) CLASS TFormattedText LOCAL hRender := ::Super:GenerarRenderizable( oContextoEjecucion ) LOCAL aRuns := {} LOCAL hRun LOCAL hOutput LOCAL cExpression IF hRender == NIL RETURN NIL ENDIF FOR EACH hRun IN ::aRichTextRuns IF HB_ISHASH( hRun ) hOutput := hb_HClone( hRun ) cExpression := iif( hb_HHasKey( hRun, "cExpression" ), ::ValorAString( hRun[ "cExpression" ] ), Chr( 34 ) + Chr( 34 ) ) hOutput[ "cText" ] := ::ValorAString( oContextoEjecucion:EvaluarFormula( cExpression ) ) AAdd( aRuns, hOutput ) ENDIF NEXT hRender[ "tipo" ] := "texto_formateado" hRender[ "runs" ] := aRuns RETURN hRender