There are no predefined styles.
Each document has its own list of styles.
But there are some reserved names of styles, such as "Normal", "heading 1", "Hyperlink", etc. They may have special meaning; and RichViewActions display their names translated.
But documents do not necessary include these styles. Actually, only one style - "Normal" - is absolutely necessary.
At design time, in the Object Inspector, when you edit Name property of a style (styletemplate), you can see a list of predefined names. However, when you assign Name, other properties are not changed, you need to define them yourself (well, there are some exceptions: for some styles, values of Kind and ParentId properties are adjusted depending on names).
Probably, it would be simpler to fill rvActionNew.StyleTemplates in code than at design time.
For this task, you can use the function from RVStyleFuncs.pas from RichViewActions:
Code: Select all
procedure RVSetStandardStyleDefaults(StyleType: TRVStandardStyle;
Level: Integer; StyleTemplate: TRVStyleTemplate; RVStyle: TRVStyle;
StyleTemplates, StandardStyleTemplates: TRVStyleTemplateCollection;
ControlPanel: TComponent);
This function sets default properties for the specified style according to StyleType and Level.
StyleType value is one of:
Code: Select all
TRVStandardStyle = (rvssnNormal, rvssnNormalIndent, rvssnNoSpacing,
rvssnHeadingN, rvssnListParagraph, rvssnHyperlink, rvssnTitle,
rvssnSubtitle, rvssnEmphasis, rvssnSubtleEmphasis, rvssnIntenseEmphasis,
rvssnStrong, rvssnQuote, rvssnIntenseQuote, rvssnSubtleReference,
rvssnIntenseReference, rvssnBlockText, rvssnHTMLVariable, rvssnHTMLCode,
rvssnHTMLAcronym, rvssnHTMLDefinition, rvssnHTMLKeyboard, rvssnHTMLSample,
rvssnHTMLTypewriter, rvssnHTMLPreformatted, rvssnHTMLCite, rvssnHeader,
rvssnFooter, rvssnPageNumber, rvssnCaption, rvssnEndnoteReference,
rvssnFootnoteReference, rvssnEndnoteText, rvssnFootnoteText,
rvssnSidenoteReference, rvssnSidenoteText);
Level is a heading level, used only if StyleType = rvssnHeadingN.
Example of use (adding "Title" style and setting its default properties):
Code: Select all
var
ST: TRVStyleTemplate;
ST := rvActionNew1.StyleTemplates.Add;
RVSetStandardStyleDefaults(rvssnTitle, 0, ST, nil, rvActionNew1.StyleTemplates, nil, RVAControlPanel1);
RVSetStandardStyleDefaults is used internally in RichViewActions in the style management dialog (when the user adds a standard style).
You can use this function to add all standard styles:
Code: Select all
var
SType: TRVStandardStyle;
Level: Integer;
rvActionNew1.StyleTemplates.Clear;
for SType := Low(TRVStandardStyle) to High(TRVStandardStyle) do
RVSetStandardStyleDefaults(SType, 1, rvActionNew1.StyleTemplates.Add, nil, rvActionNew1.StyleTemplates, nil, RVAControlPanel1);
for Level := 2 to 6 do
RVSetStandardStyleDefaults(rvssnHeadingN, Level, rvActionNew1.StyleTemplates.Add, nil, rvActionNew1.StyleTemplates, nil, RVAControlPanel1);