<< Click to display table of contents >> TRVStyle |
This invisible at run-time component is used for defining a visual appearance of RichView and its descendant components.
Unit [VCL/FMX] RVStyle / fmxRVStyle.
Syntax
TRVStyle = class(TComponent)
TObject
TPersistent
TComponent
If you want to display some document in RichView, associate this RichView with some RVStyle component: create TRVStyle component and assign it to the Style property of RichView. You can do it at design-time using the the Object Inspector.
The same RVStyle object can be used by several RichView, RichViewEdit, DBRichView, DBRichViewEdit controls.
But if you use the following:
▪TCustomRichView.DeleteUnusedStyles;
▪TDBRichViewEdit.AutoDeleteUnusedStyles=True;
▪TCustomRichView.LoadRVF, LoadRVFFromStream, and RVFTextStylesReadMode or RVFParaStylesReadMode <> rvf_sIgnore;
▪TDBRichView or TDBRichViewEdit, and RVFTextStylesReadMode or RVFParaStylesReadMode <> rvf_sIgnore
you must use one RVStyle for one RichView.
TRVStyle has a design-time component editor (unit RVSEdit). This editor:
▪adds 3 items into the context menu for component: “Edit Text Styles”, “Edit Paragraph Styles”, “Edit List Styles” which invoke property editors for TextStyles, ParaStyles, or ListStyles;
▪adds “Convert Lengths to twips” (... to pixels, ... to EMU) item in the context menu, allowing to convert all RVStyle properties measured in Units.
▪adds 3 items into the context menu for component: “Edit Style Templates”, “Save Style Templates...”, “Load Style Templates...” which invoke property editors for StyleTemplates, save them to a file, and load them from a file.
▪invokes property editor for TextStyles on double-click.
Three main properties of RVStyle are:
▪TextStyles – collection of text attributes (styles), a collection of TFontInfo items;
▪ParaStyles – collection of paragraph attributes (styles), a collection of TParaInfo items;
▪ListStyles – collection of paragraph list styles (bullets and numbering), a collection of TRVListInfo items.
Style templates ("real" styles)
▪StyleTemplates – collection of "real" styles, controlling properties of TextStyles and ParaStyles;
Units of measurement
▪Units defines measure units for properties of this component and documents in linked TRichViiew controls.
▪UnitsPixelsPerInch defines DPI for values measured in pixels.
RVStyle allows to set some colors for associated controls:
▪Color – background color;
▪SelColor, InactiveSelColor – background colors of selected text (with and without focus);
▪SelTextColor, InactiveSelTextColor – colors of selected text (with and without focus);
▪DisabledFontColor – text color for disabled controls.
▪HoverColor – default color of hypertext links under the mouse pointer;
▪CheckpointColor, CheckpointEvColor – colors of checkpoints (if visible);
▪PageBreakColor – color of explicit page breaks (if visible);
▪FloatingLineColor – color of placeholders for left- and right-aligned items (if visible).
▪GridColor, GridReadOnlyColor – colors of table grid lines (if visible); GridStyle, GridReadOnlyStyle define their pen styles.
RVStyle allows to set cursors:
JumpCursor – hypertext cursor for hotspots and hot-pictures (and default cursor for text hypertext items);
LineSelectCursor – cursor for the left margin.
Tabs:
▪SpacesInTab – If positive, Add*** methods of RichView, methods for loading text and RTF, keyboard input will replace tab characters with the specified number of spaces. If 0 (default), a special tabulator item type is used;
▪DefTabWidth – default distance between tab stops.
Properties related to label items and item types inherited from them:
▪FieldHighlightColor – color for highlighting label items.
▪FieldHighlightType specifies when to highlight label items.
▪FootnoteNumbering – numbering type for footnotes.
▪FootnotePageReset – numbering mode for footnotes.
▪EndnoteNumbering – numbering type for endnotes.
▪SidenoteNumbering – numbering type for sidenotes.
Properties related to selection:
▪SelectionStyle – visual appearance of selection (draw for objects or lines);
▪SelectionMode – modes of making selection;
▪SelectionHandleKind – visual appearance of touch screen selection handles;
▪SelColor, InactiveSelColor – background colors of selected text (with and without focus);
▪SelTextColor, InactiveSelTextColor – colors of selected text (with and without focus).
▪SelOpacity – selection fill opacity (opaque and semitransparent selection is drawn differently)
Other properties
▪TextEngine specifies which API is used for drawing and measuring text;
▪FontQuality – font quality and anti-aliasing;
▪DefCodePage – default code page for internal ANSI <->Unicode conversion;
▪LineWrapMode specifies a line wrapping algorithm;
▪UseSound.
If another TRVStyle component is assigned to MainRVStyle property, most properties of this TRVStyle simply provide access to properties of this main TRVStyle.
(For example, SelColor returns MainRVStyle.SelColor).
Initially, this feature was implemented to allow using a single StyleTemplates collection in multiple TRVStyle components. But in the new version of TRVStyle all properties of MainRVStyle are shared.
The following properties are not shared:
▪all events
You can save and load all information in RVStyle in ini-file:
▪SaveINI saves RVStyle properties in ini-file;
▪LoadINI loads RVStyle properties from ini-file;
or registry:
▪SaveReg saves RVStyle properties in ini-file;
▪LoadReg loads RVStyle properties from ini-file.
You can export styles in style sheet (for saving HTML files):
▪SaveCSS;
You can search for a style with the specified properties:
Custom drawing:
▪OnDrawCheckpoint – drawing checkpoint;
▪OnDrawPageBreak – drawing page break;
▪OnDrawParaBack – drawing background of paragraph;
▪OnDrawTextBack – drawing background of text;
▪OnApplyStyle – applying text style to Canvas;
▪OnApplyStyleColor – applying text style color to Canvas;
▪OnDrawStyleText – drawing text of the given style;
▪OnStyleHoverSensitive – "should the component be repainted when user moves the mouse pointer over hyperlink of the given style?".