trichview.com

trichview.support




Extending TRichView in a maintainable way


Return to index


Author

Message

Martin Holmes

Posted: 09/09/2004 15:43:24


Hi there,


I need to add XHTML 1.1 output to TRichView, and looking through the

code, it looks as though I can basically achieve this by rewriting

function TCustomRVData.SaveHTMLToStreamEx; the changes are minor --

mainly lower-casing tags, adding quotes to attribute values, and so on.

However, I don't want to edit the original function because changes

would be overwritten by subsequent updates to TRichView. I'm unsure

about the best way to add this functionality. If I subclass

TCustomRVData, I'll have to subclass all its parents all the way up to

TCustomRichViewEdit, which will be messy. I'd thought of writing an

external function something like this:


function SaveXHTMLToStreamEx(RVD: TCustomRVData; Stream: TStream; const

Path,

   Title, ImagesPrefix, ExtraStyles, ExternalCSS, CPPrefix: String;

   Options: TRVSaveOptions; Color: TColor; var CurrentFileColor: TColor;

   var imgSaveNo: Integer; LeftMargin, TopMargin, RightMargin,

BottomMargin: Integer;

   Background: TRVBackground; Bullets: TRVList): Boolean;


begin


       with RVD do

               begin

{...}


               end;

end;


This passes the a pointer to the TCustomRVData object into the function,

  then wraps the rest of the code in a "with" clause. Is this likely to

be a successful approach, or is there a better way to add this

functionality such a way that updates to TRichView won't overwrite it?


All help appreciated,

Martin





Powered by ABC Amber Outlook Express Converter