@sheetxl/models
Version:
Models - A Headless javascript spreadsheet library.
86 lines • 3.02 kB
TypeScript
import { Size, Bounds, Rectangle } from "@sheetxl/common";
import { VerticalAlignment, TextDirection, TextAutofit } from "./types";
import { ITextVisitor } from "./TextVisitor";
import { ITextLine } from "./TextLine";
import { ITextParagraph } from "./TextParagraph";
/**
* Represents a frame of wrappable rich text.
*/
export interface ITextFrame {
readonly wrapped: boolean;
readonly insets: Rectangle;
readonly textDirection: TextDirection;
readonly autoFit: TextAutofit;
readonly fontScale: number;
readonly vertical: boolean;
readonly columnCount: number;
readonly columSpacing: number;
readonly verticalAlignment: VerticalAlignment;
/**
* This is different than center aligned text.
*/
readonly horizontalCentered: boolean;
readonly lineReduction: number;
readonly isSpaceFirstLastPara: boolean;
/**
* Returns the presetTextWarp.
* TODO - implement this.
*/
readonly presetTextWarp: string;
readonly paragraphs: ITextParagraph[];
visitParas(visitor: ITextVisitor): void;
visitLines(visitor: ITextVisitor): void;
/**
* Before using the bounds of a textFrame the layout must be called.
* This will then return a a clone of this ITextFrame that can be
* placed and rendered.
*
* @param bounds will cause the text to wrap. If bounds are not specified or only a dimension then it will not wrap.
*/
layout(bounds?: Partial<Size>): ITextFrame;
/**
* This is the bound of a textfield include any whitespace
*/
readonly bounds: Readonly<Bounds>;
/**
* This is the bound of a text not include whitespace
*/
readonly textBounds: Readonly<Bounds>;
readonly lines: ITextLine[];
}
export interface CloneableTextFrame extends ITextFrame {
clone(visitor?: ITextVisitor): ITextFrame;
equals(other: ITextFrame): boolean;
}
export declare class DefaultTextFrame {
private _private;
private _bounds;
private _textBounds;
private _lines;
private _lastLayoutBounds;
private _lastLayout;
constructor(overrides: Partial<ITextFrame>, lines?: ITextLine[], bounds?: Bounds, textBounds?: Bounds);
visitParas(visitor: ITextVisitor): void;
visitLines(visitor: ITextVisitor): void;
layout(bounds?: Partial<Size>): ITextFrame;
clone(visitor?: ITextVisitor): ITextFrame;
equals(other: ITextParagraph): boolean;
get bounds(): Bounds;
get textBounds(): any;
get lines(): ITextLine[];
get wrapped(): boolean;
get insets(): Rectangle;
get textDirection(): TextDirection;
get autoFit(): TextAutofit;
get fontScale(): number;
get vertical(): boolean;
get columnCount(): number;
get columSpacing(): number;
get verticalAlignment(): VerticalAlignment;
get horizontalCentered(): boolean;
get lineReduction(): number;
get isSpaceFirstLastPara(): boolean;
get presetTextWarp(): string;
get paragraphs(): ITextParagraph[];
}
//# sourceMappingURL=TextFrame.d.ts.map