v2.1.1 大量更新,功能性更新见readme

This commit is contained in:
csh 2025-05-30 14:44:32 +08:00
parent f816e8b6e3
commit b7a7b983b3
20 changed files with 25299 additions and 13986 deletions

159
README.md
View File

@ -1,6 +1,6 @@
# OfficeXml
[迁移指南](./迁移指南.md)
[迁移指南](./%E8%BF%81%E7%A7%BB%E6%8C%87%E5%8D%97.md)
## 概述
@ -52,27 +52,111 @@ echo p.Rs(1).T.Text; // 输出:(份)
## 基类
`OpenXmlAttribute`是节点的属性类
`OpenXmlElement.tsf`是节点基类
`OpenXmlSimpleType`是简单类型的元素节点类,继承于`OpenXmlElement`,如`<b />`
`OpenXmlTextElement`是包含文本内容的元素节点类,继承于`OpenXmlElement`,如`<t>文本</t>`
`OpenXmlCompositeElement`是复杂节点的元素节点类,继承于`OpenXmlElement`,会包含一系列的属性或其他元素节点类
`OpenXmlAttribute`是节点的属性类
`OpenXmlElement`是节点基类
`OpenXmlSimpleType`是简单类型的元素节点类,继承于 `OpenXmlElement`,如 `<b />`
`OpenXmlTextElement`是包含文本内容的元素节点类,继承于 `OpenXmlElement`,如 `<t>文本</t>`
`OpenXmlCompositeElement`是复杂节点的元素节点类,继承于 `OpenXmlElement`,会包含一系列的属性或其他元素节点类
## 基本功能
### 获取属性/子节点
获取同名但命名空间不同的属性/子节点内容时,遵守以下规范
1. 默认情况下,获取的命名空间前缀与父节点一致
2. 当父节点有前缀,但是属性/子节点没有前缀时候,通过 `("")`空字符串参数获取
3. 存在同名属性/子节点情况下,默认获取的一定是和父节点前缀相同的内容
```xml
<m:r w:val="testw" val="testN" m:val="testm">
<m:rPr>
<m:sty m:val="p" />
</m:rPr>
<a:rPr lang="en-US"
altLang="zh-CN" sz="1100"
i="0" kern="1200">
<a:latin
typeface="Cambria Math"
panose="02040503050406030204"
pitchFamily="18"
charset="0" />
</a:rPr>
<m:t>cos</m:t>
</m:r>
```
```go
r.Val; // 默认获取前缀为m即m:val的属性
r.Val("m"); // 指定前缀m
r.Val(""); // 无前缀的属性即val
r.Val("w"); // 获取前缀为w即w:val的属性
r.RPr; // 默认获取前缀为m即m:rPr的子节点
r.RPr("m"); // 指定前缀为m
r.RPr("a"); // 获取前缀为a即a:rPr的子节点
```
### 删除属性/节点
```go
移除方式一通过RemoveAttribute或RemoveChild
// 移除r的属性w:val
// 因为r.Val("w")是直接获取了属性值所以不能作为参数传递给RemoveAttribute
r.RemoveAttribute(r.Attribute("w:val"));
// 移除r的子节点rPr
// 因为r.RPr就是一个对象所以可直接使用
r.RemoveChild(r.RPr);
移除方式二通过赋值nil
// 这种方式不需要区分属性和子节点,也不需要知道属性的全称
r.Val("w") := nil;
r.RPr := nil;
最后需要回写才会生效
r.Serialize();
```
### 回落功能(Fallback)
项目的 `fallback`功能是指获取某个属性或节点不存在时候,会检查是否设置了 `fallback`,如果设置了会通过 `fallback`获取对应的属性或节点
```xml
// pPr1
<w:pPr>
<w:jc w:val="left" />
</w:pPr>
// pPr2
<w:pPr>
<w:jc w:val="left" />
<w:wordWrap w:val="1" />
</w:pPr>
```
```go
// 假设已经获取到了对象ppr1和ppr2
ppr1.SetFallback(ppr2); // 将ppr1的fallback设置为ppr2
ppr1.Jc.Val; // 得到"left"
ppr1.WordWrap.Val; // ppr1不存在wordWrap但是ppr2存在wordWrap所以回落到ppr2的wordWrap获取到"1"
```
## Unit 单元
- `DocxML`
包含`docx`文件独有的 xml 节点对象,一般 xml 的命名空间是`w`,如`w:p`
- `PptxML`
包含`pptx`文件独有的 xml 节点对象,一般 xml 的命名空间是`p`,如`p:spPr`
- `XlsxML`
包含`xlsx`文件独有的 xml 节点对象
- `DrawingML`
包含`docx,pptx,xlsx`文件图形的 xml 节点对象,一般 xml 的命名空间是`a`,如`a:xfrm`
- `SharedML`
包含`docx,pptx,xlsx`文件共有的 xml 节点对象
- `DocxML`包含 `docx`文件独有的 xml 节点对象,一般 xml 的命名空间是 `w`,如 `w:p`
- `PptxML`包含 `pptx`文件独有的 xml 节点对象,一般 xml 的命名空间是 `p`,如 `p:spPr`
- `XlsxML`包含 `xlsx`文件独有的 xml 节点对象
- `DrawingML`包含 `docx,pptx,xlsx`文件图形的 xml 节点对象,一般 xml 的命名空间是 `a`,如 `a:xfrm`
- `SharedML`包含 `docx,pptx,xlsx`文件共有的 xml 节点对象
- `VML`
[参考链接 1](http://webapp.docx4java.org/OnlineDemo/ecma376/)
[参考链接 1](http://webapp.docx4java.org/OnlineDemo/ecma376/)
[参考链接 2](http://officeopenxml.com/index.php)
## 部件
@ -85,7 +169,7 @@ echo p.Rs(1).T.Text; // 输出:(份)
2. `XlsxComponents`xlsx 文件的各部分 xml 内容
3. `PptxComponents`pptx 文件的各部分 xml 内容
以`DocxComponents.tsf`为例,使用这个类,可以获取到对应的 docx 文件的 xml 对象
`DocxComponents.tsf`为例,使用这个类,可以获取到对应的 docx 文件的 xml 对象
```go
component := new DocxComponents(); // 创建对象
@ -136,9 +220,9 @@ document.xml 内容如下
每个对象都有一个单位装饰器,能统一转成磅(point)单位(如果有配置属性转换),还能保留原来的接口
每个`ML`都有装饰器`tsf`统一命名是`Unit的名称+UnitDecorator`,如`docx``docx`大部分`xml`隶属于`DocxML`)的`SectPr`对象的装饰器是`SectPrUnitDecorator`
每个 `ML`都有装饰器 `tsf`统一命名是 `Unit的名称+UnitDecorator`,如 `docx``docx`大部分 `xml`隶属于 `DocxML`)的 `SectPr`对象的装饰器是 `SectPrUnitDecorator`
如:有下面一段 xml其中的`pgSz.w = "11906", pgSz.h = "16838"`都需要转换成 point
如:有下面一段 xml其中的 `pgSz.w = "11906", pgSz.h = "16838"`都需要转换成 point
```xml
<w:sectPr w:rsidR="00B118EF" w:rsidSect="002E4343">
@ -153,7 +237,7 @@ document.xml 内容如下
```go
uses DocxMLUnitDecorator;
component := new Components(); // 创建对象
component := new DocxComponents(); // 创建对象
component.Open("", "xxx.docx"); // 打开文件
document := component.Document; // 获取document.xml生成Document对象
document.Deserialize(); // 将xml对象的数据反序列化到tsl对象中
@ -169,7 +253,7 @@ echo "w = ", sect_pr_unit_decorator.PgSz.W; // 此时输出的是数字类
适配器是通过 key 获取对应的对象,比如样式可以通过样式 ID 获取对应的样式对象
只有部分对象才有适配器(具体可见`autounit/xxxMLAdapter`),比如`DocxML.Styles`的适配器是`StylesAdapter`
只有部分对象才有适配器(具体可见 `autounit/xxxMLAdapter`),比如 `DocxML.Styles`的适配器是 `StylesAdapter`
styles.xml 部分如下
@ -202,7 +286,7 @@ styles.xml 部分如下
```go
uses DocxMLAdapter;
component := new Components(); // 创建对象
component := new DocxComponents(); // 创建对象
component.Open("", "xxx.docx"); // 打开文件
document := component.Document; // 获取document.xml生成Document对象
document.Deserialize(); // 将xml对象的数据反序列化到tsl对象中
@ -214,32 +298,3 @@ styles_adapter := new StylesAdapter(styles);
style := styles_adapter.GetStyleByStyleId("a6");
echo style.Name; // 输出的是"页脚 字符"
```
### 其他设计的补充
```xml
<m:r>
<m:rPr>
<m:sty m:val="p" />
</m:rPr>
<a:rPr lang="en-US"
altLang="zh-CN" sz="1100"
i="0" kern="1200">
<a:latin
typeface="Cambria Math"
panose="02040503050406030204"
pitchFamily="18"
charset="0" />
</a:rPr>
<m:t>cos</m:t>
</m:r>
```
由于设计取对象时候不包含前缀,那么同时存在多个`rPr`时,如何区分是哪一个?
取`m:rPr`时,可通过`r.RPr`,这是因为它们的前缀都是`m`,所以可直接获取
取`a:rPr`时,需要指定前缀`a`,通过`r.RPr('a')`,进行获取`RPr`对象
## TODO
- [ ] 命名空间不同,但是名字相同属性的读写访问
- [ ] 属性的删除操作

File diff suppressed because it is too large Load Diff

View File

@ -290,6 +290,15 @@ private
object_: R;
end;
type CommentReferenceUnitDecorator = class(CommentReference)
public
function Create(_obj: CommentReference);
function GetObject();
function Convert();
private
object_: CommentReference;
end;
type ObjectUnitDecorator = class(Object)
public
function Create(_obj: Object);
@ -1340,11 +1349,11 @@ begin
if not ifnil(object_.XmlChildTabs) then
{self.}XmlChildTabs := new TabsUnitDecorator(object_.XmlChildTabs);
if not ifnil(object_.XmlChildBidi) then
{self.}XmlChildBidi.Copy(object_.XmlChildBidi);
{self.}Bidi.Copy(object_.XmlChildBidi);
if not ifnil(object_.XmlChildWidowControl) then
{self.}XmlChildWidowControl.Copy(object_.XmlChildWidowControl);
{self.}WidowControl.Copy(object_.XmlChildWidowControl);
if not ifnil(object_.XmlChildSnapToGrid) then
{self.}XmlChildSnapToGrid.Copy(object_.XmlChildSnapToGrid);
{self.}SnapToGrid.Copy(object_.XmlChildSnapToGrid);
if not ifnil(object_.XmlChildPStyle) then
{self.}XmlChildPStyle := new PureWValUnitDecorator(object_.XmlChildPStyle);
if not ifnil(object_.XmlChildNumPr) then
@ -1354,21 +1363,21 @@ begin
if not ifnil(object_.XmlChildInd) then
{self.}XmlChildInd := new IndUnitDecorator(object_.XmlChildInd);
if not ifnil(object_.XmlChildKeepNext) then
{self.}XmlChildKeepNext.Copy(object_.XmlChildKeepNext);
{self.}KeepNext.Copy(object_.XmlChildKeepNext);
if not ifnil(object_.XmlChildKeepLines) then
{self.}XmlChildKeepLines.Copy(object_.XmlChildKeepLines);
{self.}KeepLines.Copy(object_.XmlChildKeepLines);
if not ifnil(object_.XmlChildMirrorIndents) then
{self.}XmlChildMirrorIndents.Copy(object_.XmlChildMirrorIndents);
{self.}MirrorIndents.Copy(object_.XmlChildMirrorIndents);
if not ifnil(object_.XmlChildKinsoku) then
{self.}XmlChildKinsoku := new PureWValUnitDecorator(object_.XmlChildKinsoku);
if not ifnil(object_.XmlChildPageBreakBefore) then
{self.}XmlChildPageBreakBefore.Copy(object_.XmlChildPageBreakBefore);
{self.}PageBreakBefore.Copy(object_.XmlChildPageBreakBefore);
if not ifnil(object_.XmlChildSuppressAutoHyphens) then
{self.}XmlChildSuppressAutoHyphens.Copy(object_.XmlChildSuppressAutoHyphens);
{self.}SuppressAutoHyphens.Copy(object_.XmlChildSuppressAutoHyphens);
if not ifnil(object_.XmlChildSuppressLineNumbers) then
{self.}XmlChildSuppressLineNumbers.Copy(object_.XmlChildSuppressLineNumbers);
{self.}SuppressLineNumbers.Copy(object_.XmlChildSuppressLineNumbers);
if not ifnil(object_.XmlChildSuppressOverlap) then
{self.}XmlChildSuppressOverlap.Copy(object_.XmlChildSuppressOverlap);
{self.}SuppressOverlap.Copy(object_.XmlChildSuppressOverlap);
if not ifnil(object_.XmlChildOverflowPunct) then
{self.}XmlChildOverflowPunct := new PureWValUnitDecorator(object_.XmlChildOverflowPunct);
if not ifnil(object_.XmlChildAdjustRightInd) then
@ -1386,7 +1395,7 @@ begin
if not ifnil(object_.XmlChildPBdr) then
{self.}XmlChildPBdr := new PBdrUnitDecorator(object_.XmlChildPBdr);
if not ifnil(object_.XmlChildContextualSpacing) then
{self.}XmlChildContextualSpacing.Copy(object_.XmlChildContextualSpacing);
{self.}ContextualSpacing.Copy(object_.XmlChildContextualSpacing);
if not ifnil(object_.XmlChildShd) then
{self.}XmlChildShd := new ShdUnitDecorator(object_.XmlChildShd);
if not ifnil(object_.XmlChildWordWrap) then
@ -1405,6 +1414,8 @@ begin
{self.}XmlChildTextAlignment := new PureWValUnitDecorator(object_.XmlChildTextAlignment);
if not ifnil(object_.XmlChildTextDirection) then
{self.}XmlChildTextDirection := new PureWValUnitDecorator(object_.XmlChildTextDirection);
if not ifnil(object_.XmlChildCollapsed) then
{self.}XmlChildCollapsed := new PureWValUnitDecorator(object_.XmlChildCollapsed);
tslassigning := tslassigning_backup;
end;
@ -1698,13 +1709,13 @@ begin
if not ifnil(object_.XmlChildKern) then
{self.}XmlChildKern := new PureWValUnitDecorator(object_.XmlChildKern);
if not ifnil(object_.XmlChildI) then
{self.}XmlChildI.Copy(object_.XmlChildI);
{self.}I.Copy(object_.XmlChildI);
if not ifnil(object_.XmlChildICs) then
{self.}XmlChildICs.Copy(object_.XmlChildICs);
{self.}ICs.Copy(object_.XmlChildICs);
if not ifnil(object_.XmlChildB) then
{self.}XmlChildB.Copy(object_.XmlChildB);
{self.}B.Copy(object_.XmlChildB);
if not ifnil(object_.XmlChildBCs) then
{self.}XmlChildBCs.Copy(object_.XmlChildBCs);
{self.}BCs.Copy(object_.XmlChildBCs);
if not ifnil(object_.XmlChildBdr) then
{self.}XmlChildBdr := new BdrUnitDecorator(object_.XmlChildBdr);
if not ifnil(object_.XmlChildCaps) then
@ -1712,7 +1723,7 @@ begin
if not ifnil(object_.XmlChildDel) then
{self.}XmlChildDel := new DelUnitDecorator(object_.XmlChildDel);
if not ifnil(object_.XmlChildStrike) then
{self.}XmlChildStrike.Copy(object_.XmlChildStrike);
{self.}Strike.Copy(object_.XmlChildStrike);
if not ifnil(object_.XmlChildDStrike) then
{self.}XmlChildDStrike := new PureWValUnitDecorator(object_.XmlChildDStrike);
if not ifnil(object_.XmlChildEffect) then
@ -1730,13 +1741,13 @@ begin
if not ifnil(object_.XmlChildEastAsianLayout) then
{self.}XmlChildEastAsianLayout := new EastAsianLayoutUnitDecorator(object_.XmlChildEastAsianLayout);
if not ifnil(object_.XmlChildCs) then
{self.}XmlChildCs.Copy(object_.XmlChildCs);
{self.}Cs.Copy(object_.XmlChildCs);
if not ifnil(object_.XmlChildSz) then
{self.}XmlChildSz := new SzUnitDecorator(object_.XmlChildSz);
if not ifnil(object_.XmlChildSzCs) then
{self.}XmlChildSzCs := new SzCsUnitDecorator(object_.XmlChildSzCs);
if not ifnil(object_.XmlChildU) then
{self.}XmlChildU.Copy(object_.XmlChildU);
{self.}U.Copy(object_.XmlChildU);
if not ifnil(object_.XmlChildLang) then
{self.}XmlChildLang := new LangUnitDecorator(object_.XmlChildLang);
if not ifnil(object_.XmlChildImprint) then
@ -1748,13 +1759,13 @@ begin
if not ifnil(object_.XmlChildRtl) then
{self.}XmlChildRtl := new PureWValUnitDecorator(object_.XmlChildRtl);
if not ifnil(object_.XmlChildOMath) then
{self.}XmlChildOMath.Copy(object_.XmlChildOMath);
{self.}OMath.Copy(object_.XmlChildOMath);
if not ifnil(object_.XmlChildShadow) then
{self.}XmlChildShadow.Copy(object_.XmlChildShadow);
{self.}Shadow.Copy(object_.XmlChildShadow);
if not ifnil(object_.XmlChildSpecVanish) then
{self.}XmlChildSpecVanish.Copy(object_.XmlChildSpecVanish);
{self.}SpecVanish.Copy(object_.XmlChildSpecVanish);
if not ifnil(object_.XmlChildVanish) then
{self.}XmlChildVanish.Copy(object_.XmlChildVanish);
{self.}Vanish.Copy(object_.XmlChildVanish);
if not ifnil(object_.XmlChildShd) then
{self.}XmlChildShd := new ShdUnitDecorator(object_.XmlChildShd);
if not ifnil(object_.XmlChildSmallCaps) then
@ -2151,11 +2162,11 @@ begin
if not ifnil(object_.XmlChildInstrText) then
{self.}XmlChildInstrText := new InstrTextUnitDecorator(object_.XmlChildInstrText);
if not ifnil(object_.XmlChildSeparator) then
{self.}XmlChildSeparator.Copy(object_.XmlChildSeparator);
{self.}Separator.Copy(object_.XmlChildSeparator);
if not ifnil(object_.XmlChildContinuationSeparator) then
{self.}XmlChildContinuationSeparator.Copy(object_.XmlChildContinuationSeparator);
{self.}ContinuationSeparator.Copy(object_.XmlChildContinuationSeparator);
if not ifnil(object_.XmlChildLastRenderedPageBreak) then
{self.}XmlChildLastRenderedPageBreak.Copy(object_.XmlChildLastRenderedPageBreak);
{self.}LastRenderedPageBreak.Copy(object_.XmlChildLastRenderedPageBreak);
if not ifnil(object_.XmlChildAlternateContent) then
{self.}XmlChildAlternateContent := new AlternateContentUnitDecorator(object_.XmlChildAlternateContent);
if not ifnil(object_.XmlChildDrawing) then
@ -2169,7 +2180,30 @@ begin
if not ifnil(object_.XmlChildFootnoteReference) then
{self.}XmlChildFootnoteReference := new FootnoteReferenceUnitDecorator(object_.XmlChildFootnoteReference);
if not ifnil(object_.XmlChildFootnoteRef) then
{self.}XmlChildFootnoteRef.Copy(object_.XmlChildFootnoteRef);
{self.}FootnoteRef.Copy(object_.XmlChildFootnoteRef);
if not ifnil(object_.XmlChildCommentReference) then
{self.}XmlChildCommentReference := new CommentReferenceUnitDecorator(object_.XmlChildCommentReference);
tslassigning := tslassigning_backup;
end;
function CommentReferenceUnitDecorator.Create(_obj: CommentReference);
begin
class(CommentReference).Create();
object_ := _obj;
{self.}Convert();
end;
function CommentReferenceUnitDecorator.GetObject();
begin
return object_;
end;
function CommentReferenceUnitDecorator.Convert();
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
if not ifnil(object_.XmlAttrId) then
{self.}Id := object_.XmlAttrId.Value;
tslassigning := tslassigning_backup;
end;
@ -2697,7 +2731,7 @@ begin
if not ifnil(object_.XmlChildJc) then
{self.}XmlChildJc := new PureWValUnitDecorator(object_.XmlChildJc);
if not ifnil(object_.XmlChildCantSplit) then
{self.}XmlChildCantSplit.Copy(object_.XmlChildCantSplit);
{self.}CantSplit.Copy(object_.XmlChildCantSplit);
if not ifnil(object_.XmlChildCnfStyle) then
{self.}XmlChildCnfStyle := new CnfStyleUnitDecorator(object_.XmlChildCnfStyle);
if not ifnil(object_.XmlChildIns) then
@ -2853,11 +2887,11 @@ begin
if not ifnil(object_.XmlChildGridSpan) then
{self.}XmlChildGridSpan := new GridSpanUnitDecorator(object_.XmlChildGridSpan);
if not ifnil(object_.XmlChildVMerge) then
{self.}XmlChildVMerge.Copy(object_.XmlChildVMerge);
{self.}VMerge.Copy(object_.XmlChildVMerge);
if not ifnil(object_.XmlChildVAlign) then
{self.}XmlChildVAlign := new PureWValUnitDecorator(object_.XmlChildVAlign);
if not ifnil(object_.XmlChildHideMark) then
{self.}XmlChildHideMark.Copy(object_.XmlChildHideMark);
{self.}HideMark.Copy(object_.XmlChildHideMark);
if not ifnil(object_.XmlChildShd) then
{self.}XmlChildShd := new ShdUnitDecorator(object_.XmlChildShd);
if not ifnil(object_.XmlChildTcBorders) then
@ -3116,7 +3150,7 @@ begin
if not ifnil(object_.XmlChildCols) then
{self.}XmlChildCols := new ColsUnitDecorator(object_.XmlChildCols);
if not ifnil(object_.XmlChildTitlePg) then
{self.}XmlChildTitlePg.Copy(object_.XmlChildTitlePg);
{self.}TitlePg.Copy(object_.XmlChildTitlePg);
if not ifnil(object_.XmlChildDocGrid) then
{self.}XmlChildDocGrid := new DocGridUnitDecorator(object_.XmlChildDocGrid);
if not ifnil(object_.XmlChildTextDirection) then
@ -3483,10 +3517,10 @@ begin
{self.}Usb2 := object_.XmlAttrUsb2.Value;
if not ifnil(object_.XmlAttrUsb3) then
{self.}Usb3 := object_.XmlAttrUsb3.Value;
if not ifnil(object_.XmlAttrcsb0) then
{self.}csb0 := object_.XmlAttrcsb0.Value;
if not ifnil(object_.XmlAttrcsb1) then
{self.}csb1 := object_.XmlAttrcsb1.Value;
if not ifnil(object_.XmlAttrCsb0) then
{self.}Csb0 := object_.XmlAttrCsb0.Value;
if not ifnil(object_.XmlAttrCsb1) then
{self.}Csb1 := object_.XmlAttrCsb1.Value;
tslassigning := tslassigning_backup;
end;
@ -3508,48 +3542,20 @@ begin
tslassigning := 1;
if not ifnil(object_.XmlAttrIgnorable) then
{self.}Ignorable := object_.XmlAttrIgnorable.Value;
if not ifnil(object_.XmlChildZoom) then
{self.}XmlChildZoom := new ZoomUnitDecorator(object_.XmlChildZoom);
if not ifnil(object_.XmlChildBordersDoNotSurroundHeader) then
{self.}XmlChildBordersDoNotSurroundHeader.Copy(object_.XmlChildBordersDoNotSurroundHeader);
if not ifnil(object_.XmlChildBordersDoNotSurroundFooter) then
{self.}XmlChildBordersDoNotSurroundFooter.Copy(object_.XmlChildBordersDoNotSurroundFooter);
if not ifnil(object_.XmlChildDefaultTabStop) then
{self.}XmlChildDefaultTabStop := new PureWValUnitDecorator(object_.XmlChildDefaultTabStop);
if not ifnil(object_.XmlChildEvenAndOddHeaders) then
{self.}XmlChildEvenAndOddHeaders.Copy(object_.XmlChildEvenAndOddHeaders);
if not ifnil(object_.XmlChildDrawingGridVerticalSpacing) then
{self.}XmlChildDrawingGridVerticalSpacing := new PureWValUnitDecorator(object_.XmlChildDrawingGridVerticalSpacing);
if not ifnil(object_.XmlChildDisplayHorizontalDrawingGridEvery) then
{self.}XmlChildDisplayHorizontalDrawingGridEvery := new PureWValUnitDecorator(object_.XmlChildDisplayHorizontalDrawingGridEvery);
if not ifnil(object_.XmlChildDisplayVerticalDrawingGridEvery) then
{self.}XmlChildDisplayVerticalDrawingGridEvery := new PureWValUnitDecorator(object_.XmlChildDisplayVerticalDrawingGridEvery);
if not ifnil(object_.XmlChildCharacterSpacingControl) then
{self.}XmlChildCharacterSpacingControl := new PureWValUnitDecorator(object_.XmlChildCharacterSpacingControl);
if not ifnil(object_.XmlChildHdrShapeDefaults) then
{self.}XmlChildHdrShapeDefaults := new HdrShapeDefaultsUnitDecorator(object_.XmlChildHdrShapeDefaults);
if not ifnil(object_.XmlChildFootnotePr) then
{self.}XmlChildFootnotePr := new FootnotePrUnitDecorator(object_.XmlChildFootnotePr);
if not ifnil(object_.XmlChildEndnotePr) then
{self.}XmlChildEndnotePr := new EndnotePrUnitDecorator(object_.XmlChildEndnotePr);
if not ifnil(object_.XmlChildCompat) then
{self.}XmlChildCompat := new CompatUnitDecorator(object_.XmlChildCompat);
if not ifnil(object_.XmlChildRsids) then
{self.}XmlChildRsids := new RsidsUnitDecorator(object_.XmlChildRsids);
if not ifnil(object_.XmlChildMathPr) then
{self.}XmlChildMathPr := new MathPrUnitDecorator(object_.XmlChildMathPr);
if not ifnil(object_.XmlChildThemeFontLang) then
{self.}XmlChildThemeFontLang := new ThemeFontLangUnitDecorator(object_.XmlChildThemeFontLang);
if not ifnil(object_.XmlChildClrSchemeMapping) then
{self.}XmlChildClrSchemeMapping := new ClrSchemeMappingUnitDecorator(object_.XmlChildClrSchemeMapping);
if not ifnil(object_.XmlChildDoNotIncludeSubdocsInStats) then
{self.}XmlChildDoNotIncludeSubdocsInStats.Copy(object_.XmlChildDoNotIncludeSubdocsInStats);
if not ifnil(object_.XmlChildShapeDefaults) then
{self.}XmlChildShapeDefaults := new ShapeDefaults2UnitDecorator(object_.XmlChildShapeDefaults);
if not ifnil(object_.XmlChildDecimalSymbol) then
{self.}XmlChildDecimalSymbol := new PureWValUnitDecorator(object_.XmlChildDecimalSymbol);
if not ifnil(object_.XmlChildListSeparator) then
{self.}XmlChildListSeparator := new PureWValUnitDecorator(object_.XmlChildListSeparator);
if not ifnil(object_.XmlAttrIgnorable) then
{self.}Ignorable := object_.XmlAttrIgnorable.Value;
if not ifnil(object_.XmlAttrIgnorable) then
{self.}Ignorable := object_.XmlAttrIgnorable.Value;
if not ifnil(object_.XmlAttrPr) then
{self.}Pr := object_.XmlAttrPr.Value;
if not ifnil(object_.XmlAttrPr) then
{self.}Pr := object_.XmlAttrPr.Value;
if not ifnil(object_.XmlAttrSig) then
{self.}Sig := object_.XmlAttrSig.Value;
if not ifnil(object_.XmlAttrSig) then
{self.}Sig := object_.XmlAttrSig.Value;
if not ifnil(object_.XmlAttrSig) then
{self.}Sig := object_.XmlAttrSig.Value;
if not ifnil(object_.XmlChildDocId) then
{self.}XmlChildDocId := new PureWValUnitDecorator(object_.XmlChildDocId);
if not ifnil(object_.XmlChildDocId) then
@ -3557,7 +3563,7 @@ begin
if not ifnil(object_.XmlChildDocId) then
{self.}XmlChildDocId := new PureWValUnitDecorator(object_.XmlChildDocId);
if not ifnil(object_.XmlChildChartTrackingRefBased) then
{self.}XmlChildChartTrackingRefBased.Copy(object_.XmlChildChartTrackingRefBased);
{self.}ChartTrackingRefBased.Copy(object_.XmlChildChartTrackingRefBased);
tslassigning := tslassigning_backup;
end;
@ -3703,19 +3709,19 @@ begin
tslassigning_backup := tslassigning;
tslassigning := 1;
if not ifnil(object_.XmlChildSpaceForUL) then
{self.}XmlChildSpaceForUL.Copy(object_.XmlChildSpaceForUL);
{self.}SpaceForUL.Copy(object_.XmlChildSpaceForUL);
if not ifnil(object_.XmlChildBalanceSingleByteDoubleByteWidth) then
{self.}XmlChildBalanceSingleByteDoubleByteWidth.Copy(object_.XmlChildBalanceSingleByteDoubleByteWidth);
{self.}BalanceSingleByteDoubleByteWidth.Copy(object_.XmlChildBalanceSingleByteDoubleByteWidth);
if not ifnil(object_.XmlChildDoNotLeaveBackslashAlone) then
{self.}XmlChildDoNotLeaveBackslashAlone.Copy(object_.XmlChildDoNotLeaveBackslashAlone);
{self.}DoNotLeaveBackslashAlone.Copy(object_.XmlChildDoNotLeaveBackslashAlone);
if not ifnil(object_.XmlChildUlTrailSpace) then
{self.}XmlChildUlTrailSpace.Copy(object_.XmlChildUlTrailSpace);
{self.}UlTrailSpace.Copy(object_.XmlChildUlTrailSpace);
if not ifnil(object_.XmlChildDoNotExpandShiftReturn) then
{self.}XmlChildDoNotExpandShiftReturn.Copy(object_.XmlChildDoNotExpandShiftReturn);
{self.}DoNotExpandShiftReturn.Copy(object_.XmlChildDoNotExpandShiftReturn);
if not ifnil(object_.XmlChildAdjustLineHeightInTable) then
{self.}XmlChildAdjustLineHeightInTable.Copy(object_.XmlChildAdjustLineHeightInTable);
{self.}AdjustLineHeightInTable.Copy(object_.XmlChildAdjustLineHeightInTable);
if not ifnil(object_.XmlChildUseFELayout) then
{self.}XmlChildUseFELayout.Copy(object_.XmlChildUseFELayout);
{self.}UseFELayout.Copy(object_.XmlChildUseFELayout);
elems := object_.CompatSettings();
for _,elem in elems do
{self.}AppendChild(new CompatSettingUnitDecorator(elem));
@ -4097,11 +4103,11 @@ begin
if not ifnil(object_.XmlChildUIPriority) then
{self.}XmlChildUIPriority := new PureWValUnitDecorator(object_.XmlChildUIPriority);
if not ifnil(object_.XmlChildSemiHidden) then
{self.}XmlChildSemiHidden.Copy(object_.XmlChildSemiHidden);
{self.}SemiHidden.Copy(object_.XmlChildSemiHidden);
if not ifnil(object_.XmlChildUnhideWhenUsed) then
{self.}XmlChildUnhideWhenUsed.Copy(object_.XmlChildUnhideWhenUsed);
{self.}UnhideWhenUsed.Copy(object_.XmlChildUnhideWhenUsed);
if not ifnil(object_.XmlChildQFormat) then
{self.}XmlChildQFormat.Copy(object_.XmlChildQFormat);
{self.}QFormat.Copy(object_.XmlChildQFormat);
if not ifnil(object_.XmlChildRsid) then
{self.}XmlChildRsid := new PureWValUnitDecorator(object_.XmlChildRsid);
if not ifnil(object_.XmlChildPPr) then
@ -4220,9 +4226,9 @@ begin
if not ifnil(object_.XmlAttrIgnorable) then
{self.}Ignorable := object_.XmlAttrIgnorable.Value;
if not ifnil(object_.XmlChildOptimizeForBrowser) then
{self.}XmlChildOptimizeForBrowser.Copy(object_.XmlChildOptimizeForBrowser);
{self.}OptimizeForBrowser.Copy(object_.XmlChildOptimizeForBrowser);
if not ifnil(object_.XmlChildAllowPNG) then
{self.}XmlChildAllowPNG.Copy(object_.XmlChildAllowPNG);
{self.}AllowPNG.Copy(object_.XmlChildAllowPNG);
tslassigning := tslassigning_backup;
end;

File diff suppressed because it is too large Load Diff

View File

@ -862,9 +862,9 @@ begin
if not ifnil(object_.XmlChildThemeElements) then
{self.}XmlChildThemeElements := new ThemeElementsUnitDecorator(object_.XmlChildThemeElements);
if not ifnil(object_.XmlChildObjectDefaults) then
{self.}XmlChildObjectDefaults.Copy(object_.XmlChildObjectDefaults);
{self.}ObjectDefaults.Copy(object_.XmlChildObjectDefaults);
if not ifnil(object_.XmlChildExtraClrSchemeLst) then
{self.}XmlChildExtraClrSchemeLst.Copy(object_.XmlChildExtraClrSchemeLst);
{self.}ExtraClrSchemeLst.Copy(object_.XmlChildExtraClrSchemeLst);
if not ifnil(object_.XmlChildExtLst) then
{self.}XmlChildExtLst := new ExtLstUnitDecorator(object_.XmlChildExtLst);
tslassigning := tslassigning_backup;
@ -1623,7 +1623,7 @@ begin
if not ifnil(object_.XmlChildLegendPos) then
{self.}XmlChildLegendPos := new PureValUnitDecorator(object_.XmlChildLegendPos);
if not ifnil(object_.XmlChildLayout) then
{self.}XmlChildLayout.Copy(object_.XmlChildLayout);
{self.}Layout.Copy(object_.XmlChildLayout);
if not ifnil(object_.XmlChildOverlay) then
{self.}XmlChildOverlay := new PureValUnitDecorator(object_.XmlChildOverlay);
if not ifnil(object_.XmlChildTxPr) then
@ -1673,7 +1673,7 @@ begin
tslassigning_backup := tslassigning;
tslassigning := 1;
if not ifnil(object_.XmlChildLayout) then
{self.}XmlChildLayout.Copy(object_.XmlChildLayout);
{self.}Layout.Copy(object_.XmlChildLayout);
if not ifnil(object_.XmlChildBarChart) then
{self.}XmlChildBarChart := new BarChartUnitDecorator(object_.XmlChildBarChart);
if not ifnil(object_.XmlChildCatAx) then
@ -2094,7 +2094,7 @@ begin
if not ifnil(object_.XmlChildBodyPr) then
{self.}XmlChildBodyPr := new BodyPrUnitDecorator(object_.XmlChildBodyPr);
if not ifnil(object_.XmlChildLstStyle) then
{self.}XmlChildLstStyle.Copy(object_.XmlChildLstStyle);
{self.}LstStyle.Copy(object_.XmlChildLstStyle);
elems := object_.Ps();
for _,elem in elems do
{self.}AppendChild(new PUnitDecorator(elem));
@ -2120,7 +2120,7 @@ begin
if not ifnil(object_.XmlChildTx) then
{self.}XmlChildTx := new TxUnitDecorator(object_.XmlChildTx);
if not ifnil(object_.XmlChildLayout) then
{self.}XmlChildLayout.Copy(object_.XmlChildLayout);
{self.}Layout.Copy(object_.XmlChildLayout);
if not ifnil(object_.XmlChildOverlay) then
{self.}XmlChildOverlay := new PureValUnitDecorator(object_.XmlChildOverlay);
tslassigning := tslassigning_backup;
@ -2168,7 +2168,7 @@ begin
if not ifnil(object_.XmlChildBodyPr) then
{self.}XmlChildBodyPr := new BodyPrUnitDecorator(object_.XmlChildBodyPr);
if not ifnil(object_.XmlChildLstStyle) then
{self.}XmlChildLstStyle.Copy(object_.XmlChildLstStyle);
{self.}LstStyle.Copy(object_.XmlChildLstStyle);
elems := object_.Ps();
for _,elem in elems do
{self.}AppendChild(new PUnitDecorator(elem));
@ -2230,7 +2230,7 @@ begin
if not ifnil(object_.XmlChildPrstTxWrap) then
{self.}XmlChildPrstTxWrap := new PrstTxWrapUnitDecorator(object_.XmlChildPrstTxWrap);
if not ifnil(object_.XmlChildNoAutofit) then
{self.}XmlChildNoAutofit.Copy(object_.XmlChildNoAutofit);
{self.}NoAutofit.Copy(object_.XmlChildNoAutofit);
tslassigning := tslassigning_backup;
end;
@ -2253,7 +2253,7 @@ begin
if not ifnil(object_.XmlAttrPrst) then
{self.}Prst := object_.XmlAttrPrst.Value;
if not ifnil(object_.XmlChildAvLst) then
{self.}XmlChildAvLst.Copy(object_.XmlChildAvLst);
{self.}AvLst.Copy(object_.XmlChildAvLst);
tslassigning := tslassigning_backup;
end;
@ -2952,7 +2952,7 @@ begin
if not ifnil(object_.XmlChildPrstGeom) then
{self.}XmlChildPrstGeom := new PrstGeomUnitDecorator(object_.XmlChildPrstGeom);
if not ifnil(object_.XmlChildNoFill) then
{self.}XmlChildNoFill.Copy(object_.XmlChildNoFill);
{self.}NoFill.Copy(object_.XmlChildNoFill);
if not ifnil(object_.XmlChildSolidFill) then
{self.}XmlChildSolidFill := new SolidFillUnitDecorator(object_.XmlChildSolidFill);
if not ifnil(object_.XmlChildLn) then
@ -3008,7 +3008,7 @@ begin
if not ifnil(object_.XmlAttrAlgn) then
{self.}Algn := object_.XmlAttrAlgn.Value;
if not ifnil(object_.XmlChildNoFill) then
{self.}XmlChildNoFill.Copy(object_.XmlChildNoFill);
{self.}NoFill.Copy(object_.XmlChildNoFill);
if not ifnil(object_.XmlChildSolidFill) then
{self.}XmlChildSolidFill := new SolidFillUnitDecorator(object_.XmlChildSolidFill);
if not ifnil(object_.XmlChildPrstDash) then
@ -3016,9 +3016,9 @@ begin
if not ifnil(object_.XmlChildMiter) then
{self.}XmlChildMiter := new MiterUnitDecorator(object_.XmlChildMiter);
if not ifnil(object_.XmlChildHeadEnd) then
{self.}XmlChildHeadEnd.Copy(object_.XmlChildHeadEnd);
{self.}HeadEnd.Copy(object_.XmlChildHeadEnd);
if not ifnil(object_.XmlChildTailEnd) then
{self.}XmlChildTailEnd.Copy(object_.XmlChildTailEnd);
{self.}TailEnd.Copy(object_.XmlChildTailEnd);
tslassigning := tslassigning_backup;
end;
@ -3194,7 +3194,7 @@ begin
if not ifnil(object_.XmlChildEffectExtent) then
{self.}XmlChildEffectExtent := new EffectExtentUnitDecorator(object_.XmlChildEffectExtent);
if not ifnil(object_.XmlChildWrapNone) then
{self.}XmlChildWrapNone.Copy(object_.XmlChildWrapNone);
{self.}WrapNone.Copy(object_.XmlChildWrapNone);
if not ifnil(object_.XmlChildDocPr) then
{self.}XmlChildDocPr := new DocPrUnitDecorator(object_.XmlChildDocPr);
if not ifnil(object_.XmlChildCNvGraphicFramePr) then

File diff suppressed because it is too large Load Diff

View File

@ -101,15 +101,6 @@ private
object_: CtrlPr;
end;
type EUnitDecorator = class(E)
public
function Create(_obj: E);
function GetObject();
function Convert();
private
object_: E;
end;
type SSupUnitDecorator = class(SSup)
public
function Create(_obj: SSup);
@ -128,15 +119,6 @@ private
object_: SSupPr;
end;
type SupUnitDecorator = class(Sup)
public
function Create(_obj: Sup);
function GetObject();
function Convert();
private
object_: Sup;
end;
type FUnitDecorator = class(F)
public
function Create(_obj: F);
@ -155,15 +137,6 @@ private
object_: FPr;
end;
type NumUnitDecorator = class(Num)
public
function Create(_obj: Num);
function GetObject();
function Convert();
private
object_: Num;
end;
type RadUnitDecorator = class(Rad)
public
function Create(_obj: Rad);
@ -182,24 +155,6 @@ private
object_: RadPr;
end;
type DegUnitDecorator = class(Deg)
public
function Create(_obj: Deg);
function GetObject();
function Convert();
private
object_: Deg;
end;
type DenUnitDecorator = class(Den)
public
function Create(_obj: Den);
function GetObject();
function Convert();
private
object_: Den;
end;
type SSubUnitDecorator = class(SSub)
public
function Create(_obj: SSub);
@ -218,15 +173,6 @@ private
object_: SSubPr;
end;
type SubUnitDecorator = class(Sub)
public
function Create(_obj: Sub);
function GetObject();
function Convert();
private
object_: Sub;
end;
type NaryUnitDecorator = class(Nary)
public
function Create(_obj: Nary);
@ -344,6 +290,60 @@ private
object_: _Override;
end;
type NumUnitDecorator = class(Num)
public
function Create(_obj: Num);
function GetObject();
function Convert();
private
object_: Num;
end;
type DegUnitDecorator = class(Deg)
public
function Create(_obj: Deg);
function GetObject();
function Convert();
private
object_: Deg;
end;
type EUnitDecorator = class(E)
public
function Create(_obj: E);
function GetObject();
function Convert();
private
object_: E;
end;
type SupUnitDecorator = class(Sup)
public
function Create(_obj: Sup);
function GetObject();
function Convert();
private
object_: Sup;
end;
type DenUnitDecorator = class(Den)
public
function Create(_obj: Den);
function GetObject();
function Convert();
private
object_: Den;
end;
type SubUnitDecorator = class(Sub)
public
function Create(_obj: Sub);
function GetObject();
function Convert();
private
object_: Sub;
end;
implementation
function MathPrUnitDecorator.Create(_obj: MathPr);
@ -371,7 +371,7 @@ begin
if not ifnil(object_.XmlChildSmallFrac) then
{self.}XmlChildSmallFrac := new PureMValUnitDecorator(object_.XmlChildSmallFrac);
if not ifnil(object_.XmlChildDispDef) then
{self.}XmlChildDispDef.Copy(object_.XmlChildDispDef);
{self.}DispDef.Copy(object_.XmlChildDispDef);
if not ifnil(object_.XmlChildLMargin) then
{self.}XmlChildLMargin := new PureMValUnitDecorator(object_.XmlChildLMargin);
if not ifnil(object_.XmlChildRMargin) then
@ -483,9 +483,15 @@ begin
elems := object_.SSubs();
for _,elem in elems do
{self.}AppendChild(new SSubUnitDecorator(elem));
elems := object_.SSups();
for _,elem in elems do
{self.}AppendChild(new SSupUnitDecorator(elem));
elems := object_.Naries();
for _,elem in elems do
{self.}AppendChild(new NaryUnitDecorator(elem));
elems := object_.Funcs();
for _,elem in elems do
{self.}AppendChild(new FuncUnitDecorator(elem));
tslassigning := tslassigning_backup;
end;
@ -637,44 +643,6 @@ begin
tslassigning := tslassigning_backup;
end;
function EUnitDecorator.Create(_obj: E);
begin
class(E).Create();
object_ := _obj;
{self.}Convert();
end;
function EUnitDecorator.GetObject();
begin
return object_;
end;
function EUnitDecorator.Convert();
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
elems := object_.Rs();
for _,elem in elems do
{self.}AppendChild(new RUnitDecorator(elem));
elems := object_.Ds();
for _,elem in elems do
{self.}AppendChild(new DUnitDecorator(elem));
elems := object_.SSups();
for _,elem in elems do
{self.}AppendChild(new SSupUnitDecorator(elem));
elems := object_.SSubs();
for _,elem in elems do
{self.}AppendChild(new SSubUnitDecorator(elem));
elems := object_.Funcs();
for _,elem in elems do
{self.}AppendChild(new FuncUnitDecorator(elem));
if not ifnil(object_.XmlChildF) then
{self.}XmlChildF := new FUnitDecorator(object_.XmlChildF);
if not ifnil(object_.XmlChildCtrlPr) then
{self.}XmlChildCtrlPr := new CtrlPrUnitDecorator(object_.XmlChildCtrlPr);
tslassigning := tslassigning_backup;
end;
function SSupUnitDecorator.Create(_obj: SSup);
begin
class(SSup).Create();
@ -721,30 +689,6 @@ begin
tslassigning := tslassigning_backup;
end;
function SupUnitDecorator.Create(_obj: Sup);
begin
class(Sup).Create();
object_ := _obj;
{self.}Convert();
end;
function SupUnitDecorator.GetObject();
begin
return object_;
end;
function SupUnitDecorator.Convert();
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
elems := object_.Rs();
for _,elem in elems do
{self.}AppendChild(new RUnitDecorator(elem));
if not ifnil(object_.XmlChildCtrlPr) then
{self.}XmlChildCtrlPr := new CtrlPrUnitDecorator(object_.XmlChildCtrlPr);
tslassigning := tslassigning_backup;
end;
function FUnitDecorator.Create(_obj: F);
begin
class(F).Create();
@ -793,32 +737,6 @@ begin
tslassigning := tslassigning_backup;
end;
function NumUnitDecorator.Create(_obj: Num);
begin
class(Num).Create();
object_ := _obj;
{self.}Convert();
end;
function NumUnitDecorator.GetObject();
begin
return object_;
end;
function NumUnitDecorator.Convert();
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
elems := object_.Rs();
for _,elem in elems do
{self.}AppendChild(new RUnitDecorator(elem));
if not ifnil(object_.XmlChildRad) then
{self.}XmlChildRad := new RadUnitDecorator(object_.XmlChildRad);
if not ifnil(object_.XmlChildCtrlPr) then
{self.}XmlChildCtrlPr := new CtrlPrUnitDecorator(object_.XmlChildCtrlPr);
tslassigning := tslassigning_backup;
end;
function RadUnitDecorator.Create(_obj: Rad);
begin
class(Rad).Create();
@ -867,49 +785,6 @@ begin
tslassigning := tslassigning_backup;
end;
function DegUnitDecorator.Create(_obj: Deg);
begin
class(Deg).Create();
object_ := _obj;
{self.}Convert();
end;
function DegUnitDecorator.GetObject();
begin
return object_;
end;
function DegUnitDecorator.Convert();
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
if not ifnil(object_.XmlChildCtrlPr) then
{self.}XmlChildCtrlPr := new CtrlPrUnitDecorator(object_.XmlChildCtrlPr);
tslassigning := tslassigning_backup;
end;
function DenUnitDecorator.Create(_obj: Den);
begin
class(Den).Create();
object_ := _obj;
{self.}Convert();
end;
function DenUnitDecorator.GetObject();
begin
return object_;
end;
function DenUnitDecorator.Convert();
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
elems := object_.Rs();
for _,elem in elems do
{self.}AppendChild(new RUnitDecorator(elem));
tslassigning := tslassigning_backup;
end;
function SSubUnitDecorator.Create(_obj: SSub);
begin
class(SSub).Create();
@ -956,30 +831,6 @@ begin
tslassigning := tslassigning_backup;
end;
function SubUnitDecorator.Create(_obj: Sub);
begin
class(Sub).Create();
object_ := _obj;
{self.}Convert();
end;
function SubUnitDecorator.GetObject();
begin
return object_;
end;
function SubUnitDecorator.Convert();
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
elems := object_.Rs();
for _,elem in elems do
{self.}AppendChild(new RUnitDecorator(elem));
if not ifnil(object_.XmlChildCtrlPr) then
{self.}XmlChildCtrlPr := new CtrlPrUnitDecorator(object_.XmlChildCtrlPr);
tslassigning := tslassigning_backup;
end;
function NaryUnitDecorator.Create(_obj: Nary);
begin
class(Nary).Create();
@ -1297,4 +1148,274 @@ begin
tslassigning := tslassigning_backup;
end;
function NumUnitDecorator.Create(_obj: Num);
begin
class(Num).Create();
object_ := _obj;
{self.}Convert();
end;
function NumUnitDecorator.GetObject();
begin
return object_;
end;
function NumUnitDecorator.Convert();
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
if not ifnil(object_.XmlChildCtrlPr) then
{self.}XmlChildCtrlPr := new CtrlPrUnitDecorator(object_.XmlChildCtrlPr);
elems := object_.Rs();
for _,elem in elems do
{self.}AppendChild(new RUnitDecorator(elem));
elems := object_.Ds();
for _,elem in elems do
{self.}AppendChild(new DUnitDecorator(elem));
elems := object_.Fs();
for _,elem in elems do
{self.}AppendChild(new FUnitDecorator(elem));
elems := object_.Rads();
for _,elem in elems do
{self.}AppendChild(new RadUnitDecorator(elem));
elems := object_.SSubs();
for _,elem in elems do
{self.}AppendChild(new SSubUnitDecorator(elem));
elems := object_.SSups();
for _,elem in elems do
{self.}AppendChild(new SSupUnitDecorator(elem));
elems := object_.Naries();
for _,elem in elems do
{self.}AppendChild(new NaryUnitDecorator(elem));
elems := object_.Funcs();
for _,elem in elems do
{self.}AppendChild(new FuncUnitDecorator(elem));
tslassigning := tslassigning_backup;
end;
function DegUnitDecorator.Create(_obj: Deg);
begin
class(Deg).Create();
object_ := _obj;
{self.}Convert();
end;
function DegUnitDecorator.GetObject();
begin
return object_;
end;
function DegUnitDecorator.Convert();
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
if not ifnil(object_.XmlChildCtrlPr) then
{self.}XmlChildCtrlPr := new CtrlPrUnitDecorator(object_.XmlChildCtrlPr);
elems := object_.Rs();
for _,elem in elems do
{self.}AppendChild(new RUnitDecorator(elem));
elems := object_.Ds();
for _,elem in elems do
{self.}AppendChild(new DUnitDecorator(elem));
elems := object_.Fs();
for _,elem in elems do
{self.}AppendChild(new FUnitDecorator(elem));
elems := object_.Rads();
for _,elem in elems do
{self.}AppendChild(new RadUnitDecorator(elem));
elems := object_.SSubs();
for _,elem in elems do
{self.}AppendChild(new SSubUnitDecorator(elem));
elems := object_.SSups();
for _,elem in elems do
{self.}AppendChild(new SSupUnitDecorator(elem));
elems := object_.Naries();
for _,elem in elems do
{self.}AppendChild(new NaryUnitDecorator(elem));
elems := object_.Funcs();
for _,elem in elems do
{self.}AppendChild(new FuncUnitDecorator(elem));
tslassigning := tslassigning_backup;
end;
function EUnitDecorator.Create(_obj: E);
begin
class(E).Create();
object_ := _obj;
{self.}Convert();
end;
function EUnitDecorator.GetObject();
begin
return object_;
end;
function EUnitDecorator.Convert();
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
if not ifnil(object_.XmlChildCtrlPr) then
{self.}XmlChildCtrlPr := new CtrlPrUnitDecorator(object_.XmlChildCtrlPr);
elems := object_.Rs();
for _,elem in elems do
{self.}AppendChild(new RUnitDecorator(elem));
elems := object_.Ds();
for _,elem in elems do
{self.}AppendChild(new DUnitDecorator(elem));
elems := object_.Fs();
for _,elem in elems do
{self.}AppendChild(new FUnitDecorator(elem));
elems := object_.Rads();
for _,elem in elems do
{self.}AppendChild(new RadUnitDecorator(elem));
elems := object_.SSubs();
for _,elem in elems do
{self.}AppendChild(new SSubUnitDecorator(elem));
elems := object_.SSups();
for _,elem in elems do
{self.}AppendChild(new SSupUnitDecorator(elem));
elems := object_.Naries();
for _,elem in elems do
{self.}AppendChild(new NaryUnitDecorator(elem));
elems := object_.Funcs();
for _,elem in elems do
{self.}AppendChild(new FuncUnitDecorator(elem));
tslassigning := tslassigning_backup;
end;
function SupUnitDecorator.Create(_obj: Sup);
begin
class(Sup).Create();
object_ := _obj;
{self.}Convert();
end;
function SupUnitDecorator.GetObject();
begin
return object_;
end;
function SupUnitDecorator.Convert();
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
if not ifnil(object_.XmlChildCtrlPr) then
{self.}XmlChildCtrlPr := new CtrlPrUnitDecorator(object_.XmlChildCtrlPr);
elems := object_.Rs();
for _,elem in elems do
{self.}AppendChild(new RUnitDecorator(elem));
elems := object_.Ds();
for _,elem in elems do
{self.}AppendChild(new DUnitDecorator(elem));
elems := object_.Fs();
for _,elem in elems do
{self.}AppendChild(new FUnitDecorator(elem));
elems := object_.Rads();
for _,elem in elems do
{self.}AppendChild(new RadUnitDecorator(elem));
elems := object_.SSubs();
for _,elem in elems do
{self.}AppendChild(new SSubUnitDecorator(elem));
elems := object_.SSups();
for _,elem in elems do
{self.}AppendChild(new SSupUnitDecorator(elem));
elems := object_.Naries();
for _,elem in elems do
{self.}AppendChild(new NaryUnitDecorator(elem));
elems := object_.Funcs();
for _,elem in elems do
{self.}AppendChild(new FuncUnitDecorator(elem));
tslassigning := tslassigning_backup;
end;
function DenUnitDecorator.Create(_obj: Den);
begin
class(Den).Create();
object_ := _obj;
{self.}Convert();
end;
function DenUnitDecorator.GetObject();
begin
return object_;
end;
function DenUnitDecorator.Convert();
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
if not ifnil(object_.XmlChildCtrlPr) then
{self.}XmlChildCtrlPr := new CtrlPrUnitDecorator(object_.XmlChildCtrlPr);
elems := object_.Rs();
for _,elem in elems do
{self.}AppendChild(new RUnitDecorator(elem));
elems := object_.Ds();
for _,elem in elems do
{self.}AppendChild(new DUnitDecorator(elem));
elems := object_.Fs();
for _,elem in elems do
{self.}AppendChild(new FUnitDecorator(elem));
elems := object_.Rads();
for _,elem in elems do
{self.}AppendChild(new RadUnitDecorator(elem));
elems := object_.SSubs();
for _,elem in elems do
{self.}AppendChild(new SSubUnitDecorator(elem));
elems := object_.SSups();
for _,elem in elems do
{self.}AppendChild(new SSupUnitDecorator(elem));
elems := object_.Naries();
for _,elem in elems do
{self.}AppendChild(new NaryUnitDecorator(elem));
elems := object_.Funcs();
for _,elem in elems do
{self.}AppendChild(new FuncUnitDecorator(elem));
tslassigning := tslassigning_backup;
end;
function SubUnitDecorator.Create(_obj: Sub);
begin
class(Sub).Create();
object_ := _obj;
{self.}Convert();
end;
function SubUnitDecorator.GetObject();
begin
return object_;
end;
function SubUnitDecorator.Convert();
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
if not ifnil(object_.XmlChildCtrlPr) then
{self.}XmlChildCtrlPr := new CtrlPrUnitDecorator(object_.XmlChildCtrlPr);
elems := object_.Rs();
for _,elem in elems do
{self.}AppendChild(new RUnitDecorator(elem));
elems := object_.Ds();
for _,elem in elems do
{self.}AppendChild(new DUnitDecorator(elem));
elems := object_.Fs();
for _,elem in elems do
{self.}AppendChild(new FUnitDecorator(elem));
elems := object_.Rads();
for _,elem in elems do
{self.}AppendChild(new RadUnitDecorator(elem));
elems := object_.SSubs();
for _,elem in elems do
{self.}AppendChild(new SSubUnitDecorator(elem));
elems := object_.SSups();
for _,elem in elems do
{self.}AppendChild(new SSupUnitDecorator(elem));
elems := object_.Naries();
for _,elem in elems do
{self.}AppendChild(new NaryUnitDecorator(elem));
elems := object_.Funcs();
for _,elem in elems do
{self.}AppendChild(new FuncUnitDecorator(elem));
tslassigning := tslassigning_backup;
end;
end.

View File

@ -1,6 +1,6 @@
unit VML;
interface
uses DocxML;
uses TSSafeUnitConverter, DocxML;
type Shapetype = class(OpenXmlCompositeElement)
public
@ -9,6 +9,8 @@ public
function Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
function Init();override;
function Copy(_obj: Shapetype);override;
function ConvertToPoint();override;
public
// attributes property
property AnchorId read ReadXmlAttrAnchorId write WriteXmlAttrAnchorId;
@ -81,6 +83,8 @@ public
function Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
function Init();override;
function Copy(_obj: Formulas);override;
function ConvertToPoint();override;
public
// multi property
@ -100,6 +104,8 @@ public
function Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
function Init();override;
function Copy(_obj: Lock);override;
function ConvertToPoint();override;
public
// attributes property
property Ext read ReadXmlAttrExt write WriteXmlAttrExt;
@ -123,6 +129,8 @@ public
function Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
function Init();override;
function Copy(_obj: F);override;
function ConvertToPoint();override;
public
// attributes property
property Eqn read ReadXmlAttrEqn write WriteXmlAttrEqn;
@ -142,6 +150,8 @@ public
function Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
function Init();override;
function Copy(_obj: Stroke);override;
function ConvertToPoint();override;
public
// attributes property
property Joinstyle read ReadXmlAttrJoinstyle write WriteXmlAttrJoinstyle;
@ -161,6 +171,8 @@ public
function Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
function Init();override;
function Copy(_obj: Path);override;
function ConvertToPoint();override;
public
// attributes property
property Extrusionok read ReadXmlAttrExtrusionok write WriteXmlAttrExtrusionok;
@ -200,6 +212,8 @@ public
function Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
function Init();override;
function Copy(_obj: Textpath);override;
function ConvertToPoint();override;
public
// attributes property
property _On read ReadXmlAttr_On write WriteXmlAttr_On;
@ -231,6 +245,8 @@ public
function Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
function Init();override;
function Copy(_obj: Handles);override;
function ConvertToPoint();override;
public
// normal property
@ -249,6 +265,8 @@ public
function Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
function Init();override;
function Copy(_obj: H);override;
function ConvertToPoint();override;
public
// attributes property
property Xrange read ReadXmlAttrXrange write WriteXmlAttrXrange;
@ -272,6 +290,8 @@ public
function Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
function Init();override;
function Copy(_obj: Shape);override;
function ConvertToPoint();override;
public
// attributes property
property Id read ReadXmlAttrId write WriteXmlAttrId;
@ -345,6 +365,8 @@ public
function Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
function Init();override;
function Copy(_obj: Wrap);override;
function ConvertToPoint();override;
public
// attributes property
property Anchorx read ReadXmlAttrAnchorx write WriteXmlAttrAnchorx;
@ -368,6 +390,8 @@ public
function Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
function Init();override;
function Copy(_obj: Fill);override;
function ConvertToPoint();override;
public
// attributes property
property Opacity read ReadXmlAttrOpacity write WriteXmlAttrOpacity;
@ -387,6 +411,8 @@ public
function Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
function Init();override;
function Copy(_obj: Imagedata);override;
function ConvertToPoint();override;
public
// attributes property
property Id read ReadXmlAttrId write WriteXmlAttrId;
@ -410,6 +436,8 @@ public
function Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
function Init();override;
function Copy(_obj: Textbox);override;
function ConvertToPoint();override;
public
// normal property
@ -428,6 +456,8 @@ public
function Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
function Init();override;
function Copy(_obj: OLEObject);override;
function ConvertToPoint();override;
public
// attributes property
property Type read ReadXmlAttrType write WriteXmlAttrType;
@ -542,6 +572,22 @@ begin
tslassigning := tslassigning_backup;
end;
function Shapetype.ConvertToPoint();override;
begin
if not ifnil({self.}XmlChildStroke) then
{self.}XmlChildStroke.ConvertToPoint();
if not ifnil({self.}XmlChildFormulas) then
{self.}XmlChildFormulas.ConvertToPoint();
if not ifnil({self.}XmlChildPath) then
{self.}XmlChildPath.ConvertToPoint();
if not ifnil({self.}XmlChildTextpath) then
{self.}XmlChildTextpath.ConvertToPoint();
if not ifnil({self.}XmlChildHandles) then
{self.}XmlChildHandles.ConvertToPoint();
if not ifnil({self.}XmlChildLock) then
{self.}XmlChildLock.ConvertToPoint();
end;
function Shapetype.ReadXmlAttrAnchorId();
begin
return {self.}XmlAttrAnchorId.Value;
@ -773,6 +819,13 @@ begin
tslassigning := tslassigning_backup;
end;
function Formulas.ConvertToPoint();override;
begin
elems := {self.}Fs();
for _,elem in elems do
elem.ConvertToPoint();
end;
function Formulas.ReadFs(_index);
begin
ind := ifnil(_index) ? -2 : _index;
@ -835,6 +888,11 @@ begin
tslassigning := tslassigning_backup;
end;
function Lock.ConvertToPoint();override;
begin
end;
function Lock.ReadXmlAttrExt();
begin
return {self.}XmlAttrExt.Value;
@ -903,6 +961,11 @@ begin
tslassigning := tslassigning_backup;
end;
function F.ConvertToPoint();override;
begin
end;
function F.ReadXmlAttrEqn();
begin
return {self.}XmlAttrEqn.Value;
@ -956,6 +1019,11 @@ begin
tslassigning := tslassigning_backup;
end;
function Stroke.ConvertToPoint();override;
begin
end;
function Stroke.ReadXmlAttrJoinstyle();
begin
return {self.}XmlAttrJoinstyle.Value;
@ -1024,6 +1092,11 @@ begin
tslassigning := tslassigning_backup;
end;
function Path.ConvertToPoint();override;
begin
end;
function Path.ReadXmlAttrExtrusionok();
begin
return {self.}XmlAttrExtrusionok.Value;
@ -1161,6 +1234,11 @@ begin
tslassigning := tslassigning_backup;
end;
function Textpath.ConvertToPoint();override;
begin
end;
function Textpath.ReadXmlAttr_On();
begin
return {self.}XmlAttr_On.Value;
@ -1259,6 +1337,12 @@ begin
tslassigning := tslassigning_backup;
end;
function Handles.ConvertToPoint();override;
begin
if not ifnil({self.}XmlChildH) then
{self.}XmlChildH.ConvertToPoint();
end;
function Handles.ReadXmlChildH(): H;
begin
if tslassigning and (ifnil({self.}XmlChildH) or {self.}XmlChildH.Removed) then
@ -1310,6 +1394,11 @@ begin
tslassigning := tslassigning_backup;
end;
function H.ConvertToPoint();override;
begin
end;
function H.ReadXmlAttrXrange();
begin
return {self.}XmlAttrXrange.Value;
@ -1420,6 +1509,20 @@ begin
tslassigning := tslassigning_backup;
end;
function Shape.ConvertToPoint();override;
begin
if not ifnil({self.}XmlChildFill) then
{self.}XmlChildFill.ConvertToPoint();
if not ifnil({self.}XmlChildTextbox) then
{self.}XmlChildTextbox.ConvertToPoint();
if not ifnil({self.}XmlChildTextpath) then
{self.}XmlChildTextpath.ConvertToPoint();
if not ifnil({self.}XmlChildImagedata) then
{self.}XmlChildImagedata.ConvertToPoint();
if not ifnil({self.}XmlChildWrap) then
{self.}XmlChildWrap.ConvertToPoint();
end;
function Shape.ReadXmlAttrId();
begin
return {self.}XmlAttrId.Value;
@ -1661,6 +1764,11 @@ begin
tslassigning := tslassigning_backup;
end;
function Wrap.ConvertToPoint();override;
begin
end;
function Wrap.ReadXmlAttrAnchorx();
begin
return {self.}XmlAttrAnchorx.Value;
@ -1729,6 +1837,11 @@ begin
tslassigning := tslassigning_backup;
end;
function Fill.ConvertToPoint();override;
begin
end;
function Fill.ReadXmlAttrOpacity();
begin
return {self.}XmlAttrOpacity.Value;
@ -1785,6 +1898,11 @@ begin
tslassigning := tslassigning_backup;
end;
function Imagedata.ConvertToPoint();override;
begin
end;
function Imagedata.ReadXmlAttrId();
begin
return {self.}XmlAttrId.Value;
@ -1853,6 +1971,12 @@ begin
tslassigning := tslassigning_backup;
end;
function Textbox.ConvertToPoint();override;
begin
if not ifnil({self.}XmlChildTxbxContent) then
{self.}XmlChildTxbxContent.ConvertToPoint();
end;
function Textbox.ReadXmlChildTxbxContent(): TxbxContent;
begin
if tslassigning and (ifnil({self.}XmlChildTxbxContent) or {self.}XmlChildTxbxContent.Removed) then
@ -1916,6 +2040,11 @@ begin
tslassigning := tslassigning_backup;
end;
function OLEObject.ConvertToPoint();override;
begin
end;
function OLEObject.ReadXmlAttrType();
begin
return {self.}XmlAttrType.Value;

6
cp.ps1
View File

@ -2,14 +2,16 @@ $sourcedir = "D:\code\tinysoft\OfficeXml-dev"
$destdir = "D:\code\tinysoft\OfficeXml"
# 复制tsf脚本
Remove-Item -Path ($destdir + "\autoclass\") -Recurse -Force
Remove-Item -Path ($destdir + "\autounit\") -Recurse -Force
Remove-Item -Path ($destdir + "\openxml\") -Recurse -Force
Remove-Item -Path ($destdir + "\utils\") -Recurse -Force
Remove-Item -Path ($destdir + "\docx\") -Recurse -Force
Remove-Item -Path ($destdir + "\pptx\") -Recurse -Force
Copy-Item -Path ($sourcedir + "\funcext\OfficeXml\autoclass\") ($destdir + "\autoclass\") -Recurse -Force
Copy-Item -Path ($sourcedir + "\funcext\OfficeXml\autounit\") ($destdir + "\autounit\") -Recurse -Force
Copy-Item -Path ($sourcedir + "\funcext\OfficeXml\utils\") ($destdir + "\utils\") -Recurse -Force
Copy-Item -Path ($sourcedir + "\funcext\OfficeXml\openxml\") ($destdir + "\openxml\") -Recurse -Force
Copy-Item -Path ($sourcedir + "\funcext\OfficeXml\docx\") ($destdir + "\docx\") -Recurse -Force
Copy-Item -Path ($sourcedir + "\funcext\OfficeXml\pptx\") ($destdir + "\pptx\") -Recurse -Force
Copy-Item -Path ($sourcedir + "\README.md") ($destdir + "\") -Force
Copy-Item -Path ($sourcedir + "\迁移指南.md") ($destdir + "\") -Force

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -9,11 +9,9 @@ public
function AppendChild(_element: OpenXmlElement);
function InsertAfter(_element: OpenXmlElement; _pos_element: OpenXmlElement);
function RemoveChild(_element: OpenXmlElement);
function RemoveAttribute(_attr: OpenXmlAttribute);
// function InsertBefore(_pos_obj: tslobj; _obj: tslobj);
// function PrependChild(_obj: tslobj);
// function SetAttribute(_obj: OpenXmlAttribute);
// function RemoveAttribute();
public
function GetOrCreateNode(_obj: tslobj);
@ -65,15 +63,16 @@ end;
function OpenXmlCompositeElement.Serialize();override;
begin
if {self.}DeleteSelf() then return;
{self.}GetNode();
// xmlns
for k, v in xmlns_ do
{self.}GetNode().SetAttribute(v.ElementName, v.Value);
{self.}XmlNode.SetAttribute(v.ElementName, v.Value);
// Attributes
for k, v in attributes_ do
if not ifnil(v.Value) then
{self.}GetNode().SetAttribute(v.ElementName, v.Value);
{self.}XmlNode.SetAttribute(v.ElementName, v.Value);
else if {self.}XmlNode then
{self.}XmlNode.DeleteAttribute(v.ElementName);
@ -152,8 +151,3 @@ begin
_element.Removed := true;
end;
function OpenXmlCompositeElement.RemoveAttribute(_attr: OpenXmlAttribute);
begin
_attr.Value := nil;
end;

View File

@ -9,11 +9,16 @@ public
function Serialize();virtual;
function Marshal(): tableArray;virtual;
function SetFallback(_fallback: OpenXmlElement);
function RemoveAttribute(_attr: OpenXmlAttribute);
function Attribute(_attr: string; _ns: string): OpenXmlAttribute;
function Attributes(): array of OpenXmlAttribute;
function Elements(): array of tslobj;
function Xmlns(_prefix: string): string;
// 单位转换
function ConvertToPoint();virtual;
protected
function GetNode(): XmlNode;
function DeleteSelf(): boolean;
@ -32,6 +37,7 @@ protected
xmlns_: tableArray;
sorted_child_: tableArray;
container_: TSOfficeContainer;
fallback_: OpenXmlElement; // 代理对象
end;
function OpenXmlElement.Create(_node: XmlNode);overload;
@ -53,12 +59,18 @@ begin
{self.}Removed := false;
{self.}Init();
xmlns_ := array();
fallback_ := nil;
end;
function OpenXmlElement.SetFallback(_fallback: OpenXmlElement);
begin
fallback_ := _fallback;
end;
function OpenXmlElement.Attribute(_attr: string; _ns: string): OpenXmlAttribute;
begin
if ifnil(_ns) then
attr_name := ifString({self.}Prefix) and {self.}Prefix <> "" ? format("%s:%%s", {self.}Prefix, _attr) : _attr;
attr_name := ifString({self.}Prefix) and {self.}Prefix <> "" ? format("%s:%s", {self.}Prefix, _attr) : _attr;
else
attr_name := format("%s:%s", _ns, _attr);
return attributes_[attr_name];
@ -67,8 +79,9 @@ end;
function OpenXmlElement.Attributes(): array of OpenXmlAttribute;
begin
attrs := array();
for k, v in attributes_ do
attrs[length(attrs)] := v;
for k,v in attributes_ do
if not ifnil(v.Value) then
attrs[length(attrs)] := v;
return attrs;
end;
@ -105,3 +118,7 @@ begin
return false;
end;
function OpenXmlElement.RemoveAttribute(_attr: OpenXmlAttribute);
begin
_attr.Value := nil;
end;

View File

@ -73,13 +73,16 @@ function OpenXmlSimpleType.Serialize();override;
begin
if not ifObj({self.}XmlNode) then
begin
if not ifnil({self.}XmlAttrVal.Value) then {self.}GetNode().SetAttribute({self.}XmlAttrVal.ElementName, {self.}XmlAttrVal.Value);
{self.}GetNode();
if not ifnil({self.}XmlAttrVal.Value) then {self.}XmlNode.SetAttribute({self.}XmlAttrVal.ElementName, {self.}XmlAttrVal.Value);
end
else begin
if not {self.}Enable or {self.}Removed then
{self.}Parent.XmlNode.DeleteChild({self.}XmlNode);
else if not ifnil({self.}XmlAttrVal.Value) then
{self.}XmlNode.SetAttribute({self.}XmlAttrVal.ElementName, {self.}XmlAttrVal.Value);
else if ifnil({self.}XmlAttrVal.Value) then
{self.}XmlNode.DeleteAttribute({self.}XmlAttrVal.ElementName);
end
end;

View File

@ -62,7 +62,7 @@ end;
function PptxComponents.Create();
begin
Class(TSComponentsBase).Create();
inherited;
end;
function PptxComponents.Init();override;

View File

@ -3,12 +3,14 @@ public
function Create();
function Init();virtual;
function InitZip(zip: ZipFile);
function NewFile(): tableArray;
function Open(alias: string; file: string; password: string): tableArray;
function Save(): array of info; // array(err, errmsg)
function SaveAs(alias: string; file: string): array of info;
function Zip(): ZipFile;
protected
function DefaultBinaryData(): binary;virtual;
function GetProp(_variable: tslobj; _name: string): tslobj;
function GetPropArr(_variable: tslobj; _name: string; _index: integer): tslobj;
function NewObject(_name: string): tslobj;virtual;
@ -16,22 +18,26 @@ protected
protected
zipfile_: ZipFile;
conf_: tableArray;
end;
function TSComponentsBase.Create();
begin
{self.}Init();
end;
function TSComponentsBase.InitZip(zip: ZipFile);
begin
{self.}Init();
zipfile_ := zip;
end;
function TSComponentsBase.NewFile(): tableArray;
begin
zipfile_ := new ZipFile();
return zipfile_.LoadFromMem({self.}DefaultBinaryData());
end;
function TSComponentsBase.Open(alias: string; file: string; password: string): tableArray;
begin
{self.}Init();
zipfile_ := new ZipFile();
return zipfile_.Open(alias, file, password);
end;

View File

@ -1,7 +1,8 @@
type TSOfficeContainer = class
public
function Create(arr: array of string);
function Set(data: any): boolean; // 设置data数据
function Set(data: any): boolean;overload; // 设置data数据
function Set(name: string; index: integer; data: any): boolean;overload;
function Add(data: any): boolean;
function Append(data: any): boolean;
function Insert(data: any): boolean;
@ -16,7 +17,8 @@ private
bucket_: array of LinkList;
child_: array of string;
current_index_: integer;
last_index_: integer;
min_index_; integer;
max_index_: integer;
end;
type LinkList = class
@ -47,22 +49,88 @@ function TSOfficeContainer.Create(arr: array of string);
begin
bucket_ := array();
child_ := array();
min_index_ := 0;
max_index_ := 0;
for str,v in arr do
begin
child_[str] := v[0];
last_index_ := v[0];
if v[0] > max_index_ then max_index_ := v[0];
if v[0] < min_index_ then min_index_ := v[0];
end
current_index_ := -1;
current_index_ := -INF;
end;
function TSOfficeContainer.Set(data: any): boolean;
function TSOfficeContainer.Set(data: any): boolean;overload;
begin
obj := {self.}GetBucketObj(data.ElementName);
if ifnil(obj) then return false;
obj.Add(data);
obj.Set(data);
return true;
end;
function TSOfficeContainer.Set(name: string; index: integer; data: any): boolean;overload;
begin
ind := child_[name];
obj := bucket_[ind];
if ifObj(obj) and obj.Name() = name then
begin
node := obj.First();
while ifObj(node) do
begin
if node.data.Removed then
begin
node := node.next;
continue;
end
index--;
if index = -1 then
begin
new_node := new Node();
new_node.data := data;
new_node.next := node.next;
node.data.Removed := true;
node.next := new_node;
if tail_ = node then
tail_ := new_node;
return true;
end
node := node.next;
end
end
i := max_index_ + 1;
for i:=max_index_+1 to current_index_ do
begin
if i = ind then continue;
obj := bucket_[i];
if ifObj(obj) and obj.Name() = name then
begin
node := obj.First();
while ifObj(node) do
begin
if node.data.Remove then
begin
node := node.next;
continue;
end
index--;
if index = -1 then
begin
new_node := new Node();
new_node.data := data;
new_node.next := node.next;
node.data.Removed := true;
node.next := new_node;
if tail_ = node then
tail_ := new_node;
return true;
end
node := node.next;
end
end
end
return false;
end;
function TSOfficeContainer.Add(data: any): boolean;
begin
obj := {self.}GetBucketObj(data.ElementName);
@ -80,7 +148,7 @@ begin
if ifObj(obj) and obj.Name() = data.ElementName then obj.Add(data);
else begin
obj := new LinkList(data.ElementName);
current_index_ := current_index_ > last_index_ ? current_index_ + 1 : last_index_ + 1;
current_index_ := current_index_ > max_index_ ? current_index_ + 1 : max_index_ + 1;
bucket_[current_index_] := obj;
obj.Add(data);
end
@ -102,7 +170,7 @@ end;
function TSOfficeContainer.Insert(data: any): boolean;
begin
i := last_index_ + 1;
i := max_index_ + 1;
while i <= current_index_ do
begin
obj := bucket_[i];
@ -129,7 +197,7 @@ end;
function TSOfficeContainer.GetElements(include_removed: boolean = true): array of tslobj;
begin
arr := array();
for i:=0 to current_index_ do
for i:=min_index_ to current_index_ do
begin
obj := bucket_[i];
if ifObj(obj) then
@ -151,33 +219,43 @@ begin
ind := child_[name];
arr := array();
obj := bucket_[ind];
if ifObj(obj) then
if ifObj(obj) and obj.Name() = name then
begin
node := obj.First();
while ifObj(node) do
begin
if node.data.Removed then
begin
node := node.next;
continue;
end
arr[length(arr)] := node.data;
index--;
if index = -1 then return node.data;
node := node.next;
end
end
i := last_index_ + 1;
while i <= current_index_ do
i := max_index_ + 1;
for i:=max_index_+1 to current_index_ do
begin
if i = ind then continue;
obj := bucket_[i];
if ifObj(obj) and obj.Name() = name then
begin
node := obj.First();
while ifObj(node) do
begin
if node.data.Removed then
begin
node := node.next;
continue;
end
arr[length(arr)] := node.data;
index--;
if index = -1 then return node.data;
node := node.next;
end
end
i++;
end
return arr;
end;
@ -208,8 +286,18 @@ function LinkList.Set(data: any)
begin
node := new Node();
node.data := data;
head_.next := node;
tail_ := node;
if tail_ <> head_ then
begin
tail_.data.Removed := true;
tail_.next := node;
tail_ := node;
size_++;
end
else begin
head_.next := node;
tail_ := node;
size_ := 1;
end
end;
function LinkList.Add(data: any)

View File

@ -1,16 +1,24 @@
unit TSSafeUnitConverter;
interface
function PointsToTwips(value): real;
function TwipsToPoints(value): real;
function EmusToPoints(value): real;
function HalfPointToPoints(value): real;
function PercentToNumber(value): real;
function NumberToPercent(value): real;
function ToInt(value): integer;
function EighthPointToPoints(value): real;
implementation
uses TSUnitConverter;
function PointsToTwips(value): real;
begin
if ifNil(value) then return 0;
new_value := ifString(value) ? strToFloat(value) : value;
return TSUnitConverter.PointsToTwips(new_value);
end;
function TwipsToPoints(value): real;
begin
if ifNil(value) then return 0;
@ -39,10 +47,17 @@ uses TSUnitConverter;
return TSUnitConverter.PercentToNumber(new_value);
end;
function NumberToPercent(value): real;
begin
if ifNil(value) then return 0;
new_value := ifString(value) ? strToFloat(value) : value;
return TSUnitConverter.NumberToPercent(new_value);
end;
function ToInt(value): integer;
begin
if ifNil(value) then return 0;
return tryStrtoInt(value, r) ? r : 0;
return strtoIntDef(value, 0);
end;
function EighthPointToPoints(value): real;

View File

@ -1,13 +1,20 @@
unit TSUnitConverter;
interface
function PointsToTwips(value): real;
function TwipsToPoints(value: real): real;
function EmusToPoints(value: real): real;
function HalfPointToPoints(value: real): real;
function EighthPointToPoints(value: real): real;
function PercentToNumber(value: real): real;
function NumberToPercent(value: real): real;
implementation
function PointsToTwips(value): real;
begin
return value * 20;
end;
function TwipsToPoints(value: real): real;
begin
return value / 20;
@ -28,6 +35,11 @@ implementation
return value / 100;
end;
function NumberToPercent(value: real): real;
begin
return value * 100;
end;
function EighthPointToPoints(value: real): real;
begin
return value / 8;

View File

@ -1,6 +1,6 @@
type VBABase = class
public
function Create(Par: tslobj; App: Application; Cre: integer);
function Create(_parent: tslobj; _application: Application; _creator: integer);
public
property Application read ReadApplication;
@ -9,19 +9,19 @@ public
function ReadApplication();
function ReadParent();
function ReadCreator();
private
[weakref]parent_: tslobj;
[weakref]application_: Application;
creator_: integer;
End;
end;
// ============== 实现 ================= //
function VBABase.Create(Par: tslobj; App: Application; Cre: integer);
function VBABase.Create(_parent: tslobj; _application: Application; _creator: integer);
begin
parent_ := Par;
application_ := App;
creator_ := Cre;
parent_ := _parent;
application_ := _application;
creator_ := _creator;
end;
// properties