Clarification regarding styles needed
Posted: Tue Jan 31, 2006 7:00 pm
I'm finally putting TRichView to some real use and I need to understand a few things about styles.
Basically, my app is a rich text editor, which allows users to create documents with all kinds of goodies (basic formatting, alignment, tables, pictures, etc.). Additionally, users should be able to select certain parts of their documents, tag those parts with an invisible id and make them protected so they can't be modified anymore.
This is all well and done. For this purpose I defined two styles at design-time:
- normal text
- tagged text
When user selects some text, they can right-click it and convert it to tagged text by inserting a string tag with InsertStringWTag and applying the 2nd style.
This works fine with new documents - i.e. the ones that user starts building from scratch.
Problems arise, when user decides to import an existing RTF document. This action messes up the styles that I defined at design-time.
RTFReadProperties.ParaStyleMode and TextStyleMode are both set to rvrsAddIfNeeded, because I want to preserve original RTF formatting as much as possible.
So now I have 2 questions:
1. What should I do to allow for dynamic addition of styles from the loaded RTF document AND preserve my "tagged text" style from design-time?
2. Where can I find out more about the mechanics behind styles? Do I need to define them at all or are they dynamically built when user modifies the document (bold, italic, right align, etc.)?
Aleksander
Basically, my app is a rich text editor, which allows users to create documents with all kinds of goodies (basic formatting, alignment, tables, pictures, etc.). Additionally, users should be able to select certain parts of their documents, tag those parts with an invisible id and make them protected so they can't be modified anymore.
This is all well and done. For this purpose I defined two styles at design-time:
- normal text
- tagged text
When user selects some text, they can right-click it and convert it to tagged text by inserting a string tag with InsertStringWTag and applying the 2nd style.
This works fine with new documents - i.e. the ones that user starts building from scratch.
Problems arise, when user decides to import an existing RTF document. This action messes up the styles that I defined at design-time.
RTFReadProperties.ParaStyleMode and TextStyleMode are both set to rvrsAddIfNeeded, because I want to preserve original RTF formatting as much as possible.
So now I have 2 questions:
1. What should I do to allow for dynamic addition of styles from the loaded RTF document AND preserve my "tagged text" style from design-time?
2. Where can I find out more about the mechanics behind styles? Do I need to define them at all or are they dynamically built when user modifies the document (bold, italic, right align, etc.)?
Aleksander