devexpress-richedit
Version:
DevExpress Rich Text Editor is an advanced word-processing tool designed for working with rich text documents.
81 lines (80 loc) • 4.11 kB
JavaScript
import { LayoutBox, LayoutBoxType } from '../../../../layout/main-structures/layout-boxes/layout-box';
import { Pair } from '@devexpress/utils/lib/class/pair';
import { BaseFormatter, StdProps } from '../base-formatter';
export class CCF_LayoutBox extends BaseFormatter {
isHandleObject(obj) {
return obj instanceof LayoutBox;
}
getShortDescription(_config) {
const list = [new Pair("", LayoutBoxType[this.curr.getType()])];
if (this.curr.getType() == LayoutBoxType.Text)
list.push(new Pair("text", this.curr.text));
list.push(new Pair("offset", this.curr.rowOffset));
if (this.curr.getType() == LayoutBoxType.AnchorTextBox)
list.push(new Pair("txt", this.getSubDocumentText(this.curr.internalSubDocId)));
return this.stdShow(new StdProps(list).showAsLine());
}
availableFullDescription(_config) {
return true;
}
getFullDescription(_config) {
return this.stdShow(new StdProps(this.getList()).showAsColumn());
}
getList() {
const list = [
new Pair("offset", this.curr.rowOffset),
new Pair("type", LayoutBoxType[this.curr.getType()]),
new Pair("bounds", this.curr.createRectangle()),
];
switch (this.curr.getType()) {
case LayoutBoxType.Text:
list.push(new Pair("text", this.curr.text));
break;
case LayoutBoxType.Space:
list.push(new Pair("hiddenSpaceWidth", this.curr.hiddenSpaceWidth));
list.push(new Pair("spaceWidth", this.curr.spaceWidth));
break;
case LayoutBoxType.NonBreakingSpace:
list.push(new Pair("nonBreakingSymbolWidth", this.curr.spaceWidth));
list.push(new Pair("hiddenSpaceWidth", this.curr.hiddenSpaceWidth));
break;
case LayoutBoxType.Picture:
list.push(new Pair("pictureIsLoaded", this.curr.cacheInfo.currId));
this.addPicInfo(list);
break;
case LayoutBoxType.NumberingList:
list.push(new Pair("separatorBox", this.curr.separatorBox));
list.push(new Pair("textBox", this.curr.textBox));
break;
case LayoutBoxType.AnchorPicture:
case LayoutBoxType.AnchorTextBox:
list.push(new Pair("objectId", this.curr.objectId));
list.push(new Pair("belongsToSubDocId", this.curr.belongsToSubDocId));
list.push(new Pair("rotationInRadians", this.curr.rotationInRadians));
list.push(new Pair("anchorInfo", this.curr.anchorInfo));
list.push(new Pair("shape", this.curr.shape));
list.push(new Pair("rendererLevel", this.curr.rendererLevel));
if (this.curr.getType() == LayoutBoxType.AnchorTextBox) {
list.push(new Pair("internalSubDocId", this.curr.internalSubDocId));
list.push(new Pair("textBoxProperties", this.curr.textBoxProperties));
list.push(new Pair("textOfInnerSubDocument", this.getSubDocumentText(this.curr.internalSubDocId)));
}
else {
list.push(new Pair("isLoaded", this.curr.cacheInfo.currId));
this.addPicInfo(list);
}
break;
}
list.push(new Pair("characterProperties", this.curr.characterProperties));
list.push(new Pair("fieldLevel", this.curr.fieldLevel));
list.push(new Pair("hyperlinkTip", this.curr.hyperlinkTip));
return list;
}
addPicInfo(list) {
const picId = this.curr.getType() == LayoutBoxType.Picture ?
this.curr.cacheInfo.currId : this.curr.cacheInfo.currId;
list.push(new Pair("pictureId", picId));
list.push(new Pair("", this.getPictureNode(picId, this.curr)));
}
}
CCF_LayoutBox._foo = BaseFormatter.addToFormattersList(new CCF_LayoutBox());