/**
* SmartForm content — what each window prints, for preview rendering.
*
* SAP side: ZMCP_ADT_DISPATCH action SSF_CONTENT → FM ZMCP_SSF_CONTENT
* (sc4sap/abap/zmcp_ssf_content.abap), read-only, four parts:
* FORM Form Builder XML of the active version (FB_CONVERT_FORM_TO_XML,
* texts in the logon language), base64
* STYLE SmartStyle as CSS (SSF_CONVERT_STYLE_TO_CSS), base64
* GRAPHIC SE78 graphic as BMP + STXBITMAPS size data, base64
* STDTEXT SO10 / include text lines (READ_TEXT)
*
* This module parses the XML into pages → windows → content nodes (text,
* table / template / loop / folder sections, graphics, addresses, code
* markers, conditions), then fetches the styles, the graphics with a fixed
* key and the include texts with a fixed key. Files (XML, CSS, BMP) are
* written under the MCP output directory; the JSON carries their paths.
*/
import type { IAbapConnection } from '@babamba2/mcp-abap-adt-interfaces';
export declare const SSF_CONTENT_INSTALL_HINT: string;
/** A field value contains a symbol such as &GV_LOGO& — resolved only at print time. */
export declare function hasSymbol(v: unknown): boolean;
/**
* Turn a field element into a plain value: `- …
…` → array,
* an element with children → object, a leaf → string. Attributes are kept
* only for ID / IDREF.
*/
export declare function plain(v: unknown): any;
export interface TextLine {
/** Paragraph format (TDFORMAT): '*' default, '=' / '/' continuation, or a paragraph tag. */
format: string;
/** Line with SAPscript inline tags (…>) and symbols (&FIELD&). */
text: string;
}
export interface ContentNode {
kind: string;
name: string;
caption: string;
/** Print condition (COND of the node), raw. */
condition?: any;
/** Box and shading of the output options (per side mm, distance, colour; fill). */
box?: any;
/** alternative (condition node): the COND lines that pick the TRUE / FALSE event */
test?: any;
/** loop / table WHERE: [{COP, OP1, OP2, LOP}] */
where?: any;
/** text */
textType?: string;
style?: string;
lines?: TextLine[];
include?: {
object: string;
name: string;
id: string;
language: string;
resolved: boolean;
};
/** For a text inside a table / template: line type and cell (TABLINE). */
tableCell?: any;
/** graphic */
graphic?: {
object: string;
name: string;
id: string;
btype: string;
resolution: string;
dynamic: boolean;
};
/** section (table / template / loop / folder / ...) */
sectionType?: string;
dataTable?: string;
width?: {
value: string;
unit: string;
mm: number | null;
};
/** Line types of a table (DYNLINES) / lines of a template (STATLINES), raw. */
lineTypes?: any;
templateLines?: any;
/** Template / table pattern and frame: outer = frame drawn around it. */
frame?: {
pattern: string;
lineMm: number;
outer: boolean;
border?: boolean;
};
cells?: any;
/** Output attributes of the node (position inside the window etc.), raw. */
output?: Record;
/** Remaining scalar attributes of the node object. */
attrs?: Record;
children: ContentNode[];
}
export interface ContentWindow {
name: string;
caption: string;
type: string;
typeCode: string;
leftMm: number | null;
topMm: number | null;
widthMm: number | null;
heightMm: number | null;
condition?: any;
box?: any;
/** alternative (condition node): the COND lines that pick the TRUE / FALSE event */
test?: any;
/** loop / table WHERE: [{COP, OP1, OP2, LOP}] */
where?: any;
content: ContentNode[];
}
export interface ContentPage {
variant: string;
name: string;
caption: string;
format: string;
orientation: string;
nextPage: string;
stdStyle: string;
windows: ContentWindow[];
}
export interface SmartFormGraphic {
object: string;
name: string;
id: string;
btype: string;
widthPix?: number;
heightPix?: number;
widthTw?: number;
heightTw?: number;
/** Printed size from twips: 1 twip = 1/1440 inch. */
widthMm?: number;
heightMm?: number;
resolution?: number;
file?: string;
error?: string;
}
export interface SmartFormContent {
form: string;
language: string;
stdStyles: string[];
pages: ContentPage[];
styles: Array<{
name: string;
file?: string;
css?: string;
error?: string;
/** standard paragraph ('*' lines) and default font from the style header */
firstParagraph?: string;
font?: {
family: string;
pt: number;
bold: boolean;
};
lpi?: number;
cpi?: number;
/** default tab distance, value + unit (e.g. "1.00 CM") */
tabDistance?: string;
/** paragraphs as stored: value + unit per attribute (SSFPARAS) */
paragraphs?: any[];
/** character formats as stored (SSFSTRINGS) */
strings?: any[];
}>;
graphics: SmartFormGraphic[];
/** printer assumed for the fonts: device, device type, its fonts [family, size 1/10 pt, bold, italic], family substitutes */
printer?: any;
includeTexts: Array<{
object: string;
name: string;
id: string;
language: string;
lines?: TextLine[];
error?: string;
}>;
/** Form interface (minus SAP's standard parameters) and global data — the types behind the &symbols&. */
data: SmartFormDataDecl[];
/** Graphics / texts whose key holds a &symbol& — only known at print time. */
dynamicReferences: string[];
files: {
xml: string;
content?: string;
};
path: string;
}
/** One data declaration of the form: interface parameter or global data. */
export interface SmartFormDataDecl {
name: string;
scope: 'import' | 'export' | 'changing' | 'tables' | 'global';
/** TYPE / LIKE / TYPE REF TO … as written in Form Builder. */
typing: string;
typeName: string;
}
export interface ParsedSmartForm {
data: SmartFormDataDecl[];
stdStyles: string[];
pages: ContentPage[];
graphicKeys: NonNullable[];
dynamicGraphics: NonNullable[];
textKeys: NonNullable[];
styles: string[];
dynamic: string[];
}
/** Parse the Form Builder XML of FB_CONVERT_FORM_TO_XML. */
export declare function parseSmartFormXml(xml: string): ParsedSmartForm;
export declare function translateSmartFormContentError(error: unknown): string;
/** Every &symbol& printed by text lines of the form (system symbols included), sorted. */
export declare function symbolsOf(pages: ContentPage[]): string[];
/** Compact view for the tool answer when the full content is read from files.content. */
export declare function summarizeSmartFormContent(c: SmartFormContent): {
form: string;
language: string;
data: SmartFormDataDecl[];
stdStyles: string[];
pages: {
name: string;
format: string;
orientation: string;
windows: {
nodes: number;
condition?: any;
name: string;
caption: string;
type: string;
leftMm: number | null;
topMm: number | null;
widthMm: number | null;
heightMm: number | null;
}[];
}[];
styles: {
name: string;
file?: string;
error?: string;
/** standard paragraph ('*' lines) and default font from the style header */
firstParagraph?: string;
font?: {
family: string;
pt: number;
bold: boolean;
};
lpi?: number;
cpi?: number;
/** default tab distance, value + unit (e.g. "1.00 CM") */
tabDistance?: string;
/** paragraphs as stored: value + unit per attribute (SSFPARAS) */
paragraphs?: any[];
/** character formats as stored (SSFSTRINGS) */
strings?: any[];
}[];
graphics: SmartFormGraphic[];
includeTexts: {
lines: number;
object: string;
name: string;
id: string;
language: string;
error?: string;
}[];
symbols: string[];
dynamicReferences: string[];
files: {
xml: string;
content?: string;
};
path: string;
};
export interface SmartFormContentOptions {
includeGraphics?: boolean;
includeStyles?: boolean;
includeTexts?: boolean;
/** Language for include texts with no language in their key (default: form language). */
textLanguage?: string;
/** Output device to assume for printer fonts (default: chosen from the form's fonts). */
device?: string;
/** Sample values for &symbols& in graphic keys (e.g. { IM_SIGN: 'ZSIGN' }): those graphics are fetched too. */
values?: Record;
}
export declare function getSmartFormContent(connection: IAbapConnection, formName: string, options?: SmartFormContentOptions): Promise;
//# sourceMappingURL=smartFormContent.d.ts.map