From 4b9b1451cab347dd903a6da1f4375012dad0fc71 Mon Sep 17 00:00:00 2001 From: csh Date: Thu, 19 Sep 2024 10:45:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A9=E7=94=A8nil=E6=96=B0=E7=89=B9?= =?UTF-8?q?=E6=80=A7=E8=BF=9B=E8=A1=8C=E6=80=A7=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapter/docx/EndnotePrAdapter@DOCX.tsf | 36 + .../adapter/docx/EndnotesAdapter@DOCX.tsf | 36 + .../adapter/docx/FootnotePrAdapter@DOCX.tsf | 36 + .../adapter/docx/FootnotesAdapter@DOCX.tsf | 36 + .../decorator/docx/APPrUnitDecorator@DOCX.tsf | 6 +- .../decorator/docx/ARPrUnitDecorator@DOCX.tsf | 45 +- .../decorator/docx/ARUnitDecorator@DOCX.tsf | 9 +- .../docx/AbstractNumUnitDecorator@DOCX.tsf | 18 +- .../AlternateContentUnitDecorator@DOCX.tsf | 12 +- .../docx/AnchorUnitDecorator@DOCX.tsf | 72 +- .../decorator/docx/ApUnitDecorator@DOCX.tsf | 9 +- .../decorator/docx/AxUnitDecorator@DOCX.tsf | 54 +- .../docx/BarChartUnitDecorator@DOCX.tsf | 15 +- .../docx/BlipFillUnitDecorator@DOCX.tsf | 9 +- .../decorator/docx/BlipUnitDecorator@DOCX.tsf | 9 +- .../docx/BodyPrUnitDecorator@DOCX.tsf | 63 +- .../decorator/docx/BodyUnitDecorator@DOCX.tsf | 6 +- .../docx/BookmarkUnitDecorator@DOCX.tsf | 9 +- .../decorator/docx/BrUnitDecorator@DOCX.tsf | 6 +- .../CNvGraphicFramePrUnitDecorator@DOCX.tsf | 6 +- .../docx/CNvPicPrUnitDecorator@DOCX.tsf | 6 +- .../docx/CNvPrUnitDecorator@DOCX.tsf | 12 +- .../docx/CNvSpPrUnitDecorator@DOCX.tsf | 9 +- .../decorator/docx/CXYUnitDecorator@DOCX.tsf | 9 +- .../docx/CacheUnitDecorator@DOCX.tsf | 7 +- .../decorator/docx/CatUnitDecorator@DOCX.tsf | 6 +- .../docx/ChartSpaceUnitDecorator@DOCX.tsf | 30 +- .../docx/ChartUnitDecorator@DOCX.tsf | 27 +- .../docx/ChoiceUnitDecorator@DOCX.tsf | 15 +- .../decorator/docx/Clr1UnitDecorator@DOCX.tsf | 6 +- .../decorator/docx/Clr2UnitDecorator@DOCX.tsf | 6 +- .../ClrSchemeMappingUnitDecorator@DOCX.tsf | 39 +- .../docx/ClrSchemeUnitDecorator@DOCX.tsf | 42 +- .../docx/CnfStyleUnitDecorator@DOCX.tsf | 42 +- .../docx/ColorUnitDecorator@DOCX.tsf | 9 +- .../decorator/docx/ColsUnitDecorator@DOCX.tsf | 6 +- .../docx/CommentRangeUnitDecorator@DOCX.tsf | 6 +- .../docx/CommentUnitDecorator@DOCX.tsf | 12 +- .../docx/CommentsUnitDecorator@DOCX.tsf | 57 +- .../docx/CompatSettingUnitDecorator@DOCX.tsf | 12 +- .../docx/CompatUnitDecorator@DOCX.tsf | 24 +- .../docx/CorePropertiesUnitDecorator@DOCX.tsf | 32 +- .../docx/CreatedUnitDecorator@DOCX.tsf | 6 +- .../docx/DLblsUnitDecorator@DOCX.tsf | 30 +- .../docx/DTableUnitDecorator@DOCX.tsf | 18 +- .../docx/DefaultUnitDecorator@DOCX.tsf | 9 +- .../docx/DocDefaultsUnitDecorator@DOCX.tsf | 9 +- .../docx/DocGridUnitDecorator@DOCX.tsf | 9 +- .../docx/DocPartObjUnitDecorator@DOCX.tsf | 9 +- .../docx/DocPrUnitDecorator@DOCX.tsf | 12 +- .../docx/DocumentUnitDecorator@DOCX.tsf | 45 +- .../docx/DrawingUnitDecorator@DOCX.tsf | 9 +- .../docx/EffectExtentUnitDecorator@DOCX.tsf | 15 +- .../docx/EffectLstUnitDecorator@DOCX.tsf | 6 +- .../docx/EffectStyleLstUnitDecorator@DOCX.tsf | 3 + .../docx/EffectStyleUnitDecorator@DOCX.tsf | 6 +- .../docx/EndnotePrUnitDecorator@DOCX.tsf | 3 + .../docx/EndnoteUnitDecorator@DOCX.tsf | 9 +- .../docx/EndnotesUnitDecorator@DOCX.tsf | 102 ++- .../docx/ExtLstUnitDecorator@DOCX.tsf | 3 + .../decorator/docx/ExtUnitDecorator@DOCX.tsf | 15 +- .../docx/ExternalDataUnitDecorator@DOCX.tsf | 9 +- .../docx/FallbackUnitDecorator@DOCX.tsf | 9 +- .../docx/FillStyleLstUnitDecorator@DOCX.tsf | 3 + .../docx/FldCharUnitDecorator@DOCX.tsf | 9 +- .../docx/FldSimpleUnitDecorator@DOCX.tsf | 6 +- .../docx/FmtSchemeUnitDecorator@DOCX.tsf | 18 +- .../docx/FontSchemeUnitDecorator@DOCX.tsf | 12 +- .../decorator/docx/FontUnitDecorator@DOCX.tsf | 24 +- .../docx/FontsUnitDecorator@DOCX.tsf | 39 +- .../docx/FootnotePrUnitDecorator@DOCX.tsf | 9 + .../docx/FootnoteUnitDecorator@DOCX.tsf | 9 +- .../docx/FootnotesUnitDecorator@DOCX.tsf | 102 ++- .../decorator/docx/FtrUnitDecorator@DOCX.tsf | 48 +- .../docx/GradFillUnitDecorator@DOCX.tsf | 12 +- .../docx/GraphicDataUnitDecorator@DOCX.tsf | 15 +- .../GraphicFrameLocksUnitDecorator@DOCX.tsf | 9 +- .../docx/GraphicUnitDecorator@DOCX.tsf | 9 +- .../docx/GridColUnitDecorator@DOCX.tsf | 6 +- .../docx/GridSpanUnitDecorator@DOCX.tsf | 6 +- .../docx/GsLstUnitDecorator@DOCX.tsf | 3 + .../decorator/docx/GsUnitDecorator@DOCX.tsf | 9 +- .../HdrShapeDefaultsUnitDecorator@DOCX.tsf | 6 +- .../decorator/docx/HdrUnitDecorator@DOCX.tsf | 48 +- .../docx/HyperLinkUnitDecorator@DOCX.tsf | 12 +- .../docx/IdMapUnitDecorator@DOCX.tsf | 9 +- .../decorator/docx/IndUnitDecorator@DOCX.tsf | 27 +- .../docx/InstrTextUnitDecorator@DOCX.tsf | 6 +- .../decorator/docx/LangUnitDecorator@DOCX.tsf | 12 +- .../docx/LatenStylesUnitDecorator@DOCX.tsf | 21 +- .../docx/LatinUnitDecorator@DOCX.tsf | 9 +- .../docx/LegendUnitDecorator@DOCX.tsf | 15 +- .../decorator/docx/LinUnitDecorator@DOCX.tsf | 9 +- .../docx/LnStyleLstUnitDecorator@DOCX.tsf | 3 + .../decorator/docx/LnUnitDecorator@DOCX.tsf | 24 +- .../docx/LsdExceptionUnitDecorator@DOCX.tsf | 18 +- .../decorator/docx/LvlUnitDecorator@DOCX.tsf | 33 +- .../docx/MFontFontUnitDecorator@DOCX.tsf | 9 +- .../docx/MFontUnitDecorator@DOCX.tsf | 12 +- .../docx/MathPrUnitDecorator@DOCX.tsf | 36 +- .../docx/MiterUnitDecorator@DOCX.tsf | 6 +- .../docx/ModifiedUnitDecorator@DOCX.tsf | 6 +- .../docx/NumFmtUnitDecorator@DOCX.tsf | 9 +- .../docx/NumPrUnitDecorator@DOCX.tsf | 9 +- .../docx/NumRefUnitDecorator@DOCX.tsf | 7 +- .../decorator/docx/NumUnitDecorator@DOCX.tsf | 9 +- .../docx/NumberingUnitDecorator@DOCX.tsf | 108 ++- .../docx/NvPicPrUnitDecorator@DOCX.tsf | 9 +- .../docx/OuterShdwUnitDecorator@DOCX.tsf | 21 +- .../decorator/docx/PBdrUnitDecorator@DOCX.tsf | 9 +- .../docx/PBorderUnitDecorator@DOCX.tsf | 21 +- .../docx/PPrDefaultUnitDecorator@DOCX.tsf | 6 +- .../decorator/docx/PPrUnitDecorator@DOCX.tsf | 57 +- .../decorator/docx/PUnitDecorator@DOCX.tsf | 24 +- .../decorator/docx/PathUnitDecorator@DOCX.tsf | 9 +- .../docx/PgMarUnitDecorator@DOCX.tsf | 24 +- .../docx/PgNumTypeUnitDecorator@DOCX.tsf | 6 +- .../decorator/docx/PgSzUnitDecorator@DOCX.tsf | 14 +- .../docx/PicLocksUnitDecorator@DOCX.tsf | 6 +- .../decorator/docx/PicUnitDecorator@DOCX.tsf | 15 +- .../decorator/docx/PictUnitDecorator@DOCX.tsf | 9 +- .../docx/PlotAreaUnitDecorator@DOCX.tsf | 21 +- .../docx/PositionHUnitDecorator@DOCX.tsf | 9 +- .../docx/PositionVUnitDecorator@DOCX.tsf | 9 +- .../docx/PropertiesUnitDecorator@DOCX.tsf | 25 +- .../docx/PrstGeomUnitDecorator@DOCX.tsf | 9 +- .../docx/PrstTxWrapUnitDecorator@DOCX.tsf | 9 +- .../decorator/docx/PtUnitDecorator@DOCX.tsf | 7 +- .../docx/PureValUnitDecorator@DOCX.tsf | 6 +- .../docx/PureWValUnitDecorator@DOCX.tsf | 6 +- .../docx/RFontsUnitDecorator@DOCX.tsf | 27 +- .../docx/RPrDefaultUnitDecorator@DOCX.tsf | 6 +- .../decorator/docx/RPrUnitDecorator@DOCX.tsf | 51 +- .../decorator/docx/RUnitDecorator@DOCX.tsf | 44 +- .../docx/ReferenceUnitDecorator@DOCX.tsf | 9 +- .../docx/RelationshipUnitDecorator@DOCX.tsf | 12 +- .../docx/RelationshipsUnitDecorator@DOCX.tsf | 6 +- .../decorator/docx/RichUnitDecorator@DOCX.tsf | 9 +- .../docx/RsidsUnitDecorator@DOCX.tsf | 6 +- .../docx/ScalingUnitDecorator@DOCX.tsf | 6 +- .../docx/SchemeClrUnitDecorator@DOCX.tsf | 15 +- .../docx/SdtContentUnitDecorator@DOCX.tsf | 3 + .../docx/SdtEndPrUnitDecorator@DOCX.tsf | 6 +- .../docx/SdtPrUnitDecorator@DOCX.tsf | 12 +- .../decorator/docx/SdtUnitDecorator@DOCX.tsf | 12 +- .../docx/SectPrUnitDecorator@DOCX.tsf | 32 +- .../decorator/docx/SerUnitDecorator@DOCX.tsf | 27 +- .../docx/SettingsUnitDecorator@DOCX.tsf | 117 ++- .../docx/ShapeDefaults2UnitDecorator@DOCX.tsf | 9 +- .../docx/ShapeDefaultsUnitDecorator@DOCX.tsf | 9 +- .../docx/ShapeLayoutUnitDecorator@DOCX.tsf | 9 +- .../docx/ShapeUnitDecorator@DOCX.tsf | 24 +- .../docx/ShapetypeUnitDecorator@DOCX.tsf | 24 +- .../decorator/docx/ShdUnitDecorator@DOCX.tsf | 18 +- .../decorator/docx/SigUnitDecorator@DOCX.tsf | 21 +- .../docx/SizeRelHUnitDecorator@DOCX.tsf | 9 +- .../docx/SizeRelVUnitDecorator@DOCX.tsf | 9 +- .../docx/SolidFillUnitDecorator@DOCX.tsf | 6 +- .../docx/SpLocksUnitDecorator@DOCX.tsf | 6 +- .../decorator/docx/SpPrUnitDecorator@DOCX.tsf | 24 +- .../docx/SpacingUnitDecorator@DOCX.tsf | 27 +- .../docx/SrgbClrUnitDecorator@DOCX.tsf | 9 +- .../docx/StrRefUnitDecorator@DOCX.tsf | 7 +- .../docx/StretchUnitDecorator@DOCX.tsf | 6 +- .../docx/StrokeUnitDecorator@DOCX.tsf | 6 +- .../docx/StyleUnitDecorator@DOCX.tsf | 57 +- .../docx/StylesUnitDecorator@DOCX.tsf | 45 +- .../docx/SysClrUnitDecorator@DOCX.tsf | 9 +- .../decorator/docx/SzCsUnitDecorator@DOCX.tsf | 6 +- .../decorator/docx/SzUnitDecorator@DOCX.tsf | 6 +- .../decorator/docx/TUnitDecorator@DOCX.tsf | 6 +- .../decorator/docx/TabUnitDecorator@DOCX.tsf | 12 +- .../decorator/docx/TabsUnitDecorator@DOCX.tsf | 3 + .../docx/TblBorderUnitDecorator@DOCX.tsf | 21 +- .../docx/TblBordersUnitDecorator@DOCX.tsf | 21 +- .../docx/TblCellMarUnitDecorator@DOCX.tsf | 15 +- .../docx/TblGridUnitDecorator@DOCX.tsf | 3 + .../docx/TblIndUnitDecorator@DOCX.tsf | 9 +- .../docx/TblLayoutUnitDecorator@DOCX.tsf | 6 +- .../docx/TblLookUnitDecorator@DOCX.tsf | 24 +- .../docx/TblPrUnitDecorator@DOCX.tsf | 33 +- .../docx/TblStylePrUnitDecorator@DOCX.tsf | 18 +- .../decorator/docx/TblUnitDecorator@DOCX.tsf | 9 +- .../decorator/docx/TblWUnitDecorator@DOCX.tsf | 9 +- .../decorator/docx/TcPrUnitDecorator@DOCX.tsf | 18 +- .../decorator/docx/TcUnitDecorator@DOCX.tsf | 6 +- .../docx/TextboxUnitDecorator@DOCX.tsf | 6 +- .../docx/ThemeElementsUnitDecorator@DOCX.tsf | 15 +- .../docx/ThemeFamilyUnitDecorator@DOCX.tsf | 15 +- .../docx/ThemeFontLangUnitDecorator@DOCX.tsf | 9 +- .../docx/ThemeUnitDecorator@DOCX.tsf | 21 +- .../docx/TitleUnitDecorator@DOCX.tsf | 12 +- .../docx/TrHeightUnitDecorator@DOCX.tsf | 6 +- .../decorator/docx/TrPrUnitDecorator@DOCX.tsf | 18 +- .../decorator/docx/TrUnitDecorator@DOCX.tsf | 18 +- .../decorator/docx/TxPrUnitDecorator@DOCX.tsf | 9 +- .../decorator/docx/TxUnitDecorator@DOCX.tsf | 9 +- .../docx/TxbxContentUnitDecorator@DOCX.tsf | 3 + .../decorator/docx/TxbxUnitDecorator@DOCX.tsf | 6 +- .../docx/TypesUnitDecorator@DOCX.tsf | 5 + .../decorator/docx/ValUnitDecorator@DOCX.tsf | 6 +- .../docx/View3DUnitDecorator@DOCX.tsf | 12 +- .../docx/WebSettingsUnitDecorator@DOCX.tsf | 45 +- .../docx/WpsStyleUnitDecorator@DOCX.tsf | 15 +- .../decorator/docx/WspUnitDecorator@DOCX.tsf | 18 +- .../decorator/docx/XRefUnitDecorator@DOCX.tsf | 9 +- .../decorator/docx/XYUnitDecorator@DOCX.tsf | 9 +- .../decorator/docx/XfrmUnitDecorator@DOCX.tsf | 9 +- .../decorator/docx/ZoomUnitDecorator@DOCX.tsf | 6 +- .../docx/_InlineUnitDecorator@DOCX.tsf | 36 +- .../docx/_OverrideUnitDecorator@DOCX.tsf | 9 +- autoclass/docx/APPr@DOCX.tsf | 87 +-- autoclass/docx/AR@DOCX.tsf | 108 ++- autoclass/docx/ARPr@DOCX.tsf | 273 ++++--- autoclass/docx/AbstractNum@DOCX.tsf | 224 +++--- autoclass/docx/AlternateContent@DOCX.tsf | 123 ++- autoclass/docx/Anchor@DOCX.tsf | 444 +++++++---- autoclass/docx/Ap@DOCX.tsf | 152 ++-- autoclass/docx/Ax@DOCX.tsf | 423 ++++++---- autoclass/docx/BarChart@DOCX.tsf | 233 +++--- autoclass/docx/Blip@DOCX.tsf | 61 +- autoclass/docx/BlipFill@DOCX.tsf | 108 ++- autoclass/docx/Body@DOCX.tsf | 209 ++--- autoclass/docx/BodyPr@DOCX.tsf | 327 ++++---- autoclass/docx/Bookmark@DOCX.tsf | 61 +- autoclass/docx/Br@DOCX.tsf | 49 +- autoclass/docx/CNvGraphicFramePr@DOCX.tsf | 87 +-- autoclass/docx/CNvPicPr@DOCX.tsf | 87 +-- autoclass/docx/CNvPr@DOCX.tsf | 73 +- autoclass/docx/CNvSpPr@DOCX.tsf | 102 +-- autoclass/docx/CXY@DOCX.tsf | 63 +- autoclass/docx/Cache@DOCX.tsf | 154 ++-- autoclass/docx/Cat@DOCX.tsf | 87 +-- autoclass/docx/Chart@DOCX.tsf | 234 +++--- autoclass/docx/ChartSpace@DOCX.tsf | 231 +++--- autoclass/docx/Choice@DOCX.tsf | 135 ++-- autoclass/docx/Clr1@DOCX.tsf | 87 +-- autoclass/docx/Clr2@DOCX.tsf | 87 +-- autoclass/docx/ClrScheme@DOCX.tsf | 333 +++++--- autoclass/docx/ClrSchemeMapping@DOCX.tsf | 181 +++-- autoclass/docx/CnfStyle@DOCX.tsf | 193 +++-- autoclass/docx/Color@DOCX.tsf | 61 +- autoclass/docx/Cols@DOCX.tsf | 49 +- autoclass/docx/Comment@DOCX.tsf | 171 ++-- autoclass/docx/CommentRange@DOCX.tsf | 49 +- autoclass/docx/Comments@DOCX.tsf | 351 +++++---- autoclass/docx/Compat@DOCX.tsf | 408 +++++----- autoclass/docx/CompatSetting@DOCX.tsf | 73 +- autoclass/docx/CoreProperties@DOCX.tsf | 339 +++++--- autoclass/docx/Created@DOCX.tsf | 40 +- autoclass/docx/DLbls@DOCX.tsf | 255 +++--- autoclass/docx/DTable@DOCX.tsf | 171 ++-- autoclass/docx/Default@DOCX.tsf | 63 +- autoclass/docx/DocDefaults@DOCX.tsf | 108 ++- autoclass/docx/DocGrid@DOCX.tsf | 61 +- autoclass/docx/DocPartObj@DOCX.tsf | 108 ++- autoclass/docx/DocPr@DOCX.tsf | 73 +- autoclass/docx/Document@DOCX.tsf | 246 +++--- autoclass/docx/Drawing@DOCX.tsf | 108 ++- autoclass/docx/EffectExtent@DOCX.tsf | 85 +- autoclass/docx/EffectLst@DOCX.tsf | 87 +-- autoclass/docx/EffectStyle@DOCX.tsf | 87 +-- autoclass/docx/EffectStyleLst@DOCX.tsf | 108 +-- autoclass/docx/Endnote@DOCX.tsf | 159 ++-- autoclass/docx/EndnotePr@DOCX.tsf | 108 +-- autoclass/docx/Endnotes@DOCX.tsf | 531 +++++++------ autoclass/docx/Ext@DOCX.tsf | 135 ++-- autoclass/docx/ExtLst@DOCX.tsf | 108 +-- autoclass/docx/ExternalData@DOCX.tsf | 102 +-- autoclass/docx/Fallback@DOCX.tsf | 108 ++- autoclass/docx/FillStyleLst@DOCX.tsf | 147 +--- autoclass/docx/FldChar@DOCX.tsf | 61 +- autoclass/docx/FldSimple@DOCX.tsf | 147 ++-- autoclass/docx/FmtScheme@DOCX.tsf | 165 ++-- autoclass/docx/Font@DOCX.tsf | 207 ++--- autoclass/docx/FontScheme@DOCX.tsf | 123 ++- autoclass/docx/Fonts@DOCX.tsf | 279 ++++--- autoclass/docx/Footnote@DOCX.tsf | 159 ++-- autoclass/docx/FootnotePr@DOCX.tsf | 158 ++-- autoclass/docx/Footnotes@DOCX.tsf | 531 +++++++------ autoclass/docx/Ftr@DOCX.tsf | 315 ++++---- autoclass/docx/GradFill@DOCX.tsf | 123 ++- autoclass/docx/Graphic@DOCX.tsf | 104 +-- autoclass/docx/GraphicData@DOCX.tsf | 144 ++-- autoclass/docx/GraphicFrameLocks@DOCX.tsf | 63 +- autoclass/docx/GridCol@DOCX.tsf | 49 +- autoclass/docx/GridSpan@DOCX.tsf | 49 +- autoclass/docx/Gs@DOCX.tsf | 102 +-- autoclass/docx/GsLst@DOCX.tsf | 108 +-- autoclass/docx/Hdr@DOCX.tsf | 315 ++++---- autoclass/docx/HdrShapeDefaults@DOCX.tsf | 87 +-- autoclass/docx/HyperLink@DOCX.tsf | 171 ++-- autoclass/docx/IdMap@DOCX.tsf | 61 +- autoclass/docx/Ind@DOCX.tsf | 133 ++-- autoclass/docx/InstrText@DOCX.tsf | 40 +- autoclass/docx/Lang@DOCX.tsf | 73 +- autoclass/docx/LatenStyles@DOCX.tsf | 207 +++-- autoclass/docx/Latin@DOCX.tsf | 61 +- autoclass/docx/Legend@DOCX.tsf | 152 ++-- autoclass/docx/Lin@DOCX.tsf | 61 +- autoclass/docx/Ln@DOCX.tsf | 180 +++-- autoclass/docx/LnStyleLst@DOCX.tsf | 108 +-- autoclass/docx/LsdException@DOCX.tsf | 97 +-- autoclass/docx/Lvl@DOCX.tsf | 261 ++++--- autoclass/docx/MFont@DOCX.tsf | 173 ++-- autoclass/docx/MFontFont@DOCX.tsf | 61 +- autoclass/docx/MathPr@DOCX.tsf | 299 ++++--- autoclass/docx/Miter@DOCX.tsf | 49 +- autoclass/docx/Modified@DOCX.tsf | 40 +- autoclass/docx/Num@DOCX.tsf | 102 +-- autoclass/docx/NumFmt@DOCX.tsf | 61 +- autoclass/docx/NumPr@DOCX.tsf | 108 ++- autoclass/docx/NumRef@DOCX.tsf | 110 ++- autoclass/docx/Numbering@DOCX.tsf | 622 ++++++++------- autoclass/docx/NvPicPr@DOCX.tsf | 108 ++- autoclass/docx/OuterShdw@DOCX.tsf | 150 ++-- autoclass/docx/P@DOCX.tsf | 632 +++++++-------- autoclass/docx/PBdr@DOCX.tsf | 108 ++- autoclass/docx/PBorder@DOCX.tsf | 109 +-- autoclass/docx/PPr@DOCX.tsf | 443 +++++++---- autoclass/docx/PPrDefault@DOCX.tsf | 87 +-- autoclass/docx/Path@DOCX.tsf | 61 +- autoclass/docx/PgMar@DOCX.tsf | 121 +-- autoclass/docx/PgNumType@DOCX.tsf | 49 +- autoclass/docx/PgSz@DOCX.tsf | 95 ++- autoclass/docx/Pic@DOCX.tsf | 144 ++-- autoclass/docx/PicLocks@DOCX.tsf | 49 +- autoclass/docx/Pict@DOCX.tsf | 108 ++- autoclass/docx/PlotArea@DOCX.tsf | 194 +++-- autoclass/docx/PositionH@DOCX.tsf | 102 +-- autoclass/docx/PositionV@DOCX.tsf | 102 +-- autoclass/docx/Properties@DOCX.tsf | 431 ++++++---- autoclass/docx/PrstGeom@DOCX.tsf | 102 +-- autoclass/docx/PrstTxWrap@DOCX.tsf | 100 +-- autoclass/docx/Pt@DOCX.tsf | 102 +-- autoclass/docx/PureVal@DOCX.tsf | 51 +- autoclass/docx/PureWVal@DOCX.tsf | 51 +- autoclass/docx/R@DOCX.tsf | 329 +++++--- autoclass/docx/RFonts@DOCX.tsf | 133 ++-- autoclass/docx/RPr@DOCX.tsf | 399 ++++++---- autoclass/docx/RPrDefault@DOCX.tsf | 87 +-- autoclass/docx/Reference@DOCX.tsf | 61 +- autoclass/docx/Relationship@DOCX.tsf | 75 +- autoclass/docx/Relationships@DOCX.tsf | 149 ++-- autoclass/docx/Rich@DOCX.tsf | 172 ++-- autoclass/docx/Rsids@DOCX.tsf | 131 +--- autoclass/docx/Scaling@DOCX.tsf | 87 +-- autoclass/docx/SchemeClr@DOCX.tsf | 144 ++-- autoclass/docx/Sdt@DOCX.tsf | 129 ++- autoclass/docx/SdtContent@DOCX.tsf | 108 +-- autoclass/docx/SdtEndPr@DOCX.tsf | 87 +-- autoclass/docx/SdtPr@DOCX.tsf | 129 ++- autoclass/docx/SectPr@DOCX.tsf | 391 +++++----- autoclass/docx/Ser@DOCX.tsf | 234 +++--- autoclass/docx/Settings@DOCX.tsf | 737 ++++++++++++------ autoclass/docx/Shape@DOCX.tsf | 162 ++-- autoclass/docx/ShapeDefaults2@DOCX.tsf | 108 ++- autoclass/docx/ShapeDefaults@DOCX.tsf | 61 +- autoclass/docx/ShapeLayout@DOCX.tsf | 102 +-- autoclass/docx/Shapetype@DOCX.tsf | 171 ++-- autoclass/docx/Shd@DOCX.tsf | 97 +-- autoclass/docx/Sig@DOCX.tsf | 109 +-- autoclass/docx/SizeRelH@DOCX.tsf | 102 +-- autoclass/docx/SizeRelV@DOCX.tsf | 102 +-- autoclass/docx/SolidFill@DOCX.tsf | 87 +-- autoclass/docx/SpLocks@DOCX.tsf | 49 +- autoclass/docx/SpPr@DOCX.tsf | 207 ++--- autoclass/docx/Spacing@DOCX.tsf | 133 ++-- autoclass/docx/SrgbClr@DOCX.tsf | 102 +-- autoclass/docx/StrRef@DOCX.tsf | 110 ++- autoclass/docx/Stretch@DOCX.tsf | 87 +-- autoclass/docx/Stroke@DOCX.tsf | 49 +- autoclass/docx/Style@DOCX.tsf | 485 +++++++----- autoclass/docx/Styles@DOCX.tsf | 323 ++++---- autoclass/docx/SysClr@DOCX.tsf | 61 +- autoclass/docx/Sz@DOCX.tsf | 49 +- autoclass/docx/SzCs@DOCX.tsf | 49 +- autoclass/docx/T@DOCX.tsf | 40 +- autoclass/docx/Tab@DOCX.tsf | 73 +- autoclass/docx/Tabs@DOCX.tsf | 108 +-- autoclass/docx/Tbl@DOCX.tsf | 152 ++-- autoclass/docx/TblBorder@DOCX.tsf | 109 +-- autoclass/docx/TblBorders@DOCX.tsf | 192 +++-- autoclass/docx/TblCellMar@DOCX.tsf | 150 ++-- autoclass/docx/TblGrid@DOCX.tsf | 108 +-- autoclass/docx/TblInd@DOCX.tsf | 61 +- autoclass/docx/TblLayout@DOCX.tsf | 49 +- autoclass/docx/TblLook@DOCX.tsf | 121 +-- autoclass/docx/TblPr@DOCX.tsf | 276 ++++--- autoclass/docx/TblStylePr@DOCX.tsf | 165 ++-- autoclass/docx/TblW@DOCX.tsf | 61 +- autoclass/docx/Tc@DOCX.tsf | 170 ++-- autoclass/docx/TcPr@DOCX.tsf | 173 ++-- autoclass/docx/Textbox@DOCX.tsf | 87 +-- autoclass/docx/Theme@DOCX.tsf | 176 +++-- autoclass/docx/ThemeElements@DOCX.tsf | 144 ++-- autoclass/docx/ThemeFamily@DOCX.tsf | 85 +- autoclass/docx/ThemeFontLang@DOCX.tsf | 61 +- autoclass/docx/Title@DOCX.tsf | 131 ++-- autoclass/docx/Tr@DOCX.tsf | 206 +++-- autoclass/docx/TrHeight@DOCX.tsf | 49 +- autoclass/docx/TrPr@DOCX.tsf | 173 ++-- autoclass/docx/Tx@DOCX.tsf | 108 ++- autoclass/docx/TxPr@DOCX.tsf | 172 ++-- autoclass/docx/Txbx@DOCX.tsf | 87 +-- autoclass/docx/TxbxContent@DOCX.tsf | 108 +-- autoclass/docx/Types@DOCX.tsf | 195 ++--- autoclass/docx/Val@DOCX.tsf | 87 +-- autoclass/docx/View3D@DOCX.tsf | 129 ++- autoclass/docx/WebSettings@DOCX.tsf | 252 +++--- autoclass/docx/WpsStyle@DOCX.tsf | 150 ++-- autoclass/docx/Wsp@DOCX.tsf | 171 ++-- autoclass/docx/XRef@DOCX.tsf | 102 +-- autoclass/docx/XY@DOCX.tsf | 63 +- autoclass/docx/Xfrm@DOCX.tsf | 108 ++- autoclass/docx/Zoom@DOCX.tsf | 49 +- autoclass/docx/_Inline@DOCX.tsf | 246 +++--- autoclass/docx/_Override@DOCX.tsf | 63 +- cp.ps1 | 14 +- docx/Components@DOCX.tsf | 6 +- openxml/OpenXmlElement.tsf | 176 ++--- openxml/OpenXmlEmpty.tsf | 51 +- openxml/OpenXmlPcdata.tsf | 15 +- utils/TSOfficeContainer.tsf | 223 ++++++ 424 files changed, 18472 insertions(+), 16812 deletions(-) create mode 100644 autoclass/adapter/docx/EndnotePrAdapter@DOCX.tsf create mode 100644 autoclass/adapter/docx/EndnotesAdapter@DOCX.tsf create mode 100644 autoclass/adapter/docx/FootnotePrAdapter@DOCX.tsf create mode 100644 autoclass/adapter/docx/FootnotesAdapter@DOCX.tsf create mode 100644 utils/TSOfficeContainer.tsf diff --git a/autoclass/adapter/docx/EndnotePrAdapter@DOCX.tsf b/autoclass/adapter/docx/EndnotePrAdapter@DOCX.tsf new file mode 100644 index 0000000..fb82082 --- /dev/null +++ b/autoclass/adapter/docx/EndnotePrAdapter@DOCX.tsf @@ -0,0 +1,36 @@ +type EndnotePrAdapter = class +public + function Create(_obj: EndnotePr); + function Init(); + + function GetEndnoteById(_key: string); + function SetEndnoteById(_key: string; _value: tslobj); + +private + object_: EndnotePr; + endnote_hash_: tableArray; +end; + +function EndnotePrAdapter.Create(_obj: EndnotePr); +begin + object_ := _obj; + endnote_hash_ := array(); + {self.}Init(); +end; + +function EndnotePrAdapter.Init(); +begin + elements := object_.Endnotes(); + for k,v in elements do + endnote_hash_[v.Id] := v; +end; + +function EndnotePrAdapter.GetEndnoteById(_key: string); +begin + return endnote_hash_[_key]; +end; + +function EndnotePrAdapter.SetEndnoteById(_key: string; _value: tslobj); +begin + endnote_hash_[_key] := _value; +end; diff --git a/autoclass/adapter/docx/EndnotesAdapter@DOCX.tsf b/autoclass/adapter/docx/EndnotesAdapter@DOCX.tsf new file mode 100644 index 0000000..519d0ce --- /dev/null +++ b/autoclass/adapter/docx/EndnotesAdapter@DOCX.tsf @@ -0,0 +1,36 @@ +type EndnotesAdapter = class +public + function Create(_obj: Endnotes); + function Init(); + + function GetEndnoteById(_key: string); + function SetEndnoteById(_key: string; _value: tslobj); + +private + object_: Endnotes; + endnote_hash_: tableArray; +end; + +function EndnotesAdapter.Create(_obj: Endnotes); +begin + object_ := _obj; + endnote_hash_ := array(); + {self.}Init(); +end; + +function EndnotesAdapter.Init(); +begin + elements := object_.Endnotes(); + for k,v in elements do + endnote_hash_[v.Id] := v; +end; + +function EndnotesAdapter.GetEndnoteById(_key: string); +begin + return endnote_hash_[_key]; +end; + +function EndnotesAdapter.SetEndnoteById(_key: string; _value: tslobj); +begin + endnote_hash_[_key] := _value; +end; diff --git a/autoclass/adapter/docx/FootnotePrAdapter@DOCX.tsf b/autoclass/adapter/docx/FootnotePrAdapter@DOCX.tsf new file mode 100644 index 0000000..4f61cd1 --- /dev/null +++ b/autoclass/adapter/docx/FootnotePrAdapter@DOCX.tsf @@ -0,0 +1,36 @@ +type FootnotePrAdapter = class +public + function Create(_obj: FootnotePr); + function Init(); + + function GetFootnoteById(_key: string); + function SetFootnoteById(_key: string; _value: tslobj); + +private + object_: FootnotePr; + footnote_hash_: tableArray; +end; + +function FootnotePrAdapter.Create(_obj: FootnotePr); +begin + object_ := _obj; + footnote_hash_ := array(); + {self.}Init(); +end; + +function FootnotePrAdapter.Init(); +begin + elements := object_.Footnotes(); + for k,v in elements do + footnote_hash_[v.Id] := v; +end; + +function FootnotePrAdapter.GetFootnoteById(_key: string); +begin + return footnote_hash_[_key]; +end; + +function FootnotePrAdapter.SetFootnoteById(_key: string; _value: tslobj); +begin + footnote_hash_[_key] := _value; +end; diff --git a/autoclass/adapter/docx/FootnotesAdapter@DOCX.tsf b/autoclass/adapter/docx/FootnotesAdapter@DOCX.tsf new file mode 100644 index 0000000..3bd2366 --- /dev/null +++ b/autoclass/adapter/docx/FootnotesAdapter@DOCX.tsf @@ -0,0 +1,36 @@ +type FootnotesAdapter = class +public + function Create(_obj: Footnotes); + function Init(); + + function GetFootnoteById(_key: string); + function SetFootnoteById(_key: string; _value: tslobj); + +private + object_: Footnotes; + footnote_hash_: tableArray; +end; + +function FootnotesAdapter.Create(_obj: Footnotes); +begin + object_ := _obj; + footnote_hash_ := array(); + {self.}Init(); +end; + +function FootnotesAdapter.Init(); +begin + elements := object_.Footnotes(); + for k,v in elements do + footnote_hash_[v.Id] := v; +end; + +function FootnotesAdapter.GetFootnoteById(_key: string); +begin + return footnote_hash_[_key]; +end; + +function FootnotesAdapter.SetFootnoteById(_key: string; _value: tslobj); +begin + footnote_hash_[_key] := _value; +end; diff --git a/autoclass/decorator/docx/APPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/APPrUnitDecorator@DOCX.tsf index 669e394..f05a8db 100644 --- a/autoclass/decorator/docx/APPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/APPrUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function APPrUnitDecorator.Convert(); begin - {self.}DefRPr := new ARPrUnitDecorator(object_.DefRPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildDefRPr) then + {self.}XmlChildDefRPr := new ARPrUnitDecorator(object_.XmlChildDefRPr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ARPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ARPrUnitDecorator@DOCX.tsf index 57424b0..b52ed79 100644 --- a/autoclass/decorator/docx/ARPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ARPrUnitDecorator@DOCX.tsf @@ -22,18 +22,35 @@ end; function ARPrUnitDecorator.Convert(); begin - {self.}XmlAttrLang.Value := object_.XmlAttrLang.Value; - {self.}XmlAttrAltLang.Value := object_.XmlAttrAltLang.Value; - {self.}XmlAttrB.Value := object_.XmlAttrB.Value; - {self.}XmlAttrBaseline.Value := object_.XmlAttrBaseline.Value; - {self.}XmlAttrI.Value := object_.XmlAttrI.Value; - {self.}XmlAttrKern.Value := object_.XmlAttrKern.Value; - {self.}XmlAttrSpc.Value := object_.XmlAttrSpc.Value; - {self.}XmlAttrStrike.Value := object_.XmlAttrStrike.Value; - {self.}XmlAttrSz.Value := object_.XmlAttrSz.Value; - {self.}XmlAttrU.Value := object_.XmlAttrU.Value; - {self.}SolidFill := new SolidFillUnitDecorator(object_.SolidFill); - {self.}Latin := new LatinUnitDecorator(object_.Latin); - {self.}Ea := new LatinUnitDecorator(object_.Ea); - {self.}Cs := new LatinUnitDecorator(object_.Cs); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrLang) then + {self.}Lang := object_.XmlAttrLang.Value; + if not ifnil(object_.XmlAttrAltLang) then + {self.}AltLang := object_.XmlAttrAltLang.Value; + if not ifnil(object_.XmlAttrB) then + {self.}B := object_.XmlAttrB.Value; + if not ifnil(object_.XmlAttrBaseline) then + {self.}Baseline := object_.XmlAttrBaseline.Value; + if not ifnil(object_.XmlAttrI) then + {self.}I := object_.XmlAttrI.Value; + if not ifnil(object_.XmlAttrKern) then + {self.}Kern := object_.XmlAttrKern.Value; + if not ifnil(object_.XmlAttrSpc) then + {self.}Spc := object_.XmlAttrSpc.Value; + if not ifnil(object_.XmlAttrStrike) then + {self.}Strike := object_.XmlAttrStrike.Value; + if not ifnil(object_.XmlAttrSz) then + {self.}Sz := object_.XmlAttrSz.Value; + if not ifnil(object_.XmlAttrU) then + {self.}U := object_.XmlAttrU.Value; + if not ifnil(object_.XmlChildSolidFill) then + {self.}XmlChildSolidFill := new SolidFillUnitDecorator(object_.XmlChildSolidFill); + if not ifnil(object_.XmlChildLatin) then + {self.}XmlChildLatin := new LatinUnitDecorator(object_.XmlChildLatin); + if not ifnil(object_.XmlChildEa) then + {self.}XmlChildEa := new LatinUnitDecorator(object_.XmlChildEa); + if not ifnil(object_.XmlChildCs) then + {self.}XmlChildCs := new LatinUnitDecorator(object_.XmlChildCs); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ARUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ARUnitDecorator@DOCX.tsf index 47c2dad..760bc70 100644 --- a/autoclass/decorator/docx/ARUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ARUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function ARUnitDecorator.Convert(); begin - {self.}RPr := new ARPrUnitDecorator(object_.RPr); - {self.}T := new TUnitDecorator(object_.T); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildRPr) then + {self.}XmlChildRPr := new ARPrUnitDecorator(object_.XmlChildRPr); + if not ifnil(object_.XmlChildT) then + {self.}XmlChildT := new TUnitDecorator(object_.XmlChildT); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/AbstractNumUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/AbstractNumUnitDecorator@DOCX.tsf index 7a8e467..30f2127 100644 --- a/autoclass/decorator/docx/AbstractNumUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/AbstractNumUnitDecorator@DOCX.tsf @@ -22,9 +22,17 @@ end; function AbstractNumUnitDecorator.Convert(); begin - {self.}XmlAttrAbstractNumId.Value := object_.XmlAttrAbstractNumId.Value; - {self.}XmlAttrRestartNumberingAfterBreak.Value := object_.XmlAttrRestartNumberingAfterBreak.Value; - {self.}Nsid := new PureWValUnitDecorator(object_.Nsid); - {self.}MultiLevelType := new PureWValUnitDecorator(object_.MultiLevelType); - {self.}Tmpl := new PureWValUnitDecorator(object_.Tmpl); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrAbstractNumId) then + {self.}AbstractNumId := object_.XmlAttrAbstractNumId.Value; + if not ifnil(object_.XmlAttrRestartNumberingAfterBreak) then + {self.}RestartNumberingAfterBreak := object_.XmlAttrRestartNumberingAfterBreak.Value; + if not ifnil(object_.XmlChildNsid) then + {self.}XmlChildNsid := new PureWValUnitDecorator(object_.XmlChildNsid); + if not ifnil(object_.XmlChildMultiLevelType) then + {self.}XmlChildMultiLevelType := new PureWValUnitDecorator(object_.XmlChildMultiLevelType); + if not ifnil(object_.XmlChildTmpl) then + {self.}XmlChildTmpl := new PureWValUnitDecorator(object_.XmlChildTmpl); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/AlternateContentUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/AlternateContentUnitDecorator@DOCX.tsf index ff553e9..b141bd0 100644 --- a/autoclass/decorator/docx/AlternateContentUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/AlternateContentUnitDecorator@DOCX.tsf @@ -22,7 +22,13 @@ end; function AlternateContentUnitDecorator.Convert(); begin - {self.}XmlAttrXmlnsMc.Value := object_.XmlAttrXmlnsMc.Value; - {self.}Choice := new ChoiceUnitDecorator(object_.Choice); - {self.}Fallback := new FallbackUnitDecorator(object_.Fallback); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXmlnsMc) then + {self.}XmlnsMc := object_.XmlAttrXmlnsMc.Value; + if not ifnil(object_.XmlChildChoice) then + {self.}XmlChildChoice := new ChoiceUnitDecorator(object_.XmlChildChoice); + if not ifnil(object_.XmlChildFallback) then + {self.}XmlChildFallback := new FallbackUnitDecorator(object_.XmlChildFallback); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/AnchorUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/AnchorUnitDecorator@DOCX.tsf index fcdcd4b..21d347b 100644 --- a/autoclass/decorator/docx/AnchorUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/AnchorUnitDecorator@DOCX.tsf @@ -22,27 +22,53 @@ end; function AnchorUnitDecorator.Convert(); begin - {self.}XmlAttrDistT.Value := object_.XmlAttrDistT.Value; - {self.}XmlAttrDistB.Value := object_.XmlAttrDistB.Value; - {self.}XmlAttrDistL.Value := object_.XmlAttrDistL.Value; - {self.}XmlAttrDistR.Value := object_.XmlAttrDistR.Value; - {self.}XmlAttrSimplePos.Value := object_.XmlAttrSimplePos.Value; - {self.}XmlAttrRelativeHeight.Value := object_.XmlAttrRelativeHeight.Value; - {self.}XmlAttrBehindDoc.Value := object_.XmlAttrBehindDoc.Value; - {self.}XmlAttrLocked.Value := object_.XmlAttrLocked.Value; - {self.}XmlAttrLayoutInCell.Value := object_.XmlAttrLayoutInCell.Value; - {self.}XmlAttrAllowOverlap.Value := object_.XmlAttrAllowOverlap.Value; - {self.}XmlAttrAnchorId.Value := object_.XmlAttrAnchorId.Value; - {self.}XmlAttrEditId.Value := object_.XmlAttrEditId.Value; - {self.}SimplePos := new XYUnitDecorator(object_.SimplePos); - {self.}PositionH := new PositionHUnitDecorator(object_.PositionH); - {self.}PositionV := new PositionVUnitDecorator(object_.PositionV); - {self.}Extent := new CXYUnitDecorator(object_.Extent); - {self.}EffectExtent := new EffectExtentUnitDecorator(object_.EffectExtent); - if not ifnil(object_.XmlChildWrapNone.Value) then {self.}XmlChildWrapNone.Value := object_.XmlChildWrapNone.Value; - {self.}DocPr := new DocPrUnitDecorator(object_.DocPr); - {self.}CNvGraphicFramePr := new CNvGraphicFramePrUnitDecorator(object_.CNvGraphicFramePr); - {self.}Graphic := new GraphicUnitDecorator(object_.Graphic); - {self.}SizeRelH := new SizeRelHUnitDecorator(object_.SizeRelH); - {self.}SizeRelV := new SizeRelVUnitDecorator(object_.SizeRelV); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrDistT) then + {self.}DistT := object_.XmlAttrDistT.Value; + if not ifnil(object_.XmlAttrDistB) then + {self.}DistB := object_.XmlAttrDistB.Value; + if not ifnil(object_.XmlAttrDistL) then + {self.}DistL := object_.XmlAttrDistL.Value; + if not ifnil(object_.XmlAttrDistR) then + {self.}DistR := object_.XmlAttrDistR.Value; + if not ifnil(object_.XmlAttrSimplePos) then + {self.}SimplePos := object_.XmlAttrSimplePos.Value; + if not ifnil(object_.XmlAttrRelativeHeight) then + {self.}RelativeHeight := object_.XmlAttrRelativeHeight.Value; + if not ifnil(object_.XmlAttrBehindDoc) then + {self.}BehindDoc := object_.XmlAttrBehindDoc.Value; + if not ifnil(object_.XmlAttrLocked) then + {self.}Locked := object_.XmlAttrLocked.Value; + if not ifnil(object_.XmlAttrLayoutInCell) then + {self.}LayoutInCell := object_.XmlAttrLayoutInCell.Value; + if not ifnil(object_.XmlAttrAllowOverlap) then + {self.}AllowOverlap := object_.XmlAttrAllowOverlap.Value; + if not ifnil(object_.XmlAttrAnchorId) then + {self.}AnchorId := object_.XmlAttrAnchorId.Value; + if not ifnil(object_.XmlAttrEditId) then + {self.}EditId := object_.XmlAttrEditId.Value; + if not ifnil(object_.XmlChildSimplePos) then + {self.}XmlChildSimplePos := new XYUnitDecorator(object_.XmlChildSimplePos); + if not ifnil(object_.XmlChildPositionH) then + {self.}XmlChildPositionH := new PositionHUnitDecorator(object_.XmlChildPositionH); + if not ifnil(object_.XmlChildPositionV) then + {self.}XmlChildPositionV := new PositionVUnitDecorator(object_.XmlChildPositionV); + if not ifnil(object_.XmlChildExtent) then + {self.}XmlChildExtent := new CXYUnitDecorator(object_.XmlChildExtent); + if not ifnil(object_.XmlChildEffectExtent) then + {self.}XmlChildEffectExtent := new EffectExtentUnitDecorator(object_.XmlChildEffectExtent); + if not ifnil(object_.XmlChildWrapNone) then + {self.}WrapNone.Copy(object_.XmlChildWrapNone); + if not ifnil(object_.XmlChildDocPr) then + {self.}XmlChildDocPr := new DocPrUnitDecorator(object_.XmlChildDocPr); + if not ifnil(object_.XmlChildCNvGraphicFramePr) then + {self.}XmlChildCNvGraphicFramePr := new CNvGraphicFramePrUnitDecorator(object_.XmlChildCNvGraphicFramePr); + if not ifnil(object_.XmlChildGraphic) then + {self.}XmlChildGraphic := new GraphicUnitDecorator(object_.XmlChildGraphic); + if not ifnil(object_.XmlChildSizeRelH) then + {self.}XmlChildSizeRelH := new SizeRelHUnitDecorator(object_.XmlChildSizeRelH); + if not ifnil(object_.XmlChildSizeRelV) then + {self.}XmlChildSizeRelV := new SizeRelVUnitDecorator(object_.XmlChildSizeRelV); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ApUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ApUnitDecorator@DOCX.tsf index 1389af0..0e3efe0 100644 --- a/autoclass/decorator/docx/ApUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ApUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function ApUnitDecorator.Convert(); begin - {self.}PPr := new APPrUnitDecorator(object_.PPr); - {self.}EndParaRPr := new ARPrUnitDecorator(object_.EndParaRPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildPPr) then + {self.}XmlChildPPr := new APPrUnitDecorator(object_.XmlChildPPr); + if not ifnil(object_.XmlChildEndParaRPr) then + {self.}XmlChildEndParaRPr := new ARPrUnitDecorator(object_.XmlChildEndParaRPr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/AxUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/AxUnitDecorator@DOCX.tsf index 7ad5b1c..9b0c2cb 100644 --- a/autoclass/decorator/docx/AxUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/AxUnitDecorator@DOCX.tsf @@ -22,21 +22,41 @@ end; function AxUnitDecorator.Convert(); begin - {self.}AxId := new PureValUnitDecorator(object_.AxId); - {self.}Scaling := new ScalingUnitDecorator(object_.Scaling); - {self.}_Delete := new PureValUnitDecorator(object_._Delete); - {self.}AxPos := new PureValUnitDecorator(object_.AxPos); - {self.}NumFmt := new NumFmtUnitDecorator(object_.NumFmt); - {self.}MajorTickMark := new PureValUnitDecorator(object_.MajorTickMark); - {self.}MinorTickMark := new PureValUnitDecorator(object_.MinorTickMark); - {self.}TickLblPos := new PureValUnitDecorator(object_.TickLblPos); - {self.}SpPr := new SpPrUnitDecorator(object_.SpPr); - {self.}TxPr := new TxPrUnitDecorator(object_.TxPr); - {self.}CrossAx := new PureValUnitDecorator(object_.CrossAx); - {self.}Crosses := new PureValUnitDecorator(object_.Crosses); - {self.}CrossBetween := new PureValUnitDecorator(object_.CrossBetween); - {self.}Auto := new PureValUnitDecorator(object_.Auto); - {self.}LblAlgn := new PureValUnitDecorator(object_.LblAlgn); - {self.}LblOffset := new PureValUnitDecorator(object_.LblOffset); - {self.}NoMultiLvlLbl := new PureValUnitDecorator(object_.NoMultiLvlLbl); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildAxId) then + {self.}XmlChildAxId := new PureValUnitDecorator(object_.XmlChildAxId); + if not ifnil(object_.XmlChildScaling) then + {self.}XmlChildScaling := new ScalingUnitDecorator(object_.XmlChildScaling); + if not ifnil(object_.XmlChild_Delete) then + {self.}XmlChild_Delete := new PureValUnitDecorator(object_.XmlChild_Delete); + if not ifnil(object_.XmlChildAxPos) then + {self.}XmlChildAxPos := new PureValUnitDecorator(object_.XmlChildAxPos); + if not ifnil(object_.XmlChildNumFmt) then + {self.}XmlChildNumFmt := new NumFmtUnitDecorator(object_.XmlChildNumFmt); + if not ifnil(object_.XmlChildMajorTickMark) then + {self.}XmlChildMajorTickMark := new PureValUnitDecorator(object_.XmlChildMajorTickMark); + if not ifnil(object_.XmlChildMinorTickMark) then + {self.}XmlChildMinorTickMark := new PureValUnitDecorator(object_.XmlChildMinorTickMark); + if not ifnil(object_.XmlChildTickLblPos) then + {self.}XmlChildTickLblPos := new PureValUnitDecorator(object_.XmlChildTickLblPos); + if not ifnil(object_.XmlChildSpPr) then + {self.}XmlChildSpPr := new SpPrUnitDecorator(object_.XmlChildSpPr); + if not ifnil(object_.XmlChildTxPr) then + {self.}XmlChildTxPr := new TxPrUnitDecorator(object_.XmlChildTxPr); + if not ifnil(object_.XmlChildCrossAx) then + {self.}XmlChildCrossAx := new PureValUnitDecorator(object_.XmlChildCrossAx); + if not ifnil(object_.XmlChildCrosses) then + {self.}XmlChildCrosses := new PureValUnitDecorator(object_.XmlChildCrosses); + if not ifnil(object_.XmlChildCrossBetween) then + {self.}XmlChildCrossBetween := new PureValUnitDecorator(object_.XmlChildCrossBetween); + if not ifnil(object_.XmlChildAuto) then + {self.}XmlChildAuto := new PureValUnitDecorator(object_.XmlChildAuto); + if not ifnil(object_.XmlChildLblAlgn) then + {self.}XmlChildLblAlgn := new PureValUnitDecorator(object_.XmlChildLblAlgn); + if not ifnil(object_.XmlChildLblOffset) then + {self.}XmlChildLblOffset := new PureValUnitDecorator(object_.XmlChildLblOffset); + if not ifnil(object_.XmlChildNoMultiLvlLbl) then + {self.}XmlChildNoMultiLvlLbl := new PureValUnitDecorator(object_.XmlChildNoMultiLvlLbl); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/BarChartUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/BarChartUnitDecorator@DOCX.tsf index 12495f6..8d7f9ef 100644 --- a/autoclass/decorator/docx/BarChartUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/BarChartUnitDecorator@DOCX.tsf @@ -22,8 +22,15 @@ end; function BarChartUnitDecorator.Convert(); begin - {self.}BarDir := new PureValUnitDecorator(object_.BarDir); - {self.}Grouping := new PureValUnitDecorator(object_.Grouping); - {self.}VaryColors := new PureValUnitDecorator(object_.VaryColors); - {self.}GapWidth := new PureValUnitDecorator(object_.GapWidth); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildBarDir) then + {self.}XmlChildBarDir := new PureValUnitDecorator(object_.XmlChildBarDir); + if not ifnil(object_.XmlChildGrouping) then + {self.}XmlChildGrouping := new PureValUnitDecorator(object_.XmlChildGrouping); + if not ifnil(object_.XmlChildVaryColors) then + {self.}XmlChildVaryColors := new PureValUnitDecorator(object_.XmlChildVaryColors); + if not ifnil(object_.XmlChildGapWidth) then + {self.}XmlChildGapWidth := new PureValUnitDecorator(object_.XmlChildGapWidth); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/BlipFillUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/BlipFillUnitDecorator@DOCX.tsf index 14bca34..86cab4a 100644 --- a/autoclass/decorator/docx/BlipFillUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/BlipFillUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function BlipFillUnitDecorator.Convert(); begin - {self.}Blip := new BlipUnitDecorator(object_.Blip); - {self.}Stretch := new StretchUnitDecorator(object_.Stretch); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildBlip) then + {self.}XmlChildBlip := new BlipUnitDecorator(object_.XmlChildBlip); + if not ifnil(object_.XmlChildStretch) then + {self.}XmlChildStretch := new StretchUnitDecorator(object_.XmlChildStretch); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/BlipUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/BlipUnitDecorator@DOCX.tsf index e4f6195..8dcfc78 100644 --- a/autoclass/decorator/docx/BlipUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/BlipUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function BlipUnitDecorator.Convert(); begin - {self.}XmlAttrEmbed.Value := object_.XmlAttrEmbed.Value; - {self.}XmlAttrCstate.Value := object_.XmlAttrCstate.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrEmbed) then + {self.}Embed := object_.XmlAttrEmbed.Value; + if not ifnil(object_.XmlAttrCstate) then + {self.}Cstate := object_.XmlAttrCstate.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/BodyPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/BodyPrUnitDecorator@DOCX.tsf index f0e411e..d988658 100644 --- a/autoclass/decorator/docx/BodyPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/BodyPrUnitDecorator@DOCX.tsf @@ -22,24 +22,47 @@ end; function BodyPrUnitDecorator.Convert(); begin - {self.}XmlAttrRot.Value := object_.XmlAttrRot.Value; - {self.}XmlAttrSpcFirstLastPara.Value := object_.XmlAttrSpcFirstLastPara.Value; - {self.}XmlAttrVertOverflow.Value := object_.XmlAttrVertOverflow.Value; - {self.}XmlAttrHorzOverflow.Value := object_.XmlAttrHorzOverflow.Value; - {self.}XmlAttrVert.Value := object_.XmlAttrVert.Value; - {self.}XmlAttrWrap.Value := object_.XmlAttrWrap.Value; - {self.}XmlAttrLIns.Value := TSSafeUnitConverter.EmusToPoints(object_.XmlAttrLIns.Value); - {self.}XmlAttrTIns.Value := TSSafeUnitConverter.EmusToPoints(object_.XmlAttrTIns.Value); - {self.}XmlAttrRIns.Value := TSSafeUnitConverter.EmusToPoints(object_.XmlAttrRIns.Value); - {self.}XmlAttrBIns.Value := TSSafeUnitConverter.EmusToPoints(object_.XmlAttrBIns.Value); - {self.}XmlAttrNumCol.Value := object_.XmlAttrNumCol.Value; - {self.}XmlAttrSpcCol.Value := object_.XmlAttrSpcCol.Value; - {self.}XmlAttrRtlCol.Value := object_.XmlAttrRtlCol.Value; - {self.}XmlAttrFromWordArt.Value := object_.XmlAttrFromWordArt.Value; - {self.}XmlAttrAnchor.Value := object_.XmlAttrAnchor.Value; - {self.}XmlAttrAnchorCtr.Value := object_.XmlAttrAnchorCtr.Value; - {self.}XmlAttrForceAA.Value := object_.XmlAttrForceAA.Value; - {self.}XmlAttrCompatLnSpc.Value := object_.XmlAttrCompatLnSpc.Value; - {self.}PrstTxWrap := new PrstTxWrapUnitDecorator(object_.PrstTxWrap); - if not ifnil(object_.XmlChildNoAutofit.Value) then {self.}XmlChildNoAutofit.Value := object_.XmlChildNoAutofit.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrRot) then + {self.}Rot := object_.XmlAttrRot.Value; + if not ifnil(object_.XmlAttrSpcFirstLastPara) then + {self.}SpcFirstLastPara := object_.XmlAttrSpcFirstLastPara.Value; + if not ifnil(object_.XmlAttrVertOverflow) then + {self.}VertOverflow := object_.XmlAttrVertOverflow.Value; + if not ifnil(object_.XmlAttrHorzOverflow) then + {self.}HorzOverflow := object_.XmlAttrHorzOverflow.Value; + if not ifnil(object_.XmlAttrVert) then + {self.}Vert := object_.XmlAttrVert.Value; + if not ifnil(object_.XmlAttrWrap) then + {self.}Wrap := object_.XmlAttrWrap.Value; + if not ifnil(object_.XmlAttrLIns) then + {self.}LIns := TSSafeUnitConverter.EmusToPoints(object_.XmlAttrLIns.Value); + if not ifnil(object_.XmlAttrTIns) then + {self.}TIns := TSSafeUnitConverter.EmusToPoints(object_.XmlAttrTIns.Value); + if not ifnil(object_.XmlAttrRIns) then + {self.}RIns := TSSafeUnitConverter.EmusToPoints(object_.XmlAttrRIns.Value); + if not ifnil(object_.XmlAttrBIns) then + {self.}BIns := TSSafeUnitConverter.EmusToPoints(object_.XmlAttrBIns.Value); + if not ifnil(object_.XmlAttrNumCol) then + {self.}NumCol := object_.XmlAttrNumCol.Value; + if not ifnil(object_.XmlAttrSpcCol) then + {self.}SpcCol := object_.XmlAttrSpcCol.Value; + if not ifnil(object_.XmlAttrRtlCol) then + {self.}RtlCol := object_.XmlAttrRtlCol.Value; + if not ifnil(object_.XmlAttrFromWordArt) then + {self.}FromWordArt := object_.XmlAttrFromWordArt.Value; + if not ifnil(object_.XmlAttrAnchor) then + {self.}Anchor := object_.XmlAttrAnchor.Value; + if not ifnil(object_.XmlAttrAnchorCtr) then + {self.}AnchorCtr := object_.XmlAttrAnchorCtr.Value; + if not ifnil(object_.XmlAttrForceAA) then + {self.}ForceAA := object_.XmlAttrForceAA.Value; + if not ifnil(object_.XmlAttrCompatLnSpc) then + {self.}CompatLnSpc := object_.XmlAttrCompatLnSpc.Value; + if not ifnil(object_.XmlChildPrstTxWrap) then + {self.}XmlChildPrstTxWrap := new PrstTxWrapUnitDecorator(object_.XmlChildPrstTxWrap); + if not ifnil(object_.XmlChildNoAutofit) then + {self.}NoAutofit.Copy(object_.XmlChildNoAutofit); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/BodyUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/BodyUnitDecorator@DOCX.tsf index 867d130..f461bd4 100644 --- a/autoclass/decorator/docx/BodyUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/BodyUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function BodyUnitDecorator.Convert(); begin - {self.}SectPr := new SectPrUnitDecorator(object_.SectPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildSectPr) then + {self.}XmlChildSectPr := new SectPrUnitDecorator(object_.XmlChildSectPr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/BookmarkUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/BookmarkUnitDecorator@DOCX.tsf index 757e696..d0e3cd2 100644 --- a/autoclass/decorator/docx/BookmarkUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/BookmarkUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function BookmarkUnitDecorator.Convert(); begin - {self.}XmlAttrName.Value := object_.XmlAttrName.Value; - {self.}XmlAttrId.Value := object_.XmlAttrId.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrName) then + {self.}Name := object_.XmlAttrName.Value; + if not ifnil(object_.XmlAttrId) then + {self.}Id := object_.XmlAttrId.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/BrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/BrUnitDecorator@DOCX.tsf index 95daf2c..d64c467 100644 --- a/autoclass/decorator/docx/BrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/BrUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function BrUnitDecorator.Convert(); begin - {self.}XmlAttrType.Value := object_.XmlAttrType.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrType) then + {self.}Type := object_.XmlAttrType.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/CNvGraphicFramePrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/CNvGraphicFramePrUnitDecorator@DOCX.tsf index 781fccc..e767c55 100644 --- a/autoclass/decorator/docx/CNvGraphicFramePrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/CNvGraphicFramePrUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function CNvGraphicFramePrUnitDecorator.Convert(); begin - {self.}GraphicFrameLocks := new GraphicFrameLocksUnitDecorator(object_.GraphicFrameLocks); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildGraphicFrameLocks) then + {self.}XmlChildGraphicFrameLocks := new GraphicFrameLocksUnitDecorator(object_.XmlChildGraphicFrameLocks); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/CNvPicPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/CNvPicPrUnitDecorator@DOCX.tsf index 28a1508..04acc34 100644 --- a/autoclass/decorator/docx/CNvPicPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/CNvPicPrUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function CNvPicPrUnitDecorator.Convert(); begin - {self.}PicLocks := new PicLocksUnitDecorator(object_.PicLocks); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildPicLocks) then + {self.}XmlChildPicLocks := new PicLocksUnitDecorator(object_.XmlChildPicLocks); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/CNvPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/CNvPrUnitDecorator@DOCX.tsf index bf0afb6..1dd5aca 100644 --- a/autoclass/decorator/docx/CNvPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/CNvPrUnitDecorator@DOCX.tsf @@ -22,7 +22,13 @@ end; function CNvPrUnitDecorator.Convert(); begin - {self.}XmlAttrId.Value := object_.XmlAttrId.Value; - {self.}XmlAttrName.Value := object_.XmlAttrName.Value; - {self.}XmlAttrDescr.Value := object_.XmlAttrDescr.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrId) then + {self.}Id := object_.XmlAttrId.Value; + if not ifnil(object_.XmlAttrName) then + {self.}Name := object_.XmlAttrName.Value; + if not ifnil(object_.XmlAttrDescr) then + {self.}Descr := object_.XmlAttrDescr.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/CNvSpPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/CNvSpPrUnitDecorator@DOCX.tsf index f1695af..1b8663b 100644 --- a/autoclass/decorator/docx/CNvSpPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/CNvSpPrUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function CNvSpPrUnitDecorator.Convert(); begin - {self.}XmlAttrTxBox.Value := object_.XmlAttrTxBox.Value; - {self.}SpLocks := new SpLocksUnitDecorator(object_.SpLocks); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrTxBox) then + {self.}TxBox := object_.XmlAttrTxBox.Value; + if not ifnil(object_.XmlChildSpLocks) then + {self.}XmlChildSpLocks := new SpLocksUnitDecorator(object_.XmlChildSpLocks); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/CXYUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/CXYUnitDecorator@DOCX.tsf index 0297d00..de51a92 100644 --- a/autoclass/decorator/docx/CXYUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/CXYUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function CXYUnitDecorator.Convert(); begin - {self.}XmlAttrCx.Value := TSSafeUnitConverter.EmusToPoints(object_.XmlAttrCx.Value); - {self.}XmlAttrCy.Value := TSSafeUnitConverter.EmusToPoints(object_.XmlAttrCy.Value); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrCx) then + {self.}Cx := TSSafeUnitConverter.EmusToPoints(object_.XmlAttrCx.Value); + if not ifnil(object_.XmlAttrCy) then + {self.}Cy := TSSafeUnitConverter.EmusToPoints(object_.XmlAttrCy.Value); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/CacheUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/CacheUnitDecorator@DOCX.tsf index 762ddf9..5973fca 100644 --- a/autoclass/decorator/docx/CacheUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/CacheUnitDecorator@DOCX.tsf @@ -22,5 +22,10 @@ end; function CacheUnitDecorator.Convert(); begin - {self.}PtCount := new PureValUnitDecorator(object_.PtCount); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildFormatCode) then + if not ifnil(object_.XmlChildPtCount) then + {self.}XmlChildPtCount := new PureValUnitDecorator(object_.XmlChildPtCount); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/CatUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/CatUnitDecorator@DOCX.tsf index 207482b..eea7847 100644 --- a/autoclass/decorator/docx/CatUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/CatUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function CatUnitDecorator.Convert(); begin - {self.}StrRef := new StrRefUnitDecorator(object_.StrRef); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildStrRef) then + {self.}XmlChildStrRef := new StrRefUnitDecorator(object_.XmlChildStrRef); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ChartSpaceUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ChartSpaceUnitDecorator@DOCX.tsf index a609da0..9f26c29 100644 --- a/autoclass/decorator/docx/ChartSpaceUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ChartSpaceUnitDecorator@DOCX.tsf @@ -22,13 +22,25 @@ end; function ChartSpaceUnitDecorator.Convert(); begin - {self.}XmlAttrXmlnsC.Value := object_.XmlAttrXmlnsC.Value; - {self.}XmlAttrXmlnsA.Value := object_.XmlAttrXmlnsA.Value; - {self.}XmlAttrXmlnsR.Value := object_.XmlAttrXmlnsR.Value; - {self.}Date1904 := new PureValUnitDecorator(object_.Date1904); - {self.}Lang := new PureValUnitDecorator(object_.Lang); - {self.}AlternateContent := new AlternateContentUnitDecorator(object_.AlternateContent); - {self.}Chart := new ChartUnitDecorator(object_.Chart); - {self.}SpPr := new SpPrUnitDecorator(object_.SpPr); - {self.}ExternalData := new ExternalDataUnitDecorator(object_.ExternalData); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXmlnsC) then + {self.}XmlnsC := object_.XmlAttrXmlnsC.Value; + if not ifnil(object_.XmlAttrXmlnsA) then + {self.}XmlnsA := object_.XmlAttrXmlnsA.Value; + if not ifnil(object_.XmlAttrXmlnsR) then + {self.}XmlnsR := object_.XmlAttrXmlnsR.Value; + if not ifnil(object_.XmlChildDate1904) then + {self.}XmlChildDate1904 := new PureValUnitDecorator(object_.XmlChildDate1904); + if not ifnil(object_.XmlChildLang) then + {self.}XmlChildLang := new PureValUnitDecorator(object_.XmlChildLang); + if not ifnil(object_.XmlChildAlternateContent) then + {self.}XmlChildAlternateContent := new AlternateContentUnitDecorator(object_.XmlChildAlternateContent); + if not ifnil(object_.XmlChildChart) then + {self.}XmlChildChart := new ChartUnitDecorator(object_.XmlChildChart); + if not ifnil(object_.XmlChildSpPr) then + {self.}XmlChildSpPr := new SpPrUnitDecorator(object_.XmlChildSpPr); + if not ifnil(object_.XmlChildExternalData) then + {self.}XmlChildExternalData := new ExternalDataUnitDecorator(object_.XmlChildExternalData); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ChartUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ChartUnitDecorator@DOCX.tsf index c77cb38..3b8fee6 100644 --- a/autoclass/decorator/docx/ChartUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ChartUnitDecorator@DOCX.tsf @@ -22,12 +22,23 @@ end; function ChartUnitDecorator.Convert(); begin - {self.}Title := new TitleUnitDecorator(object_.Title); - {self.}AutoTitleDeleted := new PureValUnitDecorator(object_.AutoTitleDeleted); - {self.}View3D := new View3DUnitDecorator(object_.View3D); - {self.}PlotArea := new PlotAreaUnitDecorator(object_.PlotArea); - {self.}Legend := new LegendUnitDecorator(object_.Legend); - {self.}PlotVisOnly := new PureValUnitDecorator(object_.PlotVisOnly); - {self.}DispBlanksAs := new PureValUnitDecorator(object_.DispBlanksAs); - {self.}ShowDLblsOverMax := new PureValUnitDecorator(object_.ShowDLblsOverMax); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildTitle) then + {self.}XmlChildTitle := new TitleUnitDecorator(object_.XmlChildTitle); + if not ifnil(object_.XmlChildAutoTitleDeleted) then + {self.}XmlChildAutoTitleDeleted := new PureValUnitDecorator(object_.XmlChildAutoTitleDeleted); + if not ifnil(object_.XmlChildView3D) then + {self.}XmlChildView3D := new View3DUnitDecorator(object_.XmlChildView3D); + if not ifnil(object_.XmlChildPlotArea) then + {self.}XmlChildPlotArea := new PlotAreaUnitDecorator(object_.XmlChildPlotArea); + if not ifnil(object_.XmlChildLegend) then + {self.}XmlChildLegend := new LegendUnitDecorator(object_.XmlChildLegend); + if not ifnil(object_.XmlChildPlotVisOnly) then + {self.}XmlChildPlotVisOnly := new PureValUnitDecorator(object_.XmlChildPlotVisOnly); + if not ifnil(object_.XmlChildDispBlanksAs) then + {self.}XmlChildDispBlanksAs := new PureValUnitDecorator(object_.XmlChildDispBlanksAs); + if not ifnil(object_.XmlChildShowDLblsOverMax) then + {self.}XmlChildShowDLblsOverMax := new PureValUnitDecorator(object_.XmlChildShowDLblsOverMax); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ChoiceUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ChoiceUnitDecorator@DOCX.tsf index c616a1b..91818c9 100644 --- a/autoclass/decorator/docx/ChoiceUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ChoiceUnitDecorator@DOCX.tsf @@ -22,8 +22,15 @@ end; function ChoiceUnitDecorator.Convert(); begin - {self.}XmlAttrRequires.Value := object_.XmlAttrRequires.Value; - {self.}XmlAttrXmlnsC14.Value := object_.XmlAttrXmlnsC14.Value; - {self.}Style := new PureValUnitDecorator(object_.Style); - {self.}Drawing := new DrawingUnitDecorator(object_.Drawing); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrRequires) then + {self.}Requires := object_.XmlAttrRequires.Value; + if not ifnil(object_.XmlAttrXmlnsC14) then + {self.}XmlnsC14 := object_.XmlAttrXmlnsC14.Value; + if not ifnil(object_.XmlChildStyle) then + {self.}XmlChildStyle := new PureValUnitDecorator(object_.XmlChildStyle); + if not ifnil(object_.XmlChildDrawing) then + {self.}XmlChildDrawing := new DrawingUnitDecorator(object_.XmlChildDrawing); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/Clr1UnitDecorator@DOCX.tsf b/autoclass/decorator/docx/Clr1UnitDecorator@DOCX.tsf index d024be7..5630b47 100644 --- a/autoclass/decorator/docx/Clr1UnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/Clr1UnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function Clr1UnitDecorator.Convert(); begin - {self.}SysClr := new SysClrUnitDecorator(object_.SysClr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildSysClr) then + {self.}XmlChildSysClr := new SysClrUnitDecorator(object_.XmlChildSysClr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/Clr2UnitDecorator@DOCX.tsf b/autoclass/decorator/docx/Clr2UnitDecorator@DOCX.tsf index 1ad2263..5053a00 100644 --- a/autoclass/decorator/docx/Clr2UnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/Clr2UnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function Clr2UnitDecorator.Convert(); begin - {self.}SrgbClr := new SrgbClrUnitDecorator(object_.SrgbClr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildSrgbClr) then + {self.}XmlChildSrgbClr := new SrgbClrUnitDecorator(object_.XmlChildSrgbClr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ClrSchemeMappingUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ClrSchemeMappingUnitDecorator@DOCX.tsf index ac5fa84..3640e62 100644 --- a/autoclass/decorator/docx/ClrSchemeMappingUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ClrSchemeMappingUnitDecorator@DOCX.tsf @@ -22,16 +22,31 @@ end; function ClrSchemeMappingUnitDecorator.Convert(); begin - {self.}XmlAttrBg1.Value := object_.XmlAttrBg1.Value; - {self.}XmlAttrT1.Value := object_.XmlAttrT1.Value; - {self.}XmlAttrBg2.Value := object_.XmlAttrBg2.Value; - {self.}XmlAttrT2.Value := object_.XmlAttrT2.Value; - {self.}XmlAttrAccent1.Value := object_.XmlAttrAccent1.Value; - {self.}XmlAttrAccent2.Value := object_.XmlAttrAccent2.Value; - {self.}XmlAttrAccent3.Value := object_.XmlAttrAccent3.Value; - {self.}XmlAttrAccent4.Value := object_.XmlAttrAccent4.Value; - {self.}XmlAttrAccent5.Value := object_.XmlAttrAccent5.Value; - {self.}XmlAttrAccent6.Value := object_.XmlAttrAccent6.Value; - {self.}XmlAttrHyperLink.Value := object_.XmlAttrHyperLink.Value; - {self.}XmlAttrFollowedHyperlink.Value := object_.XmlAttrFollowedHyperlink.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrBg1) then + {self.}Bg1 := object_.XmlAttrBg1.Value; + if not ifnil(object_.XmlAttrT1) then + {self.}T1 := object_.XmlAttrT1.Value; + if not ifnil(object_.XmlAttrBg2) then + {self.}Bg2 := object_.XmlAttrBg2.Value; + if not ifnil(object_.XmlAttrT2) then + {self.}T2 := object_.XmlAttrT2.Value; + if not ifnil(object_.XmlAttrAccent1) then + {self.}Accent1 := object_.XmlAttrAccent1.Value; + if not ifnil(object_.XmlAttrAccent2) then + {self.}Accent2 := object_.XmlAttrAccent2.Value; + if not ifnil(object_.XmlAttrAccent3) then + {self.}Accent3 := object_.XmlAttrAccent3.Value; + if not ifnil(object_.XmlAttrAccent4) then + {self.}Accent4 := object_.XmlAttrAccent4.Value; + if not ifnil(object_.XmlAttrAccent5) then + {self.}Accent5 := object_.XmlAttrAccent5.Value; + if not ifnil(object_.XmlAttrAccent6) then + {self.}Accent6 := object_.XmlAttrAccent6.Value; + if not ifnil(object_.XmlAttrHyperLink) then + {self.}HyperLink := object_.XmlAttrHyperLink.Value; + if not ifnil(object_.XmlAttrFollowedHyperlink) then + {self.}FollowedHyperlink := object_.XmlAttrFollowedHyperlink.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ClrSchemeUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ClrSchemeUnitDecorator@DOCX.tsf index 0a6dafa..4f6ee77 100644 --- a/autoclass/decorator/docx/ClrSchemeUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ClrSchemeUnitDecorator@DOCX.tsf @@ -22,17 +22,33 @@ end; function ClrSchemeUnitDecorator.Convert(); begin - {self.}XmlAttrName.Value := object_.XmlAttrName.Value; - {self.}Dk1 := new Clr1UnitDecorator(object_.Dk1); - {self.}Lt1 := new Clr1UnitDecorator(object_.Lt1); - {self.}Dk2 := new Clr2UnitDecorator(object_.Dk2); - {self.}Lt2 := new Clr2UnitDecorator(object_.Lt2); - {self.}Accent1 := new Clr2UnitDecorator(object_.Accent1); - {self.}Accent2 := new Clr2UnitDecorator(object_.Accent2); - {self.}Accent3 := new Clr2UnitDecorator(object_.Accent3); - {self.}Accent4 := new Clr2UnitDecorator(object_.Accent4); - {self.}Accent5 := new Clr2UnitDecorator(object_.Accent5); - {self.}Accent6 := new Clr2UnitDecorator(object_.Accent6); - {self.}Hlink := new Clr2UnitDecorator(object_.Hlink); - {self.}FolHlink := new Clr2UnitDecorator(object_.FolHlink); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrName) then + {self.}Name := object_.XmlAttrName.Value; + if not ifnil(object_.XmlChildDk1) then + {self.}XmlChildDk1 := new Clr1UnitDecorator(object_.XmlChildDk1); + if not ifnil(object_.XmlChildLt1) then + {self.}XmlChildLt1 := new Clr1UnitDecorator(object_.XmlChildLt1); + if not ifnil(object_.XmlChildDk2) then + {self.}XmlChildDk2 := new Clr2UnitDecorator(object_.XmlChildDk2); + if not ifnil(object_.XmlChildLt2) then + {self.}XmlChildLt2 := new Clr2UnitDecorator(object_.XmlChildLt2); + if not ifnil(object_.XmlChildAccent1) then + {self.}XmlChildAccent1 := new Clr2UnitDecorator(object_.XmlChildAccent1); + if not ifnil(object_.XmlChildAccent2) then + {self.}XmlChildAccent2 := new Clr2UnitDecorator(object_.XmlChildAccent2); + if not ifnil(object_.XmlChildAccent3) then + {self.}XmlChildAccent3 := new Clr2UnitDecorator(object_.XmlChildAccent3); + if not ifnil(object_.XmlChildAccent4) then + {self.}XmlChildAccent4 := new Clr2UnitDecorator(object_.XmlChildAccent4); + if not ifnil(object_.XmlChildAccent5) then + {self.}XmlChildAccent5 := new Clr2UnitDecorator(object_.XmlChildAccent5); + if not ifnil(object_.XmlChildAccent6) then + {self.}XmlChildAccent6 := new Clr2UnitDecorator(object_.XmlChildAccent6); + if not ifnil(object_.XmlChildHlink) then + {self.}XmlChildHlink := new Clr2UnitDecorator(object_.XmlChildHlink); + if not ifnil(object_.XmlChildFolHlink) then + {self.}XmlChildFolHlink := new Clr2UnitDecorator(object_.XmlChildFolHlink); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/CnfStyleUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/CnfStyleUnitDecorator@DOCX.tsf index 4380c7d..b23ce96 100644 --- a/autoclass/decorator/docx/CnfStyleUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/CnfStyleUnitDecorator@DOCX.tsf @@ -22,17 +22,33 @@ end; function CnfStyleUnitDecorator.Convert(); begin - {self.}XmlAttrVal.Value := object_.XmlAttrVal.Value; - {self.}XmlAttrFirstRow.Value := object_.XmlAttrFirstRow.Value; - {self.}XmlAttrLastRow.Value := object_.XmlAttrLastRow.Value; - {self.}XmlAttrFirstColumn.Value := object_.XmlAttrFirstColumn.Value; - {self.}XmlAttrLastColumn.Value := object_.XmlAttrLastColumn.Value; - {self.}XmlAttrOddVBand.Value := object_.XmlAttrOddVBand.Value; - {self.}XmlAttrEvenVBand.Value := object_.XmlAttrEvenVBand.Value; - {self.}XmlAttrOddHBand.Value := object_.XmlAttrOddHBand.Value; - {self.}XmlAttrEvenHBand.Value := object_.XmlAttrEvenHBand.Value; - {self.}XmlAttrFirstRowFirstColumn.Value := object_.XmlAttrFirstRowFirstColumn.Value; - {self.}XmlAttrFirstRowLastColumn.Value := object_.XmlAttrFirstRowLastColumn.Value; - {self.}XmlAttrLastRowFirstColumn.Value := object_.XmlAttrLastRowFirstColumn.Value; - {self.}XmlAttrLastRowLastColumn.Value := object_.XmlAttrLastRowLastColumn.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrVal) then + {self.}Val := object_.XmlAttrVal.Value; + if not ifnil(object_.XmlAttrFirstRow) then + {self.}FirstRow := object_.XmlAttrFirstRow.Value; + if not ifnil(object_.XmlAttrLastRow) then + {self.}LastRow := object_.XmlAttrLastRow.Value; + if not ifnil(object_.XmlAttrFirstColumn) then + {self.}FirstColumn := object_.XmlAttrFirstColumn.Value; + if not ifnil(object_.XmlAttrLastColumn) then + {self.}LastColumn := object_.XmlAttrLastColumn.Value; + if not ifnil(object_.XmlAttrOddVBand) then + {self.}OddVBand := object_.XmlAttrOddVBand.Value; + if not ifnil(object_.XmlAttrEvenVBand) then + {self.}EvenVBand := object_.XmlAttrEvenVBand.Value; + if not ifnil(object_.XmlAttrOddHBand) then + {self.}OddHBand := object_.XmlAttrOddHBand.Value; + if not ifnil(object_.XmlAttrEvenHBand) then + {self.}EvenHBand := object_.XmlAttrEvenHBand.Value; + if not ifnil(object_.XmlAttrFirstRowFirstColumn) then + {self.}FirstRowFirstColumn := object_.XmlAttrFirstRowFirstColumn.Value; + if not ifnil(object_.XmlAttrFirstRowLastColumn) then + {self.}FirstRowLastColumn := object_.XmlAttrFirstRowLastColumn.Value; + if not ifnil(object_.XmlAttrLastRowFirstColumn) then + {self.}LastRowFirstColumn := object_.XmlAttrLastRowFirstColumn.Value; + if not ifnil(object_.XmlAttrLastRowLastColumn) then + {self.}LastRowLastColumn := object_.XmlAttrLastRowLastColumn.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ColorUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ColorUnitDecorator@DOCX.tsf index 7e98535..d270121 100644 --- a/autoclass/decorator/docx/ColorUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ColorUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function ColorUnitDecorator.Convert(); begin - {self.}XmlAttrVal.Value := object_.XmlAttrVal.Value; - {self.}XmlAttrThemeColor.Value := object_.XmlAttrThemeColor.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrVal) then + {self.}Val := object_.XmlAttrVal.Value; + if not ifnil(object_.XmlAttrThemeColor) then + {self.}ThemeColor := object_.XmlAttrThemeColor.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ColsUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ColsUnitDecorator@DOCX.tsf index 7fc9cae..b2c4477 100644 --- a/autoclass/decorator/docx/ColsUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ColsUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function ColsUnitDecorator.Convert(); begin - {self.}XmlAttrSpace.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrSpace.Value); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrSpace) then + {self.}Space := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrSpace.Value); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/CommentRangeUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/CommentRangeUnitDecorator@DOCX.tsf index 2c9e2be..f788f37 100644 --- a/autoclass/decorator/docx/CommentRangeUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/CommentRangeUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function CommentRangeUnitDecorator.Convert(); begin - {self.}XmlAttrId.Value := object_.XmlAttrId.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrId) then + {self.}Id := object_.XmlAttrId.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/CommentUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/CommentUnitDecorator@DOCX.tsf index 696c8a6..db8019b 100644 --- a/autoclass/decorator/docx/CommentUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/CommentUnitDecorator@DOCX.tsf @@ -22,7 +22,13 @@ end; function CommentUnitDecorator.Convert(); begin - {self.}XmlAttrAuthor.Value := object_.XmlAttrAuthor.Value; - {self.}XmlAttrDate.Value := object_.XmlAttrDate.Value; - {self.}XmlAttrId.Value := object_.XmlAttrId.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrAuthor) then + {self.}Author := object_.XmlAttrAuthor.Value; + if not ifnil(object_.XmlAttrDate) then + {self.}Date := object_.XmlAttrDate.Value; + if not ifnil(object_.XmlAttrId) then + {self.}Id := object_.XmlAttrId.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/CommentsUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/CommentsUnitDecorator@DOCX.tsf index 904a191..2292574 100644 --- a/autoclass/decorator/docx/CommentsUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/CommentsUnitDecorator@DOCX.tsf @@ -22,22 +22,43 @@ end; function CommentsUnitDecorator.Convert(); begin - {self.}XmlAttrXmlnsWpc.Value := object_.XmlAttrXmlnsWpc.Value; - {self.}XmlAttrXmlnsMc.Value := object_.XmlAttrXmlnsMc.Value; - {self.}XmlAttrXmlnsO.Value := object_.XmlAttrXmlnsO.Value; - {self.}XmlAttrXmlnsR.Value := object_.XmlAttrXmlnsR.Value; - {self.}XmlAttrXmlnsM.Value := object_.XmlAttrXmlnsM.Value; - {self.}XmlAttrXmlnsV.Value := object_.XmlAttrXmlnsV.Value; - {self.}XmlAttrXmlnsWp14.Value := object_.XmlAttrXmlnsWp14.Value; - {self.}XmlAttrXmlnsWp.Value := object_.XmlAttrXmlnsWp.Value; - {self.}XmlAttrXmlnsW.Value := object_.XmlAttrXmlnsW.Value; - {self.}XmlAttrXmlnsW14.Value := object_.XmlAttrXmlnsW14.Value; - {self.}XmlAttrXmlnsW15.Value := object_.XmlAttrXmlnsW15.Value; - {self.}XmlAttrXmlnsW10.Value := object_.XmlAttrXmlnsW10.Value; - {self.}XmlAttrXmlnsWpg.Value := object_.XmlAttrXmlnsWpg.Value; - {self.}XmlAttrXmlnsWpi.Value := object_.XmlAttrXmlnsWpi.Value; - {self.}XmlAttrXmlnsWne.Value := object_.XmlAttrXmlnsWne.Value; - {self.}XmlAttrXmlnsWps.Value := object_.XmlAttrXmlnsWps.Value; - {self.}XmlAttrXmlnsWpsCustomData.Value := object_.XmlAttrXmlnsWpsCustomData.Value; - {self.}XmlAttrMcIgnorable.Value := object_.XmlAttrMcIgnorable.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXmlnsWpc) then + {self.}XmlnsWpc := object_.XmlAttrXmlnsWpc.Value; + if not ifnil(object_.XmlAttrXmlnsMc) then + {self.}XmlnsMc := object_.XmlAttrXmlnsMc.Value; + if not ifnil(object_.XmlAttrXmlnsO) then + {self.}XmlnsO := object_.XmlAttrXmlnsO.Value; + if not ifnil(object_.XmlAttrXmlnsR) then + {self.}XmlnsR := object_.XmlAttrXmlnsR.Value; + if not ifnil(object_.XmlAttrXmlnsM) then + {self.}XmlnsM := object_.XmlAttrXmlnsM.Value; + if not ifnil(object_.XmlAttrXmlnsV) then + {self.}XmlnsV := object_.XmlAttrXmlnsV.Value; + if not ifnil(object_.XmlAttrXmlnsWp14) then + {self.}XmlnsWp14 := object_.XmlAttrXmlnsWp14.Value; + if not ifnil(object_.XmlAttrXmlnsWp) then + {self.}XmlnsWp := object_.XmlAttrXmlnsWp.Value; + if not ifnil(object_.XmlAttrXmlnsW) then + {self.}XmlnsW := object_.XmlAttrXmlnsW.Value; + if not ifnil(object_.XmlAttrXmlnsW14) then + {self.}XmlnsW14 := object_.XmlAttrXmlnsW14.Value; + if not ifnil(object_.XmlAttrXmlnsW15) then + {self.}XmlnsW15 := object_.XmlAttrXmlnsW15.Value; + if not ifnil(object_.XmlAttrXmlnsW10) then + {self.}XmlnsW10 := object_.XmlAttrXmlnsW10.Value; + if not ifnil(object_.XmlAttrXmlnsWpg) then + {self.}XmlnsWpg := object_.XmlAttrXmlnsWpg.Value; + if not ifnil(object_.XmlAttrXmlnsWpi) then + {self.}XmlnsWpi := object_.XmlAttrXmlnsWpi.Value; + if not ifnil(object_.XmlAttrXmlnsWne) then + {self.}XmlnsWne := object_.XmlAttrXmlnsWne.Value; + if not ifnil(object_.XmlAttrXmlnsWps) then + {self.}XmlnsWps := object_.XmlAttrXmlnsWps.Value; + if not ifnil(object_.XmlAttrXmlnsWpsCustomData) then + {self.}XmlnsWpsCustomData := object_.XmlAttrXmlnsWpsCustomData.Value; + if not ifnil(object_.XmlAttrMcIgnorable) then + {self.}McIgnorable := object_.XmlAttrMcIgnorable.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/CompatSettingUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/CompatSettingUnitDecorator@DOCX.tsf index 76e87cd..34305cc 100644 --- a/autoclass/decorator/docx/CompatSettingUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/CompatSettingUnitDecorator@DOCX.tsf @@ -22,7 +22,13 @@ end; function CompatSettingUnitDecorator.Convert(); begin - {self.}XmlAttrName.Value := object_.XmlAttrName.Value; - {self.}XmlAttrUri.Value := object_.XmlAttrUri.Value; - {self.}XmlAttrVal.Value := object_.XmlAttrVal.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrName) then + {self.}Name := object_.XmlAttrName.Value; + if not ifnil(object_.XmlAttrUri) then + {self.}Uri := object_.XmlAttrUri.Value; + if not ifnil(object_.XmlAttrVal) then + {self.}Val := object_.XmlAttrVal.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/CompatUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/CompatUnitDecorator@DOCX.tsf index 423ba64..0ac8275 100644 --- a/autoclass/decorator/docx/CompatUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/CompatUnitDecorator@DOCX.tsf @@ -22,11 +22,21 @@ end; function CompatUnitDecorator.Convert(); begin - if not ifnil(object_.XmlChildSpaceForUL.Value) then {self.}XmlChildSpaceForUL.Value := object_.XmlChildSpaceForUL.Value; - if not ifnil(object_.XmlChildBalanceSingleByteDoubleByteWidth.Value) then {self.}XmlChildBalanceSingleByteDoubleByteWidth.Value := object_.XmlChildBalanceSingleByteDoubleByteWidth.Value; - if not ifnil(object_.XmlChildDoNotLeaveBackslashAlone.Value) then {self.}XmlChildDoNotLeaveBackslashAlone.Value := object_.XmlChildDoNotLeaveBackslashAlone.Value; - if not ifnil(object_.XmlChildUlTrailSpace.Value) then {self.}XmlChildUlTrailSpace.Value := object_.XmlChildUlTrailSpace.Value; - if not ifnil(object_.XmlChildDoNotExpandShiftReturn.Value) then {self.}XmlChildDoNotExpandShiftReturn.Value := object_.XmlChildDoNotExpandShiftReturn.Value; - if not ifnil(object_.XmlChildAdjustLineHeightInTable.Value) then {self.}XmlChildAdjustLineHeightInTable.Value := object_.XmlChildAdjustLineHeightInTable.Value; - if not ifnil(object_.XmlChildUseFELayout.Value) then {self.}XmlChildUseFELayout.Value := object_.XmlChildUseFELayout.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildSpaceForUL) then + {self.}SpaceForUL.Copy(object_.XmlChildSpaceForUL); + if not ifnil(object_.XmlChildBalanceSingleByteDoubleByteWidth) then + {self.}BalanceSingleByteDoubleByteWidth.Copy(object_.XmlChildBalanceSingleByteDoubleByteWidth); + if not ifnil(object_.XmlChildDoNotLeaveBackslashAlone) then + {self.}DoNotLeaveBackslashAlone.Copy(object_.XmlChildDoNotLeaveBackslashAlone); + if not ifnil(object_.XmlChildUlTrailSpace) then + {self.}UlTrailSpace.Copy(object_.XmlChildUlTrailSpace); + if not ifnil(object_.XmlChildDoNotExpandShiftReturn) then + {self.}DoNotExpandShiftReturn.Copy(object_.XmlChildDoNotExpandShiftReturn); + if not ifnil(object_.XmlChildAdjustLineHeightInTable) then + {self.}AdjustLineHeightInTable.Copy(object_.XmlChildAdjustLineHeightInTable); + if not ifnil(object_.XmlChildUseFELayout) then + {self.}UseFELayout.Copy(object_.XmlChildUseFELayout); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/CorePropertiesUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/CorePropertiesUnitDecorator@DOCX.tsf index 3448bfd..8ede3f8 100644 --- a/autoclass/decorator/docx/CorePropertiesUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/CorePropertiesUnitDecorator@DOCX.tsf @@ -22,11 +22,29 @@ end; function CorePropertiesUnitDecorator.Convert(); begin - {self.}XmlAttrXmlnsCp.Value := object_.XmlAttrXmlnsCp.Value; - {self.}XmlAttrXmlnsDc.Value := object_.XmlAttrXmlnsDc.Value; - {self.}XmlAttrXmlnsDcterms.Value := object_.XmlAttrXmlnsDcterms.Value; - {self.}XmlAttrXmlnsDcmitype.Value := object_.XmlAttrXmlnsDcmitype.Value; - {self.}XmlAttrXmlnsXsi.Value := object_.XmlAttrXmlnsXsi.Value; - {self.}Created := new CreatedUnitDecorator(object_.Created); - {self.}Modified := new ModifiedUnitDecorator(object_.Modified); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXmlnsCp) then + {self.}XmlnsCp := object_.XmlAttrXmlnsCp.Value; + if not ifnil(object_.XmlAttrXmlnsDc) then + {self.}XmlnsDc := object_.XmlAttrXmlnsDc.Value; + if not ifnil(object_.XmlAttrXmlnsDcterms) then + {self.}XmlnsDcterms := object_.XmlAttrXmlnsDcterms.Value; + if not ifnil(object_.XmlAttrXmlnsDcmitype) then + {self.}XmlnsDcmitype := object_.XmlAttrXmlnsDcmitype.Value; + if not ifnil(object_.XmlAttrXmlnsXsi) then + {self.}XmlnsXsi := object_.XmlAttrXmlnsXsi.Value; + if not ifnil(object_.XmlChildTitle) then + if not ifnil(object_.XmlChildSubject) then + if not ifnil(object_.XmlChildCreator) then + if not ifnil(object_.XmlChildKeywords) then + if not ifnil(object_.XmlChildDescription) then + if not ifnil(object_.XmlChildLastModifiedBy) then + if not ifnil(object_.XmlChildRevision) then + if not ifnil(object_.XmlChildLastPrinted) then + if not ifnil(object_.XmlChildCreated) then + {self.}XmlChildCreated := new CreatedUnitDecorator(object_.XmlChildCreated); + if not ifnil(object_.XmlChildModified) then + {self.}XmlChildModified := new ModifiedUnitDecorator(object_.XmlChildModified); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/CreatedUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/CreatedUnitDecorator@DOCX.tsf index e7429f1..d203075 100644 --- a/autoclass/decorator/docx/CreatedUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/CreatedUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function CreatedUnitDecorator.Convert(); begin - {self.}XmlAttrXsiType.Value := object_.XmlAttrXsiType.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXsiType) then + {self.}XsiType := object_.XmlAttrXsiType.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/DLblsUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/DLblsUnitDecorator@DOCX.tsf index 53ad141..c4d5dd8 100644 --- a/autoclass/decorator/docx/DLblsUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/DLblsUnitDecorator@DOCX.tsf @@ -22,13 +22,25 @@ end; function DLblsUnitDecorator.Convert(); begin - {self.}SpPr := new SpPrUnitDecorator(object_.SpPr); - {self.}ShowLegendKey := new PureValUnitDecorator(object_.ShowLegendKey); - {self.}ShowVal := new PureValUnitDecorator(object_.ShowVal); - {self.}ShowCatName := new PureValUnitDecorator(object_.ShowCatName); - {self.}ShowSerName := new PureValUnitDecorator(object_.ShowSerName); - {self.}ShowPercent := new PureValUnitDecorator(object_.ShowPercent); - {self.}ShowBubbleSize := new PureValUnitDecorator(object_.ShowBubbleSize); - {self.}ShowLeaderLines := new PureValUnitDecorator(object_.ShowLeaderLines); - {self.}ExtLst := new ExtLstUnitDecorator(object_.ExtLst); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildSpPr) then + {self.}XmlChildSpPr := new SpPrUnitDecorator(object_.XmlChildSpPr); + if not ifnil(object_.XmlChildShowLegendKey) then + {self.}XmlChildShowLegendKey := new PureValUnitDecorator(object_.XmlChildShowLegendKey); + if not ifnil(object_.XmlChildShowVal) then + {self.}XmlChildShowVal := new PureValUnitDecorator(object_.XmlChildShowVal); + if not ifnil(object_.XmlChildShowCatName) then + {self.}XmlChildShowCatName := new PureValUnitDecorator(object_.XmlChildShowCatName); + if not ifnil(object_.XmlChildShowSerName) then + {self.}XmlChildShowSerName := new PureValUnitDecorator(object_.XmlChildShowSerName); + if not ifnil(object_.XmlChildShowPercent) then + {self.}XmlChildShowPercent := new PureValUnitDecorator(object_.XmlChildShowPercent); + if not ifnil(object_.XmlChildShowBubbleSize) then + {self.}XmlChildShowBubbleSize := new PureValUnitDecorator(object_.XmlChildShowBubbleSize); + if not ifnil(object_.XmlChildShowLeaderLines) then + {self.}XmlChildShowLeaderLines := new PureValUnitDecorator(object_.XmlChildShowLeaderLines); + if not ifnil(object_.XmlChildExtLst) then + {self.}XmlChildExtLst := new ExtLstUnitDecorator(object_.XmlChildExtLst); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/DTableUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/DTableUnitDecorator@DOCX.tsf index 439da4a..56f6257 100644 --- a/autoclass/decorator/docx/DTableUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/DTableUnitDecorator@DOCX.tsf @@ -22,9 +22,17 @@ end; function DTableUnitDecorator.Convert(); begin - {self.}ShowHorzBorder := new PureValUnitDecorator(object_.ShowHorzBorder); - {self.}ShowVertBorder := new PureValUnitDecorator(object_.ShowVertBorder); - {self.}ShowOutline := new PureValUnitDecorator(object_.ShowOutline); - {self.}ShowKeys := new PureValUnitDecorator(object_.ShowKeys); - {self.}TxPr := new TxPrUnitDecorator(object_.TxPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildShowHorzBorder) then + {self.}XmlChildShowHorzBorder := new PureValUnitDecorator(object_.XmlChildShowHorzBorder); + if not ifnil(object_.XmlChildShowVertBorder) then + {self.}XmlChildShowVertBorder := new PureValUnitDecorator(object_.XmlChildShowVertBorder); + if not ifnil(object_.XmlChildShowOutline) then + {self.}XmlChildShowOutline := new PureValUnitDecorator(object_.XmlChildShowOutline); + if not ifnil(object_.XmlChildShowKeys) then + {self.}XmlChildShowKeys := new PureValUnitDecorator(object_.XmlChildShowKeys); + if not ifnil(object_.XmlChildTxPr) then + {self.}XmlChildTxPr := new TxPrUnitDecorator(object_.XmlChildTxPr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/DefaultUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/DefaultUnitDecorator@DOCX.tsf index 3a9b49d..bf7b71f 100644 --- a/autoclass/decorator/docx/DefaultUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/DefaultUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function DefaultUnitDecorator.Convert(); begin - {self.}XmlAttrExtension.Value := object_.XmlAttrExtension.Value; - {self.}XmlAttrContentType.Value := object_.XmlAttrContentType.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrExtension) then + {self.}Extension := object_.XmlAttrExtension.Value; + if not ifnil(object_.XmlAttrContentType) then + {self.}ContentType := object_.XmlAttrContentType.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/DocDefaultsUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/DocDefaultsUnitDecorator@DOCX.tsf index 1e04578..b211bd3 100644 --- a/autoclass/decorator/docx/DocDefaultsUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/DocDefaultsUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function DocDefaultsUnitDecorator.Convert(); begin - {self.}RPrDefault := new RPrDefaultUnitDecorator(object_.RPrDefault); - {self.}PPrDefault := new PPrDefaultUnitDecorator(object_.PPrDefault); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildRPrDefault) then + {self.}XmlChildRPrDefault := new RPrDefaultUnitDecorator(object_.XmlChildRPrDefault); + if not ifnil(object_.XmlChildPPrDefault) then + {self.}XmlChildPPrDefault := new PPrDefaultUnitDecorator(object_.XmlChildPPrDefault); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/DocGridUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/DocGridUnitDecorator@DOCX.tsf index 6c1708f..08699b4 100644 --- a/autoclass/decorator/docx/DocGridUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/DocGridUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function DocGridUnitDecorator.Convert(); begin - {self.}XmlAttrType.Value := object_.XmlAttrType.Value; - {self.}XmlAttrLinePitch.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrLinePitch.Value); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrType) then + {self.}Type := object_.XmlAttrType.Value; + if not ifnil(object_.XmlAttrLinePitch) then + {self.}LinePitch := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrLinePitch.Value); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/DocPartObjUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/DocPartObjUnitDecorator@DOCX.tsf index 7b4e8e3..c67f829 100644 --- a/autoclass/decorator/docx/DocPartObjUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/DocPartObjUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function DocPartObjUnitDecorator.Convert(); begin - {self.}DocPartGallery := new PureWValUnitDecorator(object_.DocPartGallery); - {self.}DocPartUnique := new PureValUnitDecorator(object_.DocPartUnique); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildDocPartGallery) then + {self.}XmlChildDocPartGallery := new PureWValUnitDecorator(object_.XmlChildDocPartGallery); + if not ifnil(object_.XmlChildDocPartUnique) then + {self.}XmlChildDocPartUnique := new PureValUnitDecorator(object_.XmlChildDocPartUnique); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/DocPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/DocPrUnitDecorator@DOCX.tsf index 93e5a73..d906dfa 100644 --- a/autoclass/decorator/docx/DocPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/DocPrUnitDecorator@DOCX.tsf @@ -22,7 +22,13 @@ end; function DocPrUnitDecorator.Convert(); begin - {self.}XmlAttrId.Value := object_.XmlAttrId.Value; - {self.}XmlAttrName.Value := object_.XmlAttrName.Value; - {self.}XmlAttrDescr.Value := object_.XmlAttrDescr.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrId) then + {self.}Id := object_.XmlAttrId.Value; + if not ifnil(object_.XmlAttrName) then + {self.}Name := object_.XmlAttrName.Value; + if not ifnil(object_.XmlAttrDescr) then + {self.}Descr := object_.XmlAttrDescr.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/DocumentUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/DocumentUnitDecorator@DOCX.tsf index 7a6b911..a22e21b 100644 --- a/autoclass/decorator/docx/DocumentUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/DocumentUnitDecorator@DOCX.tsf @@ -22,18 +22,35 @@ end; function DocumentUnitDecorator.Convert(); begin - {self.}XmlAttrXmlnsWpc.Value := object_.XmlAttrXmlnsWpc.Value; - {self.}XmlAttrXmlnsW15.Value := object_.XmlAttrXmlnsW15.Value; - {self.}XmlAttrXmlnsW16Cex.Value := object_.XmlAttrXmlnsW16Cex.Value; - {self.}XmlAttrXmlnsW16Cid.Value := object_.XmlAttrXmlnsW16Cid.Value; - {self.}XmlAttrXmlnsW16.Value := object_.XmlAttrXmlnsW16.Value; - {self.}XmlAttrXmlnsW16Du.Value := object_.XmlAttrXmlnsW16Du.Value; - {self.}XmlAttrXmlnsW16sdtdh.Value := object_.XmlAttrXmlnsW16sdtdh.Value; - {self.}XmlAttrXmlnsW16se.Value := object_.XmlAttrXmlnsW16se.Value; - {self.}XmlAttrXmlnsWpg.Value := object_.XmlAttrXmlnsWpg.Value; - {self.}XmlAttrXmlnsWpi.Value := object_.XmlAttrXmlnsWpi.Value; - {self.}XmlAttrXmlnsWne.Value := object_.XmlAttrXmlnsWne.Value; - {self.}XmlAttrXmlnsWps.Value := object_.XmlAttrXmlnsWps.Value; - {self.}XmlAttrMcIgnorable.Value := object_.XmlAttrMcIgnorable.Value; - {self.}Body := new BodyUnitDecorator(object_.Body); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXmlnsWpc) then + {self.}XmlnsWpc := object_.XmlAttrXmlnsWpc.Value; + if not ifnil(object_.XmlAttrXmlnsW15) then + {self.}XmlnsW15 := object_.XmlAttrXmlnsW15.Value; + if not ifnil(object_.XmlAttrXmlnsW16Cex) then + {self.}XmlnsW16Cex := object_.XmlAttrXmlnsW16Cex.Value; + if not ifnil(object_.XmlAttrXmlnsW16Cid) then + {self.}XmlnsW16Cid := object_.XmlAttrXmlnsW16Cid.Value; + if not ifnil(object_.XmlAttrXmlnsW16) then + {self.}XmlnsW16 := object_.XmlAttrXmlnsW16.Value; + if not ifnil(object_.XmlAttrXmlnsW16Du) then + {self.}XmlnsW16Du := object_.XmlAttrXmlnsW16Du.Value; + if not ifnil(object_.XmlAttrXmlnsW16sdtdh) then + {self.}XmlnsW16sdtdh := object_.XmlAttrXmlnsW16sdtdh.Value; + if not ifnil(object_.XmlAttrXmlnsW16se) then + {self.}XmlnsW16se := object_.XmlAttrXmlnsW16se.Value; + if not ifnil(object_.XmlAttrXmlnsWpg) then + {self.}XmlnsWpg := object_.XmlAttrXmlnsWpg.Value; + if not ifnil(object_.XmlAttrXmlnsWpi) then + {self.}XmlnsWpi := object_.XmlAttrXmlnsWpi.Value; + if not ifnil(object_.XmlAttrXmlnsWne) then + {self.}XmlnsWne := object_.XmlAttrXmlnsWne.Value; + if not ifnil(object_.XmlAttrXmlnsWps) then + {self.}XmlnsWps := object_.XmlAttrXmlnsWps.Value; + if not ifnil(object_.XmlAttrMcIgnorable) then + {self.}McIgnorable := object_.XmlAttrMcIgnorable.Value; + if not ifnil(object_.XmlChildBody) then + {self.}XmlChildBody := new BodyUnitDecorator(object_.XmlChildBody); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/DrawingUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/DrawingUnitDecorator@DOCX.tsf index 0e6b816..fbda7da 100644 --- a/autoclass/decorator/docx/DrawingUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/DrawingUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function DrawingUnitDecorator.Convert(); begin - {self.}_Inline := new _InlineUnitDecorator(object_._Inline); - {self.}Anchor := new AnchorUnitDecorator(object_.Anchor); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChild_Inline) then + {self.}XmlChild_Inline := new _InlineUnitDecorator(object_.XmlChild_Inline); + if not ifnil(object_.XmlChildAnchor) then + {self.}XmlChildAnchor := new AnchorUnitDecorator(object_.XmlChildAnchor); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/EffectExtentUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/EffectExtentUnitDecorator@DOCX.tsf index d1048e6..4b52931 100644 --- a/autoclass/decorator/docx/EffectExtentUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/EffectExtentUnitDecorator@DOCX.tsf @@ -22,8 +22,15 @@ end; function EffectExtentUnitDecorator.Convert(); begin - {self.}XmlAttrL.Value := object_.XmlAttrL.Value; - {self.}XmlAttrT.Value := object_.XmlAttrT.Value; - {self.}XmlAttrR.Value := object_.XmlAttrR.Value; - {self.}XmlAttrB.Value := object_.XmlAttrB.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrL) then + {self.}L := object_.XmlAttrL.Value; + if not ifnil(object_.XmlAttrT) then + {self.}T := object_.XmlAttrT.Value; + if not ifnil(object_.XmlAttrR) then + {self.}R := object_.XmlAttrR.Value; + if not ifnil(object_.XmlAttrB) then + {self.}B := object_.XmlAttrB.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/EffectLstUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/EffectLstUnitDecorator@DOCX.tsf index 62b7741..194c8c5 100644 --- a/autoclass/decorator/docx/EffectLstUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/EffectLstUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function EffectLstUnitDecorator.Convert(); begin - {self.}OuterShdw := new OuterShdwUnitDecorator(object_.OuterShdw); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildOuterShdw) then + {self.}XmlChildOuterShdw := new OuterShdwUnitDecorator(object_.XmlChildOuterShdw); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/EffectStyleLstUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/EffectStyleLstUnitDecorator@DOCX.tsf index 69dba64..b8f09da 100644 --- a/autoclass/decorator/docx/EffectStyleLstUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/EffectStyleLstUnitDecorator@DOCX.tsf @@ -22,4 +22,7 @@ end; function EffectStyleLstUnitDecorator.Convert(); begin + tslassigning_backup := tslassigning; + tslassigning := 1; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/EffectStyleUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/EffectStyleUnitDecorator@DOCX.tsf index cc43b9e..28e1e79 100644 --- a/autoclass/decorator/docx/EffectStyleUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/EffectStyleUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function EffectStyleUnitDecorator.Convert(); begin - {self.}EffectLst := new EffectLstUnitDecorator(object_.EffectLst); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildEffectLst) then + {self.}XmlChildEffectLst := new EffectLstUnitDecorator(object_.XmlChildEffectLst); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/EndnotePrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/EndnotePrUnitDecorator@DOCX.tsf index 3c371e8..d9515e7 100644 --- a/autoclass/decorator/docx/EndnotePrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/EndnotePrUnitDecorator@DOCX.tsf @@ -22,4 +22,7 @@ end; function EndnotePrUnitDecorator.Convert(); begin + tslassigning_backup := tslassigning; + tslassigning := 1; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/EndnoteUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/EndnoteUnitDecorator@DOCX.tsf index 1cb74e9..1128446 100644 --- a/autoclass/decorator/docx/EndnoteUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/EndnoteUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function EndnoteUnitDecorator.Convert(); begin - {self.}XmlAttrType.Value := object_.XmlAttrType.Value; - {self.}XmlAttrId.Value := object_.XmlAttrId.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrType) then + {self.}Type := object_.XmlAttrType.Value; + if not ifnil(object_.XmlAttrId) then + {self.}Id := object_.XmlAttrId.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/EndnotesUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/EndnotesUnitDecorator@DOCX.tsf index 3ac5c74..75485ed 100644 --- a/autoclass/decorator/docx/EndnotesUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/EndnotesUnitDecorator@DOCX.tsf @@ -22,37 +22,73 @@ end; function EndnotesUnitDecorator.Convert(); begin - {self.}XmlAttrXmlnsWpc.Value := object_.XmlAttrXmlnsWpc.Value; - {self.}XmlAttrXmlnsCx.Value := object_.XmlAttrXmlnsCx.Value; - {self.}XmlAttrXmlnsCx1.Value := object_.XmlAttrXmlnsCx1.Value; - {self.}XmlAttrXmlnsCx2.Value := object_.XmlAttrXmlnsCx2.Value; - {self.}XmlAttrXmlnsCx3.Value := object_.XmlAttrXmlnsCx3.Value; - {self.}XmlAttrXmlnsCx4.Value := object_.XmlAttrXmlnsCx4.Value; - {self.}XmlAttrXmlnsCx5.Value := object_.XmlAttrXmlnsCx5.Value; - {self.}XmlAttrXmlnsCx6.Value := object_.XmlAttrXmlnsCx6.Value; - {self.}XmlAttrXmlnsCx7.Value := object_.XmlAttrXmlnsCx7.Value; - {self.}XmlAttrXmlnsCx8.Value := object_.XmlAttrXmlnsCx8.Value; - {self.}XmlAttrXmlnsMc.Value := object_.XmlAttrXmlnsMc.Value; - {self.}XmlAttrXmlnsAink.Value := object_.XmlAttrXmlnsAink.Value; - {self.}XmlAttrXmlnsAm3d.Value := object_.XmlAttrXmlnsAm3d.Value; - {self.}XmlAttrXmlnsO.Value := object_.XmlAttrXmlnsO.Value; - {self.}XmlAttrXmlnsOel.Value := object_.XmlAttrXmlnsOel.Value; - {self.}XmlAttrXmlnsR.Value := object_.XmlAttrXmlnsR.Value; - {self.}XmlAttrXmlnsM.Value := object_.XmlAttrXmlnsM.Value; - {self.}XmlAttrXmlnsV.Value := object_.XmlAttrXmlnsV.Value; - {self.}XmlAttrXmlnsWp14.Value := object_.XmlAttrXmlnsWp14.Value; - {self.}XmlAttrXmlnsWp.Value := object_.XmlAttrXmlnsWp.Value; - {self.}XmlAttrXmlnsW14.Value := object_.XmlAttrXmlnsW14.Value; - {self.}XmlAttrXmlnsW15.Value := object_.XmlAttrXmlnsW15.Value; - {self.}XmlAttrXmlnsW16Cex.Value := object_.XmlAttrXmlnsW16Cex.Value; - {self.}XmlAttrXmlnsW16Cid.Value := object_.XmlAttrXmlnsW16Cid.Value; - {self.}XmlAttrXmlnsW16.Value := object_.XmlAttrXmlnsW16.Value; - {self.}XmlAttrXmlnsW16Du.Value := object_.XmlAttrXmlnsW16Du.Value; - {self.}XmlAttrXmlnsW16sdtdh.Value := object_.XmlAttrXmlnsW16sdtdh.Value; - {self.}XmlAttrXmlnsW16se.Value := object_.XmlAttrXmlnsW16se.Value; - {self.}XmlAttrXmlnsWpg.Value := object_.XmlAttrXmlnsWpg.Value; - {self.}XmlAttrXmlnsWpi.Value := object_.XmlAttrXmlnsWpi.Value; - {self.}XmlAttrXmlnsWne.Value := object_.XmlAttrXmlnsWne.Value; - {self.}XmlAttrXmlnsWps.Value := object_.XmlAttrXmlnsWps.Value; - {self.}XmlAttrMcIgnorable.Value := object_.XmlAttrMcIgnorable.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXmlnsWpc) then + {self.}XmlnsWpc := object_.XmlAttrXmlnsWpc.Value; + if not ifnil(object_.XmlAttrXmlnsCx) then + {self.}XmlnsCx := object_.XmlAttrXmlnsCx.Value; + if not ifnil(object_.XmlAttrXmlnsCx1) then + {self.}XmlnsCx1 := object_.XmlAttrXmlnsCx1.Value; + if not ifnil(object_.XmlAttrXmlnsCx2) then + {self.}XmlnsCx2 := object_.XmlAttrXmlnsCx2.Value; + if not ifnil(object_.XmlAttrXmlnsCx3) then + {self.}XmlnsCx3 := object_.XmlAttrXmlnsCx3.Value; + if not ifnil(object_.XmlAttrXmlnsCx4) then + {self.}XmlnsCx4 := object_.XmlAttrXmlnsCx4.Value; + if not ifnil(object_.XmlAttrXmlnsCx5) then + {self.}XmlnsCx5 := object_.XmlAttrXmlnsCx5.Value; + if not ifnil(object_.XmlAttrXmlnsCx6) then + {self.}XmlnsCx6 := object_.XmlAttrXmlnsCx6.Value; + if not ifnil(object_.XmlAttrXmlnsCx7) then + {self.}XmlnsCx7 := object_.XmlAttrXmlnsCx7.Value; + if not ifnil(object_.XmlAttrXmlnsCx8) then + {self.}XmlnsCx8 := object_.XmlAttrXmlnsCx8.Value; + if not ifnil(object_.XmlAttrXmlnsMc) then + {self.}XmlnsMc := object_.XmlAttrXmlnsMc.Value; + if not ifnil(object_.XmlAttrXmlnsAink) then + {self.}XmlnsAink := object_.XmlAttrXmlnsAink.Value; + if not ifnil(object_.XmlAttrXmlnsAm3d) then + {self.}XmlnsAm3d := object_.XmlAttrXmlnsAm3d.Value; + if not ifnil(object_.XmlAttrXmlnsO) then + {self.}XmlnsO := object_.XmlAttrXmlnsO.Value; + if not ifnil(object_.XmlAttrXmlnsOel) then + {self.}XmlnsOel := object_.XmlAttrXmlnsOel.Value; + if not ifnil(object_.XmlAttrXmlnsR) then + {self.}XmlnsR := object_.XmlAttrXmlnsR.Value; + if not ifnil(object_.XmlAttrXmlnsM) then + {self.}XmlnsM := object_.XmlAttrXmlnsM.Value; + if not ifnil(object_.XmlAttrXmlnsV) then + {self.}XmlnsV := object_.XmlAttrXmlnsV.Value; + if not ifnil(object_.XmlAttrXmlnsWp14) then + {self.}XmlnsWp14 := object_.XmlAttrXmlnsWp14.Value; + if not ifnil(object_.XmlAttrXmlnsWp) then + {self.}XmlnsWp := object_.XmlAttrXmlnsWp.Value; + if not ifnil(object_.XmlAttrXmlnsW14) then + {self.}XmlnsW14 := object_.XmlAttrXmlnsW14.Value; + if not ifnil(object_.XmlAttrXmlnsW15) then + {self.}XmlnsW15 := object_.XmlAttrXmlnsW15.Value; + if not ifnil(object_.XmlAttrXmlnsW16Cex) then + {self.}XmlnsW16Cex := object_.XmlAttrXmlnsW16Cex.Value; + if not ifnil(object_.XmlAttrXmlnsW16Cid) then + {self.}XmlnsW16Cid := object_.XmlAttrXmlnsW16Cid.Value; + if not ifnil(object_.XmlAttrXmlnsW16) then + {self.}XmlnsW16 := object_.XmlAttrXmlnsW16.Value; + if not ifnil(object_.XmlAttrXmlnsW16Du) then + {self.}XmlnsW16Du := object_.XmlAttrXmlnsW16Du.Value; + if not ifnil(object_.XmlAttrXmlnsW16sdtdh) then + {self.}XmlnsW16sdtdh := object_.XmlAttrXmlnsW16sdtdh.Value; + if not ifnil(object_.XmlAttrXmlnsW16se) then + {self.}XmlnsW16se := object_.XmlAttrXmlnsW16se.Value; + if not ifnil(object_.XmlAttrXmlnsWpg) then + {self.}XmlnsWpg := object_.XmlAttrXmlnsWpg.Value; + if not ifnil(object_.XmlAttrXmlnsWpi) then + {self.}XmlnsWpi := object_.XmlAttrXmlnsWpi.Value; + if not ifnil(object_.XmlAttrXmlnsWne) then + {self.}XmlnsWne := object_.XmlAttrXmlnsWne.Value; + if not ifnil(object_.XmlAttrXmlnsWps) then + {self.}XmlnsWps := object_.XmlAttrXmlnsWps.Value; + if not ifnil(object_.XmlAttrMcIgnorable) then + {self.}McIgnorable := object_.XmlAttrMcIgnorable.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ExtLstUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ExtLstUnitDecorator@DOCX.tsf index a4ac7fc..e566a1f 100644 --- a/autoclass/decorator/docx/ExtLstUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ExtLstUnitDecorator@DOCX.tsf @@ -22,4 +22,7 @@ end; function ExtLstUnitDecorator.Convert(); begin + tslassigning_backup := tslassigning; + tslassigning := 1; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ExtUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ExtUnitDecorator@DOCX.tsf index 0e94a52..c420e00 100644 --- a/autoclass/decorator/docx/ExtUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ExtUnitDecorator@DOCX.tsf @@ -22,8 +22,15 @@ end; function ExtUnitDecorator.Convert(); begin - {self.}XmlAttrUri.Value := object_.XmlAttrUri.Value; - {self.}XmlAttrXmlnsC16.Value := object_.XmlAttrXmlnsC16.Value; - {self.}Thm15ThemeFamily := new ThemeFamilyUnitDecorator(object_.Thm15ThemeFamily); - {self.}UniqueId := new PureValUnitDecorator(object_.UniqueId); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrUri) then + {self.}Uri := object_.XmlAttrUri.Value; + if not ifnil(object_.XmlAttrXmlnsC16) then + {self.}XmlnsC16 := object_.XmlAttrXmlnsC16.Value; + if not ifnil(object_.XmlChildThm15ThemeFamily) then + {self.}XmlChildThm15ThemeFamily := new ThemeFamilyUnitDecorator(object_.XmlChildThm15ThemeFamily); + if not ifnil(object_.XmlChildUniqueId) then + {self.}XmlChildUniqueId := new PureValUnitDecorator(object_.XmlChildUniqueId); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ExternalDataUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ExternalDataUnitDecorator@DOCX.tsf index 56df699..7fd2121 100644 --- a/autoclass/decorator/docx/ExternalDataUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ExternalDataUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function ExternalDataUnitDecorator.Convert(); begin - {self.}XmlAttrId.Value := object_.XmlAttrId.Value; - {self.}AutoUpdate := new PureValUnitDecorator(object_.AutoUpdate); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrId) then + {self.}Id := object_.XmlAttrId.Value; + if not ifnil(object_.XmlChildAutoUpdate) then + {self.}XmlChildAutoUpdate := new PureValUnitDecorator(object_.XmlChildAutoUpdate); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/FallbackUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/FallbackUnitDecorator@DOCX.tsf index d58c554..5486255 100644 --- a/autoclass/decorator/docx/FallbackUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/FallbackUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function FallbackUnitDecorator.Convert(); begin - {self.}Style := new PureValUnitDecorator(object_.Style); - {self.}Pict := new PictUnitDecorator(object_.Pict); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildStyle) then + {self.}XmlChildStyle := new PureValUnitDecorator(object_.XmlChildStyle); + if not ifnil(object_.XmlChildPict) then + {self.}XmlChildPict := new PictUnitDecorator(object_.XmlChildPict); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/FillStyleLstUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/FillStyleLstUnitDecorator@DOCX.tsf index 5a13d4a..73e0c9c 100644 --- a/autoclass/decorator/docx/FillStyleLstUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/FillStyleLstUnitDecorator@DOCX.tsf @@ -22,4 +22,7 @@ end; function FillStyleLstUnitDecorator.Convert(); begin + tslassigning_backup := tslassigning; + tslassigning := 1; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/FldCharUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/FldCharUnitDecorator@DOCX.tsf index 3183ca6..d26841d 100644 --- a/autoclass/decorator/docx/FldCharUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/FldCharUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function FldCharUnitDecorator.Convert(); begin - {self.}XmlAttrFldCharType.Value := object_.XmlAttrFldCharType.Value; - {self.}XmlAttrDirty.Value := object_.XmlAttrDirty.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrFldCharType) then + {self.}FldCharType := object_.XmlAttrFldCharType.Value; + if not ifnil(object_.XmlAttrDirty) then + {self.}Dirty := object_.XmlAttrDirty.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/FldSimpleUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/FldSimpleUnitDecorator@DOCX.tsf index edb0909..34e7321 100644 --- a/autoclass/decorator/docx/FldSimpleUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/FldSimpleUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function FldSimpleUnitDecorator.Convert(); begin - {self.}XmlAttrInstr.Value := object_.XmlAttrInstr.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrInstr) then + {self.}Instr := object_.XmlAttrInstr.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/FmtSchemeUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/FmtSchemeUnitDecorator@DOCX.tsf index 5265397..c0c9ce5 100644 --- a/autoclass/decorator/docx/FmtSchemeUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/FmtSchemeUnitDecorator@DOCX.tsf @@ -22,9 +22,17 @@ end; function FmtSchemeUnitDecorator.Convert(); begin - {self.}XmlAttrName.Value := object_.XmlAttrName.Value; - {self.}FillStyleLst := new FillStyleLstUnitDecorator(object_.FillStyleLst); - {self.}LnStyleLst := new LnStyleLstUnitDecorator(object_.LnStyleLst); - {self.}EffectStyleLst := new EffectStyleLstUnitDecorator(object_.EffectStyleLst); - {self.}BgFillStyleLst := new FillStyleLstUnitDecorator(object_.BgFillStyleLst); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrName) then + {self.}Name := object_.XmlAttrName.Value; + if not ifnil(object_.XmlChildFillStyleLst) then + {self.}XmlChildFillStyleLst := new FillStyleLstUnitDecorator(object_.XmlChildFillStyleLst); + if not ifnil(object_.XmlChildLnStyleLst) then + {self.}XmlChildLnStyleLst := new LnStyleLstUnitDecorator(object_.XmlChildLnStyleLst); + if not ifnil(object_.XmlChildEffectStyleLst) then + {self.}XmlChildEffectStyleLst := new EffectStyleLstUnitDecorator(object_.XmlChildEffectStyleLst); + if not ifnil(object_.XmlChildBgFillStyleLst) then + {self.}XmlChildBgFillStyleLst := new FillStyleLstUnitDecorator(object_.XmlChildBgFillStyleLst); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/FontSchemeUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/FontSchemeUnitDecorator@DOCX.tsf index 2237689..85da6d1 100644 --- a/autoclass/decorator/docx/FontSchemeUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/FontSchemeUnitDecorator@DOCX.tsf @@ -22,7 +22,13 @@ end; function FontSchemeUnitDecorator.Convert(); begin - {self.}XmlAttrName.Value := object_.XmlAttrName.Value; - {self.}Majorfont := new MfontUnitDecorator(object_.Majorfont); - {self.}Minorfont := new MfontUnitDecorator(object_.Minorfont); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrName) then + {self.}Name := object_.XmlAttrName.Value; + if not ifnil(object_.XmlChildMajorfont) then + {self.}XmlChildMajorfont := new MfontUnitDecorator(object_.XmlChildMajorfont); + if not ifnil(object_.XmlChildMinorfont) then + {self.}XmlChildMinorfont := new MfontUnitDecorator(object_.XmlChildMinorfont); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/FontUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/FontUnitDecorator@DOCX.tsf index 5088e1f..5ab76e0 100644 --- a/autoclass/decorator/docx/FontUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/FontUnitDecorator@DOCX.tsf @@ -22,11 +22,21 @@ end; function FontUnitDecorator.Convert(); begin - {self.}XmlAttrName.Value := object_.XmlAttrName.Value; - {self.}AltName := new PureWValUnitDecorator(object_.AltName); - {self.}Panosel := new PureWValUnitDecorator(object_.Panosel); - {self.}Charset := new PureWValUnitDecorator(object_.Charset); - {self.}Family := new PureWValUnitDecorator(object_.Family); - {self.}Pitch := new PureWValUnitDecorator(object_.Pitch); - {self.}Sig := new SigUnitDecorator(object_.Sig); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrName) then + {self.}Name := object_.XmlAttrName.Value; + if not ifnil(object_.XmlChildAltName) then + {self.}XmlChildAltName := new PureWValUnitDecorator(object_.XmlChildAltName); + if not ifnil(object_.XmlChildPanosel) then + {self.}XmlChildPanosel := new PureWValUnitDecorator(object_.XmlChildPanosel); + if not ifnil(object_.XmlChildCharset) then + {self.}XmlChildCharset := new PureWValUnitDecorator(object_.XmlChildCharset); + if not ifnil(object_.XmlChildFamily) then + {self.}XmlChildFamily := new PureWValUnitDecorator(object_.XmlChildFamily); + if not ifnil(object_.XmlChildPitch) then + {self.}XmlChildPitch := new PureWValUnitDecorator(object_.XmlChildPitch); + if not ifnil(object_.XmlChildSig) then + {self.}XmlChildSig := new SigUnitDecorator(object_.XmlChildSig); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/FontsUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/FontsUnitDecorator@DOCX.tsf index 3921ce1..aa0fd2e 100644 --- a/autoclass/decorator/docx/FontsUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/FontsUnitDecorator@DOCX.tsf @@ -22,16 +22,31 @@ end; function FontsUnitDecorator.Convert(); begin - {self.}XmlAttrXmlnsMc.Value := object_.XmlAttrXmlnsMc.Value; - {self.}XmlAttrXmlnsR.Value := object_.XmlAttrXmlnsR.Value; - {self.}XmlAttrXmlnsW.Value := object_.XmlAttrXmlnsW.Value; - {self.}XmlAttrXmlnsW14.Value := object_.XmlAttrXmlnsW14.Value; - {self.}XmlAttrXmlnsW15.Value := object_.XmlAttrXmlnsW15.Value; - {self.}XmlAttrXmlnsW16Cex.Value := object_.XmlAttrXmlnsW16Cex.Value; - {self.}XmlAttrXmlnsW16Cid.Value := object_.XmlAttrXmlnsW16Cid.Value; - {self.}XmlAttrXmlnsW16.Value := object_.XmlAttrXmlnsW16.Value; - {self.}XmlAttrXmlnsW16Du.Value := object_.XmlAttrXmlnsW16Du.Value; - {self.}XmlAttrXmlnsW16sdtdh.Value := object_.XmlAttrXmlnsW16sdtdh.Value; - {self.}XmlAttrXmlnsW16se.Value := object_.XmlAttrXmlnsW16se.Value; - {self.}XmlAttrMcIgnorable.Value := object_.XmlAttrMcIgnorable.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXmlnsMc) then + {self.}XmlnsMc := object_.XmlAttrXmlnsMc.Value; + if not ifnil(object_.XmlAttrXmlnsR) then + {self.}XmlnsR := object_.XmlAttrXmlnsR.Value; + if not ifnil(object_.XmlAttrXmlnsW) then + {self.}XmlnsW := object_.XmlAttrXmlnsW.Value; + if not ifnil(object_.XmlAttrXmlnsW14) then + {self.}XmlnsW14 := object_.XmlAttrXmlnsW14.Value; + if not ifnil(object_.XmlAttrXmlnsW15) then + {self.}XmlnsW15 := object_.XmlAttrXmlnsW15.Value; + if not ifnil(object_.XmlAttrXmlnsW16Cex) then + {self.}XmlnsW16Cex := object_.XmlAttrXmlnsW16Cex.Value; + if not ifnil(object_.XmlAttrXmlnsW16Cid) then + {self.}XmlnsW16Cid := object_.XmlAttrXmlnsW16Cid.Value; + if not ifnil(object_.XmlAttrXmlnsW16) then + {self.}XmlnsW16 := object_.XmlAttrXmlnsW16.Value; + if not ifnil(object_.XmlAttrXmlnsW16Du) then + {self.}XmlnsW16Du := object_.XmlAttrXmlnsW16Du.Value; + if not ifnil(object_.XmlAttrXmlnsW16sdtdh) then + {self.}XmlnsW16sdtdh := object_.XmlAttrXmlnsW16sdtdh.Value; + if not ifnil(object_.XmlAttrXmlnsW16se) then + {self.}XmlnsW16se := object_.XmlAttrXmlnsW16se.Value; + if not ifnil(object_.XmlAttrMcIgnorable) then + {self.}McIgnorable := object_.XmlAttrMcIgnorable.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/FootnotePrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/FootnotePrUnitDecorator@DOCX.tsf index 7ed7b4e..e2f7980 100644 --- a/autoclass/decorator/docx/FootnotePrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/FootnotePrUnitDecorator@DOCX.tsf @@ -22,4 +22,13 @@ end; function FootnotePrUnitDecorator.Convert(); begin + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildPos) then + {self.}XmlChildPos := new PureWValUnitDecorator(object_.XmlChildPos); + if not ifnil(object_.XmlChildNumFmt) then + {self.}XmlChildNumFmt := new PureWValUnitDecorator(object_.XmlChildNumFmt); + if not ifnil(object_.XmlChildNumStart) then + {self.}XmlChildNumStart := new PureWValUnitDecorator(object_.XmlChildNumStart); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/FootnoteUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/FootnoteUnitDecorator@DOCX.tsf index 4a74f22..8ec718f 100644 --- a/autoclass/decorator/docx/FootnoteUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/FootnoteUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function FootnoteUnitDecorator.Convert(); begin - {self.}XmlAttrType.Value := object_.XmlAttrType.Value; - {self.}XmlAttrId.Value := object_.XmlAttrId.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrType) then + {self.}Type := object_.XmlAttrType.Value; + if not ifnil(object_.XmlAttrId) then + {self.}Id := object_.XmlAttrId.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/FootnotesUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/FootnotesUnitDecorator@DOCX.tsf index 6e7e9b8..f8588b2 100644 --- a/autoclass/decorator/docx/FootnotesUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/FootnotesUnitDecorator@DOCX.tsf @@ -22,37 +22,73 @@ end; function FootnotesUnitDecorator.Convert(); begin - {self.}XmlAttrXmlnsWpc.Value := object_.XmlAttrXmlnsWpc.Value; - {self.}XmlAttrXmlnsCx.Value := object_.XmlAttrXmlnsCx.Value; - {self.}XmlAttrXmlnsCx1.Value := object_.XmlAttrXmlnsCx1.Value; - {self.}XmlAttrXmlnsCx2.Value := object_.XmlAttrXmlnsCx2.Value; - {self.}XmlAttrXmlnsCx3.Value := object_.XmlAttrXmlnsCx3.Value; - {self.}XmlAttrXmlnsCx4.Value := object_.XmlAttrXmlnsCx4.Value; - {self.}XmlAttrXmlnsCx5.Value := object_.XmlAttrXmlnsCx5.Value; - {self.}XmlAttrXmlnsCx6.Value := object_.XmlAttrXmlnsCx6.Value; - {self.}XmlAttrXmlnsCx7.Value := object_.XmlAttrXmlnsCx7.Value; - {self.}XmlAttrXmlnsCx8.Value := object_.XmlAttrXmlnsCx8.Value; - {self.}XmlAttrXmlnsMc.Value := object_.XmlAttrXmlnsMc.Value; - {self.}XmlAttrXmlnsAink.Value := object_.XmlAttrXmlnsAink.Value; - {self.}XmlAttrXmlnsAm3d.Value := object_.XmlAttrXmlnsAm3d.Value; - {self.}XmlAttrXmlnsO.Value := object_.XmlAttrXmlnsO.Value; - {self.}XmlAttrXmlnsOel.Value := object_.XmlAttrXmlnsOel.Value; - {self.}XmlAttrXmlnsR.Value := object_.XmlAttrXmlnsR.Value; - {self.}XmlAttrXmlnsM.Value := object_.XmlAttrXmlnsM.Value; - {self.}XmlAttrXmlnsV.Value := object_.XmlAttrXmlnsV.Value; - {self.}XmlAttrXmlnsWp14.Value := object_.XmlAttrXmlnsWp14.Value; - {self.}XmlAttrXmlnsWp.Value := object_.XmlAttrXmlnsWp.Value; - {self.}XmlAttrXmlnsW14.Value := object_.XmlAttrXmlnsW14.Value; - {self.}XmlAttrXmlnsW15.Value := object_.XmlAttrXmlnsW15.Value; - {self.}XmlAttrXmlnsW16Cex.Value := object_.XmlAttrXmlnsW16Cex.Value; - {self.}XmlAttrXmlnsW16Cid.Value := object_.XmlAttrXmlnsW16Cid.Value; - {self.}XmlAttrXmlnsW16.Value := object_.XmlAttrXmlnsW16.Value; - {self.}XmlAttrXmlnsW16Du.Value := object_.XmlAttrXmlnsW16Du.Value; - {self.}XmlAttrXmlnsW16sdtdh.Value := object_.XmlAttrXmlnsW16sdtdh.Value; - {self.}XmlAttrXmlnsW16se.Value := object_.XmlAttrXmlnsW16se.Value; - {self.}XmlAttrXmlnsWpg.Value := object_.XmlAttrXmlnsWpg.Value; - {self.}XmlAttrXmlnsWpi.Value := object_.XmlAttrXmlnsWpi.Value; - {self.}XmlAttrXmlnsWne.Value := object_.XmlAttrXmlnsWne.Value; - {self.}XmlAttrXmlnsWps.Value := object_.XmlAttrXmlnsWps.Value; - {self.}XmlAttrMcIgnorable.Value := object_.XmlAttrMcIgnorable.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXmlnsWpc) then + {self.}XmlnsWpc := object_.XmlAttrXmlnsWpc.Value; + if not ifnil(object_.XmlAttrXmlnsCx) then + {self.}XmlnsCx := object_.XmlAttrXmlnsCx.Value; + if not ifnil(object_.XmlAttrXmlnsCx1) then + {self.}XmlnsCx1 := object_.XmlAttrXmlnsCx1.Value; + if not ifnil(object_.XmlAttrXmlnsCx2) then + {self.}XmlnsCx2 := object_.XmlAttrXmlnsCx2.Value; + if not ifnil(object_.XmlAttrXmlnsCx3) then + {self.}XmlnsCx3 := object_.XmlAttrXmlnsCx3.Value; + if not ifnil(object_.XmlAttrXmlnsCx4) then + {self.}XmlnsCx4 := object_.XmlAttrXmlnsCx4.Value; + if not ifnil(object_.XmlAttrXmlnsCx5) then + {self.}XmlnsCx5 := object_.XmlAttrXmlnsCx5.Value; + if not ifnil(object_.XmlAttrXmlnsCx6) then + {self.}XmlnsCx6 := object_.XmlAttrXmlnsCx6.Value; + if not ifnil(object_.XmlAttrXmlnsCx7) then + {self.}XmlnsCx7 := object_.XmlAttrXmlnsCx7.Value; + if not ifnil(object_.XmlAttrXmlnsCx8) then + {self.}XmlnsCx8 := object_.XmlAttrXmlnsCx8.Value; + if not ifnil(object_.XmlAttrXmlnsMc) then + {self.}XmlnsMc := object_.XmlAttrXmlnsMc.Value; + if not ifnil(object_.XmlAttrXmlnsAink) then + {self.}XmlnsAink := object_.XmlAttrXmlnsAink.Value; + if not ifnil(object_.XmlAttrXmlnsAm3d) then + {self.}XmlnsAm3d := object_.XmlAttrXmlnsAm3d.Value; + if not ifnil(object_.XmlAttrXmlnsO) then + {self.}XmlnsO := object_.XmlAttrXmlnsO.Value; + if not ifnil(object_.XmlAttrXmlnsOel) then + {self.}XmlnsOel := object_.XmlAttrXmlnsOel.Value; + if not ifnil(object_.XmlAttrXmlnsR) then + {self.}XmlnsR := object_.XmlAttrXmlnsR.Value; + if not ifnil(object_.XmlAttrXmlnsM) then + {self.}XmlnsM := object_.XmlAttrXmlnsM.Value; + if not ifnil(object_.XmlAttrXmlnsV) then + {self.}XmlnsV := object_.XmlAttrXmlnsV.Value; + if not ifnil(object_.XmlAttrXmlnsWp14) then + {self.}XmlnsWp14 := object_.XmlAttrXmlnsWp14.Value; + if not ifnil(object_.XmlAttrXmlnsWp) then + {self.}XmlnsWp := object_.XmlAttrXmlnsWp.Value; + if not ifnil(object_.XmlAttrXmlnsW14) then + {self.}XmlnsW14 := object_.XmlAttrXmlnsW14.Value; + if not ifnil(object_.XmlAttrXmlnsW15) then + {self.}XmlnsW15 := object_.XmlAttrXmlnsW15.Value; + if not ifnil(object_.XmlAttrXmlnsW16Cex) then + {self.}XmlnsW16Cex := object_.XmlAttrXmlnsW16Cex.Value; + if not ifnil(object_.XmlAttrXmlnsW16Cid) then + {self.}XmlnsW16Cid := object_.XmlAttrXmlnsW16Cid.Value; + if not ifnil(object_.XmlAttrXmlnsW16) then + {self.}XmlnsW16 := object_.XmlAttrXmlnsW16.Value; + if not ifnil(object_.XmlAttrXmlnsW16Du) then + {self.}XmlnsW16Du := object_.XmlAttrXmlnsW16Du.Value; + if not ifnil(object_.XmlAttrXmlnsW16sdtdh) then + {self.}XmlnsW16sdtdh := object_.XmlAttrXmlnsW16sdtdh.Value; + if not ifnil(object_.XmlAttrXmlnsW16se) then + {self.}XmlnsW16se := object_.XmlAttrXmlnsW16se.Value; + if not ifnil(object_.XmlAttrXmlnsWpg) then + {self.}XmlnsWpg := object_.XmlAttrXmlnsWpg.Value; + if not ifnil(object_.XmlAttrXmlnsWpi) then + {self.}XmlnsWpi := object_.XmlAttrXmlnsWpi.Value; + if not ifnil(object_.XmlAttrXmlnsWne) then + {self.}XmlnsWne := object_.XmlAttrXmlnsWne.Value; + if not ifnil(object_.XmlAttrXmlnsWps) then + {self.}XmlnsWps := object_.XmlAttrXmlnsWps.Value; + if not ifnil(object_.XmlAttrMcIgnorable) then + {self.}McIgnorable := object_.XmlAttrMcIgnorable.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/FtrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/FtrUnitDecorator@DOCX.tsf index f062218..64356c5 100644 --- a/autoclass/decorator/docx/FtrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/FtrUnitDecorator@DOCX.tsf @@ -22,19 +22,37 @@ end; function FtrUnitDecorator.Convert(); begin - {self.}XmlAttrXmlnsM.Value := object_.XmlAttrXmlnsM.Value; - {self.}XmlAttrXmlnsMc.Value := object_.XmlAttrXmlnsMc.Value; - {self.}XmlAttrXmlnsMo.Value := object_.XmlAttrXmlnsMo.Value; - {self.}XmlAttrXmlnsR.Value := object_.XmlAttrXmlnsR.Value; - {self.}XmlAttrXmlnsV.Value := object_.XmlAttrXmlnsV.Value; - {self.}XmlAttrXmlnsW14.Value := object_.XmlAttrXmlnsW14.Value; - {self.}XmlAttrXmlnsW.Value := object_.XmlAttrXmlnsW.Value; - {self.}XmlAttrXmlnsWne.Value := object_.XmlAttrXmlnsWne.Value; - {self.}XmlAttrXmlnsWp14.Value := object_.XmlAttrXmlnsWp14.Value; - {self.}XmlAttrXmlnsWp.Value := object_.XmlAttrXmlnsWp.Value; - {self.}XmlAttrXmlnsWpc.Value := object_.XmlAttrXmlnsWpc.Value; - {self.}XmlAttrXmlnsWpg.Value := object_.XmlAttrXmlnsWpg.Value; - {self.}XmlAttrXmlnsWpi.Value := object_.XmlAttrXmlnsWpi.Value; - {self.}XmlAttrXmlnsWps.Value := object_.XmlAttrXmlnsWps.Value; - {self.}XmlAttrMcIgnorable.Value := object_.XmlAttrMcIgnorable.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXmlnsM) then + {self.}XmlnsM := object_.XmlAttrXmlnsM.Value; + if not ifnil(object_.XmlAttrXmlnsMc) then + {self.}XmlnsMc := object_.XmlAttrXmlnsMc.Value; + if not ifnil(object_.XmlAttrXmlnsMo) then + {self.}XmlnsMo := object_.XmlAttrXmlnsMo.Value; + if not ifnil(object_.XmlAttrXmlnsR) then + {self.}XmlnsR := object_.XmlAttrXmlnsR.Value; + if not ifnil(object_.XmlAttrXmlnsV) then + {self.}XmlnsV := object_.XmlAttrXmlnsV.Value; + if not ifnil(object_.XmlAttrXmlnsW14) then + {self.}XmlnsW14 := object_.XmlAttrXmlnsW14.Value; + if not ifnil(object_.XmlAttrXmlnsW) then + {self.}XmlnsW := object_.XmlAttrXmlnsW.Value; + if not ifnil(object_.XmlAttrXmlnsWne) then + {self.}XmlnsWne := object_.XmlAttrXmlnsWne.Value; + if not ifnil(object_.XmlAttrXmlnsWp14) then + {self.}XmlnsWp14 := object_.XmlAttrXmlnsWp14.Value; + if not ifnil(object_.XmlAttrXmlnsWp) then + {self.}XmlnsWp := object_.XmlAttrXmlnsWp.Value; + if not ifnil(object_.XmlAttrXmlnsWpc) then + {self.}XmlnsWpc := object_.XmlAttrXmlnsWpc.Value; + if not ifnil(object_.XmlAttrXmlnsWpg) then + {self.}XmlnsWpg := object_.XmlAttrXmlnsWpg.Value; + if not ifnil(object_.XmlAttrXmlnsWpi) then + {self.}XmlnsWpi := object_.XmlAttrXmlnsWpi.Value; + if not ifnil(object_.XmlAttrXmlnsWps) then + {self.}XmlnsWps := object_.XmlAttrXmlnsWps.Value; + if not ifnil(object_.XmlAttrMcIgnorable) then + {self.}McIgnorable := object_.XmlAttrMcIgnorable.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/GradFillUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/GradFillUnitDecorator@DOCX.tsf index 4d07338..682686b 100644 --- a/autoclass/decorator/docx/GradFillUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/GradFillUnitDecorator@DOCX.tsf @@ -22,7 +22,13 @@ end; function GradFillUnitDecorator.Convert(); begin - {self.}XmlAttrRotWithShape.Value := object_.XmlAttrRotWithShape.Value; - {self.}GsLst := new GsLstUnitDecorator(object_.GsLst); - {self.}Lin := new LinUnitDecorator(object_.Lin); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrRotWithShape) then + {self.}RotWithShape := object_.XmlAttrRotWithShape.Value; + if not ifnil(object_.XmlChildGsLst) then + {self.}XmlChildGsLst := new GsLstUnitDecorator(object_.XmlChildGsLst); + if not ifnil(object_.XmlChildLin) then + {self.}XmlChildLin := new LinUnitDecorator(object_.XmlChildLin); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/GraphicDataUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/GraphicDataUnitDecorator@DOCX.tsf index 1df5488..80211d5 100644 --- a/autoclass/decorator/docx/GraphicDataUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/GraphicDataUnitDecorator@DOCX.tsf @@ -22,8 +22,15 @@ end; function GraphicDataUnitDecorator.Convert(); begin - {self.}XmlAttrUri.Value := object_.XmlAttrUri.Value; - {self.}Pic := new PicUnitDecorator(object_.Pic); - {self.}Chart := new ChartUnitDecorator(object_.Chart); - {self.}Wsp := new WspUnitDecorator(object_.Wsp); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrUri) then + {self.}Uri := object_.XmlAttrUri.Value; + if not ifnil(object_.XmlChildPic) then + {self.}XmlChildPic := new PicUnitDecorator(object_.XmlChildPic); + if not ifnil(object_.XmlChildChart) then + {self.}XmlChildChart := new ChartUnitDecorator(object_.XmlChildChart); + if not ifnil(object_.XmlChildWsp) then + {self.}XmlChildWsp := new WspUnitDecorator(object_.XmlChildWsp); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/GraphicFrameLocksUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/GraphicFrameLocksUnitDecorator@DOCX.tsf index d028102..24b6dc3 100644 --- a/autoclass/decorator/docx/GraphicFrameLocksUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/GraphicFrameLocksUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function GraphicFrameLocksUnitDecorator.Convert(); begin - {self.}XmlAttrNoChangeAspect.Value := object_.XmlAttrNoChangeAspect.Value; - {self.}XmlAttrXmlnsA.Value := object_.XmlAttrXmlnsA.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrNoChangeAspect) then + {self.}NoChangeAspect := object_.XmlAttrNoChangeAspect.Value; + if not ifnil(object_.XmlAttrXmlnsA) then + {self.}XmlnsA := object_.XmlAttrXmlnsA.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/GraphicUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/GraphicUnitDecorator@DOCX.tsf index cbdb9a5..792eb1e 100644 --- a/autoclass/decorator/docx/GraphicUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/GraphicUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function GraphicUnitDecorator.Convert(); begin - {self.}XmlAttrXmlnsA.Value := object_.XmlAttrXmlnsA.Value; - {self.}GraphicData := new GraphicDataUnitDecorator(object_.GraphicData); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXmlnsA) then + {self.}XmlnsA := object_.XmlAttrXmlnsA.Value; + if not ifnil(object_.XmlChildGraphicData) then + {self.}XmlChildGraphicData := new GraphicDataUnitDecorator(object_.XmlChildGraphicData); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/GridColUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/GridColUnitDecorator@DOCX.tsf index 6d961ca..3fac7ed 100644 --- a/autoclass/decorator/docx/GridColUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/GridColUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function GridColUnitDecorator.Convert(); begin - {self.}XmlAttrw.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrw.Value); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrw) then + {self.}w := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrw.Value); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/GridSpanUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/GridSpanUnitDecorator@DOCX.tsf index db0a5e9..5e71cb5 100644 --- a/autoclass/decorator/docx/GridSpanUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/GridSpanUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function GridSpanUnitDecorator.Convert(); begin - {self.}XmlAttrVal.Value := TSSafeUnitConverter.ToInt(object_.XmlAttrVal.Value); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrVal) then + {self.}Val := TSSafeUnitConverter.ToInt(object_.XmlAttrVal.Value); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/GsLstUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/GsLstUnitDecorator@DOCX.tsf index 5bc9d52..32b4950 100644 --- a/autoclass/decorator/docx/GsLstUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/GsLstUnitDecorator@DOCX.tsf @@ -22,4 +22,7 @@ end; function GsLstUnitDecorator.Convert(); begin + tslassigning_backup := tslassigning; + tslassigning := 1; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/GsUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/GsUnitDecorator@DOCX.tsf index 09c329b..ae8715a 100644 --- a/autoclass/decorator/docx/GsUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/GsUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function GsUnitDecorator.Convert(); begin - {self.}XmlAttrPos.Value := object_.XmlAttrPos.Value; - {self.}SchemeClr := new SchemeClrUnitDecorator(object_.SchemeClr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrPos) then + {self.}Pos := object_.XmlAttrPos.Value; + if not ifnil(object_.XmlChildSchemeClr) then + {self.}XmlChildSchemeClr := new SchemeClrUnitDecorator(object_.XmlChildSchemeClr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/HdrShapeDefaultsUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/HdrShapeDefaultsUnitDecorator@DOCX.tsf index 71b77e1..ce5d85c 100644 --- a/autoclass/decorator/docx/HdrShapeDefaultsUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/HdrShapeDefaultsUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function HdrShapeDefaultsUnitDecorator.Convert(); begin - {self.}ShapeDefaults := new ShapeDefaultsUnitDecorator(object_.ShapeDefaults); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildShapeDefaults) then + {self.}XmlChildShapeDefaults := new ShapeDefaultsUnitDecorator(object_.XmlChildShapeDefaults); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/HdrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/HdrUnitDecorator@DOCX.tsf index 9c44b1a..f820cc5 100644 --- a/autoclass/decorator/docx/HdrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/HdrUnitDecorator@DOCX.tsf @@ -22,19 +22,37 @@ end; function HdrUnitDecorator.Convert(); begin - {self.}XmlAttrXmlnsM.Value := object_.XmlAttrXmlnsM.Value; - {self.}XmlAttrXmlnsMc.Value := object_.XmlAttrXmlnsMc.Value; - {self.}XmlAttrXmlnsMo.Value := object_.XmlAttrXmlnsMo.Value; - {self.}XmlAttrXmlnsR.Value := object_.XmlAttrXmlnsR.Value; - {self.}XmlAttrXmlnsV.Value := object_.XmlAttrXmlnsV.Value; - {self.}XmlAttrXmlnsW14.Value := object_.XmlAttrXmlnsW14.Value; - {self.}XmlAttrXmlnsW.Value := object_.XmlAttrXmlnsW.Value; - {self.}XmlAttrXmlnsWne.Value := object_.XmlAttrXmlnsWne.Value; - {self.}XmlAttrXmlnsWp14.Value := object_.XmlAttrXmlnsWp14.Value; - {self.}XmlAttrXmlnsWp.Value := object_.XmlAttrXmlnsWp.Value; - {self.}XmlAttrXmlnsWpc.Value := object_.XmlAttrXmlnsWpc.Value; - {self.}XmlAttrXmlnsWpg.Value := object_.XmlAttrXmlnsWpg.Value; - {self.}XmlAttrXmlnsWpi.Value := object_.XmlAttrXmlnsWpi.Value; - {self.}XmlAttrXmlnsWps.Value := object_.XmlAttrXmlnsWps.Value; - {self.}XmlAttrMcIgnorable.Value := object_.XmlAttrMcIgnorable.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXmlnsM) then + {self.}XmlnsM := object_.XmlAttrXmlnsM.Value; + if not ifnil(object_.XmlAttrXmlnsMc) then + {self.}XmlnsMc := object_.XmlAttrXmlnsMc.Value; + if not ifnil(object_.XmlAttrXmlnsMo) then + {self.}XmlnsMo := object_.XmlAttrXmlnsMo.Value; + if not ifnil(object_.XmlAttrXmlnsR) then + {self.}XmlnsR := object_.XmlAttrXmlnsR.Value; + if not ifnil(object_.XmlAttrXmlnsV) then + {self.}XmlnsV := object_.XmlAttrXmlnsV.Value; + if not ifnil(object_.XmlAttrXmlnsW14) then + {self.}XmlnsW14 := object_.XmlAttrXmlnsW14.Value; + if not ifnil(object_.XmlAttrXmlnsW) then + {self.}XmlnsW := object_.XmlAttrXmlnsW.Value; + if not ifnil(object_.XmlAttrXmlnsWne) then + {self.}XmlnsWne := object_.XmlAttrXmlnsWne.Value; + if not ifnil(object_.XmlAttrXmlnsWp14) then + {self.}XmlnsWp14 := object_.XmlAttrXmlnsWp14.Value; + if not ifnil(object_.XmlAttrXmlnsWp) then + {self.}XmlnsWp := object_.XmlAttrXmlnsWp.Value; + if not ifnil(object_.XmlAttrXmlnsWpc) then + {self.}XmlnsWpc := object_.XmlAttrXmlnsWpc.Value; + if not ifnil(object_.XmlAttrXmlnsWpg) then + {self.}XmlnsWpg := object_.XmlAttrXmlnsWpg.Value; + if not ifnil(object_.XmlAttrXmlnsWpi) then + {self.}XmlnsWpi := object_.XmlAttrXmlnsWpi.Value; + if not ifnil(object_.XmlAttrXmlnsWps) then + {self.}XmlnsWps := object_.XmlAttrXmlnsWps.Value; + if not ifnil(object_.XmlAttrMcIgnorable) then + {self.}McIgnorable := object_.XmlAttrMcIgnorable.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/HyperLinkUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/HyperLinkUnitDecorator@DOCX.tsf index 6d78f7e..5083cda 100644 --- a/autoclass/decorator/docx/HyperLinkUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/HyperLinkUnitDecorator@DOCX.tsf @@ -22,7 +22,13 @@ end; function HyperLinkUnitDecorator.Convert(); begin - {self.}XmlAttrAnchor.Value := object_.XmlAttrAnchor.Value; - {self.}XmlAttrId.Value := object_.XmlAttrId.Value; - {self.}XmlAttrHistory.Value := object_.XmlAttrHistory.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrAnchor) then + {self.}Anchor := object_.XmlAttrAnchor.Value; + if not ifnil(object_.XmlAttrId) then + {self.}Id := object_.XmlAttrId.Value; + if not ifnil(object_.XmlAttrHistory) then + {self.}History := object_.XmlAttrHistory.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/IdMapUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/IdMapUnitDecorator@DOCX.tsf index 1f38205..97e037d 100644 --- a/autoclass/decorator/docx/IdMapUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/IdMapUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function IdMapUnitDecorator.Convert(); begin - {self.}XmlAttrExt.Value := object_.XmlAttrExt.Value; - {self.}XmlAttrData.Value := object_.XmlAttrData.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrExt) then + {self.}Ext := object_.XmlAttrExt.Value; + if not ifnil(object_.XmlAttrData) then + {self.}Data := object_.XmlAttrData.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/IndUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/IndUnitDecorator@DOCX.tsf index d88efe9..420564f 100644 --- a/autoclass/decorator/docx/IndUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/IndUnitDecorator@DOCX.tsf @@ -22,12 +22,23 @@ end; function IndUnitDecorator.Convert(); begin - {self.}XmlAttrFirstLineChars.Value := TSSafeUnitConverter.PercentToNumber(object_.XmlAttrFirstLineChars.Value); - {self.}XmlAttrFirstLine.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrFirstLine.Value); - {self.}XmlAttrRightChars.Value := TSSafeUnitConverter.PercentToNumber(object_.XmlAttrRightChars.Value); - {self.}XmlAttrRight.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrRight.Value); - {self.}XmlAttrLeftChars.Value := TSSafeUnitConverter.PercentToNumber(object_.XmlAttrLeftChars.Value); - {self.}XmlAttrLeft.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrLeft.Value); - {self.}XmlAttrHanging.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrHanging.Value); - {self.}XmlAttrHangingChars.Value := TSSafeUnitConverter.PercentToNumber(object_.XmlAttrHangingChars.Value); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrFirstLineChars) then + {self.}FirstLineChars := TSSafeUnitConverter.PercentToNumber(object_.XmlAttrFirstLineChars.Value); + if not ifnil(object_.XmlAttrFirstLine) then + {self.}FirstLine := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrFirstLine.Value); + if not ifnil(object_.XmlAttrRightChars) then + {self.}RightChars := TSSafeUnitConverter.PercentToNumber(object_.XmlAttrRightChars.Value); + if not ifnil(object_.XmlAttrRight) then + {self.}Right := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrRight.Value); + if not ifnil(object_.XmlAttrLeftChars) then + {self.}LeftChars := TSSafeUnitConverter.PercentToNumber(object_.XmlAttrLeftChars.Value); + if not ifnil(object_.XmlAttrLeft) then + {self.}Left := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrLeft.Value); + if not ifnil(object_.XmlAttrHanging) then + {self.}Hanging := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrHanging.Value); + if not ifnil(object_.XmlAttrHangingChars) then + {self.}HangingChars := TSSafeUnitConverter.PercentToNumber(object_.XmlAttrHangingChars.Value); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/InstrTextUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/InstrTextUnitDecorator@DOCX.tsf index 335f4a7..7d6fcbb 100644 --- a/autoclass/decorator/docx/InstrTextUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/InstrTextUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function InstrTextUnitDecorator.Convert(); begin - {self.}XmlAttrSpace.Value := object_.XmlAttrSpace.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrSpace) then + {self.}Space := object_.XmlAttrSpace.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/LangUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/LangUnitDecorator@DOCX.tsf index ec47dfa..73b6ee6 100644 --- a/autoclass/decorator/docx/LangUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/LangUnitDecorator@DOCX.tsf @@ -22,7 +22,13 @@ end; function LangUnitDecorator.Convert(); begin - {self.}XmlAttrVal.Value := object_.XmlAttrVal.Value; - {self.}XmlAttrEastAsia.Value := object_.XmlAttrEastAsia.Value; - {self.}XmlAttrBidi.Value := object_.XmlAttrBidi.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrVal) then + {self.}Val := object_.XmlAttrVal.Value; + if not ifnil(object_.XmlAttrEastAsia) then + {self.}EastAsia := object_.XmlAttrEastAsia.Value; + if not ifnil(object_.XmlAttrBidi) then + {self.}Bidi := object_.XmlAttrBidi.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/LatenStylesUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/LatenStylesUnitDecorator@DOCX.tsf index 7754389..f9614d5 100644 --- a/autoclass/decorator/docx/LatenStylesUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/LatenStylesUnitDecorator@DOCX.tsf @@ -22,10 +22,19 @@ end; function LatenStylesUnitDecorator.Convert(); begin - {self.}XmlAttrDefLickedState.Value := object_.XmlAttrDefLickedState.Value; - {self.}XmlAttrDefUIPriority.Value := object_.XmlAttrDefUIPriority.Value; - {self.}XmlAttrDefSemiHidden.Value := object_.XmlAttrDefSemiHidden.Value; - {self.}XmlAttrDefUnhideWhenUsed.Value := object_.XmlAttrDefUnhideWhenUsed.Value; - {self.}XmlAttrDefQFormat.Value := object_.XmlAttrDefQFormat.Value; - {self.}XmlAttrCount.Value := object_.XmlAttrCount.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrDefLickedState) then + {self.}DefLickedState := object_.XmlAttrDefLickedState.Value; + if not ifnil(object_.XmlAttrDefUIPriority) then + {self.}DefUIPriority := object_.XmlAttrDefUIPriority.Value; + if not ifnil(object_.XmlAttrDefSemiHidden) then + {self.}DefSemiHidden := object_.XmlAttrDefSemiHidden.Value; + if not ifnil(object_.XmlAttrDefUnhideWhenUsed) then + {self.}DefUnhideWhenUsed := object_.XmlAttrDefUnhideWhenUsed.Value; + if not ifnil(object_.XmlAttrDefQFormat) then + {self.}DefQFormat := object_.XmlAttrDefQFormat.Value; + if not ifnil(object_.XmlAttrCount) then + {self.}Count := object_.XmlAttrCount.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/LatinUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/LatinUnitDecorator@DOCX.tsf index eecc22a..cfd3e64 100644 --- a/autoclass/decorator/docx/LatinUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/LatinUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function LatinUnitDecorator.Convert(); begin - {self.}XmlAttrTypeface.Value := object_.XmlAttrTypeface.Value; - {self.}XmlAttrPanose.Value := object_.XmlAttrPanose.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrTypeface) then + {self.}Typeface := object_.XmlAttrTypeface.Value; + if not ifnil(object_.XmlAttrPanose) then + {self.}Panose := object_.XmlAttrPanose.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/LegendUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/LegendUnitDecorator@DOCX.tsf index f3a7600..8ba076e 100644 --- a/autoclass/decorator/docx/LegendUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/LegendUnitDecorator@DOCX.tsf @@ -22,8 +22,15 @@ end; function LegendUnitDecorator.Convert(); begin - {self.}LegendPos := new PureValUnitDecorator(object_.LegendPos); - if not ifnil(object_.XmlChildLayout.Value) then {self.}XmlChildLayout.Value := object_.XmlChildLayout.Value; - {self.}Overlay := new PureValUnitDecorator(object_.Overlay); - {self.}TxPr := new TxPrUnitDecorator(object_.TxPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildLegendPos) then + {self.}XmlChildLegendPos := new PureValUnitDecorator(object_.XmlChildLegendPos); + if not ifnil(object_.XmlChildLayout) then + {self.}Layout.Copy(object_.XmlChildLayout); + if not ifnil(object_.XmlChildOverlay) then + {self.}XmlChildOverlay := new PureValUnitDecorator(object_.XmlChildOverlay); + if not ifnil(object_.XmlChildTxPr) then + {self.}XmlChildTxPr := new TxPrUnitDecorator(object_.XmlChildTxPr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/LinUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/LinUnitDecorator@DOCX.tsf index 8a2cca2..e6088fb 100644 --- a/autoclass/decorator/docx/LinUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/LinUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function LinUnitDecorator.Convert(); begin - {self.}XmlAttrAng.Value := object_.XmlAttrAng.Value; - {self.}XmlAttrScaled.Value := object_.XmlAttrScaled.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrAng) then + {self.}Ang := object_.XmlAttrAng.Value; + if not ifnil(object_.XmlAttrScaled) then + {self.}Scaled := object_.XmlAttrScaled.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/LnStyleLstUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/LnStyleLstUnitDecorator@DOCX.tsf index 5ed7181..f107131 100644 --- a/autoclass/decorator/docx/LnStyleLstUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/LnStyleLstUnitDecorator@DOCX.tsf @@ -22,4 +22,7 @@ end; function LnStyleLstUnitDecorator.Convert(); begin + tslassigning_backup := tslassigning; + tslassigning := 1; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/LnUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/LnUnitDecorator@DOCX.tsf index 6b46540..cbb1aef 100644 --- a/autoclass/decorator/docx/LnUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/LnUnitDecorator@DOCX.tsf @@ -22,11 +22,21 @@ end; function LnUnitDecorator.Convert(); begin - {self.}XmlAttrW.Value := object_.XmlAttrW.Value; - {self.}XmlAttrCap.Value := object_.XmlAttrCap.Value; - {self.}XmlAttrCmpd.Value := object_.XmlAttrCmpd.Value; - {self.}XmlAttrAlgn.Value := object_.XmlAttrAlgn.Value; - {self.}SolidFill := new SolidFillUnitDecorator(object_.SolidFill); - {self.}PrstDash := new PureValUnitDecorator(object_.PrstDash); - {self.}Miter := new MiterUnitDecorator(object_.Miter); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrW) then + {self.}W := object_.XmlAttrW.Value; + if not ifnil(object_.XmlAttrCap) then + {self.}Cap := object_.XmlAttrCap.Value; + if not ifnil(object_.XmlAttrCmpd) then + {self.}Cmpd := object_.XmlAttrCmpd.Value; + if not ifnil(object_.XmlAttrAlgn) then + {self.}Algn := object_.XmlAttrAlgn.Value; + if not ifnil(object_.XmlChildSolidFill) then + {self.}XmlChildSolidFill := new SolidFillUnitDecorator(object_.XmlChildSolidFill); + if not ifnil(object_.XmlChildPrstDash) then + {self.}XmlChildPrstDash := new PureValUnitDecorator(object_.XmlChildPrstDash); + if not ifnil(object_.XmlChildMiter) then + {self.}XmlChildMiter := new MiterUnitDecorator(object_.XmlChildMiter); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/LsdExceptionUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/LsdExceptionUnitDecorator@DOCX.tsf index e73b7eb..7d1de54 100644 --- a/autoclass/decorator/docx/LsdExceptionUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/LsdExceptionUnitDecorator@DOCX.tsf @@ -22,9 +22,17 @@ end; function LsdExceptionUnitDecorator.Convert(); begin - {self.}XmlAttrName.Value := object_.XmlAttrName.Value; - {self.}XmlAttrUIPriority.Value := object_.XmlAttrUIPriority.Value; - {self.}XmlAttrSemiHidden.Value := object_.XmlAttrSemiHidden.Value; - {self.}XmlAttrUnhideWhenUsed.Value := object_.XmlAttrUnhideWhenUsed.Value; - {self.}XmlAttrQFormat.Value := object_.XmlAttrQFormat.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrName) then + {self.}Name := object_.XmlAttrName.Value; + if not ifnil(object_.XmlAttrUIPriority) then + {self.}UIPriority := object_.XmlAttrUIPriority.Value; + if not ifnil(object_.XmlAttrSemiHidden) then + {self.}SemiHidden := object_.XmlAttrSemiHidden.Value; + if not ifnil(object_.XmlAttrUnhideWhenUsed) then + {self.}UnhideWhenUsed := object_.XmlAttrUnhideWhenUsed.Value; + if not ifnil(object_.XmlAttrQFormat) then + {self.}QFormat := object_.XmlAttrQFormat.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/LvlUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/LvlUnitDecorator@DOCX.tsf index bdf5869..acba8c0 100644 --- a/autoclass/decorator/docx/LvlUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/LvlUnitDecorator@DOCX.tsf @@ -22,14 +22,27 @@ end; function LvlUnitDecorator.Convert(); begin - {self.}XmlAttrIlvl.Value := object_.XmlAttrIlvl.Value; - {self.}XmlAttrTentative.Value := object_.XmlAttrTentative.Value; - {self.}Start := new PureWValUnitDecorator(object_.Start); - {self.}NumFmt := new PureWValUnitDecorator(object_.NumFmt); - {self.}PStyle := new PureWValUnitDecorator(object_.PStyle); - {self.}Suff := new PureWValUnitDecorator(object_.Suff); - {self.}LvlText := new PureWValUnitDecorator(object_.LvlText); - {self.}LvlJc := new PureWValUnitDecorator(object_.LvlJc); - {self.}PPr := new PPrUnitDecorator(object_.PPr); - {self.}RPr := new RPrUnitDecorator(object_.RPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrIlvl) then + {self.}Ilvl := object_.XmlAttrIlvl.Value; + if not ifnil(object_.XmlAttrTentative) then + {self.}Tentative := object_.XmlAttrTentative.Value; + if not ifnil(object_.XmlChildStart) then + {self.}XmlChildStart := new PureWValUnitDecorator(object_.XmlChildStart); + if not ifnil(object_.XmlChildNumFmt) then + {self.}XmlChildNumFmt := new PureWValUnitDecorator(object_.XmlChildNumFmt); + if not ifnil(object_.XmlChildPStyle) then + {self.}XmlChildPStyle := new PureWValUnitDecorator(object_.XmlChildPStyle); + if not ifnil(object_.XmlChildSuff) then + {self.}XmlChildSuff := new PureWValUnitDecorator(object_.XmlChildSuff); + if not ifnil(object_.XmlChildLvlText) then + {self.}XmlChildLvlText := new PureWValUnitDecorator(object_.XmlChildLvlText); + if not ifnil(object_.XmlChildLvlJc) then + {self.}XmlChildLvlJc := new PureWValUnitDecorator(object_.XmlChildLvlJc); + if not ifnil(object_.XmlChildPPr) then + {self.}XmlChildPPr := new PPrUnitDecorator(object_.XmlChildPPr); + if not ifnil(object_.XmlChildRPr) then + {self.}XmlChildRPr := new RPrUnitDecorator(object_.XmlChildRPr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/MFontFontUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/MFontFontUnitDecorator@DOCX.tsf index 2375aad..e7781d1 100644 --- a/autoclass/decorator/docx/MFontFontUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/MFontFontUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function MFontFontUnitDecorator.Convert(); begin - {self.}XmlAttrScript.Value := object_.XmlAttrScript.Value; - {self.}XmlAttrTypeface.Value := object_.XmlAttrTypeface.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrScript) then + {self.}Script := object_.XmlAttrScript.Value; + if not ifnil(object_.XmlAttrTypeface) then + {self.}Typeface := object_.XmlAttrTypeface.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/MFontUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/MFontUnitDecorator@DOCX.tsf index f93486b..eafedb2 100644 --- a/autoclass/decorator/docx/MFontUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/MFontUnitDecorator@DOCX.tsf @@ -22,7 +22,13 @@ end; function MFontUnitDecorator.Convert(); begin - {self.}Latin := new LatinUnitDecorator(object_.Latin); - {self.}Ea := new LatinUnitDecorator(object_.Ea); - {self.}Cs := new LatinUnitDecorator(object_.Cs); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildLatin) then + {self.}XmlChildLatin := new LatinUnitDecorator(object_.XmlChildLatin); + if not ifnil(object_.XmlChildEa) then + {self.}XmlChildEa := new LatinUnitDecorator(object_.XmlChildEa); + if not ifnil(object_.XmlChildCs) then + {self.}XmlChildCs := new LatinUnitDecorator(object_.XmlChildCs); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/MathPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/MathPrUnitDecorator@DOCX.tsf index 6990340..d8cb6b7 100644 --- a/autoclass/decorator/docx/MathPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/MathPrUnitDecorator@DOCX.tsf @@ -22,15 +22,29 @@ end; function MathPrUnitDecorator.Convert(); begin - {self.}MathFont := new PureWValUnitDecorator(object_.MathFont); - {self.}BrkBin := new PureWValUnitDecorator(object_.BrkBin); - {self.}BrkBinSub := new PureWValUnitDecorator(object_.BrkBinSub); - {self.}SmallFrac := new PureWValUnitDecorator(object_.SmallFrac); - if not ifnil(object_.XmlChildDispDef.Value) then {self.}XmlChildDispDef.Value := object_.XmlChildDispDef.Value; - {self.}LMargin := new PureWValUnitDecorator(object_.LMargin); - {self.}RMargin := new PureWValUnitDecorator(object_.RMargin); - {self.}DefJc := new PureWValUnitDecorator(object_.DefJc); - {self.}WrapIndent := new PureWValUnitDecorator(object_.WrapIndent); - {self.}IntLim := new PureWValUnitDecorator(object_.IntLim); - {self.}NaryLim := new PureWValUnitDecorator(object_.NaryLim); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildMathFont) then + {self.}XmlChildMathFont := new PureWValUnitDecorator(object_.XmlChildMathFont); + if not ifnil(object_.XmlChildBrkBin) then + {self.}XmlChildBrkBin := new PureWValUnitDecorator(object_.XmlChildBrkBin); + if not ifnil(object_.XmlChildBrkBinSub) then + {self.}XmlChildBrkBinSub := new PureWValUnitDecorator(object_.XmlChildBrkBinSub); + if not ifnil(object_.XmlChildSmallFrac) then + {self.}XmlChildSmallFrac := new PureWValUnitDecorator(object_.XmlChildSmallFrac); + if not ifnil(object_.XmlChildDispDef) then + {self.}DispDef.Copy(object_.XmlChildDispDef); + if not ifnil(object_.XmlChildLMargin) then + {self.}XmlChildLMargin := new PureWValUnitDecorator(object_.XmlChildLMargin); + if not ifnil(object_.XmlChildRMargin) then + {self.}XmlChildRMargin := new PureWValUnitDecorator(object_.XmlChildRMargin); + if not ifnil(object_.XmlChildDefJc) then + {self.}XmlChildDefJc := new PureWValUnitDecorator(object_.XmlChildDefJc); + if not ifnil(object_.XmlChildWrapIndent) then + {self.}XmlChildWrapIndent := new PureWValUnitDecorator(object_.XmlChildWrapIndent); + if not ifnil(object_.XmlChildIntLim) then + {self.}XmlChildIntLim := new PureWValUnitDecorator(object_.XmlChildIntLim); + if not ifnil(object_.XmlChildNaryLim) then + {self.}XmlChildNaryLim := new PureWValUnitDecorator(object_.XmlChildNaryLim); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/MiterUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/MiterUnitDecorator@DOCX.tsf index 95ffbe5..06851d9 100644 --- a/autoclass/decorator/docx/MiterUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/MiterUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function MiterUnitDecorator.Convert(); begin - {self.}XmlAttrLim.Value := object_.XmlAttrLim.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrLim) then + {self.}Lim := object_.XmlAttrLim.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ModifiedUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ModifiedUnitDecorator@DOCX.tsf index b170eef..e7272a4 100644 --- a/autoclass/decorator/docx/ModifiedUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ModifiedUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function ModifiedUnitDecorator.Convert(); begin - {self.}XmlAttrXsiType.Value := object_.XmlAttrXsiType.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXsiType) then + {self.}XsiType := object_.XmlAttrXsiType.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/NumFmtUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/NumFmtUnitDecorator@DOCX.tsf index b0711cb..3473752 100644 --- a/autoclass/decorator/docx/NumFmtUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/NumFmtUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function NumFmtUnitDecorator.Convert(); begin - {self.}XmlAttrFormatCode.Value := object_.XmlAttrFormatCode.Value; - {self.}XmlAttrSourceLinked.Value := object_.XmlAttrSourceLinked.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrFormatCode) then + {self.}FormatCode := object_.XmlAttrFormatCode.Value; + if not ifnil(object_.XmlAttrSourceLinked) then + {self.}SourceLinked := object_.XmlAttrSourceLinked.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/NumPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/NumPrUnitDecorator@DOCX.tsf index c6557b5..c08966c 100644 --- a/autoclass/decorator/docx/NumPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/NumPrUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function NumPrUnitDecorator.Convert(); begin - {self.}Ilvl := new PureWValUnitDecorator(object_.Ilvl); - {self.}NumId := new PureWValUnitDecorator(object_.NumId); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildIlvl) then + {self.}XmlChildIlvl := new PureWValUnitDecorator(object_.XmlChildIlvl); + if not ifnil(object_.XmlChildNumId) then + {self.}XmlChildNumId := new PureWValUnitDecorator(object_.XmlChildNumId); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/NumRefUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/NumRefUnitDecorator@DOCX.tsf index 1bc0c0a..dcd5235 100644 --- a/autoclass/decorator/docx/NumRefUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/NumRefUnitDecorator@DOCX.tsf @@ -22,5 +22,10 @@ end; function NumRefUnitDecorator.Convert(); begin - {self.}NumCache := new CacheUnitDecorator(object_.NumCache); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildF) then + if not ifnil(object_.XmlChildNumCache) then + {self.}XmlChildNumCache := new CacheUnitDecorator(object_.XmlChildNumCache); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/NumUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/NumUnitDecorator@DOCX.tsf index 5a4287a..0473ac4 100644 --- a/autoclass/decorator/docx/NumUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/NumUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function NumUnitDecorator.Convert(); begin - {self.}XmlAttrNumId.Value := object_.XmlAttrNumId.Value; - {self.}AbstractNumId := new PureWValUnitDecorator(object_.AbstractNumId); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrNumId) then + {self.}NumId := object_.XmlAttrNumId.Value; + if not ifnil(object_.XmlChildAbstractNumId) then + {self.}XmlChildAbstractNumId := new PureWValUnitDecorator(object_.XmlChildAbstractNumId); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/NumberingUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/NumberingUnitDecorator@DOCX.tsf index 493aa8e..652267d 100644 --- a/autoclass/decorator/docx/NumberingUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/NumberingUnitDecorator@DOCX.tsf @@ -22,39 +22,77 @@ end; function NumberingUnitDecorator.Convert(); begin - {self.}XmlAttrXmlnsWpc.Value := object_.XmlAttrXmlnsWpc.Value; - {self.}XmlAttrXmlnsCx.Value := object_.XmlAttrXmlnsCx.Value; - {self.}XmlAttrXmlnsCx1.Value := object_.XmlAttrXmlnsCx1.Value; - {self.}XmlAttrXmlnsCx2.Value := object_.XmlAttrXmlnsCx2.Value; - {self.}XmlAttrXmlnsCx3.Value := object_.XmlAttrXmlnsCx3.Value; - {self.}XmlAttrXmlnsCx4.Value := object_.XmlAttrXmlnsCx4.Value; - {self.}XmlAttrXmlnsCx5.Value := object_.XmlAttrXmlnsCx5.Value; - {self.}XmlAttrXmlnsCx6.Value := object_.XmlAttrXmlnsCx6.Value; - {self.}XmlAttrXmlnsCx7.Value := object_.XmlAttrXmlnsCx7.Value; - {self.}XmlAttrXmlnsCx8.Value := object_.XmlAttrXmlnsCx8.Value; - {self.}XmlAttrXmlnsMc.Value := object_.XmlAttrXmlnsMc.Value; - {self.}XmlAttrXmlnsAink.Value := object_.XmlAttrXmlnsAink.Value; - {self.}XmlAttrXmlnsAm3d.Value := object_.XmlAttrXmlnsAm3d.Value; - {self.}XmlAttrXmlnsO.Value := object_.XmlAttrXmlnsO.Value; - {self.}XmlAttrXmlnsOel.Value := object_.XmlAttrXmlnsOel.Value; - {self.}XmlAttrXmlnsR.Value := object_.XmlAttrXmlnsR.Value; - {self.}XmlAttrXmlnsM.Value := object_.XmlAttrXmlnsM.Value; - {self.}XmlAttrXmlnsV.Value := object_.XmlAttrXmlnsV.Value; - {self.}XmlAttrXmlnsWp14.Value := object_.XmlAttrXmlnsWp14.Value; - {self.}XmlAttrXmlnsWp.Value := object_.XmlAttrXmlnsWp.Value; - {self.}XmlAttrXmlnsW10.Value := object_.XmlAttrXmlnsW10.Value; - {self.}XmlAttrXmlnsW.Value := object_.XmlAttrXmlnsW.Value; - {self.}XmlAttrXmlnsW14.Value := object_.XmlAttrXmlnsW14.Value; - {self.}XmlAttrXmlnsW15.Value := object_.XmlAttrXmlnsW15.Value; - {self.}XmlAttrXmlnsW16Cex.Value := object_.XmlAttrXmlnsW16Cex.Value; - {self.}XmlAttrXmlnsW16Cid.Value := object_.XmlAttrXmlnsW16Cid.Value; - {self.}XmlAttrXmlnsW16.Value := object_.XmlAttrXmlnsW16.Value; - {self.}XmlAttrXmlnsW16Du.Value := object_.XmlAttrXmlnsW16Du.Value; - {self.}XmlAttrXmlnsW16sdtdh.Value := object_.XmlAttrXmlnsW16sdtdh.Value; - {self.}XmlAttrXmlnsW16se.Value := object_.XmlAttrXmlnsW16se.Value; - {self.}XmlAttrXmlnsWpg.Value := object_.XmlAttrXmlnsWpg.Value; - {self.}XmlAttrXmlnsWpi.Value := object_.XmlAttrXmlnsWpi.Value; - {self.}XmlAttrXmlnsWne.Value := object_.XmlAttrXmlnsWne.Value; - {self.}XmlAttrXmlnsWps.Value := object_.XmlAttrXmlnsWps.Value; - {self.}XmlAttrMcIgnorable.Value := object_.XmlAttrMcIgnorable.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXmlnsWpc) then + {self.}XmlnsWpc := object_.XmlAttrXmlnsWpc.Value; + if not ifnil(object_.XmlAttrXmlnsCx) then + {self.}XmlnsCx := object_.XmlAttrXmlnsCx.Value; + if not ifnil(object_.XmlAttrXmlnsCx1) then + {self.}XmlnsCx1 := object_.XmlAttrXmlnsCx1.Value; + if not ifnil(object_.XmlAttrXmlnsCx2) then + {self.}XmlnsCx2 := object_.XmlAttrXmlnsCx2.Value; + if not ifnil(object_.XmlAttrXmlnsCx3) then + {self.}XmlnsCx3 := object_.XmlAttrXmlnsCx3.Value; + if not ifnil(object_.XmlAttrXmlnsCx4) then + {self.}XmlnsCx4 := object_.XmlAttrXmlnsCx4.Value; + if not ifnil(object_.XmlAttrXmlnsCx5) then + {self.}XmlnsCx5 := object_.XmlAttrXmlnsCx5.Value; + if not ifnil(object_.XmlAttrXmlnsCx6) then + {self.}XmlnsCx6 := object_.XmlAttrXmlnsCx6.Value; + if not ifnil(object_.XmlAttrXmlnsCx7) then + {self.}XmlnsCx7 := object_.XmlAttrXmlnsCx7.Value; + if not ifnil(object_.XmlAttrXmlnsCx8) then + {self.}XmlnsCx8 := object_.XmlAttrXmlnsCx8.Value; + if not ifnil(object_.XmlAttrXmlnsMc) then + {self.}XmlnsMc := object_.XmlAttrXmlnsMc.Value; + if not ifnil(object_.XmlAttrXmlnsAink) then + {self.}XmlnsAink := object_.XmlAttrXmlnsAink.Value; + if not ifnil(object_.XmlAttrXmlnsAm3d) then + {self.}XmlnsAm3d := object_.XmlAttrXmlnsAm3d.Value; + if not ifnil(object_.XmlAttrXmlnsO) then + {self.}XmlnsO := object_.XmlAttrXmlnsO.Value; + if not ifnil(object_.XmlAttrXmlnsOel) then + {self.}XmlnsOel := object_.XmlAttrXmlnsOel.Value; + if not ifnil(object_.XmlAttrXmlnsR) then + {self.}XmlnsR := object_.XmlAttrXmlnsR.Value; + if not ifnil(object_.XmlAttrXmlnsM) then + {self.}XmlnsM := object_.XmlAttrXmlnsM.Value; + if not ifnil(object_.XmlAttrXmlnsV) then + {self.}XmlnsV := object_.XmlAttrXmlnsV.Value; + if not ifnil(object_.XmlAttrXmlnsWp14) then + {self.}XmlnsWp14 := object_.XmlAttrXmlnsWp14.Value; + if not ifnil(object_.XmlAttrXmlnsWp) then + {self.}XmlnsWp := object_.XmlAttrXmlnsWp.Value; + if not ifnil(object_.XmlAttrXmlnsW10) then + {self.}XmlnsW10 := object_.XmlAttrXmlnsW10.Value; + if not ifnil(object_.XmlAttrXmlnsW) then + {self.}XmlnsW := object_.XmlAttrXmlnsW.Value; + if not ifnil(object_.XmlAttrXmlnsW14) then + {self.}XmlnsW14 := object_.XmlAttrXmlnsW14.Value; + if not ifnil(object_.XmlAttrXmlnsW15) then + {self.}XmlnsW15 := object_.XmlAttrXmlnsW15.Value; + if not ifnil(object_.XmlAttrXmlnsW16Cex) then + {self.}XmlnsW16Cex := object_.XmlAttrXmlnsW16Cex.Value; + if not ifnil(object_.XmlAttrXmlnsW16Cid) then + {self.}XmlnsW16Cid := object_.XmlAttrXmlnsW16Cid.Value; + if not ifnil(object_.XmlAttrXmlnsW16) then + {self.}XmlnsW16 := object_.XmlAttrXmlnsW16.Value; + if not ifnil(object_.XmlAttrXmlnsW16Du) then + {self.}XmlnsW16Du := object_.XmlAttrXmlnsW16Du.Value; + if not ifnil(object_.XmlAttrXmlnsW16sdtdh) then + {self.}XmlnsW16sdtdh := object_.XmlAttrXmlnsW16sdtdh.Value; + if not ifnil(object_.XmlAttrXmlnsW16se) then + {self.}XmlnsW16se := object_.XmlAttrXmlnsW16se.Value; + if not ifnil(object_.XmlAttrXmlnsWpg) then + {self.}XmlnsWpg := object_.XmlAttrXmlnsWpg.Value; + if not ifnil(object_.XmlAttrXmlnsWpi) then + {self.}XmlnsWpi := object_.XmlAttrXmlnsWpi.Value; + if not ifnil(object_.XmlAttrXmlnsWne) then + {self.}XmlnsWne := object_.XmlAttrXmlnsWne.Value; + if not ifnil(object_.XmlAttrXmlnsWps) then + {self.}XmlnsWps := object_.XmlAttrXmlnsWps.Value; + if not ifnil(object_.XmlAttrMcIgnorable) then + {self.}McIgnorable := object_.XmlAttrMcIgnorable.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/NvPicPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/NvPicPrUnitDecorator@DOCX.tsf index 404267f..29d907c 100644 --- a/autoclass/decorator/docx/NvPicPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/NvPicPrUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function NvPicPrUnitDecorator.Convert(); begin - {self.}CNvPr := new CNvPrUnitDecorator(object_.CNvPr); - {self.}CNvPicPr := new CNvPicPrUnitDecorator(object_.CNvPicPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildCNvPr) then + {self.}XmlChildCNvPr := new CNvPrUnitDecorator(object_.XmlChildCNvPr); + if not ifnil(object_.XmlChildCNvPicPr) then + {self.}XmlChildCNvPicPr := new CNvPicPrUnitDecorator(object_.XmlChildCNvPicPr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/OuterShdwUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/OuterShdwUnitDecorator@DOCX.tsf index 5aa7495..236f2af 100644 --- a/autoclass/decorator/docx/OuterShdwUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/OuterShdwUnitDecorator@DOCX.tsf @@ -22,10 +22,19 @@ end; function OuterShdwUnitDecorator.Convert(); begin - {self.}XmlAttrBlurRad.Value := object_.XmlAttrBlurRad.Value; - {self.}XmlAttrDist.Value := object_.XmlAttrDist.Value; - {self.}XmlAttrDir.Value := object_.XmlAttrDir.Value; - {self.}XmlAttrAlgn.Value := object_.XmlAttrAlgn.Value; - {self.}XmlAttrRotWithShape.Value := object_.XmlAttrRotWithShape.Value; - {self.}SrgbClr := new SrgbClrUnitDecorator(object_.SrgbClr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrBlurRad) then + {self.}BlurRad := object_.XmlAttrBlurRad.Value; + if not ifnil(object_.XmlAttrDist) then + {self.}Dist := object_.XmlAttrDist.Value; + if not ifnil(object_.XmlAttrDir) then + {self.}Dir := object_.XmlAttrDir.Value; + if not ifnil(object_.XmlAttrAlgn) then + {self.}Algn := object_.XmlAttrAlgn.Value; + if not ifnil(object_.XmlAttrRotWithShape) then + {self.}RotWithShape := object_.XmlAttrRotWithShape.Value; + if not ifnil(object_.XmlChildSrgbClr) then + {self.}XmlChildSrgbClr := new SrgbClrUnitDecorator(object_.XmlChildSrgbClr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PBdrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PBdrUnitDecorator@DOCX.tsf index 405e9ab..c0b6196 100644 --- a/autoclass/decorator/docx/PBdrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PBdrUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function PBdrUnitDecorator.Convert(); begin - {self.}Top := new PBorderUnitDecorator(object_.Top); - {self.}Bottom := new PBorderUnitDecorator(object_.Bottom); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildTop) then + {self.}XmlChildTop := new PBorderUnitDecorator(object_.XmlChildTop); + if not ifnil(object_.XmlChildBottom) then + {self.}XmlChildBottom := new PBorderUnitDecorator(object_.XmlChildBottom); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PBorderUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PBorderUnitDecorator@DOCX.tsf index 7349180..efd2e6c 100644 --- a/autoclass/decorator/docx/PBorderUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PBorderUnitDecorator@DOCX.tsf @@ -22,10 +22,19 @@ end; function PBorderUnitDecorator.Convert(); begin - {self.}XmlAttrVal.Value := object_.XmlAttrVal.Value; - {self.}XmlAttrColor.Value := object_.XmlAttrColor.Value; - {self.}XmlAttrSpace.Value := object_.XmlAttrSpace.Value; - {self.}XmlAttrThemeColor.Value := object_.XmlAttrThemeColor.Value; - {self.}XmlAttrThemeTint.Value := object_.XmlAttrThemeTint.Value; - {self.}XmlAttrSz.Value := TSSafeUnitConverter.HalfPointToPoints(object_.XmlAttrSz.Value); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrVal) then + {self.}Val := object_.XmlAttrVal.Value; + if not ifnil(object_.XmlAttrColor) then + {self.}Color := object_.XmlAttrColor.Value; + if not ifnil(object_.XmlAttrSpace) then + {self.}Space := object_.XmlAttrSpace.Value; + if not ifnil(object_.XmlAttrThemeColor) then + {self.}ThemeColor := object_.XmlAttrThemeColor.Value; + if not ifnil(object_.XmlAttrThemeTint) then + {self.}ThemeTint := object_.XmlAttrThemeTint.Value; + if not ifnil(object_.XmlAttrSz) then + {self.}Sz := TSSafeUnitConverter.HalfPointToPoints(object_.XmlAttrSz.Value); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PPrDefaultUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PPrDefaultUnitDecorator@DOCX.tsf index d36eb35..f9fdbfc 100644 --- a/autoclass/decorator/docx/PPrDefaultUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PPrDefaultUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function PPrDefaultUnitDecorator.Convert(); begin - {self.}PPr := new PPrUnitDecorator(object_.PPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildPPr) then + {self.}XmlChildPPr := new PPrUnitDecorator(object_.XmlChildPPr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PPrUnitDecorator@DOCX.tsf index 0a27d70..6f1af51 100644 --- a/autoclass/decorator/docx/PPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PPrUnitDecorator@DOCX.tsf @@ -22,22 +22,43 @@ end; function PPrUnitDecorator.Convert(); begin - {self.}SectPr := new SectPrUnitDecorator(object_.SectPr); - {self.}Tabs := new TabsUnitDecorator(object_.Tabs); - if not ifnil(object_.XmlChildWidowControl.Value) then {self.}XmlChildWidowControl.Value := object_.XmlChildWidowControl.Value; - {self.}SnapToGrid := new PureWValUnitDecorator(object_.SnapToGrid); - {self.}PStyle := new PureWValUnitDecorator(object_.PStyle); - {self.}NumPr := new NumPrUnitDecorator(object_.NumPr); - {self.}Jc := new PureWValUnitDecorator(object_.Jc); - {self.}Ind := new IndUnitDecorator(object_.Ind); - if not ifnil(object_.XmlChildKeepNext.Value) then {self.}XmlChildKeepNext.Value := object_.XmlChildKeepNext.Value; - if not ifnil(object_.XmlChildKeepLines.Value) then {self.}XmlChildKeepLines.Value := object_.XmlChildKeepLines.Value; - {self.}AdjustRightInd := new PureWValUnitDecorator(object_.AdjustRightInd); - {self.}Spacing := new SpacingUnitDecorator(object_.Spacing); - {self.}OutlineLvl := new PureWValUnitDecorator(object_.OutlineLvl); - {self.}AutoSpaceDE := new PureWValUnitDecorator(object_.AutoSpaceDE); - {self.}AutoSpaceDN := new PureWValUnitDecorator(object_.AutoSpaceDN); - {self.}RPr := new RPrUnitDecorator(object_.RPr); - {self.}PBdr := new PBdrUnitDecorator(object_.PBdr); - if not ifnil(object_.XmlChildContextualSpacing.Value) then {self.}XmlChildContextualSpacing.Value := object_.XmlChildContextualSpacing.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildSectPr) then + {self.}XmlChildSectPr := new SectPrUnitDecorator(object_.XmlChildSectPr); + if not ifnil(object_.XmlChildTabs) then + {self.}XmlChildTabs := new TabsUnitDecorator(object_.XmlChildTabs); + if not ifnil(object_.XmlChildWidowControl) then + {self.}WidowControl.Copy(object_.XmlChildWidowControl); + if not ifnil(object_.XmlChildSnapToGrid) then + {self.}XmlChildSnapToGrid := new PureWValUnitDecorator(object_.XmlChildSnapToGrid); + if not ifnil(object_.XmlChildPStyle) then + {self.}XmlChildPStyle := new PureWValUnitDecorator(object_.XmlChildPStyle); + if not ifnil(object_.XmlChildNumPr) then + {self.}XmlChildNumPr := new NumPrUnitDecorator(object_.XmlChildNumPr); + if not ifnil(object_.XmlChildJc) then + {self.}XmlChildJc := new PureWValUnitDecorator(object_.XmlChildJc); + if not ifnil(object_.XmlChildInd) then + {self.}XmlChildInd := new IndUnitDecorator(object_.XmlChildInd); + if not ifnil(object_.XmlChildKeepNext) then + {self.}KeepNext.Copy(object_.XmlChildKeepNext); + if not ifnil(object_.XmlChildKeepLines) then + {self.}KeepLines.Copy(object_.XmlChildKeepLines); + if not ifnil(object_.XmlChildAdjustRightInd) then + {self.}XmlChildAdjustRightInd := new PureWValUnitDecorator(object_.XmlChildAdjustRightInd); + if not ifnil(object_.XmlChildSpacing) then + {self.}XmlChildSpacing := new SpacingUnitDecorator(object_.XmlChildSpacing); + if not ifnil(object_.XmlChildOutlineLvl) then + {self.}XmlChildOutlineLvl := new PureWValUnitDecorator(object_.XmlChildOutlineLvl); + if not ifnil(object_.XmlChildAutoSpaceDE) then + {self.}XmlChildAutoSpaceDE := new PureWValUnitDecorator(object_.XmlChildAutoSpaceDE); + if not ifnil(object_.XmlChildAutoSpaceDN) then + {self.}XmlChildAutoSpaceDN := new PureWValUnitDecorator(object_.XmlChildAutoSpaceDN); + if not ifnil(object_.XmlChildRPr) then + {self.}XmlChildRPr := new RPrUnitDecorator(object_.XmlChildRPr); + if not ifnil(object_.XmlChildPBdr) then + {self.}XmlChildPBdr := new PBdrUnitDecorator(object_.XmlChildPBdr); + if not ifnil(object_.XmlChildContextualSpacing) then + {self.}ContextualSpacing.Copy(object_.XmlChildContextualSpacing); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PUnitDecorator@DOCX.tsf index 92e3f22..0bdc3f8 100644 --- a/autoclass/decorator/docx/PUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PUnitDecorator@DOCX.tsf @@ -22,11 +22,21 @@ end; function PUnitDecorator.Convert(); begin - {self.}XmlAttrW14ParaId.Value := object_.XmlAttrW14ParaId.Value; - {self.}XmlAttrW14TextId.Value := object_.XmlAttrW14TextId.Value; - {self.}XmlAttrWRsidR.Value := object_.XmlAttrWRsidR.Value; - {self.}XmlAttrWRsidRPr.Value := object_.XmlAttrWRsidRPr.Value; - {self.}XmlAttrWRsidRDefault.Value := object_.XmlAttrWRsidRDefault.Value; - {self.}XmlAttrWRsidP.Value := object_.XmlAttrWRsidP.Value; - {self.}PPr := new PPrUnitDecorator(object_.PPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrW14ParaId) then + {self.}W14ParaId := object_.XmlAttrW14ParaId.Value; + if not ifnil(object_.XmlAttrW14TextId) then + {self.}W14TextId := object_.XmlAttrW14TextId.Value; + if not ifnil(object_.XmlAttrWRsidR) then + {self.}WRsidR := object_.XmlAttrWRsidR.Value; + if not ifnil(object_.XmlAttrWRsidRPr) then + {self.}WRsidRPr := object_.XmlAttrWRsidRPr.Value; + if not ifnil(object_.XmlAttrWRsidRDefault) then + {self.}WRsidRDefault := object_.XmlAttrWRsidRDefault.Value; + if not ifnil(object_.XmlAttrWRsidP) then + {self.}WRsidP := object_.XmlAttrWRsidP.Value; + if not ifnil(object_.XmlChildPPr) then + {self.}XmlChildPPr := new PPrUnitDecorator(object_.XmlChildPPr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PathUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PathUnitDecorator@DOCX.tsf index a62c0b3..3ed15d1 100644 --- a/autoclass/decorator/docx/PathUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PathUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function PathUnitDecorator.Convert(); begin - {self.}XmlAttrGradientshapeok.Value := object_.XmlAttrGradientshapeok.Value; - {self.}XmlAttrConnecttype.Value := object_.XmlAttrConnecttype.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrGradientshapeok) then + {self.}Gradientshapeok := object_.XmlAttrGradientshapeok.Value; + if not ifnil(object_.XmlAttrConnecttype) then + {self.}Connecttype := object_.XmlAttrConnecttype.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PgMarUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PgMarUnitDecorator@DOCX.tsf index c588ab3..4b843e9 100644 --- a/autoclass/decorator/docx/PgMarUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PgMarUnitDecorator@DOCX.tsf @@ -22,11 +22,21 @@ end; function PgMarUnitDecorator.Convert(); begin - {self.}XmlAttrTop.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrTop.Value); - {self.}XmlAttrRight.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrRight.Value); - {self.}XmlAttrBottom.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrBottom.Value); - {self.}XmlAttrLeft.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrLeft.Value); - {self.}XmlAttrHeader.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrHeader.Value); - {self.}XmlAttrFooter.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrFooter.Value); - {self.}XmlAttrGutter.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrGutter.Value); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrTop) then + {self.}Top := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrTop.Value); + if not ifnil(object_.XmlAttrRight) then + {self.}Right := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrRight.Value); + if not ifnil(object_.XmlAttrBottom) then + {self.}Bottom := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrBottom.Value); + if not ifnil(object_.XmlAttrLeft) then + {self.}Left := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrLeft.Value); + if not ifnil(object_.XmlAttrHeader) then + {self.}Header := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrHeader.Value); + if not ifnil(object_.XmlAttrFooter) then + {self.}Footer := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrFooter.Value); + if not ifnil(object_.XmlAttrGutter) then + {self.}Gutter := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrGutter.Value); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PgNumTypeUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PgNumTypeUnitDecorator@DOCX.tsf index c4b223d..8de7731 100644 --- a/autoclass/decorator/docx/PgNumTypeUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PgNumTypeUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function PgNumTypeUnitDecorator.Convert(); begin - {self.}XmlAttrStart.Value := TSSafeUnitConverter.ToInt(object_.XmlAttrStart.Value); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrStart) then + {self.}Start := TSSafeUnitConverter.ToInt(object_.XmlAttrStart.Value); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PgSzUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PgSzUnitDecorator@DOCX.tsf index cbe054f..ef73e03 100644 --- a/autoclass/decorator/docx/PgSzUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PgSzUnitDecorator@DOCX.tsf @@ -22,7 +22,15 @@ end; function PgSzUnitDecorator.Convert(); begin - {self.}XmlAttrW.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrW.Value); - {self.}XmlAttrH.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrH.Value); - {self.}XmlAttrOrient.Value := object_.XmlAttrOrient.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrW) then + {self.}W := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrW.Value); + if not ifnil(object_.XmlAttrH) then + {self.}H := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrH.Value); + if not ifnil(object_.XmlAttrOrient) then + {self.}Orient := object_.XmlAttrOrient.Value; + if not ifnil(object_.XmlAttrCode) then + {self.}Code := object_.XmlAttrCode.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PicLocksUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PicLocksUnitDecorator@DOCX.tsf index 84b89cd..651fd1e 100644 --- a/autoclass/decorator/docx/PicLocksUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PicLocksUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function PicLocksUnitDecorator.Convert(); begin - {self.}XmlAttrNoChangeAspect.Value := object_.XmlAttrNoChangeAspect.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrNoChangeAspect) then + {self.}NoChangeAspect := object_.XmlAttrNoChangeAspect.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PicUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PicUnitDecorator@DOCX.tsf index ba4399d..5350bfb 100644 --- a/autoclass/decorator/docx/PicUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PicUnitDecorator@DOCX.tsf @@ -22,8 +22,15 @@ end; function PicUnitDecorator.Convert(); begin - {self.}XmlAttrXmlnsPic.Value := object_.XmlAttrXmlnsPic.Value; - {self.}NvPicPr := new NvPicPrUnitDecorator(object_.NvPicPr); - {self.}BlipFill := new BlipFillUnitDecorator(object_.BlipFill); - {self.}SpPr := new SpPrUnitDecorator(object_.SpPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXmlnsPic) then + {self.}XmlnsPic := object_.XmlAttrXmlnsPic.Value; + if not ifnil(object_.XmlChildNvPicPr) then + {self.}XmlChildNvPicPr := new NvPicPrUnitDecorator(object_.XmlChildNvPicPr); + if not ifnil(object_.XmlChildBlipFill) then + {self.}XmlChildBlipFill := new BlipFillUnitDecorator(object_.XmlChildBlipFill); + if not ifnil(object_.XmlChildSpPr) then + {self.}XmlChildSpPr := new SpPrUnitDecorator(object_.XmlChildSpPr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PictUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PictUnitDecorator@DOCX.tsf index 6a357c7..967c19c 100644 --- a/autoclass/decorator/docx/PictUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PictUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function PictUnitDecorator.Convert(); begin - {self.}Shapetype := new ShapetypeUnitDecorator(object_.Shapetype); - {self.}Shape := new ShapeUnitDecorator(object_.Shape); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildShapetype) then + {self.}XmlChildShapetype := new ShapetypeUnitDecorator(object_.XmlChildShapetype); + if not ifnil(object_.XmlChildShape) then + {self.}XmlChildShape := new ShapeUnitDecorator(object_.XmlChildShape); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PlotAreaUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PlotAreaUnitDecorator@DOCX.tsf index 91079ce..b8e9ac0 100644 --- a/autoclass/decorator/docx/PlotAreaUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PlotAreaUnitDecorator@DOCX.tsf @@ -22,10 +22,19 @@ end; function PlotAreaUnitDecorator.Convert(); begin - if not ifnil(object_.XmlChildLayout.Value) then {self.}XmlChildLayout.Value := object_.XmlChildLayout.Value; - {self.}BarChart := new BarChartUnitDecorator(object_.BarChart); - {self.}CatAx := new AxUnitDecorator(object_.CatAx); - {self.}ValAx := new AxUnitDecorator(object_.ValAx); - {self.}DTable := new DTableUnitDecorator(object_.DTable); - {self.}SpPr := new SpPrUnitDecorator(object_.SpPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildLayout) then + {self.}Layout.Copy(object_.XmlChildLayout); + if not ifnil(object_.XmlChildBarChart) then + {self.}XmlChildBarChart := new BarChartUnitDecorator(object_.XmlChildBarChart); + if not ifnil(object_.XmlChildCatAx) then + {self.}XmlChildCatAx := new AxUnitDecorator(object_.XmlChildCatAx); + if not ifnil(object_.XmlChildValAx) then + {self.}XmlChildValAx := new AxUnitDecorator(object_.XmlChildValAx); + if not ifnil(object_.XmlChildDTable) then + {self.}XmlChildDTable := new DTableUnitDecorator(object_.XmlChildDTable); + if not ifnil(object_.XmlChildSpPr) then + {self.}XmlChildSpPr := new SpPrUnitDecorator(object_.XmlChildSpPr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PositionHUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PositionHUnitDecorator@DOCX.tsf index 4c4be12..6e6839f 100644 --- a/autoclass/decorator/docx/PositionHUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PositionHUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function PositionHUnitDecorator.Convert(); begin - {self.}XmlAttrRelativeFrom.Value := object_.XmlAttrRelativeFrom.Value; - {self.}PosOffset.Text := TSSafeUnitConverter.EmusToPoints(object_.PosOffset.Text); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrRelativeFrom) then + {self.}RelativeFrom := object_.XmlAttrRelativeFrom.Value; + if not ifnil(object_.XmlChildPosOffset) then + {self.}PosOffset.Text := TSSafeUnitConverter.EmusToPoints(object_.XmlChildPosOffset.Text); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PositionVUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PositionVUnitDecorator@DOCX.tsf index ed3afb5..e5152a7 100644 --- a/autoclass/decorator/docx/PositionVUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PositionVUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function PositionVUnitDecorator.Convert(); begin - {self.}XmlAttrRelativeFrom.Value := object_.XmlAttrRelativeFrom.Value; - {self.}PosOffset.Text := TSSafeUnitConverter.EmusToPoints(object_.PosOffset.Text); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrRelativeFrom) then + {self.}RelativeFrom := object_.XmlAttrRelativeFrom.Value; + if not ifnil(object_.XmlChildPosOffset) then + {self.}PosOffset.Text := TSSafeUnitConverter.EmusToPoints(object_.XmlChildPosOffset.Text); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PropertiesUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PropertiesUnitDecorator@DOCX.tsf index ca2d750..baded62 100644 --- a/autoclass/decorator/docx/PropertiesUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PropertiesUnitDecorator@DOCX.tsf @@ -22,6 +22,27 @@ end; function PropertiesUnitDecorator.Convert(); begin - {self.}XmlAttrXmlns.Value := object_.XmlAttrXmlns.Value; - {self.}XmlAttrXmlnsVt.Value := object_.XmlAttrXmlnsVt.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXmlns) then + {self.}Xmlns := object_.XmlAttrXmlns.Value; + if not ifnil(object_.XmlAttrXmlnsVt) then + {self.}XmlnsVt := object_.XmlAttrXmlnsVt.Value; + if not ifnil(object_.XmlChildTemplate) then + if not ifnil(object_.XmlChildTotalTime) then + if not ifnil(object_.XmlChildPages) then + if not ifnil(object_.XmlChildWords) then + if not ifnil(object_.XmlChildCharacters) then + if not ifnil(object_.XmlChildApplication) then + if not ifnil(object_.XmlChildDocSecurity) then + if not ifnil(object_.XmlChildLines) then + if not ifnil(object_.XmlChildParagraphs) then + if not ifnil(object_.XmlChildScaleCrop) then + if not ifnil(object_.XmlChildCompany) then + if not ifnil(object_.XmlChildLinksUpToDate) then + if not ifnil(object_.XmlChildCharactersWithSpaces) then + if not ifnil(object_.XmlChildSharedDoc) then + if not ifnil(object_.XmlChildHyperlinksChanged) then + if not ifnil(object_.XmlChildAppVersion) then + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PrstGeomUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PrstGeomUnitDecorator@DOCX.tsf index ea89c58..e94266c 100644 --- a/autoclass/decorator/docx/PrstGeomUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PrstGeomUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function PrstGeomUnitDecorator.Convert(); begin - {self.}XmlAttrPrst.Value := object_.XmlAttrPrst.Value; - {self.}AvLst := new PureValUnitDecorator(object_.AvLst); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrPrst) then + {self.}Prst := object_.XmlAttrPrst.Value; + if not ifnil(object_.XmlChildAvLst) then + {self.}XmlChildAvLst := new PureValUnitDecorator(object_.XmlChildAvLst); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PrstTxWrapUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PrstTxWrapUnitDecorator@DOCX.tsf index 424b5fc..2022148 100644 --- a/autoclass/decorator/docx/PrstTxWrapUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PrstTxWrapUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function PrstTxWrapUnitDecorator.Convert(); begin - {self.}XmlAttrPrst.Value := object_.XmlAttrPrst.Value; - if not ifnil(object_.XmlChildAvLst.Value) then {self.}XmlChildAvLst.Value := object_.XmlChildAvLst.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrPrst) then + {self.}Prst := object_.XmlAttrPrst.Value; + if not ifnil(object_.XmlChildAvLst) then + {self.}AvLst.Copy(object_.XmlChildAvLst); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PtUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PtUnitDecorator@DOCX.tsf index 8caf086..a6a977d 100644 --- a/autoclass/decorator/docx/PtUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PtUnitDecorator@DOCX.tsf @@ -22,5 +22,10 @@ end; function PtUnitDecorator.Convert(); begin - {self.}XmlAttrIdx.Value := object_.XmlAttrIdx.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrIdx) then + {self.}Idx := object_.XmlAttrIdx.Value; + if not ifnil(object_.XmlChildV) then + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PureValUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PureValUnitDecorator@DOCX.tsf index dfb5787..35de7df 100644 --- a/autoclass/decorator/docx/PureValUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PureValUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function PureValUnitDecorator.Convert(); begin - {self.}XmlAttrVal.Value := object_.XmlAttrVal.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrVal) then + {self.}Val := object_.XmlAttrVal.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/PureWValUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/PureWValUnitDecorator@DOCX.tsf index aea332a..007dcbf 100644 --- a/autoclass/decorator/docx/PureWValUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/PureWValUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function PureWValUnitDecorator.Convert(); begin - {self.}XmlAttrVal.Value := object_.XmlAttrVal.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrVal) then + {self.}Val := object_.XmlAttrVal.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/RFontsUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/RFontsUnitDecorator@DOCX.tsf index 9d96bce..6269742 100644 --- a/autoclass/decorator/docx/RFontsUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/RFontsUnitDecorator@DOCX.tsf @@ -22,12 +22,23 @@ end; function RFontsUnitDecorator.Convert(); begin - {self.}XmlAttrAscii.Value := object_.XmlAttrAscii.Value; - {self.}XmlAttrAsciiTheme.Value := object_.XmlAttrAsciiTheme.Value; - {self.}XmlAttrEastAsia.Value := object_.XmlAttrEastAsia.Value; - {self.}XmlAttrEastAsiaTheme.Value := object_.XmlAttrEastAsiaTheme.Value; - {self.}XmlAttrHAnsi.Value := object_.XmlAttrHAnsi.Value; - {self.}XmlAttrHAnsiTheme.Value := object_.XmlAttrHAnsiTheme.Value; - {self.}XmlAttrHint.Value := object_.XmlAttrHint.Value; - {self.}XmlAttrCsTheme.Value := object_.XmlAttrCsTheme.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrAscii) then + {self.}Ascii := object_.XmlAttrAscii.Value; + if not ifnil(object_.XmlAttrAsciiTheme) then + {self.}AsciiTheme := object_.XmlAttrAsciiTheme.Value; + if not ifnil(object_.XmlAttrEastAsia) then + {self.}EastAsia := object_.XmlAttrEastAsia.Value; + if not ifnil(object_.XmlAttrEastAsiaTheme) then + {self.}EastAsiaTheme := object_.XmlAttrEastAsiaTheme.Value; + if not ifnil(object_.XmlAttrHAnsi) then + {self.}HAnsi := object_.XmlAttrHAnsi.Value; + if not ifnil(object_.XmlAttrHAnsiTheme) then + {self.}HAnsiTheme := object_.XmlAttrHAnsiTheme.Value; + if not ifnil(object_.XmlAttrHint) then + {self.}Hint := object_.XmlAttrHint.Value; + if not ifnil(object_.XmlAttrCsTheme) then + {self.}CsTheme := object_.XmlAttrCsTheme.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/RPrDefaultUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/RPrDefaultUnitDecorator@DOCX.tsf index cb8dcdf..d6c9c55 100644 --- a/autoclass/decorator/docx/RPrDefaultUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/RPrDefaultUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function RPrDefaultUnitDecorator.Convert(); begin - {self.}RPr := new RPrUnitDecorator(object_.RPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildRPr) then + {self.}XmlChildRPr := new RPrUnitDecorator(object_.XmlChildRPr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/RPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/RPrUnitDecorator@DOCX.tsf index b6849f2..18eac33 100644 --- a/autoclass/decorator/docx/RPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/RPrUnitDecorator@DOCX.tsf @@ -22,20 +22,39 @@ end; function RPrUnitDecorator.Convert(); begin - {self.}NoProof := new PureValUnitDecorator(object_.NoProof); - {self.}WebHidden := new PureWValUnitDecorator(object_.WebHidden); - {self.}RStyle := new PureWValUnitDecorator(object_.RStyle); - {self.}RFonts := new RFontsUnitDecorator(object_.RFonts); - {self.}Kern := new PureWValUnitDecorator(object_.Kern); - if not ifnil(object_.XmlChildI.Value) then {self.}XmlChildI.Value := object_.XmlChildI.Value; - if not ifnil(object_.XmlChildICs.Value) then {self.}XmlChildICs.Value := object_.XmlChildICs.Value; - if not ifnil(object_.XmlChildB.Value) then {self.}XmlChildB.Value := object_.XmlChildB.Value; - if not ifnil(object_.XmlChildBCs.Value) then {self.}XmlChildBCs.Value := object_.XmlChildBCs.Value; - if not ifnil(object_.XmlChildStrike.Value) then {self.}XmlChildStrike.Value := object_.XmlChildStrike.Value; - {self.}Color := new ColorUnitDecorator(object_.Color); - {self.}Sz := new SzUnitDecorator(object_.Sz); - {self.}SzCs := new SzCsUnitDecorator(object_.SzCs); - if not ifnil(object_.XmlChildU.Value) then {self.}XmlChildU.Value := object_.XmlChildU.Value; - {self.}Lang := new LangUnitDecorator(object_.Lang); - {self.}W14Ligatures := new PureWValUnitDecorator(object_.W14Ligatures); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildNoProof) then + {self.}XmlChildNoProof := new PureValUnitDecorator(object_.XmlChildNoProof); + if not ifnil(object_.XmlChildWebHidden) then + {self.}XmlChildWebHidden := new PureWValUnitDecorator(object_.XmlChildWebHidden); + if not ifnil(object_.XmlChildRStyle) then + {self.}XmlChildRStyle := new PureWValUnitDecorator(object_.XmlChildRStyle); + if not ifnil(object_.XmlChildRFonts) then + {self.}XmlChildRFonts := new RFontsUnitDecorator(object_.XmlChildRFonts); + if not ifnil(object_.XmlChildKern) then + {self.}XmlChildKern := new PureWValUnitDecorator(object_.XmlChildKern); + if not ifnil(object_.XmlChildI) then + {self.}I.Copy(object_.XmlChildI); + if not ifnil(object_.XmlChildICs) then + {self.}ICs.Copy(object_.XmlChildICs); + if not ifnil(object_.XmlChildB) then + {self.}B.Copy(object_.XmlChildB); + if not ifnil(object_.XmlChildBCs) then + {self.}BCs.Copy(object_.XmlChildBCs); + if not ifnil(object_.XmlChildStrike) then + {self.}Strike.Copy(object_.XmlChildStrike); + if not ifnil(object_.XmlChildColor) then + {self.}XmlChildColor := new ColorUnitDecorator(object_.XmlChildColor); + 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.}U.Copy(object_.XmlChildU); + if not ifnil(object_.XmlChildLang) then + {self.}XmlChildLang := new LangUnitDecorator(object_.XmlChildLang); + if not ifnil(object_.XmlChildW14Ligatures) then + {self.}XmlChildW14Ligatures := new PureWValUnitDecorator(object_.XmlChildW14Ligatures); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/RUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/RUnitDecorator@DOCX.tsf index 2e1de8e..0f1dc84 100644 --- a/autoclass/decorator/docx/RUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/RUnitDecorator@DOCX.tsf @@ -22,17 +22,35 @@ end; function RUnitDecorator.Convert(); begin - {self.}XmlAttrWRsidRPr.Value := object_.XmlAttrWRsidRPr.Value; - {self.}XmlAttrAnchor.Value := object_.XmlAttrAnchor.Value; - {self.}XmlAttrHistory.Value := object_.XmlAttrHistory.Value; - {self.}RPr := new RPrUnitDecorator(object_.RPr); - {self.}Br := new BrUnitDecorator(object_.Br); - {self.}FldChar := new FldCharUnitDecorator(object_.FldChar); - {self.}InstrText := new InstrTextUnitDecorator(object_.InstrText); - if not ifnil(object_.XmlChildSeparator.Value) then {self.}XmlChildSeparator.Value := object_.XmlChildSeparator.Value; - if not ifnil(object_.XmlChildContinuationSeparator.Value) then {self.}XmlChildContinuationSeparator.Value := object_.XmlChildContinuationSeparator.Value; - if not ifnil(object_.XmlChildLastRenderedPageBreak.Value) then {self.}XmlChildLastRenderedPageBreak.Value := object_.XmlChildLastRenderedPageBreak.Value; - {self.}AlternateContent := new AlternateContentUnitDecorator(object_.AlternateContent); - {self.}Drawing := new DrawingUnitDecorator(object_.Drawing); - {self.}T := new TUnitDecorator(object_.T); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrWRsidRPr) then + {self.}WRsidRPr := object_.XmlAttrWRsidRPr.Value; + if not ifnil(object_.XmlAttrAnchor) then + {self.}Anchor := object_.XmlAttrAnchor.Value; + if not ifnil(object_.XmlAttrHistory) then + {self.}History := object_.XmlAttrHistory.Value; + if not ifnil(object_.XmlChildRPr) then + {self.}XmlChildRPr := new RPrUnitDecorator(object_.XmlChildRPr); + if not ifnil(object_.XmlChildBr) then + {self.}XmlChildBr := new BrUnitDecorator(object_.XmlChildBr); + if not ifnil(object_.XmlChildFldChar) then + {self.}XmlChildFldChar := new FldCharUnitDecorator(object_.XmlChildFldChar); + if not ifnil(object_.XmlChildInstrText) then + {self.}XmlChildInstrText := new InstrTextUnitDecorator(object_.XmlChildInstrText); + if not ifnil(object_.XmlChildSeparator) then + {self.}Separator.Copy(object_.XmlChildSeparator); + if not ifnil(object_.XmlChildContinuationSeparator) then + {self.}ContinuationSeparator.Copy(object_.XmlChildContinuationSeparator); + if not ifnil(object_.XmlChildLastRenderedPageBreak) then + {self.}LastRenderedPageBreak.Copy(object_.XmlChildLastRenderedPageBreak); + if not ifnil(object_.XmlChildAlternateContent) then + {self.}XmlChildAlternateContent := new AlternateContentUnitDecorator(object_.XmlChildAlternateContent); + if not ifnil(object_.XmlChildDrawing) then + {self.}XmlChildDrawing := new DrawingUnitDecorator(object_.XmlChildDrawing); + if not ifnil(object_.XmlChildT) then + {self.}XmlChildT := new TUnitDecorator(object_.XmlChildT); + if not ifnil(object_.XmlChildFootnoteReference) then + {self.}XmlChildFootnoteReference := new FootnoteReferenceUnitDecorator(object_.XmlChildFootnoteReference); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ReferenceUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ReferenceUnitDecorator@DOCX.tsf index c652bae..19d94cc 100644 --- a/autoclass/decorator/docx/ReferenceUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ReferenceUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function ReferenceUnitDecorator.Convert(); begin - {self.}XmlAttrType.Value := object_.XmlAttrType.Value; - {self.}XmlAttrId.Value := object_.XmlAttrId.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrType) then + {self.}Type := object_.XmlAttrType.Value; + if not ifnil(object_.XmlAttrId) then + {self.}Id := object_.XmlAttrId.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/RelationshipUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/RelationshipUnitDecorator@DOCX.tsf index 031c133..76f551f 100644 --- a/autoclass/decorator/docx/RelationshipUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/RelationshipUnitDecorator@DOCX.tsf @@ -22,7 +22,13 @@ end; function RelationshipUnitDecorator.Convert(); begin - {self.}XmlAttrId.Value := object_.XmlAttrId.Value; - {self.}XmlAttrType.Value := object_.XmlAttrType.Value; - {self.}XmlAttrTarget.Value := object_.XmlAttrTarget.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrId) then + {self.}Id := object_.XmlAttrId.Value; + if not ifnil(object_.XmlAttrType) then + {self.}Type := object_.XmlAttrType.Value; + if not ifnil(object_.XmlAttrTarget) then + {self.}Target := object_.XmlAttrTarget.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/RelationshipsUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/RelationshipsUnitDecorator@DOCX.tsf index 7a9433f..1fc4217 100644 --- a/autoclass/decorator/docx/RelationshipsUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/RelationshipsUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function RelationshipsUnitDecorator.Convert(); begin - {self.}XmlAttrxmlns.Value := object_.XmlAttrxmlns.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrxmlns) then + {self.}xmlns := object_.XmlAttrxmlns.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/RichUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/RichUnitDecorator@DOCX.tsf index 76c2f7e..85d9e19 100644 --- a/autoclass/decorator/docx/RichUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/RichUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function RichUnitDecorator.Convert(); begin - {self.}BodyPr := new BodyPrUnitDecorator(object_.BodyPr); - if not ifnil(object_.XmlChildLstStyle.Value) then {self.}XmlChildLstStyle.Value := object_.XmlChildLstStyle.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildBodyPr) then + {self.}XmlChildBodyPr := new BodyPrUnitDecorator(object_.XmlChildBodyPr); + if not ifnil(object_.XmlChildLstStyle) then + {self.}LstStyle.Copy(object_.XmlChildLstStyle); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/RsidsUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/RsidsUnitDecorator@DOCX.tsf index b176d9b..9e04d35 100644 --- a/autoclass/decorator/docx/RsidsUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/RsidsUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function RsidsUnitDecorator.Convert(); begin - {self.}RsidRoot := new PureWValUnitDecorator(object_.RsidRoot); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildRsidRoot) then + {self.}XmlChildRsidRoot := new PureWValUnitDecorator(object_.XmlChildRsidRoot); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ScalingUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ScalingUnitDecorator@DOCX.tsf index 5c28937..fa9531b 100644 --- a/autoclass/decorator/docx/ScalingUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ScalingUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function ScalingUnitDecorator.Convert(); begin - {self.}Orientation := new PureValUnitDecorator(object_.Orientation); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildOrientation) then + {self.}XmlChildOrientation := new PureValUnitDecorator(object_.XmlChildOrientation); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/SchemeClrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/SchemeClrUnitDecorator@DOCX.tsf index 1fcf048..d2765d8 100644 --- a/autoclass/decorator/docx/SchemeClrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/SchemeClrUnitDecorator@DOCX.tsf @@ -22,8 +22,15 @@ end; function SchemeClrUnitDecorator.Convert(); begin - {self.}XmlAttrVal.Value := object_.XmlAttrVal.Value; - {self.}LumMod := new PureValUnitDecorator(object_.LumMod); - {self.}SatMod := new PureValUnitDecorator(object_.SatMod); - {self.}Tint := new PureValUnitDecorator(object_.Tint); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrVal) then + {self.}Val := object_.XmlAttrVal.Value; + if not ifnil(object_.XmlChildLumMod) then + {self.}XmlChildLumMod := new PureValUnitDecorator(object_.XmlChildLumMod); + if not ifnil(object_.XmlChildSatMod) then + {self.}XmlChildSatMod := new PureValUnitDecorator(object_.XmlChildSatMod); + if not ifnil(object_.XmlChildTint) then + {self.}XmlChildTint := new PureValUnitDecorator(object_.XmlChildTint); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/SdtContentUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/SdtContentUnitDecorator@DOCX.tsf index faeed07..f9ea743 100644 --- a/autoclass/decorator/docx/SdtContentUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/SdtContentUnitDecorator@DOCX.tsf @@ -22,4 +22,7 @@ end; function SdtContentUnitDecorator.Convert(); begin + tslassigning_backup := tslassigning; + tslassigning := 1; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/SdtEndPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/SdtEndPrUnitDecorator@DOCX.tsf index 64d6838..36ee73f 100644 --- a/autoclass/decorator/docx/SdtEndPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/SdtEndPrUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function SdtEndPrUnitDecorator.Convert(); begin - {self.}RPr := new RPrUnitDecorator(object_.RPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildRPr) then + {self.}XmlChildRPr := new RPrUnitDecorator(object_.XmlChildRPr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/SdtPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/SdtPrUnitDecorator@DOCX.tsf index 6808a5b..b42ce5b 100644 --- a/autoclass/decorator/docx/SdtPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/SdtPrUnitDecorator@DOCX.tsf @@ -22,7 +22,13 @@ end; function SdtPrUnitDecorator.Convert(); begin - {self.}RPr := new RPrUnitDecorator(object_.RPr); - {self.}Id := new PureWValUnitDecorator(object_.Id); - {self.}DocPartObj := new DocPartObjUnitDecorator(object_.DocPartObj); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildRPr) then + {self.}XmlChildRPr := new RPrUnitDecorator(object_.XmlChildRPr); + if not ifnil(object_.XmlChildId) then + {self.}XmlChildId := new PureWValUnitDecorator(object_.XmlChildId); + if not ifnil(object_.XmlChildDocPartObj) then + {self.}XmlChildDocPartObj := new DocPartObjUnitDecorator(object_.XmlChildDocPartObj); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/SdtUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/SdtUnitDecorator@DOCX.tsf index c1d8018..7a00c82 100644 --- a/autoclass/decorator/docx/SdtUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/SdtUnitDecorator@DOCX.tsf @@ -22,7 +22,13 @@ end; function SdtUnitDecorator.Convert(); begin - {self.}SdtPr := new SdtPrUnitDecorator(object_.SdtPr); - {self.}SdtEndPr := new SdtEndPrUnitDecorator(object_.SdtEndPr); - {self.}SdtContent := new SdtContentUnitDecorator(object_.SdtContent); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildSdtPr) then + {self.}XmlChildSdtPr := new SdtPrUnitDecorator(object_.XmlChildSdtPr); + if not ifnil(object_.XmlChildSdtEndPr) then + {self.}XmlChildSdtEndPr := new SdtEndPrUnitDecorator(object_.XmlChildSdtEndPr); + if not ifnil(object_.XmlChildSdtContent) then + {self.}XmlChildSdtContent := new SdtContentUnitDecorator(object_.XmlChildSdtContent); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/SectPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/SectPrUnitDecorator@DOCX.tsf index 488a53f..64da258 100644 --- a/autoclass/decorator/docx/SectPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/SectPrUnitDecorator@DOCX.tsf @@ -22,13 +22,27 @@ end; function SectPrUnitDecorator.Convert(); begin - {self.}XmlAttrWRsidR.Value := object_.XmlAttrWRsidR.Value; - {self.}XmlAttrWRsidSect.Value := object_.XmlAttrWRsidSect.Value; - {self.}Type := new PureWValUnitDecorator(object_.Type); - {self.}PgSz := new PgSzUnitDecorator(object_.PgSz); - {self.}PgMar := new PgMarUnitDecorator(object_.PgMar); - {self.}PgNumType := new PgNumTypeUnitDecorator(object_.PgNumType); - {self.}Cols := new ColsUnitDecorator(object_.Cols); - if not ifnil(object_.XmlChildTitlePg.Value) then {self.}XmlChildTitlePg.Value := object_.XmlChildTitlePg.Value; - {self.}DocGrid := new docGridUnitDecorator(object_.DocGrid); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrWRsidR) then + {self.}WRsidR := object_.XmlAttrWRsidR.Value; + if not ifnil(object_.XmlAttrWRsidSect) then + {self.}WRsidSect := object_.XmlAttrWRsidSect.Value; + if not ifnil(object_.XmlChildFootnotePr) then + {self.}XmlChildFootnotePr := new FootnotePrUnitDecorator(object_.XmlChildFootnotePr); + if not ifnil(object_.XmlChildType) then + {self.}XmlChildType := new PureWValUnitDecorator(object_.XmlChildType); + if not ifnil(object_.XmlChildPgSz) then + {self.}XmlChildPgSz := new PgSzUnitDecorator(object_.XmlChildPgSz); + if not ifnil(object_.XmlChildPgMar) then + {self.}XmlChildPgMar := new PgMarUnitDecorator(object_.XmlChildPgMar); + if not ifnil(object_.XmlChildPgNumType) then + {self.}XmlChildPgNumType := new PgNumTypeUnitDecorator(object_.XmlChildPgNumType); + if not ifnil(object_.XmlChildCols) then + {self.}XmlChildCols := new ColsUnitDecorator(object_.XmlChildCols); + if not ifnil(object_.XmlChildTitlePg) then + {self.}TitlePg.Copy(object_.XmlChildTitlePg); + if not ifnil(object_.XmlChildDocGrid) then + {self.}XmlChildDocGrid := new docGridUnitDecorator(object_.XmlChildDocGrid); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/SerUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/SerUnitDecorator@DOCX.tsf index b0bb71a..b9c6cd4 100644 --- a/autoclass/decorator/docx/SerUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/SerUnitDecorator@DOCX.tsf @@ -22,12 +22,23 @@ end; function SerUnitDecorator.Convert(); begin - {self.}Idx := new PureValUnitDecorator(object_.Idx); - {self.}Order := new PureValUnitDecorator(object_.Order); - {self.}Tx := new TxUnitDecorator(object_.Tx); - {self.}InvertIfNegative := new PureValUnitDecorator(object_.InvertIfNegative); - {self.}DLbls := new DLblsUnitDecorator(object_.DLbls); - {self.}Cat := new CatUnitDecorator(object_.Cat); - {self.}Val := new ValUnitDecorator(object_.Val); - {self.}ExtLst := new ExtLstUnitDecorator(object_.ExtLst); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildIdx) then + {self.}XmlChildIdx := new PureValUnitDecorator(object_.XmlChildIdx); + if not ifnil(object_.XmlChildOrder) then + {self.}XmlChildOrder := new PureValUnitDecorator(object_.XmlChildOrder); + if not ifnil(object_.XmlChildTx) then + {self.}XmlChildTx := new TxUnitDecorator(object_.XmlChildTx); + if not ifnil(object_.XmlChildInvertIfNegative) then + {self.}XmlChildInvertIfNegative := new PureValUnitDecorator(object_.XmlChildInvertIfNegative); + if not ifnil(object_.XmlChildDLbls) then + {self.}XmlChildDLbls := new DLblsUnitDecorator(object_.XmlChildDLbls); + if not ifnil(object_.XmlChildCat) then + {self.}XmlChildCat := new CatUnitDecorator(object_.XmlChildCat); + if not ifnil(object_.XmlChildVal) then + {self.}XmlChildVal := new ValUnitDecorator(object_.XmlChildVal); + if not ifnil(object_.XmlChildExtLst) then + {self.}XmlChildExtLst := new ExtLstUnitDecorator(object_.XmlChildExtLst); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/SettingsUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/SettingsUnitDecorator@DOCX.tsf index e25ba32..fb8a2b9 100644 --- a/autoclass/decorator/docx/SettingsUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/SettingsUnitDecorator@DOCX.tsf @@ -22,42 +22,83 @@ end; function SettingsUnitDecorator.Convert(); begin - {self.}XmlAttrXmlnsO.Value := object_.XmlAttrXmlnsO.Value; - {self.}XmlAttrXmlnsR.Value := object_.XmlAttrXmlnsR.Value; - {self.}XmlAttrXmlnsM.Value := object_.XmlAttrXmlnsM.Value; - {self.}XmlAttrXmlnsV.Value := object_.XmlAttrXmlnsV.Value; - {self.}XmlAttrXmlnsW.Value := object_.XmlAttrXmlnsW.Value; - {self.}XmlAttrXmlnsW14.Value := object_.XmlAttrXmlnsW14.Value; - {self.}XmlAttrXmlnsW15.Value := object_.XmlAttrXmlnsW15.Value; - {self.}XmlAttrXmlnsW16Cex.Value := object_.XmlAttrXmlnsW16Cex.Value; - {self.}XmlAttrXmlnsW16Cid.Value := object_.XmlAttrXmlnsW16Cid.Value; - {self.}XmlAttrXmlnsW16.Value := object_.XmlAttrXmlnsW16.Value; - {self.}XmlAttrXmlnsW16Du.Value := object_.XmlAttrXmlnsW16Du.Value; - {self.}XmlAttrXmlnsW16se.Value := object_.XmlAttrXmlnsW16se.Value; - {self.}XmlAttrXmlnsSl.Value := object_.XmlAttrXmlnsSl.Value; - {self.}XmlAttrMcIgnorable.Value := object_.XmlAttrMcIgnorable.Value; - {self.}Zoom := new ZoomUnitDecorator(object_.Zoom); - if not ifnil(object_.XmlChildBordersDoNotSurroundHeader.Value) then {self.}XmlChildBordersDoNotSurroundHeader.Value := object_.XmlChildBordersDoNotSurroundHeader.Value; - if not ifnil(object_.XmlChildBordersDoNotSurroundFooter.Value) then {self.}XmlChildBordersDoNotSurroundFooter.Value := object_.XmlChildBordersDoNotSurroundFooter.Value; - {self.}DefaultTabStop := new PureWValUnitDecorator(object_.DefaultTabStop); - if not ifnil(object_.XmlChildEvenAndOddHeaders.Value) then {self.}XmlChildEvenAndOddHeaders.Value := object_.XmlChildEvenAndOddHeaders.Value; - {self.}DrawingGridVerticalSpacing := new PureWValUnitDecorator(object_.DrawingGridVerticalSpacing); - {self.}DisplayHorizontalDrawingGridEvery := new PureWValUnitDecorator(object_.DisplayHorizontalDrawingGridEvery); - {self.}DisplayVerticalDrawingGridEvery := new PureWValUnitDecorator(object_.DisplayVerticalDrawingGridEvery); - {self.}CharacterSpacingControl := new PureWValUnitDecorator(object_.CharacterSpacingControl); - {self.}HdrShapeDefaults := new HdrShapeDefaultsUnitDecorator(object_.HdrShapeDefaults); - {self.}FootnotePr := new FootnotePrUnitDecorator(object_.FootnotePr); - {self.}EndnotePr := new EndnotePrUnitDecorator(object_.EndnotePr); - {self.}Compat := new CompatUnitDecorator(object_.Compat); - {self.}Rsids := new RsidsUnitDecorator(object_.Rsids); - {self.}MathPr := new MathPrUnitDecorator(object_.MathPr); - {self.}ThemeFontLang := new ThemeFontLangUnitDecorator(object_.ThemeFontLang); - {self.}ClrSchemeMapping := new ClrSchemeMappingUnitDecorator(object_.ClrSchemeMapping); - if not ifnil(object_.XmlChildDoNotIncludeSubdocsInStats.Value) then {self.}XmlChildDoNotIncludeSubdocsInStats.Value := object_.XmlChildDoNotIncludeSubdocsInStats.Value; - {self.}ShapeDefaults := new ShapeDefaults2UnitDecorator(object_.ShapeDefaults); - {self.}DecimalSymbol := new PureWValUnitDecorator(object_.DecimalSymbol); - {self.}ListSeparator := new PureWValUnitDecorator(object_.ListSeparator); - {self.}W14DocId := new PureWValUnitDecorator(object_.W14DocId); - if not ifnil(object_.XmlChildW15ChartTrackingRefBased.Value) then {self.}XmlChildW15ChartTrackingRefBased.Value := object_.XmlChildW15ChartTrackingRefBased.Value; - {self.}W15DocId := new PureWValUnitDecorator(object_.W15DocId); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXmlnsO) then + {self.}XmlnsO := object_.XmlAttrXmlnsO.Value; + if not ifnil(object_.XmlAttrXmlnsR) then + {self.}XmlnsR := object_.XmlAttrXmlnsR.Value; + if not ifnil(object_.XmlAttrXmlnsM) then + {self.}XmlnsM := object_.XmlAttrXmlnsM.Value; + if not ifnil(object_.XmlAttrXmlnsV) then + {self.}XmlnsV := object_.XmlAttrXmlnsV.Value; + if not ifnil(object_.XmlAttrXmlnsW) then + {self.}XmlnsW := object_.XmlAttrXmlnsW.Value; + if not ifnil(object_.XmlAttrXmlnsW14) then + {self.}XmlnsW14 := object_.XmlAttrXmlnsW14.Value; + if not ifnil(object_.XmlAttrXmlnsW15) then + {self.}XmlnsW15 := object_.XmlAttrXmlnsW15.Value; + if not ifnil(object_.XmlAttrXmlnsW16Cex) then + {self.}XmlnsW16Cex := object_.XmlAttrXmlnsW16Cex.Value; + if not ifnil(object_.XmlAttrXmlnsW16Cid) then + {self.}XmlnsW16Cid := object_.XmlAttrXmlnsW16Cid.Value; + if not ifnil(object_.XmlAttrXmlnsW16) then + {self.}XmlnsW16 := object_.XmlAttrXmlnsW16.Value; + if not ifnil(object_.XmlAttrXmlnsW16Du) then + {self.}XmlnsW16Du := object_.XmlAttrXmlnsW16Du.Value; + if not ifnil(object_.XmlAttrXmlnsW16se) then + {self.}XmlnsW16se := object_.XmlAttrXmlnsW16se.Value; + if not ifnil(object_.XmlAttrXmlnsSl) then + {self.}XmlnsSl := object_.XmlAttrXmlnsSl.Value; + if not ifnil(object_.XmlAttrMcIgnorable) then + {self.}McIgnorable := object_.XmlAttrMcIgnorable.Value; + if not ifnil(object_.XmlChildZoom) then + {self.}XmlChildZoom := new ZoomUnitDecorator(object_.XmlChildZoom); + if not ifnil(object_.XmlChildBordersDoNotSurroundHeader) then + {self.}BordersDoNotSurroundHeader.Copy(object_.XmlChildBordersDoNotSurroundHeader); + if not ifnil(object_.XmlChildBordersDoNotSurroundFooter) then + {self.}BordersDoNotSurroundFooter.Copy(object_.XmlChildBordersDoNotSurroundFooter); + if not ifnil(object_.XmlChildDefaultTabStop) then + {self.}XmlChildDefaultTabStop := new PureWValUnitDecorator(object_.XmlChildDefaultTabStop); + if not ifnil(object_.XmlChildEvenAndOddHeaders) then + {self.}EvenAndOddHeaders.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.}DoNotIncludeSubdocsInStats.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_.XmlChildW14DocId) then + {self.}XmlChildW14DocId := new PureWValUnitDecorator(object_.XmlChildW14DocId); + if not ifnil(object_.XmlChildW15ChartTrackingRefBased) then + {self.}W15ChartTrackingRefBased.Copy(object_.XmlChildW15ChartTrackingRefBased); + if not ifnil(object_.XmlChildW15DocId) then + {self.}XmlChildW15DocId := new PureWValUnitDecorator(object_.XmlChildW15DocId); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ShapeDefaults2UnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ShapeDefaults2UnitDecorator@DOCX.tsf index 73e0112..0fb2e28 100644 --- a/autoclass/decorator/docx/ShapeDefaults2UnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ShapeDefaults2UnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function ShapeDefaults2UnitDecorator.Convert(); begin - {self.}ShapeDefaults := new ShapeDefaultsUnitDecorator(object_.ShapeDefaults); - {self.}ShapeLayout := new ShapeLayoutUnitDecorator(object_.ShapeLayout); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildShapeDefaults) then + {self.}XmlChildShapeDefaults := new ShapeDefaultsUnitDecorator(object_.XmlChildShapeDefaults); + if not ifnil(object_.XmlChildShapeLayout) then + {self.}XmlChildShapeLayout := new ShapeLayoutUnitDecorator(object_.XmlChildShapeLayout); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ShapeDefaultsUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ShapeDefaultsUnitDecorator@DOCX.tsf index 100bf41..6510bf4 100644 --- a/autoclass/decorator/docx/ShapeDefaultsUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ShapeDefaultsUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function ShapeDefaultsUnitDecorator.Convert(); begin - {self.}XmlAttrExt.Value := object_.XmlAttrExt.Value; - {self.}XmlAttrSpidmax.Value := object_.XmlAttrSpidmax.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrExt) then + {self.}Ext := object_.XmlAttrExt.Value; + if not ifnil(object_.XmlAttrSpidmax) then + {self.}Spidmax := object_.XmlAttrSpidmax.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ShapeLayoutUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ShapeLayoutUnitDecorator@DOCX.tsf index 71e8c95..799f04a 100644 --- a/autoclass/decorator/docx/ShapeLayoutUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ShapeLayoutUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function ShapeLayoutUnitDecorator.Convert(); begin - {self.}XmlAttrExt.Value := object_.XmlAttrExt.Value; - {self.}IdMap := new IdMapUnitDecorator(object_.IdMap); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrExt) then + {self.}Ext := object_.XmlAttrExt.Value; + if not ifnil(object_.XmlChildIdMap) then + {self.}XmlChildIdMap := new IdMapUnitDecorator(object_.XmlChildIdMap); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ShapeUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ShapeUnitDecorator@DOCX.tsf index 574aaf4..a471547 100644 --- a/autoclass/decorator/docx/ShapeUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ShapeUnitDecorator@DOCX.tsf @@ -22,11 +22,21 @@ end; function ShapeUnitDecorator.Convert(); begin - {self.}XmlAttrId.Value := object_.XmlAttrId.Value; - {self.}XmlAttrSpid.Value := object_.XmlAttrSpid.Value; - {self.}XmlAttrType.Value := object_.XmlAttrType.Value; - {self.}XmlAttrGfxdata.Value := object_.XmlAttrGfxdata.Value; - {self.}XmlAttrFilled.Value := object_.XmlAttrFilled.Value; - {self.}XmlAttrStroked.Value := object_.XmlAttrStroked.Value; - {self.}Textbox := new TextboxUnitDecorator(object_.Textbox); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrId) then + {self.}Id := object_.XmlAttrId.Value; + if not ifnil(object_.XmlAttrSpid) then + {self.}Spid := object_.XmlAttrSpid.Value; + if not ifnil(object_.XmlAttrType) then + {self.}Type := object_.XmlAttrType.Value; + if not ifnil(object_.XmlAttrGfxdata) then + {self.}Gfxdata := object_.XmlAttrGfxdata.Value; + if not ifnil(object_.XmlAttrFilled) then + {self.}Filled := object_.XmlAttrFilled.Value; + if not ifnil(object_.XmlAttrStroked) then + {self.}Stroked := object_.XmlAttrStroked.Value; + if not ifnil(object_.XmlChildTextbox) then + {self.}XmlChildTextbox := new TextboxUnitDecorator(object_.XmlChildTextbox); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ShapetypeUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ShapetypeUnitDecorator@DOCX.tsf index e413544..2ed2099 100644 --- a/autoclass/decorator/docx/ShapetypeUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ShapetypeUnitDecorator@DOCX.tsf @@ -22,11 +22,21 @@ end; function ShapetypeUnitDecorator.Convert(); begin - {self.}XmlAttrAnchorId.Value := object_.XmlAttrAnchorId.Value; - {self.}XmlAttrId.Value := object_.XmlAttrId.Value; - {self.}XmlAttrCoordsize.Value := object_.XmlAttrCoordsize.Value; - {self.}XmlAttrSpt.Value := object_.XmlAttrSpt.Value; - {self.}XmlAttrPath.Value := object_.XmlAttrPath.Value; - {self.}Stroke := new StrokeUnitDecorator(object_.Stroke); - {self.}Path := new PathUnitDecorator(object_.Path); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrAnchorId) then + {self.}AnchorId := object_.XmlAttrAnchorId.Value; + if not ifnil(object_.XmlAttrId) then + {self.}Id := object_.XmlAttrId.Value; + if not ifnil(object_.XmlAttrCoordsize) then + {self.}Coordsize := object_.XmlAttrCoordsize.Value; + if not ifnil(object_.XmlAttrSpt) then + {self.}Spt := object_.XmlAttrSpt.Value; + if not ifnil(object_.XmlAttrPath) then + {self.}Path := object_.XmlAttrPath.Value; + if not ifnil(object_.XmlChildStroke) then + {self.}XmlChildStroke := new StrokeUnitDecorator(object_.XmlChildStroke); + if not ifnil(object_.XmlChildPath) then + {self.}XmlChildPath := new PathUnitDecorator(object_.XmlChildPath); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ShdUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ShdUnitDecorator@DOCX.tsf index ef274f7..37c71eb 100644 --- a/autoclass/decorator/docx/ShdUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ShdUnitDecorator@DOCX.tsf @@ -22,9 +22,17 @@ end; function ShdUnitDecorator.Convert(); begin - {self.}XmlAttrVal.Value := object_.XmlAttrVal.Value; - {self.}XmlAttrColor.Value := object_.XmlAttrColor.Value; - {self.}XmlAttrFill.Value := object_.XmlAttrFill.Value; - {self.}XmlAttrThemeFill.Value := object_.XmlAttrThemeFill.Value; - {self.}XmlAttrThemeFillTint.Value := object_.XmlAttrThemeFillTint.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrVal) then + {self.}Val := object_.XmlAttrVal.Value; + if not ifnil(object_.XmlAttrColor) then + {self.}Color := object_.XmlAttrColor.Value; + if not ifnil(object_.XmlAttrFill) then + {self.}Fill := object_.XmlAttrFill.Value; + if not ifnil(object_.XmlAttrThemeFill) then + {self.}ThemeFill := object_.XmlAttrThemeFill.Value; + if not ifnil(object_.XmlAttrThemeFillTint) then + {self.}ThemeFillTint := object_.XmlAttrThemeFillTint.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/SigUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/SigUnitDecorator@DOCX.tsf index 7e0d3c7..a7a8612 100644 --- a/autoclass/decorator/docx/SigUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/SigUnitDecorator@DOCX.tsf @@ -22,10 +22,19 @@ end; function SigUnitDecorator.Convert(); begin - {self.}XmlAttrUsb0.Value := object_.XmlAttrUsb0.Value; - {self.}XmlAttrUsb1.Value := object_.XmlAttrUsb1.Value; - {self.}XmlAttrUsb2.Value := object_.XmlAttrUsb2.Value; - {self.}XmlAttrUsb3.Value := object_.XmlAttrUsb3.Value; - {self.}XmlAttrcsb0.Value := object_.XmlAttrcsb0.Value; - {self.}XmlAttrcsb1.Value := object_.XmlAttrcsb1.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrUsb0) then + {self.}Usb0 := object_.XmlAttrUsb0.Value; + if not ifnil(object_.XmlAttrUsb1) then + {self.}Usb1 := object_.XmlAttrUsb1.Value; + if not ifnil(object_.XmlAttrUsb2) then + {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; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/SizeRelHUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/SizeRelHUnitDecorator@DOCX.tsf index 28c1dc5..ef6878e 100644 --- a/autoclass/decorator/docx/SizeRelHUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/SizeRelHUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function SizeRelHUnitDecorator.Convert(); begin - {self.}XmlAttrRelativeFrom.Value := object_.XmlAttrRelativeFrom.Value; - {self.}PctWidth.Text := TSSafeUnitConverter.EmusToPoints(object_.PctWidth.Text); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrRelativeFrom) then + {self.}RelativeFrom := object_.XmlAttrRelativeFrom.Value; + if not ifnil(object_.XmlChildPctWidth) then + {self.}PctWidth.Text := TSSafeUnitConverter.EmusToPoints(object_.XmlChildPctWidth.Text); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/SizeRelVUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/SizeRelVUnitDecorator@DOCX.tsf index 3a59042..1fb9bfa 100644 --- a/autoclass/decorator/docx/SizeRelVUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/SizeRelVUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function SizeRelVUnitDecorator.Convert(); begin - {self.}XmlAttrRelativeFrom.Value := object_.XmlAttrRelativeFrom.Value; - {self.}PctHeight.Text := TSSafeUnitConverter.EmusToPoints(object_.PctHeight.Text); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrRelativeFrom) then + {self.}RelativeFrom := object_.XmlAttrRelativeFrom.Value; + if not ifnil(object_.XmlChildPctHeight) then + {self.}PctHeight.Text := TSSafeUnitConverter.EmusToPoints(object_.XmlChildPctHeight.Text); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/SolidFillUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/SolidFillUnitDecorator@DOCX.tsf index c168e6d..23b590a 100644 --- a/autoclass/decorator/docx/SolidFillUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/SolidFillUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function SolidFillUnitDecorator.Convert(); begin - {self.}SchemeClr := new SchemeClrUnitDecorator(object_.SchemeClr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildSchemeClr) then + {self.}XmlChildSchemeClr := new SchemeClrUnitDecorator(object_.XmlChildSchemeClr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/SpLocksUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/SpLocksUnitDecorator@DOCX.tsf index 20676aa..495d401 100644 --- a/autoclass/decorator/docx/SpLocksUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/SpLocksUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function SpLocksUnitDecorator.Convert(); begin - {self.}XmlAttrNoChangeArrowheads.Value := object_.XmlAttrNoChangeArrowheads.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrNoChangeArrowheads) then + {self.}NoChangeArrowheads := object_.XmlAttrNoChangeArrowheads.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/SpPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/SpPrUnitDecorator@DOCX.tsf index 157fb69..d5c904c 100644 --- a/autoclass/decorator/docx/SpPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/SpPrUnitDecorator@DOCX.tsf @@ -22,11 +22,21 @@ end; function SpPrUnitDecorator.Convert(); begin - {self.}XmlAttrBwMode.Value := object_.XmlAttrBwMode.Value; - {self.}Xfrm := new XfrmUnitDecorator(object_.Xfrm); - {self.}PrstGeom := new PrstGeomUnitDecorator(object_.PrstGeom); - if not ifnil(object_.XmlChildNoFill.Value) then {self.}XmlChildNoFill.Value := object_.XmlChildNoFill.Value; - {self.}SolidFill := new SolidFillUnitDecorator(object_.SolidFill); - {self.}Ln := new LnUnitDecorator(object_.Ln); - {self.}EffectLst := new EffectLstUnitDecorator(object_.EffectLst); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrBwMode) then + {self.}BwMode := object_.XmlAttrBwMode.Value; + if not ifnil(object_.XmlChildXfrm) then + {self.}XmlChildXfrm := new XfrmUnitDecorator(object_.XmlChildXfrm); + if not ifnil(object_.XmlChildPrstGeom) then + {self.}XmlChildPrstGeom := new PrstGeomUnitDecorator(object_.XmlChildPrstGeom); + if not ifnil(object_.XmlChildNoFill) then + {self.}NoFill.Copy(object_.XmlChildNoFill); + if not ifnil(object_.XmlChildSolidFill) then + {self.}XmlChildSolidFill := new SolidFillUnitDecorator(object_.XmlChildSolidFill); + if not ifnil(object_.XmlChildLn) then + {self.}XmlChildLn := new LnUnitDecorator(object_.XmlChildLn); + if not ifnil(object_.XmlChildEffectLst) then + {self.}XmlChildEffectLst := new EffectLstUnitDecorator(object_.XmlChildEffectLst); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/SpacingUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/SpacingUnitDecorator@DOCX.tsf index b304c0c..1ad74b3 100644 --- a/autoclass/decorator/docx/SpacingUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/SpacingUnitDecorator@DOCX.tsf @@ -22,12 +22,23 @@ end; function SpacingUnitDecorator.Convert(); begin - {self.}XmlAttrBefore.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrBefore.Value); - {self.}XmlAttrBeforeLines.Value := TSSafeUnitConverter.PercentToNumber(object_.XmlAttrBeforeLines.Value); - {self.}XmlAttrBeforeAutospacing.Value := object_.XmlAttrBeforeAutospacing.Value; - {self.}XmlAttrAfter.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrAfter.Value); - {self.}XmlAttrAfterLines.Value := TSSafeUnitConverter.PercentToNumber(object_.XmlAttrAfterLines.Value); - {self.}XmlAttrAfterAutospacing.Value := object_.XmlAttrAfterAutospacing.Value; - {self.}XmlAttrLine.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrLine.Value); - {self.}XmlAttrLineRule.Value := object_.XmlAttrLineRule.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrBefore) then + {self.}Before := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrBefore.Value); + if not ifnil(object_.XmlAttrBeforeLines) then + {self.}BeforeLines := TSSafeUnitConverter.PercentToNumber(object_.XmlAttrBeforeLines.Value); + if not ifnil(object_.XmlAttrBeforeAutospacing) then + {self.}BeforeAutospacing := object_.XmlAttrBeforeAutospacing.Value; + if not ifnil(object_.XmlAttrAfter) then + {self.}After := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrAfter.Value); + if not ifnil(object_.XmlAttrAfterLines) then + {self.}AfterLines := TSSafeUnitConverter.PercentToNumber(object_.XmlAttrAfterLines.Value); + if not ifnil(object_.XmlAttrAfterAutospacing) then + {self.}AfterAutospacing := object_.XmlAttrAfterAutospacing.Value; + if not ifnil(object_.XmlAttrLine) then + {self.}Line := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrLine.Value); + if not ifnil(object_.XmlAttrLineRule) then + {self.}LineRule := object_.XmlAttrLineRule.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/SrgbClrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/SrgbClrUnitDecorator@DOCX.tsf index d658ac6..564e57b 100644 --- a/autoclass/decorator/docx/SrgbClrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/SrgbClrUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function SrgbClrUnitDecorator.Convert(); begin - {self.}XmlAttrVal.Value := object_.XmlAttrVal.Value; - {self.}Alpha := new PureValUnitDecorator(object_.Alpha); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrVal) then + {self.}Val := object_.XmlAttrVal.Value; + if not ifnil(object_.XmlChildAlpha) then + {self.}XmlChildAlpha := new PureValUnitDecorator(object_.XmlChildAlpha); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/StrRefUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/StrRefUnitDecorator@DOCX.tsf index 3c92155..7976abf 100644 --- a/autoclass/decorator/docx/StrRefUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/StrRefUnitDecorator@DOCX.tsf @@ -22,5 +22,10 @@ end; function StrRefUnitDecorator.Convert(); begin - {self.}StrCache := new CacheUnitDecorator(object_.StrCache); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildF) then + if not ifnil(object_.XmlChildStrCache) then + {self.}XmlChildStrCache := new CacheUnitDecorator(object_.XmlChildStrCache); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/StretchUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/StretchUnitDecorator@DOCX.tsf index 5060892..f284e63 100644 --- a/autoclass/decorator/docx/StretchUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/StretchUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function StretchUnitDecorator.Convert(); begin - {self.}FillRect := new PureValUnitDecorator(object_.FillRect); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildFillRect) then + {self.}XmlChildFillRect := new PureValUnitDecorator(object_.XmlChildFillRect); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/StrokeUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/StrokeUnitDecorator@DOCX.tsf index 6ca680f..5ef5adc 100644 --- a/autoclass/decorator/docx/StrokeUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/StrokeUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function StrokeUnitDecorator.Convert(); begin - {self.}XmlAttrJoinstyle.Value := object_.XmlAttrJoinstyle.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrJoinstyle) then + {self.}Joinstyle := object_.XmlAttrJoinstyle.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/StyleUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/StyleUnitDecorator@DOCX.tsf index dfeebf4..45face3 100644 --- a/autoclass/decorator/docx/StyleUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/StyleUnitDecorator@DOCX.tsf @@ -22,22 +22,43 @@ end; function StyleUnitDecorator.Convert(); begin - {self.}XmlAttrType.Value := object_.XmlAttrType.Value; - {self.}XmlAttrDefault.Value := object_.XmlAttrDefault.Value; - {self.}XmlAttrStyleId.Value := object_.XmlAttrStyleId.Value; - {self.}Name := new PureWValUnitDecorator(object_.Name); - {self.}BasedOn := new PureWValUnitDecorator(object_.BasedOn); - {self.}Next := new PureWValUnitDecorator(object_.Next); - {self.}AutoRedefine := new PureWValUnitDecorator(object_.AutoRedefine); - {self.}Link := new PureWValUnitDecorator(object_.Link); - {self.}UIPriority := new PureWValUnitDecorator(object_.UIPriority); - if not ifnil(object_.XmlChildSemiHidden.Value) then {self.}XmlChildSemiHidden.Value := object_.XmlChildSemiHidden.Value; - if not ifnil(object_.XmlChildUnhideWhenUsed.Value) then {self.}XmlChildUnhideWhenUsed.Value := object_.XmlChildUnhideWhenUsed.Value; - if not ifnil(object_.XmlChildQFormat.Value) then {self.}XmlChildQFormat.Value := object_.XmlChildQFormat.Value; - {self.}Rsid := new PureWValUnitDecorator(object_.Rsid); - {self.}PPr := new PPrUnitDecorator(object_.PPr); - {self.}RPr := new RPrUnitDecorator(object_.RPr); - {self.}TblPr := new TblPrUnitDecorator(object_.TblPr); - {self.}TrPr := new TrPrUnitDecorator(object_.TrPr); - {self.}TcPr := new TcPrUnitDecorator(object_.TcPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrType) then + {self.}Type := object_.XmlAttrType.Value; + if not ifnil(object_.XmlAttrDefault) then + {self.}Default := object_.XmlAttrDefault.Value; + if not ifnil(object_.XmlAttrStyleId) then + {self.}StyleId := object_.XmlAttrStyleId.Value; + if not ifnil(object_.XmlChildName) then + {self.}XmlChildName := new PureWValUnitDecorator(object_.XmlChildName); + if not ifnil(object_.XmlChildBasedOn) then + {self.}XmlChildBasedOn := new PureWValUnitDecorator(object_.XmlChildBasedOn); + if not ifnil(object_.XmlChildNext) then + {self.}XmlChildNext := new PureWValUnitDecorator(object_.XmlChildNext); + if not ifnil(object_.XmlChildAutoRedefine) then + {self.}XmlChildAutoRedefine := new PureWValUnitDecorator(object_.XmlChildAutoRedefine); + if not ifnil(object_.XmlChildLink) then + {self.}XmlChildLink := new PureWValUnitDecorator(object_.XmlChildLink); + if not ifnil(object_.XmlChildUIPriority) then + {self.}XmlChildUIPriority := new PureWValUnitDecorator(object_.XmlChildUIPriority); + if not ifnil(object_.XmlChildSemiHidden) then + {self.}SemiHidden.Copy(object_.XmlChildSemiHidden); + if not ifnil(object_.XmlChildUnhideWhenUsed) then + {self.}UnhideWhenUsed.Copy(object_.XmlChildUnhideWhenUsed); + if not ifnil(object_.XmlChildQFormat) then + {self.}QFormat.Copy(object_.XmlChildQFormat); + if not ifnil(object_.XmlChildRsid) then + {self.}XmlChildRsid := new PureWValUnitDecorator(object_.XmlChildRsid); + if not ifnil(object_.XmlChildPPr) then + {self.}XmlChildPPr := new PPrUnitDecorator(object_.XmlChildPPr); + if not ifnil(object_.XmlChildRPr) then + {self.}XmlChildRPr := new RPrUnitDecorator(object_.XmlChildRPr); + if not ifnil(object_.XmlChildTblPr) then + {self.}XmlChildTblPr := new TblPrUnitDecorator(object_.XmlChildTblPr); + if not ifnil(object_.XmlChildTrPr) then + {self.}XmlChildTrPr := new TrPrUnitDecorator(object_.XmlChildTrPr); + if not ifnil(object_.XmlChildTcPr) then + {self.}XmlChildTcPr := new TcPrUnitDecorator(object_.XmlChildTcPr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/StylesUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/StylesUnitDecorator@DOCX.tsf index e5c7fa8..90b3faa 100644 --- a/autoclass/decorator/docx/StylesUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/StylesUnitDecorator@DOCX.tsf @@ -22,18 +22,35 @@ end; function StylesUnitDecorator.Convert(); begin - {self.}XmlAttrXmlnsMc.Value := object_.XmlAttrXmlnsMc.Value; - {self.}XmlAttrXmlnsR.Value := object_.XmlAttrXmlnsR.Value; - {self.}XmlAttrXmlnsW.Value := object_.XmlAttrXmlnsW.Value; - {self.}XmlAttrXmlnsW14.Value := object_.XmlAttrXmlnsW14.Value; - {self.}XmlAttrXmlnsW15.Value := object_.XmlAttrXmlnsW15.Value; - {self.}XmlAttrXmlnsW16Cex.Value := object_.XmlAttrXmlnsW16Cex.Value; - {self.}XmlAttrXmlnsW16Cid.Value := object_.XmlAttrXmlnsW16Cid.Value; - {self.}XmlAttrXmlnsW16.Value := object_.XmlAttrXmlnsW16.Value; - {self.}XmlAttrXmlnsW16Du.Value := object_.XmlAttrXmlnsW16Du.Value; - {self.}XmlAttrXmlnsW16sdtdh.Value := object_.XmlAttrXmlnsW16sdtdh.Value; - {self.}XmlAttrXmlnsW16se.Value := object_.XmlAttrXmlnsW16se.Value; - {self.}XmlAttrMcIgnorable.Value := object_.XmlAttrMcIgnorable.Value; - {self.}DocDefaults := new DocDefaultsUnitDecorator(object_.DocDefaults); - {self.}LatenStyles := new LatenStylesUnitDecorator(object_.LatenStyles); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXmlnsMc) then + {self.}XmlnsMc := object_.XmlAttrXmlnsMc.Value; + if not ifnil(object_.XmlAttrXmlnsR) then + {self.}XmlnsR := object_.XmlAttrXmlnsR.Value; + if not ifnil(object_.XmlAttrXmlnsW) then + {self.}XmlnsW := object_.XmlAttrXmlnsW.Value; + if not ifnil(object_.XmlAttrXmlnsW14) then + {self.}XmlnsW14 := object_.XmlAttrXmlnsW14.Value; + if not ifnil(object_.XmlAttrXmlnsW15) then + {self.}XmlnsW15 := object_.XmlAttrXmlnsW15.Value; + if not ifnil(object_.XmlAttrXmlnsW16Cex) then + {self.}XmlnsW16Cex := object_.XmlAttrXmlnsW16Cex.Value; + if not ifnil(object_.XmlAttrXmlnsW16Cid) then + {self.}XmlnsW16Cid := object_.XmlAttrXmlnsW16Cid.Value; + if not ifnil(object_.XmlAttrXmlnsW16) then + {self.}XmlnsW16 := object_.XmlAttrXmlnsW16.Value; + if not ifnil(object_.XmlAttrXmlnsW16Du) then + {self.}XmlnsW16Du := object_.XmlAttrXmlnsW16Du.Value; + if not ifnil(object_.XmlAttrXmlnsW16sdtdh) then + {self.}XmlnsW16sdtdh := object_.XmlAttrXmlnsW16sdtdh.Value; + if not ifnil(object_.XmlAttrXmlnsW16se) then + {self.}XmlnsW16se := object_.XmlAttrXmlnsW16se.Value; + if not ifnil(object_.XmlAttrMcIgnorable) then + {self.}McIgnorable := object_.XmlAttrMcIgnorable.Value; + if not ifnil(object_.XmlChildDocDefaults) then + {self.}XmlChildDocDefaults := new DocDefaultsUnitDecorator(object_.XmlChildDocDefaults); + if not ifnil(object_.XmlChildLatenStyles) then + {self.}XmlChildLatenStyles := new LatenStylesUnitDecorator(object_.XmlChildLatenStyles); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/SysClrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/SysClrUnitDecorator@DOCX.tsf index 1b19335..0cd225d 100644 --- a/autoclass/decorator/docx/SysClrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/SysClrUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function SysClrUnitDecorator.Convert(); begin - {self.}XmlAttrVal.Value := object_.XmlAttrVal.Value; - {self.}XmlAttrLastClr.Value := object_.XmlAttrLastClr.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrVal) then + {self.}Val := object_.XmlAttrVal.Value; + if not ifnil(object_.XmlAttrLastClr) then + {self.}LastClr := object_.XmlAttrLastClr.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/SzCsUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/SzCsUnitDecorator@DOCX.tsf index a870575..b498351 100644 --- a/autoclass/decorator/docx/SzCsUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/SzCsUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function SzCsUnitDecorator.Convert(); begin - {self.}XmlAttrVal.Value := TSSafeUnitConverter.HalfPointToPoints(object_.XmlAttrVal.Value); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrVal) then + {self.}Val := TSSafeUnitConverter.HalfPointToPoints(object_.XmlAttrVal.Value); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/SzUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/SzUnitDecorator@DOCX.tsf index 30430cb..1454ee5 100644 --- a/autoclass/decorator/docx/SzUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/SzUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function SzUnitDecorator.Convert(); begin - {self.}XmlAttrVal.Value := TSSafeUnitConverter.HalfPointToPoints(object_.XmlAttrVal.Value); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrVal) then + {self.}Val := TSSafeUnitConverter.HalfPointToPoints(object_.XmlAttrVal.Value); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TUnitDecorator@DOCX.tsf index 11a9a55..dc941e3 100644 --- a/autoclass/decorator/docx/TUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function TUnitDecorator.Convert(); begin - {self.}XmlAttrSpace.Value := object_.XmlAttrSpace.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrSpace) then + {self.}Space := object_.XmlAttrSpace.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TabUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TabUnitDecorator@DOCX.tsf index 487ff86..5e607f0 100644 --- a/autoclass/decorator/docx/TabUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TabUnitDecorator@DOCX.tsf @@ -22,7 +22,13 @@ end; function TabUnitDecorator.Convert(); begin - {self.}XmlAttrVal.Value := object_.XmlAttrVal.Value; - {self.}XmlAttrLeader.Value := object_.XmlAttrLeader.Value; - {self.}XmlAttrPos.Value := object_.XmlAttrPos.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrVal) then + {self.}Val := object_.XmlAttrVal.Value; + if not ifnil(object_.XmlAttrLeader) then + {self.}Leader := object_.XmlAttrLeader.Value; + if not ifnil(object_.XmlAttrPos) then + {self.}Pos := object_.XmlAttrPos.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TabsUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TabsUnitDecorator@DOCX.tsf index 86ce272..76c35f6 100644 --- a/autoclass/decorator/docx/TabsUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TabsUnitDecorator@DOCX.tsf @@ -22,4 +22,7 @@ end; function TabsUnitDecorator.Convert(); begin + tslassigning_backup := tslassigning; + tslassigning := 1; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TblBorderUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TblBorderUnitDecorator@DOCX.tsf index 3c1af49..abfd859 100644 --- a/autoclass/decorator/docx/TblBorderUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TblBorderUnitDecorator@DOCX.tsf @@ -22,10 +22,19 @@ end; function TblBorderUnitDecorator.Convert(); begin - {self.}XmlAttrVal.Value := object_.XmlAttrVal.Value; - {self.}XmlAttrColor.Value := object_.XmlAttrColor.Value; - {self.}XmlAttrSpace.Value := object_.XmlAttrSpace.Value; - {self.}XmlAttrThemeColor.Value := object_.XmlAttrThemeColor.Value; - {self.}XmlAttrThemeTint.Value := object_.XmlAttrThemeTint.Value; - {self.}XmlAttrSz.Value := TSSafeUnitConverter.HalfPointToPoints(object_.XmlAttrSz.Value); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrVal) then + {self.}Val := object_.XmlAttrVal.Value; + if not ifnil(object_.XmlAttrColor) then + {self.}Color := object_.XmlAttrColor.Value; + if not ifnil(object_.XmlAttrSpace) then + {self.}Space := object_.XmlAttrSpace.Value; + if not ifnil(object_.XmlAttrThemeColor) then + {self.}ThemeColor := object_.XmlAttrThemeColor.Value; + if not ifnil(object_.XmlAttrThemeTint) then + {self.}ThemeTint := object_.XmlAttrThemeTint.Value; + if not ifnil(object_.XmlAttrSz) then + {self.}Sz := TSSafeUnitConverter.HalfPointToPoints(object_.XmlAttrSz.Value); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TblBordersUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TblBordersUnitDecorator@DOCX.tsf index 6933d79..2422322 100644 --- a/autoclass/decorator/docx/TblBordersUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TblBordersUnitDecorator@DOCX.tsf @@ -22,10 +22,19 @@ end; function TblBordersUnitDecorator.Convert(); begin - {self.}Top := new tblBorderUnitDecorator(object_.Top); - {self.}Left := new tblBorderUnitDecorator(object_.Left); - {self.}Bottom := new tblBorderUnitDecorator(object_.Bottom); - {self.}Right := new tblBorderUnitDecorator(object_.Right); - {self.}InsideH := new PureWValUnitDecorator(object_.InsideH); - {self.}InsideV := new PureWValUnitDecorator(object_.InsideV); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildTop) then + {self.}XmlChildTop := new tblBorderUnitDecorator(object_.XmlChildTop); + if not ifnil(object_.XmlChildLeft) then + {self.}XmlChildLeft := new tblBorderUnitDecorator(object_.XmlChildLeft); + if not ifnil(object_.XmlChildBottom) then + {self.}XmlChildBottom := new tblBorderUnitDecorator(object_.XmlChildBottom); + if not ifnil(object_.XmlChildRight) then + {self.}XmlChildRight := new tblBorderUnitDecorator(object_.XmlChildRight); + if not ifnil(object_.XmlChildInsideH) then + {self.}XmlChildInsideH := new PureWValUnitDecorator(object_.XmlChildInsideH); + if not ifnil(object_.XmlChildInsideV) then + {self.}XmlChildInsideV := new PureWValUnitDecorator(object_.XmlChildInsideV); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TblCellMarUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TblCellMarUnitDecorator@DOCX.tsf index 5cc2eb0..f6b5d93 100644 --- a/autoclass/decorator/docx/TblCellMarUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TblCellMarUnitDecorator@DOCX.tsf @@ -22,8 +22,15 @@ end; function TblCellMarUnitDecorator.Convert(); begin - {self.}Top := new TblIndUnitDecorator(object_.Top); - {self.}Left := new TblIndUnitDecorator(object_.Left); - {self.}Bottom := new TblIndUnitDecorator(object_.Bottom); - {self.}Right := new TblIndUnitDecorator(object_.Right); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildTop) then + {self.}XmlChildTop := new TblIndUnitDecorator(object_.XmlChildTop); + if not ifnil(object_.XmlChildLeft) then + {self.}XmlChildLeft := new TblIndUnitDecorator(object_.XmlChildLeft); + if not ifnil(object_.XmlChildBottom) then + {self.}XmlChildBottom := new TblIndUnitDecorator(object_.XmlChildBottom); + if not ifnil(object_.XmlChildRight) then + {self.}XmlChildRight := new TblIndUnitDecorator(object_.XmlChildRight); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TblGridUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TblGridUnitDecorator@DOCX.tsf index 9e2aaf6..95cc2cf 100644 --- a/autoclass/decorator/docx/TblGridUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TblGridUnitDecorator@DOCX.tsf @@ -22,4 +22,7 @@ end; function TblGridUnitDecorator.Convert(); begin + tslassigning_backup := tslassigning; + tslassigning := 1; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TblIndUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TblIndUnitDecorator@DOCX.tsf index 74c5a16..452481a 100644 --- a/autoclass/decorator/docx/TblIndUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TblIndUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function TblIndUnitDecorator.Convert(); begin - {self.}XmlAttrW.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrW.Value); - {self.}XmlAttrType.Value := object_.XmlAttrType.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrW) then + {self.}W := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrW.Value); + if not ifnil(object_.XmlAttrType) then + {self.}Type := object_.XmlAttrType.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TblLayoutUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TblLayoutUnitDecorator@DOCX.tsf index 596e2e0..5448b5c 100644 --- a/autoclass/decorator/docx/TblLayoutUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TblLayoutUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function TblLayoutUnitDecorator.Convert(); begin - {self.}XmlAttrType.Value := object_.XmlAttrType.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrType) then + {self.}Type := object_.XmlAttrType.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TblLookUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TblLookUnitDecorator@DOCX.tsf index a3126ac..fed8083 100644 --- a/autoclass/decorator/docx/TblLookUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TblLookUnitDecorator@DOCX.tsf @@ -22,11 +22,21 @@ end; function TblLookUnitDecorator.Convert(); begin - {self.}XmlAttrVal.Value := object_.XmlAttrVal.Value; - {self.}XmlAttrFirstRow.Value := object_.XmlAttrFirstRow.Value; - {self.}XmlAttrLastRow.Value := object_.XmlAttrLastRow.Value; - {self.}XmlAttrFirstColumn.Value := object_.XmlAttrFirstColumn.Value; - {self.}XmlAttrLastColumn.Value := object_.XmlAttrLastColumn.Value; - {self.}XmlAttrNoHBand.Value := object_.XmlAttrNoHBand.Value; - {self.}XmlAttrNoVBand.Value := object_.XmlAttrNoVBand.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrVal) then + {self.}Val := object_.XmlAttrVal.Value; + if not ifnil(object_.XmlAttrFirstRow) then + {self.}FirstRow := object_.XmlAttrFirstRow.Value; + if not ifnil(object_.XmlAttrLastRow) then + {self.}LastRow := object_.XmlAttrLastRow.Value; + if not ifnil(object_.XmlAttrFirstColumn) then + {self.}FirstColumn := object_.XmlAttrFirstColumn.Value; + if not ifnil(object_.XmlAttrLastColumn) then + {self.}LastColumn := object_.XmlAttrLastColumn.Value; + if not ifnil(object_.XmlAttrNoHBand) then + {self.}NoHBand := object_.XmlAttrNoHBand.Value; + if not ifnil(object_.XmlAttrNoVBand) then + {self.}NoVBand := object_.XmlAttrNoVBand.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TblPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TblPrUnitDecorator@DOCX.tsf index fd9fc7b..fff7f18 100644 --- a/autoclass/decorator/docx/TblPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TblPrUnitDecorator@DOCX.tsf @@ -22,14 +22,27 @@ end; function TblPrUnitDecorator.Convert(); begin - {self.}TblStyleRowBandSize := new PureWValUnitDecorator(object_.TblStyleRowBandSize); - {self.}TblStyleColBandSize := new PureWValUnitDecorator(object_.TblStyleColBandSize); - {self.}Jc := new PureWValUnitDecorator(object_.Jc); - {self.}TblStyle := new PureWValUnitDecorator(object_.TblStyle); - {self.}TblW := new TblWUnitDecorator(object_.TblW); - {self.}TblInd := new TblWUnitDecorator(object_.TblInd); - {self.}TblLayout := new TblLayoutUnitDecorator(object_.TblLayout); - {self.}TblLook := new TblLookUnitDecorator(object_.TblLook); - {self.}TblBorders := new TblBordersUnitDecorator(object_.TblBorders); - {self.}TblCellMar := new TblCellMarUnitDecorator(object_.TblCellMar); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildTblStyleRowBandSize) then + {self.}XmlChildTblStyleRowBandSize := new PureWValUnitDecorator(object_.XmlChildTblStyleRowBandSize); + if not ifnil(object_.XmlChildTblStyleColBandSize) then + {self.}XmlChildTblStyleColBandSize := new PureWValUnitDecorator(object_.XmlChildTblStyleColBandSize); + if not ifnil(object_.XmlChildJc) then + {self.}XmlChildJc := new PureWValUnitDecorator(object_.XmlChildJc); + if not ifnil(object_.XmlChildTblStyle) then + {self.}XmlChildTblStyle := new PureWValUnitDecorator(object_.XmlChildTblStyle); + if not ifnil(object_.XmlChildTblW) then + {self.}XmlChildTblW := new TblWUnitDecorator(object_.XmlChildTblW); + if not ifnil(object_.XmlChildTblInd) then + {self.}XmlChildTblInd := new TblWUnitDecorator(object_.XmlChildTblInd); + if not ifnil(object_.XmlChildTblLayout) then + {self.}XmlChildTblLayout := new TblLayoutUnitDecorator(object_.XmlChildTblLayout); + if not ifnil(object_.XmlChildTblLook) then + {self.}XmlChildTblLook := new TblLookUnitDecorator(object_.XmlChildTblLook); + if not ifnil(object_.XmlChildTblBorders) then + {self.}XmlChildTblBorders := new TblBordersUnitDecorator(object_.XmlChildTblBorders); + if not ifnil(object_.XmlChildTblCellMar) then + {self.}XmlChildTblCellMar := new TblCellMarUnitDecorator(object_.XmlChildTblCellMar); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TblStylePrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TblStylePrUnitDecorator@DOCX.tsf index b6084f7..951f0fb 100644 --- a/autoclass/decorator/docx/TblStylePrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TblStylePrUnitDecorator@DOCX.tsf @@ -22,9 +22,17 @@ end; function TblStylePrUnitDecorator.Convert(); begin - {self.}XmlAttrType.Value := object_.XmlAttrType.Value; - {self.}PPr := new PPrUnitDecorator(object_.PPr); - {self.}TblPr := new TblPrUnitDecorator(object_.TblPr); - {self.}TrPr := new TrPrUnitDecorator(object_.TrPr); - {self.}TcPr := new TcPrUnitDecorator(object_.TcPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrType) then + {self.}Type := object_.XmlAttrType.Value; + if not ifnil(object_.XmlChildPPr) then + {self.}XmlChildPPr := new PPrUnitDecorator(object_.XmlChildPPr); + if not ifnil(object_.XmlChildTblPr) then + {self.}XmlChildTblPr := new TblPrUnitDecorator(object_.XmlChildTblPr); + if not ifnil(object_.XmlChildTrPr) then + {self.}XmlChildTrPr := new TrPrUnitDecorator(object_.XmlChildTrPr); + if not ifnil(object_.XmlChildTcPr) then + {self.}XmlChildTcPr := new TcPrUnitDecorator(object_.XmlChildTcPr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TblUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TblUnitDecorator@DOCX.tsf index 0830549..4cc7206 100644 --- a/autoclass/decorator/docx/TblUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TblUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function TblUnitDecorator.Convert(); begin - {self.}TblPr := new TblPrUnitDecorator(object_.TblPr); - {self.}TblGrid := new TblGridUnitDecorator(object_.TblGrid); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildTblPr) then + {self.}XmlChildTblPr := new TblPrUnitDecorator(object_.XmlChildTblPr); + if not ifnil(object_.XmlChildTblGrid) then + {self.}XmlChildTblGrid := new TblGridUnitDecorator(object_.XmlChildTblGrid); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TblWUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TblWUnitDecorator@DOCX.tsf index 7d72f82..e706c4b 100644 --- a/autoclass/decorator/docx/TblWUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TblWUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function TblWUnitDecorator.Convert(); begin - {self.}XmlAttrW.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrW.Value); - {self.}XmlAttrType.Value := object_.XmlAttrType.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrW) then + {self.}W := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrW.Value); + if not ifnil(object_.XmlAttrType) then + {self.}Type := object_.XmlAttrType.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TcPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TcPrUnitDecorator@DOCX.tsf index a261703..4edff5b 100644 --- a/autoclass/decorator/docx/TcPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TcPrUnitDecorator@DOCX.tsf @@ -22,9 +22,17 @@ end; function TcPrUnitDecorator.Convert(); begin - {self.}TcW := new TblWUnitDecorator(object_.TcW); - {self.}GridSpan := new GridSpanUnitDecorator(object_.GridSpan); - if not ifnil(object_.XmlChildVMerge.Value) then {self.}XmlChildVMerge.Value := object_.XmlChildVMerge.Value; - {self.}VAlign := new PureWValUnitDecorator(object_.VAlign); - {self.}Shd := new ShdUnitDecorator(object_.Shd); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildTcW) then + {self.}XmlChildTcW := new TblWUnitDecorator(object_.XmlChildTcW); + if not ifnil(object_.XmlChildGridSpan) then + {self.}XmlChildGridSpan := new GridSpanUnitDecorator(object_.XmlChildGridSpan); + if not ifnil(object_.XmlChildVMerge) then + {self.}VMerge.Copy(object_.XmlChildVMerge); + if not ifnil(object_.XmlChildVAlign) then + {self.}XmlChildVAlign := new PureWValUnitDecorator(object_.XmlChildVAlign); + if not ifnil(object_.XmlChildShd) then + {self.}XmlChildShd := new ShdUnitDecorator(object_.XmlChildShd); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TcUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TcUnitDecorator@DOCX.tsf index 5f2a8f1..d05b74f 100644 --- a/autoclass/decorator/docx/TcUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TcUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function TcUnitDecorator.Convert(); begin - {self.}TcPr := new TcPrUnitDecorator(object_.TcPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildTcPr) then + {self.}XmlChildTcPr := new TcPrUnitDecorator(object_.XmlChildTcPr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TextboxUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TextboxUnitDecorator@DOCX.tsf index 10aa730..7c41840 100644 --- a/autoclass/decorator/docx/TextboxUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TextboxUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function TextboxUnitDecorator.Convert(); begin - {self.}TxbxContent := new TxbxContentUnitDecorator(object_.TxbxContent); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildTxbxContent) then + {self.}XmlChildTxbxContent := new TxbxContentUnitDecorator(object_.XmlChildTxbxContent); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ThemeElementsUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ThemeElementsUnitDecorator@DOCX.tsf index 037b623..bdd29ab 100644 --- a/autoclass/decorator/docx/ThemeElementsUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ThemeElementsUnitDecorator@DOCX.tsf @@ -22,8 +22,15 @@ end; function ThemeElementsUnitDecorator.Convert(); begin - {self.}XmlAttrName.Value := object_.XmlAttrName.Value; - {self.}ClrScheme := new ClrSchemeUnitDecorator(object_.ClrScheme); - {self.}FontScheme := new FontSchemeUnitDecorator(object_.FontScheme); - {self.}FmtScheme := new FmtSchemeUnitDecorator(object_.FmtScheme); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrName) then + {self.}Name := object_.XmlAttrName.Value; + if not ifnil(object_.XmlChildClrScheme) then + {self.}XmlChildClrScheme := new ClrSchemeUnitDecorator(object_.XmlChildClrScheme); + if not ifnil(object_.XmlChildFontScheme) then + {self.}XmlChildFontScheme := new FontSchemeUnitDecorator(object_.XmlChildFontScheme); + if not ifnil(object_.XmlChildFmtScheme) then + {self.}XmlChildFmtScheme := new FmtSchemeUnitDecorator(object_.XmlChildFmtScheme); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ThemeFamilyUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ThemeFamilyUnitDecorator@DOCX.tsf index 25476b3..fec7f08 100644 --- a/autoclass/decorator/docx/ThemeFamilyUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ThemeFamilyUnitDecorator@DOCX.tsf @@ -22,8 +22,15 @@ end; function ThemeFamilyUnitDecorator.Convert(); begin - {self.}XmlAttrXmlnsThm15.Value := object_.XmlAttrXmlnsThm15.Value; - {self.}XmlAttrName.Value := object_.XmlAttrName.Value; - {self.}XmlAttrId.Value := object_.XmlAttrId.Value; - {self.}XmlAttrVid.Value := object_.XmlAttrVid.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXmlnsThm15) then + {self.}XmlnsThm15 := object_.XmlAttrXmlnsThm15.Value; + if not ifnil(object_.XmlAttrName) then + {self.}Name := object_.XmlAttrName.Value; + if not ifnil(object_.XmlAttrId) then + {self.}Id := object_.XmlAttrId.Value; + if not ifnil(object_.XmlAttrVid) then + {self.}Vid := object_.XmlAttrVid.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ThemeFontLangUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ThemeFontLangUnitDecorator@DOCX.tsf index 6f72c46..c78972c 100644 --- a/autoclass/decorator/docx/ThemeFontLangUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ThemeFontLangUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function ThemeFontLangUnitDecorator.Convert(); begin - {self.}XmlAttrVal.Value := object_.XmlAttrVal.Value; - {self.}XmlAttrEastAsia.Value := object_.XmlAttrEastAsia.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrVal) then + {self.}Val := object_.XmlAttrVal.Value; + if not ifnil(object_.XmlAttrEastAsia) then + {self.}EastAsia := object_.XmlAttrEastAsia.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ThemeUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ThemeUnitDecorator@DOCX.tsf index 75e0434..c72ddeb 100644 --- a/autoclass/decorator/docx/ThemeUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ThemeUnitDecorator@DOCX.tsf @@ -22,10 +22,19 @@ end; function ThemeUnitDecorator.Convert(); begin - {self.}XmlAttrXmlnsA.Value := object_.XmlAttrXmlnsA.Value; - {self.}XmlAttrName.Value := object_.XmlAttrName.Value; - {self.}ThemeElements := new ThemeElementsUnitDecorator(object_.ThemeElements); - if not ifnil(object_.XmlChildObjectDefaults.Value) then {self.}XmlChildObjectDefaults.Value := object_.XmlChildObjectDefaults.Value; - if not ifnil(object_.XmlChildExtraClrSchemeLst.Value) then {self.}XmlChildExtraClrSchemeLst.Value := object_.XmlChildExtraClrSchemeLst.Value; - {self.}ExtLst := new ExtLstUnitDecorator(object_.ExtLst); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXmlnsA) then + {self.}XmlnsA := object_.XmlAttrXmlnsA.Value; + if not ifnil(object_.XmlAttrName) then + {self.}Name := object_.XmlAttrName.Value; + if not ifnil(object_.XmlChildThemeElements) then + {self.}XmlChildThemeElements := new ThemeElementsUnitDecorator(object_.XmlChildThemeElements); + if not ifnil(object_.XmlChildObjectDefaults) then + {self.}ObjectDefaults.Copy(object_.XmlChildObjectDefaults); + if not ifnil(object_.XmlChildExtraClrSchemeLst) then + {self.}ExtraClrSchemeLst.Copy(object_.XmlChildExtraClrSchemeLst); + if not ifnil(object_.XmlChildExtLst) then + {self.}XmlChildExtLst := new ExtLstUnitDecorator(object_.XmlChildExtLst); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TitleUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TitleUnitDecorator@DOCX.tsf index 1162876..c026738 100644 --- a/autoclass/decorator/docx/TitleUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TitleUnitDecorator@DOCX.tsf @@ -22,7 +22,13 @@ end; function TitleUnitDecorator.Convert(); begin - {self.}Tx := new TxUnitDecorator(object_.Tx); - if not ifnil(object_.XmlChildLayout.Value) then {self.}XmlChildLayout.Value := object_.XmlChildLayout.Value; - {self.}Overlay := new PureValUnitDecorator(object_.Overlay); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildTx) then + {self.}XmlChildTx := new TxUnitDecorator(object_.XmlChildTx); + if not ifnil(object_.XmlChildLayout) then + {self.}Layout.Copy(object_.XmlChildLayout); + if not ifnil(object_.XmlChildOverlay) then + {self.}XmlChildOverlay := new PureValUnitDecorator(object_.XmlChildOverlay); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TrHeightUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TrHeightUnitDecorator@DOCX.tsf index f399b08..478cbcc 100644 --- a/autoclass/decorator/docx/TrHeightUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TrHeightUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function TrHeightUnitDecorator.Convert(); begin - {self.}XmlAttrval.Value := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrval.Value); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrval) then + {self.}val := TSSafeUnitConverter.TwipsToPoints(object_.XmlAttrval.Value); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TrPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TrPrUnitDecorator@DOCX.tsf index 8f8ba1b..3cf93b5 100644 --- a/autoclass/decorator/docx/TrPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TrPrUnitDecorator@DOCX.tsf @@ -22,9 +22,17 @@ end; function TrPrUnitDecorator.Convert(); begin - {self.}TrHeight := new TrHeightUnitDecorator(object_.TrHeight); - {self.}TblHeader := new PureWValUnitDecorator(object_.TblHeader); - {self.}Jc := new PureWValUnitDecorator(object_.Jc); - if not ifnil(object_.XmlChildCantSplit.Value) then {self.}XmlChildCantSplit.Value := object_.XmlChildCantSplit.Value; - {self.}CnfStyle := new CnfStyleUnitDecorator(object_.CnfStyle); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildTrHeight) then + {self.}XmlChildTrHeight := new TrHeightUnitDecorator(object_.XmlChildTrHeight); + if not ifnil(object_.XmlChildTblHeader) then + {self.}XmlChildTblHeader := new PureWValUnitDecorator(object_.XmlChildTblHeader); + if not ifnil(object_.XmlChildJc) then + {self.}XmlChildJc := new PureWValUnitDecorator(object_.XmlChildJc); + if not ifnil(object_.XmlChildCantSplit) then + {self.}CantSplit.Copy(object_.XmlChildCantSplit); + if not ifnil(object_.XmlChildCnfStyle) then + {self.}XmlChildCnfStyle := new CnfStyleUnitDecorator(object_.XmlChildCnfStyle); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TrUnitDecorator@DOCX.tsf index 91a4dea..90e08c9 100644 --- a/autoclass/decorator/docx/TrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TrUnitDecorator@DOCX.tsf @@ -22,9 +22,17 @@ end; function TrUnitDecorator.Convert(); begin - {self.}XmlAttrWRsidR.Value := object_.XmlAttrWRsidR.Value; - {self.}XmlAttrW14ParaId.Value := object_.XmlAttrW14ParaId.Value; - {self.}XmlAttrW14TextId.Value := object_.XmlAttrW14TextId.Value; - {self.}XmlAttrWRsidTr.Value := object_.XmlAttrWRsidTr.Value; - {self.}TrPr := new TrPrUnitDecorator(object_.TrPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrWRsidR) then + {self.}WRsidR := object_.XmlAttrWRsidR.Value; + if not ifnil(object_.XmlAttrW14ParaId) then + {self.}W14ParaId := object_.XmlAttrW14ParaId.Value; + if not ifnil(object_.XmlAttrW14TextId) then + {self.}W14TextId := object_.XmlAttrW14TextId.Value; + if not ifnil(object_.XmlAttrWRsidTr) then + {self.}WRsidTr := object_.XmlAttrWRsidTr.Value; + if not ifnil(object_.XmlChildTrPr) then + {self.}XmlChildTrPr := new TrPrUnitDecorator(object_.XmlChildTrPr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TxPrUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TxPrUnitDecorator@DOCX.tsf index 1292293..9e41126 100644 --- a/autoclass/decorator/docx/TxPrUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TxPrUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function TxPrUnitDecorator.Convert(); begin - {self.}BodyPr := new BodyPrUnitDecorator(object_.BodyPr); - if not ifnil(object_.XmlChildLstStyle.Value) then {self.}XmlChildLstStyle.Value := object_.XmlChildLstStyle.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildBodyPr) then + {self.}XmlChildBodyPr := new BodyPrUnitDecorator(object_.XmlChildBodyPr); + if not ifnil(object_.XmlChildLstStyle) then + {self.}LstStyle.Copy(object_.XmlChildLstStyle); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TxUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TxUnitDecorator@DOCX.tsf index b2bf801..e3481ed 100644 --- a/autoclass/decorator/docx/TxUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TxUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function TxUnitDecorator.Convert(); begin - {self.}StrRef := new StrRefUnitDecorator(object_.StrRef); - {self.}Rich := new RichUnitDecorator(object_.Rich); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildStrRef) then + {self.}XmlChildStrRef := new StrRefUnitDecorator(object_.XmlChildStrRef); + if not ifnil(object_.XmlChildRich) then + {self.}XmlChildRich := new RichUnitDecorator(object_.XmlChildRich); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TxbxContentUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TxbxContentUnitDecorator@DOCX.tsf index 0244e1e..4316645 100644 --- a/autoclass/decorator/docx/TxbxContentUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TxbxContentUnitDecorator@DOCX.tsf @@ -22,4 +22,7 @@ end; function TxbxContentUnitDecorator.Convert(); begin + tslassigning_backup := tslassigning; + tslassigning := 1; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TxbxUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TxbxUnitDecorator@DOCX.tsf index d850863..a543126 100644 --- a/autoclass/decorator/docx/TxbxUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TxbxUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function TxbxUnitDecorator.Convert(); begin - {self.}TxbxContent := new TxbxContentUnitDecorator(object_.TxbxContent); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildTxbxContent) then + {self.}XmlChildTxbxContent := new TxbxContentUnitDecorator(object_.XmlChildTxbxContent); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/TypesUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/TypesUnitDecorator@DOCX.tsf index 191f0b8..a151a85 100644 --- a/autoclass/decorator/docx/TypesUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/TypesUnitDecorator@DOCX.tsf @@ -22,4 +22,9 @@ end; function TypesUnitDecorator.Convert(); begin + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrxmlns) then + {self.}xmlns := object_.XmlAttrxmlns.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ValUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ValUnitDecorator@DOCX.tsf index 0027643..4625577 100644 --- a/autoclass/decorator/docx/ValUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ValUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function ValUnitDecorator.Convert(); begin - {self.}NumRef := new NumRefUnitDecorator(object_.NumRef); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildNumRef) then + {self.}XmlChildNumRef := new NumRefUnitDecorator(object_.XmlChildNumRef); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/View3DUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/View3DUnitDecorator@DOCX.tsf index eaf2981..e3b01ae 100644 --- a/autoclass/decorator/docx/View3DUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/View3DUnitDecorator@DOCX.tsf @@ -22,7 +22,13 @@ end; function View3DUnitDecorator.Convert(); begin - {self.}RotX := new PureValUnitDecorator(object_.RotX); - {self.}RotY := new PureValUnitDecorator(object_.RotY); - {self.}RAngAx := new PureValUnitDecorator(object_.RAngAx); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildRotX) then + {self.}XmlChildRotX := new PureValUnitDecorator(object_.XmlChildRotX); + if not ifnil(object_.XmlChildRotY) then + {self.}XmlChildRotY := new PureValUnitDecorator(object_.XmlChildRotY); + if not ifnil(object_.XmlChildRAngAx) then + {self.}XmlChildRAngAx := new PureValUnitDecorator(object_.XmlChildRAngAx); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/WebSettingsUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/WebSettingsUnitDecorator@DOCX.tsf index 4339faf..c8c5e75 100644 --- a/autoclass/decorator/docx/WebSettingsUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/WebSettingsUnitDecorator@DOCX.tsf @@ -22,18 +22,35 @@ end; function WebSettingsUnitDecorator.Convert(); begin - {self.}XmlAttrXmlnsMc.Value := object_.XmlAttrXmlnsMc.Value; - {self.}XmlAttrXmlnsR.Value := object_.XmlAttrXmlnsR.Value; - {self.}XmlAttrXmlnsW.Value := object_.XmlAttrXmlnsW.Value; - {self.}XmlAttrXmlnsW14.Value := object_.XmlAttrXmlnsW14.Value; - {self.}XmlAttrXmlnsW15.Value := object_.XmlAttrXmlnsW15.Value; - {self.}XmlAttrXmlnsW16Cex.Value := object_.XmlAttrXmlnsW16Cex.Value; - {self.}XmlAttrXmlnsW16Cid.Value := object_.XmlAttrXmlnsW16Cid.Value; - {self.}XmlAttrXmlnsW16.Value := object_.XmlAttrXmlnsW16.Value; - {self.}XmlAttrXmlnsW16Du.Value := object_.XmlAttrXmlnsW16Du.Value; - {self.}XmlAttrXmlnsW16sdtdh.Value := object_.XmlAttrXmlnsW16sdtdh.Value; - {self.}XmlAttrXmlnsW16se.Value := object_.XmlAttrXmlnsW16se.Value; - {self.}XmlAttrMcIgnorable.Value := object_.XmlAttrMcIgnorable.Value; - if not ifnil(object_.XmlChildOptimizeForBrowser.Value) then {self.}XmlChildOptimizeForBrowser.Value := object_.XmlChildOptimizeForBrowser.Value; - if not ifnil(object_.XmlChildAllowPNG.Value) then {self.}XmlChildAllowPNG.Value := object_.XmlChildAllowPNG.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrXmlnsMc) then + {self.}XmlnsMc := object_.XmlAttrXmlnsMc.Value; + if not ifnil(object_.XmlAttrXmlnsR) then + {self.}XmlnsR := object_.XmlAttrXmlnsR.Value; + if not ifnil(object_.XmlAttrXmlnsW) then + {self.}XmlnsW := object_.XmlAttrXmlnsW.Value; + if not ifnil(object_.XmlAttrXmlnsW14) then + {self.}XmlnsW14 := object_.XmlAttrXmlnsW14.Value; + if not ifnil(object_.XmlAttrXmlnsW15) then + {self.}XmlnsW15 := object_.XmlAttrXmlnsW15.Value; + if not ifnil(object_.XmlAttrXmlnsW16Cex) then + {self.}XmlnsW16Cex := object_.XmlAttrXmlnsW16Cex.Value; + if not ifnil(object_.XmlAttrXmlnsW16Cid) then + {self.}XmlnsW16Cid := object_.XmlAttrXmlnsW16Cid.Value; + if not ifnil(object_.XmlAttrXmlnsW16) then + {self.}XmlnsW16 := object_.XmlAttrXmlnsW16.Value; + if not ifnil(object_.XmlAttrXmlnsW16Du) then + {self.}XmlnsW16Du := object_.XmlAttrXmlnsW16Du.Value; + if not ifnil(object_.XmlAttrXmlnsW16sdtdh) then + {self.}XmlnsW16sdtdh := object_.XmlAttrXmlnsW16sdtdh.Value; + if not ifnil(object_.XmlAttrXmlnsW16se) then + {self.}XmlnsW16se := object_.XmlAttrXmlnsW16se.Value; + if not ifnil(object_.XmlAttrMcIgnorable) then + {self.}McIgnorable := object_.XmlAttrMcIgnorable.Value; + if not ifnil(object_.XmlChildOptimizeForBrowser) then + {self.}OptimizeForBrowser.Copy(object_.XmlChildOptimizeForBrowser); + if not ifnil(object_.XmlChildAllowPNG) then + {self.}AllowPNG.Copy(object_.XmlChildAllowPNG); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/WpsStyleUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/WpsStyleUnitDecorator@DOCX.tsf index 29de0ae..09e63ad 100644 --- a/autoclass/decorator/docx/WpsStyleUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/WpsStyleUnitDecorator@DOCX.tsf @@ -22,8 +22,15 @@ end; function WpsStyleUnitDecorator.Convert(); begin - {self.}LnRef := new XRefUnitDecorator(object_.LnRef); - {self.}FillRef := new XRefUnitDecorator(object_.FillRef); - {self.}EffectRef := new XRefUnitDecorator(object_.EffectRef); - {self.}FontRef := new XRefUnitDecorator(object_.FontRef); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildLnRef) then + {self.}XmlChildLnRef := new XRefUnitDecorator(object_.XmlChildLnRef); + if not ifnil(object_.XmlChildFillRef) then + {self.}XmlChildFillRef := new XRefUnitDecorator(object_.XmlChildFillRef); + if not ifnil(object_.XmlChildEffectRef) then + {self.}XmlChildEffectRef := new XRefUnitDecorator(object_.XmlChildEffectRef); + if not ifnil(object_.XmlChildFontRef) then + {self.}XmlChildFontRef := new XRefUnitDecorator(object_.XmlChildFontRef); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/WspUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/WspUnitDecorator@DOCX.tsf index b8a9523..ba55925 100644 --- a/autoclass/decorator/docx/WspUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/WspUnitDecorator@DOCX.tsf @@ -22,9 +22,17 @@ end; function WspUnitDecorator.Convert(); begin - {self.}CNvSpPr := new CNvSpPrUnitDecorator(object_.CNvSpPr); - {self.}SpPr := new SpPrUnitDecorator(object_.SpPr); - {self.}Txbx := new TxbxUnitDecorator(object_.Txbx); - {self.}Style := new WpsStyleUnitDecorator(object_.Style); - {self.}BodyPr := new BodyPrUnitDecorator(object_.BodyPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildCNvSpPr) then + {self.}XmlChildCNvSpPr := new CNvSpPrUnitDecorator(object_.XmlChildCNvSpPr); + if not ifnil(object_.XmlChildSpPr) then + {self.}XmlChildSpPr := new SpPrUnitDecorator(object_.XmlChildSpPr); + if not ifnil(object_.XmlChildTxbx) then + {self.}XmlChildTxbx := new TxbxUnitDecorator(object_.XmlChildTxbx); + if not ifnil(object_.XmlChildStyle) then + {self.}XmlChildStyle := new WpsStyleUnitDecorator(object_.XmlChildStyle); + if not ifnil(object_.XmlChildBodyPr) then + {self.}XmlChildBodyPr := new BodyPrUnitDecorator(object_.XmlChildBodyPr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/XRefUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/XRefUnitDecorator@DOCX.tsf index 37bf7fe..b888df0 100644 --- a/autoclass/decorator/docx/XRefUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/XRefUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function XRefUnitDecorator.Convert(); begin - {self.}XmlAttrIdx.Value := object_.XmlAttrIdx.Value; - {self.}SchemeClr := new SchemeClrUnitDecorator(object_.SchemeClr); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrIdx) then + {self.}Idx := object_.XmlAttrIdx.Value; + if not ifnil(object_.XmlChildSchemeClr) then + {self.}XmlChildSchemeClr := new SchemeClrUnitDecorator(object_.XmlChildSchemeClr); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/XYUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/XYUnitDecorator@DOCX.tsf index 11303cd..cc7ef7b 100644 --- a/autoclass/decorator/docx/XYUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/XYUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function XYUnitDecorator.Convert(); begin - {self.}XmlAttrX.Value := TSSafeUnitConverter.EmusToPoints(object_.XmlAttrX.Value); - {self.}XmlAttrY.Value := TSSafeUnitConverter.EmusToPoints(object_.XmlAttrY.Value); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrX) then + {self.}X := TSSafeUnitConverter.EmusToPoints(object_.XmlAttrX.Value); + if not ifnil(object_.XmlAttrY) then + {self.}Y := TSSafeUnitConverter.EmusToPoints(object_.XmlAttrY.Value); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/XfrmUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/XfrmUnitDecorator@DOCX.tsf index 1ba67b4..f19b02e 100644 --- a/autoclass/decorator/docx/XfrmUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/XfrmUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function XfrmUnitDecorator.Convert(); begin - {self.}Off := new XYUnitDecorator(object_.Off); - {self.}Ext := new CXYUnitDecorator(object_.Ext); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlChildOff) then + {self.}XmlChildOff := new XYUnitDecorator(object_.XmlChildOff); + if not ifnil(object_.XmlChildExt) then + {self.}XmlChildExt := new CXYUnitDecorator(object_.XmlChildExt); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/ZoomUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/ZoomUnitDecorator@DOCX.tsf index 0dee9ce..875ca52 100644 --- a/autoclass/decorator/docx/ZoomUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/ZoomUnitDecorator@DOCX.tsf @@ -22,5 +22,9 @@ end; function ZoomUnitDecorator.Convert(); begin - {self.}XmlAttrPercent.Value := object_.XmlAttrPercent.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrPercent) then + {self.}Percent := object_.XmlAttrPercent.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/_InlineUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/_InlineUnitDecorator@DOCX.tsf index 363e536..97d2a76 100644 --- a/autoclass/decorator/docx/_InlineUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/_InlineUnitDecorator@DOCX.tsf @@ -22,15 +22,29 @@ end; function _InlineUnitDecorator.Convert(); begin - {self.}XmlAttrDistT.Value := object_.XmlAttrDistT.Value; - {self.}XmlAttrDistB.Value := object_.XmlAttrDistB.Value; - {self.}XmlAttrDistL.Value := object_.XmlAttrDistL.Value; - {self.}XmlAttrDistR.Value := object_.XmlAttrDistR.Value; - {self.}XmlAttrAnchorId.Value := object_.XmlAttrAnchorId.Value; - {self.}XmlAttrEditId.Value := object_.XmlAttrEditId.Value; - {self.}Extent := new CXYUnitDecorator(object_.Extent); - {self.}EffectExtent := new EffectExtentUnitDecorator(object_.EffectExtent); - {self.}DocPr := new DocPrUnitDecorator(object_.DocPr); - {self.}CNvGraphicFramePr := new CNvGraphicFramePrUnitDecorator(object_.CNvGraphicFramePr); - {self.}Graphic := new GraphicUnitDecorator(object_.Graphic); + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrDistT) then + {self.}DistT := object_.XmlAttrDistT.Value; + if not ifnil(object_.XmlAttrDistB) then + {self.}DistB := object_.XmlAttrDistB.Value; + if not ifnil(object_.XmlAttrDistL) then + {self.}DistL := object_.XmlAttrDistL.Value; + if not ifnil(object_.XmlAttrDistR) then + {self.}DistR := object_.XmlAttrDistR.Value; + if not ifnil(object_.XmlAttrAnchorId) then + {self.}AnchorId := object_.XmlAttrAnchorId.Value; + if not ifnil(object_.XmlAttrEditId) then + {self.}EditId := object_.XmlAttrEditId.Value; + if not ifnil(object_.XmlChildExtent) then + {self.}XmlChildExtent := new CXYUnitDecorator(object_.XmlChildExtent); + if not ifnil(object_.XmlChildEffectExtent) then + {self.}XmlChildEffectExtent := new EffectExtentUnitDecorator(object_.XmlChildEffectExtent); + if not ifnil(object_.XmlChildDocPr) then + {self.}XmlChildDocPr := new DocPrUnitDecorator(object_.XmlChildDocPr); + if not ifnil(object_.XmlChildCNvGraphicFramePr) then + {self.}XmlChildCNvGraphicFramePr := new CNvGraphicFramePrUnitDecorator(object_.XmlChildCNvGraphicFramePr); + if not ifnil(object_.XmlChildGraphic) then + {self.}XmlChildGraphic := new GraphicUnitDecorator(object_.XmlChildGraphic); + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/decorator/docx/_OverrideUnitDecorator@DOCX.tsf b/autoclass/decorator/docx/_OverrideUnitDecorator@DOCX.tsf index f38ef1b..a9b27f2 100644 --- a/autoclass/decorator/docx/_OverrideUnitDecorator@DOCX.tsf +++ b/autoclass/decorator/docx/_OverrideUnitDecorator@DOCX.tsf @@ -22,6 +22,11 @@ end; function _OverrideUnitDecorator.Convert(); begin - {self.}XmlAttrPartName.Value := object_.XmlAttrPartName.Value; - {self.}XmlAttrContentType.Value := object_.XmlAttrContentType.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + if not ifnil(object_.XmlAttrPartName) then + {self.}PartName := object_.XmlAttrPartName.Value; + if not ifnil(object_.XmlAttrContentType) then + {self.}ContentType := object_.XmlAttrContentType.Value; + tslassigning := tslassigning_backup; end; \ No newline at end of file diff --git a/autoclass/docx/APPr@DOCX.tsf b/autoclass/docx/APPr@DOCX.tsf index 954c80a..95c7030 100644 --- a/autoclass/docx/APPr@DOCX.tsf +++ b/autoclass/docx/APPr@DOCX.tsf @@ -4,16 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: APPr);override; public - // Attributes + // normal property + property DefRPr read ReadXmlChildDefRPr; + function ReadXmlChildDefRPr(); + +public // Children - DefRPr: ARPr; + XmlChildDefRPr: ARPr; end; @@ -29,70 +30,38 @@ end; function APPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function APPr.Init();override; begin - {self.}DefRPr := new ARPr(self, {self.}Prefix, "defRPr"); -end; - -function APPr.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function APPr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}DefRPr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}DefRPr.ElementName: 0, + pre + "defRPr": array(0, makeweakref(thisFunction(ReadXmlChildDefRPr))), ); -end; - -function APPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function APPr.Copy(_obj: APPr);override; begin - {self.}DefRPr.Copy(_obj.DefRPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildDefRPr) then + {self.}DefRPr.Copy(_obj.XmlChildDefRPr); + tslassigning := tslassigning_backup; +end; + +function APPr.ReadXmlChildDefRPr(); +begin + if tslassigning and ifnil({self.}XmlChildDefRPr) then + begin + {self.}XmlChildDefRPr := new ARPr(self, {self.}Prefix, "defRPr"); + container_.Set({self.}XmlChildDefRPr); + end + return {self.}XmlChildDefRPr; end; diff --git a/autoclass/docx/AR@DOCX.tsf b/autoclass/docx/AR@DOCX.tsf index cd87fd4..c1bef6a 100644 --- a/autoclass/docx/AR@DOCX.tsf +++ b/autoclass/docx/AR@DOCX.tsf @@ -4,17 +4,20 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: AR);override; public - // Attributes + // normal property + property RPr read ReadXmlChildRPr; + property T read ReadXmlChildT; + function ReadXmlChildRPr(); + function ReadXmlChildT(); + +public // Children - RPr: ARPr; - T: T; + XmlChildRPr: ARPr; + XmlChildT: T; end; @@ -30,74 +33,51 @@ end; function AR.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function AR.Init();override; begin - {self.}RPr := new ARPr(self, {self.}Prefix, "rPr"); - {self.}T := new T(self, {self.}Prefix, "t"); -end; - -function AR.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function AR.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}RPr, - 1: {self.}T, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}RPr.ElementName: 0, - {self.}T.ElementName: 1, + pre + "rPr": array(0, makeweakref(thisFunction(ReadXmlChildRPr))), + pre + "t": array(1, makeweakref(thisFunction(ReadXmlChildT))), ); -end; - -function AR.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function AR.Copy(_obj: AR);override; begin - {self.}RPr.Copy(_obj.RPr); - {self.}T.Copy(_obj.T); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildRPr) then + {self.}RPr.Copy(_obj.XmlChildRPr); + if not ifnil(_obj.XmlChildT) then + {self.}T.Copy(_obj.XmlChildT); + tslassigning := tslassigning_backup; +end; + +function AR.ReadXmlChildRPr(); +begin + if tslassigning and ifnil({self.}XmlChildRPr) then + begin + {self.}XmlChildRPr := new ARPr(self, {self.}Prefix, "rPr"); + container_.Set({self.}XmlChildRPr); + end + return {self.}XmlChildRPr; +end; + +function AR.ReadXmlChildT(); +begin + if tslassigning and ifnil({self.}XmlChildT) then + begin + {self.}XmlChildT := new T(self, {self.}Prefix, "t"); + container_.Set({self.}XmlChildT); + end + return {self.}XmlChildT; end; diff --git a/autoclass/docx/ARPr@DOCX.tsf b/autoclass/docx/ARPr@DOCX.tsf index c38d2a2..ee34a8a 100644 --- a/autoclass/docx/ARPr@DOCX.tsf +++ b/autoclass/docx/ARPr@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: ARPr);override; +public + + // attributes property property Lang read ReadXmlAttrLang write WriteXmlAttrLang; property AltLang read ReadXmlAttrAltLang write WriteXmlAttrAltLang; property B read ReadXmlAttrB write WriteXmlAttrB; @@ -40,8 +40,18 @@ public function ReadXmlAttrU(); function WriteXmlAttrU(_value); + // normal property + property SolidFill read ReadXmlChildSolidFill; + property Latin read ReadXmlChildLatin; + property Ea read ReadXmlChildEa; + property Cs read ReadXmlChildCs; + function ReadXmlChildSolidFill(); + function ReadXmlChildLatin(); + function ReadXmlChildEa(); + function ReadXmlChildCs(); + public - // Attributes + // Attributes XmlAttrLang: OpenXmlAttribute; XmlAttrAltLang: OpenXmlAttribute; XmlAttrB: OpenXmlAttribute; @@ -54,10 +64,10 @@ public XmlAttrU: OpenXmlAttribute; // Children - SolidFill: SolidFill; - Latin: Latin; - Ea: Latin; - Cs: Latin; + XmlChildSolidFill: SolidFill; + XmlChildLatin: Latin; + XmlChildEa: Latin; + XmlChildCs: Latin; end; @@ -73,124 +83,69 @@ end; function ARPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function ARPr.Init();override; begin - {self.}XmlAttrLang := new OpenXmlAttribute(nil, "lang", nil); - {self.}XmlAttrAltLang := new OpenXmlAttribute(nil, "altLang", nil); - {self.}XmlAttrB := new OpenXmlAttribute(nil, "b", nil); - {self.}XmlAttrBaseline := new OpenXmlAttribute(nil, "baseline", nil); - {self.}XmlAttrI := new OpenXmlAttribute(nil, "i", nil); - {self.}XmlAttrKern := new OpenXmlAttribute(nil, "kern", nil); - {self.}XmlAttrSpc := new OpenXmlAttribute(nil, "spc", nil); - {self.}XmlAttrStrike := new OpenXmlAttribute(nil, "strike", nil); - {self.}XmlAttrSz := new OpenXmlAttribute(nil, "sz", nil); - {self.}XmlAttrU := new OpenXmlAttribute(nil, "u", nil); - {self.}SolidFill := new SolidFill(self, {self.}Prefix, "solidFill"); - {self.}Latin := new Latin(self, {self.}Prefix, "latin"); - {self.}Ea := new Latin(self, {self.}Prefix, "ea"); - {self.}Cs := new Latin(self, {self.}Prefix, "cs"); -end; - -function ARPr.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrLang, - {self.}XmlAttrAltLang, - {self.}XmlAttrB, - {self.}XmlAttrBaseline, - {self.}XmlAttrI, - {self.}XmlAttrKern, - {self.}XmlAttrSpc, - {self.}XmlAttrStrike, - {self.}XmlAttrSz, - {self.}XmlAttrU, - ); -end; - -function ARPr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}SolidFill, - 1: {self.}Latin, - 2: {self.}Ea, - 3: {self.}Cs, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "lang": makeweakref(thisFunction(WriteXmlAttrLang)), + "altLang": makeweakref(thisFunction(WriteXmlAttrAltLang)), + "b": makeweakref(thisFunction(WriteXmlAttrB)), + "baseline": makeweakref(thisFunction(WriteXmlAttrBaseline)), + "i": makeweakref(thisFunction(WriteXmlAttrI)), + "kern": makeweakref(thisFunction(WriteXmlAttrKern)), + "spc": makeweakref(thisFunction(WriteXmlAttrSpc)), + "strike": makeweakref(thisFunction(WriteXmlAttrStrike)), + "sz": makeweakref(thisFunction(WriteXmlAttrSz)), + "u": makeweakref(thisFunction(WriteXmlAttrU)), ); sorted_child_ := array( - "": -1, - {self.}SolidFill.ElementName: 0, - {self.}Latin.ElementName: 1, - {self.}Ea.ElementName: 2, - {self.}Cs.ElementName: 3, + pre + "solidFill": array(0, makeweakref(thisFunction(ReadXmlChildSolidFill))), + pre + "latin": array(1, makeweakref(thisFunction(ReadXmlChildLatin))), + pre + "ea": array(2, makeweakref(thisFunction(ReadXmlChildEa))), + pre + "cs": array(3, makeweakref(thisFunction(ReadXmlChildCs))), ); -end; - -function ARPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function ARPr.Copy(_obj: ARPr);override; begin - if not ifnil(_obj.XmlAttrLang.Value) then - {self.}XmlAttrLang.Value := _obj.XmlAttrLang.Value; - if not ifnil(_obj.XmlAttrAltLang.Value) then - {self.}XmlAttrAltLang.Value := _obj.XmlAttrAltLang.Value; - if not ifnil(_obj.XmlAttrB.Value) then - {self.}XmlAttrB.Value := _obj.XmlAttrB.Value; - if not ifnil(_obj.XmlAttrBaseline.Value) then - {self.}XmlAttrBaseline.Value := _obj.XmlAttrBaseline.Value; - if not ifnil(_obj.XmlAttrI.Value) then - {self.}XmlAttrI.Value := _obj.XmlAttrI.Value; - if not ifnil(_obj.XmlAttrKern.Value) then - {self.}XmlAttrKern.Value := _obj.XmlAttrKern.Value; - if not ifnil(_obj.XmlAttrSpc.Value) then - {self.}XmlAttrSpc.Value := _obj.XmlAttrSpc.Value; - if not ifnil(_obj.XmlAttrStrike.Value) then - {self.}XmlAttrStrike.Value := _obj.XmlAttrStrike.Value; - if not ifnil(_obj.XmlAttrSz.Value) then - {self.}XmlAttrSz.Value := _obj.XmlAttrSz.Value; - if not ifnil(_obj.XmlAttrU.Value) then - {self.}XmlAttrU.Value := _obj.XmlAttrU.Value; - {self.}SolidFill.Copy(_obj.SolidFill); - {self.}Latin.Copy(_obj.Latin); - {self.}Ea.Copy(_obj.Ea); - {self.}Cs.Copy(_obj.Cs); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Lang) then + {self.}Lang := _obj.Lang; + if not ifnil(_obj.AltLang) then + {self.}AltLang := _obj.AltLang; + if not ifnil(_obj.B) then + {self.}B := _obj.B; + if not ifnil(_obj.Baseline) then + {self.}Baseline := _obj.Baseline; + if not ifnil(_obj.I) then + {self.}I := _obj.I; + if not ifnil(_obj.Kern) then + {self.}Kern := _obj.Kern; + if not ifnil(_obj.Spc) then + {self.}Spc := _obj.Spc; + if not ifnil(_obj.Strike) then + {self.}Strike := _obj.Strike; + if not ifnil(_obj.Sz) then + {self.}Sz := _obj.Sz; + if not ifnil(_obj.U) then + {self.}U := _obj.U; + if not ifnil(_obj.XmlChildSolidFill) then + {self.}SolidFill.Copy(_obj.XmlChildSolidFill); + if not ifnil(_obj.XmlChildLatin) then + {self.}Latin.Copy(_obj.XmlChildLatin); + if not ifnil(_obj.XmlChildEa) then + {self.}Ea.Copy(_obj.XmlChildEa); + if not ifnil(_obj.XmlChildCs) then + {self.}Cs.Copy(_obj.XmlChildCs); + tslassigning := tslassigning_backup; end; function ARPr.ReadXmlAttrLang(); @@ -200,6 +155,11 @@ end; function ARPr.WriteXmlAttrLang(_value); begin + if ifnil({self.}XmlAttrLang) then + begin + {self.}XmlAttrLang := new OpenXmlAttribute("", "lang", nil); + attributes_[length(attributes_)] := {self.}XmlAttrLang; + end {self.}XmlAttrLang.Value := _value; end; @@ -210,6 +170,11 @@ end; function ARPr.WriteXmlAttrAltLang(_value); begin + if ifnil({self.}XmlAttrAltLang) then + begin + {self.}XmlAttrAltLang := new OpenXmlAttribute("", "altLang", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAltLang; + end {self.}XmlAttrAltLang.Value := _value; end; @@ -220,6 +185,11 @@ end; function ARPr.WriteXmlAttrB(_value); begin + if ifnil({self.}XmlAttrB) then + begin + {self.}XmlAttrB := new OpenXmlAttribute("", "b", nil); + attributes_[length(attributes_)] := {self.}XmlAttrB; + end {self.}XmlAttrB.Value := _value; end; @@ -230,6 +200,11 @@ end; function ARPr.WriteXmlAttrBaseline(_value); begin + if ifnil({self.}XmlAttrBaseline) then + begin + {self.}XmlAttrBaseline := new OpenXmlAttribute("", "baseline", nil); + attributes_[length(attributes_)] := {self.}XmlAttrBaseline; + end {self.}XmlAttrBaseline.Value := _value; end; @@ -240,6 +215,11 @@ end; function ARPr.WriteXmlAttrI(_value); begin + if ifnil({self.}XmlAttrI) then + begin + {self.}XmlAttrI := new OpenXmlAttribute("", "i", nil); + attributes_[length(attributes_)] := {self.}XmlAttrI; + end {self.}XmlAttrI.Value := _value; end; @@ -250,6 +230,11 @@ end; function ARPr.WriteXmlAttrKern(_value); begin + if ifnil({self.}XmlAttrKern) then + begin + {self.}XmlAttrKern := new OpenXmlAttribute("", "kern", nil); + attributes_[length(attributes_)] := {self.}XmlAttrKern; + end {self.}XmlAttrKern.Value := _value; end; @@ -260,6 +245,11 @@ end; function ARPr.WriteXmlAttrSpc(_value); begin + if ifnil({self.}XmlAttrSpc) then + begin + {self.}XmlAttrSpc := new OpenXmlAttribute("", "spc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrSpc; + end {self.}XmlAttrSpc.Value := _value; end; @@ -270,6 +260,11 @@ end; function ARPr.WriteXmlAttrStrike(_value); begin + if ifnil({self.}XmlAttrStrike) then + begin + {self.}XmlAttrStrike := new OpenXmlAttribute("", "strike", nil); + attributes_[length(attributes_)] := {self.}XmlAttrStrike; + end {self.}XmlAttrStrike.Value := _value; end; @@ -280,6 +275,11 @@ end; function ARPr.WriteXmlAttrSz(_value); begin + if ifnil({self.}XmlAttrSz) then + begin + {self.}XmlAttrSz := new OpenXmlAttribute("", "sz", nil); + attributes_[length(attributes_)] := {self.}XmlAttrSz; + end {self.}XmlAttrSz.Value := _value; end; @@ -290,5 +290,50 @@ end; function ARPr.WriteXmlAttrU(_value); begin + if ifnil({self.}XmlAttrU) then + begin + {self.}XmlAttrU := new OpenXmlAttribute("", "u", nil); + attributes_[length(attributes_)] := {self.}XmlAttrU; + end {self.}XmlAttrU.Value := _value; end; + +function ARPr.ReadXmlChildSolidFill(); +begin + if tslassigning and ifnil({self.}XmlChildSolidFill) then + begin + {self.}XmlChildSolidFill := new SolidFill(self, {self.}Prefix, "solidFill"); + container_.Set({self.}XmlChildSolidFill); + end + return {self.}XmlChildSolidFill; +end; + +function ARPr.ReadXmlChildLatin(); +begin + if tslassigning and ifnil({self.}XmlChildLatin) then + begin + {self.}XmlChildLatin := new Latin(self, {self.}Prefix, "latin"); + container_.Set({self.}XmlChildLatin); + end + return {self.}XmlChildLatin; +end; + +function ARPr.ReadXmlChildEa(); +begin + if tslassigning and ifnil({self.}XmlChildEa) then + begin + {self.}XmlChildEa := new Latin(self, {self.}Prefix, "ea"); + container_.Set({self.}XmlChildEa); + end + return {self.}XmlChildEa; +end; + +function ARPr.ReadXmlChildCs(); +begin + if tslassigning and ifnil({self.}XmlChildCs) then + begin + {self.}XmlChildCs := new Latin(self, {self.}Prefix, "cs"); + container_.Set({self.}XmlChildCs); + end + return {self.}XmlChildCs; +end; diff --git a/autoclass/docx/AbstractNum@DOCX.tsf b/autoclass/docx/AbstractNum@DOCX.tsf index c245cf0..ede7fff 100644 --- a/autoclass/docx/AbstractNum@DOCX.tsf +++ b/autoclass/docx/AbstractNum@DOCX.tsf @@ -4,16 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: AbstractNum);override; - function AddLvl(): Lvl; - function AppendLvl(): Lvl; - property Lvls read ReadLvls; - function ReadLvls(_index); +public + // attributes property property AbstractNumId read ReadXmlAttrAbstractNumId write WriteXmlAttrAbstractNumId; property RestartNumberingAfterBreak read ReadXmlAttrRestartNumberingAfterBreak write WriteXmlAttrRestartNumberingAfterBreak; function ReadXmlAttrAbstractNumId(); @@ -21,15 +16,29 @@ public function ReadXmlAttrRestartNumberingAfterBreak(); function WriteXmlAttrRestartNumberingAfterBreak(_value); + // normal property + property Nsid read ReadXmlChildNsid; + property MultiLevelType read ReadXmlChildMultiLevelType; + property Tmpl read ReadXmlChildTmpl; + function ReadXmlChildNsid(); + function ReadXmlChildMultiLevelType(); + function ReadXmlChildTmpl(); + + // multi property + property Lvls read ReadLvls; + function ReadLvls(_index); + function AddLvl(): Lvl; + function AppendLvl(): Lvl; + public - // Attributes + // Attributes XmlAttrAbstractNumId: OpenXmlAttribute; XmlAttrRestartNumberingAfterBreak: OpenXmlAttribute; // Children - Nsid: PureWVal; - MultiLevelType: PureWVal; - Tmpl: PureWVal; + XmlChildNsid: PureWVal; + XmlChildMultiLevelType: PureWVal; + XmlChildTmpl: PureWVal; end; @@ -45,125 +54,43 @@ end; function AbstractNum.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function AbstractNum.Init();override; begin - {self.}XmlAttrAbstractNumId := new OpenXmlAttribute({self.}Prefix, "abstractNumId", nil); - {self.}XmlAttrRestartNumberingAfterBreak := new OpenXmlAttribute({self.}Prefix, "restartNumberingAfterBreak", nil); - {self.}Nsid := new PureWVal(self, {self.}Prefix, "nsid"); - {self.}MultiLevelType := new PureWVal(self, {self.}Prefix, "multiLevelType"); - {self.}Tmpl := new PureWVal(self, {self.}Prefix, "tmpl"); -end; - -function AbstractNum.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrAbstractNumId, - {self.}XmlAttrRestartNumberingAfterBreak, - ); -end; - -function AbstractNum.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Nsid, - 1: {self.}MultiLevelType, - 2: {self.}Tmpl, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "abstractNumId": makeweakref(thisFunction(WriteXmlAttrAbstractNumId)), + pre + "restartNumberingAfterBreak": makeweakref(thisFunction(WriteXmlAttrRestartNumberingAfterBreak)), ); sorted_child_ := array( - "": -1, - {self.}Nsid.ElementName: 0, - {self.}MultiLevelType.ElementName: 1, - {self.}Tmpl.ElementName: 2, + pre + "nsid": array(0, makeweakref(thisFunction(ReadXmlChildNsid))), + pre + "multiLevelType": array(1, makeweakref(thisFunction(ReadXmlChildMultiLevelType))), + pre + "tmpl": array(2, makeweakref(thisFunction(ReadXmlChildTmpl))), + pre + "lvl": array(3, makeweakref(thisFunction(AppendLvl))), ); -end; - -function AbstractNum.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "lvl": obj := {self.}AppendLvl(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function AbstractNum.Copy(_obj: AbstractNum);override; begin - if not ifnil(_obj.XmlAttrAbstractNumId.Value) then - {self.}XmlAttrAbstractNumId.Value := _obj.XmlAttrAbstractNumId.Value; - if not ifnil(_obj.XmlAttrRestartNumberingAfterBreak.Value) then - {self.}XmlAttrRestartNumberingAfterBreak.Value := _obj.XmlAttrRestartNumberingAfterBreak.Value; - {self.}Nsid.Copy(_obj.Nsid); - {self.}MultiLevelType.Copy(_obj.MultiLevelType); - {self.}Tmpl.Copy(_obj.Tmpl); -end; - -function AbstractNum.AddLvl(): Lvl; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "lvl" then break; - end - obj := new Lvl(self, {self.}Prefix, "lvl"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function AbstractNum.AppendLvl(): Lvl; -begin - obj := new Lvl(self, {self.}Prefix, "lvl"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function AbstractNum.ReadLvls(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "lvl" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.AbstractNumId) then + {self.}AbstractNumId := _obj.AbstractNumId; + if not ifnil(_obj.RestartNumberingAfterBreak) then + {self.}RestartNumberingAfterBreak := _obj.RestartNumberingAfterBreak; + if not ifnil(_obj.XmlChildNsid) then + {self.}Nsid.Copy(_obj.XmlChildNsid); + if not ifnil(_obj.XmlChildMultiLevelType) then + {self.}MultiLevelType.Copy(_obj.XmlChildMultiLevelType); + if not ifnil(_obj.XmlChildTmpl) then + {self.}Tmpl.Copy(_obj.XmlChildTmpl); + tslassigning := tslassigning_backup; end; function AbstractNum.ReadXmlAttrAbstractNumId(); @@ -173,6 +100,11 @@ end; function AbstractNum.WriteXmlAttrAbstractNumId(_value); begin + if ifnil({self.}XmlAttrAbstractNumId) then + begin + {self.}XmlAttrAbstractNumId := new OpenXmlAttribute({self.}Prefix, "abstractNumId", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAbstractNumId; + end {self.}XmlAttrAbstractNumId.Value := _value; end; @@ -183,5 +115,61 @@ end; function AbstractNum.WriteXmlAttrRestartNumberingAfterBreak(_value); begin + if ifnil({self.}XmlAttrRestartNumberingAfterBreak) then + begin + {self.}XmlAttrRestartNumberingAfterBreak := new OpenXmlAttribute({self.}Prefix, "restartNumberingAfterBreak", nil); + attributes_[length(attributes_)] := {self.}XmlAttrRestartNumberingAfterBreak; + end {self.}XmlAttrRestartNumberingAfterBreak.Value := _value; end; + +function AbstractNum.ReadXmlChildNsid(); +begin + if tslassigning and ifnil({self.}XmlChildNsid) then + begin + {self.}XmlChildNsid := new PureWVal(self, {self.}Prefix, "nsid"); + container_.Set({self.}XmlChildNsid); + end + return {self.}XmlChildNsid; +end; + +function AbstractNum.ReadXmlChildMultiLevelType(); +begin + if tslassigning and ifnil({self.}XmlChildMultiLevelType) then + begin + {self.}XmlChildMultiLevelType := new PureWVal(self, {self.}Prefix, "multiLevelType"); + container_.Set({self.}XmlChildMultiLevelType); + end + return {self.}XmlChildMultiLevelType; +end; + +function AbstractNum.ReadXmlChildTmpl(); +begin + if tslassigning and ifnil({self.}XmlChildTmpl) then + begin + {self.}XmlChildTmpl := new PureWVal(self, {self.}Prefix, "tmpl"); + container_.Set({self.}XmlChildTmpl); + end + return {self.}XmlChildTmpl; +end; + +function AbstractNum.ReadLvls(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "lvl", ind); +end; + +function AbstractNum.AddLvl(): Lvl; +begin + obj := new Lvl(self, {self.}Prefix, "lvl"); + container_.Insert(obj); + return obj; +end; + +function AbstractNum.AppendLvl(): Lvl; +begin + obj := new Lvl(self, {self.}Prefix, "lvl"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/AlternateContent@DOCX.tsf b/autoclass/docx/AlternateContent@DOCX.tsf index d1573d8..86fd15f 100644 --- a/autoclass/docx/AlternateContent@DOCX.tsf +++ b/autoclass/docx/AlternateContent@DOCX.tsf @@ -4,22 +4,28 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: AlternateContent);override; +public + + // attributes property property XmlnsMc read ReadXmlAttrXmlnsMc write WriteXmlAttrXmlnsMc; function ReadXmlAttrXmlnsMc(); function WriteXmlAttrXmlnsMc(_value); + // normal property + property Choice read ReadXmlChildChoice; + property Fallback read ReadXmlChildFallback; + function ReadXmlChildChoice(); + function ReadXmlChildFallback(); + public - // Attributes + // Attributes XmlAttrXmlnsMc: OpenXmlAttribute; // Children - Choice: Choice; - Fallback: Fallback; + XmlChildChoice: Choice; + XmlChildFallback: Fallback; end; @@ -35,80 +41,36 @@ end; function AlternateContent.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function AlternateContent.Init();override; begin - {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); - {self.}Choice := new Choice(self, {self.}Prefix, "Choice"); - {self.}Fallback := new Fallback(self, {self.}Prefix, "Fallback"); -end; - -function AlternateContent.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXmlnsMc, - ); -end; - -function AlternateContent.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Choice, - 1: {self.}Fallback, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns:mc": makeweakref(thisFunction(WriteXmlAttrXmlnsMc)), ); sorted_child_ := array( - "": -1, - {self.}Choice.ElementName: 0, - {self.}Fallback.ElementName: 1, + pre + "Choice": array(0, makeweakref(thisFunction(ReadXmlChildChoice))), + pre + "Fallback": array(1, makeweakref(thisFunction(ReadXmlChildFallback))), ); -end; - -function AlternateContent.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function AlternateContent.Copy(_obj: AlternateContent);override; begin - if not ifnil(_obj.XmlAttrXmlnsMc.Value) then - {self.}XmlAttrXmlnsMc.Value := _obj.XmlAttrXmlnsMc.Value; - {self.}Choice.Copy(_obj.Choice); - {self.}Fallback.Copy(_obj.Fallback); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlnsMc) then + {self.}XmlnsMc := _obj.XmlnsMc; + if not ifnil(_obj.XmlChildChoice) then + {self.}Choice.Copy(_obj.XmlChildChoice); + if not ifnil(_obj.XmlChildFallback) then + {self.}Fallback.Copy(_obj.XmlChildFallback); + tslassigning := tslassigning_backup; end; function AlternateContent.ReadXmlAttrXmlnsMc(); @@ -118,5 +80,30 @@ end; function AlternateContent.WriteXmlAttrXmlnsMc(_value); begin + if ifnil({self.}XmlAttrXmlnsMc) then + begin + {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsMc; + end {self.}XmlAttrXmlnsMc.Value := _value; end; + +function AlternateContent.ReadXmlChildChoice(); +begin + if tslassigning and ifnil({self.}XmlChildChoice) then + begin + {self.}XmlChildChoice := new Choice(self, {self.}Prefix, "Choice"); + container_.Set({self.}XmlChildChoice); + end + return {self.}XmlChildChoice; +end; + +function AlternateContent.ReadXmlChildFallback(); +begin + if tslassigning and ifnil({self.}XmlChildFallback) then + begin + {self.}XmlChildFallback := new Fallback(self, {self.}Prefix, "Fallback"); + container_.Set({self.}XmlChildFallback); + end + return {self.}XmlChildFallback; +end; diff --git a/autoclass/docx/Anchor@DOCX.tsf b/autoclass/docx/Anchor@DOCX.tsf index 0309d53..8df4b75 100644 --- a/autoclass/docx/Anchor@DOCX.tsf +++ b/autoclass/docx/Anchor@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Anchor);override; +public + + // attributes property property DistT read ReadXmlAttrDistT write WriteXmlAttrDistT; property DistB read ReadXmlAttrDistB write WriteXmlAttrDistB; property DistL read ReadXmlAttrDistL write WriteXmlAttrDistL; @@ -46,12 +46,35 @@ public function ReadXmlAttrEditId(); function WriteXmlAttrEditId(_value); + // empty property property WrapNone read ReadXmlChildWrapNone write WriteXmlChildWrapNone; function ReadXmlChildWrapNone(); function WriteXmlChildWrapNone(_value); + // normal property + property SimplePos read ReadXmlChildSimplePos; + property PositionH read ReadXmlChildPositionH; + property PositionV read ReadXmlChildPositionV; + property Extent read ReadXmlChildExtent; + property EffectExtent read ReadXmlChildEffectExtent; + property DocPr read ReadXmlChildDocPr; + property CNvGraphicFramePr read ReadXmlChildCNvGraphicFramePr; + property Graphic read ReadXmlChildGraphic; + property SizeRelH read ReadXmlChildSizeRelH; + property SizeRelV read ReadXmlChildSizeRelV; + function ReadXmlChildSimplePos(); + function ReadXmlChildPositionH(); + function ReadXmlChildPositionV(); + function ReadXmlChildExtent(); + function ReadXmlChildEffectExtent(); + function ReadXmlChildDocPr(); + function ReadXmlChildCNvGraphicFramePr(); + function ReadXmlChildGraphic(); + function ReadXmlChildSizeRelH(); + function ReadXmlChildSizeRelV(); + public - // Attributes + // Attributes XmlAttrDistT: OpenXmlAttribute; XmlAttrDistB: OpenXmlAttribute; XmlAttrDistL: OpenXmlAttribute; @@ -66,17 +89,17 @@ public XmlAttrEditId: OpenXmlAttribute; // Children - SimplePos: XY; - PositionH: PositionH; - PositionV: PositionV; - Extent: CXY; - EffectExtent: EffectExtent; + XmlChildSimplePos: XY; + XmlChildPositionH: PositionH; + XmlChildPositionV: PositionV; + XmlChildExtent: CXY; + XmlChildEffectExtent: EffectExtent; XmlChildWrapNone: OpenXmlEmpty; - DocPr: DocPr; - CNvGraphicFramePr: CNvGraphicFramePr; - Graphic: Graphic; - SizeRelH: SizeRelH; - SizeRelV: SizeRelV; + XmlChildDocPr: DocPr; + XmlChildCNvGraphicFramePr: CNvGraphicFramePr; + XmlChildGraphic: Graphic; + XmlChildSizeRelH: SizeRelH; + XmlChildSizeRelV: SizeRelV; end; @@ -92,160 +115,96 @@ end; function Anchor.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Anchor.Init();override; begin - {self.}XmlAttrDistT := new OpenXmlAttribute(nil, "distT", nil); - {self.}XmlAttrDistB := new OpenXmlAttribute(nil, "distB", nil); - {self.}XmlAttrDistL := new OpenXmlAttribute(nil, "distL", nil); - {self.}XmlAttrDistR := new OpenXmlAttribute(nil, "distR", nil); - {self.}XmlAttrSimplePos := new OpenXmlAttribute(nil, "simplePos", nil); - {self.}XmlAttrRelativeHeight := new OpenXmlAttribute(nil, "relativeHeight", nil); - {self.}XmlAttrBehindDoc := new OpenXmlAttribute(nil, "behindDoc", nil); - {self.}XmlAttrLocked := new OpenXmlAttribute(nil, "locked", nil); - {self.}XmlAttrLayoutInCell := new OpenXmlAttribute(nil, "layoutInCell", nil); - {self.}XmlAttrAllowOverlap := new OpenXmlAttribute(nil, "allowOverlap", nil); - {self.}XmlAttrAnchorId := new OpenXmlAttribute("wp14", "anchorId", nil); - {self.}XmlAttrEditId := new OpenXmlAttribute("wp14", "editId", nil); - {self.}SimplePos := new XY(self, {self.}Prefix, "simplePos"); - {self.}PositionH := new PositionH(self, {self.}Prefix, "positionH"); - {self.}PositionV := new PositionV(self, {self.}Prefix, "positionV"); - {self.}Extent := new CXY(self, {self.}Prefix, "extent"); - {self.}EffectExtent := new EffectExtent(self, {self.}Prefix, "effectExtent"); - {self.}XmlChildWrapNone := new OpenXmlEmpty(self, {self.}Prefix, "wrapNone"); - {self.}DocPr := new DocPr(self, {self.}Prefix, "docPr"); - {self.}CNvGraphicFramePr := new CNvGraphicFramePr(self, {self.}Prefix, "cNvGraphicFramePr"); - {self.}Graphic := new Graphic(self, "a", "graphic"); - {self.}SizeRelH := new SizeRelH(self, "wp14", "sizeRelH"); - {self.}SizeRelV := new SizeRelV(self, "wp14", "sizeRelV"); -end; - -function Anchor.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrDistT, - {self.}XmlAttrDistB, - {self.}XmlAttrDistL, - {self.}XmlAttrDistR, - {self.}XmlAttrSimplePos, - {self.}XmlAttrRelativeHeight, - {self.}XmlAttrBehindDoc, - {self.}XmlAttrLocked, - {self.}XmlAttrLayoutInCell, - {self.}XmlAttrAllowOverlap, - {self.}XmlAttrAnchorId, - {self.}XmlAttrEditId, - ); -end; - -function Anchor.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}SimplePos, - 1: {self.}PositionH, - 2: {self.}PositionV, - 3: {self.}Extent, - 4: {self.}EffectExtent, - 5: {self.}XmlChildWrapNone, - 6: {self.}DocPr, - 7: {self.}CNvGraphicFramePr, - 8: {self.}Graphic, - 9: {self.}SizeRelH, - 10: {self.}SizeRelV, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "distT": makeweakref(thisFunction(WriteXmlAttrDistT)), + "distB": makeweakref(thisFunction(WriteXmlAttrDistB)), + "distL": makeweakref(thisFunction(WriteXmlAttrDistL)), + "distR": makeweakref(thisFunction(WriteXmlAttrDistR)), + "simplePos": makeweakref(thisFunction(WriteXmlAttrSimplePos)), + "relativeHeight": makeweakref(thisFunction(WriteXmlAttrRelativeHeight)), + "behindDoc": makeweakref(thisFunction(WriteXmlAttrBehindDoc)), + "locked": makeweakref(thisFunction(WriteXmlAttrLocked)), + "layoutInCell": makeweakref(thisFunction(WriteXmlAttrLayoutInCell)), + "allowOverlap": makeweakref(thisFunction(WriteXmlAttrAllowOverlap)), + "wp14:anchorId": makeweakref(thisFunction(WriteXmlAttrAnchorId)), + "wp14:editId": makeweakref(thisFunction(WriteXmlAttrEditId)), ); sorted_child_ := array( - "": -1, - {self.}SimplePos.ElementName: 0, - {self.}PositionH.ElementName: 1, - {self.}PositionV.ElementName: 2, - {self.}Extent.ElementName: 3, - {self.}EffectExtent.ElementName: 4, - {self.}XmlChildWrapNone.ElementName: 5, - {self.}DocPr.ElementName: 6, - {self.}CNvGraphicFramePr.ElementName: 7, - {self.}Graphic.ElementName: 8, - {self.}SizeRelH.ElementName: 9, - {self.}SizeRelV.ElementName: 10, + pre + "simplePos": array(0, makeweakref(thisFunction(ReadXmlChildSimplePos))), + pre + "positionH": array(1, makeweakref(thisFunction(ReadXmlChildPositionH))), + pre + "positionV": array(2, makeweakref(thisFunction(ReadXmlChildPositionV))), + pre + "extent": array(3, makeweakref(thisFunction(ReadXmlChildExtent))), + pre + "effectExtent": array(4, makeweakref(thisFunction(ReadXmlChildEffectExtent))), + pre + "wrapNone": array(5, makeweakref(thisFunction(ReadXmlChildWrapNone))), + pre + "docPr": array(6, makeweakref(thisFunction(ReadXmlChildDocPr))), + pre + "cNvGraphicFramePr": array(7, makeweakref(thisFunction(ReadXmlChildCNvGraphicFramePr))), + "a:graphic": array(8, makeweakref(thisFunction(ReadXmlChildGraphic))), + "wp14:sizeRelH": array(9, makeweakref(thisFunction(ReadXmlChildSizeRelH))), + "wp14:sizeRelV": array(10, makeweakref(thisFunction(ReadXmlChildSizeRelV))), ); -end; - -function Anchor.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Anchor.Copy(_obj: Anchor);override; begin - if not ifnil(_obj.XmlAttrDistT.Value) then - {self.}XmlAttrDistT.Value := _obj.XmlAttrDistT.Value; - if not ifnil(_obj.XmlAttrDistB.Value) then - {self.}XmlAttrDistB.Value := _obj.XmlAttrDistB.Value; - if not ifnil(_obj.XmlAttrDistL.Value) then - {self.}XmlAttrDistL.Value := _obj.XmlAttrDistL.Value; - if not ifnil(_obj.XmlAttrDistR.Value) then - {self.}XmlAttrDistR.Value := _obj.XmlAttrDistR.Value; - if not ifnil(_obj.XmlAttrSimplePos.Value) then - {self.}XmlAttrSimplePos.Value := _obj.XmlAttrSimplePos.Value; - if not ifnil(_obj.XmlAttrRelativeHeight.Value) then - {self.}XmlAttrRelativeHeight.Value := _obj.XmlAttrRelativeHeight.Value; - if not ifnil(_obj.XmlAttrBehindDoc.Value) then - {self.}XmlAttrBehindDoc.Value := _obj.XmlAttrBehindDoc.Value; - if not ifnil(_obj.XmlAttrLocked.Value) then - {self.}XmlAttrLocked.Value := _obj.XmlAttrLocked.Value; - if not ifnil(_obj.XmlAttrLayoutInCell.Value) then - {self.}XmlAttrLayoutInCell.Value := _obj.XmlAttrLayoutInCell.Value; - if not ifnil(_obj.XmlAttrAllowOverlap.Value) then - {self.}XmlAttrAllowOverlap.Value := _obj.XmlAttrAllowOverlap.Value; - if not ifnil(_obj.XmlAttrAnchorId.Value) then - {self.}XmlAttrAnchorId.Value := _obj.XmlAttrAnchorId.Value; - if not ifnil(_obj.XmlAttrEditId.Value) then - {self.}XmlAttrEditId.Value := _obj.XmlAttrEditId.Value; - {self.}SimplePos.Copy(_obj.SimplePos); - {self.}PositionH.Copy(_obj.PositionH); - {self.}PositionV.Copy(_obj.PositionV); - {self.}Extent.Copy(_obj.Extent); - {self.}EffectExtent.Copy(_obj.EffectExtent); - {self.}XmlChildWrapNone.Copy(_obj.XmlChildWrapNone); - {self.}DocPr.Copy(_obj.DocPr); - {self.}CNvGraphicFramePr.Copy(_obj.CNvGraphicFramePr); - {self.}Graphic.Copy(_obj.Graphic); - {self.}SizeRelH.Copy(_obj.SizeRelH); - {self.}SizeRelV.Copy(_obj.SizeRelV); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.DistT) then + {self.}DistT := _obj.DistT; + if not ifnil(_obj.DistB) then + {self.}DistB := _obj.DistB; + if not ifnil(_obj.DistL) then + {self.}DistL := _obj.DistL; + if not ifnil(_obj.DistR) then + {self.}DistR := _obj.DistR; + if not ifnil(_obj.SimplePos) then + {self.}SimplePos := _obj.SimplePos; + if not ifnil(_obj.RelativeHeight) then + {self.}RelativeHeight := _obj.RelativeHeight; + if not ifnil(_obj.BehindDoc) then + {self.}BehindDoc := _obj.BehindDoc; + if not ifnil(_obj.Locked) then + {self.}Locked := _obj.Locked; + if not ifnil(_obj.LayoutInCell) then + {self.}LayoutInCell := _obj.LayoutInCell; + if not ifnil(_obj.AllowOverlap) then + {self.}AllowOverlap := _obj.AllowOverlap; + if not ifnil(_obj.AnchorId) then + {self.}AnchorId := _obj.AnchorId; + if not ifnil(_obj.EditId) then + {self.}EditId := _obj.EditId; + if not ifnil(_obj.XmlChildSimplePos) then + {self.}SimplePos.Copy(_obj.XmlChildSimplePos); + if not ifnil(_obj.XmlChildPositionH) then + {self.}PositionH.Copy(_obj.XmlChildPositionH); + if not ifnil(_obj.XmlChildPositionV) then + {self.}PositionV.Copy(_obj.XmlChildPositionV); + if not ifnil(_obj.XmlChildExtent) then + {self.}Extent.Copy(_obj.XmlChildExtent); + if not ifnil(_obj.XmlChildEffectExtent) then + {self.}EffectExtent.Copy(_obj.XmlChildEffectExtent); + if not ifnil(_obj.XmlChildWrapNone) then + ifnil({self.}XmlChildWrapNone) ? {self.}WrapNone.Copy(_obj.XmlChildWrapNone) : {self.}XmlChildWrapNone.Copy(_obj.XmlChildWrapNone); + if not ifnil(_obj.XmlChildDocPr) then + {self.}DocPr.Copy(_obj.XmlChildDocPr); + if not ifnil(_obj.XmlChildCNvGraphicFramePr) then + {self.}CNvGraphicFramePr.Copy(_obj.XmlChildCNvGraphicFramePr); + if not ifnil(_obj.XmlChildGraphic) then + {self.}Graphic.Copy(_obj.XmlChildGraphic); + if not ifnil(_obj.XmlChildSizeRelH) then + {self.}SizeRelH.Copy(_obj.XmlChildSizeRelH); + if not ifnil(_obj.XmlChildSizeRelV) then + {self.}SizeRelV.Copy(_obj.XmlChildSizeRelV); + tslassigning := tslassigning_backup; end; function Anchor.ReadXmlAttrDistT(); @@ -255,6 +214,11 @@ end; function Anchor.WriteXmlAttrDistT(_value); begin + if ifnil({self.}XmlAttrDistT) then + begin + {self.}XmlAttrDistT := new OpenXmlAttribute("", "distT", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDistT; + end {self.}XmlAttrDistT.Value := _value; end; @@ -265,6 +229,11 @@ end; function Anchor.WriteXmlAttrDistB(_value); begin + if ifnil({self.}XmlAttrDistB) then + begin + {self.}XmlAttrDistB := new OpenXmlAttribute("", "distB", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDistB; + end {self.}XmlAttrDistB.Value := _value; end; @@ -275,6 +244,11 @@ end; function Anchor.WriteXmlAttrDistL(_value); begin + if ifnil({self.}XmlAttrDistL) then + begin + {self.}XmlAttrDistL := new OpenXmlAttribute("", "distL", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDistL; + end {self.}XmlAttrDistL.Value := _value; end; @@ -285,6 +259,11 @@ end; function Anchor.WriteXmlAttrDistR(_value); begin + if ifnil({self.}XmlAttrDistR) then + begin + {self.}XmlAttrDistR := new OpenXmlAttribute("", "distR", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDistR; + end {self.}XmlAttrDistR.Value := _value; end; @@ -295,6 +274,11 @@ end; function Anchor.WriteXmlAttrSimplePos(_value); begin + if ifnil({self.}XmlAttrSimplePos) then + begin + {self.}XmlAttrSimplePos := new OpenXmlAttribute("", "simplePos", nil); + attributes_[length(attributes_)] := {self.}XmlAttrSimplePos; + end {self.}XmlAttrSimplePos.Value := _value; end; @@ -305,6 +289,11 @@ end; function Anchor.WriteXmlAttrRelativeHeight(_value); begin + if ifnil({self.}XmlAttrRelativeHeight) then + begin + {self.}XmlAttrRelativeHeight := new OpenXmlAttribute("", "relativeHeight", nil); + attributes_[length(attributes_)] := {self.}XmlAttrRelativeHeight; + end {self.}XmlAttrRelativeHeight.Value := _value; end; @@ -315,6 +304,11 @@ end; function Anchor.WriteXmlAttrBehindDoc(_value); begin + if ifnil({self.}XmlAttrBehindDoc) then + begin + {self.}XmlAttrBehindDoc := new OpenXmlAttribute("", "behindDoc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrBehindDoc; + end {self.}XmlAttrBehindDoc.Value := _value; end; @@ -325,6 +319,11 @@ end; function Anchor.WriteXmlAttrLocked(_value); begin + if ifnil({self.}XmlAttrLocked) then + begin + {self.}XmlAttrLocked := new OpenXmlAttribute("", "locked", nil); + attributes_[length(attributes_)] := {self.}XmlAttrLocked; + end {self.}XmlAttrLocked.Value := _value; end; @@ -335,6 +334,11 @@ end; function Anchor.WriteXmlAttrLayoutInCell(_value); begin + if ifnil({self.}XmlAttrLayoutInCell) then + begin + {self.}XmlAttrLayoutInCell := new OpenXmlAttribute("", "layoutInCell", nil); + attributes_[length(attributes_)] := {self.}XmlAttrLayoutInCell; + end {self.}XmlAttrLayoutInCell.Value := _value; end; @@ -345,6 +349,11 @@ end; function Anchor.WriteXmlAttrAllowOverlap(_value); begin + if ifnil({self.}XmlAttrAllowOverlap) then + begin + {self.}XmlAttrAllowOverlap := new OpenXmlAttribute("", "allowOverlap", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAllowOverlap; + end {self.}XmlAttrAllowOverlap.Value := _value; end; @@ -355,6 +364,11 @@ end; function Anchor.WriteXmlAttrAnchorId(_value); begin + if ifnil({self.}XmlAttrAnchorId) then + begin + {self.}XmlAttrAnchorId := new OpenXmlAttribute("wp14", "anchorId", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAnchorId; + end {self.}XmlAttrAnchorId.Value := _value; end; @@ -365,15 +379,131 @@ end; function Anchor.WriteXmlAttrEditId(_value); begin + if ifnil({self.}XmlAttrEditId) then + begin + {self.}XmlAttrEditId := new OpenXmlAttribute("wp14", "editId", nil); + attributes_[length(attributes_)] := {self.}XmlAttrEditId; + end {self.}XmlAttrEditId.Value := _value; end; function Anchor.ReadXmlChildWrapNone(); begin - return ifnil({self.}XmlChildWrapNone.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildWrapNone) then + begin + {self.}XmlChildWrapNone := new OpenXmlEmpty(self, {self.}Prefix, "wrapNone"); + container_.Set({self.}XmlChildWrapNone); + return {self.}XmlChildWrapNone; + end + return {self.}XmlChildWrapNone.BoolValue(); end; function Anchor.WriteXmlChildWrapNone(_value); begin + if ifnil({self.}XmlChildWrapNone) then + begin + {self.}XmlChildWrapNone := new OpenXmlEmpty(self, {self.}Prefix, "wrapNone"); + container_.Set({self.}XmlChildWrapNone); + end {self.}XmlChildWrapNone.Value := _value; end; + +function Anchor.ReadXmlChildSimplePos(); +begin + if tslassigning and ifnil({self.}XmlChildSimplePos) then + begin + {self.}XmlChildSimplePos := new XY(self, {self.}Prefix, "simplePos"); + container_.Set({self.}XmlChildSimplePos); + end + return {self.}XmlChildSimplePos; +end; + +function Anchor.ReadXmlChildPositionH(); +begin + if tslassigning and ifnil({self.}XmlChildPositionH) then + begin + {self.}XmlChildPositionH := new PositionH(self, {self.}Prefix, "positionH"); + container_.Set({self.}XmlChildPositionH); + end + return {self.}XmlChildPositionH; +end; + +function Anchor.ReadXmlChildPositionV(); +begin + if tslassigning and ifnil({self.}XmlChildPositionV) then + begin + {self.}XmlChildPositionV := new PositionV(self, {self.}Prefix, "positionV"); + container_.Set({self.}XmlChildPositionV); + end + return {self.}XmlChildPositionV; +end; + +function Anchor.ReadXmlChildExtent(); +begin + if tslassigning and ifnil({self.}XmlChildExtent) then + begin + {self.}XmlChildExtent := new CXY(self, {self.}Prefix, "extent"); + container_.Set({self.}XmlChildExtent); + end + return {self.}XmlChildExtent; +end; + +function Anchor.ReadXmlChildEffectExtent(); +begin + if tslassigning and ifnil({self.}XmlChildEffectExtent) then + begin + {self.}XmlChildEffectExtent := new EffectExtent(self, {self.}Prefix, "effectExtent"); + container_.Set({self.}XmlChildEffectExtent); + end + return {self.}XmlChildEffectExtent; +end; + +function Anchor.ReadXmlChildDocPr(); +begin + if tslassigning and ifnil({self.}XmlChildDocPr) then + begin + {self.}XmlChildDocPr := new DocPr(self, {self.}Prefix, "docPr"); + container_.Set({self.}XmlChildDocPr); + end + return {self.}XmlChildDocPr; +end; + +function Anchor.ReadXmlChildCNvGraphicFramePr(); +begin + if tslassigning and ifnil({self.}XmlChildCNvGraphicFramePr) then + begin + {self.}XmlChildCNvGraphicFramePr := new CNvGraphicFramePr(self, {self.}Prefix, "cNvGraphicFramePr"); + container_.Set({self.}XmlChildCNvGraphicFramePr); + end + return {self.}XmlChildCNvGraphicFramePr; +end; + +function Anchor.ReadXmlChildGraphic(); +begin + if tslassigning and ifnil({self.}XmlChildGraphic) then + begin + {self.}XmlChildGraphic := new Graphic(self, "a", "graphic"); + container_.Set({self.}XmlChildGraphic); + end + return {self.}XmlChildGraphic; +end; + +function Anchor.ReadXmlChildSizeRelH(); +begin + if tslassigning and ifnil({self.}XmlChildSizeRelH) then + begin + {self.}XmlChildSizeRelH := new SizeRelH(self, "wp14", "sizeRelH"); + container_.Set({self.}XmlChildSizeRelH); + end + return {self.}XmlChildSizeRelH; +end; + +function Anchor.ReadXmlChildSizeRelV(); +begin + if tslassigning and ifnil({self.}XmlChildSizeRelV) then + begin + {self.}XmlChildSizeRelV := new SizeRelV(self, "wp14", "sizeRelV"); + container_.Set({self.}XmlChildSizeRelV); + end + return {self.}XmlChildSizeRelV; +end; diff --git a/autoclass/docx/Ap@DOCX.tsf b/autoclass/docx/Ap@DOCX.tsf index c395fe5..91a69ca 100644 --- a/autoclass/docx/Ap@DOCX.tsf +++ b/autoclass/docx/Ap@DOCX.tsf @@ -4,22 +4,26 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Ap);override; + +public + + // normal property + property PPr read ReadXmlChildPPr; + property EndParaRPr read ReadXmlChildEndParaRPr; + function ReadXmlChildPPr(); + function ReadXmlChildEndParaRPr(); + + // multi property + property Rs read ReadRs; + function ReadRs(_index); function AddR(): AR; function AppendR(): AR; - property Rs read ReadRs; - function ReadRs(_index); - public - // Attributes - // Children - PPr: APPr; - EndParaRPr: ARPr; + XmlChildPPr: APPr; + XmlChildEndParaRPr: ARPr; end; @@ -35,111 +39,73 @@ end; function Ap.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Ap.Init();override; begin - {self.}PPr := new APPr(self, {self.}Prefix, "pPr"); - {self.}EndParaRPr := new ARPr(self, {self.}Prefix, "endParaRPr"); -end; - -function Ap.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Ap.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}PPr, - 1: {self.}EndParaRPr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}PPr.ElementName: 0, - {self.}EndParaRPr.ElementName: 1, + pre + "pPr": array(0, makeweakref(thisFunction(ReadXmlChildPPr))), + pre + "endParaRPr": array(1, makeweakref(thisFunction(ReadXmlChildEndParaRPr))), + pre + "r": array(2, makeweakref(thisFunction(AppendR))), ); -end; - -function Ap.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "r": obj := {self.}AppendR(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Ap.Copy(_obj: Ap);override; begin - {self.}PPr.Copy(_obj.PPr); - {self.}EndParaRPr.Copy(_obj.EndParaRPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildPPr) then + {self.}PPr.Copy(_obj.XmlChildPPr); + if not ifnil(_obj.XmlChildEndParaRPr) then + {self.}EndParaRPr.Copy(_obj.XmlChildEndParaRPr); + tslassigning := tslassigning_backup; +end; + +function Ap.ReadXmlChildPPr(); +begin + if tslassigning and ifnil({self.}XmlChildPPr) then + begin + {self.}XmlChildPPr := new APPr(self, {self.}Prefix, "pPr"); + container_.Set({self.}XmlChildPPr); + end + return {self.}XmlChildPPr; +end; + +function Ap.ReadXmlChildEndParaRPr(); +begin + if tslassigning and ifnil({self.}XmlChildEndParaRPr) then + begin + {self.}XmlChildEndParaRPr := new ARPr(self, {self.}Prefix, "endParaRPr"); + container_.Set({self.}XmlChildEndParaRPr); + end + return {self.}XmlChildEndParaRPr; +end; + +function Ap.ReadRs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "r", ind); end; function Ap.AddR(): AR; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "r" then break; - end obj := new AR(self, {self.}Prefix, "r"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function Ap.AppendR(): AR; begin obj := new AR(self, {self.}Prefix, "r"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function Ap.ReadRs(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "r" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; diff --git a/autoclass/docx/Ax@DOCX.tsf b/autoclass/docx/Ax@DOCX.tsf index e55b04b..a508d07 100644 --- a/autoclass/docx/Ax@DOCX.tsf +++ b/autoclass/docx/Ax@DOCX.tsf @@ -4,32 +4,65 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Ax);override; public - // Attributes + // normal property + property AxId read ReadXmlChildAxId; + property Scaling read ReadXmlChildScaling; + property _Delete read ReadXmlChild_Delete; + property AxPos read ReadXmlChildAxPos; + property NumFmt read ReadXmlChildNumFmt; + property MajorTickMark read ReadXmlChildMajorTickMark; + property MinorTickMark read ReadXmlChildMinorTickMark; + property TickLblPos read ReadXmlChildTickLblPos; + property SpPr read ReadXmlChildSpPr; + property TxPr read ReadXmlChildTxPr; + property CrossAx read ReadXmlChildCrossAx; + property Crosses read ReadXmlChildCrosses; + property CrossBetween read ReadXmlChildCrossBetween; + property Auto read ReadXmlChildAuto; + property LblAlgn read ReadXmlChildLblAlgn; + property LblOffset read ReadXmlChildLblOffset; + property NoMultiLvlLbl read ReadXmlChildNoMultiLvlLbl; + function ReadXmlChildAxId(); + function ReadXmlChildScaling(); + function ReadXmlChild_Delete(); + function ReadXmlChildAxPos(); + function ReadXmlChildNumFmt(); + function ReadXmlChildMajorTickMark(); + function ReadXmlChildMinorTickMark(); + function ReadXmlChildTickLblPos(); + function ReadXmlChildSpPr(); + function ReadXmlChildTxPr(); + function ReadXmlChildCrossAx(); + function ReadXmlChildCrosses(); + function ReadXmlChildCrossBetween(); + function ReadXmlChildAuto(); + function ReadXmlChildLblAlgn(); + function ReadXmlChildLblOffset(); + function ReadXmlChildNoMultiLvlLbl(); + +public // Children - AxId: PureVal; - Scaling: Scaling; - _Delete: PureVal; - AxPos: PureVal; - NumFmt: NumFmt; - MajorTickMark: PureVal; - MinorTickMark: PureVal; - TickLblPos: PureVal; - SpPr: SpPr; - TxPr: TxPr; - CrossAx: PureVal; - Crosses: PureVal; - CrossBetween: PureVal; - Auto: PureVal; - LblAlgn: PureVal; - LblOffset: PureVal; - NoMultiLvlLbl: PureVal; + XmlChildAxId: PureVal; + XmlChildScaling: Scaling; + XmlChild_Delete: PureVal; + XmlChildAxPos: PureVal; + XmlChildNumFmt: NumFmt; + XmlChildMajorTickMark: PureVal; + XmlChildMinorTickMark: PureVal; + XmlChildTickLblPos: PureVal; + XmlChildSpPr: SpPr; + XmlChildTxPr: TxPr; + XmlChildCrossAx: PureVal; + XmlChildCrosses: PureVal; + XmlChildCrossBetween: PureVal; + XmlChildAuto: PureVal; + XmlChildLblAlgn: PureVal; + XmlChildLblOffset: PureVal; + XmlChildNoMultiLvlLbl: PureVal; end; @@ -45,134 +78,246 @@ end; function Ax.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Ax.Init();override; begin - {self.}AxId := new PureVal(self, {self.}Prefix, "axId"); - {self.}Scaling := new Scaling(self, {self.}Prefix, "scaling"); - {self.}_Delete := new PureVal(self, {self.}Prefix, "delete"); - {self.}AxPos := new PureVal(self, {self.}Prefix, "axPos"); - {self.}NumFmt := new NumFmt(self, {self.}Prefix, "numFmt"); - {self.}MajorTickMark := new PureVal(self, {self.}Prefix, "majorTickMark"); - {self.}MinorTickMark := new PureVal(self, {self.}Prefix, "minorTickMark"); - {self.}TickLblPos := new PureVal(self, {self.}Prefix, "tickLblPos"); - {self.}SpPr := new SpPr(self, {self.}Prefix, "spPr"); - {self.}TxPr := new TxPr(self, {self.}Prefix, "txPr"); - {self.}CrossAx := new PureVal(self, {self.}Prefix, "crossAx"); - {self.}Crosses := new PureVal(self, {self.}Prefix, "crosses"); - {self.}CrossBetween := new PureVal(self, {self.}Prefix, "crossBetween"); - {self.}Auto := new PureVal(self, {self.}Prefix, "auto"); - {self.}LblAlgn := new PureVal(self, {self.}Prefix, "lblAlgn"); - {self.}LblOffset := new PureVal(self, {self.}Prefix, "lblOffset"); - {self.}NoMultiLvlLbl := new PureVal(self, {self.}Prefix, "noMultiLvlLbl"); -end; - -function Ax.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Ax.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}AxId, - 1: {self.}Scaling, - 2: {self.}_Delete, - 3: {self.}AxPos, - 4: {self.}NumFmt, - 5: {self.}MajorTickMark, - 6: {self.}MinorTickMark, - 7: {self.}TickLblPos, - 8: {self.}SpPr, - 9: {self.}TxPr, - 10: {self.}CrossAx, - 11: {self.}Crosses, - 12: {self.}CrossBetween, - 13: {self.}Auto, - 14: {self.}LblAlgn, - 15: {self.}LblOffset, - 16: {self.}NoMultiLvlLbl, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}AxId.ElementName: 0, - {self.}Scaling.ElementName: 1, - {self.}_Delete.ElementName: 2, - {self.}AxPos.ElementName: 3, - {self.}NumFmt.ElementName: 4, - {self.}MajorTickMark.ElementName: 5, - {self.}MinorTickMark.ElementName: 6, - {self.}TickLblPos.ElementName: 7, - {self.}SpPr.ElementName: 8, - {self.}TxPr.ElementName: 9, - {self.}CrossAx.ElementName: 10, - {self.}Crosses.ElementName: 11, - {self.}CrossBetween.ElementName: 12, - {self.}Auto.ElementName: 13, - {self.}LblAlgn.ElementName: 14, - {self.}LblOffset.ElementName: 15, - {self.}NoMultiLvlLbl.ElementName: 16, + pre + "axId": array(0, makeweakref(thisFunction(ReadXmlChildAxId))), + pre + "scaling": array(1, makeweakref(thisFunction(ReadXmlChildScaling))), + pre + "delete": array(2, makeweakref(thisFunction(ReadXmlChild_Delete))), + pre + "axPos": array(3, makeweakref(thisFunction(ReadXmlChildAxPos))), + pre + "numFmt": array(4, makeweakref(thisFunction(ReadXmlChildNumFmt))), + pre + "majorTickMark": array(5, makeweakref(thisFunction(ReadXmlChildMajorTickMark))), + pre + "minorTickMark": array(6, makeweakref(thisFunction(ReadXmlChildMinorTickMark))), + pre + "tickLblPos": array(7, makeweakref(thisFunction(ReadXmlChildTickLblPos))), + pre + "spPr": array(8, makeweakref(thisFunction(ReadXmlChildSpPr))), + pre + "txPr": array(9, makeweakref(thisFunction(ReadXmlChildTxPr))), + pre + "crossAx": array(10, makeweakref(thisFunction(ReadXmlChildCrossAx))), + pre + "crosses": array(11, makeweakref(thisFunction(ReadXmlChildCrosses))), + pre + "crossBetween": array(12, makeweakref(thisFunction(ReadXmlChildCrossBetween))), + pre + "auto": array(13, makeweakref(thisFunction(ReadXmlChildAuto))), + pre + "lblAlgn": array(14, makeweakref(thisFunction(ReadXmlChildLblAlgn))), + pre + "lblOffset": array(15, makeweakref(thisFunction(ReadXmlChildLblOffset))), + pre + "noMultiLvlLbl": array(16, makeweakref(thisFunction(ReadXmlChildNoMultiLvlLbl))), ); -end; - -function Ax.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Ax.Copy(_obj: Ax);override; begin - {self.}AxId.Copy(_obj.AxId); - {self.}Scaling.Copy(_obj.Scaling); - {self.}_Delete.Copy(_obj._Delete); - {self.}AxPos.Copy(_obj.AxPos); - {self.}NumFmt.Copy(_obj.NumFmt); - {self.}MajorTickMark.Copy(_obj.MajorTickMark); - {self.}MinorTickMark.Copy(_obj.MinorTickMark); - {self.}TickLblPos.Copy(_obj.TickLblPos); - {self.}SpPr.Copy(_obj.SpPr); - {self.}TxPr.Copy(_obj.TxPr); - {self.}CrossAx.Copy(_obj.CrossAx); - {self.}Crosses.Copy(_obj.Crosses); - {self.}CrossBetween.Copy(_obj.CrossBetween); - {self.}Auto.Copy(_obj.Auto); - {self.}LblAlgn.Copy(_obj.LblAlgn); - {self.}LblOffset.Copy(_obj.LblOffset); - {self.}NoMultiLvlLbl.Copy(_obj.NoMultiLvlLbl); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildAxId) then + {self.}AxId.Copy(_obj.XmlChildAxId); + if not ifnil(_obj.XmlChildScaling) then + {self.}Scaling.Copy(_obj.XmlChildScaling); + if not ifnil(_obj.XmlChild_Delete) then + {self.}_Delete.Copy(_obj.XmlChild_Delete); + if not ifnil(_obj.XmlChildAxPos) then + {self.}AxPos.Copy(_obj.XmlChildAxPos); + if not ifnil(_obj.XmlChildNumFmt) then + {self.}NumFmt.Copy(_obj.XmlChildNumFmt); + if not ifnil(_obj.XmlChildMajorTickMark) then + {self.}MajorTickMark.Copy(_obj.XmlChildMajorTickMark); + if not ifnil(_obj.XmlChildMinorTickMark) then + {self.}MinorTickMark.Copy(_obj.XmlChildMinorTickMark); + if not ifnil(_obj.XmlChildTickLblPos) then + {self.}TickLblPos.Copy(_obj.XmlChildTickLblPos); + if not ifnil(_obj.XmlChildSpPr) then + {self.}SpPr.Copy(_obj.XmlChildSpPr); + if not ifnil(_obj.XmlChildTxPr) then + {self.}TxPr.Copy(_obj.XmlChildTxPr); + if not ifnil(_obj.XmlChildCrossAx) then + {self.}CrossAx.Copy(_obj.XmlChildCrossAx); + if not ifnil(_obj.XmlChildCrosses) then + {self.}Crosses.Copy(_obj.XmlChildCrosses); + if not ifnil(_obj.XmlChildCrossBetween) then + {self.}CrossBetween.Copy(_obj.XmlChildCrossBetween); + if not ifnil(_obj.XmlChildAuto) then + {self.}Auto.Copy(_obj.XmlChildAuto); + if not ifnil(_obj.XmlChildLblAlgn) then + {self.}LblAlgn.Copy(_obj.XmlChildLblAlgn); + if not ifnil(_obj.XmlChildLblOffset) then + {self.}LblOffset.Copy(_obj.XmlChildLblOffset); + if not ifnil(_obj.XmlChildNoMultiLvlLbl) then + {self.}NoMultiLvlLbl.Copy(_obj.XmlChildNoMultiLvlLbl); + tslassigning := tslassigning_backup; +end; + +function Ax.ReadXmlChildAxId(); +begin + if tslassigning and ifnil({self.}XmlChildAxId) then + begin + {self.}XmlChildAxId := new PureVal(self, {self.}Prefix, "axId"); + container_.Set({self.}XmlChildAxId); + end + return {self.}XmlChildAxId; +end; + +function Ax.ReadXmlChildScaling(); +begin + if tslassigning and ifnil({self.}XmlChildScaling) then + begin + {self.}XmlChildScaling := new Scaling(self, {self.}Prefix, "scaling"); + container_.Set({self.}XmlChildScaling); + end + return {self.}XmlChildScaling; +end; + +function Ax.ReadXmlChild_Delete(); +begin + if tslassigning and ifnil({self.}XmlChild_Delete) then + begin + {self.}XmlChild_Delete := new PureVal(self, {self.}Prefix, "delete"); + container_.Set({self.}XmlChild_Delete); + end + return {self.}XmlChild_Delete; +end; + +function Ax.ReadXmlChildAxPos(); +begin + if tslassigning and ifnil({self.}XmlChildAxPos) then + begin + {self.}XmlChildAxPos := new PureVal(self, {self.}Prefix, "axPos"); + container_.Set({self.}XmlChildAxPos); + end + return {self.}XmlChildAxPos; +end; + +function Ax.ReadXmlChildNumFmt(); +begin + if tslassigning and ifnil({self.}XmlChildNumFmt) then + begin + {self.}XmlChildNumFmt := new NumFmt(self, {self.}Prefix, "numFmt"); + container_.Set({self.}XmlChildNumFmt); + end + return {self.}XmlChildNumFmt; +end; + +function Ax.ReadXmlChildMajorTickMark(); +begin + if tslassigning and ifnil({self.}XmlChildMajorTickMark) then + begin + {self.}XmlChildMajorTickMark := new PureVal(self, {self.}Prefix, "majorTickMark"); + container_.Set({self.}XmlChildMajorTickMark); + end + return {self.}XmlChildMajorTickMark; +end; + +function Ax.ReadXmlChildMinorTickMark(); +begin + if tslassigning and ifnil({self.}XmlChildMinorTickMark) then + begin + {self.}XmlChildMinorTickMark := new PureVal(self, {self.}Prefix, "minorTickMark"); + container_.Set({self.}XmlChildMinorTickMark); + end + return {self.}XmlChildMinorTickMark; +end; + +function Ax.ReadXmlChildTickLblPos(); +begin + if tslassigning and ifnil({self.}XmlChildTickLblPos) then + begin + {self.}XmlChildTickLblPos := new PureVal(self, {self.}Prefix, "tickLblPos"); + container_.Set({self.}XmlChildTickLblPos); + end + return {self.}XmlChildTickLblPos; +end; + +function Ax.ReadXmlChildSpPr(); +begin + if tslassigning and ifnil({self.}XmlChildSpPr) then + begin + {self.}XmlChildSpPr := new SpPr(self, {self.}Prefix, "spPr"); + container_.Set({self.}XmlChildSpPr); + end + return {self.}XmlChildSpPr; +end; + +function Ax.ReadXmlChildTxPr(); +begin + if tslassigning and ifnil({self.}XmlChildTxPr) then + begin + {self.}XmlChildTxPr := new TxPr(self, {self.}Prefix, "txPr"); + container_.Set({self.}XmlChildTxPr); + end + return {self.}XmlChildTxPr; +end; + +function Ax.ReadXmlChildCrossAx(); +begin + if tslassigning and ifnil({self.}XmlChildCrossAx) then + begin + {self.}XmlChildCrossAx := new PureVal(self, {self.}Prefix, "crossAx"); + container_.Set({self.}XmlChildCrossAx); + end + return {self.}XmlChildCrossAx; +end; + +function Ax.ReadXmlChildCrosses(); +begin + if tslassigning and ifnil({self.}XmlChildCrosses) then + begin + {self.}XmlChildCrosses := new PureVal(self, {self.}Prefix, "crosses"); + container_.Set({self.}XmlChildCrosses); + end + return {self.}XmlChildCrosses; +end; + +function Ax.ReadXmlChildCrossBetween(); +begin + if tslassigning and ifnil({self.}XmlChildCrossBetween) then + begin + {self.}XmlChildCrossBetween := new PureVal(self, {self.}Prefix, "crossBetween"); + container_.Set({self.}XmlChildCrossBetween); + end + return {self.}XmlChildCrossBetween; +end; + +function Ax.ReadXmlChildAuto(); +begin + if tslassigning and ifnil({self.}XmlChildAuto) then + begin + {self.}XmlChildAuto := new PureVal(self, {self.}Prefix, "auto"); + container_.Set({self.}XmlChildAuto); + end + return {self.}XmlChildAuto; +end; + +function Ax.ReadXmlChildLblAlgn(); +begin + if tslassigning and ifnil({self.}XmlChildLblAlgn) then + begin + {self.}XmlChildLblAlgn := new PureVal(self, {self.}Prefix, "lblAlgn"); + container_.Set({self.}XmlChildLblAlgn); + end + return {self.}XmlChildLblAlgn; +end; + +function Ax.ReadXmlChildLblOffset(); +begin + if tslassigning and ifnil({self.}XmlChildLblOffset) then + begin + {self.}XmlChildLblOffset := new PureVal(self, {self.}Prefix, "lblOffset"); + container_.Set({self.}XmlChildLblOffset); + end + return {self.}XmlChildLblOffset; +end; + +function Ax.ReadXmlChildNoMultiLvlLbl(); +begin + if tslassigning and ifnil({self.}XmlChildNoMultiLvlLbl) then + begin + {self.}XmlChildNoMultiLvlLbl := new PureVal(self, {self.}Prefix, "noMultiLvlLbl"); + container_.Set({self.}XmlChildNoMultiLvlLbl); + end + return {self.}XmlChildNoMultiLvlLbl; end; diff --git a/autoclass/docx/BarChart@DOCX.tsf b/autoclass/docx/BarChart@DOCX.tsf index e11640a..2874fa2 100644 --- a/autoclass/docx/BarChart@DOCX.tsf +++ b/autoclass/docx/BarChart@DOCX.tsf @@ -4,28 +4,36 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: BarChart);override; + +public + + // normal property + property BarDir read ReadXmlChildBarDir; + property Grouping read ReadXmlChildGrouping; + property VaryColors read ReadXmlChildVaryColors; + property GapWidth read ReadXmlChildGapWidth; + function ReadXmlChildBarDir(); + function ReadXmlChildGrouping(); + function ReadXmlChildVaryColors(); + function ReadXmlChildGapWidth(); + + // multi property + property Sers read ReadSers; + property AxIds read ReadAxIds; + function ReadSers(_index); + function ReadAxIds(_index); function AddSer(): Ser; function AddAxId(): PureVal; function AppendSer(): Ser; function AppendAxId(): PureVal; - property Sers read ReadSers; - property AxIds read ReadAxIds; - function ReadSers(_index); - function ReadAxIds(_index); - public - // Attributes - // Children - BarDir: PureVal; - Grouping: PureVal; - VaryColors: PureVal; - GapWidth: PureVal; + XmlChildBarDir: PureVal; + XmlChildGrouping: PureVal; + XmlChildVaryColors: PureVal; + XmlChildGapWidth: PureVal; end; @@ -41,156 +49,121 @@ end; function BarChart.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function BarChart.Init();override; begin - {self.}BarDir := new PureVal(self, {self.}Prefix, "barDir"); - {self.}Grouping := new PureVal(self, {self.}Prefix, "grouping"); - {self.}VaryColors := new PureVal(self, {self.}Prefix, "varyColors"); - {self.}GapWidth := new PureVal(self, {self.}Prefix, "gapWidth"); -end; - -function BarChart.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function BarChart.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}BarDir, - 1: {self.}Grouping, - 2: {self.}VaryColors, - 4: {self.}GapWidth, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}BarDir.ElementName: 0, - {self.}Grouping.ElementName: 1, - {self.}VaryColors.ElementName: 2, - {self.}GapWidth.ElementName: 4, + pre + "barDir": array(0, makeweakref(thisFunction(ReadXmlChildBarDir))), + pre + "grouping": array(1, makeweakref(thisFunction(ReadXmlChildGrouping))), + pre + "varyColors": array(2, makeweakref(thisFunction(ReadXmlChildVaryColors))), + pre + "ser": array(3, makeweakref(thisFunction(AppendSer))), + pre + "gapWidth": array(4, makeweakref(thisFunction(ReadXmlChildGapWidth))), + pre + "axId": array(5, makeweakref(thisFunction(AppendAxId))), ); -end; - -function BarChart.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "ser": obj := {self.}AppendSer(); - pre + "axId": obj := {self.}AppendAxId(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function BarChart.Copy(_obj: BarChart);override; begin - {self.}BarDir.Copy(_obj.BarDir); - {self.}Grouping.Copy(_obj.Grouping); - {self.}VaryColors.Copy(_obj.VaryColors); - {self.}GapWidth.Copy(_obj.GapWidth); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildBarDir) then + {self.}BarDir.Copy(_obj.XmlChildBarDir); + if not ifnil(_obj.XmlChildGrouping) then + {self.}Grouping.Copy(_obj.XmlChildGrouping); + if not ifnil(_obj.XmlChildVaryColors) then + {self.}VaryColors.Copy(_obj.XmlChildVaryColors); + if not ifnil(_obj.XmlChildGapWidth) then + {self.}GapWidth.Copy(_obj.XmlChildGapWidth); + tslassigning := tslassigning_backup; +end; + +function BarChart.ReadXmlChildBarDir(); +begin + if tslassigning and ifnil({self.}XmlChildBarDir) then + begin + {self.}XmlChildBarDir := new PureVal(self, {self.}Prefix, "barDir"); + container_.Set({self.}XmlChildBarDir); + end + return {self.}XmlChildBarDir; +end; + +function BarChart.ReadXmlChildGrouping(); +begin + if tslassigning and ifnil({self.}XmlChildGrouping) then + begin + {self.}XmlChildGrouping := new PureVal(self, {self.}Prefix, "grouping"); + container_.Set({self.}XmlChildGrouping); + end + return {self.}XmlChildGrouping; +end; + +function BarChart.ReadXmlChildVaryColors(); +begin + if tslassigning and ifnil({self.}XmlChildVaryColors) then + begin + {self.}XmlChildVaryColors := new PureVal(self, {self.}Prefix, "varyColors"); + container_.Set({self.}XmlChildVaryColors); + end + return {self.}XmlChildVaryColors; +end; + +function BarChart.ReadXmlChildGapWidth(); +begin + if tslassigning and ifnil({self.}XmlChildGapWidth) then + begin + {self.}XmlChildGapWidth := new PureVal(self, {self.}Prefix, "gapWidth"); + container_.Set({self.}XmlChildGapWidth); + end + return {self.}XmlChildGapWidth; +end; + +function BarChart.ReadSers(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "ser", ind); +end; + +function BarChart.ReadAxIds(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "axId", ind); end; function BarChart.AddSer(): Ser; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "ser" then break; - end obj := new Ser(self, {self.}Prefix, "ser"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function BarChart.AddAxId(): PureVal; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "axId" then break; - end obj := new PureVal(self, {self.}Prefix, "axId"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function BarChart.AppendSer(): Ser; begin obj := new Ser(self, {self.}Prefix, "ser"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; function BarChart.AppendAxId(): PureVal; begin obj := new PureVal(self, {self.}Prefix, "axId"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function BarChart.ReadSers(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "ser" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; - -function BarChart.ReadAxIds(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "axId" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; diff --git a/autoclass/docx/Blip@DOCX.tsf b/autoclass/docx/Blip@DOCX.tsf index e536982..d45c646 100644 --- a/autoclass/docx/Blip@DOCX.tsf +++ b/autoclass/docx/Blip@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Blip);override; +public + + // attributes property property Embed read ReadXmlAttrEmbed write WriteXmlAttrEmbed; property Cstate read ReadXmlAttrCstate write WriteXmlAttrCstate; function ReadXmlAttrEmbed(); @@ -17,11 +17,10 @@ public function WriteXmlAttrCstate(_value); public - // Attributes + // Attributes XmlAttrEmbed: OpenXmlAttribute; XmlAttrCstate: OpenXmlAttribute; - // Children end; @@ -37,45 +36,33 @@ end; function Blip.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Blip.Init();override; begin - {self.}XmlAttrEmbed := new OpenXmlAttribute("r", "embed", nil); - {self.}XmlAttrCstate := new OpenXmlAttribute(nil, "cstate", nil); -end; - -function Blip.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrEmbed, - {self.}XmlAttrCstate, - ); -end; - -function Blip.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "r:embed": makeweakref(thisFunction(WriteXmlAttrEmbed)), + "cstate": makeweakref(thisFunction(WriteXmlAttrCstate)), ); sorted_child_ := array( - "": -1, ); -end; - -function Blip.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Blip.Copy(_obj: Blip);override; begin - if not ifnil(_obj.XmlAttrEmbed.Value) then - {self.}XmlAttrEmbed.Value := _obj.XmlAttrEmbed.Value; - if not ifnil(_obj.XmlAttrCstate.Value) then - {self.}XmlAttrCstate.Value := _obj.XmlAttrCstate.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Embed) then + {self.}Embed := _obj.Embed; + if not ifnil(_obj.Cstate) then + {self.}Cstate := _obj.Cstate; + tslassigning := tslassigning_backup; end; function Blip.ReadXmlAttrEmbed(); @@ -85,6 +72,11 @@ end; function Blip.WriteXmlAttrEmbed(_value); begin + if ifnil({self.}XmlAttrEmbed) then + begin + {self.}XmlAttrEmbed := new OpenXmlAttribute("r", "embed", nil); + attributes_[length(attributes_)] := {self.}XmlAttrEmbed; + end {self.}XmlAttrEmbed.Value := _value; end; @@ -95,5 +87,10 @@ end; function Blip.WriteXmlAttrCstate(_value); begin + if ifnil({self.}XmlAttrCstate) then + begin + {self.}XmlAttrCstate := new OpenXmlAttribute("", "cstate", nil); + attributes_[length(attributes_)] := {self.}XmlAttrCstate; + end {self.}XmlAttrCstate.Value := _value; end; diff --git a/autoclass/docx/BlipFill@DOCX.tsf b/autoclass/docx/BlipFill@DOCX.tsf index 30ed16c..8fa03a9 100644 --- a/autoclass/docx/BlipFill@DOCX.tsf +++ b/autoclass/docx/BlipFill@DOCX.tsf @@ -4,17 +4,20 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: BlipFill);override; public - // Attributes + // normal property + property Blip read ReadXmlChildBlip; + property Stretch read ReadXmlChildStretch; + function ReadXmlChildBlip(); + function ReadXmlChildStretch(); + +public // Children - Blip: Blip; - Stretch: Stretch; + XmlChildBlip: Blip; + XmlChildStretch: Stretch; end; @@ -30,74 +33,51 @@ end; function BlipFill.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function BlipFill.Init();override; begin - {self.}Blip := new Blip(self, "a", "blip"); - {self.}Stretch := new Stretch(self, "a", "stretch"); -end; - -function BlipFill.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function BlipFill.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Blip, - 1: {self.}Stretch, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}Blip.ElementName: 0, - {self.}Stretch.ElementName: 1, + "a:blip": array(0, makeweakref(thisFunction(ReadXmlChildBlip))), + "a:stretch": array(1, makeweakref(thisFunction(ReadXmlChildStretch))), ); -end; - -function BlipFill.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function BlipFill.Copy(_obj: BlipFill);override; begin - {self.}Blip.Copy(_obj.Blip); - {self.}Stretch.Copy(_obj.Stretch); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildBlip) then + {self.}Blip.Copy(_obj.XmlChildBlip); + if not ifnil(_obj.XmlChildStretch) then + {self.}Stretch.Copy(_obj.XmlChildStretch); + tslassigning := tslassigning_backup; +end; + +function BlipFill.ReadXmlChildBlip(); +begin + if tslassigning and ifnil({self.}XmlChildBlip) then + begin + {self.}XmlChildBlip := new Blip(self, "a", "blip"); + container_.Set({self.}XmlChildBlip); + end + return {self.}XmlChildBlip; +end; + +function BlipFill.ReadXmlChildStretch(); +begin + if tslassigning and ifnil({self.}XmlChildStretch) then + begin + {self.}XmlChildStretch := new Stretch(self, "a", "stretch"); + container_.Set({self.}XmlChildStretch); + end + return {self.}XmlChildStretch; end; diff --git a/autoclass/docx/Body@DOCX.tsf b/autoclass/docx/Body@DOCX.tsf index b37997c..928e2d4 100644 --- a/autoclass/docx/Body@DOCX.tsf +++ b/autoclass/docx/Body@DOCX.tsf @@ -4,10 +4,21 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Body);override; + +public + + // normal property + property SectPr read ReadXmlChildSectPr; + function ReadXmlChildSectPr(); + + // multi property + property Ps read ReadPs; + property Tbls read ReadTbls; + property Sdts read ReadSdts; + function ReadPs(_index); + function ReadTbls(_index); + function ReadSdts(_index); function AddP(): P; function AddTbl(): Tbl; function AddSdt(): Sdt; @@ -15,18 +26,9 @@ public function AppendTbl(): Tbl; function AppendSdt(): Sdt; - property Ps read ReadPs; - property Tbls read ReadTbls; - property Sdts read ReadSdts; - function ReadPs(_index); - function ReadTbls(_index); - function ReadSdts(_index); - public - // Attributes - // Children - SectPr: SectPr; + XmlChildSectPr: SectPr; end; @@ -42,181 +44,104 @@ end; function Body.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Body.Init();override; begin - {self.}SectPr := new SectPr(self, {self.}Prefix, "sectPr"); -end; - -function Body.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Body.InitChildren();override; -begin - child_elements_ := array( - 3: {self.}SectPr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}SectPr.ElementName: 3, + pre + "p": array(0, makeweakref(thisFunction(AppendP))), + pre + "tbl": array(1, makeweakref(thisFunction(AppendTbl))), + pre + "sdt": array(2, makeweakref(thisFunction(AppendSdt))), + pre + "sectPr": array(-1, makeweakref(thisFunction(ReadXmlChildSectPr))), ); -end; - -function Body.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "p": obj := {self.}AppendP(); - pre + "tbl": obj := {self.}AppendTbl(); - pre + "sdt": obj := {self.}AppendSdt(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Body.Copy(_obj: Body);override; begin - {self.}SectPr.Copy(_obj.SectPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildSectPr) then + {self.}SectPr.Copy(_obj.XmlChildSectPr); + tslassigning := tslassigning_backup; +end; + +function Body.ReadXmlChildSectPr(); +begin + if tslassigning and ifnil({self.}XmlChildSectPr) then + begin + {self.}XmlChildSectPr := new SectPr(self, {self.}Prefix, "sectPr"); + container_.Append({self.}XmlChildSectPr); + end + return {self.}XmlChildSectPr; +end; + +function Body.ReadPs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "p", ind); +end; + +function Body.ReadTbls(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "tbl", ind); +end; + +function Body.ReadSdts(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "sdt", ind); end; function Body.AddP(): P; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "p" then break; - end obj := new P(self, {self.}Prefix, "p"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function Body.AddTbl(): Tbl; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "tbl" then break; - end obj := new Tbl(self, {self.}Prefix, "tbl"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function Body.AddSdt(): Sdt; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "sdt" then break; - end obj := new Sdt(self, {self.}Prefix, "sdt"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function Body.AppendP(): P; begin obj := new P(self, {self.}Prefix, "p"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; function Body.AppendTbl(): Tbl; begin obj := new Tbl(self, {self.}Prefix, "tbl"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; function Body.AppendSdt(): Sdt; begin obj := new Sdt(self, {self.}Prefix, "sdt"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function Body.ReadPs(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "p" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; - -function Body.ReadTbls(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "tbl" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; - -function Body.ReadSdts(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "sdt" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; diff --git a/autoclass/docx/BodyPr@DOCX.tsf b/autoclass/docx/BodyPr@DOCX.tsf index 224bb63..460f6ae 100644 --- a/autoclass/docx/BodyPr@DOCX.tsf +++ b/autoclass/docx/BodyPr@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: BodyPr);override; +public + + // attributes property property Rot read ReadXmlAttrRot write WriteXmlAttrRot; property SpcFirstLastPara read ReadXmlAttrSpcFirstLastPara write WriteXmlAttrSpcFirstLastPara; property VertOverflow read ReadXmlAttrVertOverflow write WriteXmlAttrVertOverflow; @@ -64,12 +64,17 @@ public function ReadXmlAttrCompatLnSpc(); function WriteXmlAttrCompatLnSpc(_value); + // empty property property NoAutofit read ReadXmlChildNoAutofit write WriteXmlChildNoAutofit; function ReadXmlChildNoAutofit(); function WriteXmlChildNoAutofit(_value); + // normal property + property PrstTxWrap read ReadXmlChildPrstTxWrap; + function ReadXmlChildPrstTxWrap(); + public - // Attributes + // Attributes XmlAttrRot: OpenXmlAttribute; XmlAttrSpcFirstLastPara: OpenXmlAttribute; XmlAttrVertOverflow: OpenXmlAttribute; @@ -90,7 +95,7 @@ public XmlAttrCompatLnSpc: OpenXmlAttribute; // Children - PrstTxWrap: PrstTxWrap; + XmlChildPrstTxWrap: PrstTxWrap; XmlChildNoAutofit: OpenXmlEmpty; end; @@ -107,148 +112,87 @@ end; function BodyPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function BodyPr.Init();override; begin - {self.}XmlAttrRot := new OpenXmlAttribute(nil, "rot", nil); - {self.}XmlAttrSpcFirstLastPara := new OpenXmlAttribute(nil, "spcFirstLastPara", nil); - {self.}XmlAttrVertOverflow := new OpenXmlAttribute(nil, "vertOverflow", nil); - {self.}XmlAttrHorzOverflow := new OpenXmlAttribute(nil, "horzOverflow", nil); - {self.}XmlAttrVert := new OpenXmlAttribute(nil, "vert", nil); - {self.}XmlAttrWrap := new OpenXmlAttribute(nil, "wrap", nil); - {self.}XmlAttrLIns := new OpenXmlAttribute(nil, "lIns", nil); - {self.}XmlAttrTIns := new OpenXmlAttribute(nil, "TIns", nil); - {self.}XmlAttrRIns := new OpenXmlAttribute(nil, "rIns", nil); - {self.}XmlAttrBIns := new OpenXmlAttribute(nil, "bIns", nil); - {self.}XmlAttrNumCol := new OpenXmlAttribute(nil, "numCol", nil); - {self.}XmlAttrSpcCol := new OpenXmlAttribute(nil, "spcCol", nil); - {self.}XmlAttrRtlCol := new OpenXmlAttribute(nil, "rtlCol", nil); - {self.}XmlAttrFromWordArt := new OpenXmlAttribute(nil, "fromWordArt", nil); - {self.}XmlAttrAnchor := new OpenXmlAttribute(nil, "anchor", nil); - {self.}XmlAttrAnchorCtr := new OpenXmlAttribute(nil, "anchorCtr", nil); - {self.}XmlAttrForceAA := new OpenXmlAttribute(nil, "forceAA", nil); - {self.}XmlAttrCompatLnSpc := new OpenXmlAttribute(nil, "compatLnSpc", nil); - {self.}PrstTxWrap := new PrstTxWrap(self, "a", "prstTxWrap"); - {self.}XmlChildNoAutofit := new OpenXmlEmpty(self, "a", "noAutofit"); -end; - -function BodyPr.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrRot, - {self.}XmlAttrSpcFirstLastPara, - {self.}XmlAttrVertOverflow, - {self.}XmlAttrHorzOverflow, - {self.}XmlAttrVert, - {self.}XmlAttrWrap, - {self.}XmlAttrLIns, - {self.}XmlAttrTIns, - {self.}XmlAttrRIns, - {self.}XmlAttrBIns, - {self.}XmlAttrNumCol, - {self.}XmlAttrSpcCol, - {self.}XmlAttrRtlCol, - {self.}XmlAttrFromWordArt, - {self.}XmlAttrAnchor, - {self.}XmlAttrAnchorCtr, - {self.}XmlAttrForceAA, - {self.}XmlAttrCompatLnSpc, - ); -end; - -function BodyPr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}PrstTxWrap, - 1: {self.}XmlChildNoAutofit, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "rot": makeweakref(thisFunction(WriteXmlAttrRot)), + "spcFirstLastPara": makeweakref(thisFunction(WriteXmlAttrSpcFirstLastPara)), + "vertOverflow": makeweakref(thisFunction(WriteXmlAttrVertOverflow)), + "horzOverflow": makeweakref(thisFunction(WriteXmlAttrHorzOverflow)), + "vert": makeweakref(thisFunction(WriteXmlAttrVert)), + "wrap": makeweakref(thisFunction(WriteXmlAttrWrap)), + "lIns": makeweakref(thisFunction(WriteXmlAttrLIns)), + "TIns": makeweakref(thisFunction(WriteXmlAttrTIns)), + "rIns": makeweakref(thisFunction(WriteXmlAttrRIns)), + "bIns": makeweakref(thisFunction(WriteXmlAttrBIns)), + "numCol": makeweakref(thisFunction(WriteXmlAttrNumCol)), + "spcCol": makeweakref(thisFunction(WriteXmlAttrSpcCol)), + "rtlCol": makeweakref(thisFunction(WriteXmlAttrRtlCol)), + "fromWordArt": makeweakref(thisFunction(WriteXmlAttrFromWordArt)), + "anchor": makeweakref(thisFunction(WriteXmlAttrAnchor)), + "anchorCtr": makeweakref(thisFunction(WriteXmlAttrAnchorCtr)), + "forceAA": makeweakref(thisFunction(WriteXmlAttrForceAA)), + "compatLnSpc": makeweakref(thisFunction(WriteXmlAttrCompatLnSpc)), ); sorted_child_ := array( - "": -1, - {self.}PrstTxWrap.ElementName: 0, - {self.}XmlChildNoAutofit.ElementName: 1, + "a:prstTxWrap": array(0, makeweakref(thisFunction(ReadXmlChildPrstTxWrap))), + "a:noAutofit": array(1, makeweakref(thisFunction(ReadXmlChildNoAutofit))), ); -end; - -function BodyPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function BodyPr.Copy(_obj: BodyPr);override; begin - if not ifnil(_obj.XmlAttrRot.Value) then - {self.}XmlAttrRot.Value := _obj.XmlAttrRot.Value; - if not ifnil(_obj.XmlAttrSpcFirstLastPara.Value) then - {self.}XmlAttrSpcFirstLastPara.Value := _obj.XmlAttrSpcFirstLastPara.Value; - if not ifnil(_obj.XmlAttrVertOverflow.Value) then - {self.}XmlAttrVertOverflow.Value := _obj.XmlAttrVertOverflow.Value; - if not ifnil(_obj.XmlAttrHorzOverflow.Value) then - {self.}XmlAttrHorzOverflow.Value := _obj.XmlAttrHorzOverflow.Value; - if not ifnil(_obj.XmlAttrVert.Value) then - {self.}XmlAttrVert.Value := _obj.XmlAttrVert.Value; - if not ifnil(_obj.XmlAttrWrap.Value) then - {self.}XmlAttrWrap.Value := _obj.XmlAttrWrap.Value; - if not ifnil(_obj.XmlAttrLIns.Value) then - {self.}XmlAttrLIns.Value := _obj.XmlAttrLIns.Value; - if not ifnil(_obj.XmlAttrTIns.Value) then - {self.}XmlAttrTIns.Value := _obj.XmlAttrTIns.Value; - if not ifnil(_obj.XmlAttrRIns.Value) then - {self.}XmlAttrRIns.Value := _obj.XmlAttrRIns.Value; - if not ifnil(_obj.XmlAttrBIns.Value) then - {self.}XmlAttrBIns.Value := _obj.XmlAttrBIns.Value; - if not ifnil(_obj.XmlAttrNumCol.Value) then - {self.}XmlAttrNumCol.Value := _obj.XmlAttrNumCol.Value; - if not ifnil(_obj.XmlAttrSpcCol.Value) then - {self.}XmlAttrSpcCol.Value := _obj.XmlAttrSpcCol.Value; - if not ifnil(_obj.XmlAttrRtlCol.Value) then - {self.}XmlAttrRtlCol.Value := _obj.XmlAttrRtlCol.Value; - if not ifnil(_obj.XmlAttrFromWordArt.Value) then - {self.}XmlAttrFromWordArt.Value := _obj.XmlAttrFromWordArt.Value; - if not ifnil(_obj.XmlAttrAnchor.Value) then - {self.}XmlAttrAnchor.Value := _obj.XmlAttrAnchor.Value; - if not ifnil(_obj.XmlAttrAnchorCtr.Value) then - {self.}XmlAttrAnchorCtr.Value := _obj.XmlAttrAnchorCtr.Value; - if not ifnil(_obj.XmlAttrForceAA.Value) then - {self.}XmlAttrForceAA.Value := _obj.XmlAttrForceAA.Value; - if not ifnil(_obj.XmlAttrCompatLnSpc.Value) then - {self.}XmlAttrCompatLnSpc.Value := _obj.XmlAttrCompatLnSpc.Value; - {self.}PrstTxWrap.Copy(_obj.PrstTxWrap); - {self.}XmlChildNoAutofit.Copy(_obj.XmlChildNoAutofit); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Rot) then + {self.}Rot := _obj.Rot; + if not ifnil(_obj.SpcFirstLastPara) then + {self.}SpcFirstLastPara := _obj.SpcFirstLastPara; + if not ifnil(_obj.VertOverflow) then + {self.}VertOverflow := _obj.VertOverflow; + if not ifnil(_obj.HorzOverflow) then + {self.}HorzOverflow := _obj.HorzOverflow; + if not ifnil(_obj.Vert) then + {self.}Vert := _obj.Vert; + if not ifnil(_obj.Wrap) then + {self.}Wrap := _obj.Wrap; + if not ifnil(_obj.LIns) then + {self.}LIns := _obj.LIns; + if not ifnil(_obj.TIns) then + {self.}TIns := _obj.TIns; + if not ifnil(_obj.RIns) then + {self.}RIns := _obj.RIns; + if not ifnil(_obj.BIns) then + {self.}BIns := _obj.BIns; + if not ifnil(_obj.NumCol) then + {self.}NumCol := _obj.NumCol; + if not ifnil(_obj.SpcCol) then + {self.}SpcCol := _obj.SpcCol; + if not ifnil(_obj.RtlCol) then + {self.}RtlCol := _obj.RtlCol; + if not ifnil(_obj.FromWordArt) then + {self.}FromWordArt := _obj.FromWordArt; + if not ifnil(_obj.Anchor) then + {self.}Anchor := _obj.Anchor; + if not ifnil(_obj.AnchorCtr) then + {self.}AnchorCtr := _obj.AnchorCtr; + if not ifnil(_obj.ForceAA) then + {self.}ForceAA := _obj.ForceAA; + if not ifnil(_obj.CompatLnSpc) then + {self.}CompatLnSpc := _obj.CompatLnSpc; + if not ifnil(_obj.XmlChildPrstTxWrap) then + {self.}PrstTxWrap.Copy(_obj.XmlChildPrstTxWrap); + if not ifnil(_obj.XmlChildNoAutofit) then + ifnil({self.}XmlChildNoAutofit) ? {self.}NoAutofit.Copy(_obj.XmlChildNoAutofit) : {self.}XmlChildNoAutofit.Copy(_obj.XmlChildNoAutofit); + tslassigning := tslassigning_backup; end; function BodyPr.ReadXmlAttrRot(); @@ -258,6 +202,11 @@ end; function BodyPr.WriteXmlAttrRot(_value); begin + if ifnil({self.}XmlAttrRot) then + begin + {self.}XmlAttrRot := new OpenXmlAttribute("", "rot", nil); + attributes_[length(attributes_)] := {self.}XmlAttrRot; + end {self.}XmlAttrRot.Value := _value; end; @@ -268,6 +217,11 @@ end; function BodyPr.WriteXmlAttrSpcFirstLastPara(_value); begin + if ifnil({self.}XmlAttrSpcFirstLastPara) then + begin + {self.}XmlAttrSpcFirstLastPara := new OpenXmlAttribute("", "spcFirstLastPara", nil); + attributes_[length(attributes_)] := {self.}XmlAttrSpcFirstLastPara; + end {self.}XmlAttrSpcFirstLastPara.Value := _value; end; @@ -278,6 +232,11 @@ end; function BodyPr.WriteXmlAttrVertOverflow(_value); begin + if ifnil({self.}XmlAttrVertOverflow) then + begin + {self.}XmlAttrVertOverflow := new OpenXmlAttribute("", "vertOverflow", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVertOverflow; + end {self.}XmlAttrVertOverflow.Value := _value; end; @@ -288,6 +247,11 @@ end; function BodyPr.WriteXmlAttrHorzOverflow(_value); begin + if ifnil({self.}XmlAttrHorzOverflow) then + begin + {self.}XmlAttrHorzOverflow := new OpenXmlAttribute("", "horzOverflow", nil); + attributes_[length(attributes_)] := {self.}XmlAttrHorzOverflow; + end {self.}XmlAttrHorzOverflow.Value := _value; end; @@ -298,6 +262,11 @@ end; function BodyPr.WriteXmlAttrVert(_value); begin + if ifnil({self.}XmlAttrVert) then + begin + {self.}XmlAttrVert := new OpenXmlAttribute("", "vert", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVert; + end {self.}XmlAttrVert.Value := _value; end; @@ -308,6 +277,11 @@ end; function BodyPr.WriteXmlAttrWrap(_value); begin + if ifnil({self.}XmlAttrWrap) then + begin + {self.}XmlAttrWrap := new OpenXmlAttribute("", "wrap", nil); + attributes_[length(attributes_)] := {self.}XmlAttrWrap; + end {self.}XmlAttrWrap.Value := _value; end; @@ -318,6 +292,11 @@ end; function BodyPr.WriteXmlAttrLIns(_value); begin + if ifnil({self.}XmlAttrLIns) then + begin + {self.}XmlAttrLIns := new OpenXmlAttribute("", "lIns", nil); + attributes_[length(attributes_)] := {self.}XmlAttrLIns; + end {self.}XmlAttrLIns.Value := _value; end; @@ -328,6 +307,11 @@ end; function BodyPr.WriteXmlAttrTIns(_value); begin + if ifnil({self.}XmlAttrTIns) then + begin + {self.}XmlAttrTIns := new OpenXmlAttribute("", "TIns", nil); + attributes_[length(attributes_)] := {self.}XmlAttrTIns; + end {self.}XmlAttrTIns.Value := _value; end; @@ -338,6 +322,11 @@ end; function BodyPr.WriteXmlAttrRIns(_value); begin + if ifnil({self.}XmlAttrRIns) then + begin + {self.}XmlAttrRIns := new OpenXmlAttribute("", "rIns", nil); + attributes_[length(attributes_)] := {self.}XmlAttrRIns; + end {self.}XmlAttrRIns.Value := _value; end; @@ -348,6 +337,11 @@ end; function BodyPr.WriteXmlAttrBIns(_value); begin + if ifnil({self.}XmlAttrBIns) then + begin + {self.}XmlAttrBIns := new OpenXmlAttribute("", "bIns", nil); + attributes_[length(attributes_)] := {self.}XmlAttrBIns; + end {self.}XmlAttrBIns.Value := _value; end; @@ -358,6 +352,11 @@ end; function BodyPr.WriteXmlAttrNumCol(_value); begin + if ifnil({self.}XmlAttrNumCol) then + begin + {self.}XmlAttrNumCol := new OpenXmlAttribute("", "numCol", nil); + attributes_[length(attributes_)] := {self.}XmlAttrNumCol; + end {self.}XmlAttrNumCol.Value := _value; end; @@ -368,6 +367,11 @@ end; function BodyPr.WriteXmlAttrSpcCol(_value); begin + if ifnil({self.}XmlAttrSpcCol) then + begin + {self.}XmlAttrSpcCol := new OpenXmlAttribute("", "spcCol", nil); + attributes_[length(attributes_)] := {self.}XmlAttrSpcCol; + end {self.}XmlAttrSpcCol.Value := _value; end; @@ -378,6 +382,11 @@ end; function BodyPr.WriteXmlAttrRtlCol(_value); begin + if ifnil({self.}XmlAttrRtlCol) then + begin + {self.}XmlAttrRtlCol := new OpenXmlAttribute("", "rtlCol", nil); + attributes_[length(attributes_)] := {self.}XmlAttrRtlCol; + end {self.}XmlAttrRtlCol.Value := _value; end; @@ -388,6 +397,11 @@ end; function BodyPr.WriteXmlAttrFromWordArt(_value); begin + if ifnil({self.}XmlAttrFromWordArt) then + begin + {self.}XmlAttrFromWordArt := new OpenXmlAttribute("", "fromWordArt", nil); + attributes_[length(attributes_)] := {self.}XmlAttrFromWordArt; + end {self.}XmlAttrFromWordArt.Value := _value; end; @@ -398,6 +412,11 @@ end; function BodyPr.WriteXmlAttrAnchor(_value); begin + if ifnil({self.}XmlAttrAnchor) then + begin + {self.}XmlAttrAnchor := new OpenXmlAttribute("", "anchor", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAnchor; + end {self.}XmlAttrAnchor.Value := _value; end; @@ -408,6 +427,11 @@ end; function BodyPr.WriteXmlAttrAnchorCtr(_value); begin + if ifnil({self.}XmlAttrAnchorCtr) then + begin + {self.}XmlAttrAnchorCtr := new OpenXmlAttribute("", "anchorCtr", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAnchorCtr; + end {self.}XmlAttrAnchorCtr.Value := _value; end; @@ -418,6 +442,11 @@ end; function BodyPr.WriteXmlAttrForceAA(_value); begin + if ifnil({self.}XmlAttrForceAA) then + begin + {self.}XmlAttrForceAA := new OpenXmlAttribute("", "forceAA", nil); + attributes_[length(attributes_)] := {self.}XmlAttrForceAA; + end {self.}XmlAttrForceAA.Value := _value; end; @@ -428,15 +457,41 @@ end; function BodyPr.WriteXmlAttrCompatLnSpc(_value); begin + if ifnil({self.}XmlAttrCompatLnSpc) then + begin + {self.}XmlAttrCompatLnSpc := new OpenXmlAttribute("", "compatLnSpc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrCompatLnSpc; + end {self.}XmlAttrCompatLnSpc.Value := _value; end; function BodyPr.ReadXmlChildNoAutofit(); begin - return ifnil({self.}XmlChildNoAutofit.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildNoAutofit) then + begin + {self.}XmlChildNoAutofit := new OpenXmlEmpty(self, "a", "noAutofit"); + container_.Set({self.}XmlChildNoAutofit); + return {self.}XmlChildNoAutofit; + end + return {self.}XmlChildNoAutofit.BoolValue(); end; function BodyPr.WriteXmlChildNoAutofit(_value); begin + if ifnil({self.}XmlChildNoAutofit) then + begin + {self.}XmlChildNoAutofit := new OpenXmlEmpty(self, "a", "noAutofit"); + container_.Set({self.}XmlChildNoAutofit); + end {self.}XmlChildNoAutofit.Value := _value; end; + +function BodyPr.ReadXmlChildPrstTxWrap(); +begin + if tslassigning and ifnil({self.}XmlChildPrstTxWrap) then + begin + {self.}XmlChildPrstTxWrap := new PrstTxWrap(self, "a", "prstTxWrap"); + container_.Set({self.}XmlChildPrstTxWrap); + end + return {self.}XmlChildPrstTxWrap; +end; diff --git a/autoclass/docx/Bookmark@DOCX.tsf b/autoclass/docx/Bookmark@DOCX.tsf index 50da815..286fc26 100644 --- a/autoclass/docx/Bookmark@DOCX.tsf +++ b/autoclass/docx/Bookmark@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Bookmark);override; +public + + // attributes property property Name read ReadXmlAttrName write WriteXmlAttrName; property Id read ReadXmlAttrId write WriteXmlAttrId; function ReadXmlAttrName(); @@ -17,11 +17,10 @@ public function WriteXmlAttrId(_value); public - // Attributes + // Attributes XmlAttrName: OpenXmlAttribute; XmlAttrId: OpenXmlAttribute; - // Children end; @@ -37,45 +36,33 @@ end; function Bookmark.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Bookmark.Init();override; begin - {self.}XmlAttrName := new OpenXmlAttribute({self.}Prefix, "name", nil); - {self.}XmlAttrId := new OpenXmlAttribute({self.}Prefix, "id", nil); -end; - -function Bookmark.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrName, - {self.}XmlAttrId, - ); -end; - -function Bookmark.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "name": makeweakref(thisFunction(WriteXmlAttrName)), + pre + "id": makeweakref(thisFunction(WriteXmlAttrId)), ); sorted_child_ := array( - "": -1, ); -end; - -function Bookmark.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Bookmark.Copy(_obj: Bookmark);override; begin - if not ifnil(_obj.XmlAttrName.Value) then - {self.}XmlAttrName.Value := _obj.XmlAttrName.Value; - if not ifnil(_obj.XmlAttrId.Value) then - {self.}XmlAttrId.Value := _obj.XmlAttrId.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Name) then + {self.}Name := _obj.Name; + if not ifnil(_obj.Id) then + {self.}Id := _obj.Id; + tslassigning := tslassigning_backup; end; function Bookmark.ReadXmlAttrName(); @@ -85,6 +72,11 @@ end; function Bookmark.WriteXmlAttrName(_value); begin + if ifnil({self.}XmlAttrName) then + begin + {self.}XmlAttrName := new OpenXmlAttribute({self.}Prefix, "name", nil); + attributes_[length(attributes_)] := {self.}XmlAttrName; + end {self.}XmlAttrName.Value := _value; end; @@ -95,5 +87,10 @@ end; function Bookmark.WriteXmlAttrId(_value); begin + if ifnil({self.}XmlAttrId) then + begin + {self.}XmlAttrId := new OpenXmlAttribute({self.}Prefix, "id", nil); + attributes_[length(attributes_)] := {self.}XmlAttrId; + end {self.}XmlAttrId.Value := _value; end; diff --git a/autoclass/docx/Br@DOCX.tsf b/autoclass/docx/Br@DOCX.tsf index 11e2622..6bec183 100644 --- a/autoclass/docx/Br@DOCX.tsf +++ b/autoclass/docx/Br@DOCX.tsf @@ -4,20 +4,19 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Br);override; +public + + // attributes property property Type read ReadXmlAttrType write WriteXmlAttrType; function ReadXmlAttrType(); function WriteXmlAttrType(_value); public - // Attributes + // Attributes XmlAttrType: OpenXmlAttribute; - // Children end; @@ -33,41 +32,30 @@ end; function Br.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Br.Init();override; begin - {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); -end; - -function Br.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrType, - ); -end; - -function Br.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "type": makeweakref(thisFunction(WriteXmlAttrType)), ); sorted_child_ := array( - "": -1, ); -end; - -function Br.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Br.Copy(_obj: Br);override; begin - if not ifnil(_obj.XmlAttrType.Value) then - {self.}XmlAttrType.Value := _obj.XmlAttrType.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Type) then + {self.}Type := _obj.Type; + tslassigning := tslassigning_backup; end; function Br.ReadXmlAttrType(); @@ -77,5 +65,10 @@ end; function Br.WriteXmlAttrType(_value); begin + if ifnil({self.}XmlAttrType) then + begin + {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); + attributes_[length(attributes_)] := {self.}XmlAttrType; + end {self.}XmlAttrType.Value := _value; end; diff --git a/autoclass/docx/CNvGraphicFramePr@DOCX.tsf b/autoclass/docx/CNvGraphicFramePr@DOCX.tsf index 13bf2fa..595d73b 100644 --- a/autoclass/docx/CNvGraphicFramePr@DOCX.tsf +++ b/autoclass/docx/CNvGraphicFramePr@DOCX.tsf @@ -4,16 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: CNvGraphicFramePr);override; public - // Attributes + // normal property + property GraphicFrameLocks read ReadXmlChildGraphicFrameLocks; + function ReadXmlChildGraphicFrameLocks(); + +public // Children - GraphicFrameLocks: GraphicFrameLocks; + XmlChildGraphicFrameLocks: GraphicFrameLocks; end; @@ -29,70 +30,38 @@ end; function CNvGraphicFramePr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function CNvGraphicFramePr.Init();override; begin - {self.}GraphicFrameLocks := new GraphicFrameLocks(self, {self.}Prefix, "graphicFrameLocks"); -end; - -function CNvGraphicFramePr.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function CNvGraphicFramePr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}GraphicFrameLocks, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}GraphicFrameLocks.ElementName: 0, + pre + "graphicFrameLocks": array(0, makeweakref(thisFunction(ReadXmlChildGraphicFrameLocks))), ); -end; - -function CNvGraphicFramePr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function CNvGraphicFramePr.Copy(_obj: CNvGraphicFramePr);override; begin - {self.}GraphicFrameLocks.Copy(_obj.GraphicFrameLocks); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildGraphicFrameLocks) then + {self.}GraphicFrameLocks.Copy(_obj.XmlChildGraphicFrameLocks); + tslassigning := tslassigning_backup; +end; + +function CNvGraphicFramePr.ReadXmlChildGraphicFrameLocks(); +begin + if tslassigning and ifnil({self.}XmlChildGraphicFrameLocks) then + begin + {self.}XmlChildGraphicFrameLocks := new GraphicFrameLocks(self, {self.}Prefix, "graphicFrameLocks"); + container_.Set({self.}XmlChildGraphicFrameLocks); + end + return {self.}XmlChildGraphicFrameLocks; end; diff --git a/autoclass/docx/CNvPicPr@DOCX.tsf b/autoclass/docx/CNvPicPr@DOCX.tsf index 80946ed..6c42ccd 100644 --- a/autoclass/docx/CNvPicPr@DOCX.tsf +++ b/autoclass/docx/CNvPicPr@DOCX.tsf @@ -4,16 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: CNvPicPr);override; public - // Attributes + // normal property + property PicLocks read ReadXmlChildPicLocks; + function ReadXmlChildPicLocks(); + +public // Children - PicLocks: PicLocks; + XmlChildPicLocks: PicLocks; end; @@ -29,70 +30,38 @@ end; function CNvPicPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function CNvPicPr.Init();override; begin - {self.}PicLocks := new PicLocks(self, "a", "picLocks"); -end; - -function CNvPicPr.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function CNvPicPr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}PicLocks, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}PicLocks.ElementName: 0, + "a:picLocks": array(0, makeweakref(thisFunction(ReadXmlChildPicLocks))), ); -end; - -function CNvPicPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function CNvPicPr.Copy(_obj: CNvPicPr);override; begin - {self.}PicLocks.Copy(_obj.PicLocks); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildPicLocks) then + {self.}PicLocks.Copy(_obj.XmlChildPicLocks); + tslassigning := tslassigning_backup; +end; + +function CNvPicPr.ReadXmlChildPicLocks(); +begin + if tslassigning and ifnil({self.}XmlChildPicLocks) then + begin + {self.}XmlChildPicLocks := new PicLocks(self, "a", "picLocks"); + container_.Set({self.}XmlChildPicLocks); + end + return {self.}XmlChildPicLocks; end; diff --git a/autoclass/docx/CNvPr@DOCX.tsf b/autoclass/docx/CNvPr@DOCX.tsf index edfae12..36971c0 100644 --- a/autoclass/docx/CNvPr@DOCX.tsf +++ b/autoclass/docx/CNvPr@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: CNvPr);override; +public + + // attributes property property Id read ReadXmlAttrId write WriteXmlAttrId; property Name read ReadXmlAttrName write WriteXmlAttrName; property Descr read ReadXmlAttrDescr write WriteXmlAttrDescr; @@ -20,12 +20,11 @@ public function WriteXmlAttrDescr(_value); public - // Attributes + // Attributes XmlAttrId: OpenXmlAttribute; XmlAttrName: OpenXmlAttribute; XmlAttrDescr: OpenXmlAttribute; - // Children end; @@ -41,49 +40,36 @@ end; function CNvPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function CNvPr.Init();override; begin - {self.}XmlAttrId := new OpenXmlAttribute(nil, "id", nil); - {self.}XmlAttrName := new OpenXmlAttribute(nil, "name", nil); - {self.}XmlAttrDescr := new OpenXmlAttribute(nil, "descr", nil); -end; - -function CNvPr.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrId, - {self.}XmlAttrName, - {self.}XmlAttrDescr, - ); -end; - -function CNvPr.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "id": makeweakref(thisFunction(WriteXmlAttrId)), + "name": makeweakref(thisFunction(WriteXmlAttrName)), + "descr": makeweakref(thisFunction(WriteXmlAttrDescr)), ); sorted_child_ := array( - "": -1, ); -end; - -function CNvPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function CNvPr.Copy(_obj: CNvPr);override; begin - if not ifnil(_obj.XmlAttrId.Value) then - {self.}XmlAttrId.Value := _obj.XmlAttrId.Value; - if not ifnil(_obj.XmlAttrName.Value) then - {self.}XmlAttrName.Value := _obj.XmlAttrName.Value; - if not ifnil(_obj.XmlAttrDescr.Value) then - {self.}XmlAttrDescr.Value := _obj.XmlAttrDescr.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Id) then + {self.}Id := _obj.Id; + if not ifnil(_obj.Name) then + {self.}Name := _obj.Name; + if not ifnil(_obj.Descr) then + {self.}Descr := _obj.Descr; + tslassigning := tslassigning_backup; end; function CNvPr.ReadXmlAttrId(); @@ -93,6 +79,11 @@ end; function CNvPr.WriteXmlAttrId(_value); begin + if ifnil({self.}XmlAttrId) then + begin + {self.}XmlAttrId := new OpenXmlAttribute("", "id", nil); + attributes_[length(attributes_)] := {self.}XmlAttrId; + end {self.}XmlAttrId.Value := _value; end; @@ -103,6 +94,11 @@ end; function CNvPr.WriteXmlAttrName(_value); begin + if ifnil({self.}XmlAttrName) then + begin + {self.}XmlAttrName := new OpenXmlAttribute("", "name", nil); + attributes_[length(attributes_)] := {self.}XmlAttrName; + end {self.}XmlAttrName.Value := _value; end; @@ -113,5 +109,10 @@ end; function CNvPr.WriteXmlAttrDescr(_value); begin + if ifnil({self.}XmlAttrDescr) then + begin + {self.}XmlAttrDescr := new OpenXmlAttribute("", "descr", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDescr; + end {self.}XmlAttrDescr.Value := _value; end; diff --git a/autoclass/docx/CNvSpPr@DOCX.tsf b/autoclass/docx/CNvSpPr@DOCX.tsf index 38e2e00..935b289 100644 --- a/autoclass/docx/CNvSpPr@DOCX.tsf +++ b/autoclass/docx/CNvSpPr@DOCX.tsf @@ -4,21 +4,25 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: CNvSpPr);override; +public + + // attributes property property TxBox read ReadXmlAttrTxBox write WriteXmlAttrTxBox; function ReadXmlAttrTxBox(); function WriteXmlAttrTxBox(_value); + // normal property + property SpLocks read ReadXmlChildSpLocks; + function ReadXmlChildSpLocks(); + public - // Attributes + // Attributes XmlAttrTxBox: OpenXmlAttribute; // Children - SpLocks: SpLocks; + XmlChildSpLocks: SpLocks; end; @@ -34,76 +38,33 @@ end; function CNvSpPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function CNvSpPr.Init();override; begin - {self.}XmlAttrTxBox := new OpenXmlAttribute(nil, "txBox", nil); - {self.}SpLocks := new SpLocks(self, "a", "spLocks"); -end; - -function CNvSpPr.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrTxBox, - ); -end; - -function CNvSpPr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}SpLocks, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "txBox": makeweakref(thisFunction(WriteXmlAttrTxBox)), ); sorted_child_ := array( - "": -1, - {self.}SpLocks.ElementName: 0, + "a:spLocks": array(0, makeweakref(thisFunction(ReadXmlChildSpLocks))), ); -end; - -function CNvSpPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function CNvSpPr.Copy(_obj: CNvSpPr);override; begin - if not ifnil(_obj.XmlAttrTxBox.Value) then - {self.}XmlAttrTxBox.Value := _obj.XmlAttrTxBox.Value; - {self.}SpLocks.Copy(_obj.SpLocks); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.TxBox) then + {self.}TxBox := _obj.TxBox; + if not ifnil(_obj.XmlChildSpLocks) then + {self.}SpLocks.Copy(_obj.XmlChildSpLocks); + tslassigning := tslassigning_backup; end; function CNvSpPr.ReadXmlAttrTxBox(); @@ -113,5 +74,20 @@ end; function CNvSpPr.WriteXmlAttrTxBox(_value); begin + if ifnil({self.}XmlAttrTxBox) then + begin + {self.}XmlAttrTxBox := new OpenXmlAttribute("", "txBox", nil); + attributes_[length(attributes_)] := {self.}XmlAttrTxBox; + end {self.}XmlAttrTxBox.Value := _value; end; + +function CNvSpPr.ReadXmlChildSpLocks(); +begin + if tslassigning and ifnil({self.}XmlChildSpLocks) then + begin + {self.}XmlChildSpLocks := new SpLocks(self, "a", "spLocks"); + container_.Set({self.}XmlChildSpLocks); + end + return {self.}XmlChildSpLocks; +end; diff --git a/autoclass/docx/CXY@DOCX.tsf b/autoclass/docx/CXY@DOCX.tsf index 339cbfe..a6be2d5 100644 --- a/autoclass/docx/CXY@DOCX.tsf +++ b/autoclass/docx/CXY@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: CXY);override; +public + + // attributes property property Cx read ReadXmlAttrCx write WriteXmlAttrCx; property Cy read ReadXmlAttrCy write WriteXmlAttrCy; function ReadXmlAttrCx(); @@ -17,17 +17,16 @@ public function WriteXmlAttrCy(_value); public - // Attributes + // Attributes XmlAttrCx: OpenXmlAttribute; XmlAttrCy: OpenXmlAttribute; - // Children end; function CXY.Create();overload; begin - {self.}Create(nil, nil, ""); + {self.}Create(nil, "", ""); end; function CXY.Create(_node: XmlNode);overload; @@ -37,45 +36,33 @@ end; function CXY.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function CXY.Init();override; begin - {self.}XmlAttrCx := new OpenXmlAttribute(nil, "cx", nil); - {self.}XmlAttrCy := new OpenXmlAttribute(nil, "cy", nil); -end; - -function CXY.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrCx, - {self.}XmlAttrCy, - ); -end; - -function CXY.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "cx": makeweakref(thisFunction(WriteXmlAttrCx)), + "cy": makeweakref(thisFunction(WriteXmlAttrCy)), ); sorted_child_ := array( - "": -1, ); -end; - -function CXY.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function CXY.Copy(_obj: CXY);override; begin - if not ifnil(_obj.XmlAttrCx.Value) then - {self.}XmlAttrCx.Value := _obj.XmlAttrCx.Value; - if not ifnil(_obj.XmlAttrCy.Value) then - {self.}XmlAttrCy.Value := _obj.XmlAttrCy.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Cx) then + {self.}Cx := _obj.Cx; + if not ifnil(_obj.Cy) then + {self.}Cy := _obj.Cy; + tslassigning := tslassigning_backup; end; function CXY.ReadXmlAttrCx(); @@ -85,6 +72,11 @@ end; function CXY.WriteXmlAttrCx(_value); begin + if ifnil({self.}XmlAttrCx) then + begin + {self.}XmlAttrCx := new OpenXmlAttribute("", "cx", nil); + attributes_[length(attributes_)] := {self.}XmlAttrCx; + end {self.}XmlAttrCx.Value := _value; end; @@ -95,5 +87,10 @@ end; function CXY.WriteXmlAttrCy(_value); begin + if ifnil({self.}XmlAttrCy) then + begin + {self.}XmlAttrCy := new OpenXmlAttribute("", "cy", nil); + attributes_[length(attributes_)] := {self.}XmlAttrCy; + end {self.}XmlAttrCy.Value := _value; end; diff --git a/autoclass/docx/Cache@DOCX.tsf b/autoclass/docx/Cache@DOCX.tsf index 4c2cb5d..23df5f2 100644 --- a/autoclass/docx/Cache@DOCX.tsf +++ b/autoclass/docx/Cache@DOCX.tsf @@ -4,22 +4,28 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Cache);override; + +public + + // pcdata property + property FormatCode read ReadXmlChildFormatCode; + function ReadXmlChildFormatCode(); + + // normal property + property PtCount read ReadXmlChildPtCount; + function ReadXmlChildPtCount(); + + // multi property + property Pts read ReadPts; + function ReadPts(_index); function AddPt(): Pt; function AppendPt(): Pt; - property Pts read ReadPts; - function ReadPts(_index); - public - // Attributes - // Children - FormatCode: OpenXmlPcdata; - PtCount: PureVal; + XmlChildFormatCode: OpenXmlPcdata; + XmlChildPtCount: PureVal; end; @@ -35,111 +41,73 @@ end; function Cache.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Cache.Init();override; begin - {self.}FormatCode := new OpenXmlPcdata(self, {self.}Prefix, "formatCode"); - {self.}PtCount := new PureVal(self, {self.}Prefix, "ptCount"); -end; - -function Cache.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Cache.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}FormatCode, - 1: {self.}PtCount, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}FormatCode.ElementName: 0, - {self.}PtCount.ElementName: 1, + pre + "formatCode": array(0, makeweakref(thisFunction(ReadXmlChildFormatCode))), + pre + "ptCount": array(1, makeweakref(thisFunction(ReadXmlChildPtCount))), + pre + "pt": array(2, makeweakref(thisFunction(AppendPt))), ); -end; - -function Cache.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "pt": obj := {self.}AppendPt(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Cache.Copy(_obj: Cache);override; begin - {self.}FormatCode.Copy(_obj.FormatCode); - {self.}PtCount.Copy(_obj.PtCount); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildFormatCode) then + {self.}FormatCode.Copy(_obj.XmlChildFormatCode); + if not ifnil(_obj.XmlChildPtCount) then + {self.}PtCount.Copy(_obj.XmlChildPtCount); + tslassigning := tslassigning_backup; +end; + +function Cache.ReadXmlChildFormatCode(); +begin + if tslassigning and ifnil({self.}XmlChildFormatCode) then + begin + {self.}XmlChildFormatCode := new OpenXmlPcdata(self, {self.}Prefix, "formatCode"); + container_.Set({self.}XmlChildFormatCode); + end + return {self.}XmlChildFormatCode; +end; + +function Cache.ReadXmlChildPtCount(); +begin + if tslassigning and ifnil({self.}XmlChildPtCount) then + begin + {self.}XmlChildPtCount := new PureVal(self, {self.}Prefix, "ptCount"); + container_.Set({self.}XmlChildPtCount); + end + return {self.}XmlChildPtCount; +end; + +function Cache.ReadPts(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "pt", ind); end; function Cache.AddPt(): Pt; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "pt" then break; - end obj := new Pt(self, {self.}Prefix, "pt"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function Cache.AppendPt(): Pt; begin obj := new Pt(self, {self.}Prefix, "pt"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function Cache.ReadPts(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "pt" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; diff --git a/autoclass/docx/Cat@DOCX.tsf b/autoclass/docx/Cat@DOCX.tsf index 7088108..aa3bac8 100644 --- a/autoclass/docx/Cat@DOCX.tsf +++ b/autoclass/docx/Cat@DOCX.tsf @@ -4,16 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Cat);override; public - // Attributes + // normal property + property StrRef read ReadXmlChildStrRef; + function ReadXmlChildStrRef(); + +public // Children - StrRef: StrRef; + XmlChildStrRef: StrRef; end; @@ -29,70 +30,38 @@ end; function Cat.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Cat.Init();override; begin - {self.}StrRef := new StrRef(self, {self.}Prefix, "strRef"); -end; - -function Cat.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Cat.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}StrRef, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}StrRef.ElementName: 0, + pre + "strRef": array(0, makeweakref(thisFunction(ReadXmlChildStrRef))), ); -end; - -function Cat.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Cat.Copy(_obj: Cat);override; begin - {self.}StrRef.Copy(_obj.StrRef); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildStrRef) then + {self.}StrRef.Copy(_obj.XmlChildStrRef); + tslassigning := tslassigning_backup; +end; + +function Cat.ReadXmlChildStrRef(); +begin + if tslassigning and ifnil({self.}XmlChildStrRef) then + begin + {self.}XmlChildStrRef := new StrRef(self, {self.}Prefix, "strRef"); + container_.Set({self.}XmlChildStrRef); + end + return {self.}XmlChildStrRef; end; diff --git a/autoclass/docx/Chart@DOCX.tsf b/autoclass/docx/Chart@DOCX.tsf index 09800aa..b0cd640 100644 --- a/autoclass/docx/Chart@DOCX.tsf +++ b/autoclass/docx/Chart@DOCX.tsf @@ -4,23 +4,38 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Chart);override; public - // Attributes + // normal property + property Title read ReadXmlChildTitle; + property AutoTitleDeleted read ReadXmlChildAutoTitleDeleted; + property View3D read ReadXmlChildView3D; + property PlotArea read ReadXmlChildPlotArea; + property Legend read ReadXmlChildLegend; + property PlotVisOnly read ReadXmlChildPlotVisOnly; + property DispBlanksAs read ReadXmlChildDispBlanksAs; + property ShowDLblsOverMax read ReadXmlChildShowDLblsOverMax; + function ReadXmlChildTitle(); + function ReadXmlChildAutoTitleDeleted(); + function ReadXmlChildView3D(); + function ReadXmlChildPlotArea(); + function ReadXmlChildLegend(); + function ReadXmlChildPlotVisOnly(); + function ReadXmlChildDispBlanksAs(); + function ReadXmlChildShowDLblsOverMax(); + +public // Children - Title: Title; - AutoTitleDeleted: PureVal; - View3D: View3D; - PlotArea: PlotArea; - Legend: Legend; - PlotVisOnly: PureVal; - DispBlanksAs: PureVal; - ShowDLblsOverMax: PureVal; + XmlChildTitle: Title; + XmlChildAutoTitleDeleted: PureVal; + XmlChildView3D: View3D; + XmlChildPlotArea: PlotArea; + XmlChildLegend: Legend; + XmlChildPlotVisOnly: PureVal; + XmlChildDispBlanksAs: PureVal; + XmlChildShowDLblsOverMax: PureVal; end; @@ -36,98 +51,129 @@ end; function Chart.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Chart.Init();override; begin - {self.}Title := new Title(self, {self.}Prefix, "title"); - {self.}AutoTitleDeleted := new PureVal(self, {self.}Prefix, "autoTitleDeleted"); - {self.}View3D := new View3D(self, {self.}Prefix, "view3D"); - {self.}PlotArea := new PlotArea(self, {self.}Prefix, "plotArea"); - {self.}Legend := new Legend(self, {self.}Prefix, "legend"); - {self.}PlotVisOnly := new PureVal(self, {self.}Prefix, "plotVisOnly"); - {self.}DispBlanksAs := new PureVal(self, {self.}Prefix, "dispBlanksAs"); - {self.}ShowDLblsOverMax := new PureVal(self, {self.}Prefix, "showDLblsOverMax"); -end; - -function Chart.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Chart.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Title, - 1: {self.}AutoTitleDeleted, - 2: {self.}View3D, - 3: {self.}PlotArea, - 4: {self.}Legend, - 5: {self.}PlotVisOnly, - 6: {self.}DispBlanksAs, - 7: {self.}ShowDLblsOverMax, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}Title.ElementName: 0, - {self.}AutoTitleDeleted.ElementName: 1, - {self.}View3D.ElementName: 2, - {self.}PlotArea.ElementName: 3, - {self.}Legend.ElementName: 4, - {self.}PlotVisOnly.ElementName: 5, - {self.}DispBlanksAs.ElementName: 6, - {self.}ShowDLblsOverMax.ElementName: 7, + pre + "title": array(0, makeweakref(thisFunction(ReadXmlChildTitle))), + pre + "autoTitleDeleted": array(1, makeweakref(thisFunction(ReadXmlChildAutoTitleDeleted))), + pre + "view3D": array(2, makeweakref(thisFunction(ReadXmlChildView3D))), + pre + "plotArea": array(3, makeweakref(thisFunction(ReadXmlChildPlotArea))), + pre + "legend": array(4, makeweakref(thisFunction(ReadXmlChildLegend))), + pre + "plotVisOnly": array(5, makeweakref(thisFunction(ReadXmlChildPlotVisOnly))), + pre + "dispBlanksAs": array(6, makeweakref(thisFunction(ReadXmlChildDispBlanksAs))), + pre + "showDLblsOverMax": array(7, makeweakref(thisFunction(ReadXmlChildShowDLblsOverMax))), ); -end; - -function Chart.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Chart.Copy(_obj: Chart);override; begin - {self.}Title.Copy(_obj.Title); - {self.}AutoTitleDeleted.Copy(_obj.AutoTitleDeleted); - {self.}View3D.Copy(_obj.View3D); - {self.}PlotArea.Copy(_obj.PlotArea); - {self.}Legend.Copy(_obj.Legend); - {self.}PlotVisOnly.Copy(_obj.PlotVisOnly); - {self.}DispBlanksAs.Copy(_obj.DispBlanksAs); - {self.}ShowDLblsOverMax.Copy(_obj.ShowDLblsOverMax); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildTitle) then + {self.}Title.Copy(_obj.XmlChildTitle); + if not ifnil(_obj.XmlChildAutoTitleDeleted) then + {self.}AutoTitleDeleted.Copy(_obj.XmlChildAutoTitleDeleted); + if not ifnil(_obj.XmlChildView3D) then + {self.}View3D.Copy(_obj.XmlChildView3D); + if not ifnil(_obj.XmlChildPlotArea) then + {self.}PlotArea.Copy(_obj.XmlChildPlotArea); + if not ifnil(_obj.XmlChildLegend) then + {self.}Legend.Copy(_obj.XmlChildLegend); + if not ifnil(_obj.XmlChildPlotVisOnly) then + {self.}PlotVisOnly.Copy(_obj.XmlChildPlotVisOnly); + if not ifnil(_obj.XmlChildDispBlanksAs) then + {self.}DispBlanksAs.Copy(_obj.XmlChildDispBlanksAs); + if not ifnil(_obj.XmlChildShowDLblsOverMax) then + {self.}ShowDLblsOverMax.Copy(_obj.XmlChildShowDLblsOverMax); + tslassigning := tslassigning_backup; +end; + +function Chart.ReadXmlChildTitle(); +begin + if tslassigning and ifnil({self.}XmlChildTitle) then + begin + {self.}XmlChildTitle := new Title(self, {self.}Prefix, "title"); + container_.Set({self.}XmlChildTitle); + end + return {self.}XmlChildTitle; +end; + +function Chart.ReadXmlChildAutoTitleDeleted(); +begin + if tslassigning and ifnil({self.}XmlChildAutoTitleDeleted) then + begin + {self.}XmlChildAutoTitleDeleted := new PureVal(self, {self.}Prefix, "autoTitleDeleted"); + container_.Set({self.}XmlChildAutoTitleDeleted); + end + return {self.}XmlChildAutoTitleDeleted; +end; + +function Chart.ReadXmlChildView3D(); +begin + if tslassigning and ifnil({self.}XmlChildView3D) then + begin + {self.}XmlChildView3D := new View3D(self, {self.}Prefix, "view3D"); + container_.Set({self.}XmlChildView3D); + end + return {self.}XmlChildView3D; +end; + +function Chart.ReadXmlChildPlotArea(); +begin + if tslassigning and ifnil({self.}XmlChildPlotArea) then + begin + {self.}XmlChildPlotArea := new PlotArea(self, {self.}Prefix, "plotArea"); + container_.Set({self.}XmlChildPlotArea); + end + return {self.}XmlChildPlotArea; +end; + +function Chart.ReadXmlChildLegend(); +begin + if tslassigning and ifnil({self.}XmlChildLegend) then + begin + {self.}XmlChildLegend := new Legend(self, {self.}Prefix, "legend"); + container_.Set({self.}XmlChildLegend); + end + return {self.}XmlChildLegend; +end; + +function Chart.ReadXmlChildPlotVisOnly(); +begin + if tslassigning and ifnil({self.}XmlChildPlotVisOnly) then + begin + {self.}XmlChildPlotVisOnly := new PureVal(self, {self.}Prefix, "plotVisOnly"); + container_.Set({self.}XmlChildPlotVisOnly); + end + return {self.}XmlChildPlotVisOnly; +end; + +function Chart.ReadXmlChildDispBlanksAs(); +begin + if tslassigning and ifnil({self.}XmlChildDispBlanksAs) then + begin + {self.}XmlChildDispBlanksAs := new PureVal(self, {self.}Prefix, "dispBlanksAs"); + container_.Set({self.}XmlChildDispBlanksAs); + end + return {self.}XmlChildDispBlanksAs; +end; + +function Chart.ReadXmlChildShowDLblsOverMax(); +begin + if tslassigning and ifnil({self.}XmlChildShowDLblsOverMax) then + begin + {self.}XmlChildShowDLblsOverMax := new PureVal(self, {self.}Prefix, "showDLblsOverMax"); + container_.Set({self.}XmlChildShowDLblsOverMax); + end + return {self.}XmlChildShowDLblsOverMax; end; diff --git a/autoclass/docx/ChartSpace@DOCX.tsf b/autoclass/docx/ChartSpace@DOCX.tsf index ad1ff02..210e393 100644 --- a/autoclass/docx/ChartSpace@DOCX.tsf +++ b/autoclass/docx/ChartSpace@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: ChartSpace);override; +public + + // attributes property property XmlnsC read ReadXmlAttrXmlnsC write WriteXmlAttrXmlnsC; property XmlnsA read ReadXmlAttrXmlnsA write WriteXmlAttrXmlnsA; property XmlnsR read ReadXmlAttrXmlnsR write WriteXmlAttrXmlnsR; @@ -19,23 +19,36 @@ public function ReadXmlAttrXmlnsR(); function WriteXmlAttrXmlnsR(_value); + // empty property property Lang read ReadXmlChildLang write WriteXmlChildLang; function ReadXmlChildLang(); function WriteXmlChildLang(_value); + // normal property + property Date1904 read ReadXmlChildDate1904; + property AlternateContent read ReadXmlChildAlternateContent; + property Chart read ReadXmlChildChart; + property SpPr read ReadXmlChildSpPr; + property ExternalData read ReadXmlChildExternalData; + function ReadXmlChildDate1904(); + function ReadXmlChildAlternateContent(); + function ReadXmlChildChart(); + function ReadXmlChildSpPr(); + function ReadXmlChildExternalData(); + public - // Attributes + // Attributes XmlAttrXmlnsC: OpenXmlAttribute; XmlAttrXmlnsA: OpenXmlAttribute; XmlAttrXmlnsR: OpenXmlAttribute; // Children - Date1904: PureVal; + XmlChildDate1904: PureVal; XmlChildLang: OpenXmlEmpty; - AlternateContent: AlternateContent; - Chart: Chart; - SpPr: SpPr; - ExternalData: ExternalData; + XmlChildAlternateContent: AlternateContent; + XmlChildChart: Chart; + XmlChildSpPr: SpPr; + XmlChildExternalData: ExternalData; end; @@ -51,104 +64,54 @@ end; function ChartSpace.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function ChartSpace.Init();override; begin - {self.}XmlAttrXmlnsC := new OpenXmlAttribute("xmlns", "c", nil); - {self.}XmlAttrXmlnsA := new OpenXmlAttribute("xmlns", "a", nil); - {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "c", nil); - {self.}Date1904 := new PureVal(self, {self.}Prefix, "date1904"); - {self.}XmlChildLang := new PureVal(self, {self.}Prefix, "lang"); - {self.}AlternateContent := new AlternateContent(self, "mc", "AlternateContent"); - {self.}Chart := new Chart(self, {self.}Prefix, "chart"); - {self.}SpPr := new SpPr(self, {self.}Prefix, "spPr"); - {self.}ExternalData := new ExternalData(self, {self.}Prefix, "externalData"); -end; - -function ChartSpace.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXmlnsC, - {self.}XmlAttrXmlnsA, - {self.}XmlAttrXmlnsR, - ); -end; - -function ChartSpace.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Date1904, - 1: {self.}XmlChildLang, - 2: {self.}AlternateContent, - 3: {self.}Chart, - 4: {self.}SpPr, - 5: {self.}ExternalData, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns:c": makeweakref(thisFunction(WriteXmlAttrXmlnsC)), + "xmlns:a": makeweakref(thisFunction(WriteXmlAttrXmlnsA)), + "xmlns:c": makeweakref(thisFunction(WriteXmlAttrXmlnsR)), ); sorted_child_ := array( - "": -1, - {self.}Date1904.ElementName: 0, - {self.}XmlChildLang.ElementName: 1, - {self.}AlternateContent.ElementName: 2, - {self.}Chart.ElementName: 3, - {self.}SpPr.ElementName: 4, - {self.}ExternalData.ElementName: 5, + pre + "date1904": array(0, makeweakref(thisFunction(ReadXmlChildDate1904))), + pre + "lang": array(1, makeweakref(thisFunction(ReadXmlChildLang))), + "mc:AlternateContent": array(2, makeweakref(thisFunction(ReadXmlChildAlternateContent))), + pre + "chart": array(3, makeweakref(thisFunction(ReadXmlChildChart))), + pre + "spPr": array(4, makeweakref(thisFunction(ReadXmlChildSpPr))), + pre + "externalData": array(5, makeweakref(thisFunction(ReadXmlChildExternalData))), ); -end; - -function ChartSpace.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function ChartSpace.Copy(_obj: ChartSpace);override; begin - if not ifnil(_obj.XmlAttrXmlnsC.Value) then - {self.}XmlAttrXmlnsC.Value := _obj.XmlAttrXmlnsC.Value; - if not ifnil(_obj.XmlAttrXmlnsA.Value) then - {self.}XmlAttrXmlnsA.Value := _obj.XmlAttrXmlnsA.Value; - if not ifnil(_obj.XmlAttrXmlnsR.Value) then - {self.}XmlAttrXmlnsR.Value := _obj.XmlAttrXmlnsR.Value; - {self.}Date1904.Copy(_obj.Date1904); - {self.}XmlChildLang.Copy(_obj.XmlChildLang); - {self.}AlternateContent.Copy(_obj.AlternateContent); - {self.}Chart.Copy(_obj.Chart); - {self.}SpPr.Copy(_obj.SpPr); - {self.}ExternalData.Copy(_obj.ExternalData); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlnsC) then + {self.}XmlnsC := _obj.XmlnsC; + if not ifnil(_obj.XmlnsA) then + {self.}XmlnsA := _obj.XmlnsA; + if not ifnil(_obj.XmlnsR) then + {self.}XmlnsR := _obj.XmlnsR; + if not ifnil(_obj.XmlChildDate1904) then + {self.}Date1904.Copy(_obj.XmlChildDate1904); + if not ifnil(_obj.XmlChildLang) then + ifnil({self.}XmlChildLang) ? {self.}Lang.Copy(_obj.XmlChildLang) : {self.}XmlChildLang.Copy(_obj.XmlChildLang); + if not ifnil(_obj.XmlChildAlternateContent) then + {self.}AlternateContent.Copy(_obj.XmlChildAlternateContent); + if not ifnil(_obj.XmlChildChart) then + {self.}Chart.Copy(_obj.XmlChildChart); + if not ifnil(_obj.XmlChildSpPr) then + {self.}SpPr.Copy(_obj.XmlChildSpPr); + if not ifnil(_obj.XmlChildExternalData) then + {self.}ExternalData.Copy(_obj.XmlChildExternalData); + tslassigning := tslassigning_backup; end; function ChartSpace.ReadXmlAttrXmlnsC(); @@ -158,6 +121,11 @@ end; function ChartSpace.WriteXmlAttrXmlnsC(_value); begin + if ifnil({self.}XmlAttrXmlnsC) then + begin + {self.}XmlAttrXmlnsC := new OpenXmlAttribute("xmlns", "c", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsC; + end {self.}XmlAttrXmlnsC.Value := _value; end; @@ -168,6 +136,11 @@ end; function ChartSpace.WriteXmlAttrXmlnsA(_value); begin + if ifnil({self.}XmlAttrXmlnsA) then + begin + {self.}XmlAttrXmlnsA := new OpenXmlAttribute("xmlns", "a", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsA; + end {self.}XmlAttrXmlnsA.Value := _value; end; @@ -178,15 +151,81 @@ end; function ChartSpace.WriteXmlAttrXmlnsR(_value); begin + if ifnil({self.}XmlAttrXmlnsR) then + begin + {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "c", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsR; + end {self.}XmlAttrXmlnsR.Value := _value; end; function ChartSpace.ReadXmlChildLang(); begin - return ifnil({self.}XmlChildLang.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildLang) then + begin + {self.}XmlChildLang := new OpenXmlEmpty(self, {self.}Prefix, "lang"); + container_.Set({self.}XmlChildLang); + return {self.}XmlChildLang; + end + return {self.}XmlChildLang.BoolValue(); end; function ChartSpace.WriteXmlChildLang(_value); begin + if ifnil({self.}XmlChildLang) then + begin + {self.}XmlChildLang := new OpenXmlEmpty(self, {self.}Prefix, "lang"); + container_.Set({self.}XmlChildLang); + end {self.}XmlChildLang.Value := _value; end; + +function ChartSpace.ReadXmlChildDate1904(); +begin + if tslassigning and ifnil({self.}XmlChildDate1904) then + begin + {self.}XmlChildDate1904 := new PureVal(self, {self.}Prefix, "date1904"); + container_.Set({self.}XmlChildDate1904); + end + return {self.}XmlChildDate1904; +end; + +function ChartSpace.ReadXmlChildAlternateContent(); +begin + if tslassigning and ifnil({self.}XmlChildAlternateContent) then + begin + {self.}XmlChildAlternateContent := new AlternateContent(self, "mc", "AlternateContent"); + container_.Set({self.}XmlChildAlternateContent); + end + return {self.}XmlChildAlternateContent; +end; + +function ChartSpace.ReadXmlChildChart(); +begin + if tslassigning and ifnil({self.}XmlChildChart) then + begin + {self.}XmlChildChart := new Chart(self, {self.}Prefix, "chart"); + container_.Set({self.}XmlChildChart); + end + return {self.}XmlChildChart; +end; + +function ChartSpace.ReadXmlChildSpPr(); +begin + if tslassigning and ifnil({self.}XmlChildSpPr) then + begin + {self.}XmlChildSpPr := new SpPr(self, {self.}Prefix, "spPr"); + container_.Set({self.}XmlChildSpPr); + end + return {self.}XmlChildSpPr; +end; + +function ChartSpace.ReadXmlChildExternalData(); +begin + if tslassigning and ifnil({self.}XmlChildExternalData) then + begin + {self.}XmlChildExternalData := new ExternalData(self, {self.}Prefix, "externalData"); + container_.Set({self.}XmlChildExternalData); + end + return {self.}XmlChildExternalData; +end; diff --git a/autoclass/docx/Choice@DOCX.tsf b/autoclass/docx/Choice@DOCX.tsf index 3256f4c..f5bcce1 100644 --- a/autoclass/docx/Choice@DOCX.tsf +++ b/autoclass/docx/Choice@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Choice);override; +public + + // attributes property property Requires read ReadXmlAttrRequires write WriteXmlAttrRequires; property XmlnsC14 read ReadXmlAttrXmlnsC14 write WriteXmlAttrXmlnsC14; function ReadXmlAttrRequires(); @@ -16,14 +16,20 @@ public function ReadXmlAttrXmlnsC14(); function WriteXmlAttrXmlnsC14(_value); + // normal property + property Style read ReadXmlChildStyle; + property Drawing read ReadXmlChildDrawing; + function ReadXmlChildStyle(); + function ReadXmlChildDrawing(); + public - // Attributes + // Attributes XmlAttrRequires: OpenXmlAttribute; XmlAttrXmlnsC14: OpenXmlAttribute; // Children - Style: PureVal; - Drawing: Drawing; + XmlChildStyle: PureVal; + XmlChildDrawing: Drawing; end; @@ -39,84 +45,39 @@ end; function Choice.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Choice.Init();override; begin - {self.}XmlAttrRequires := new OpenXmlAttribute(nil, "Requires", nil); - {self.}XmlAttrXmlnsC14 := new OpenXmlAttribute("xmlns", "c14", nil); - {self.}Style := new PureVal(self, "c14", "style"); - {self.}Drawing := new Drawing(self, "w", "drawing"); -end; - -function Choice.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrRequires, - {self.}XmlAttrXmlnsC14, - ); -end; - -function Choice.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Style, - 1: {self.}Drawing, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "Requires": makeweakref(thisFunction(WriteXmlAttrRequires)), + "xmlns:c14": makeweakref(thisFunction(WriteXmlAttrXmlnsC14)), ); sorted_child_ := array( - "": -1, - {self.}Style.ElementName: 0, - {self.}Drawing.ElementName: 1, + "c14:style": array(0, makeweakref(thisFunction(ReadXmlChildStyle))), + "w:drawing": array(1, makeweakref(thisFunction(ReadXmlChildDrawing))), ); -end; - -function Choice.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Choice.Copy(_obj: Choice);override; begin - if not ifnil(_obj.XmlAttrRequires.Value) then - {self.}XmlAttrRequires.Value := _obj.XmlAttrRequires.Value; - if not ifnil(_obj.XmlAttrXmlnsC14.Value) then - {self.}XmlAttrXmlnsC14.Value := _obj.XmlAttrXmlnsC14.Value; - {self.}Style.Copy(_obj.Style); - {self.}Drawing.Copy(_obj.Drawing); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Requires) then + {self.}Requires := _obj.Requires; + if not ifnil(_obj.XmlnsC14) then + {self.}XmlnsC14 := _obj.XmlnsC14; + if not ifnil(_obj.XmlChildStyle) then + {self.}Style.Copy(_obj.XmlChildStyle); + if not ifnil(_obj.XmlChildDrawing) then + {self.}Drawing.Copy(_obj.XmlChildDrawing); + tslassigning := tslassigning_backup; end; function Choice.ReadXmlAttrRequires(); @@ -126,6 +87,11 @@ end; function Choice.WriteXmlAttrRequires(_value); begin + if ifnil({self.}XmlAttrRequires) then + begin + {self.}XmlAttrRequires := new OpenXmlAttribute("", "Requires", nil); + attributes_[length(attributes_)] := {self.}XmlAttrRequires; + end {self.}XmlAttrRequires.Value := _value; end; @@ -136,5 +102,30 @@ end; function Choice.WriteXmlAttrXmlnsC14(_value); begin + if ifnil({self.}XmlAttrXmlnsC14) then + begin + {self.}XmlAttrXmlnsC14 := new OpenXmlAttribute("xmlns", "c14", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsC14; + end {self.}XmlAttrXmlnsC14.Value := _value; end; + +function Choice.ReadXmlChildStyle(); +begin + if tslassigning and ifnil({self.}XmlChildStyle) then + begin + {self.}XmlChildStyle := new PureVal(self, "c14", "style"); + container_.Set({self.}XmlChildStyle); + end + return {self.}XmlChildStyle; +end; + +function Choice.ReadXmlChildDrawing(); +begin + if tslassigning and ifnil({self.}XmlChildDrawing) then + begin + {self.}XmlChildDrawing := new Drawing(self, "w", "drawing"); + container_.Set({self.}XmlChildDrawing); + end + return {self.}XmlChildDrawing; +end; diff --git a/autoclass/docx/Clr1@DOCX.tsf b/autoclass/docx/Clr1@DOCX.tsf index e350752..45fcc43 100644 --- a/autoclass/docx/Clr1@DOCX.tsf +++ b/autoclass/docx/Clr1@DOCX.tsf @@ -4,16 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Clr1);override; public - // Attributes + // normal property + property SysClr read ReadXmlChildSysClr; + function ReadXmlChildSysClr(); + +public // Children - SysClr: SysClr; + XmlChildSysClr: SysClr; end; @@ -29,70 +30,38 @@ end; function Clr1.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Clr1.Init();override; begin - {self.}SysClr := new SysClr(self, {self.}Prefix, "sysClr"); -end; - -function Clr1.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Clr1.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}SysClr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}SysClr.ElementName: 0, + pre + "sysClr": array(0, makeweakref(thisFunction(ReadXmlChildSysClr))), ); -end; - -function Clr1.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Clr1.Copy(_obj: Clr1);override; begin - {self.}SysClr.Copy(_obj.SysClr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildSysClr) then + {self.}SysClr.Copy(_obj.XmlChildSysClr); + tslassigning := tslassigning_backup; +end; + +function Clr1.ReadXmlChildSysClr(); +begin + if tslassigning and ifnil({self.}XmlChildSysClr) then + begin + {self.}XmlChildSysClr := new SysClr(self, {self.}Prefix, "sysClr"); + container_.Set({self.}XmlChildSysClr); + end + return {self.}XmlChildSysClr; end; diff --git a/autoclass/docx/Clr2@DOCX.tsf b/autoclass/docx/Clr2@DOCX.tsf index 8c6c142..d6fe8b3 100644 --- a/autoclass/docx/Clr2@DOCX.tsf +++ b/autoclass/docx/Clr2@DOCX.tsf @@ -4,16 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Clr2);override; public - // Attributes + // normal property + property SrgbClr read ReadXmlChildSrgbClr; + function ReadXmlChildSrgbClr(); + +public // Children - SrgbClr: SrgbClr; + XmlChildSrgbClr: SrgbClr; end; @@ -29,70 +30,38 @@ end; function Clr2.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Clr2.Init();override; begin - {self.}SrgbClr := new SrgbClr(self, {self.}Prefix, "srgbClr"); -end; - -function Clr2.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Clr2.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}SrgbClr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}SrgbClr.ElementName: 0, + pre + "srgbClr": array(0, makeweakref(thisFunction(ReadXmlChildSrgbClr))), ); -end; - -function Clr2.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Clr2.Copy(_obj: Clr2);override; begin - {self.}SrgbClr.Copy(_obj.SrgbClr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildSrgbClr) then + {self.}SrgbClr.Copy(_obj.XmlChildSrgbClr); + tslassigning := tslassigning_backup; +end; + +function Clr2.ReadXmlChildSrgbClr(); +begin + if tslassigning and ifnil({self.}XmlChildSrgbClr) then + begin + {self.}XmlChildSrgbClr := new SrgbClr(self, {self.}Prefix, "srgbClr"); + container_.Set({self.}XmlChildSrgbClr); + end + return {self.}XmlChildSrgbClr; end; diff --git a/autoclass/docx/ClrScheme@DOCX.tsf b/autoclass/docx/ClrScheme@DOCX.tsf index a3d98bb..aab69c8 100644 --- a/autoclass/docx/ClrScheme@DOCX.tsf +++ b/autoclass/docx/ClrScheme@DOCX.tsf @@ -4,32 +4,58 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: ClrScheme);override; +public + + // attributes property property Name read ReadXmlAttrName write WriteXmlAttrName; function ReadXmlAttrName(); function WriteXmlAttrName(_value); + // normal property + property Dk1 read ReadXmlChildDk1; + property Lt1 read ReadXmlChildLt1; + property Dk2 read ReadXmlChildDk2; + property Lt2 read ReadXmlChildLt2; + property Accent1 read ReadXmlChildAccent1; + property Accent2 read ReadXmlChildAccent2; + property Accent3 read ReadXmlChildAccent3; + property Accent4 read ReadXmlChildAccent4; + property Accent5 read ReadXmlChildAccent5; + property Accent6 read ReadXmlChildAccent6; + property Hlink read ReadXmlChildHlink; + property FolHlink read ReadXmlChildFolHlink; + function ReadXmlChildDk1(); + function ReadXmlChildLt1(); + function ReadXmlChildDk2(); + function ReadXmlChildLt2(); + function ReadXmlChildAccent1(); + function ReadXmlChildAccent2(); + function ReadXmlChildAccent3(); + function ReadXmlChildAccent4(); + function ReadXmlChildAccent5(); + function ReadXmlChildAccent6(); + function ReadXmlChildHlink(); + function ReadXmlChildFolHlink(); + public - // Attributes + // Attributes XmlAttrName: OpenXmlAttribute; // Children - Dk1: Clr1; - Lt1: Clr1; - Dk2: Clr2; - Lt2: Clr2; - Accent1: Clr2; - Accent2: Clr2; - Accent3: Clr2; - Accent4: Clr2; - Accent5: Clr2; - Accent6: Clr2; - Hlink: Clr2; - FolHlink: Clr2; + XmlChildDk1: Clr1; + XmlChildLt1: Clr1; + XmlChildDk2: Clr2; + XmlChildLt2: Clr2; + XmlChildAccent1: Clr2; + XmlChildAccent2: Clr2; + XmlChildAccent3: Clr2; + XmlChildAccent4: Clr2; + XmlChildAccent5: Clr2; + XmlChildAccent6: Clr2; + XmlChildHlink: Clr2; + XmlChildFolHlink: Clr2; end; @@ -45,120 +71,66 @@ end; function ClrScheme.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function ClrScheme.Init();override; begin - {self.}XmlAttrName := new OpenXmlAttribute(nil, "name", nil); - {self.}Dk1 := new Clr1(self, {self.}Prefix, "dk1"); - {self.}Lt1 := new Clr1(self, {self.}Prefix, "lt1"); - {self.}Dk2 := new Clr2(self, {self.}Prefix, "dk2"); - {self.}Lt2 := new Clr2(self, {self.}Prefix, "lt2"); - {self.}Accent1 := new Clr2(self, {self.}Prefix, "accent1"); - {self.}Accent2 := new Clr2(self, {self.}Prefix, "accent2"); - {self.}Accent3 := new Clr2(self, {self.}Prefix, "accent3"); - {self.}Accent4 := new Clr2(self, {self.}Prefix, "accent4"); - {self.}Accent5 := new Clr2(self, {self.}Prefix, "accent5"); - {self.}Accent6 := new Clr2(self, {self.}Prefix, "accent6"); - {self.}Hlink := new Clr2(self, {self.}Prefix, "hlink"); - {self.}FolHlink := new Clr2(self, {self.}Prefix, "folHlink"); -end; - -function ClrScheme.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrName, - ); -end; - -function ClrScheme.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Dk1, - 1: {self.}Lt1, - 2: {self.}Dk2, - 3: {self.}Lt2, - 4: {self.}Accent1, - 5: {self.}Accent2, - 6: {self.}Accent3, - 7: {self.}Accent4, - 8: {self.}Accent5, - 9: {self.}Accent6, - 10: {self.}Hlink, - 11: {self.}FolHlink, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "name": makeweakref(thisFunction(WriteXmlAttrName)), ); sorted_child_ := array( - "": -1, - {self.}Dk1.ElementName: 0, - {self.}Lt1.ElementName: 1, - {self.}Dk2.ElementName: 2, - {self.}Lt2.ElementName: 3, - {self.}Accent1.ElementName: 4, - {self.}Accent2.ElementName: 5, - {self.}Accent3.ElementName: 6, - {self.}Accent4.ElementName: 7, - {self.}Accent5.ElementName: 8, - {self.}Accent6.ElementName: 9, - {self.}Hlink.ElementName: 10, - {self.}FolHlink.ElementName: 11, + pre + "dk1": array(0, makeweakref(thisFunction(ReadXmlChildDk1))), + pre + "lt1": array(1, makeweakref(thisFunction(ReadXmlChildLt1))), + pre + "dk2": array(2, makeweakref(thisFunction(ReadXmlChildDk2))), + pre + "lt2": array(3, makeweakref(thisFunction(ReadXmlChildLt2))), + pre + "accent1": array(4, makeweakref(thisFunction(ReadXmlChildAccent1))), + pre + "accent2": array(5, makeweakref(thisFunction(ReadXmlChildAccent2))), + pre + "accent3": array(6, makeweakref(thisFunction(ReadXmlChildAccent3))), + pre + "accent4": array(7, makeweakref(thisFunction(ReadXmlChildAccent4))), + pre + "accent5": array(8, makeweakref(thisFunction(ReadXmlChildAccent5))), + pre + "accent6": array(9, makeweakref(thisFunction(ReadXmlChildAccent6))), + pre + "hlink": array(10, makeweakref(thisFunction(ReadXmlChildHlink))), + pre + "folHlink": array(11, makeweakref(thisFunction(ReadXmlChildFolHlink))), ); -end; - -function ClrScheme.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function ClrScheme.Copy(_obj: ClrScheme);override; begin - if not ifnil(_obj.XmlAttrName.Value) then - {self.}XmlAttrName.Value := _obj.XmlAttrName.Value; - {self.}Dk1.Copy(_obj.Dk1); - {self.}Lt1.Copy(_obj.Lt1); - {self.}Dk2.Copy(_obj.Dk2); - {self.}Lt2.Copy(_obj.Lt2); - {self.}Accent1.Copy(_obj.Accent1); - {self.}Accent2.Copy(_obj.Accent2); - {self.}Accent3.Copy(_obj.Accent3); - {self.}Accent4.Copy(_obj.Accent4); - {self.}Accent5.Copy(_obj.Accent5); - {self.}Accent6.Copy(_obj.Accent6); - {self.}Hlink.Copy(_obj.Hlink); - {self.}FolHlink.Copy(_obj.FolHlink); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Name) then + {self.}Name := _obj.Name; + if not ifnil(_obj.XmlChildDk1) then + {self.}Dk1.Copy(_obj.XmlChildDk1); + if not ifnil(_obj.XmlChildLt1) then + {self.}Lt1.Copy(_obj.XmlChildLt1); + if not ifnil(_obj.XmlChildDk2) then + {self.}Dk2.Copy(_obj.XmlChildDk2); + if not ifnil(_obj.XmlChildLt2) then + {self.}Lt2.Copy(_obj.XmlChildLt2); + if not ifnil(_obj.XmlChildAccent1) then + {self.}Accent1.Copy(_obj.XmlChildAccent1); + if not ifnil(_obj.XmlChildAccent2) then + {self.}Accent2.Copy(_obj.XmlChildAccent2); + if not ifnil(_obj.XmlChildAccent3) then + {self.}Accent3.Copy(_obj.XmlChildAccent3); + if not ifnil(_obj.XmlChildAccent4) then + {self.}Accent4.Copy(_obj.XmlChildAccent4); + if not ifnil(_obj.XmlChildAccent5) then + {self.}Accent5.Copy(_obj.XmlChildAccent5); + if not ifnil(_obj.XmlChildAccent6) then + {self.}Accent6.Copy(_obj.XmlChildAccent6); + if not ifnil(_obj.XmlChildHlink) then + {self.}Hlink.Copy(_obj.XmlChildHlink); + if not ifnil(_obj.XmlChildFolHlink) then + {self.}FolHlink.Copy(_obj.XmlChildFolHlink); + tslassigning := tslassigning_backup; end; function ClrScheme.ReadXmlAttrName(); @@ -168,5 +140,130 @@ end; function ClrScheme.WriteXmlAttrName(_value); begin + if ifnil({self.}XmlAttrName) then + begin + {self.}XmlAttrName := new OpenXmlAttribute("", "name", nil); + attributes_[length(attributes_)] := {self.}XmlAttrName; + end {self.}XmlAttrName.Value := _value; end; + +function ClrScheme.ReadXmlChildDk1(); +begin + if tslassigning and ifnil({self.}XmlChildDk1) then + begin + {self.}XmlChildDk1 := new Clr1(self, {self.}Prefix, "dk1"); + container_.Set({self.}XmlChildDk1); + end + return {self.}XmlChildDk1; +end; + +function ClrScheme.ReadXmlChildLt1(); +begin + if tslassigning and ifnil({self.}XmlChildLt1) then + begin + {self.}XmlChildLt1 := new Clr1(self, {self.}Prefix, "lt1"); + container_.Set({self.}XmlChildLt1); + end + return {self.}XmlChildLt1; +end; + +function ClrScheme.ReadXmlChildDk2(); +begin + if tslassigning and ifnil({self.}XmlChildDk2) then + begin + {self.}XmlChildDk2 := new Clr2(self, {self.}Prefix, "dk2"); + container_.Set({self.}XmlChildDk2); + end + return {self.}XmlChildDk2; +end; + +function ClrScheme.ReadXmlChildLt2(); +begin + if tslassigning and ifnil({self.}XmlChildLt2) then + begin + {self.}XmlChildLt2 := new Clr2(self, {self.}Prefix, "lt2"); + container_.Set({self.}XmlChildLt2); + end + return {self.}XmlChildLt2; +end; + +function ClrScheme.ReadXmlChildAccent1(); +begin + if tslassigning and ifnil({self.}XmlChildAccent1) then + begin + {self.}XmlChildAccent1 := new Clr2(self, {self.}Prefix, "accent1"); + container_.Set({self.}XmlChildAccent1); + end + return {self.}XmlChildAccent1; +end; + +function ClrScheme.ReadXmlChildAccent2(); +begin + if tslassigning and ifnil({self.}XmlChildAccent2) then + begin + {self.}XmlChildAccent2 := new Clr2(self, {self.}Prefix, "accent2"); + container_.Set({self.}XmlChildAccent2); + end + return {self.}XmlChildAccent2; +end; + +function ClrScheme.ReadXmlChildAccent3(); +begin + if tslassigning and ifnil({self.}XmlChildAccent3) then + begin + {self.}XmlChildAccent3 := new Clr2(self, {self.}Prefix, "accent3"); + container_.Set({self.}XmlChildAccent3); + end + return {self.}XmlChildAccent3; +end; + +function ClrScheme.ReadXmlChildAccent4(); +begin + if tslassigning and ifnil({self.}XmlChildAccent4) then + begin + {self.}XmlChildAccent4 := new Clr2(self, {self.}Prefix, "accent4"); + container_.Set({self.}XmlChildAccent4); + end + return {self.}XmlChildAccent4; +end; + +function ClrScheme.ReadXmlChildAccent5(); +begin + if tslassigning and ifnil({self.}XmlChildAccent5) then + begin + {self.}XmlChildAccent5 := new Clr2(self, {self.}Prefix, "accent5"); + container_.Set({self.}XmlChildAccent5); + end + return {self.}XmlChildAccent5; +end; + +function ClrScheme.ReadXmlChildAccent6(); +begin + if tslassigning and ifnil({self.}XmlChildAccent6) then + begin + {self.}XmlChildAccent6 := new Clr2(self, {self.}Prefix, "accent6"); + container_.Set({self.}XmlChildAccent6); + end + return {self.}XmlChildAccent6; +end; + +function ClrScheme.ReadXmlChildHlink(); +begin + if tslassigning and ifnil({self.}XmlChildHlink) then + begin + {self.}XmlChildHlink := new Clr2(self, {self.}Prefix, "hlink"); + container_.Set({self.}XmlChildHlink); + end + return {self.}XmlChildHlink; +end; + +function ClrScheme.ReadXmlChildFolHlink(); +begin + if tslassigning and ifnil({self.}XmlChildFolHlink) then + begin + {self.}XmlChildFolHlink := new Clr2(self, {self.}Prefix, "folHlink"); + container_.Set({self.}XmlChildFolHlink); + end + return {self.}XmlChildFolHlink; +end; diff --git a/autoclass/docx/ClrSchemeMapping@DOCX.tsf b/autoclass/docx/ClrSchemeMapping@DOCX.tsf index bbe3195..8eea95c 100644 --- a/autoclass/docx/ClrSchemeMapping@DOCX.tsf +++ b/autoclass/docx/ClrSchemeMapping@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: ClrSchemeMapping);override; +public + + // attributes property property Bg1 read ReadXmlAttrBg1 write WriteXmlAttrBg1; property T1 read ReadXmlAttrT1 write WriteXmlAttrT1; property Bg2 read ReadXmlAttrBg2 write WriteXmlAttrBg2; @@ -47,7 +47,7 @@ public function WriteXmlAttrFollowedHyperlink(_value); public - // Attributes + // Attributes XmlAttrBg1: OpenXmlAttribute; XmlAttrT1: OpenXmlAttribute; XmlAttrBg2: OpenXmlAttribute; @@ -61,7 +61,6 @@ public XmlAttrHyperLink: OpenXmlAttribute; XmlAttrFollowedHyperlink: OpenXmlAttribute; - // Children end; @@ -77,85 +76,63 @@ end; function ClrSchemeMapping.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function ClrSchemeMapping.Init();override; begin - {self.}XmlAttrBg1 := new OpenXmlAttribute({self.}Prefix, "bg1", nil); - {self.}XmlAttrT1 := new OpenXmlAttribute({self.}Prefix, "t1", nil); - {self.}XmlAttrBg2 := new OpenXmlAttribute({self.}Prefix, "bg2", nil); - {self.}XmlAttrT2 := new OpenXmlAttribute({self.}Prefix, "t2", nil); - {self.}XmlAttrAccent1 := new OpenXmlAttribute({self.}Prefix, "accent1", nil); - {self.}XmlAttrAccent2 := new OpenXmlAttribute({self.}Prefix, "accent2", nil); - {self.}XmlAttrAccent3 := new OpenXmlAttribute({self.}Prefix, "accent3", nil); - {self.}XmlAttrAccent4 := new OpenXmlAttribute({self.}Prefix, "accent4", nil); - {self.}XmlAttrAccent5 := new OpenXmlAttribute({self.}Prefix, "accent5", nil); - {self.}XmlAttrAccent6 := new OpenXmlAttribute({self.}Prefix, "accent6", nil); - {self.}XmlAttrHyperLink := new OpenXmlAttribute({self.}Prefix, "hyperlink", nil); - {self.}XmlAttrFollowedHyperlink := new OpenXmlAttribute({self.}Prefix, "followedHyperlink", nil); -end; - -function ClrSchemeMapping.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrBg1, - {self.}XmlAttrT1, - {self.}XmlAttrBg2, - {self.}XmlAttrT2, - {self.}XmlAttrAccent1, - {self.}XmlAttrAccent2, - {self.}XmlAttrAccent3, - {self.}XmlAttrAccent4, - {self.}XmlAttrAccent5, - {self.}XmlAttrAccent6, - {self.}XmlAttrHyperLink, - {self.}XmlAttrFollowedHyperlink, - ); -end; - -function ClrSchemeMapping.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "bg1": makeweakref(thisFunction(WriteXmlAttrBg1)), + pre + "t1": makeweakref(thisFunction(WriteXmlAttrT1)), + pre + "bg2": makeweakref(thisFunction(WriteXmlAttrBg2)), + pre + "t2": makeweakref(thisFunction(WriteXmlAttrT2)), + pre + "accent1": makeweakref(thisFunction(WriteXmlAttrAccent1)), + pre + "accent2": makeweakref(thisFunction(WriteXmlAttrAccent2)), + pre + "accent3": makeweakref(thisFunction(WriteXmlAttrAccent3)), + pre + "accent4": makeweakref(thisFunction(WriteXmlAttrAccent4)), + pre + "accent5": makeweakref(thisFunction(WriteXmlAttrAccent5)), + pre + "accent6": makeweakref(thisFunction(WriteXmlAttrAccent6)), + pre + "hyperlink": makeweakref(thisFunction(WriteXmlAttrHyperLink)), + pre + "followedHyperlink": makeweakref(thisFunction(WriteXmlAttrFollowedHyperlink)), ); sorted_child_ := array( - "": -1, ); -end; - -function ClrSchemeMapping.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function ClrSchemeMapping.Copy(_obj: ClrSchemeMapping);override; begin - if not ifnil(_obj.XmlAttrBg1.Value) then - {self.}XmlAttrBg1.Value := _obj.XmlAttrBg1.Value; - if not ifnil(_obj.XmlAttrT1.Value) then - {self.}XmlAttrT1.Value := _obj.XmlAttrT1.Value; - if not ifnil(_obj.XmlAttrBg2.Value) then - {self.}XmlAttrBg2.Value := _obj.XmlAttrBg2.Value; - if not ifnil(_obj.XmlAttrT2.Value) then - {self.}XmlAttrT2.Value := _obj.XmlAttrT2.Value; - if not ifnil(_obj.XmlAttrAccent1.Value) then - {self.}XmlAttrAccent1.Value := _obj.XmlAttrAccent1.Value; - if not ifnil(_obj.XmlAttrAccent2.Value) then - {self.}XmlAttrAccent2.Value := _obj.XmlAttrAccent2.Value; - if not ifnil(_obj.XmlAttrAccent3.Value) then - {self.}XmlAttrAccent3.Value := _obj.XmlAttrAccent3.Value; - if not ifnil(_obj.XmlAttrAccent4.Value) then - {self.}XmlAttrAccent4.Value := _obj.XmlAttrAccent4.Value; - if not ifnil(_obj.XmlAttrAccent5.Value) then - {self.}XmlAttrAccent5.Value := _obj.XmlAttrAccent5.Value; - if not ifnil(_obj.XmlAttrAccent6.Value) then - {self.}XmlAttrAccent6.Value := _obj.XmlAttrAccent6.Value; - if not ifnil(_obj.XmlAttrHyperLink.Value) then - {self.}XmlAttrHyperLink.Value := _obj.XmlAttrHyperLink.Value; - if not ifnil(_obj.XmlAttrFollowedHyperlink.Value) then - {self.}XmlAttrFollowedHyperlink.Value := _obj.XmlAttrFollowedHyperlink.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Bg1) then + {self.}Bg1 := _obj.Bg1; + if not ifnil(_obj.T1) then + {self.}T1 := _obj.T1; + if not ifnil(_obj.Bg2) then + {self.}Bg2 := _obj.Bg2; + if not ifnil(_obj.T2) then + {self.}T2 := _obj.T2; + if not ifnil(_obj.Accent1) then + {self.}Accent1 := _obj.Accent1; + if not ifnil(_obj.Accent2) then + {self.}Accent2 := _obj.Accent2; + if not ifnil(_obj.Accent3) then + {self.}Accent3 := _obj.Accent3; + if not ifnil(_obj.Accent4) then + {self.}Accent4 := _obj.Accent4; + if not ifnil(_obj.Accent5) then + {self.}Accent5 := _obj.Accent5; + if not ifnil(_obj.Accent6) then + {self.}Accent6 := _obj.Accent6; + if not ifnil(_obj.HyperLink) then + {self.}HyperLink := _obj.HyperLink; + if not ifnil(_obj.FollowedHyperlink) then + {self.}FollowedHyperlink := _obj.FollowedHyperlink; + tslassigning := tslassigning_backup; end; function ClrSchemeMapping.ReadXmlAttrBg1(); @@ -165,6 +142,11 @@ end; function ClrSchemeMapping.WriteXmlAttrBg1(_value); begin + if ifnil({self.}XmlAttrBg1) then + begin + {self.}XmlAttrBg1 := new OpenXmlAttribute({self.}Prefix, "bg1", nil); + attributes_[length(attributes_)] := {self.}XmlAttrBg1; + end {self.}XmlAttrBg1.Value := _value; end; @@ -175,6 +157,11 @@ end; function ClrSchemeMapping.WriteXmlAttrT1(_value); begin + if ifnil({self.}XmlAttrT1) then + begin + {self.}XmlAttrT1 := new OpenXmlAttribute({self.}Prefix, "t1", nil); + attributes_[length(attributes_)] := {self.}XmlAttrT1; + end {self.}XmlAttrT1.Value := _value; end; @@ -185,6 +172,11 @@ end; function ClrSchemeMapping.WriteXmlAttrBg2(_value); begin + if ifnil({self.}XmlAttrBg2) then + begin + {self.}XmlAttrBg2 := new OpenXmlAttribute({self.}Prefix, "bg2", nil); + attributes_[length(attributes_)] := {self.}XmlAttrBg2; + end {self.}XmlAttrBg2.Value := _value; end; @@ -195,6 +187,11 @@ end; function ClrSchemeMapping.WriteXmlAttrT2(_value); begin + if ifnil({self.}XmlAttrT2) then + begin + {self.}XmlAttrT2 := new OpenXmlAttribute({self.}Prefix, "t2", nil); + attributes_[length(attributes_)] := {self.}XmlAttrT2; + end {self.}XmlAttrT2.Value := _value; end; @@ -205,6 +202,11 @@ end; function ClrSchemeMapping.WriteXmlAttrAccent1(_value); begin + if ifnil({self.}XmlAttrAccent1) then + begin + {self.}XmlAttrAccent1 := new OpenXmlAttribute({self.}Prefix, "accent1", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAccent1; + end {self.}XmlAttrAccent1.Value := _value; end; @@ -215,6 +217,11 @@ end; function ClrSchemeMapping.WriteXmlAttrAccent2(_value); begin + if ifnil({self.}XmlAttrAccent2) then + begin + {self.}XmlAttrAccent2 := new OpenXmlAttribute({self.}Prefix, "accent2", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAccent2; + end {self.}XmlAttrAccent2.Value := _value; end; @@ -225,6 +232,11 @@ end; function ClrSchemeMapping.WriteXmlAttrAccent3(_value); begin + if ifnil({self.}XmlAttrAccent3) then + begin + {self.}XmlAttrAccent3 := new OpenXmlAttribute({self.}Prefix, "accent3", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAccent3; + end {self.}XmlAttrAccent3.Value := _value; end; @@ -235,6 +247,11 @@ end; function ClrSchemeMapping.WriteXmlAttrAccent4(_value); begin + if ifnil({self.}XmlAttrAccent4) then + begin + {self.}XmlAttrAccent4 := new OpenXmlAttribute({self.}Prefix, "accent4", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAccent4; + end {self.}XmlAttrAccent4.Value := _value; end; @@ -245,6 +262,11 @@ end; function ClrSchemeMapping.WriteXmlAttrAccent5(_value); begin + if ifnil({self.}XmlAttrAccent5) then + begin + {self.}XmlAttrAccent5 := new OpenXmlAttribute({self.}Prefix, "accent5", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAccent5; + end {self.}XmlAttrAccent5.Value := _value; end; @@ -255,6 +277,11 @@ end; function ClrSchemeMapping.WriteXmlAttrAccent6(_value); begin + if ifnil({self.}XmlAttrAccent6) then + begin + {self.}XmlAttrAccent6 := new OpenXmlAttribute({self.}Prefix, "accent6", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAccent6; + end {self.}XmlAttrAccent6.Value := _value; end; @@ -265,6 +292,11 @@ end; function ClrSchemeMapping.WriteXmlAttrHyperLink(_value); begin + if ifnil({self.}XmlAttrHyperLink) then + begin + {self.}XmlAttrHyperLink := new OpenXmlAttribute({self.}Prefix, "hyperlink", nil); + attributes_[length(attributes_)] := {self.}XmlAttrHyperLink; + end {self.}XmlAttrHyperLink.Value := _value; end; @@ -275,5 +307,10 @@ end; function ClrSchemeMapping.WriteXmlAttrFollowedHyperlink(_value); begin + if ifnil({self.}XmlAttrFollowedHyperlink) then + begin + {self.}XmlAttrFollowedHyperlink := new OpenXmlAttribute({self.}Prefix, "followedHyperlink", nil); + attributes_[length(attributes_)] := {self.}XmlAttrFollowedHyperlink; + end {self.}XmlAttrFollowedHyperlink.Value := _value; end; diff --git a/autoclass/docx/CnfStyle@DOCX.tsf b/autoclass/docx/CnfStyle@DOCX.tsf index d553fae..816a182 100644 --- a/autoclass/docx/CnfStyle@DOCX.tsf +++ b/autoclass/docx/CnfStyle@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: CnfStyle);override; +public + + // attributes property property Val read ReadXmlAttrVal write WriteXmlAttrVal; property FirstRow read ReadXmlAttrFirstRow write WriteXmlAttrFirstRow; property LastRow read ReadXmlAttrLastRow write WriteXmlAttrLastRow; @@ -50,7 +50,7 @@ public function WriteXmlAttrLastRowLastColumn(_value); public - // Attributes + // Attributes XmlAttrVal: OpenXmlAttribute; XmlAttrFirstRow: OpenXmlAttribute; XmlAttrLastRow: OpenXmlAttribute; @@ -65,7 +65,6 @@ public XmlAttrLastRowFirstColumn: OpenXmlAttribute; XmlAttrLastRowLastColumn: OpenXmlAttribute; - // Children end; @@ -81,89 +80,66 @@ end; function CnfStyle.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function CnfStyle.Init();override; begin - {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); - {self.}XmlAttrFirstRow := new OpenXmlAttribute({self.}Prefix, "firstRow", nil); - {self.}XmlAttrLastRow := new OpenXmlAttribute({self.}Prefix, "lastRow", nil); - {self.}XmlAttrFirstColumn := new OpenXmlAttribute({self.}Prefix, "firstColumn", nil); - {self.}XmlAttrLastColumn := new OpenXmlAttribute({self.}Prefix, "lastColumn", nil); - {self.}XmlAttrOddVBand := new OpenXmlAttribute({self.}Prefix, "oddVBand", nil); - {self.}XmlAttrEvenVBand := new OpenXmlAttribute({self.}Prefix, "evenVBand", nil); - {self.}XmlAttrOddHBand := new OpenXmlAttribute({self.}Prefix, "oddHBand", nil); - {self.}XmlAttrEvenHBand := new OpenXmlAttribute({self.}Prefix, "evenHBand", nil); - {self.}XmlAttrFirstRowFirstColumn := new OpenXmlAttribute({self.}Prefix, "firstRowFirstColumn", nil); - {self.}XmlAttrFirstRowLastColumn := new OpenXmlAttribute({self.}Prefix, "firstRowLastColumn", nil); - {self.}XmlAttrLastRowFirstColumn := new OpenXmlAttribute({self.}Prefix, "lastRowFirstColumn", nil); - {self.}XmlAttrLastRowLastColumn := new OpenXmlAttribute({self.}Prefix, "lastRowLastColumn", nil); -end; - -function CnfStyle.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrVal, - {self.}XmlAttrFirstRow, - {self.}XmlAttrLastRow, - {self.}XmlAttrFirstColumn, - {self.}XmlAttrLastColumn, - {self.}XmlAttrOddVBand, - {self.}XmlAttrEvenVBand, - {self.}XmlAttrOddHBand, - {self.}XmlAttrEvenHBand, - {self.}XmlAttrFirstRowFirstColumn, - {self.}XmlAttrFirstRowLastColumn, - {self.}XmlAttrLastRowFirstColumn, - {self.}XmlAttrLastRowLastColumn, - ); -end; - -function CnfStyle.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "val": makeweakref(thisFunction(WriteXmlAttrVal)), + pre + "firstRow": makeweakref(thisFunction(WriteXmlAttrFirstRow)), + pre + "lastRow": makeweakref(thisFunction(WriteXmlAttrLastRow)), + pre + "firstColumn": makeweakref(thisFunction(WriteXmlAttrFirstColumn)), + pre + "lastColumn": makeweakref(thisFunction(WriteXmlAttrLastColumn)), + pre + "oddVBand": makeweakref(thisFunction(WriteXmlAttrOddVBand)), + pre + "evenVBand": makeweakref(thisFunction(WriteXmlAttrEvenVBand)), + pre + "oddHBand": makeweakref(thisFunction(WriteXmlAttrOddHBand)), + pre + "evenHBand": makeweakref(thisFunction(WriteXmlAttrEvenHBand)), + pre + "firstRowFirstColumn": makeweakref(thisFunction(WriteXmlAttrFirstRowFirstColumn)), + pre + "firstRowLastColumn": makeweakref(thisFunction(WriteXmlAttrFirstRowLastColumn)), + pre + "lastRowFirstColumn": makeweakref(thisFunction(WriteXmlAttrLastRowFirstColumn)), + pre + "lastRowLastColumn": makeweakref(thisFunction(WriteXmlAttrLastRowLastColumn)), ); sorted_child_ := array( - "": -1, ); -end; - -function CnfStyle.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function CnfStyle.Copy(_obj: CnfStyle);override; begin - if not ifnil(_obj.XmlAttrVal.Value) then - {self.}XmlAttrVal.Value := _obj.XmlAttrVal.Value; - if not ifnil(_obj.XmlAttrFirstRow.Value) then - {self.}XmlAttrFirstRow.Value := _obj.XmlAttrFirstRow.Value; - if not ifnil(_obj.XmlAttrLastRow.Value) then - {self.}XmlAttrLastRow.Value := _obj.XmlAttrLastRow.Value; - if not ifnil(_obj.XmlAttrFirstColumn.Value) then - {self.}XmlAttrFirstColumn.Value := _obj.XmlAttrFirstColumn.Value; - if not ifnil(_obj.XmlAttrLastColumn.Value) then - {self.}XmlAttrLastColumn.Value := _obj.XmlAttrLastColumn.Value; - if not ifnil(_obj.XmlAttrOddVBand.Value) then - {self.}XmlAttrOddVBand.Value := _obj.XmlAttrOddVBand.Value; - if not ifnil(_obj.XmlAttrEvenVBand.Value) then - {self.}XmlAttrEvenVBand.Value := _obj.XmlAttrEvenVBand.Value; - if not ifnil(_obj.XmlAttrOddHBand.Value) then - {self.}XmlAttrOddHBand.Value := _obj.XmlAttrOddHBand.Value; - if not ifnil(_obj.XmlAttrEvenHBand.Value) then - {self.}XmlAttrEvenHBand.Value := _obj.XmlAttrEvenHBand.Value; - if not ifnil(_obj.XmlAttrFirstRowFirstColumn.Value) then - {self.}XmlAttrFirstRowFirstColumn.Value := _obj.XmlAttrFirstRowFirstColumn.Value; - if not ifnil(_obj.XmlAttrFirstRowLastColumn.Value) then - {self.}XmlAttrFirstRowLastColumn.Value := _obj.XmlAttrFirstRowLastColumn.Value; - if not ifnil(_obj.XmlAttrLastRowFirstColumn.Value) then - {self.}XmlAttrLastRowFirstColumn.Value := _obj.XmlAttrLastRowFirstColumn.Value; - if not ifnil(_obj.XmlAttrLastRowLastColumn.Value) then - {self.}XmlAttrLastRowLastColumn.Value := _obj.XmlAttrLastRowLastColumn.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Val) then + {self.}Val := _obj.Val; + if not ifnil(_obj.FirstRow) then + {self.}FirstRow := _obj.FirstRow; + if not ifnil(_obj.LastRow) then + {self.}LastRow := _obj.LastRow; + if not ifnil(_obj.FirstColumn) then + {self.}FirstColumn := _obj.FirstColumn; + if not ifnil(_obj.LastColumn) then + {self.}LastColumn := _obj.LastColumn; + if not ifnil(_obj.OddVBand) then + {self.}OddVBand := _obj.OddVBand; + if not ifnil(_obj.EvenVBand) then + {self.}EvenVBand := _obj.EvenVBand; + if not ifnil(_obj.OddHBand) then + {self.}OddHBand := _obj.OddHBand; + if not ifnil(_obj.EvenHBand) then + {self.}EvenHBand := _obj.EvenHBand; + if not ifnil(_obj.FirstRowFirstColumn) then + {self.}FirstRowFirstColumn := _obj.FirstRowFirstColumn; + if not ifnil(_obj.FirstRowLastColumn) then + {self.}FirstRowLastColumn := _obj.FirstRowLastColumn; + if not ifnil(_obj.LastRowFirstColumn) then + {self.}LastRowFirstColumn := _obj.LastRowFirstColumn; + if not ifnil(_obj.LastRowLastColumn) then + {self.}LastRowLastColumn := _obj.LastRowLastColumn; + tslassigning := tslassigning_backup; end; function CnfStyle.ReadXmlAttrVal(); @@ -173,6 +149,11 @@ end; function CnfStyle.WriteXmlAttrVal(_value); begin + if ifnil({self.}XmlAttrVal) then + begin + {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVal; + end {self.}XmlAttrVal.Value := _value; end; @@ -183,6 +164,11 @@ end; function CnfStyle.WriteXmlAttrFirstRow(_value); begin + if ifnil({self.}XmlAttrFirstRow) then + begin + {self.}XmlAttrFirstRow := new OpenXmlAttribute({self.}Prefix, "firstRow", nil); + attributes_[length(attributes_)] := {self.}XmlAttrFirstRow; + end {self.}XmlAttrFirstRow.Value := _value; end; @@ -193,6 +179,11 @@ end; function CnfStyle.WriteXmlAttrLastRow(_value); begin + if ifnil({self.}XmlAttrLastRow) then + begin + {self.}XmlAttrLastRow := new OpenXmlAttribute({self.}Prefix, "lastRow", nil); + attributes_[length(attributes_)] := {self.}XmlAttrLastRow; + end {self.}XmlAttrLastRow.Value := _value; end; @@ -203,6 +194,11 @@ end; function CnfStyle.WriteXmlAttrFirstColumn(_value); begin + if ifnil({self.}XmlAttrFirstColumn) then + begin + {self.}XmlAttrFirstColumn := new OpenXmlAttribute({self.}Prefix, "firstColumn", nil); + attributes_[length(attributes_)] := {self.}XmlAttrFirstColumn; + end {self.}XmlAttrFirstColumn.Value := _value; end; @@ -213,6 +209,11 @@ end; function CnfStyle.WriteXmlAttrLastColumn(_value); begin + if ifnil({self.}XmlAttrLastColumn) then + begin + {self.}XmlAttrLastColumn := new OpenXmlAttribute({self.}Prefix, "lastColumn", nil); + attributes_[length(attributes_)] := {self.}XmlAttrLastColumn; + end {self.}XmlAttrLastColumn.Value := _value; end; @@ -223,6 +224,11 @@ end; function CnfStyle.WriteXmlAttrOddVBand(_value); begin + if ifnil({self.}XmlAttrOddVBand) then + begin + {self.}XmlAttrOddVBand := new OpenXmlAttribute({self.}Prefix, "oddVBand", nil); + attributes_[length(attributes_)] := {self.}XmlAttrOddVBand; + end {self.}XmlAttrOddVBand.Value := _value; end; @@ -233,6 +239,11 @@ end; function CnfStyle.WriteXmlAttrEvenVBand(_value); begin + if ifnil({self.}XmlAttrEvenVBand) then + begin + {self.}XmlAttrEvenVBand := new OpenXmlAttribute({self.}Prefix, "evenVBand", nil); + attributes_[length(attributes_)] := {self.}XmlAttrEvenVBand; + end {self.}XmlAttrEvenVBand.Value := _value; end; @@ -243,6 +254,11 @@ end; function CnfStyle.WriteXmlAttrOddHBand(_value); begin + if ifnil({self.}XmlAttrOddHBand) then + begin + {self.}XmlAttrOddHBand := new OpenXmlAttribute({self.}Prefix, "oddHBand", nil); + attributes_[length(attributes_)] := {self.}XmlAttrOddHBand; + end {self.}XmlAttrOddHBand.Value := _value; end; @@ -253,6 +269,11 @@ end; function CnfStyle.WriteXmlAttrEvenHBand(_value); begin + if ifnil({self.}XmlAttrEvenHBand) then + begin + {self.}XmlAttrEvenHBand := new OpenXmlAttribute({self.}Prefix, "evenHBand", nil); + attributes_[length(attributes_)] := {self.}XmlAttrEvenHBand; + end {self.}XmlAttrEvenHBand.Value := _value; end; @@ -263,6 +284,11 @@ end; function CnfStyle.WriteXmlAttrFirstRowFirstColumn(_value); begin + if ifnil({self.}XmlAttrFirstRowFirstColumn) then + begin + {self.}XmlAttrFirstRowFirstColumn := new OpenXmlAttribute({self.}Prefix, "firstRowFirstColumn", nil); + attributes_[length(attributes_)] := {self.}XmlAttrFirstRowFirstColumn; + end {self.}XmlAttrFirstRowFirstColumn.Value := _value; end; @@ -273,6 +299,11 @@ end; function CnfStyle.WriteXmlAttrFirstRowLastColumn(_value); begin + if ifnil({self.}XmlAttrFirstRowLastColumn) then + begin + {self.}XmlAttrFirstRowLastColumn := new OpenXmlAttribute({self.}Prefix, "firstRowLastColumn", nil); + attributes_[length(attributes_)] := {self.}XmlAttrFirstRowLastColumn; + end {self.}XmlAttrFirstRowLastColumn.Value := _value; end; @@ -283,6 +314,11 @@ end; function CnfStyle.WriteXmlAttrLastRowFirstColumn(_value); begin + if ifnil({self.}XmlAttrLastRowFirstColumn) then + begin + {self.}XmlAttrLastRowFirstColumn := new OpenXmlAttribute({self.}Prefix, "lastRowFirstColumn", nil); + attributes_[length(attributes_)] := {self.}XmlAttrLastRowFirstColumn; + end {self.}XmlAttrLastRowFirstColumn.Value := _value; end; @@ -293,5 +329,10 @@ end; function CnfStyle.WriteXmlAttrLastRowLastColumn(_value); begin + if ifnil({self.}XmlAttrLastRowLastColumn) then + begin + {self.}XmlAttrLastRowLastColumn := new OpenXmlAttribute({self.}Prefix, "lastRowLastColumn", nil); + attributes_[length(attributes_)] := {self.}XmlAttrLastRowLastColumn; + end {self.}XmlAttrLastRowLastColumn.Value := _value; end; diff --git a/autoclass/docx/Color@DOCX.tsf b/autoclass/docx/Color@DOCX.tsf index cd59e02..3211810 100644 --- a/autoclass/docx/Color@DOCX.tsf +++ b/autoclass/docx/Color@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Color);override; +public + + // attributes property property Val read ReadXmlAttrVal write WriteXmlAttrVal; property ThemeColor read ReadXmlAttrThemeColor write WriteXmlAttrThemeColor; function ReadXmlAttrVal(); @@ -17,11 +17,10 @@ public function WriteXmlAttrThemeColor(_value); public - // Attributes + // Attributes XmlAttrVal: OpenXmlAttribute; XmlAttrThemeColor: OpenXmlAttribute; - // Children end; @@ -37,45 +36,33 @@ end; function Color.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Color.Init();override; begin - {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); - {self.}XmlAttrThemeColor := new OpenXmlAttribute({self.}Prefix, "themeColor", nil); -end; - -function Color.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrVal, - {self.}XmlAttrThemeColor, - ); -end; - -function Color.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "val": makeweakref(thisFunction(WriteXmlAttrVal)), + pre + "themeColor": makeweakref(thisFunction(WriteXmlAttrThemeColor)), ); sorted_child_ := array( - "": -1, ); -end; - -function Color.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Color.Copy(_obj: Color);override; begin - if not ifnil(_obj.XmlAttrVal.Value) then - {self.}XmlAttrVal.Value := _obj.XmlAttrVal.Value; - if not ifnil(_obj.XmlAttrThemeColor.Value) then - {self.}XmlAttrThemeColor.Value := _obj.XmlAttrThemeColor.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Val) then + {self.}Val := _obj.Val; + if not ifnil(_obj.ThemeColor) then + {self.}ThemeColor := _obj.ThemeColor; + tslassigning := tslassigning_backup; end; function Color.ReadXmlAttrVal(); @@ -85,6 +72,11 @@ end; function Color.WriteXmlAttrVal(_value); begin + if ifnil({self.}XmlAttrVal) then + begin + {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVal; + end {self.}XmlAttrVal.Value := _value; end; @@ -95,5 +87,10 @@ end; function Color.WriteXmlAttrThemeColor(_value); begin + if ifnil({self.}XmlAttrThemeColor) then + begin + {self.}XmlAttrThemeColor := new OpenXmlAttribute({self.}Prefix, "themeColor", nil); + attributes_[length(attributes_)] := {self.}XmlAttrThemeColor; + end {self.}XmlAttrThemeColor.Value := _value; end; diff --git a/autoclass/docx/Cols@DOCX.tsf b/autoclass/docx/Cols@DOCX.tsf index a3bd8b0..1a999b4 100644 --- a/autoclass/docx/Cols@DOCX.tsf +++ b/autoclass/docx/Cols@DOCX.tsf @@ -4,20 +4,19 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Cols);override; +public + + // attributes property property Space read ReadXmlAttrSpace write WriteXmlAttrSpace; function ReadXmlAttrSpace(); function WriteXmlAttrSpace(_value); public - // Attributes + // Attributes XmlAttrSpace: OpenXmlAttribute; - // Children end; @@ -33,41 +32,30 @@ end; function Cols.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Cols.Init();override; begin - {self.}XmlAttrSpace := new OpenXmlAttribute({self.}Prefix, "space", nil); -end; - -function Cols.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrSpace, - ); -end; - -function Cols.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "space": makeweakref(thisFunction(WriteXmlAttrSpace)), ); sorted_child_ := array( - "": -1, ); -end; - -function Cols.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Cols.Copy(_obj: Cols);override; begin - if not ifnil(_obj.XmlAttrSpace.Value) then - {self.}XmlAttrSpace.Value := _obj.XmlAttrSpace.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Space) then + {self.}Space := _obj.Space; + tslassigning := tslassigning_backup; end; function Cols.ReadXmlAttrSpace(); @@ -77,5 +65,10 @@ end; function Cols.WriteXmlAttrSpace(_value); begin + if ifnil({self.}XmlAttrSpace) then + begin + {self.}XmlAttrSpace := new OpenXmlAttribute({self.}Prefix, "space", nil); + attributes_[length(attributes_)] := {self.}XmlAttrSpace; + end {self.}XmlAttrSpace.Value := _value; end; diff --git a/autoclass/docx/Comment@DOCX.tsf b/autoclass/docx/Comment@DOCX.tsf index bd2a7d2..04f23cb 100644 --- a/autoclass/docx/Comment@DOCX.tsf +++ b/autoclass/docx/Comment@DOCX.tsf @@ -4,16 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Comment);override; - function AddP(): P; - function AppendP(): P; - property Ps read ReadPs; - function ReadPs(_index); +public + // attributes property property Author read ReadXmlAttrAuthor write WriteXmlAttrAuthor; property Date read ReadXmlAttrDate write WriteXmlAttrDate; property Id read ReadXmlAttrId write WriteXmlAttrId; @@ -24,8 +19,14 @@ public function ReadXmlAttrId(); function WriteXmlAttrId(_value); + // multi property + property Ps read ReadPs; + function ReadPs(_index); + function AddP(): P; + function AppendP(): P; + public - // Attributes + // Attributes XmlAttrAuthor: OpenXmlAttribute; XmlAttrDate: OpenXmlAttribute; XmlAttrId: OpenXmlAttribute; @@ -46,117 +47,37 @@ end; function Comment.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Comment.Init();override; begin - {self.}XmlAttrAuthor := new OpenXmlAttribute({self.}Prefix, "author", nil); - {self.}XmlAttrDate := new OpenXmlAttribute({self.}Prefix, "date", nil); - {self.}XmlAttrId := new OpenXmlAttribute({self.}Prefix, "id", nil); -end; - -function Comment.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrAuthor, - {self.}XmlAttrDate, - {self.}XmlAttrId, - ); -end; - -function Comment.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "author": makeweakref(thisFunction(WriteXmlAttrAuthor)), + pre + "date": makeweakref(thisFunction(WriteXmlAttrDate)), + pre + "id": makeweakref(thisFunction(WriteXmlAttrId)), ); sorted_child_ := array( - "": -1, + pre + "p": array(0, makeweakref(thisFunction(AppendP))), ); -end; - -function Comment.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "p": obj := {self.}AppendP(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Comment.Copy(_obj: Comment);override; begin - if not ifnil(_obj.XmlAttrAuthor.Value) then - {self.}XmlAttrAuthor.Value := _obj.XmlAttrAuthor.Value; - if not ifnil(_obj.XmlAttrDate.Value) then - {self.}XmlAttrDate.Value := _obj.XmlAttrDate.Value; - if not ifnil(_obj.XmlAttrId.Value) then - {self.}XmlAttrId.Value := _obj.XmlAttrId.Value; -end; - -function Comment.AddP(): P; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "p" then break; - end - obj := new P(self, {self.}Prefix, "p"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function Comment.AppendP(): P; -begin - obj := new P(self, {self.}Prefix, "p"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function Comment.ReadPs(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "p" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Author) then + {self.}Author := _obj.Author; + if not ifnil(_obj.Date) then + {self.}Date := _obj.Date; + if not ifnil(_obj.Id) then + {self.}Id := _obj.Id; + tslassigning := tslassigning_backup; end; function Comment.ReadXmlAttrAuthor(); @@ -166,6 +87,11 @@ end; function Comment.WriteXmlAttrAuthor(_value); begin + if ifnil({self.}XmlAttrAuthor) then + begin + {self.}XmlAttrAuthor := new OpenXmlAttribute({self.}Prefix, "author", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAuthor; + end {self.}XmlAttrAuthor.Value := _value; end; @@ -176,6 +102,11 @@ end; function Comment.WriteXmlAttrDate(_value); begin + if ifnil({self.}XmlAttrDate) then + begin + {self.}XmlAttrDate := new OpenXmlAttribute({self.}Prefix, "date", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDate; + end {self.}XmlAttrDate.Value := _value; end; @@ -186,5 +117,31 @@ end; function Comment.WriteXmlAttrId(_value); begin + if ifnil({self.}XmlAttrId) then + begin + {self.}XmlAttrId := new OpenXmlAttribute({self.}Prefix, "id", nil); + attributes_[length(attributes_)] := {self.}XmlAttrId; + end {self.}XmlAttrId.Value := _value; end; + +function Comment.ReadPs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "p", ind); +end; + +function Comment.AddP(): P; +begin + obj := new P(self, {self.}Prefix, "p"); + container_.Insert(obj); + return obj; +end; + +function Comment.AppendP(): P; +begin + obj := new P(self, {self.}Prefix, "p"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/CommentRange@DOCX.tsf b/autoclass/docx/CommentRange@DOCX.tsf index 6b2fc4f..79558ff 100644 --- a/autoclass/docx/CommentRange@DOCX.tsf +++ b/autoclass/docx/CommentRange@DOCX.tsf @@ -4,20 +4,19 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: CommentRange);override; +public + + // attributes property property Id read ReadXmlAttrId write WriteXmlAttrId; function ReadXmlAttrId(); function WriteXmlAttrId(_value); public - // Attributes + // Attributes XmlAttrId: OpenXmlAttribute; - // Children end; @@ -33,41 +32,30 @@ end; function CommentRange.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function CommentRange.Init();override; begin - {self.}XmlAttrId := new OpenXmlAttribute({self.}Prefix, "id", nil); -end; - -function CommentRange.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrId, - ); -end; - -function CommentRange.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "id": makeweakref(thisFunction(WriteXmlAttrId)), ); sorted_child_ := array( - "": -1, ); -end; - -function CommentRange.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function CommentRange.Copy(_obj: CommentRange);override; begin - if not ifnil(_obj.XmlAttrId.Value) then - {self.}XmlAttrId.Value := _obj.XmlAttrId.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Id) then + {self.}Id := _obj.Id; + tslassigning := tslassigning_backup; end; function CommentRange.ReadXmlAttrId(); @@ -77,5 +65,10 @@ end; function CommentRange.WriteXmlAttrId(_value); begin + if ifnil({self.}XmlAttrId) then + begin + {self.}XmlAttrId := new OpenXmlAttribute({self.}Prefix, "id", nil); + attributes_[length(attributes_)] := {self.}XmlAttrId; + end {self.}XmlAttrId.Value := _value; end; diff --git a/autoclass/docx/Comments@DOCX.tsf b/autoclass/docx/Comments@DOCX.tsf index b6a556e..48f750b 100644 --- a/autoclass/docx/Comments@DOCX.tsf +++ b/autoclass/docx/Comments@DOCX.tsf @@ -4,16 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Comments);override; - function AddComment(): Comment; - function AppendComment(): Comment; - property Comments read ReadComments; - function ReadComments(_index); +public + // attributes property property XmlnsWpc read ReadXmlAttrXmlnsWpc write WriteXmlAttrXmlnsWpc; property XmlnsMc read ReadXmlAttrXmlnsMc write WriteXmlAttrXmlnsMc; property XmlnsO read ReadXmlAttrXmlnsO write WriteXmlAttrXmlnsO; @@ -69,8 +64,14 @@ public function ReadXmlAttrMcIgnorable(); function WriteXmlAttrMcIgnorable(_value); + // multi property + property Comments read ReadComments; + function ReadComments(_index); + function AddComment(): Comment; + function AppendComment(): Comment; + public - // Attributes + // Attributes XmlAttrXmlnsWpc: OpenXmlAttribute; XmlAttrXmlnsMc: OpenXmlAttribute; XmlAttrXmlnsO: OpenXmlAttribute; @@ -106,177 +107,82 @@ end; function Comments.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Comments.Init();override; begin - {self.}XmlAttrXmlnsWpc := new OpenXmlAttribute("xmlns", "wpc", nil); - {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); - {self.}XmlAttrXmlnsO := new OpenXmlAttribute("xmlns", "o", nil); - {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); - {self.}XmlAttrXmlnsM := new OpenXmlAttribute("xmlns", "m", nil); - {self.}XmlAttrXmlnsV := new OpenXmlAttribute("xmlns", "v", nil); - {self.}XmlAttrXmlnsWp14 := new OpenXmlAttribute("xmlns", "wp14", nil); - {self.}XmlAttrXmlnsWp := new OpenXmlAttribute("xmlns", "wp", nil); - {self.}XmlAttrXmlnsW := new OpenXmlAttribute("xmlns", "w", nil); - {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); - {self.}XmlAttrXmlnsW15 := new OpenXmlAttribute("xmlns", "w15", nil); - {self.}XmlAttrXmlnsW10 := new OpenXmlAttribute("xmlns", "w10", nil); - {self.}XmlAttrXmlnsWpg := new OpenXmlAttribute("xmlns", "wpg", nil); - {self.}XmlAttrXmlnsWpi := new OpenXmlAttribute("xmlns", "wpi", nil); - {self.}XmlAttrXmlnsWne := new OpenXmlAttribute("xmlns", "wne", nil); - {self.}XmlAttrXmlnsWps := new OpenXmlAttribute("xmlns", "wps", nil); - {self.}XmlAttrXmlnsWpsCustomData := new OpenXmlAttribute("xmlns", "wpsCustomData", nil); - {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); -end; - -function Comments.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXmlnsWpc, - {self.}XmlAttrXmlnsMc, - {self.}XmlAttrXmlnsO, - {self.}XmlAttrXmlnsR, - {self.}XmlAttrXmlnsM, - {self.}XmlAttrXmlnsV, - {self.}XmlAttrXmlnsWp14, - {self.}XmlAttrXmlnsWp, - {self.}XmlAttrXmlnsW, - {self.}XmlAttrXmlnsW14, - {self.}XmlAttrXmlnsW15, - {self.}XmlAttrXmlnsW10, - {self.}XmlAttrXmlnsWpg, - {self.}XmlAttrXmlnsWpi, - {self.}XmlAttrXmlnsWne, - {self.}XmlAttrXmlnsWps, - {self.}XmlAttrXmlnsWpsCustomData, - {self.}XmlAttrMcIgnorable, - ); -end; - -function Comments.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns:wpc": makeweakref(thisFunction(WriteXmlAttrXmlnsWpc)), + "xmlns:mc": makeweakref(thisFunction(WriteXmlAttrXmlnsMc)), + "xmlns:o": makeweakref(thisFunction(WriteXmlAttrXmlnsO)), + "xmlns:r": makeweakref(thisFunction(WriteXmlAttrXmlnsR)), + "xmlns:m": makeweakref(thisFunction(WriteXmlAttrXmlnsM)), + "xmlns:v": makeweakref(thisFunction(WriteXmlAttrXmlnsV)), + "xmlns:wp14": makeweakref(thisFunction(WriteXmlAttrXmlnsWp14)), + "xmlns:wp": makeweakref(thisFunction(WriteXmlAttrXmlnsWp)), + "xmlns:w": makeweakref(thisFunction(WriteXmlAttrXmlnsW)), + "xmlns:w14": makeweakref(thisFunction(WriteXmlAttrXmlnsW14)), + "xmlns:w15": makeweakref(thisFunction(WriteXmlAttrXmlnsW15)), + "xmlns:w10": makeweakref(thisFunction(WriteXmlAttrXmlnsW10)), + "xmlns:wpg": makeweakref(thisFunction(WriteXmlAttrXmlnsWpg)), + "xmlns:wpi": makeweakref(thisFunction(WriteXmlAttrXmlnsWpi)), + "xmlns:wne": makeweakref(thisFunction(WriteXmlAttrXmlnsWne)), + "xmlns:wps": makeweakref(thisFunction(WriteXmlAttrXmlnsWps)), + "xmlns:wpsCustomData": makeweakref(thisFunction(WriteXmlAttrXmlnsWpsCustomData)), + "mc:Ignorable": makeweakref(thisFunction(WriteXmlAttrMcIgnorable)), ); sorted_child_ := array( - "": -1, + pre + "comment": array(0, makeweakref(thisFunction(AppendComment))), ); -end; - -function Comments.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "comment": obj := {self.}AppendComment(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Comments.Copy(_obj: Comments);override; begin - if not ifnil(_obj.XmlAttrXmlnsWpc.Value) then - {self.}XmlAttrXmlnsWpc.Value := _obj.XmlAttrXmlnsWpc.Value; - if not ifnil(_obj.XmlAttrXmlnsMc.Value) then - {self.}XmlAttrXmlnsMc.Value := _obj.XmlAttrXmlnsMc.Value; - if not ifnil(_obj.XmlAttrXmlnsO.Value) then - {self.}XmlAttrXmlnsO.Value := _obj.XmlAttrXmlnsO.Value; - if not ifnil(_obj.XmlAttrXmlnsR.Value) then - {self.}XmlAttrXmlnsR.Value := _obj.XmlAttrXmlnsR.Value; - if not ifnil(_obj.XmlAttrXmlnsM.Value) then - {self.}XmlAttrXmlnsM.Value := _obj.XmlAttrXmlnsM.Value; - if not ifnil(_obj.XmlAttrXmlnsV.Value) then - {self.}XmlAttrXmlnsV.Value := _obj.XmlAttrXmlnsV.Value; - if not ifnil(_obj.XmlAttrXmlnsWp14.Value) then - {self.}XmlAttrXmlnsWp14.Value := _obj.XmlAttrXmlnsWp14.Value; - if not ifnil(_obj.XmlAttrXmlnsWp.Value) then - {self.}XmlAttrXmlnsWp.Value := _obj.XmlAttrXmlnsWp.Value; - if not ifnil(_obj.XmlAttrXmlnsW.Value) then - {self.}XmlAttrXmlnsW.Value := _obj.XmlAttrXmlnsW.Value; - if not ifnil(_obj.XmlAttrXmlnsW14.Value) then - {self.}XmlAttrXmlnsW14.Value := _obj.XmlAttrXmlnsW14.Value; - if not ifnil(_obj.XmlAttrXmlnsW15.Value) then - {self.}XmlAttrXmlnsW15.Value := _obj.XmlAttrXmlnsW15.Value; - if not ifnil(_obj.XmlAttrXmlnsW10.Value) then - {self.}XmlAttrXmlnsW10.Value := _obj.XmlAttrXmlnsW10.Value; - if not ifnil(_obj.XmlAttrXmlnsWpg.Value) then - {self.}XmlAttrXmlnsWpg.Value := _obj.XmlAttrXmlnsWpg.Value; - if not ifnil(_obj.XmlAttrXmlnsWpi.Value) then - {self.}XmlAttrXmlnsWpi.Value := _obj.XmlAttrXmlnsWpi.Value; - if not ifnil(_obj.XmlAttrXmlnsWne.Value) then - {self.}XmlAttrXmlnsWne.Value := _obj.XmlAttrXmlnsWne.Value; - if not ifnil(_obj.XmlAttrXmlnsWps.Value) then - {self.}XmlAttrXmlnsWps.Value := _obj.XmlAttrXmlnsWps.Value; - if not ifnil(_obj.XmlAttrXmlnsWpsCustomData.Value) then - {self.}XmlAttrXmlnsWpsCustomData.Value := _obj.XmlAttrXmlnsWpsCustomData.Value; - if not ifnil(_obj.XmlAttrMcIgnorable.Value) then - {self.}XmlAttrMcIgnorable.Value := _obj.XmlAttrMcIgnorable.Value; -end; - -function Comments.AddComment(): Comment; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "comment" then break; - end - obj := new Comment(self, {self.}Prefix, "comment"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function Comments.AppendComment(): Comment; -begin - obj := new Comment(self, {self.}Prefix, "comment"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function Comments.ReadComments(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "comment" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlnsWpc) then + {self.}XmlnsWpc := _obj.XmlnsWpc; + if not ifnil(_obj.XmlnsMc) then + {self.}XmlnsMc := _obj.XmlnsMc; + if not ifnil(_obj.XmlnsO) then + {self.}XmlnsO := _obj.XmlnsO; + if not ifnil(_obj.XmlnsR) then + {self.}XmlnsR := _obj.XmlnsR; + if not ifnil(_obj.XmlnsM) then + {self.}XmlnsM := _obj.XmlnsM; + if not ifnil(_obj.XmlnsV) then + {self.}XmlnsV := _obj.XmlnsV; + if not ifnil(_obj.XmlnsWp14) then + {self.}XmlnsWp14 := _obj.XmlnsWp14; + if not ifnil(_obj.XmlnsWp) then + {self.}XmlnsWp := _obj.XmlnsWp; + if not ifnil(_obj.XmlnsW) then + {self.}XmlnsW := _obj.XmlnsW; + if not ifnil(_obj.XmlnsW14) then + {self.}XmlnsW14 := _obj.XmlnsW14; + if not ifnil(_obj.XmlnsW15) then + {self.}XmlnsW15 := _obj.XmlnsW15; + if not ifnil(_obj.XmlnsW10) then + {self.}XmlnsW10 := _obj.XmlnsW10; + if not ifnil(_obj.XmlnsWpg) then + {self.}XmlnsWpg := _obj.XmlnsWpg; + if not ifnil(_obj.XmlnsWpi) then + {self.}XmlnsWpi := _obj.XmlnsWpi; + if not ifnil(_obj.XmlnsWne) then + {self.}XmlnsWne := _obj.XmlnsWne; + if not ifnil(_obj.XmlnsWps) then + {self.}XmlnsWps := _obj.XmlnsWps; + if not ifnil(_obj.XmlnsWpsCustomData) then + {self.}XmlnsWpsCustomData := _obj.XmlnsWpsCustomData; + if not ifnil(_obj.McIgnorable) then + {self.}McIgnorable := _obj.McIgnorable; + tslassigning := tslassigning_backup; end; function Comments.ReadXmlAttrXmlnsWpc(); @@ -286,6 +192,11 @@ end; function Comments.WriteXmlAttrXmlnsWpc(_value); begin + if ifnil({self.}XmlAttrXmlnsWpc) then + begin + {self.}XmlAttrXmlnsWpc := new OpenXmlAttribute("xmlns", "wpc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpc; + end {self.}XmlAttrXmlnsWpc.Value := _value; end; @@ -296,6 +207,11 @@ end; function Comments.WriteXmlAttrXmlnsMc(_value); begin + if ifnil({self.}XmlAttrXmlnsMc) then + begin + {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsMc; + end {self.}XmlAttrXmlnsMc.Value := _value; end; @@ -306,6 +222,11 @@ end; function Comments.WriteXmlAttrXmlnsO(_value); begin + if ifnil({self.}XmlAttrXmlnsO) then + begin + {self.}XmlAttrXmlnsO := new OpenXmlAttribute("xmlns", "o", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsO; + end {self.}XmlAttrXmlnsO.Value := _value; end; @@ -316,6 +237,11 @@ end; function Comments.WriteXmlAttrXmlnsR(_value); begin + if ifnil({self.}XmlAttrXmlnsR) then + begin + {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsR; + end {self.}XmlAttrXmlnsR.Value := _value; end; @@ -326,6 +252,11 @@ end; function Comments.WriteXmlAttrXmlnsM(_value); begin + if ifnil({self.}XmlAttrXmlnsM) then + begin + {self.}XmlAttrXmlnsM := new OpenXmlAttribute("xmlns", "m", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsM; + end {self.}XmlAttrXmlnsM.Value := _value; end; @@ -336,6 +267,11 @@ end; function Comments.WriteXmlAttrXmlnsV(_value); begin + if ifnil({self.}XmlAttrXmlnsV) then + begin + {self.}XmlAttrXmlnsV := new OpenXmlAttribute("xmlns", "v", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsV; + end {self.}XmlAttrXmlnsV.Value := _value; end; @@ -346,6 +282,11 @@ end; function Comments.WriteXmlAttrXmlnsWp14(_value); begin + if ifnil({self.}XmlAttrXmlnsWp14) then + begin + {self.}XmlAttrXmlnsWp14 := new OpenXmlAttribute("xmlns", "wp14", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWp14; + end {self.}XmlAttrXmlnsWp14.Value := _value; end; @@ -356,6 +297,11 @@ end; function Comments.WriteXmlAttrXmlnsWp(_value); begin + if ifnil({self.}XmlAttrXmlnsWp) then + begin + {self.}XmlAttrXmlnsWp := new OpenXmlAttribute("xmlns", "wp", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWp; + end {self.}XmlAttrXmlnsWp.Value := _value; end; @@ -366,6 +312,11 @@ end; function Comments.WriteXmlAttrXmlnsW(_value); begin + if ifnil({self.}XmlAttrXmlnsW) then + begin + {self.}XmlAttrXmlnsW := new OpenXmlAttribute("xmlns", "w", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW; + end {self.}XmlAttrXmlnsW.Value := _value; end; @@ -376,6 +327,11 @@ end; function Comments.WriteXmlAttrXmlnsW14(_value); begin + if ifnil({self.}XmlAttrXmlnsW14) then + begin + {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW14; + end {self.}XmlAttrXmlnsW14.Value := _value; end; @@ -386,6 +342,11 @@ end; function Comments.WriteXmlAttrXmlnsW15(_value); begin + if ifnil({self.}XmlAttrXmlnsW15) then + begin + {self.}XmlAttrXmlnsW15 := new OpenXmlAttribute("xmlns", "w15", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW15; + end {self.}XmlAttrXmlnsW15.Value := _value; end; @@ -396,6 +357,11 @@ end; function Comments.WriteXmlAttrXmlnsW10(_value); begin + if ifnil({self.}XmlAttrXmlnsW10) then + begin + {self.}XmlAttrXmlnsW10 := new OpenXmlAttribute("xmlns", "w10", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW10; + end {self.}XmlAttrXmlnsW10.Value := _value; end; @@ -406,6 +372,11 @@ end; function Comments.WriteXmlAttrXmlnsWpg(_value); begin + if ifnil({self.}XmlAttrXmlnsWpg) then + begin + {self.}XmlAttrXmlnsWpg := new OpenXmlAttribute("xmlns", "wpg", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpg; + end {self.}XmlAttrXmlnsWpg.Value := _value; end; @@ -416,6 +387,11 @@ end; function Comments.WriteXmlAttrXmlnsWpi(_value); begin + if ifnil({self.}XmlAttrXmlnsWpi) then + begin + {self.}XmlAttrXmlnsWpi := new OpenXmlAttribute("xmlns", "wpi", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpi; + end {self.}XmlAttrXmlnsWpi.Value := _value; end; @@ -426,6 +402,11 @@ end; function Comments.WriteXmlAttrXmlnsWne(_value); begin + if ifnil({self.}XmlAttrXmlnsWne) then + begin + {self.}XmlAttrXmlnsWne := new OpenXmlAttribute("xmlns", "wne", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWne; + end {self.}XmlAttrXmlnsWne.Value := _value; end; @@ -436,6 +417,11 @@ end; function Comments.WriteXmlAttrXmlnsWps(_value); begin + if ifnil({self.}XmlAttrXmlnsWps) then + begin + {self.}XmlAttrXmlnsWps := new OpenXmlAttribute("xmlns", "wps", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWps; + end {self.}XmlAttrXmlnsWps.Value := _value; end; @@ -446,6 +432,11 @@ end; function Comments.WriteXmlAttrXmlnsWpsCustomData(_value); begin + if ifnil({self.}XmlAttrXmlnsWpsCustomData) then + begin + {self.}XmlAttrXmlnsWpsCustomData := new OpenXmlAttribute("xmlns", "wpsCustomData", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpsCustomData; + end {self.}XmlAttrXmlnsWpsCustomData.Value := _value; end; @@ -456,5 +447,31 @@ end; function Comments.WriteXmlAttrMcIgnorable(_value); begin + if ifnil({self.}XmlAttrMcIgnorable) then + begin + {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); + attributes_[length(attributes_)] := {self.}XmlAttrMcIgnorable; + end {self.}XmlAttrMcIgnorable.Value := _value; end; + +function Comments.ReadComments(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "comment", ind); +end; + +function Comments.AddComment(): Comment; +begin + obj := new Comment(self, {self.}Prefix, "comment"); + container_.Insert(obj); + return obj; +end; + +function Comments.AppendComment(): Comment; +begin + obj := new Comment(self, {self.}Prefix, "comment"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/Compat@DOCX.tsf b/autoclass/docx/Compat@DOCX.tsf index 66779d9..8b63e30 100644 --- a/autoclass/docx/Compat@DOCX.tsf +++ b/autoclass/docx/Compat@DOCX.tsf @@ -4,16 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Compat);override; - function AddCompatSetting(): CompatSetting; - function AppendCompatSetting(): CompatSetting; - property CompatSettings read ReadCompatSettings; - function ReadCompatSettings(_index); +public + // empty property property SpaceForUL read ReadXmlChildSpaceForUL write WriteXmlChildSpaceForUL; property BalanceSingleByteDoubleByteWidth read ReadXmlChildBalanceSingleByteDoubleByteWidth write WriteXmlChildBalanceSingleByteDoubleByteWidth; property DoNotLeaveBackslashAlone read ReadXmlChildDoNotLeaveBackslashAlone write WriteXmlChildDoNotLeaveBackslashAlone; @@ -39,9 +34,13 @@ public function ReadXmlChildCompatSetting(); function WriteXmlChildCompatSetting(_value); -public - // Attributes + // multi property + property CompatSettings read ReadCompatSettings; + function ReadCompatSettings(_index); + function AddCompatSetting(): CompatSetting; + function AppendCompatSetting(): CompatSetting; +public // Children XmlChildSpaceForUL: OpenXmlEmpty; XmlChildBalanceSingleByteDoubleByteWidth: OpenXmlEmpty; @@ -65,211 +64,236 @@ end; function Compat.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Compat.Init();override; begin - {self.}XmlChildSpaceForUL := new OpenXmlEmpty(self, {self.}Prefix, "spaceForUL"); - {self.}XmlChildBalanceSingleByteDoubleByteWidth := new OpenXmlEmpty(self, {self.}Prefix, "balanceSingleByteDoubleByteWidth"); - {self.}XmlChildDoNotLeaveBackslashAlone := new OpenXmlEmpty(self, {self.}Prefix, "doNotLeaveBackslashAlone"); - {self.}XmlChildUlTrailSpace := new OpenXmlEmpty(self, {self.}Prefix, "ulTrailSpace"); - {self.}XmlChildDoNotExpandShiftReturn := new OpenXmlEmpty(self, {self.}Prefix, "doNotExpandShiftReturn"); - {self.}XmlChildAdjustLineHeightInTable := new OpenXmlEmpty(self, {self.}Prefix, "adjustLineHeightInTable"); - {self.}XmlChildUseFELayout := new OpenXmlEmpty(self, {self.}Prefix, "useFELayout"); -end; - -function Compat.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Compat.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}XmlChildSpaceForUL, - 1: {self.}XmlChildBalanceSingleByteDoubleByteWidth, - 2: {self.}XmlChildDoNotLeaveBackslashAlone, - 3: {self.}XmlChildUlTrailSpace, - 4: {self.}XmlChildDoNotExpandShiftReturn, - 5: {self.}XmlChildAdjustLineHeightInTable, - 6: {self.}XmlChildUseFELayout, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}XmlChildSpaceForUL.ElementName: 0, - {self.}XmlChildBalanceSingleByteDoubleByteWidth.ElementName: 1, - {self.}XmlChildDoNotLeaveBackslashAlone.ElementName: 2, - {self.}XmlChildUlTrailSpace.ElementName: 3, - {self.}XmlChildDoNotExpandShiftReturn.ElementName: 4, - {self.}XmlChildAdjustLineHeightInTable.ElementName: 5, - {self.}XmlChildUseFELayout.ElementName: 6, + pre + "spaceForUL": array(0, makeweakref(thisFunction(ReadXmlChildSpaceForUL))), + pre + "balanceSingleByteDoubleByteWidth": array(1, makeweakref(thisFunction(ReadXmlChildBalanceSingleByteDoubleByteWidth))), + pre + "doNotLeaveBackslashAlone": array(2, makeweakref(thisFunction(ReadXmlChildDoNotLeaveBackslashAlone))), + pre + "ulTrailSpace": array(3, makeweakref(thisFunction(ReadXmlChildUlTrailSpace))), + pre + "doNotExpandShiftReturn": array(4, makeweakref(thisFunction(ReadXmlChildDoNotExpandShiftReturn))), + pre + "adjustLineHeightInTable": array(5, makeweakref(thisFunction(ReadXmlChildAdjustLineHeightInTable))), + pre + "useFELayout": array(6, makeweakref(thisFunction(ReadXmlChildUseFELayout))), + pre + "compatSetting": array(7, makeweakref(thisFunction(AppendCompatSetting))), ); -end; - -function Compat.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "compatSetting": obj := {self.}AppendCompatSetting(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Compat.Copy(_obj: Compat);override; begin - {self.}XmlChildSpaceForUL.Copy(_obj.XmlChildSpaceForUL); - {self.}XmlChildBalanceSingleByteDoubleByteWidth.Copy(_obj.XmlChildBalanceSingleByteDoubleByteWidth); - {self.}XmlChildDoNotLeaveBackslashAlone.Copy(_obj.XmlChildDoNotLeaveBackslashAlone); - {self.}XmlChildUlTrailSpace.Copy(_obj.XmlChildUlTrailSpace); - {self.}XmlChildDoNotExpandShiftReturn.Copy(_obj.XmlChildDoNotExpandShiftReturn); - {self.}XmlChildAdjustLineHeightInTable.Copy(_obj.XmlChildAdjustLineHeightInTable); - {self.}XmlChildUseFELayout.Copy(_obj.XmlChildUseFELayout); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildSpaceForUL) then + ifnil({self.}XmlChildSpaceForUL) ? {self.}SpaceForUL.Copy(_obj.XmlChildSpaceForUL) : {self.}XmlChildSpaceForUL.Copy(_obj.XmlChildSpaceForUL); + if not ifnil(_obj.XmlChildBalanceSingleByteDoubleByteWidth) then + ifnil({self.}XmlChildBalanceSingleByteDoubleByteWidth) ? {self.}BalanceSingleByteDoubleByteWidth.Copy(_obj.XmlChildBalanceSingleByteDoubleByteWidth) : {self.}XmlChildBalanceSingleByteDoubleByteWidth.Copy(_obj.XmlChildBalanceSingleByteDoubleByteWidth); + if not ifnil(_obj.XmlChildDoNotLeaveBackslashAlone) then + ifnil({self.}XmlChildDoNotLeaveBackslashAlone) ? {self.}DoNotLeaveBackslashAlone.Copy(_obj.XmlChildDoNotLeaveBackslashAlone) : {self.}XmlChildDoNotLeaveBackslashAlone.Copy(_obj.XmlChildDoNotLeaveBackslashAlone); + if not ifnil(_obj.XmlChildUlTrailSpace) then + ifnil({self.}XmlChildUlTrailSpace) ? {self.}UlTrailSpace.Copy(_obj.XmlChildUlTrailSpace) : {self.}XmlChildUlTrailSpace.Copy(_obj.XmlChildUlTrailSpace); + if not ifnil(_obj.XmlChildDoNotExpandShiftReturn) then + ifnil({self.}XmlChildDoNotExpandShiftReturn) ? {self.}DoNotExpandShiftReturn.Copy(_obj.XmlChildDoNotExpandShiftReturn) : {self.}XmlChildDoNotExpandShiftReturn.Copy(_obj.XmlChildDoNotExpandShiftReturn); + if not ifnil(_obj.XmlChildAdjustLineHeightInTable) then + ifnil({self.}XmlChildAdjustLineHeightInTable) ? {self.}AdjustLineHeightInTable.Copy(_obj.XmlChildAdjustLineHeightInTable) : {self.}XmlChildAdjustLineHeightInTable.Copy(_obj.XmlChildAdjustLineHeightInTable); + if not ifnil(_obj.XmlChildUseFELayout) then + ifnil({self.}XmlChildUseFELayout) ? {self.}UseFELayout.Copy(_obj.XmlChildUseFELayout) : {self.}XmlChildUseFELayout.Copy(_obj.XmlChildUseFELayout); + tslassigning := tslassigning_backup; +end; + +function Compat.ReadXmlChildSpaceForUL(); +begin + if tslassigning and ifnil({self.}XmlChildSpaceForUL) then + begin + {self.}XmlChildSpaceForUL := new OpenXmlEmpty(self, {self.}Prefix, "spaceForUL"); + container_.Set({self.}XmlChildSpaceForUL); + return {self.}XmlChildSpaceForUL; + end + return {self.}XmlChildSpaceForUL.BoolValue(); +end; + +function Compat.WriteXmlChildSpaceForUL(_value); +begin + if ifnil({self.}XmlChildSpaceForUL) then + begin + {self.}XmlChildSpaceForUL := new OpenXmlEmpty(self, {self.}Prefix, "spaceForUL"); + container_.Set({self.}XmlChildSpaceForUL); + end + {self.}XmlChildSpaceForUL.Value := _value; +end; + +function Compat.ReadXmlChildBalanceSingleByteDoubleByteWidth(); +begin + if tslassigning and ifnil({self.}XmlChildBalanceSingleByteDoubleByteWidth) then + begin + {self.}XmlChildBalanceSingleByteDoubleByteWidth := new OpenXmlEmpty(self, {self.}Prefix, "balanceSingleByteDoubleByteWidth"); + container_.Set({self.}XmlChildBalanceSingleByteDoubleByteWidth); + return {self.}XmlChildBalanceSingleByteDoubleByteWidth; + end + return {self.}XmlChildBalanceSingleByteDoubleByteWidth.BoolValue(); +end; + +function Compat.WriteXmlChildBalanceSingleByteDoubleByteWidth(_value); +begin + if ifnil({self.}XmlChildBalanceSingleByteDoubleByteWidth) then + begin + {self.}XmlChildBalanceSingleByteDoubleByteWidth := new OpenXmlEmpty(self, {self.}Prefix, "balanceSingleByteDoubleByteWidth"); + container_.Set({self.}XmlChildBalanceSingleByteDoubleByteWidth); + end + {self.}XmlChildBalanceSingleByteDoubleByteWidth.Value := _value; +end; + +function Compat.ReadXmlChildDoNotLeaveBackslashAlone(); +begin + if tslassigning and ifnil({self.}XmlChildDoNotLeaveBackslashAlone) then + begin + {self.}XmlChildDoNotLeaveBackslashAlone := new OpenXmlEmpty(self, {self.}Prefix, "doNotLeaveBackslashAlone"); + container_.Set({self.}XmlChildDoNotLeaveBackslashAlone); + return {self.}XmlChildDoNotLeaveBackslashAlone; + end + return {self.}XmlChildDoNotLeaveBackslashAlone.BoolValue(); +end; + +function Compat.WriteXmlChildDoNotLeaveBackslashAlone(_value); +begin + if ifnil({self.}XmlChildDoNotLeaveBackslashAlone) then + begin + {self.}XmlChildDoNotLeaveBackslashAlone := new OpenXmlEmpty(self, {self.}Prefix, "doNotLeaveBackslashAlone"); + container_.Set({self.}XmlChildDoNotLeaveBackslashAlone); + end + {self.}XmlChildDoNotLeaveBackslashAlone.Value := _value; +end; + +function Compat.ReadXmlChildUlTrailSpace(); +begin + if tslassigning and ifnil({self.}XmlChildUlTrailSpace) then + begin + {self.}XmlChildUlTrailSpace := new OpenXmlEmpty(self, {self.}Prefix, "ulTrailSpace"); + container_.Set({self.}XmlChildUlTrailSpace); + return {self.}XmlChildUlTrailSpace; + end + return {self.}XmlChildUlTrailSpace.BoolValue(); +end; + +function Compat.WriteXmlChildUlTrailSpace(_value); +begin + if ifnil({self.}XmlChildUlTrailSpace) then + begin + {self.}XmlChildUlTrailSpace := new OpenXmlEmpty(self, {self.}Prefix, "ulTrailSpace"); + container_.Set({self.}XmlChildUlTrailSpace); + end + {self.}XmlChildUlTrailSpace.Value := _value; +end; + +function Compat.ReadXmlChildDoNotExpandShiftReturn(); +begin + if tslassigning and ifnil({self.}XmlChildDoNotExpandShiftReturn) then + begin + {self.}XmlChildDoNotExpandShiftReturn := new OpenXmlEmpty(self, {self.}Prefix, "doNotExpandShiftReturn"); + container_.Set({self.}XmlChildDoNotExpandShiftReturn); + return {self.}XmlChildDoNotExpandShiftReturn; + end + return {self.}XmlChildDoNotExpandShiftReturn.BoolValue(); +end; + +function Compat.WriteXmlChildDoNotExpandShiftReturn(_value); +begin + if ifnil({self.}XmlChildDoNotExpandShiftReturn) then + begin + {self.}XmlChildDoNotExpandShiftReturn := new OpenXmlEmpty(self, {self.}Prefix, "doNotExpandShiftReturn"); + container_.Set({self.}XmlChildDoNotExpandShiftReturn); + end + {self.}XmlChildDoNotExpandShiftReturn.Value := _value; +end; + +function Compat.ReadXmlChildAdjustLineHeightInTable(); +begin + if tslassigning and ifnil({self.}XmlChildAdjustLineHeightInTable) then + begin + {self.}XmlChildAdjustLineHeightInTable := new OpenXmlEmpty(self, {self.}Prefix, "adjustLineHeightInTable"); + container_.Set({self.}XmlChildAdjustLineHeightInTable); + return {self.}XmlChildAdjustLineHeightInTable; + end + return {self.}XmlChildAdjustLineHeightInTable.BoolValue(); +end; + +function Compat.WriteXmlChildAdjustLineHeightInTable(_value); +begin + if ifnil({self.}XmlChildAdjustLineHeightInTable) then + begin + {self.}XmlChildAdjustLineHeightInTable := new OpenXmlEmpty(self, {self.}Prefix, "adjustLineHeightInTable"); + container_.Set({self.}XmlChildAdjustLineHeightInTable); + end + {self.}XmlChildAdjustLineHeightInTable.Value := _value; +end; + +function Compat.ReadXmlChildUseFELayout(); +begin + if tslassigning and ifnil({self.}XmlChildUseFELayout) then + begin + {self.}XmlChildUseFELayout := new OpenXmlEmpty(self, {self.}Prefix, "useFELayout"); + container_.Set({self.}XmlChildUseFELayout); + return {self.}XmlChildUseFELayout; + end + return {self.}XmlChildUseFELayout.BoolValue(); +end; + +function Compat.WriteXmlChildUseFELayout(_value); +begin + if ifnil({self.}XmlChildUseFELayout) then + begin + {self.}XmlChildUseFELayout := new OpenXmlEmpty(self, {self.}Prefix, "useFELayout"); + container_.Set({self.}XmlChildUseFELayout); + end + {self.}XmlChildUseFELayout.Value := _value; +end; + +function Compat.ReadXmlChildCompatSetting(); +begin + if tslassigning and ifnil({self.}XmlChildCompatSetting) then + begin + {self.}XmlChildCompatSetting := new OpenXmlEmpty(self, {self.}Prefix, "compatSetting"); + container_.Set({self.}XmlChildCompatSetting); + return {self.}XmlChildCompatSetting; + end + return {self.}XmlChildCompatSetting.BoolValue(); +end; + +function Compat.WriteXmlChildCompatSetting(_value); +begin + if ifnil({self.}XmlChildCompatSetting) then + begin + {self.}XmlChildCompatSetting := new OpenXmlEmpty(self, {self.}Prefix, "compatSetting"); + container_.Set({self.}XmlChildCompatSetting); + end + {self.}XmlChildCompatSetting.Value := _value; +end; + +function Compat.ReadCompatSettings(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "compatSetting", ind); end; function Compat.AddCompatSetting(): CompatSetting; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "compatSetting" then break; - end obj := new CompatSetting(self, {self.}Prefix, "compatSetting"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function Compat.AppendCompatSetting(): CompatSetting; begin obj := new CompatSetting(self, {self.}Prefix, "compatSetting"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function Compat.ReadCompatSettings(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "compatSetting" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; - -function Compat.ReadXmlChildSpaceForUL(); -begin - return ifnil({self.}XmlChildSpaceForUL.Value) ? false : true; -end; - -function Compat.WriteXmlChildSpaceForUL(_value); -begin - {self.}XmlChildSpaceForUL.Value := _value; -end; - -function Compat.ReadXmlChildBalanceSingleByteDoubleByteWidth(); -begin - return ifnil({self.}XmlChildBalanceSingleByteDoubleByteWidth.Value) ? false : true; -end; - -function Compat.WriteXmlChildBalanceSingleByteDoubleByteWidth(_value); -begin - {self.}XmlChildBalanceSingleByteDoubleByteWidth.Value := _value; -end; - -function Compat.ReadXmlChildDoNotLeaveBackslashAlone(); -begin - return ifnil({self.}XmlChildDoNotLeaveBackslashAlone.Value) ? false : true; -end; - -function Compat.WriteXmlChildDoNotLeaveBackslashAlone(_value); -begin - {self.}XmlChildDoNotLeaveBackslashAlone.Value := _value; -end; - -function Compat.ReadXmlChildUlTrailSpace(); -begin - return ifnil({self.}XmlChildUlTrailSpace.Value) ? false : true; -end; - -function Compat.WriteXmlChildUlTrailSpace(_value); -begin - {self.}XmlChildUlTrailSpace.Value := _value; -end; - -function Compat.ReadXmlChildDoNotExpandShiftReturn(); -begin - return ifnil({self.}XmlChildDoNotExpandShiftReturn.Value) ? false : true; -end; - -function Compat.WriteXmlChildDoNotExpandShiftReturn(_value); -begin - {self.}XmlChildDoNotExpandShiftReturn.Value := _value; -end; - -function Compat.ReadXmlChildAdjustLineHeightInTable(); -begin - return ifnil({self.}XmlChildAdjustLineHeightInTable.Value) ? false : true; -end; - -function Compat.WriteXmlChildAdjustLineHeightInTable(_value); -begin - {self.}XmlChildAdjustLineHeightInTable.Value := _value; -end; - -function Compat.ReadXmlChildUseFELayout(); -begin - return ifnil({self.}XmlChildUseFELayout.Value) ? false : true; -end; - -function Compat.WriteXmlChildUseFELayout(_value); -begin - {self.}XmlChildUseFELayout.Value := _value; -end; - -function Compat.ReadXmlChildCompatSetting(); -begin - return ifnil({self.}XmlChildCompatSetting.Value) ? false : true; -end; - -function Compat.WriteXmlChildCompatSetting(_value); -begin - {self.}XmlChildCompatSetting.Value := _value; -end; diff --git a/autoclass/docx/CompatSetting@DOCX.tsf b/autoclass/docx/CompatSetting@DOCX.tsf index 7a55848..ab1ac17 100644 --- a/autoclass/docx/CompatSetting@DOCX.tsf +++ b/autoclass/docx/CompatSetting@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: CompatSetting);override; +public + + // attributes property property Name read ReadXmlAttrName write WriteXmlAttrName; property Uri read ReadXmlAttrUri write WriteXmlAttrUri; property Val read ReadXmlAttrVal write WriteXmlAttrVal; @@ -20,12 +20,11 @@ public function WriteXmlAttrVal(_value); public - // Attributes + // Attributes XmlAttrName: OpenXmlAttribute; XmlAttrUri: OpenXmlAttribute; XmlAttrVal: OpenXmlAttribute; - // Children end; @@ -41,49 +40,36 @@ end; function CompatSetting.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function CompatSetting.Init();override; begin - {self.}XmlAttrName := new OpenXmlAttribute({self.}Prefix, "name", nil); - {self.}XmlAttrUri := new OpenXmlAttribute({self.}Prefix, "uri", nil); - {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); -end; - -function CompatSetting.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrName, - {self.}XmlAttrUri, - {self.}XmlAttrVal, - ); -end; - -function CompatSetting.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "name": makeweakref(thisFunction(WriteXmlAttrName)), + pre + "uri": makeweakref(thisFunction(WriteXmlAttrUri)), + pre + "val": makeweakref(thisFunction(WriteXmlAttrVal)), ); sorted_child_ := array( - "": -1, ); -end; - -function CompatSetting.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function CompatSetting.Copy(_obj: CompatSetting);override; begin - if not ifnil(_obj.XmlAttrName.Value) then - {self.}XmlAttrName.Value := _obj.XmlAttrName.Value; - if not ifnil(_obj.XmlAttrUri.Value) then - {self.}XmlAttrUri.Value := _obj.XmlAttrUri.Value; - if not ifnil(_obj.XmlAttrVal.Value) then - {self.}XmlAttrVal.Value := _obj.XmlAttrVal.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Name) then + {self.}Name := _obj.Name; + if not ifnil(_obj.Uri) then + {self.}Uri := _obj.Uri; + if not ifnil(_obj.Val) then + {self.}Val := _obj.Val; + tslassigning := tslassigning_backup; end; function CompatSetting.ReadXmlAttrName(); @@ -93,6 +79,11 @@ end; function CompatSetting.WriteXmlAttrName(_value); begin + if ifnil({self.}XmlAttrName) then + begin + {self.}XmlAttrName := new OpenXmlAttribute({self.}Prefix, "name", nil); + attributes_[length(attributes_)] := {self.}XmlAttrName; + end {self.}XmlAttrName.Value := _value; end; @@ -103,6 +94,11 @@ end; function CompatSetting.WriteXmlAttrUri(_value); begin + if ifnil({self.}XmlAttrUri) then + begin + {self.}XmlAttrUri := new OpenXmlAttribute({self.}Prefix, "uri", nil); + attributes_[length(attributes_)] := {self.}XmlAttrUri; + end {self.}XmlAttrUri.Value := _value; end; @@ -113,5 +109,10 @@ end; function CompatSetting.WriteXmlAttrVal(_value); begin + if ifnil({self.}XmlAttrVal) then + begin + {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVal; + end {self.}XmlAttrVal.Value := _value; end; diff --git a/autoclass/docx/CoreProperties@DOCX.tsf b/autoclass/docx/CoreProperties@DOCX.tsf index 6b31f7a..b9340f3 100644 --- a/autoclass/docx/CoreProperties@DOCX.tsf +++ b/autoclass/docx/CoreProperties@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: CoreProperties);override; +public + + // attributes property property XmlnsCp read ReadXmlAttrXmlnsCp write WriteXmlAttrXmlnsCp; property XmlnsDc read ReadXmlAttrXmlnsDc write WriteXmlAttrXmlnsDc; property XmlnsDcterms read ReadXmlAttrXmlnsDcterms write WriteXmlAttrXmlnsDcterms; @@ -25,8 +25,30 @@ public function ReadXmlAttrXmlnsXsi(); function WriteXmlAttrXmlnsXsi(_value); + // pcdata property + property Title read ReadXmlChildTitle; + property Subject read ReadXmlChildSubject; + property Creator read ReadXmlChildCreator; + property Keywords read ReadXmlChildKeywords; + property Description read ReadXmlChildDescription; + property LastModifiedBy read ReadXmlChildLastModifiedBy; + property Revision read ReadXmlChildRevision; + property LastPrinted read ReadXmlChildLastPrinted; + property Created read ReadXmlChildCreated; + property Modified read ReadXmlChildModified; + function ReadXmlChildTitle(); + function ReadXmlChildSubject(); + function ReadXmlChildCreator(); + function ReadXmlChildKeywords(); + function ReadXmlChildDescription(); + function ReadXmlChildLastModifiedBy(); + function ReadXmlChildRevision(); + function ReadXmlChildLastPrinted(); + function ReadXmlChildCreated(); + function ReadXmlChildModified(); + public - // Attributes + // Attributes XmlAttrXmlnsCp: OpenXmlAttribute; XmlAttrXmlnsDc: OpenXmlAttribute; XmlAttrXmlnsDcterms: OpenXmlAttribute; @@ -34,16 +56,16 @@ public XmlAttrXmlnsXsi: OpenXmlAttribute; // Children - Title: OpenXmlPcdata; - Subject: OpenXmlPcdata; - Creator: OpenXmlPcdata; - Keywords: OpenXmlPcdata; - Description: OpenXmlPcdata; - LastModifiedBy: OpenXmlPcdata; - Revision: OpenXmlPcdata; - LastPrinted: OpenXmlPcdata; - Created: OpenXmlPcdata; - Modified: OpenXmlPcdata; + XmlChildTitle: OpenXmlPcdata; + XmlChildSubject: OpenXmlPcdata; + XmlChildCreator: OpenXmlPcdata; + XmlChildKeywords: OpenXmlPcdata; + XmlChildDescription: OpenXmlPcdata; + XmlChildLastModifiedBy: OpenXmlPcdata; + XmlChildRevision: OpenXmlPcdata; + XmlChildLastPrinted: OpenXmlPcdata; + XmlChildCreated: Created; + XmlChildModified: Modified; end; @@ -59,128 +81,72 @@ end; function CoreProperties.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function CoreProperties.Init();override; begin - {self.}XmlAttrXmlnsCp := new OpenXmlAttribute("xmlns", "cp", nil); - {self.}XmlAttrXmlnsDc := new OpenXmlAttribute("xmlns", "dc", nil); - {self.}XmlAttrXmlnsDcterms := new OpenXmlAttribute("xmlns", "dcterms", nil); - {self.}XmlAttrXmlnsDcmitype := new OpenXmlAttribute("xmlns", "dcmitype", nil); - {self.}XmlAttrXmlnsXsi := new OpenXmlAttribute("xmlns", "xsi", nil); - {self.}Title := new OpenXmlPcdata(self, "dc", "title"); - {self.}Subject := new OpenXmlPcdata(self, "dc", "subject"); - {self.}Creator := new OpenXmlPcdata(self, "dc", "creator"); - {self.}Keywords := new OpenXmlPcdata(self, "cp", "keywords"); - {self.}Description := new OpenXmlPcdata(self, "cp", "description"); - {self.}LastModifiedBy := new OpenXmlPcdata(self, "cp", "lastModifiedBy"); - {self.}Revision := new OpenXmlPcdata(self, "cp", "revision"); - {self.}LastPrinted := new OpenXmlPcdata(self, "cp", "lastPrinted"); - {self.}Created := new Created(self, "dcterms", "created"); - {self.}Modified := new Modified(self, "dcterms", "modified"); -end; - -function CoreProperties.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXmlnsCp, - {self.}XmlAttrXmlnsDc, - {self.}XmlAttrXmlnsDcterms, - {self.}XmlAttrXmlnsDcmitype, - {self.}XmlAttrXmlnsXsi, - ); -end; - -function CoreProperties.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Title, - 1: {self.}Subject, - 2: {self.}Creator, - 3: {self.}Keywords, - 4: {self.}Description, - 5: {self.}LastModifiedBy, - 6: {self.}Revision, - 7: {self.}LastPrinted, - 8: {self.}Created, - 9: {self.}Modified, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns:cp": makeweakref(thisFunction(WriteXmlAttrXmlnsCp)), + "xmlns:dc": makeweakref(thisFunction(WriteXmlAttrXmlnsDc)), + "xmlns:dcterms": makeweakref(thisFunction(WriteXmlAttrXmlnsDcterms)), + "xmlns:dcmitype": makeweakref(thisFunction(WriteXmlAttrXmlnsDcmitype)), + "xmlns:xsi": makeweakref(thisFunction(WriteXmlAttrXmlnsXsi)), ); sorted_child_ := array( - "": -1, - {self.}Title.ElementName: 0, - {self.}Subject.ElementName: 1, - {self.}Creator.ElementName: 2, - {self.}Keywords.ElementName: 3, - {self.}Description.ElementName: 4, - {self.}LastModifiedBy.ElementName: 5, - {self.}Revision.ElementName: 6, - {self.}LastPrinted.ElementName: 7, - {self.}Created.ElementName: 8, - {self.}Modified.ElementName: 9, + "dc:title": array(0, makeweakref(thisFunction(ReadXmlChildTitle))), + "dc:subject": array(1, makeweakref(thisFunction(ReadXmlChildSubject))), + "dc:creator": array(2, makeweakref(thisFunction(ReadXmlChildCreator))), + "cp:keywords": array(3, makeweakref(thisFunction(ReadXmlChildKeywords))), + "cp:description": array(4, makeweakref(thisFunction(ReadXmlChildDescription))), + "cp:lastModifiedBy": array(5, makeweakref(thisFunction(ReadXmlChildLastModifiedBy))), + "cp:revision": array(6, makeweakref(thisFunction(ReadXmlChildRevision))), + "cp:lastPrinted": array(7, makeweakref(thisFunction(ReadXmlChildLastPrinted))), + "dcterms:created": array(8, makeweakref(thisFunction(ReadXmlChildCreated))), + "dcterms:modified": array(9, makeweakref(thisFunction(ReadXmlChildModified))), ); -end; - -function CoreProperties.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function CoreProperties.Copy(_obj: CoreProperties);override; begin - if not ifnil(_obj.XmlAttrXmlnsCp.Value) then - {self.}XmlAttrXmlnsCp.Value := _obj.XmlAttrXmlnsCp.Value; - if not ifnil(_obj.XmlAttrXmlnsDc.Value) then - {self.}XmlAttrXmlnsDc.Value := _obj.XmlAttrXmlnsDc.Value; - if not ifnil(_obj.XmlAttrXmlnsDcterms.Value) then - {self.}XmlAttrXmlnsDcterms.Value := _obj.XmlAttrXmlnsDcterms.Value; - if not ifnil(_obj.XmlAttrXmlnsDcmitype.Value) then - {self.}XmlAttrXmlnsDcmitype.Value := _obj.XmlAttrXmlnsDcmitype.Value; - if not ifnil(_obj.XmlAttrXmlnsXsi.Value) then - {self.}XmlAttrXmlnsXsi.Value := _obj.XmlAttrXmlnsXsi.Value; - {self.}Title.Copy(_obj.Title); - {self.}Subject.Copy(_obj.Subject); - {self.}Creator.Copy(_obj.Creator); - {self.}Keywords.Copy(_obj.Keywords); - {self.}Description.Copy(_obj.Description); - {self.}LastModifiedBy.Copy(_obj.LastModifiedBy); - {self.}Revision.Copy(_obj.Revision); - {self.}LastPrinted.Copy(_obj.LastPrinted); - {self.}Created.Copy(_obj.Created); - {self.}Modified.Copy(_obj.Modified); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlnsCp) then + {self.}XmlnsCp := _obj.XmlnsCp; + if not ifnil(_obj.XmlnsDc) then + {self.}XmlnsDc := _obj.XmlnsDc; + if not ifnil(_obj.XmlnsDcterms) then + {self.}XmlnsDcterms := _obj.XmlnsDcterms; + if not ifnil(_obj.XmlnsDcmitype) then + {self.}XmlnsDcmitype := _obj.XmlnsDcmitype; + if not ifnil(_obj.XmlnsXsi) then + {self.}XmlnsXsi := _obj.XmlnsXsi; + if not ifnil(_obj.XmlChildTitle) then + {self.}Title.Copy(_obj.XmlChildTitle); + if not ifnil(_obj.XmlChildSubject) then + {self.}Subject.Copy(_obj.XmlChildSubject); + if not ifnil(_obj.XmlChildCreator) then + {self.}Creator.Copy(_obj.XmlChildCreator); + if not ifnil(_obj.XmlChildKeywords) then + {self.}Keywords.Copy(_obj.XmlChildKeywords); + if not ifnil(_obj.XmlChildDescription) then + {self.}Description.Copy(_obj.XmlChildDescription); + if not ifnil(_obj.XmlChildLastModifiedBy) then + {self.}LastModifiedBy.Copy(_obj.XmlChildLastModifiedBy); + if not ifnil(_obj.XmlChildRevision) then + {self.}Revision.Copy(_obj.XmlChildRevision); + if not ifnil(_obj.XmlChildLastPrinted) then + {self.}LastPrinted.Copy(_obj.XmlChildLastPrinted); + if not ifnil(_obj.XmlChildCreated) then + {self.}Created.Copy(_obj.XmlChildCreated); + if not ifnil(_obj.XmlChildModified) then + {self.}Modified.Copy(_obj.XmlChildModified); + tslassigning := tslassigning_backup; end; function CoreProperties.ReadXmlAttrXmlnsCp(); @@ -190,6 +156,11 @@ end; function CoreProperties.WriteXmlAttrXmlnsCp(_value); begin + if ifnil({self.}XmlAttrXmlnsCp) then + begin + {self.}XmlAttrXmlnsCp := new OpenXmlAttribute("xmlns", "cp", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCp; + end {self.}XmlAttrXmlnsCp.Value := _value; end; @@ -200,6 +171,11 @@ end; function CoreProperties.WriteXmlAttrXmlnsDc(_value); begin + if ifnil({self.}XmlAttrXmlnsDc) then + begin + {self.}XmlAttrXmlnsDc := new OpenXmlAttribute("xmlns", "dc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsDc; + end {self.}XmlAttrXmlnsDc.Value := _value; end; @@ -210,6 +186,11 @@ end; function CoreProperties.WriteXmlAttrXmlnsDcterms(_value); begin + if ifnil({self.}XmlAttrXmlnsDcterms) then + begin + {self.}XmlAttrXmlnsDcterms := new OpenXmlAttribute("xmlns", "dcterms", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsDcterms; + end {self.}XmlAttrXmlnsDcterms.Value := _value; end; @@ -220,6 +201,11 @@ end; function CoreProperties.WriteXmlAttrXmlnsDcmitype(_value); begin + if ifnil({self.}XmlAttrXmlnsDcmitype) then + begin + {self.}XmlAttrXmlnsDcmitype := new OpenXmlAttribute("xmlns", "dcmitype", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsDcmitype; + end {self.}XmlAttrXmlnsDcmitype.Value := _value; end; @@ -230,5 +216,110 @@ end; function CoreProperties.WriteXmlAttrXmlnsXsi(_value); begin + if ifnil({self.}XmlAttrXmlnsXsi) then + begin + {self.}XmlAttrXmlnsXsi := new OpenXmlAttribute("xmlns", "xsi", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsXsi; + end {self.}XmlAttrXmlnsXsi.Value := _value; end; + +function CoreProperties.ReadXmlChildTitle(); +begin + if tslassigning and ifnil({self.}XmlChildTitle) then + begin + {self.}XmlChildTitle := new OpenXmlPcdata(self, "dc", "title"); + container_.Set({self.}XmlChildTitle); + end + return {self.}XmlChildTitle; +end; + +function CoreProperties.ReadXmlChildSubject(); +begin + if tslassigning and ifnil({self.}XmlChildSubject) then + begin + {self.}XmlChildSubject := new OpenXmlPcdata(self, "dc", "subject"); + container_.Set({self.}XmlChildSubject); + end + return {self.}XmlChildSubject; +end; + +function CoreProperties.ReadXmlChildCreator(); +begin + if tslassigning and ifnil({self.}XmlChildCreator) then + begin + {self.}XmlChildCreator := new OpenXmlPcdata(self, "dc", "creator"); + container_.Set({self.}XmlChildCreator); + end + return {self.}XmlChildCreator; +end; + +function CoreProperties.ReadXmlChildKeywords(); +begin + if tslassigning and ifnil({self.}XmlChildKeywords) then + begin + {self.}XmlChildKeywords := new OpenXmlPcdata(self, "cp", "keywords"); + container_.Set({self.}XmlChildKeywords); + end + return {self.}XmlChildKeywords; +end; + +function CoreProperties.ReadXmlChildDescription(); +begin + if tslassigning and ifnil({self.}XmlChildDescription) then + begin + {self.}XmlChildDescription := new OpenXmlPcdata(self, "cp", "description"); + container_.Set({self.}XmlChildDescription); + end + return {self.}XmlChildDescription; +end; + +function CoreProperties.ReadXmlChildLastModifiedBy(); +begin + if tslassigning and ifnil({self.}XmlChildLastModifiedBy) then + begin + {self.}XmlChildLastModifiedBy := new OpenXmlPcdata(self, "cp", "lastModifiedBy"); + container_.Set({self.}XmlChildLastModifiedBy); + end + return {self.}XmlChildLastModifiedBy; +end; + +function CoreProperties.ReadXmlChildRevision(); +begin + if tslassigning and ifnil({self.}XmlChildRevision) then + begin + {self.}XmlChildRevision := new OpenXmlPcdata(self, "cp", "revision"); + container_.Set({self.}XmlChildRevision); + end + return {self.}XmlChildRevision; +end; + +function CoreProperties.ReadXmlChildLastPrinted(); +begin + if tslassigning and ifnil({self.}XmlChildLastPrinted) then + begin + {self.}XmlChildLastPrinted := new OpenXmlPcdata(self, "cp", "lastPrinted"); + container_.Set({self.}XmlChildLastPrinted); + end + return {self.}XmlChildLastPrinted; +end; + +function CoreProperties.ReadXmlChildCreated(); +begin + if tslassigning and ifnil({self.}XmlChildCreated) then + begin + {self.}XmlChildCreated := new Created(self, "dcterms", "created"); + container_.Set({self.}XmlChildCreated); + end + return {self.}XmlChildCreated; +end; + +function CoreProperties.ReadXmlChildModified(); +begin + if tslassigning and ifnil({self.}XmlChildModified) then + begin + {self.}XmlChildModified := new Modified(self, "dcterms", "modified"); + container_.Set({self.}XmlChildModified); + end + return {self.}XmlChildModified; +end; diff --git a/autoclass/docx/Created@DOCX.tsf b/autoclass/docx/Created@DOCX.tsf index cffa709..c992399 100644 --- a/autoclass/docx/Created@DOCX.tsf +++ b/autoclass/docx/Created@DOCX.tsf @@ -4,19 +4,19 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Created);override; +public + + // attributes property property XsiType read ReadXmlAttrXsiType write WriteXmlAttrXsiType; function ReadXmlAttrXsiType(); function WriteXmlAttrXsiType(_value); public - // Attributes + // Attributes XmlAttrXsiType: OpenXmlAttribute; - // Children end; @@ -32,32 +32,27 @@ end; function Created.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlPcdata).Create(_parent, _prefix, _local_name); end; function Created.Init();override; begin - {self.}XmlAttrXsiType := new OpenXmlAttribute("xsi", "type", nil); -end; - -function Created.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXsiType, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xsi:type": makeweakref(thisFunction(WriteXmlAttrXsiType)), ); end; -function Created.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; -end; - function Created.Copy(_obj: Created);override; begin - if not ifnil(_obj.XmlAttrXsiType.Value) then - {self.}XmlAttrXsiType.Value := _obj.XmlAttrXsiType.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlPcdata).Copy(_obj); + if not ifnil(_obj.XsiType) then + {self.}XsiType := _obj.XsiType; + tslassigning := tslassigning_backup; end; function Created.ReadXmlAttrXsiType(); @@ -67,5 +62,10 @@ end; function Created.WriteXmlAttrXsiType(_value); begin + if ifnil({self.}XmlAttrXsiType) then + begin + {self.}XmlAttrXsiType := new OpenXmlAttribute("xsi", "type", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXsiType; + end {self.}XmlAttrXsiType.Value := _value; end; diff --git a/autoclass/docx/DLbls@DOCX.tsf b/autoclass/docx/DLbls@DOCX.tsf index d8f6d74..d0b9cdb 100644 --- a/autoclass/docx/DLbls@DOCX.tsf +++ b/autoclass/docx/DLbls@DOCX.tsf @@ -4,24 +4,41 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: DLbls);override; public - // Attributes + // normal property + property SpPr read ReadXmlChildSpPr; + property ShowLegendKey read ReadXmlChildShowLegendKey; + property ShowVal read ReadXmlChildShowVal; + property ShowCatName read ReadXmlChildShowCatName; + property ShowSerName read ReadXmlChildShowSerName; + property ShowPercent read ReadXmlChildShowPercent; + property ShowBubbleSize read ReadXmlChildShowBubbleSize; + property ShowLeaderLines read ReadXmlChildShowLeaderLines; + property ExtLst read ReadXmlChildExtLst; + function ReadXmlChildSpPr(); + function ReadXmlChildShowLegendKey(); + function ReadXmlChildShowVal(); + function ReadXmlChildShowCatName(); + function ReadXmlChildShowSerName(); + function ReadXmlChildShowPercent(); + function ReadXmlChildShowBubbleSize(); + function ReadXmlChildShowLeaderLines(); + function ReadXmlChildExtLst(); + +public // Children - SpPr: SpPr; - ShowLegendKey: PureVal; - ShowVal: PureVal; - ShowCatName: PureVal; - ShowSerName: PureVal; - ShowPercent: PureVal; - ShowBubbleSize: PureVal; - ShowLeaderLines: PureVal; - ExtLst: ExtLst; + XmlChildSpPr: SpPr; + XmlChildShowLegendKey: PureVal; + XmlChildShowVal: PureVal; + XmlChildShowCatName: PureVal; + XmlChildShowSerName: PureVal; + XmlChildShowPercent: PureVal; + XmlChildShowBubbleSize: PureVal; + XmlChildShowLeaderLines: PureVal; + XmlChildExtLst: ExtLst; end; @@ -37,102 +54,142 @@ end; function DLbls.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function DLbls.Init();override; begin - {self.}SpPr := new SpPr(self, {self.}Prefix, "spPr"); - {self.}ShowLegendKey := new PureVal(self, {self.}Prefix, "showLegendKey"); - {self.}ShowVal := new PureVal(self, {self.}Prefix, "showVal"); - {self.}ShowCatName := new PureVal(self, {self.}Prefix, "showCatName"); - {self.}ShowSerName := new PureVal(self, {self.}Prefix, "showSerName"); - {self.}ShowPercent := new PureVal(self, {self.}Prefix, "showPercent"); - {self.}ShowBubbleSize := new PureVal(self, {self.}Prefix, "showBubbleSize"); - {self.}ShowLeaderLines := new PureVal(self, {self.}Prefix, "showLeaderLines"); - {self.}ExtLst := new ExtLst(self, {self.}Prefix, "extLst"); -end; - -function DLbls.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function DLbls.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}SpPr, - 1: {self.}ShowLegendKey, - 2: {self.}ShowVal, - 3: {self.}ShowCatName, - 4: {self.}ShowSerName, - 5: {self.}ShowPercent, - 6: {self.}ShowBubbleSize, - 7: {self.}ShowLeaderLines, - 8: {self.}ExtLst, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}SpPr.ElementName: 0, - {self.}ShowLegendKey.ElementName: 1, - {self.}ShowVal.ElementName: 2, - {self.}ShowCatName.ElementName: 3, - {self.}ShowSerName.ElementName: 4, - {self.}ShowPercent.ElementName: 5, - {self.}ShowBubbleSize.ElementName: 6, - {self.}ShowLeaderLines.ElementName: 7, - {self.}ExtLst.ElementName: 8, + pre + "spPr": array(0, makeweakref(thisFunction(ReadXmlChildSpPr))), + pre + "showLegendKey": array(1, makeweakref(thisFunction(ReadXmlChildShowLegendKey))), + pre + "showVal": array(2, makeweakref(thisFunction(ReadXmlChildShowVal))), + pre + "showCatName": array(3, makeweakref(thisFunction(ReadXmlChildShowCatName))), + pre + "showSerName": array(4, makeweakref(thisFunction(ReadXmlChildShowSerName))), + pre + "showPercent": array(5, makeweakref(thisFunction(ReadXmlChildShowPercent))), + pre + "showBubbleSize": array(6, makeweakref(thisFunction(ReadXmlChildShowBubbleSize))), + pre + "showLeaderLines": array(7, makeweakref(thisFunction(ReadXmlChildShowLeaderLines))), + pre + "extLst": array(8, makeweakref(thisFunction(ReadXmlChildExtLst))), ); -end; - -function DLbls.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function DLbls.Copy(_obj: DLbls);override; begin - {self.}SpPr.Copy(_obj.SpPr); - {self.}ShowLegendKey.Copy(_obj.ShowLegendKey); - {self.}ShowVal.Copy(_obj.ShowVal); - {self.}ShowCatName.Copy(_obj.ShowCatName); - {self.}ShowSerName.Copy(_obj.ShowSerName); - {self.}ShowPercent.Copy(_obj.ShowPercent); - {self.}ShowBubbleSize.Copy(_obj.ShowBubbleSize); - {self.}ShowLeaderLines.Copy(_obj.ShowLeaderLines); - {self.}ExtLst.Copy(_obj.ExtLst); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildSpPr) then + {self.}SpPr.Copy(_obj.XmlChildSpPr); + if not ifnil(_obj.XmlChildShowLegendKey) then + {self.}ShowLegendKey.Copy(_obj.XmlChildShowLegendKey); + if not ifnil(_obj.XmlChildShowVal) then + {self.}ShowVal.Copy(_obj.XmlChildShowVal); + if not ifnil(_obj.XmlChildShowCatName) then + {self.}ShowCatName.Copy(_obj.XmlChildShowCatName); + if not ifnil(_obj.XmlChildShowSerName) then + {self.}ShowSerName.Copy(_obj.XmlChildShowSerName); + if not ifnil(_obj.XmlChildShowPercent) then + {self.}ShowPercent.Copy(_obj.XmlChildShowPercent); + if not ifnil(_obj.XmlChildShowBubbleSize) then + {self.}ShowBubbleSize.Copy(_obj.XmlChildShowBubbleSize); + if not ifnil(_obj.XmlChildShowLeaderLines) then + {self.}ShowLeaderLines.Copy(_obj.XmlChildShowLeaderLines); + if not ifnil(_obj.XmlChildExtLst) then + {self.}ExtLst.Copy(_obj.XmlChildExtLst); + tslassigning := tslassigning_backup; +end; + +function DLbls.ReadXmlChildSpPr(); +begin + if tslassigning and ifnil({self.}XmlChildSpPr) then + begin + {self.}XmlChildSpPr := new SpPr(self, {self.}Prefix, "spPr"); + container_.Set({self.}XmlChildSpPr); + end + return {self.}XmlChildSpPr; +end; + +function DLbls.ReadXmlChildShowLegendKey(); +begin + if tslassigning and ifnil({self.}XmlChildShowLegendKey) then + begin + {self.}XmlChildShowLegendKey := new PureVal(self, {self.}Prefix, "showLegendKey"); + container_.Set({self.}XmlChildShowLegendKey); + end + return {self.}XmlChildShowLegendKey; +end; + +function DLbls.ReadXmlChildShowVal(); +begin + if tslassigning and ifnil({self.}XmlChildShowVal) then + begin + {self.}XmlChildShowVal := new PureVal(self, {self.}Prefix, "showVal"); + container_.Set({self.}XmlChildShowVal); + end + return {self.}XmlChildShowVal; +end; + +function DLbls.ReadXmlChildShowCatName(); +begin + if tslassigning and ifnil({self.}XmlChildShowCatName) then + begin + {self.}XmlChildShowCatName := new PureVal(self, {self.}Prefix, "showCatName"); + container_.Set({self.}XmlChildShowCatName); + end + return {self.}XmlChildShowCatName; +end; + +function DLbls.ReadXmlChildShowSerName(); +begin + if tslassigning and ifnil({self.}XmlChildShowSerName) then + begin + {self.}XmlChildShowSerName := new PureVal(self, {self.}Prefix, "showSerName"); + container_.Set({self.}XmlChildShowSerName); + end + return {self.}XmlChildShowSerName; +end; + +function DLbls.ReadXmlChildShowPercent(); +begin + if tslassigning and ifnil({self.}XmlChildShowPercent) then + begin + {self.}XmlChildShowPercent := new PureVal(self, {self.}Prefix, "showPercent"); + container_.Set({self.}XmlChildShowPercent); + end + return {self.}XmlChildShowPercent; +end; + +function DLbls.ReadXmlChildShowBubbleSize(); +begin + if tslassigning and ifnil({self.}XmlChildShowBubbleSize) then + begin + {self.}XmlChildShowBubbleSize := new PureVal(self, {self.}Prefix, "showBubbleSize"); + container_.Set({self.}XmlChildShowBubbleSize); + end + return {self.}XmlChildShowBubbleSize; +end; + +function DLbls.ReadXmlChildShowLeaderLines(); +begin + if tslassigning and ifnil({self.}XmlChildShowLeaderLines) then + begin + {self.}XmlChildShowLeaderLines := new PureVal(self, {self.}Prefix, "showLeaderLines"); + container_.Set({self.}XmlChildShowLeaderLines); + end + return {self.}XmlChildShowLeaderLines; +end; + +function DLbls.ReadXmlChildExtLst(); +begin + if tslassigning and ifnil({self.}XmlChildExtLst) then + begin + {self.}XmlChildExtLst := new ExtLst(self, {self.}Prefix, "extLst"); + container_.Set({self.}XmlChildExtLst); + end + return {self.}XmlChildExtLst; end; diff --git a/autoclass/docx/DTable@DOCX.tsf b/autoclass/docx/DTable@DOCX.tsf index 2ddbbc1..a686878 100644 --- a/autoclass/docx/DTable@DOCX.tsf +++ b/autoclass/docx/DTable@DOCX.tsf @@ -4,20 +4,29 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: DTable);override; public - // Attributes + // normal property + property ShowHorzBorder read ReadXmlChildShowHorzBorder; + property ShowVertBorder read ReadXmlChildShowVertBorder; + property ShowOutline read ReadXmlChildShowOutline; + property ShowKeys read ReadXmlChildShowKeys; + property TxPr read ReadXmlChildTxPr; + function ReadXmlChildShowHorzBorder(); + function ReadXmlChildShowVertBorder(); + function ReadXmlChildShowOutline(); + function ReadXmlChildShowKeys(); + function ReadXmlChildTxPr(); + +public // Children - ShowHorzBorder: PureVal; - ShowVertBorder: PureVal; - ShowOutline: PureVal; - ShowKeys: PureVal; - TxPr: TxPr; + XmlChildShowHorzBorder: PureVal; + XmlChildShowVertBorder: PureVal; + XmlChildShowOutline: PureVal; + XmlChildShowKeys: PureVal; + XmlChildTxPr: TxPr; end; @@ -33,86 +42,90 @@ end; function DTable.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function DTable.Init();override; begin - {self.}ShowHorzBorder := new PureVal(self, {self.}Prefix, "showHorzBorder"); - {self.}ShowVertBorder := new PureVal(self, {self.}Prefix, "showVertBorder"); - {self.}ShowOutline := new PureVal(self, {self.}Prefix, "showOutline"); - {self.}ShowKeys := new PureVal(self, {self.}Prefix, "showKeys"); - {self.}TxPr := new TxPr(self, {self.}Prefix, "txPr"); -end; - -function DTable.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function DTable.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}ShowHorzBorder, - 1: {self.}ShowVertBorder, - 2: {self.}ShowOutline, - 3: {self.}ShowKeys, - 4: {self.}TxPr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}ShowHorzBorder.ElementName: 0, - {self.}ShowVertBorder.ElementName: 1, - {self.}ShowOutline.ElementName: 2, - {self.}ShowKeys.ElementName: 3, - {self.}TxPr.ElementName: 4, + pre + "showHorzBorder": array(0, makeweakref(thisFunction(ReadXmlChildShowHorzBorder))), + pre + "showVertBorder": array(1, makeweakref(thisFunction(ReadXmlChildShowVertBorder))), + pre + "showOutline": array(2, makeweakref(thisFunction(ReadXmlChildShowOutline))), + pre + "showKeys": array(3, makeweakref(thisFunction(ReadXmlChildShowKeys))), + pre + "txPr": array(4, makeweakref(thisFunction(ReadXmlChildTxPr))), ); -end; - -function DTable.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function DTable.Copy(_obj: DTable);override; begin - {self.}ShowHorzBorder.Copy(_obj.ShowHorzBorder); - {self.}ShowVertBorder.Copy(_obj.ShowVertBorder); - {self.}ShowOutline.Copy(_obj.ShowOutline); - {self.}ShowKeys.Copy(_obj.ShowKeys); - {self.}TxPr.Copy(_obj.TxPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildShowHorzBorder) then + {self.}ShowHorzBorder.Copy(_obj.XmlChildShowHorzBorder); + if not ifnil(_obj.XmlChildShowVertBorder) then + {self.}ShowVertBorder.Copy(_obj.XmlChildShowVertBorder); + if not ifnil(_obj.XmlChildShowOutline) then + {self.}ShowOutline.Copy(_obj.XmlChildShowOutline); + if not ifnil(_obj.XmlChildShowKeys) then + {self.}ShowKeys.Copy(_obj.XmlChildShowKeys); + if not ifnil(_obj.XmlChildTxPr) then + {self.}TxPr.Copy(_obj.XmlChildTxPr); + tslassigning := tslassigning_backup; +end; + +function DTable.ReadXmlChildShowHorzBorder(); +begin + if tslassigning and ifnil({self.}XmlChildShowHorzBorder) then + begin + {self.}XmlChildShowHorzBorder := new PureVal(self, {self.}Prefix, "showHorzBorder"); + container_.Set({self.}XmlChildShowHorzBorder); + end + return {self.}XmlChildShowHorzBorder; +end; + +function DTable.ReadXmlChildShowVertBorder(); +begin + if tslassigning and ifnil({self.}XmlChildShowVertBorder) then + begin + {self.}XmlChildShowVertBorder := new PureVal(self, {self.}Prefix, "showVertBorder"); + container_.Set({self.}XmlChildShowVertBorder); + end + return {self.}XmlChildShowVertBorder; +end; + +function DTable.ReadXmlChildShowOutline(); +begin + if tslassigning and ifnil({self.}XmlChildShowOutline) then + begin + {self.}XmlChildShowOutline := new PureVal(self, {self.}Prefix, "showOutline"); + container_.Set({self.}XmlChildShowOutline); + end + return {self.}XmlChildShowOutline; +end; + +function DTable.ReadXmlChildShowKeys(); +begin + if tslassigning and ifnil({self.}XmlChildShowKeys) then + begin + {self.}XmlChildShowKeys := new PureVal(self, {self.}Prefix, "showKeys"); + container_.Set({self.}XmlChildShowKeys); + end + return {self.}XmlChildShowKeys; +end; + +function DTable.ReadXmlChildTxPr(); +begin + if tslassigning and ifnil({self.}XmlChildTxPr) then + begin + {self.}XmlChildTxPr := new TxPr(self, {self.}Prefix, "txPr"); + container_.Set({self.}XmlChildTxPr); + end + return {self.}XmlChildTxPr; end; diff --git a/autoclass/docx/Default@DOCX.tsf b/autoclass/docx/Default@DOCX.tsf index 5f8cad2..30211f9 100644 --- a/autoclass/docx/Default@DOCX.tsf +++ b/autoclass/docx/Default@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Default);override; +public + + // attributes property property Extension read ReadXmlAttrExtension write WriteXmlAttrExtension; property ContentType read ReadXmlAttrContentType write WriteXmlAttrContentType; function ReadXmlAttrExtension(); @@ -17,17 +17,16 @@ public function WriteXmlAttrContentType(_value); public - // Attributes + // Attributes XmlAttrExtension: OpenXmlAttribute; XmlAttrContentType: OpenXmlAttribute; - // Children end; function Default.Create();overload; begin - {self.}Create(nil, nil, "Default"); + {self.}Create(nil, "", "Default"); end; function Default.Create(_node: XmlNode);overload; @@ -37,45 +36,33 @@ end; function Default.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Default.Init();override; begin - {self.}XmlAttrExtension := new OpenXmlAttribute(nil, "Extension", nil); - {self.}XmlAttrContentType := new OpenXmlAttribute(nil, "ContentType", nil); -end; - -function Default.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrExtension, - {self.}XmlAttrContentType, - ); -end; - -function Default.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "Extension": makeweakref(thisFunction(WriteXmlAttrExtension)), + "ContentType": makeweakref(thisFunction(WriteXmlAttrContentType)), ); sorted_child_ := array( - "": -1, ); -end; - -function Default.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Default.Copy(_obj: Default);override; begin - if not ifnil(_obj.XmlAttrExtension.Value) then - {self.}XmlAttrExtension.Value := _obj.XmlAttrExtension.Value; - if not ifnil(_obj.XmlAttrContentType.Value) then - {self.}XmlAttrContentType.Value := _obj.XmlAttrContentType.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Extension) then + {self.}Extension := _obj.Extension; + if not ifnil(_obj.ContentType) then + {self.}ContentType := _obj.ContentType; + tslassigning := tslassigning_backup; end; function Default.ReadXmlAttrExtension(); @@ -85,6 +72,11 @@ end; function Default.WriteXmlAttrExtension(_value); begin + if ifnil({self.}XmlAttrExtension) then + begin + {self.}XmlAttrExtension := new OpenXmlAttribute("", "Extension", nil); + attributes_[length(attributes_)] := {self.}XmlAttrExtension; + end {self.}XmlAttrExtension.Value := _value; end; @@ -95,5 +87,10 @@ end; function Default.WriteXmlAttrContentType(_value); begin + if ifnil({self.}XmlAttrContentType) then + begin + {self.}XmlAttrContentType := new OpenXmlAttribute("", "ContentType", nil); + attributes_[length(attributes_)] := {self.}XmlAttrContentType; + end {self.}XmlAttrContentType.Value := _value; end; diff --git a/autoclass/docx/DocDefaults@DOCX.tsf b/autoclass/docx/DocDefaults@DOCX.tsf index f8cc31c..64770cf 100644 --- a/autoclass/docx/DocDefaults@DOCX.tsf +++ b/autoclass/docx/DocDefaults@DOCX.tsf @@ -4,17 +4,20 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: DocDefaults);override; public - // Attributes + // normal property + property RPrDefault read ReadXmlChildRPrDefault; + property PPrDefault read ReadXmlChildPPrDefault; + function ReadXmlChildRPrDefault(); + function ReadXmlChildPPrDefault(); + +public // Children - RPrDefault: RPrDefault; - PPrDefault: PPrDefault; + XmlChildRPrDefault: RPrDefault; + XmlChildPPrDefault: PPrDefault; end; @@ -30,74 +33,51 @@ end; function DocDefaults.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function DocDefaults.Init();override; begin - {self.}RPrDefault := new RPrDefault(self, {self.}Prefix, "rPrDefault"); - {self.}PPrDefault := new PPrDefault(self, {self.}Prefix, "pPrDefault"); -end; - -function DocDefaults.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function DocDefaults.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}RPrDefault, - 1: {self.}PPrDefault, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}RPrDefault.ElementName: 0, - {self.}PPrDefault.ElementName: 1, + pre + "rPrDefault": array(0, makeweakref(thisFunction(ReadXmlChildRPrDefault))), + pre + "pPrDefault": array(1, makeweakref(thisFunction(ReadXmlChildPPrDefault))), ); -end; - -function DocDefaults.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function DocDefaults.Copy(_obj: DocDefaults);override; begin - {self.}RPrDefault.Copy(_obj.RPrDefault); - {self.}PPrDefault.Copy(_obj.PPrDefault); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildRPrDefault) then + {self.}RPrDefault.Copy(_obj.XmlChildRPrDefault); + if not ifnil(_obj.XmlChildPPrDefault) then + {self.}PPrDefault.Copy(_obj.XmlChildPPrDefault); + tslassigning := tslassigning_backup; +end; + +function DocDefaults.ReadXmlChildRPrDefault(); +begin + if tslassigning and ifnil({self.}XmlChildRPrDefault) then + begin + {self.}XmlChildRPrDefault := new RPrDefault(self, {self.}Prefix, "rPrDefault"); + container_.Set({self.}XmlChildRPrDefault); + end + return {self.}XmlChildRPrDefault; +end; + +function DocDefaults.ReadXmlChildPPrDefault(); +begin + if tslassigning and ifnil({self.}XmlChildPPrDefault) then + begin + {self.}XmlChildPPrDefault := new PPrDefault(self, {self.}Prefix, "pPrDefault"); + container_.Set({self.}XmlChildPPrDefault); + end + return {self.}XmlChildPPrDefault; end; diff --git a/autoclass/docx/DocGrid@DOCX.tsf b/autoclass/docx/DocGrid@DOCX.tsf index 9a9ae2b..121dee3 100644 --- a/autoclass/docx/DocGrid@DOCX.tsf +++ b/autoclass/docx/DocGrid@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: DocGrid);override; +public + + // attributes property property Type read ReadXmlAttrType write WriteXmlAttrType; property LinePitch read ReadXmlAttrLinePitch write WriteXmlAttrLinePitch; function ReadXmlAttrType(); @@ -17,11 +17,10 @@ public function WriteXmlAttrLinePitch(_value); public - // Attributes + // Attributes XmlAttrType: OpenXmlAttribute; XmlAttrLinePitch: OpenXmlAttribute; - // Children end; @@ -37,45 +36,33 @@ end; function DocGrid.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function DocGrid.Init();override; begin - {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); - {self.}XmlAttrLinePitch := new OpenXmlAttribute({self.}Prefix, "linePitch", nil); -end; - -function DocGrid.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrType, - {self.}XmlAttrLinePitch, - ); -end; - -function DocGrid.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "type": makeweakref(thisFunction(WriteXmlAttrType)), + pre + "linePitch": makeweakref(thisFunction(WriteXmlAttrLinePitch)), ); sorted_child_ := array( - "": -1, ); -end; - -function DocGrid.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function DocGrid.Copy(_obj: DocGrid);override; begin - if not ifnil(_obj.XmlAttrType.Value) then - {self.}XmlAttrType.Value := _obj.XmlAttrType.Value; - if not ifnil(_obj.XmlAttrLinePitch.Value) then - {self.}XmlAttrLinePitch.Value := _obj.XmlAttrLinePitch.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Type) then + {self.}Type := _obj.Type; + if not ifnil(_obj.LinePitch) then + {self.}LinePitch := _obj.LinePitch; + tslassigning := tslassigning_backup; end; function DocGrid.ReadXmlAttrType(); @@ -85,6 +72,11 @@ end; function DocGrid.WriteXmlAttrType(_value); begin + if ifnil({self.}XmlAttrType) then + begin + {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); + attributes_[length(attributes_)] := {self.}XmlAttrType; + end {self.}XmlAttrType.Value := _value; end; @@ -95,5 +87,10 @@ end; function DocGrid.WriteXmlAttrLinePitch(_value); begin + if ifnil({self.}XmlAttrLinePitch) then + begin + {self.}XmlAttrLinePitch := new OpenXmlAttribute({self.}Prefix, "linePitch", nil); + attributes_[length(attributes_)] := {self.}XmlAttrLinePitch; + end {self.}XmlAttrLinePitch.Value := _value; end; diff --git a/autoclass/docx/DocPartObj@DOCX.tsf b/autoclass/docx/DocPartObj@DOCX.tsf index 8b511ad..e1283ef 100644 --- a/autoclass/docx/DocPartObj@DOCX.tsf +++ b/autoclass/docx/DocPartObj@DOCX.tsf @@ -4,17 +4,20 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: DocPartObj);override; public - // Attributes + // normal property + property DocPartGallery read ReadXmlChildDocPartGallery; + property DocPartUnique read ReadXmlChildDocPartUnique; + function ReadXmlChildDocPartGallery(); + function ReadXmlChildDocPartUnique(); + +public // Children - DocPartGallery: PureWVal; - DocPartUnique: PureVal; + XmlChildDocPartGallery: PureWVal; + XmlChildDocPartUnique: PureVal; end; @@ -30,74 +33,51 @@ end; function DocPartObj.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function DocPartObj.Init();override; begin - {self.}DocPartGallery := new PureWVal(self, {self.}Prefix, "docPartGallery"); - {self.}DocPartUnique := new PureVal(self, {self.}Prefix, "docPartUnique"); -end; - -function DocPartObj.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function DocPartObj.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}DocPartGallery, - 1: {self.}DocPartUnique, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}DocPartGallery.ElementName: 0, - {self.}DocPartUnique.ElementName: 1, + pre + "docPartGallery": array(0, makeweakref(thisFunction(ReadXmlChildDocPartGallery))), + pre + "docPartUnique": array(1, makeweakref(thisFunction(ReadXmlChildDocPartUnique))), ); -end; - -function DocPartObj.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function DocPartObj.Copy(_obj: DocPartObj);override; begin - {self.}DocPartGallery.Copy(_obj.DocPartGallery); - {self.}DocPartUnique.Copy(_obj.DocPartUnique); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildDocPartGallery) then + {self.}DocPartGallery.Copy(_obj.XmlChildDocPartGallery); + if not ifnil(_obj.XmlChildDocPartUnique) then + {self.}DocPartUnique.Copy(_obj.XmlChildDocPartUnique); + tslassigning := tslassigning_backup; +end; + +function DocPartObj.ReadXmlChildDocPartGallery(); +begin + if tslassigning and ifnil({self.}XmlChildDocPartGallery) then + begin + {self.}XmlChildDocPartGallery := new PureWVal(self, {self.}Prefix, "docPartGallery"); + container_.Set({self.}XmlChildDocPartGallery); + end + return {self.}XmlChildDocPartGallery; +end; + +function DocPartObj.ReadXmlChildDocPartUnique(); +begin + if tslassigning and ifnil({self.}XmlChildDocPartUnique) then + begin + {self.}XmlChildDocPartUnique := new PureVal(self, {self.}Prefix, "docPartUnique"); + container_.Set({self.}XmlChildDocPartUnique); + end + return {self.}XmlChildDocPartUnique; end; diff --git a/autoclass/docx/DocPr@DOCX.tsf b/autoclass/docx/DocPr@DOCX.tsf index e238b38..0ec2e66 100644 --- a/autoclass/docx/DocPr@DOCX.tsf +++ b/autoclass/docx/DocPr@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: DocPr);override; +public + + // attributes property property Id read ReadXmlAttrId write WriteXmlAttrId; property Name read ReadXmlAttrName write WriteXmlAttrName; property Descr read ReadXmlAttrDescr write WriteXmlAttrDescr; @@ -20,12 +20,11 @@ public function WriteXmlAttrDescr(_value); public - // Attributes + // Attributes XmlAttrId: OpenXmlAttribute; XmlAttrName: OpenXmlAttribute; XmlAttrDescr: OpenXmlAttribute; - // Children end; @@ -41,49 +40,36 @@ end; function DocPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function DocPr.Init();override; begin - {self.}XmlAttrId := new OpenXmlAttribute(nil, "id", nil); - {self.}XmlAttrName := new OpenXmlAttribute(nil, "name", nil); - {self.}XmlAttrDescr := new OpenXmlAttribute(nil, "descr", nil); -end; - -function DocPr.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrId, - {self.}XmlAttrName, - {self.}XmlAttrDescr, - ); -end; - -function DocPr.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "id": makeweakref(thisFunction(WriteXmlAttrId)), + "name": makeweakref(thisFunction(WriteXmlAttrName)), + "descr": makeweakref(thisFunction(WriteXmlAttrDescr)), ); sorted_child_ := array( - "": -1, ); -end; - -function DocPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function DocPr.Copy(_obj: DocPr);override; begin - if not ifnil(_obj.XmlAttrId.Value) then - {self.}XmlAttrId.Value := _obj.XmlAttrId.Value; - if not ifnil(_obj.XmlAttrName.Value) then - {self.}XmlAttrName.Value := _obj.XmlAttrName.Value; - if not ifnil(_obj.XmlAttrDescr.Value) then - {self.}XmlAttrDescr.Value := _obj.XmlAttrDescr.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Id) then + {self.}Id := _obj.Id; + if not ifnil(_obj.Name) then + {self.}Name := _obj.Name; + if not ifnil(_obj.Descr) then + {self.}Descr := _obj.Descr; + tslassigning := tslassigning_backup; end; function DocPr.ReadXmlAttrId(); @@ -93,6 +79,11 @@ end; function DocPr.WriteXmlAttrId(_value); begin + if ifnil({self.}XmlAttrId) then + begin + {self.}XmlAttrId := new OpenXmlAttribute("", "id", nil); + attributes_[length(attributes_)] := {self.}XmlAttrId; + end {self.}XmlAttrId.Value := _value; end; @@ -103,6 +94,11 @@ end; function DocPr.WriteXmlAttrName(_value); begin + if ifnil({self.}XmlAttrName) then + begin + {self.}XmlAttrName := new OpenXmlAttribute("", "name", nil); + attributes_[length(attributes_)] := {self.}XmlAttrName; + end {self.}XmlAttrName.Value := _value; end; @@ -113,5 +109,10 @@ end; function DocPr.WriteXmlAttrDescr(_value); begin + if ifnil({self.}XmlAttrDescr) then + begin + {self.}XmlAttrDescr := new OpenXmlAttribute("", "descr", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDescr; + end {self.}XmlAttrDescr.Value := _value; end; diff --git a/autoclass/docx/Document@DOCX.tsf b/autoclass/docx/Document@DOCX.tsf index d7679f6..91f9aa2 100644 --- a/autoclass/docx/Document@DOCX.tsf +++ b/autoclass/docx/Document@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Document);override; +public + + // attributes property property XmlnsWpc read ReadXmlAttrXmlnsWpc write WriteXmlAttrXmlnsWpc; property XmlnsW15 read ReadXmlAttrXmlnsW15 write WriteXmlAttrXmlnsW15; property XmlnsW16Cex read ReadXmlAttrXmlnsW16Cex write WriteXmlAttrXmlnsW16Cex; @@ -49,8 +49,12 @@ public function ReadXmlAttrMcIgnorable(); function WriteXmlAttrMcIgnorable(_value); + // normal property + property Body read ReadXmlChildBody; + function ReadXmlChildBody(); + public - // Attributes + // Attributes XmlAttrXmlnsWpc: OpenXmlAttribute; XmlAttrXmlnsW15: OpenXmlAttribute; XmlAttrXmlnsW16Cex: OpenXmlAttribute; @@ -66,7 +70,7 @@ public XmlAttrMcIgnorable: OpenXmlAttribute; // Children - Body: Body; + XmlChildBody: Body; end; @@ -82,124 +86,69 @@ end; function Document.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Document.Init();override; begin - {self.}XmlAttrXmlnsWpc := new OpenXmlAttribute("xmlns", "wpc", nil); - {self.}XmlAttrXmlnsW15 := new OpenXmlAttribute("xmlns", "w15", nil); - {self.}XmlAttrXmlnsW16Cex := new OpenXmlAttribute("xmlns", "w16cex", nil); - {self.}XmlAttrXmlnsW16Cid := new OpenXmlAttribute("xmlns", "w16cid", nil); - {self.}XmlAttrXmlnsW16 := new OpenXmlAttribute("xmlns", "w16", nil); - {self.}XmlAttrXmlnsW16Du := new OpenXmlAttribute("xmlns", "w16du", nil); - {self.}XmlAttrXmlnsW16sdtdh := new OpenXmlAttribute("xmlns", "w16sdtdh", nil); - {self.}XmlAttrXmlnsW16se := new OpenXmlAttribute("xmlns", "w16se", nil); - {self.}XmlAttrXmlnsWpg := new OpenXmlAttribute("xmlns", "wpg", nil); - {self.}XmlAttrXmlnsWpi := new OpenXmlAttribute("xmlns", "wpi", nil); - {self.}XmlAttrXmlnsWne := new OpenXmlAttribute("xmlns", "wne", nil); - {self.}XmlAttrXmlnsWps := new OpenXmlAttribute("xmlns", "wps", nil); - {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); - {self.}Body := new Body(self, {self.}Prefix, "body"); -end; - -function Document.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXmlnsWpc, - {self.}XmlAttrXmlnsW15, - {self.}XmlAttrXmlnsW16Cex, - {self.}XmlAttrXmlnsW16Cid, - {self.}XmlAttrXmlnsW16, - {self.}XmlAttrXmlnsW16Du, - {self.}XmlAttrXmlnsW16sdtdh, - {self.}XmlAttrXmlnsW16se, - {self.}XmlAttrXmlnsWpg, - {self.}XmlAttrXmlnsWpi, - {self.}XmlAttrXmlnsWne, - {self.}XmlAttrXmlnsWps, - {self.}XmlAttrMcIgnorable, - ); -end; - -function Document.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Body, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns:wpc": makeweakref(thisFunction(WriteXmlAttrXmlnsWpc)), + "xmlns:w15": makeweakref(thisFunction(WriteXmlAttrXmlnsW15)), + "xmlns:w16cex": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Cex)), + "xmlns:w16cid": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Cid)), + "xmlns:w16": makeweakref(thisFunction(WriteXmlAttrXmlnsW16)), + "xmlns:w16du": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Du)), + "xmlns:w16sdtdh": makeweakref(thisFunction(WriteXmlAttrXmlnsW16sdtdh)), + "xmlns:w16se": makeweakref(thisFunction(WriteXmlAttrXmlnsW16se)), + "xmlns:wpg": makeweakref(thisFunction(WriteXmlAttrXmlnsWpg)), + "xmlns:wpi": makeweakref(thisFunction(WriteXmlAttrXmlnsWpi)), + "xmlns:wne": makeweakref(thisFunction(WriteXmlAttrXmlnsWne)), + "xmlns:wps": makeweakref(thisFunction(WriteXmlAttrXmlnsWps)), + "mc:Ignorable": makeweakref(thisFunction(WriteXmlAttrMcIgnorable)), ); sorted_child_ := array( - "": -1, - {self.}Body.ElementName: 0, + pre + "body": array(0, makeweakref(thisFunction(ReadXmlChildBody))), ); -end; - -function Document.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Document.Copy(_obj: Document);override; begin - if not ifnil(_obj.XmlAttrXmlnsWpc.Value) then - {self.}XmlAttrXmlnsWpc.Value := _obj.XmlAttrXmlnsWpc.Value; - if not ifnil(_obj.XmlAttrXmlnsW15.Value) then - {self.}XmlAttrXmlnsW15.Value := _obj.XmlAttrXmlnsW15.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Cex.Value) then - {self.}XmlAttrXmlnsW16Cex.Value := _obj.XmlAttrXmlnsW16Cex.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Cid.Value) then - {self.}XmlAttrXmlnsW16Cid.Value := _obj.XmlAttrXmlnsW16Cid.Value; - if not ifnil(_obj.XmlAttrXmlnsW16.Value) then - {self.}XmlAttrXmlnsW16.Value := _obj.XmlAttrXmlnsW16.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Du.Value) then - {self.}XmlAttrXmlnsW16Du.Value := _obj.XmlAttrXmlnsW16Du.Value; - if not ifnil(_obj.XmlAttrXmlnsW16sdtdh.Value) then - {self.}XmlAttrXmlnsW16sdtdh.Value := _obj.XmlAttrXmlnsW16sdtdh.Value; - if not ifnil(_obj.XmlAttrXmlnsW16se.Value) then - {self.}XmlAttrXmlnsW16se.Value := _obj.XmlAttrXmlnsW16se.Value; - if not ifnil(_obj.XmlAttrXmlnsWpg.Value) then - {self.}XmlAttrXmlnsWpg.Value := _obj.XmlAttrXmlnsWpg.Value; - if not ifnil(_obj.XmlAttrXmlnsWpi.Value) then - {self.}XmlAttrXmlnsWpi.Value := _obj.XmlAttrXmlnsWpi.Value; - if not ifnil(_obj.XmlAttrXmlnsWne.Value) then - {self.}XmlAttrXmlnsWne.Value := _obj.XmlAttrXmlnsWne.Value; - if not ifnil(_obj.XmlAttrXmlnsWps.Value) then - {self.}XmlAttrXmlnsWps.Value := _obj.XmlAttrXmlnsWps.Value; - if not ifnil(_obj.XmlAttrMcIgnorable.Value) then - {self.}XmlAttrMcIgnorable.Value := _obj.XmlAttrMcIgnorable.Value; - {self.}Body.Copy(_obj.Body); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlnsWpc) then + {self.}XmlnsWpc := _obj.XmlnsWpc; + if not ifnil(_obj.XmlnsW15) then + {self.}XmlnsW15 := _obj.XmlnsW15; + if not ifnil(_obj.XmlnsW16Cex) then + {self.}XmlnsW16Cex := _obj.XmlnsW16Cex; + if not ifnil(_obj.XmlnsW16Cid) then + {self.}XmlnsW16Cid := _obj.XmlnsW16Cid; + if not ifnil(_obj.XmlnsW16) then + {self.}XmlnsW16 := _obj.XmlnsW16; + if not ifnil(_obj.XmlnsW16Du) then + {self.}XmlnsW16Du := _obj.XmlnsW16Du; + if not ifnil(_obj.XmlnsW16sdtdh) then + {self.}XmlnsW16sdtdh := _obj.XmlnsW16sdtdh; + if not ifnil(_obj.XmlnsW16se) then + {self.}XmlnsW16se := _obj.XmlnsW16se; + if not ifnil(_obj.XmlnsWpg) then + {self.}XmlnsWpg := _obj.XmlnsWpg; + if not ifnil(_obj.XmlnsWpi) then + {self.}XmlnsWpi := _obj.XmlnsWpi; + if not ifnil(_obj.XmlnsWne) then + {self.}XmlnsWne := _obj.XmlnsWne; + if not ifnil(_obj.XmlnsWps) then + {self.}XmlnsWps := _obj.XmlnsWps; + if not ifnil(_obj.McIgnorable) then + {self.}McIgnorable := _obj.McIgnorable; + if not ifnil(_obj.XmlChildBody) then + {self.}Body.Copy(_obj.XmlChildBody); + tslassigning := tslassigning_backup; end; function Document.ReadXmlAttrXmlnsWpc(); @@ -209,6 +158,11 @@ end; function Document.WriteXmlAttrXmlnsWpc(_value); begin + if ifnil({self.}XmlAttrXmlnsWpc) then + begin + {self.}XmlAttrXmlnsWpc := new OpenXmlAttribute("xmlns", "wpc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpc; + end {self.}XmlAttrXmlnsWpc.Value := _value; end; @@ -219,6 +173,11 @@ end; function Document.WriteXmlAttrXmlnsW15(_value); begin + if ifnil({self.}XmlAttrXmlnsW15) then + begin + {self.}XmlAttrXmlnsW15 := new OpenXmlAttribute("xmlns", "w15", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW15; + end {self.}XmlAttrXmlnsW15.Value := _value; end; @@ -229,6 +188,11 @@ end; function Document.WriteXmlAttrXmlnsW16Cex(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Cex) then + begin + {self.}XmlAttrXmlnsW16Cex := new OpenXmlAttribute("xmlns", "w16cex", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Cex; + end {self.}XmlAttrXmlnsW16Cex.Value := _value; end; @@ -239,6 +203,11 @@ end; function Document.WriteXmlAttrXmlnsW16Cid(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Cid) then + begin + {self.}XmlAttrXmlnsW16Cid := new OpenXmlAttribute("xmlns", "w16cid", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Cid; + end {self.}XmlAttrXmlnsW16Cid.Value := _value; end; @@ -249,6 +218,11 @@ end; function Document.WriteXmlAttrXmlnsW16(_value); begin + if ifnil({self.}XmlAttrXmlnsW16) then + begin + {self.}XmlAttrXmlnsW16 := new OpenXmlAttribute("xmlns", "w16", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16; + end {self.}XmlAttrXmlnsW16.Value := _value; end; @@ -259,6 +233,11 @@ end; function Document.WriteXmlAttrXmlnsW16Du(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Du) then + begin + {self.}XmlAttrXmlnsW16Du := new OpenXmlAttribute("xmlns", "w16du", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Du; + end {self.}XmlAttrXmlnsW16Du.Value := _value; end; @@ -269,6 +248,11 @@ end; function Document.WriteXmlAttrXmlnsW16sdtdh(_value); begin + if ifnil({self.}XmlAttrXmlnsW16sdtdh) then + begin + {self.}XmlAttrXmlnsW16sdtdh := new OpenXmlAttribute("xmlns", "w16sdtdh", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16sdtdh; + end {self.}XmlAttrXmlnsW16sdtdh.Value := _value; end; @@ -279,6 +263,11 @@ end; function Document.WriteXmlAttrXmlnsW16se(_value); begin + if ifnil({self.}XmlAttrXmlnsW16se) then + begin + {self.}XmlAttrXmlnsW16se := new OpenXmlAttribute("xmlns", "w16se", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16se; + end {self.}XmlAttrXmlnsW16se.Value := _value; end; @@ -289,6 +278,11 @@ end; function Document.WriteXmlAttrXmlnsWpg(_value); begin + if ifnil({self.}XmlAttrXmlnsWpg) then + begin + {self.}XmlAttrXmlnsWpg := new OpenXmlAttribute("xmlns", "wpg", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpg; + end {self.}XmlAttrXmlnsWpg.Value := _value; end; @@ -299,6 +293,11 @@ end; function Document.WriteXmlAttrXmlnsWpi(_value); begin + if ifnil({self.}XmlAttrXmlnsWpi) then + begin + {self.}XmlAttrXmlnsWpi := new OpenXmlAttribute("xmlns", "wpi", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpi; + end {self.}XmlAttrXmlnsWpi.Value := _value; end; @@ -309,6 +308,11 @@ end; function Document.WriteXmlAttrXmlnsWne(_value); begin + if ifnil({self.}XmlAttrXmlnsWne) then + begin + {self.}XmlAttrXmlnsWne := new OpenXmlAttribute("xmlns", "wne", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWne; + end {self.}XmlAttrXmlnsWne.Value := _value; end; @@ -319,6 +323,11 @@ end; function Document.WriteXmlAttrXmlnsWps(_value); begin + if ifnil({self.}XmlAttrXmlnsWps) then + begin + {self.}XmlAttrXmlnsWps := new OpenXmlAttribute("xmlns", "wps", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWps; + end {self.}XmlAttrXmlnsWps.Value := _value; end; @@ -329,5 +338,20 @@ end; function Document.WriteXmlAttrMcIgnorable(_value); begin + if ifnil({self.}XmlAttrMcIgnorable) then + begin + {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); + attributes_[length(attributes_)] := {self.}XmlAttrMcIgnorable; + end {self.}XmlAttrMcIgnorable.Value := _value; end; + +function Document.ReadXmlChildBody(); +begin + if tslassigning and ifnil({self.}XmlChildBody) then + begin + {self.}XmlChildBody := new Body(self, {self.}Prefix, "body"); + container_.Set({self.}XmlChildBody); + end + return {self.}XmlChildBody; +end; diff --git a/autoclass/docx/Drawing@DOCX.tsf b/autoclass/docx/Drawing@DOCX.tsf index b9deb06..1d37e58 100644 --- a/autoclass/docx/Drawing@DOCX.tsf +++ b/autoclass/docx/Drawing@DOCX.tsf @@ -4,17 +4,20 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Drawing);override; public - // Attributes + // normal property + property _Inline read ReadXmlChild_Inline; + property Anchor read ReadXmlChildAnchor; + function ReadXmlChild_Inline(); + function ReadXmlChildAnchor(); + +public // Children - _Inline: _Inline; - Anchor: Anchor; + XmlChild_Inline: _Inline; + XmlChildAnchor: Anchor; end; @@ -30,74 +33,51 @@ end; function Drawing.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Drawing.Init();override; begin - {self.}_Inline := new _Inline(self, "wp", "inline"); - {self.}Anchor := new Anchor(self, "wp", "anchor"); -end; - -function Drawing.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Drawing.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}_Inline, - 1: {self.}Anchor, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}_Inline.ElementName: 0, - {self.}Anchor.ElementName: 1, + "wp:inline": array(0, makeweakref(thisFunction(ReadXmlChild_Inline))), + "wp:anchor": array(1, makeweakref(thisFunction(ReadXmlChildAnchor))), ); -end; - -function Drawing.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Drawing.Copy(_obj: Drawing);override; begin - {self.}_Inline.Copy(_obj._Inline); - {self.}Anchor.Copy(_obj.Anchor); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChild_Inline) then + {self.}_Inline.Copy(_obj.XmlChild_Inline); + if not ifnil(_obj.XmlChildAnchor) then + {self.}Anchor.Copy(_obj.XmlChildAnchor); + tslassigning := tslassigning_backup; +end; + +function Drawing.ReadXmlChild_Inline(); +begin + if tslassigning and ifnil({self.}XmlChild_Inline) then + begin + {self.}XmlChild_Inline := new _Inline(self, "wp", "inline"); + container_.Set({self.}XmlChild_Inline); + end + return {self.}XmlChild_Inline; +end; + +function Drawing.ReadXmlChildAnchor(); +begin + if tslassigning and ifnil({self.}XmlChildAnchor) then + begin + {self.}XmlChildAnchor := new Anchor(self, "wp", "anchor"); + container_.Set({self.}XmlChildAnchor); + end + return {self.}XmlChildAnchor; end; diff --git a/autoclass/docx/EffectExtent@DOCX.tsf b/autoclass/docx/EffectExtent@DOCX.tsf index 0467b9d..fc246bb 100644 --- a/autoclass/docx/EffectExtent@DOCX.tsf +++ b/autoclass/docx/EffectExtent@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: EffectExtent);override; +public + + // attributes property property L read ReadXmlAttrL write WriteXmlAttrL; property T read ReadXmlAttrT write WriteXmlAttrT; property R read ReadXmlAttrR write WriteXmlAttrR; @@ -23,13 +23,12 @@ public function WriteXmlAttrB(_value); public - // Attributes + // Attributes XmlAttrL: OpenXmlAttribute; XmlAttrT: OpenXmlAttribute; XmlAttrR: OpenXmlAttribute; XmlAttrB: OpenXmlAttribute; - // Children end; @@ -45,53 +44,39 @@ end; function EffectExtent.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function EffectExtent.Init();override; begin - {self.}XmlAttrL := new OpenXmlAttribute(nil, "l", nil); - {self.}XmlAttrT := new OpenXmlAttribute(nil, "t", nil); - {self.}XmlAttrR := new OpenXmlAttribute(nil, "r", nil); - {self.}XmlAttrB := new OpenXmlAttribute(nil, "b", nil); -end; - -function EffectExtent.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrL, - {self.}XmlAttrT, - {self.}XmlAttrR, - {self.}XmlAttrB, - ); -end; - -function EffectExtent.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "l": makeweakref(thisFunction(WriteXmlAttrL)), + "t": makeweakref(thisFunction(WriteXmlAttrT)), + "r": makeweakref(thisFunction(WriteXmlAttrR)), + "b": makeweakref(thisFunction(WriteXmlAttrB)), ); sorted_child_ := array( - "": -1, ); -end; - -function EffectExtent.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function EffectExtent.Copy(_obj: EffectExtent);override; begin - if not ifnil(_obj.XmlAttrL.Value) then - {self.}XmlAttrL.Value := _obj.XmlAttrL.Value; - if not ifnil(_obj.XmlAttrT.Value) then - {self.}XmlAttrT.Value := _obj.XmlAttrT.Value; - if not ifnil(_obj.XmlAttrR.Value) then - {self.}XmlAttrR.Value := _obj.XmlAttrR.Value; - if not ifnil(_obj.XmlAttrB.Value) then - {self.}XmlAttrB.Value := _obj.XmlAttrB.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.L) then + {self.}L := _obj.L; + if not ifnil(_obj.T) then + {self.}T := _obj.T; + if not ifnil(_obj.R) then + {self.}R := _obj.R; + if not ifnil(_obj.B) then + {self.}B := _obj.B; + tslassigning := tslassigning_backup; end; function EffectExtent.ReadXmlAttrL(); @@ -101,6 +86,11 @@ end; function EffectExtent.WriteXmlAttrL(_value); begin + if ifnil({self.}XmlAttrL) then + begin + {self.}XmlAttrL := new OpenXmlAttribute("", "l", nil); + attributes_[length(attributes_)] := {self.}XmlAttrL; + end {self.}XmlAttrL.Value := _value; end; @@ -111,6 +101,11 @@ end; function EffectExtent.WriteXmlAttrT(_value); begin + if ifnil({self.}XmlAttrT) then + begin + {self.}XmlAttrT := new OpenXmlAttribute("", "t", nil); + attributes_[length(attributes_)] := {self.}XmlAttrT; + end {self.}XmlAttrT.Value := _value; end; @@ -121,6 +116,11 @@ end; function EffectExtent.WriteXmlAttrR(_value); begin + if ifnil({self.}XmlAttrR) then + begin + {self.}XmlAttrR := new OpenXmlAttribute("", "r", nil); + attributes_[length(attributes_)] := {self.}XmlAttrR; + end {self.}XmlAttrR.Value := _value; end; @@ -131,5 +131,10 @@ end; function EffectExtent.WriteXmlAttrB(_value); begin + if ifnil({self.}XmlAttrB) then + begin + {self.}XmlAttrB := new OpenXmlAttribute("", "b", nil); + attributes_[length(attributes_)] := {self.}XmlAttrB; + end {self.}XmlAttrB.Value := _value; end; diff --git a/autoclass/docx/EffectLst@DOCX.tsf b/autoclass/docx/EffectLst@DOCX.tsf index e50851c..8bc5e7c 100644 --- a/autoclass/docx/EffectLst@DOCX.tsf +++ b/autoclass/docx/EffectLst@DOCX.tsf @@ -4,16 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: EffectLst);override; public - // Attributes + // normal property + property OuterShdw read ReadXmlChildOuterShdw; + function ReadXmlChildOuterShdw(); + +public // Children - OuterShdw: OuterShdw; + XmlChildOuterShdw: OuterShdw; end; @@ -29,70 +30,38 @@ end; function EffectLst.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function EffectLst.Init();override; begin - {self.}OuterShdw := new OuterShdw(self, {self.}Prefix, "outerShdw"); -end; - -function EffectLst.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function EffectLst.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}OuterShdw, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}OuterShdw.ElementName: 0, + pre + "outerShdw": array(0, makeweakref(thisFunction(ReadXmlChildOuterShdw))), ); -end; - -function EffectLst.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function EffectLst.Copy(_obj: EffectLst);override; begin - {self.}OuterShdw.Copy(_obj.OuterShdw); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildOuterShdw) then + {self.}OuterShdw.Copy(_obj.XmlChildOuterShdw); + tslassigning := tslassigning_backup; +end; + +function EffectLst.ReadXmlChildOuterShdw(); +begin + if tslassigning and ifnil({self.}XmlChildOuterShdw) then + begin + {self.}XmlChildOuterShdw := new OuterShdw(self, {self.}Prefix, "outerShdw"); + container_.Set({self.}XmlChildOuterShdw); + end + return {self.}XmlChildOuterShdw; end; diff --git a/autoclass/docx/EffectStyle@DOCX.tsf b/autoclass/docx/EffectStyle@DOCX.tsf index 2f728fc..d6e6d56 100644 --- a/autoclass/docx/EffectStyle@DOCX.tsf +++ b/autoclass/docx/EffectStyle@DOCX.tsf @@ -4,16 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: EffectStyle);override; public - // Attributes + // normal property + property EffectLst read ReadXmlChildEffectLst; + function ReadXmlChildEffectLst(); + +public // Children - EffectLst: EffectLst; + XmlChildEffectLst: EffectLst; end; @@ -29,70 +30,38 @@ end; function EffectStyle.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function EffectStyle.Init();override; begin - {self.}EffectLst := new EffectLst(self, {self.}Prefix, "effectLst"); -end; - -function EffectStyle.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function EffectStyle.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}EffectLst, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}EffectLst.ElementName: 0, + pre + "effectLst": array(0, makeweakref(thisFunction(ReadXmlChildEffectLst))), ); -end; - -function EffectStyle.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function EffectStyle.Copy(_obj: EffectStyle);override; begin - {self.}EffectLst.Copy(_obj.EffectLst); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildEffectLst) then + {self.}EffectLst.Copy(_obj.XmlChildEffectLst); + tslassigning := tslassigning_backup; +end; + +function EffectStyle.ReadXmlChildEffectLst(); +begin + if tslassigning and ifnil({self.}XmlChildEffectLst) then + begin + {self.}XmlChildEffectLst := new EffectLst(self, {self.}Prefix, "effectLst"); + container_.Set({self.}XmlChildEffectLst); + end + return {self.}XmlChildEffectLst; end; diff --git a/autoclass/docx/EffectStyleLst@DOCX.tsf b/autoclass/docx/EffectStyleLst@DOCX.tsf index 9401945..2ebe74e 100644 --- a/autoclass/docx/EffectStyleLst@DOCX.tsf +++ b/autoclass/docx/EffectStyleLst@DOCX.tsf @@ -4,19 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: EffectStyleLst);override; + +public + + // multi property + property EffectStyles read ReadEffectStyles; + function ReadEffectStyles(_index); function AddEffectStyle(): EffectStyle; function AppendEffectStyle(): EffectStyle; - property EffectStyles read ReadEffectStyles; - function ReadEffectStyles(_index); - public - // Attributes - // Children end; @@ -33,105 +31,47 @@ end; function EffectStyleLst.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function EffectStyleLst.Init();override; begin - -end; - -function EffectStyleLst.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function EffectStyleLst.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, + pre + "effectStyle": array(0, makeweakref(thisFunction(AppendEffectStyle))), ); -end; - -function EffectStyleLst.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "effectStyle": obj := {self.}AppendEffectStyle(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function EffectStyleLst.Copy(_obj: EffectStyleLst);override; begin + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + tslassigning := tslassigning_backup; +end; +function EffectStyleLst.ReadEffectStyles(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "effectStyle", ind); end; function EffectStyleLst.AddEffectStyle(): EffectStyle; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "effectStyle" then break; - end obj := new EffectStyle(self, {self.}Prefix, "effectStyle"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function EffectStyleLst.AppendEffectStyle(): EffectStyle; begin obj := new EffectStyle(self, {self.}Prefix, "effectStyle"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function EffectStyleLst.ReadEffectStyles(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "effectStyle" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; diff --git a/autoclass/docx/Endnote@DOCX.tsf b/autoclass/docx/Endnote@DOCX.tsf index ed927ec..4247af3 100644 --- a/autoclass/docx/Endnote@DOCX.tsf +++ b/autoclass/docx/Endnote@DOCX.tsf @@ -4,16 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Endnote);override; - function AddP(): P; - function AppendP(): P; - property Ps read ReadPs; - function ReadPs(_index); +public + // attributes property property Type read ReadXmlAttrType write WriteXmlAttrType; property Id read ReadXmlAttrId write WriteXmlAttrId; function ReadXmlAttrType(); @@ -21,8 +16,14 @@ public function ReadXmlAttrId(); function WriteXmlAttrId(_value); + // multi property + property Ps read ReadPs; + function ReadPs(_index); + function AddP(): P; + function AppendP(): P; + public - // Attributes + // Attributes XmlAttrType: OpenXmlAttribute; XmlAttrId: OpenXmlAttribute; @@ -42,113 +43,34 @@ end; function Endnote.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Endnote.Init();override; begin - {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); - {self.}XmlAttrId := new OpenXmlAttribute({self.}Prefix, "id", nil); -end; - -function Endnote.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrType, - {self.}XmlAttrId, - ); -end; - -function Endnote.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "type": makeweakref(thisFunction(WriteXmlAttrType)), + pre + "id": makeweakref(thisFunction(WriteXmlAttrId)), ); sorted_child_ := array( - "": -1, + pre + "p": array(0, makeweakref(thisFunction(AppendP))), ); -end; - -function Endnote.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "p": obj := {self.}AppendP(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Endnote.Copy(_obj: Endnote);override; begin - if not ifnil(_obj.XmlAttrType.Value) then - {self.}XmlAttrType.Value := _obj.XmlAttrType.Value; - if not ifnil(_obj.XmlAttrId.Value) then - {self.}XmlAttrId.Value := _obj.XmlAttrId.Value; -end; - -function Endnote.AddP(): P; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "p" then break; - end - obj := new P(self, {self.}Prefix, "p"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function Endnote.AppendP(): P; -begin - obj := new P(self, {self.}Prefix, "p"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function Endnote.ReadPs(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "p" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Type) then + {self.}Type := _obj.Type; + if not ifnil(_obj.Id) then + {self.}Id := _obj.Id; + tslassigning := tslassigning_backup; end; function Endnote.ReadXmlAttrType(); @@ -158,6 +80,11 @@ end; function Endnote.WriteXmlAttrType(_value); begin + if ifnil({self.}XmlAttrType) then + begin + {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); + attributes_[length(attributes_)] := {self.}XmlAttrType; + end {self.}XmlAttrType.Value := _value; end; @@ -168,5 +95,31 @@ end; function Endnote.WriteXmlAttrId(_value); begin + if ifnil({self.}XmlAttrId) then + begin + {self.}XmlAttrId := new OpenXmlAttribute({self.}Prefix, "id", nil); + attributes_[length(attributes_)] := {self.}XmlAttrId; + end {self.}XmlAttrId.Value := _value; end; + +function Endnote.ReadPs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "p", ind); +end; + +function Endnote.AddP(): P; +begin + obj := new P(self, {self.}Prefix, "p"); + container_.Insert(obj); + return obj; +end; + +function Endnote.AppendP(): P; +begin + obj := new P(self, {self.}Prefix, "p"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/EndnotePr@DOCX.tsf b/autoclass/docx/EndnotePr@DOCX.tsf index 18f7e49..1010241 100644 --- a/autoclass/docx/EndnotePr@DOCX.tsf +++ b/autoclass/docx/EndnotePr@DOCX.tsf @@ -4,19 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: EndnotePr);override; + +public + + // multi property + property Endnotes read ReadEndnotes; + function ReadEndnotes(_index); function AddEndnote(): Endnote; function AppendEndnote(): Endnote; - property Endnotes read ReadEndnotes; - function ReadEndnotes(_index); - public - // Attributes - // Children end; @@ -33,105 +31,47 @@ end; function EndnotePr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function EndnotePr.Init();override; begin - -end; - -function EndnotePr.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function EndnotePr.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, + pre + "endnote": array(0, makeweakref(thisFunction(AppendEndnote))), ); -end; - -function EndnotePr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "endnote": obj := {self.}AppendEndnote(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function EndnotePr.Copy(_obj: EndnotePr);override; begin + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + tslassigning := tslassigning_backup; +end; +function EndnotePr.ReadEndnotes(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "endnote", ind); end; function EndnotePr.AddEndnote(): Endnote; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "endnote" then break; - end obj := new Endnote(self, {self.}Prefix, "endnote"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function EndnotePr.AppendEndnote(): Endnote; begin obj := new Endnote(self, {self.}Prefix, "endnote"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function EndnotePr.ReadEndnotes(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "endnote" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; diff --git a/autoclass/docx/Endnotes@DOCX.tsf b/autoclass/docx/Endnotes@DOCX.tsf index 510e2b5..46e534e 100644 --- a/autoclass/docx/Endnotes@DOCX.tsf +++ b/autoclass/docx/Endnotes@DOCX.tsf @@ -4,16 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Endnotes);override; - function AddEndnote(): Endnote; - function AppendEndnote(): Endnote; - property Endnotes read ReadEndnotes; - function ReadEndnotes(_index); +public + // attributes property property XmlnsWpc read ReadXmlAttrXmlnsWpc write WriteXmlAttrXmlnsWpc; property XmlnsCx read ReadXmlAttrXmlnsCx write WriteXmlAttrXmlnsCx; property XmlnsCx1 read ReadXmlAttrXmlnsCx1 write WriteXmlAttrXmlnsCx1; @@ -114,8 +109,14 @@ public function ReadXmlAttrMcIgnorable(); function WriteXmlAttrMcIgnorable(_value); + // multi property + property Endnotes read ReadEndnotes; + function ReadEndnotes(_index); + function AddEndnote(): Endnote; + function AppendEndnote(): Endnote; + public - // Attributes + // Attributes XmlAttrXmlnsWpc: OpenXmlAttribute; XmlAttrXmlnsCx: OpenXmlAttribute; XmlAttrXmlnsCx1: OpenXmlAttribute; @@ -166,237 +167,127 @@ end; function Endnotes.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Endnotes.Init();override; begin - {self.}XmlAttrXmlnsWpc := new OpenXmlAttribute("xmlns", "wpc", nil); - {self.}XmlAttrXmlnsCx := new OpenXmlAttribute("xmlns", "cx", nil); - {self.}XmlAttrXmlnsCx1 := new OpenXmlAttribute("xmlns", "cx1", nil); - {self.}XmlAttrXmlnsCx2 := new OpenXmlAttribute("xmlns", "cx2", nil); - {self.}XmlAttrXmlnsCx3 := new OpenXmlAttribute("xmlns", "cx3", nil); - {self.}XmlAttrXmlnsCx4 := new OpenXmlAttribute("xmlns", "cx4", nil); - {self.}XmlAttrXmlnsCx5 := new OpenXmlAttribute("xmlns", "cx5", nil); - {self.}XmlAttrXmlnsCx6 := new OpenXmlAttribute("xmlns", "cx6", nil); - {self.}XmlAttrXmlnsCx7 := new OpenXmlAttribute("xmlns", "cx7", nil); - {self.}XmlAttrXmlnsCx8 := new OpenXmlAttribute("xmlns", "cx8", nil); - {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); - {self.}XmlAttrXmlnsAink := new OpenXmlAttribute("xmlns", "aink", nil); - {self.}XmlAttrXmlnsAm3d := new OpenXmlAttribute("xmlns", "am3d", nil); - {self.}XmlAttrXmlnsO := new OpenXmlAttribute("xmlns", "o", nil); - {self.}XmlAttrXmlnsOel := new OpenXmlAttribute("xmlns", "oel", nil); - {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); - {self.}XmlAttrXmlnsM := new OpenXmlAttribute("xmlns", "m", nil); - {self.}XmlAttrXmlnsV := new OpenXmlAttribute("xmlns", "v", nil); - {self.}XmlAttrXmlnsWp14 := new OpenXmlAttribute("xmlns", "wp14", nil); - {self.}XmlAttrXmlnsWp := new OpenXmlAttribute("xmlns", "wp", nil); - {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); - {self.}XmlAttrXmlnsW15 := new OpenXmlAttribute("xmlns", "w15", nil); - {self.}XmlAttrXmlnsW16Cex := new OpenXmlAttribute("xmlns", "w16cex", nil); - {self.}XmlAttrXmlnsW16Cid := new OpenXmlAttribute("xmlns", "w16cid", nil); - {self.}XmlAttrXmlnsW16 := new OpenXmlAttribute("xmlns", "w16", nil); - {self.}XmlAttrXmlnsW16Du := new OpenXmlAttribute("xmlns", "w16du", nil); - {self.}XmlAttrXmlnsW16sdtdh := new OpenXmlAttribute("xmlns", "w16sdtdh", nil); - {self.}XmlAttrXmlnsW16se := new OpenXmlAttribute("xmlns", "w16se", nil); - {self.}XmlAttrXmlnsWpg := new OpenXmlAttribute("xmlns", "wpg", nil); - {self.}XmlAttrXmlnsWpi := new OpenXmlAttribute("xmlns", "wpi", nil); - {self.}XmlAttrXmlnsWne := new OpenXmlAttribute("xmlns", "wne", nil); - {self.}XmlAttrXmlnsWps := new OpenXmlAttribute("xmlns", "wps", nil); - {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); -end; - -function Endnotes.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXmlnsWpc, - {self.}XmlAttrXmlnsCx, - {self.}XmlAttrXmlnsCx1, - {self.}XmlAttrXmlnsCx2, - {self.}XmlAttrXmlnsCx3, - {self.}XmlAttrXmlnsCx4, - {self.}XmlAttrXmlnsCx5, - {self.}XmlAttrXmlnsCx6, - {self.}XmlAttrXmlnsCx7, - {self.}XmlAttrXmlnsCx8, - {self.}XmlAttrXmlnsMc, - {self.}XmlAttrXmlnsAink, - {self.}XmlAttrXmlnsAm3d, - {self.}XmlAttrXmlnsO, - {self.}XmlAttrXmlnsOel, - {self.}XmlAttrXmlnsR, - {self.}XmlAttrXmlnsM, - {self.}XmlAttrXmlnsV, - {self.}XmlAttrXmlnsWp14, - {self.}XmlAttrXmlnsWp, - {self.}XmlAttrXmlnsW14, - {self.}XmlAttrXmlnsW15, - {self.}XmlAttrXmlnsW16Cex, - {self.}XmlAttrXmlnsW16Cid, - {self.}XmlAttrXmlnsW16, - {self.}XmlAttrXmlnsW16Du, - {self.}XmlAttrXmlnsW16sdtdh, - {self.}XmlAttrXmlnsW16se, - {self.}XmlAttrXmlnsWpg, - {self.}XmlAttrXmlnsWpi, - {self.}XmlAttrXmlnsWne, - {self.}XmlAttrXmlnsWps, - {self.}XmlAttrMcIgnorable, - ); -end; - -function Endnotes.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns:wpc": makeweakref(thisFunction(WriteXmlAttrXmlnsWpc)), + "xmlns:cx": makeweakref(thisFunction(WriteXmlAttrXmlnsCx)), + "xmlns:cx1": makeweakref(thisFunction(WriteXmlAttrXmlnsCx1)), + "xmlns:cx2": makeweakref(thisFunction(WriteXmlAttrXmlnsCx2)), + "xmlns:cx3": makeweakref(thisFunction(WriteXmlAttrXmlnsCx3)), + "xmlns:cx4": makeweakref(thisFunction(WriteXmlAttrXmlnsCx4)), + "xmlns:cx5": makeweakref(thisFunction(WriteXmlAttrXmlnsCx5)), + "xmlns:cx6": makeweakref(thisFunction(WriteXmlAttrXmlnsCx6)), + "xmlns:cx7": makeweakref(thisFunction(WriteXmlAttrXmlnsCx7)), + "xmlns:cx8": makeweakref(thisFunction(WriteXmlAttrXmlnsCx8)), + "xmlns:mc": makeweakref(thisFunction(WriteXmlAttrXmlnsMc)), + "xmlns:aink": makeweakref(thisFunction(WriteXmlAttrXmlnsAink)), + "xmlns:am3d": makeweakref(thisFunction(WriteXmlAttrXmlnsAm3d)), + "xmlns:o": makeweakref(thisFunction(WriteXmlAttrXmlnsO)), + "xmlns:oel": makeweakref(thisFunction(WriteXmlAttrXmlnsOel)), + "xmlns:r": makeweakref(thisFunction(WriteXmlAttrXmlnsR)), + "xmlns:m": makeweakref(thisFunction(WriteXmlAttrXmlnsM)), + "xmlns:v": makeweakref(thisFunction(WriteXmlAttrXmlnsV)), + "xmlns:wp14": makeweakref(thisFunction(WriteXmlAttrXmlnsWp14)), + "xmlns:wp": makeweakref(thisFunction(WriteXmlAttrXmlnsWp)), + "xmlns:w14": makeweakref(thisFunction(WriteXmlAttrXmlnsW14)), + "xmlns:w15": makeweakref(thisFunction(WriteXmlAttrXmlnsW15)), + "xmlns:w16cex": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Cex)), + "xmlns:w16cid": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Cid)), + "xmlns:w16": makeweakref(thisFunction(WriteXmlAttrXmlnsW16)), + "xmlns:w16du": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Du)), + "xmlns:w16sdtdh": makeweakref(thisFunction(WriteXmlAttrXmlnsW16sdtdh)), + "xmlns:w16se": makeweakref(thisFunction(WriteXmlAttrXmlnsW16se)), + "xmlns:wpg": makeweakref(thisFunction(WriteXmlAttrXmlnsWpg)), + "xmlns:wpi": makeweakref(thisFunction(WriteXmlAttrXmlnsWpi)), + "xmlns:wne": makeweakref(thisFunction(WriteXmlAttrXmlnsWne)), + "xmlns:wps": makeweakref(thisFunction(WriteXmlAttrXmlnsWps)), + "mc:Ignorable": makeweakref(thisFunction(WriteXmlAttrMcIgnorable)), ); sorted_child_ := array( - "": -1, + pre + "endnote": array(0, makeweakref(thisFunction(AppendEndnote))), ); -end; - -function Endnotes.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "endnote": obj := {self.}AppendEndnote(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Endnotes.Copy(_obj: Endnotes);override; begin - if not ifnil(_obj.XmlAttrXmlnsWpc.Value) then - {self.}XmlAttrXmlnsWpc.Value := _obj.XmlAttrXmlnsWpc.Value; - if not ifnil(_obj.XmlAttrXmlnsCx.Value) then - {self.}XmlAttrXmlnsCx.Value := _obj.XmlAttrXmlnsCx.Value; - if not ifnil(_obj.XmlAttrXmlnsCx1.Value) then - {self.}XmlAttrXmlnsCx1.Value := _obj.XmlAttrXmlnsCx1.Value; - if not ifnil(_obj.XmlAttrXmlnsCx2.Value) then - {self.}XmlAttrXmlnsCx2.Value := _obj.XmlAttrXmlnsCx2.Value; - if not ifnil(_obj.XmlAttrXmlnsCx3.Value) then - {self.}XmlAttrXmlnsCx3.Value := _obj.XmlAttrXmlnsCx3.Value; - if not ifnil(_obj.XmlAttrXmlnsCx4.Value) then - {self.}XmlAttrXmlnsCx4.Value := _obj.XmlAttrXmlnsCx4.Value; - if not ifnil(_obj.XmlAttrXmlnsCx5.Value) then - {self.}XmlAttrXmlnsCx5.Value := _obj.XmlAttrXmlnsCx5.Value; - if not ifnil(_obj.XmlAttrXmlnsCx6.Value) then - {self.}XmlAttrXmlnsCx6.Value := _obj.XmlAttrXmlnsCx6.Value; - if not ifnil(_obj.XmlAttrXmlnsCx7.Value) then - {self.}XmlAttrXmlnsCx7.Value := _obj.XmlAttrXmlnsCx7.Value; - if not ifnil(_obj.XmlAttrXmlnsCx8.Value) then - {self.}XmlAttrXmlnsCx8.Value := _obj.XmlAttrXmlnsCx8.Value; - if not ifnil(_obj.XmlAttrXmlnsMc.Value) then - {self.}XmlAttrXmlnsMc.Value := _obj.XmlAttrXmlnsMc.Value; - if not ifnil(_obj.XmlAttrXmlnsAink.Value) then - {self.}XmlAttrXmlnsAink.Value := _obj.XmlAttrXmlnsAink.Value; - if not ifnil(_obj.XmlAttrXmlnsAm3d.Value) then - {self.}XmlAttrXmlnsAm3d.Value := _obj.XmlAttrXmlnsAm3d.Value; - if not ifnil(_obj.XmlAttrXmlnsO.Value) then - {self.}XmlAttrXmlnsO.Value := _obj.XmlAttrXmlnsO.Value; - if not ifnil(_obj.XmlAttrXmlnsOel.Value) then - {self.}XmlAttrXmlnsOel.Value := _obj.XmlAttrXmlnsOel.Value; - if not ifnil(_obj.XmlAttrXmlnsR.Value) then - {self.}XmlAttrXmlnsR.Value := _obj.XmlAttrXmlnsR.Value; - if not ifnil(_obj.XmlAttrXmlnsM.Value) then - {self.}XmlAttrXmlnsM.Value := _obj.XmlAttrXmlnsM.Value; - if not ifnil(_obj.XmlAttrXmlnsV.Value) then - {self.}XmlAttrXmlnsV.Value := _obj.XmlAttrXmlnsV.Value; - if not ifnil(_obj.XmlAttrXmlnsWp14.Value) then - {self.}XmlAttrXmlnsWp14.Value := _obj.XmlAttrXmlnsWp14.Value; - if not ifnil(_obj.XmlAttrXmlnsWp.Value) then - {self.}XmlAttrXmlnsWp.Value := _obj.XmlAttrXmlnsWp.Value; - if not ifnil(_obj.XmlAttrXmlnsW14.Value) then - {self.}XmlAttrXmlnsW14.Value := _obj.XmlAttrXmlnsW14.Value; - if not ifnil(_obj.XmlAttrXmlnsW15.Value) then - {self.}XmlAttrXmlnsW15.Value := _obj.XmlAttrXmlnsW15.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Cex.Value) then - {self.}XmlAttrXmlnsW16Cex.Value := _obj.XmlAttrXmlnsW16Cex.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Cid.Value) then - {self.}XmlAttrXmlnsW16Cid.Value := _obj.XmlAttrXmlnsW16Cid.Value; - if not ifnil(_obj.XmlAttrXmlnsW16.Value) then - {self.}XmlAttrXmlnsW16.Value := _obj.XmlAttrXmlnsW16.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Du.Value) then - {self.}XmlAttrXmlnsW16Du.Value := _obj.XmlAttrXmlnsW16Du.Value; - if not ifnil(_obj.XmlAttrXmlnsW16sdtdh.Value) then - {self.}XmlAttrXmlnsW16sdtdh.Value := _obj.XmlAttrXmlnsW16sdtdh.Value; - if not ifnil(_obj.XmlAttrXmlnsW16se.Value) then - {self.}XmlAttrXmlnsW16se.Value := _obj.XmlAttrXmlnsW16se.Value; - if not ifnil(_obj.XmlAttrXmlnsWpg.Value) then - {self.}XmlAttrXmlnsWpg.Value := _obj.XmlAttrXmlnsWpg.Value; - if not ifnil(_obj.XmlAttrXmlnsWpi.Value) then - {self.}XmlAttrXmlnsWpi.Value := _obj.XmlAttrXmlnsWpi.Value; - if not ifnil(_obj.XmlAttrXmlnsWne.Value) then - {self.}XmlAttrXmlnsWne.Value := _obj.XmlAttrXmlnsWne.Value; - if not ifnil(_obj.XmlAttrXmlnsWps.Value) then - {self.}XmlAttrXmlnsWps.Value := _obj.XmlAttrXmlnsWps.Value; - if not ifnil(_obj.XmlAttrMcIgnorable.Value) then - {self.}XmlAttrMcIgnorable.Value := _obj.XmlAttrMcIgnorable.Value; -end; - -function Endnotes.AddEndnote(): Endnote; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "endnote" then break; - end - obj := new Endnote(self, {self.}Prefix, "endnote"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function Endnotes.AppendEndnote(): Endnote; -begin - obj := new Endnote(self, {self.}Prefix, "endnote"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function Endnotes.ReadEndnotes(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "endnote" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlnsWpc) then + {self.}XmlnsWpc := _obj.XmlnsWpc; + if not ifnil(_obj.XmlnsCx) then + {self.}XmlnsCx := _obj.XmlnsCx; + if not ifnil(_obj.XmlnsCx1) then + {self.}XmlnsCx1 := _obj.XmlnsCx1; + if not ifnil(_obj.XmlnsCx2) then + {self.}XmlnsCx2 := _obj.XmlnsCx2; + if not ifnil(_obj.XmlnsCx3) then + {self.}XmlnsCx3 := _obj.XmlnsCx3; + if not ifnil(_obj.XmlnsCx4) then + {self.}XmlnsCx4 := _obj.XmlnsCx4; + if not ifnil(_obj.XmlnsCx5) then + {self.}XmlnsCx5 := _obj.XmlnsCx5; + if not ifnil(_obj.XmlnsCx6) then + {self.}XmlnsCx6 := _obj.XmlnsCx6; + if not ifnil(_obj.XmlnsCx7) then + {self.}XmlnsCx7 := _obj.XmlnsCx7; + if not ifnil(_obj.XmlnsCx8) then + {self.}XmlnsCx8 := _obj.XmlnsCx8; + if not ifnil(_obj.XmlnsMc) then + {self.}XmlnsMc := _obj.XmlnsMc; + if not ifnil(_obj.XmlnsAink) then + {self.}XmlnsAink := _obj.XmlnsAink; + if not ifnil(_obj.XmlnsAm3d) then + {self.}XmlnsAm3d := _obj.XmlnsAm3d; + if not ifnil(_obj.XmlnsO) then + {self.}XmlnsO := _obj.XmlnsO; + if not ifnil(_obj.XmlnsOel) then + {self.}XmlnsOel := _obj.XmlnsOel; + if not ifnil(_obj.XmlnsR) then + {self.}XmlnsR := _obj.XmlnsR; + if not ifnil(_obj.XmlnsM) then + {self.}XmlnsM := _obj.XmlnsM; + if not ifnil(_obj.XmlnsV) then + {self.}XmlnsV := _obj.XmlnsV; + if not ifnil(_obj.XmlnsWp14) then + {self.}XmlnsWp14 := _obj.XmlnsWp14; + if not ifnil(_obj.XmlnsWp) then + {self.}XmlnsWp := _obj.XmlnsWp; + if not ifnil(_obj.XmlnsW14) then + {self.}XmlnsW14 := _obj.XmlnsW14; + if not ifnil(_obj.XmlnsW15) then + {self.}XmlnsW15 := _obj.XmlnsW15; + if not ifnil(_obj.XmlnsW16Cex) then + {self.}XmlnsW16Cex := _obj.XmlnsW16Cex; + if not ifnil(_obj.XmlnsW16Cid) then + {self.}XmlnsW16Cid := _obj.XmlnsW16Cid; + if not ifnil(_obj.XmlnsW16) then + {self.}XmlnsW16 := _obj.XmlnsW16; + if not ifnil(_obj.XmlnsW16Du) then + {self.}XmlnsW16Du := _obj.XmlnsW16Du; + if not ifnil(_obj.XmlnsW16sdtdh) then + {self.}XmlnsW16sdtdh := _obj.XmlnsW16sdtdh; + if not ifnil(_obj.XmlnsW16se) then + {self.}XmlnsW16se := _obj.XmlnsW16se; + if not ifnil(_obj.XmlnsWpg) then + {self.}XmlnsWpg := _obj.XmlnsWpg; + if not ifnil(_obj.XmlnsWpi) then + {self.}XmlnsWpi := _obj.XmlnsWpi; + if not ifnil(_obj.XmlnsWne) then + {self.}XmlnsWne := _obj.XmlnsWne; + if not ifnil(_obj.XmlnsWps) then + {self.}XmlnsWps := _obj.XmlnsWps; + if not ifnil(_obj.McIgnorable) then + {self.}McIgnorable := _obj.McIgnorable; + tslassigning := tslassigning_backup; end; function Endnotes.ReadXmlAttrXmlnsWpc(); @@ -406,6 +297,11 @@ end; function Endnotes.WriteXmlAttrXmlnsWpc(_value); begin + if ifnil({self.}XmlAttrXmlnsWpc) then + begin + {self.}XmlAttrXmlnsWpc := new OpenXmlAttribute("xmlns", "wpc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpc; + end {self.}XmlAttrXmlnsWpc.Value := _value; end; @@ -416,6 +312,11 @@ end; function Endnotes.WriteXmlAttrXmlnsCx(_value); begin + if ifnil({self.}XmlAttrXmlnsCx) then + begin + {self.}XmlAttrXmlnsCx := new OpenXmlAttribute("xmlns", "cx", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx; + end {self.}XmlAttrXmlnsCx.Value := _value; end; @@ -426,6 +327,11 @@ end; function Endnotes.WriteXmlAttrXmlnsCx1(_value); begin + if ifnil({self.}XmlAttrXmlnsCx1) then + begin + {self.}XmlAttrXmlnsCx1 := new OpenXmlAttribute("xmlns", "cx1", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx1; + end {self.}XmlAttrXmlnsCx1.Value := _value; end; @@ -436,6 +342,11 @@ end; function Endnotes.WriteXmlAttrXmlnsCx2(_value); begin + if ifnil({self.}XmlAttrXmlnsCx2) then + begin + {self.}XmlAttrXmlnsCx2 := new OpenXmlAttribute("xmlns", "cx2", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx2; + end {self.}XmlAttrXmlnsCx2.Value := _value; end; @@ -446,6 +357,11 @@ end; function Endnotes.WriteXmlAttrXmlnsCx3(_value); begin + if ifnil({self.}XmlAttrXmlnsCx3) then + begin + {self.}XmlAttrXmlnsCx3 := new OpenXmlAttribute("xmlns", "cx3", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx3; + end {self.}XmlAttrXmlnsCx3.Value := _value; end; @@ -456,6 +372,11 @@ end; function Endnotes.WriteXmlAttrXmlnsCx4(_value); begin + if ifnil({self.}XmlAttrXmlnsCx4) then + begin + {self.}XmlAttrXmlnsCx4 := new OpenXmlAttribute("xmlns", "cx4", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx4; + end {self.}XmlAttrXmlnsCx4.Value := _value; end; @@ -466,6 +387,11 @@ end; function Endnotes.WriteXmlAttrXmlnsCx5(_value); begin + if ifnil({self.}XmlAttrXmlnsCx5) then + begin + {self.}XmlAttrXmlnsCx5 := new OpenXmlAttribute("xmlns", "cx5", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx5; + end {self.}XmlAttrXmlnsCx5.Value := _value; end; @@ -476,6 +402,11 @@ end; function Endnotes.WriteXmlAttrXmlnsCx6(_value); begin + if ifnil({self.}XmlAttrXmlnsCx6) then + begin + {self.}XmlAttrXmlnsCx6 := new OpenXmlAttribute("xmlns", "cx6", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx6; + end {self.}XmlAttrXmlnsCx6.Value := _value; end; @@ -486,6 +417,11 @@ end; function Endnotes.WriteXmlAttrXmlnsCx7(_value); begin + if ifnil({self.}XmlAttrXmlnsCx7) then + begin + {self.}XmlAttrXmlnsCx7 := new OpenXmlAttribute("xmlns", "cx7", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx7; + end {self.}XmlAttrXmlnsCx7.Value := _value; end; @@ -496,6 +432,11 @@ end; function Endnotes.WriteXmlAttrXmlnsCx8(_value); begin + if ifnil({self.}XmlAttrXmlnsCx8) then + begin + {self.}XmlAttrXmlnsCx8 := new OpenXmlAttribute("xmlns", "cx8", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx8; + end {self.}XmlAttrXmlnsCx8.Value := _value; end; @@ -506,6 +447,11 @@ end; function Endnotes.WriteXmlAttrXmlnsMc(_value); begin + if ifnil({self.}XmlAttrXmlnsMc) then + begin + {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsMc; + end {self.}XmlAttrXmlnsMc.Value := _value; end; @@ -516,6 +462,11 @@ end; function Endnotes.WriteXmlAttrXmlnsAink(_value); begin + if ifnil({self.}XmlAttrXmlnsAink) then + begin + {self.}XmlAttrXmlnsAink := new OpenXmlAttribute("xmlns", "aink", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsAink; + end {self.}XmlAttrXmlnsAink.Value := _value; end; @@ -526,6 +477,11 @@ end; function Endnotes.WriteXmlAttrXmlnsAm3d(_value); begin + if ifnil({self.}XmlAttrXmlnsAm3d) then + begin + {self.}XmlAttrXmlnsAm3d := new OpenXmlAttribute("xmlns", "am3d", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsAm3d; + end {self.}XmlAttrXmlnsAm3d.Value := _value; end; @@ -536,6 +492,11 @@ end; function Endnotes.WriteXmlAttrXmlnsO(_value); begin + if ifnil({self.}XmlAttrXmlnsO) then + begin + {self.}XmlAttrXmlnsO := new OpenXmlAttribute("xmlns", "o", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsO; + end {self.}XmlAttrXmlnsO.Value := _value; end; @@ -546,6 +507,11 @@ end; function Endnotes.WriteXmlAttrXmlnsOel(_value); begin + if ifnil({self.}XmlAttrXmlnsOel) then + begin + {self.}XmlAttrXmlnsOel := new OpenXmlAttribute("xmlns", "oel", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsOel; + end {self.}XmlAttrXmlnsOel.Value := _value; end; @@ -556,6 +522,11 @@ end; function Endnotes.WriteXmlAttrXmlnsR(_value); begin + if ifnil({self.}XmlAttrXmlnsR) then + begin + {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsR; + end {self.}XmlAttrXmlnsR.Value := _value; end; @@ -566,6 +537,11 @@ end; function Endnotes.WriteXmlAttrXmlnsM(_value); begin + if ifnil({self.}XmlAttrXmlnsM) then + begin + {self.}XmlAttrXmlnsM := new OpenXmlAttribute("xmlns", "m", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsM; + end {self.}XmlAttrXmlnsM.Value := _value; end; @@ -576,6 +552,11 @@ end; function Endnotes.WriteXmlAttrXmlnsV(_value); begin + if ifnil({self.}XmlAttrXmlnsV) then + begin + {self.}XmlAttrXmlnsV := new OpenXmlAttribute("xmlns", "v", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsV; + end {self.}XmlAttrXmlnsV.Value := _value; end; @@ -586,6 +567,11 @@ end; function Endnotes.WriteXmlAttrXmlnsWp14(_value); begin + if ifnil({self.}XmlAttrXmlnsWp14) then + begin + {self.}XmlAttrXmlnsWp14 := new OpenXmlAttribute("xmlns", "wp14", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWp14; + end {self.}XmlAttrXmlnsWp14.Value := _value; end; @@ -596,6 +582,11 @@ end; function Endnotes.WriteXmlAttrXmlnsWp(_value); begin + if ifnil({self.}XmlAttrXmlnsWp) then + begin + {self.}XmlAttrXmlnsWp := new OpenXmlAttribute("xmlns", "wp", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWp; + end {self.}XmlAttrXmlnsWp.Value := _value; end; @@ -606,6 +597,11 @@ end; function Endnotes.WriteXmlAttrXmlnsW14(_value); begin + if ifnil({self.}XmlAttrXmlnsW14) then + begin + {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW14; + end {self.}XmlAttrXmlnsW14.Value := _value; end; @@ -616,6 +612,11 @@ end; function Endnotes.WriteXmlAttrXmlnsW15(_value); begin + if ifnil({self.}XmlAttrXmlnsW15) then + begin + {self.}XmlAttrXmlnsW15 := new OpenXmlAttribute("xmlns", "w15", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW15; + end {self.}XmlAttrXmlnsW15.Value := _value; end; @@ -626,6 +627,11 @@ end; function Endnotes.WriteXmlAttrXmlnsW16Cex(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Cex) then + begin + {self.}XmlAttrXmlnsW16Cex := new OpenXmlAttribute("xmlns", "w16cex", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Cex; + end {self.}XmlAttrXmlnsW16Cex.Value := _value; end; @@ -636,6 +642,11 @@ end; function Endnotes.WriteXmlAttrXmlnsW16Cid(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Cid) then + begin + {self.}XmlAttrXmlnsW16Cid := new OpenXmlAttribute("xmlns", "w16cid", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Cid; + end {self.}XmlAttrXmlnsW16Cid.Value := _value; end; @@ -646,6 +657,11 @@ end; function Endnotes.WriteXmlAttrXmlnsW16(_value); begin + if ifnil({self.}XmlAttrXmlnsW16) then + begin + {self.}XmlAttrXmlnsW16 := new OpenXmlAttribute("xmlns", "w16", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16; + end {self.}XmlAttrXmlnsW16.Value := _value; end; @@ -656,6 +672,11 @@ end; function Endnotes.WriteXmlAttrXmlnsW16Du(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Du) then + begin + {self.}XmlAttrXmlnsW16Du := new OpenXmlAttribute("xmlns", "w16du", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Du; + end {self.}XmlAttrXmlnsW16Du.Value := _value; end; @@ -666,6 +687,11 @@ end; function Endnotes.WriteXmlAttrXmlnsW16sdtdh(_value); begin + if ifnil({self.}XmlAttrXmlnsW16sdtdh) then + begin + {self.}XmlAttrXmlnsW16sdtdh := new OpenXmlAttribute("xmlns", "w16sdtdh", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16sdtdh; + end {self.}XmlAttrXmlnsW16sdtdh.Value := _value; end; @@ -676,6 +702,11 @@ end; function Endnotes.WriteXmlAttrXmlnsW16se(_value); begin + if ifnil({self.}XmlAttrXmlnsW16se) then + begin + {self.}XmlAttrXmlnsW16se := new OpenXmlAttribute("xmlns", "w16se", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16se; + end {self.}XmlAttrXmlnsW16se.Value := _value; end; @@ -686,6 +717,11 @@ end; function Endnotes.WriteXmlAttrXmlnsWpg(_value); begin + if ifnil({self.}XmlAttrXmlnsWpg) then + begin + {self.}XmlAttrXmlnsWpg := new OpenXmlAttribute("xmlns", "wpg", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpg; + end {self.}XmlAttrXmlnsWpg.Value := _value; end; @@ -696,6 +732,11 @@ end; function Endnotes.WriteXmlAttrXmlnsWpi(_value); begin + if ifnil({self.}XmlAttrXmlnsWpi) then + begin + {self.}XmlAttrXmlnsWpi := new OpenXmlAttribute("xmlns", "wpi", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpi; + end {self.}XmlAttrXmlnsWpi.Value := _value; end; @@ -706,6 +747,11 @@ end; function Endnotes.WriteXmlAttrXmlnsWne(_value); begin + if ifnil({self.}XmlAttrXmlnsWne) then + begin + {self.}XmlAttrXmlnsWne := new OpenXmlAttribute("xmlns", "wne", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWne; + end {self.}XmlAttrXmlnsWne.Value := _value; end; @@ -716,6 +762,11 @@ end; function Endnotes.WriteXmlAttrXmlnsWps(_value); begin + if ifnil({self.}XmlAttrXmlnsWps) then + begin + {self.}XmlAttrXmlnsWps := new OpenXmlAttribute("xmlns", "wps", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWps; + end {self.}XmlAttrXmlnsWps.Value := _value; end; @@ -726,5 +777,31 @@ end; function Endnotes.WriteXmlAttrMcIgnorable(_value); begin + if ifnil({self.}XmlAttrMcIgnorable) then + begin + {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); + attributes_[length(attributes_)] := {self.}XmlAttrMcIgnorable; + end {self.}XmlAttrMcIgnorable.Value := _value; end; + +function Endnotes.ReadEndnotes(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "endnote", ind); +end; + +function Endnotes.AddEndnote(): Endnote; +begin + obj := new Endnote(self, {self.}Prefix, "endnote"); + container_.Insert(obj); + return obj; +end; + +function Endnotes.AppendEndnote(): Endnote; +begin + obj := new Endnote(self, {self.}Prefix, "endnote"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/Ext@DOCX.tsf b/autoclass/docx/Ext@DOCX.tsf index 1114429..cfa2b8b 100644 --- a/autoclass/docx/Ext@DOCX.tsf +++ b/autoclass/docx/Ext@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Ext);override; +public + + // attributes property property Uri read ReadXmlAttrUri write WriteXmlAttrUri; property XmlnsC16 read ReadXmlAttrXmlnsC16 write WriteXmlAttrXmlnsC16; function ReadXmlAttrUri(); @@ -16,14 +16,20 @@ public function ReadXmlAttrXmlnsC16(); function WriteXmlAttrXmlnsC16(_value); + // normal property + property Thm15ThemeFamily read ReadXmlChildThm15ThemeFamily; + property UniqueId read ReadXmlChildUniqueId; + function ReadXmlChildThm15ThemeFamily(); + function ReadXmlChildUniqueId(); + public - // Attributes + // Attributes XmlAttrUri: OpenXmlAttribute; XmlAttrXmlnsC16: OpenXmlAttribute; // Children - Thm15ThemeFamily: ThemeFamily; - UniqueId: PureVal; + XmlChildThm15ThemeFamily: ThemeFamily; + XmlChildUniqueId: PureVal; end; @@ -39,84 +45,39 @@ end; function Ext.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Ext.Init();override; begin - {self.}XmlAttrUri := new OpenXmlAttribute(nil, "uri", nil); - {self.}XmlAttrXmlnsC16 := new OpenXmlAttribute("xmlns", "c16", nil); - {self.}Thm15ThemeFamily := new ThemeFamily(self, "thm15", "themeFamily"); - {self.}UniqueId := new PureVal(self, "c16", "uniquedId"); -end; - -function Ext.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrUri, - {self.}XmlAttrXmlnsC16, - ); -end; - -function Ext.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Thm15ThemeFamily, - 1: {self.}UniqueId, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "uri": makeweakref(thisFunction(WriteXmlAttrUri)), + "xmlns:c16": makeweakref(thisFunction(WriteXmlAttrXmlnsC16)), ); sorted_child_ := array( - "": -1, - {self.}Thm15ThemeFamily.ElementName: 0, - {self.}UniqueId.ElementName: 1, + "thm15:themeFamily": array(0, makeweakref(thisFunction(ReadXmlChildThm15ThemeFamily))), + "c16:uniquedId": array(1, makeweakref(thisFunction(ReadXmlChildUniqueId))), ); -end; - -function Ext.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Ext.Copy(_obj: Ext);override; begin - if not ifnil(_obj.XmlAttrUri.Value) then - {self.}XmlAttrUri.Value := _obj.XmlAttrUri.Value; - if not ifnil(_obj.XmlAttrXmlnsC16.Value) then - {self.}XmlAttrXmlnsC16.Value := _obj.XmlAttrXmlnsC16.Value; - {self.}Thm15ThemeFamily.Copy(_obj.Thm15ThemeFamily); - {self.}UniqueId.Copy(_obj.UniqueId); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Uri) then + {self.}Uri := _obj.Uri; + if not ifnil(_obj.XmlnsC16) then + {self.}XmlnsC16 := _obj.XmlnsC16; + if not ifnil(_obj.XmlChildThm15ThemeFamily) then + {self.}Thm15ThemeFamily.Copy(_obj.XmlChildThm15ThemeFamily); + if not ifnil(_obj.XmlChildUniqueId) then + {self.}UniqueId.Copy(_obj.XmlChildUniqueId); + tslassigning := tslassigning_backup; end; function Ext.ReadXmlAttrUri(); @@ -126,6 +87,11 @@ end; function Ext.WriteXmlAttrUri(_value); begin + if ifnil({self.}XmlAttrUri) then + begin + {self.}XmlAttrUri := new OpenXmlAttribute("", "uri", nil); + attributes_[length(attributes_)] := {self.}XmlAttrUri; + end {self.}XmlAttrUri.Value := _value; end; @@ -136,5 +102,30 @@ end; function Ext.WriteXmlAttrXmlnsC16(_value); begin + if ifnil({self.}XmlAttrXmlnsC16) then + begin + {self.}XmlAttrXmlnsC16 := new OpenXmlAttribute("xmlns", "c16", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsC16; + end {self.}XmlAttrXmlnsC16.Value := _value; end; + +function Ext.ReadXmlChildThm15ThemeFamily(); +begin + if tslassigning and ifnil({self.}XmlChildThm15ThemeFamily) then + begin + {self.}XmlChildThm15ThemeFamily := new ThemeFamily(self, "thm15", "themeFamily"); + container_.Set({self.}XmlChildThm15ThemeFamily); + end + return {self.}XmlChildThm15ThemeFamily; +end; + +function Ext.ReadXmlChildUniqueId(); +begin + if tslassigning and ifnil({self.}XmlChildUniqueId) then + begin + {self.}XmlChildUniqueId := new PureVal(self, "c16", "uniquedId"); + container_.Set({self.}XmlChildUniqueId); + end + return {self.}XmlChildUniqueId; +end; diff --git a/autoclass/docx/ExtLst@DOCX.tsf b/autoclass/docx/ExtLst@DOCX.tsf index 57cc726..8c81786 100644 --- a/autoclass/docx/ExtLst@DOCX.tsf +++ b/autoclass/docx/ExtLst@DOCX.tsf @@ -4,19 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: ExtLst);override; + +public + + // multi property + property Exts read ReadExts; + function ReadExts(_index); function AddExt(): Ext; function AppendExt(): Ext; - property Exts read ReadExts; - function ReadExts(_index); - public - // Attributes - // Children end; @@ -33,105 +31,47 @@ end; function ExtLst.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function ExtLst.Init();override; begin - -end; - -function ExtLst.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function ExtLst.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, + pre + "ext": array(0, makeweakref(thisFunction(AppendExt))), ); -end; - -function ExtLst.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "ext": obj := {self.}AppendExt(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function ExtLst.Copy(_obj: ExtLst);override; begin + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + tslassigning := tslassigning_backup; +end; +function ExtLst.ReadExts(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "ext", ind); end; function ExtLst.AddExt(): Ext; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "ext" then break; - end obj := new Ext(self, {self.}Prefix, "ext"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function ExtLst.AppendExt(): Ext; begin obj := new Ext(self, {self.}Prefix, "ext"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function ExtLst.ReadExts(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "ext" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; diff --git a/autoclass/docx/ExternalData@DOCX.tsf b/autoclass/docx/ExternalData@DOCX.tsf index 0680420..4aeb0d7 100644 --- a/autoclass/docx/ExternalData@DOCX.tsf +++ b/autoclass/docx/ExternalData@DOCX.tsf @@ -4,21 +4,25 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: ExternalData);override; +public + + // attributes property property Id read ReadXmlAttrId write WriteXmlAttrId; function ReadXmlAttrId(); function WriteXmlAttrId(_value); + // normal property + property AutoUpdate read ReadXmlChildAutoUpdate; + function ReadXmlChildAutoUpdate(); + public - // Attributes + // Attributes XmlAttrId: OpenXmlAttribute; // Children - AutoUpdate: PureVal; + XmlChildAutoUpdate: PureVal; end; @@ -34,76 +38,33 @@ end; function ExternalData.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function ExternalData.Init();override; begin - {self.}XmlAttrId := new OpenXmlAttribute("r", "id", nil); - {self.}AutoUpdate := new PureVal(self, {self.}Prefix, "autoUpdate"); -end; - -function ExternalData.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrId, - ); -end; - -function ExternalData.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}AutoUpdate, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "r:id": makeweakref(thisFunction(WriteXmlAttrId)), ); sorted_child_ := array( - "": -1, - {self.}AutoUpdate.ElementName: 0, + pre + "autoUpdate": array(0, makeweakref(thisFunction(ReadXmlChildAutoUpdate))), ); -end; - -function ExternalData.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function ExternalData.Copy(_obj: ExternalData);override; begin - if not ifnil(_obj.XmlAttrId.Value) then - {self.}XmlAttrId.Value := _obj.XmlAttrId.Value; - {self.}AutoUpdate.Copy(_obj.AutoUpdate); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Id) then + {self.}Id := _obj.Id; + if not ifnil(_obj.XmlChildAutoUpdate) then + {self.}AutoUpdate.Copy(_obj.XmlChildAutoUpdate); + tslassigning := tslassigning_backup; end; function ExternalData.ReadXmlAttrId(); @@ -113,5 +74,20 @@ end; function ExternalData.WriteXmlAttrId(_value); begin + if ifnil({self.}XmlAttrId) then + begin + {self.}XmlAttrId := new OpenXmlAttribute("r", "id", nil); + attributes_[length(attributes_)] := {self.}XmlAttrId; + end {self.}XmlAttrId.Value := _value; end; + +function ExternalData.ReadXmlChildAutoUpdate(); +begin + if tslassigning and ifnil({self.}XmlChildAutoUpdate) then + begin + {self.}XmlChildAutoUpdate := new PureVal(self, {self.}Prefix, "autoUpdate"); + container_.Set({self.}XmlChildAutoUpdate); + end + return {self.}XmlChildAutoUpdate; +end; diff --git a/autoclass/docx/Fallback@DOCX.tsf b/autoclass/docx/Fallback@DOCX.tsf index 1b69e1e..64b6931 100644 --- a/autoclass/docx/Fallback@DOCX.tsf +++ b/autoclass/docx/Fallback@DOCX.tsf @@ -4,17 +4,20 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Fallback);override; public - // Attributes + // normal property + property Style read ReadXmlChildStyle; + property Pict read ReadXmlChildPict; + function ReadXmlChildStyle(); + function ReadXmlChildPict(); + +public // Children - Style: PureVal; - Pict: Pict; + XmlChildStyle: PureVal; + XmlChildPict: Pict; end; @@ -30,74 +33,51 @@ end; function Fallback.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Fallback.Init();override; begin - {self.}Style := new PureVal(self, "c", "style"); - {self.}Pict := new Pict(self, "w", "pict"); -end; - -function Fallback.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Fallback.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Style, - 1: {self.}Pict, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}Style.ElementName: 0, - {self.}Pict.ElementName: 1, + "c:style": array(0, makeweakref(thisFunction(ReadXmlChildStyle))), + "w:pict": array(1, makeweakref(thisFunction(ReadXmlChildPict))), ); -end; - -function Fallback.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Fallback.Copy(_obj: Fallback);override; begin - {self.}Style.Copy(_obj.Style); - {self.}Pict.Copy(_obj.Pict); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildStyle) then + {self.}Style.Copy(_obj.XmlChildStyle); + if not ifnil(_obj.XmlChildPict) then + {self.}Pict.Copy(_obj.XmlChildPict); + tslassigning := tslassigning_backup; +end; + +function Fallback.ReadXmlChildStyle(); +begin + if tslassigning and ifnil({self.}XmlChildStyle) then + begin + {self.}XmlChildStyle := new PureVal(self, "c", "style"); + container_.Set({self.}XmlChildStyle); + end + return {self.}XmlChildStyle; +end; + +function Fallback.ReadXmlChildPict(); +begin + if tslassigning and ifnil({self.}XmlChildPict) then + begin + {self.}XmlChildPict := new Pict(self, "w", "pict"); + container_.Set({self.}XmlChildPict); + end + return {self.}XmlChildPict; end; diff --git a/autoclass/docx/FillStyleLst@DOCX.tsf b/autoclass/docx/FillStyleLst@DOCX.tsf index 082e0b9..10e63e7 100644 --- a/autoclass/docx/FillStyleLst@DOCX.tsf +++ b/autoclass/docx/FillStyleLst@DOCX.tsf @@ -4,23 +4,21 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: FillStyleLst);override; + +public + + // multi property + property SolidFills read ReadSolidFills; + property GradFills read ReadGradFills; + function ReadSolidFills(_index); + function ReadGradFills(_index); function AddSolidFill(): SolidFill; function AddGradFill(): GradFill; function AppendSolidFill(): SolidFill; function AppendGradFill(): GradFill; - property SolidFills read ReadSolidFills; - property GradFills read ReadGradFills; - function ReadSolidFills(_index); - function ReadGradFills(_index); - public - // Attributes - // Children end; @@ -37,142 +35,69 @@ end; function FillStyleLst.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function FillStyleLst.Init();override; begin - -end; - -function FillStyleLst.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function FillStyleLst.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, + pre + "solidFill": array(0, makeweakref(thisFunction(AppendSolidFill))), + pre + "gradFill": array(1, makeweakref(thisFunction(AppendGradFill))), ); -end; - -function FillStyleLst.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "solidFill": obj := {self.}AppendSolidFill(); - pre + "gradFill": obj := {self.}AppendGradFill(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function FillStyleLst.Copy(_obj: FillStyleLst);override; begin + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + tslassigning := tslassigning_backup; +end; +function FillStyleLst.ReadSolidFills(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "solidFill", ind); +end; + +function FillStyleLst.ReadGradFills(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "gradFill", ind); end; function FillStyleLst.AddSolidFill(): SolidFill; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "solidFill" then break; - end obj := new SolidFill(self, {self.}Prefix, "solidFill"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function FillStyleLst.AddGradFill(): GradFill; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "gradFill" then break; - end obj := new GradFill(self, {self.}Prefix, "gradFill"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function FillStyleLst.AppendSolidFill(): SolidFill; begin obj := new SolidFill(self, {self.}Prefix, "solidFill"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; function FillStyleLst.AppendGradFill(): GradFill; begin obj := new GradFill(self, {self.}Prefix, "gradFill"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function FillStyleLst.ReadSolidFills(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "solidFill" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; - -function FillStyleLst.ReadGradFills(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "gradFill" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; diff --git a/autoclass/docx/FldChar@DOCX.tsf b/autoclass/docx/FldChar@DOCX.tsf index d2d197c..ea10b9e 100644 --- a/autoclass/docx/FldChar@DOCX.tsf +++ b/autoclass/docx/FldChar@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: FldChar);override; +public + + // attributes property property FldCharType read ReadXmlAttrFldCharType write WriteXmlAttrFldCharType; property Dirty read ReadXmlAttrDirty write WriteXmlAttrDirty; function ReadXmlAttrFldCharType(); @@ -17,11 +17,10 @@ public function WriteXmlAttrDirty(_value); public - // Attributes + // Attributes XmlAttrFldCharType: OpenXmlAttribute; XmlAttrDirty: OpenXmlAttribute; - // Children end; @@ -37,45 +36,33 @@ end; function FldChar.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function FldChar.Init();override; begin - {self.}XmlAttrFldCharType := new OpenXmlAttribute({self.}Prefix, "fldCharType", nil); - {self.}XmlAttrDirty := new OpenXmlAttribute({self.}Prefix, "dirty", nil); -end; - -function FldChar.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrFldCharType, - {self.}XmlAttrDirty, - ); -end; - -function FldChar.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "fldCharType": makeweakref(thisFunction(WriteXmlAttrFldCharType)), + pre + "dirty": makeweakref(thisFunction(WriteXmlAttrDirty)), ); sorted_child_ := array( - "": -1, ); -end; - -function FldChar.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function FldChar.Copy(_obj: FldChar);override; begin - if not ifnil(_obj.XmlAttrFldCharType.Value) then - {self.}XmlAttrFldCharType.Value := _obj.XmlAttrFldCharType.Value; - if not ifnil(_obj.XmlAttrDirty.Value) then - {self.}XmlAttrDirty.Value := _obj.XmlAttrDirty.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.FldCharType) then + {self.}FldCharType := _obj.FldCharType; + if not ifnil(_obj.Dirty) then + {self.}Dirty := _obj.Dirty; + tslassigning := tslassigning_backup; end; function FldChar.ReadXmlAttrFldCharType(); @@ -85,6 +72,11 @@ end; function FldChar.WriteXmlAttrFldCharType(_value); begin + if ifnil({self.}XmlAttrFldCharType) then + begin + {self.}XmlAttrFldCharType := new OpenXmlAttribute({self.}Prefix, "fldCharType", nil); + attributes_[length(attributes_)] := {self.}XmlAttrFldCharType; + end {self.}XmlAttrFldCharType.Value := _value; end; @@ -95,5 +87,10 @@ end; function FldChar.WriteXmlAttrDirty(_value); begin + if ifnil({self.}XmlAttrDirty) then + begin + {self.}XmlAttrDirty := new OpenXmlAttribute({self.}Prefix, "dirty", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDirty; + end {self.}XmlAttrDirty.Value := _value; end; diff --git a/autoclass/docx/FldSimple@DOCX.tsf b/autoclass/docx/FldSimple@DOCX.tsf index d979016..d75bef1 100644 --- a/autoclass/docx/FldSimple@DOCX.tsf +++ b/autoclass/docx/FldSimple@DOCX.tsf @@ -4,22 +4,23 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: FldSimple);override; - function AddR(): R; - function AppendR(): R; - property Rs read ReadRs; - function ReadRs(_index); +public + // attributes property property Instr read ReadXmlAttrInstr write WriteXmlAttrInstr; function ReadXmlAttrInstr(); function WriteXmlAttrInstr(_value); + // multi property + property Rs read ReadRs; + function ReadRs(_index); + function AddR(): R; + function AppendR(): R; + public - // Attributes + // Attributes XmlAttrInstr: OpenXmlAttribute; // Children @@ -38,109 +39,31 @@ end; function FldSimple.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function FldSimple.Init();override; begin - {self.}XmlAttrInstr := new OpenXmlAttribute({self.}Prefix, "instr", nil); -end; - -function FldSimple.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrInstr, - ); -end; - -function FldSimple.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "instr": makeweakref(thisFunction(WriteXmlAttrInstr)), ); sorted_child_ := array( - "": -1, + pre + "r": array(0, makeweakref(thisFunction(AppendR))), ); -end; - -function FldSimple.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "r": obj := {self.}AppendR(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function FldSimple.Copy(_obj: FldSimple);override; begin - if not ifnil(_obj.XmlAttrInstr.Value) then - {self.}XmlAttrInstr.Value := _obj.XmlAttrInstr.Value; -end; - -function FldSimple.AddR(): R; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "r" then break; - end - obj := new R(self, {self.}Prefix, "r"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function FldSimple.AppendR(): R; -begin - obj := new R(self, {self.}Prefix, "r"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function FldSimple.ReadRs(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "r" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Instr) then + {self.}Instr := _obj.Instr; + tslassigning := tslassigning_backup; end; function FldSimple.ReadXmlAttrInstr(); @@ -150,5 +73,31 @@ end; function FldSimple.WriteXmlAttrInstr(_value); begin + if ifnil({self.}XmlAttrInstr) then + begin + {self.}XmlAttrInstr := new OpenXmlAttribute({self.}Prefix, "instr", nil); + attributes_[length(attributes_)] := {self.}XmlAttrInstr; + end {self.}XmlAttrInstr.Value := _value; end; + +function FldSimple.ReadRs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "r", ind); +end; + +function FldSimple.AddR(): R; +begin + obj := new R(self, {self.}Prefix, "r"); + container_.Insert(obj); + return obj; +end; + +function FldSimple.AppendR(): R; +begin + obj := new R(self, {self.}Prefix, "r"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/FmtScheme@DOCX.tsf b/autoclass/docx/FmtScheme@DOCX.tsf index 2959534..0f2e3fa 100644 --- a/autoclass/docx/FmtScheme@DOCX.tsf +++ b/autoclass/docx/FmtScheme@DOCX.tsf @@ -4,24 +4,34 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: FmtScheme);override; +public + + // attributes property property Name read ReadXmlAttrName write WriteXmlAttrName; function ReadXmlAttrName(); function WriteXmlAttrName(_value); + // normal property + property FillStyleLst read ReadXmlChildFillStyleLst; + property LnStyleLst read ReadXmlChildLnStyleLst; + property EffectStyleLst read ReadXmlChildEffectStyleLst; + property BgFillStyleLst read ReadXmlChildBgFillStyleLst; + function ReadXmlChildFillStyleLst(); + function ReadXmlChildLnStyleLst(); + function ReadXmlChildEffectStyleLst(); + function ReadXmlChildBgFillStyleLst(); + public - // Attributes + // Attributes XmlAttrName: OpenXmlAttribute; // Children - FillStyleLst: FillStyleLst; - LnStyleLst: LnStyleLst; - EffectStyleLst: EffectStyleLst; - BgFillStyleLst: FillStyleLst; + XmlChildFillStyleLst: FillStyleLst; + XmlChildLnStyleLst: LnStyleLst; + XmlChildEffectStyleLst: EffectStyleLst; + XmlChildBgFillStyleLst: FillStyleLst; end; @@ -37,88 +47,42 @@ end; function FmtScheme.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function FmtScheme.Init();override; begin - {self.}XmlAttrName := new OpenXmlAttribute(nil, "name", nil); - {self.}FillStyleLst := new FillStyleLst(self, {self.}Prefix, "fillStyleLst"); - {self.}LnStyleLst := new LnStyleLst(self, {self.}Prefix, "lnStyleLst"); - {self.}EffectStyleLst := new EffectStyleLst(self, {self.}Prefix, "effectStyleLst"); - {self.}BgFillStyleLst := new FillStyleLst(self, {self.}Prefix, "bgFillStyleLst"); -end; - -function FmtScheme.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrName, - ); -end; - -function FmtScheme.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}FillStyleLst, - 1: {self.}LnStyleLst, - 2: {self.}EffectStyleLst, - 3: {self.}BgFillStyleLst, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "name": makeweakref(thisFunction(WriteXmlAttrName)), ); sorted_child_ := array( - "": -1, - {self.}FillStyleLst.ElementName: 0, - {self.}LnStyleLst.ElementName: 1, - {self.}EffectStyleLst.ElementName: 2, - {self.}BgFillStyleLst.ElementName: 3, + pre + "fillStyleLst": array(0, makeweakref(thisFunction(ReadXmlChildFillStyleLst))), + pre + "lnStyleLst": array(1, makeweakref(thisFunction(ReadXmlChildLnStyleLst))), + pre + "effectStyleLst": array(2, makeweakref(thisFunction(ReadXmlChildEffectStyleLst))), + pre + "bgFillStyleLst": array(3, makeweakref(thisFunction(ReadXmlChildBgFillStyleLst))), ); -end; - -function FmtScheme.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function FmtScheme.Copy(_obj: FmtScheme);override; begin - if not ifnil(_obj.XmlAttrName.Value) then - {self.}XmlAttrName.Value := _obj.XmlAttrName.Value; - {self.}FillStyleLst.Copy(_obj.FillStyleLst); - {self.}LnStyleLst.Copy(_obj.LnStyleLst); - {self.}EffectStyleLst.Copy(_obj.EffectStyleLst); - {self.}BgFillStyleLst.Copy(_obj.BgFillStyleLst); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Name) then + {self.}Name := _obj.Name; + if not ifnil(_obj.XmlChildFillStyleLst) then + {self.}FillStyleLst.Copy(_obj.XmlChildFillStyleLst); + if not ifnil(_obj.XmlChildLnStyleLst) then + {self.}LnStyleLst.Copy(_obj.XmlChildLnStyleLst); + if not ifnil(_obj.XmlChildEffectStyleLst) then + {self.}EffectStyleLst.Copy(_obj.XmlChildEffectStyleLst); + if not ifnil(_obj.XmlChildBgFillStyleLst) then + {self.}BgFillStyleLst.Copy(_obj.XmlChildBgFillStyleLst); + tslassigning := tslassigning_backup; end; function FmtScheme.ReadXmlAttrName(); @@ -128,5 +92,50 @@ end; function FmtScheme.WriteXmlAttrName(_value); begin + if ifnil({self.}XmlAttrName) then + begin + {self.}XmlAttrName := new OpenXmlAttribute("", "name", nil); + attributes_[length(attributes_)] := {self.}XmlAttrName; + end {self.}XmlAttrName.Value := _value; end; + +function FmtScheme.ReadXmlChildFillStyleLst(); +begin + if tslassigning and ifnil({self.}XmlChildFillStyleLst) then + begin + {self.}XmlChildFillStyleLst := new FillStyleLst(self, {self.}Prefix, "fillStyleLst"); + container_.Set({self.}XmlChildFillStyleLst); + end + return {self.}XmlChildFillStyleLst; +end; + +function FmtScheme.ReadXmlChildLnStyleLst(); +begin + if tslassigning and ifnil({self.}XmlChildLnStyleLst) then + begin + {self.}XmlChildLnStyleLst := new LnStyleLst(self, {self.}Prefix, "lnStyleLst"); + container_.Set({self.}XmlChildLnStyleLst); + end + return {self.}XmlChildLnStyleLst; +end; + +function FmtScheme.ReadXmlChildEffectStyleLst(); +begin + if tslassigning and ifnil({self.}XmlChildEffectStyleLst) then + begin + {self.}XmlChildEffectStyleLst := new EffectStyleLst(self, {self.}Prefix, "effectStyleLst"); + container_.Set({self.}XmlChildEffectStyleLst); + end + return {self.}XmlChildEffectStyleLst; +end; + +function FmtScheme.ReadXmlChildBgFillStyleLst(); +begin + if tslassigning and ifnil({self.}XmlChildBgFillStyleLst) then + begin + {self.}XmlChildBgFillStyleLst := new FillStyleLst(self, {self.}Prefix, "bgFillStyleLst"); + container_.Set({self.}XmlChildBgFillStyleLst); + end + return {self.}XmlChildBgFillStyleLst; +end; diff --git a/autoclass/docx/Font@DOCX.tsf b/autoclass/docx/Font@DOCX.tsf index 8dfe7f8..d80d578 100644 --- a/autoclass/docx/Font@DOCX.tsf +++ b/autoclass/docx/Font@DOCX.tsf @@ -4,26 +4,40 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Font);override; +public + + // attributes property property Name read ReadXmlAttrName write WriteXmlAttrName; function ReadXmlAttrName(); function WriteXmlAttrName(_value); + // normal property + property AltName read ReadXmlChildAltName; + property Panosel read ReadXmlChildPanosel; + property Charset read ReadXmlChildCharset; + property Family read ReadXmlChildFamily; + property Pitch read ReadXmlChildPitch; + property Sig read ReadXmlChildSig; + function ReadXmlChildAltName(); + function ReadXmlChildPanosel(); + function ReadXmlChildCharset(); + function ReadXmlChildFamily(); + function ReadXmlChildPitch(); + function ReadXmlChildSig(); + public - // Attributes + // Attributes XmlAttrName: OpenXmlAttribute; // Children - AltName: PureWVal; - Panosel: PureWVal; - Charset: PureWVal; - Family: PureWVal; - Pitch: PureWVal; - Sig: Sig; + XmlChildAltName: PureWVal; + XmlChildPanosel: PureWVal; + XmlChildCharset: PureWVal; + XmlChildFamily: PureWVal; + XmlChildPitch: PureWVal; + XmlChildSig: Sig; end; @@ -39,96 +53,48 @@ end; function Font.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Font.Init();override; begin - {self.}XmlAttrName := new OpenXmlAttribute({self.}Prefix, "name", nil); - {self.}AltName := new PureWVal(self, {self.}Prefix, "altName"); - {self.}Panosel := new PureWVal(self, {self.}Prefix, "panosel"); - {self.}Charset := new PureWVal(self, {self.}Prefix, "charset"); - {self.}Family := new PureWVal(self, {self.}Prefix, "family"); - {self.}Pitch := new PureWVal(self, {self.}Prefix, "pitch"); - {self.}Sig := new Sig(self, {self.}Prefix, "sig"); -end; - -function Font.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrName, - ); -end; - -function Font.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}AltName, - 1: {self.}Panosel, - 2: {self.}Charset, - 3: {self.}Family, - 4: {self.}Pitch, - 5: {self.}Sig, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "name": makeweakref(thisFunction(WriteXmlAttrName)), ); sorted_child_ := array( - "": -1, - {self.}AltName.ElementName: 0, - {self.}Panosel.ElementName: 1, - {self.}Charset.ElementName: 2, - {self.}Family.ElementName: 3, - {self.}Pitch.ElementName: 4, - {self.}Sig.ElementName: 5, + pre + "altName": array(0, makeweakref(thisFunction(ReadXmlChildAltName))), + pre + "panosel": array(1, makeweakref(thisFunction(ReadXmlChildPanosel))), + pre + "charset": array(2, makeweakref(thisFunction(ReadXmlChildCharset))), + pre + "family": array(3, makeweakref(thisFunction(ReadXmlChildFamily))), + pre + "pitch": array(4, makeweakref(thisFunction(ReadXmlChildPitch))), + pre + "sig": array(5, makeweakref(thisFunction(ReadXmlChildSig))), ); -end; - -function Font.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Font.Copy(_obj: Font);override; begin - if not ifnil(_obj.XmlAttrName.Value) then - {self.}XmlAttrName.Value := _obj.XmlAttrName.Value; - {self.}AltName.Copy(_obj.AltName); - {self.}Panosel.Copy(_obj.Panosel); - {self.}Charset.Copy(_obj.Charset); - {self.}Family.Copy(_obj.Family); - {self.}Pitch.Copy(_obj.Pitch); - {self.}Sig.Copy(_obj.Sig); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Name) then + {self.}Name := _obj.Name; + if not ifnil(_obj.XmlChildAltName) then + {self.}AltName.Copy(_obj.XmlChildAltName); + if not ifnil(_obj.XmlChildPanosel) then + {self.}Panosel.Copy(_obj.XmlChildPanosel); + if not ifnil(_obj.XmlChildCharset) then + {self.}Charset.Copy(_obj.XmlChildCharset); + if not ifnil(_obj.XmlChildFamily) then + {self.}Family.Copy(_obj.XmlChildFamily); + if not ifnil(_obj.XmlChildPitch) then + {self.}Pitch.Copy(_obj.XmlChildPitch); + if not ifnil(_obj.XmlChildSig) then + {self.}Sig.Copy(_obj.XmlChildSig); + tslassigning := tslassigning_backup; end; function Font.ReadXmlAttrName(); @@ -138,5 +104,70 @@ end; function Font.WriteXmlAttrName(_value); begin + if ifnil({self.}XmlAttrName) then + begin + {self.}XmlAttrName := new OpenXmlAttribute({self.}Prefix, "name", nil); + attributes_[length(attributes_)] := {self.}XmlAttrName; + end {self.}XmlAttrName.Value := _value; end; + +function Font.ReadXmlChildAltName(); +begin + if tslassigning and ifnil({self.}XmlChildAltName) then + begin + {self.}XmlChildAltName := new PureWVal(self, {self.}Prefix, "altName"); + container_.Set({self.}XmlChildAltName); + end + return {self.}XmlChildAltName; +end; + +function Font.ReadXmlChildPanosel(); +begin + if tslassigning and ifnil({self.}XmlChildPanosel) then + begin + {self.}XmlChildPanosel := new PureWVal(self, {self.}Prefix, "panosel"); + container_.Set({self.}XmlChildPanosel); + end + return {self.}XmlChildPanosel; +end; + +function Font.ReadXmlChildCharset(); +begin + if tslassigning and ifnil({self.}XmlChildCharset) then + begin + {self.}XmlChildCharset := new PureWVal(self, {self.}Prefix, "charset"); + container_.Set({self.}XmlChildCharset); + end + return {self.}XmlChildCharset; +end; + +function Font.ReadXmlChildFamily(); +begin + if tslassigning and ifnil({self.}XmlChildFamily) then + begin + {self.}XmlChildFamily := new PureWVal(self, {self.}Prefix, "family"); + container_.Set({self.}XmlChildFamily); + end + return {self.}XmlChildFamily; +end; + +function Font.ReadXmlChildPitch(); +begin + if tslassigning and ifnil({self.}XmlChildPitch) then + begin + {self.}XmlChildPitch := new PureWVal(self, {self.}Prefix, "pitch"); + container_.Set({self.}XmlChildPitch); + end + return {self.}XmlChildPitch; +end; + +function Font.ReadXmlChildSig(); +begin + if tslassigning and ifnil({self.}XmlChildSig) then + begin + {self.}XmlChildSig := new Sig(self, {self.}Prefix, "sig"); + container_.Set({self.}XmlChildSig); + end + return {self.}XmlChildSig; +end; diff --git a/autoclass/docx/FontScheme@DOCX.tsf b/autoclass/docx/FontScheme@DOCX.tsf index 1683976..76441ab 100644 --- a/autoclass/docx/FontScheme@DOCX.tsf +++ b/autoclass/docx/FontScheme@DOCX.tsf @@ -4,22 +4,28 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: FontScheme);override; +public + + // attributes property property Name read ReadXmlAttrName write WriteXmlAttrName; function ReadXmlAttrName(); function WriteXmlAttrName(_value); + // normal property + property Majorfont read ReadXmlChildMajorfont; + property Minorfont read ReadXmlChildMinorfont; + function ReadXmlChildMajorfont(); + function ReadXmlChildMinorfont(); + public - // Attributes + // Attributes XmlAttrName: OpenXmlAttribute; // Children - Majorfont: Mfont; - Minorfont: Mfont; + XmlChildMajorfont: Mfont; + XmlChildMinorfont: Mfont; end; @@ -35,80 +41,36 @@ end; function FontScheme.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function FontScheme.Init();override; begin - {self.}XmlAttrName := new OpenXmlAttribute(nil, "name", nil); - {self.}Majorfont := new Mfont(self, {self.}Prefix, "majorFont"); - {self.}Minorfont := new Mfont(self, {self.}Prefix, "minorFont"); -end; - -function FontScheme.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrName, - ); -end; - -function FontScheme.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Majorfont, - 1: {self.}Minorfont, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "name": makeweakref(thisFunction(WriteXmlAttrName)), ); sorted_child_ := array( - "": -1, - {self.}Majorfont.ElementName: 0, - {self.}Minorfont.ElementName: 1, + pre + "majorFont": array(0, makeweakref(thisFunction(ReadXmlChildMajorfont))), + pre + "minorFont": array(1, makeweakref(thisFunction(ReadXmlChildMinorfont))), ); -end; - -function FontScheme.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function FontScheme.Copy(_obj: FontScheme);override; begin - if not ifnil(_obj.XmlAttrName.Value) then - {self.}XmlAttrName.Value := _obj.XmlAttrName.Value; - {self.}Majorfont.Copy(_obj.Majorfont); - {self.}Minorfont.Copy(_obj.Minorfont); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Name) then + {self.}Name := _obj.Name; + if not ifnil(_obj.XmlChildMajorfont) then + {self.}Majorfont.Copy(_obj.XmlChildMajorfont); + if not ifnil(_obj.XmlChildMinorfont) then + {self.}Minorfont.Copy(_obj.XmlChildMinorfont); + tslassigning := tslassigning_backup; end; function FontScheme.ReadXmlAttrName(); @@ -118,5 +80,30 @@ end; function FontScheme.WriteXmlAttrName(_value); begin + if ifnil({self.}XmlAttrName) then + begin + {self.}XmlAttrName := new OpenXmlAttribute("", "name", nil); + attributes_[length(attributes_)] := {self.}XmlAttrName; + end {self.}XmlAttrName.Value := _value; end; + +function FontScheme.ReadXmlChildMajorfont(); +begin + if tslassigning and ifnil({self.}XmlChildMajorfont) then + begin + {self.}XmlChildMajorfont := new Mfont(self, {self.}Prefix, "majorFont"); + container_.Set({self.}XmlChildMajorfont); + end + return {self.}XmlChildMajorfont; +end; + +function FontScheme.ReadXmlChildMinorfont(); +begin + if tslassigning and ifnil({self.}XmlChildMinorfont) then + begin + {self.}XmlChildMinorfont := new Mfont(self, {self.}Prefix, "minorFont"); + container_.Set({self.}XmlChildMinorfont); + end + return {self.}XmlChildMinorfont; +end; diff --git a/autoclass/docx/Fonts@DOCX.tsf b/autoclass/docx/Fonts@DOCX.tsf index ff3b239..19871e0 100644 --- a/autoclass/docx/Fonts@DOCX.tsf +++ b/autoclass/docx/Fonts@DOCX.tsf @@ -4,16 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Fonts);override; - function AddFont(): Font; - function AppendFont(): Font; - property Fonts read ReadFonts; - function ReadFonts(_index); +public + // attributes property property XmlnsMc read ReadXmlAttrXmlnsMc write WriteXmlAttrXmlnsMc; property XmlnsR read ReadXmlAttrXmlnsR write WriteXmlAttrXmlnsR; property XmlnsW read ReadXmlAttrXmlnsW write WriteXmlAttrXmlnsW; @@ -51,8 +46,14 @@ public function ReadXmlAttrMcIgnorable(); function WriteXmlAttrMcIgnorable(_value); + // multi property + property Fonts read ReadFonts; + function ReadFonts(_index); + function AddFont(): Font; + function AppendFont(): Font; + public - // Attributes + // Attributes XmlAttrXmlnsMc: OpenXmlAttribute; XmlAttrXmlnsR: OpenXmlAttribute; XmlAttrXmlnsW: OpenXmlAttribute; @@ -82,153 +83,64 @@ end; function Fonts.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Fonts.Init();override; begin - {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); - {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); - {self.}XmlAttrXmlnsW := new OpenXmlAttribute("xmlns", "w", nil); - {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); - {self.}XmlAttrXmlnsW15 := new OpenXmlAttribute("xmlns", "w15", nil); - {self.}XmlAttrXmlnsW16Cex := new OpenXmlAttribute("xmlns", "w16cex", nil); - {self.}XmlAttrXmlnsW16Cid := new OpenXmlAttribute("xmlns", "w16cid", nil); - {self.}XmlAttrXmlnsW16 := new OpenXmlAttribute("xmlns", "w16", nil); - {self.}XmlAttrXmlnsW16Du := new OpenXmlAttribute("xmlns", "w16du", nil); - {self.}XmlAttrXmlnsW16sdtdh := new OpenXmlAttribute("xmlns", "w16sdtdh", nil); - {self.}XmlAttrXmlnsW16se := new OpenXmlAttribute("xmlns", "w16se", nil); - {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); -end; - -function Fonts.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXmlnsMc, - {self.}XmlAttrXmlnsR, - {self.}XmlAttrXmlnsW, - {self.}XmlAttrXmlnsW14, - {self.}XmlAttrXmlnsW15, - {self.}XmlAttrXmlnsW16Cex, - {self.}XmlAttrXmlnsW16Cid, - {self.}XmlAttrXmlnsW16, - {self.}XmlAttrXmlnsW16Du, - {self.}XmlAttrXmlnsW16sdtdh, - {self.}XmlAttrXmlnsW16se, - {self.}XmlAttrMcIgnorable, - ); -end; - -function Fonts.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns:mc": makeweakref(thisFunction(WriteXmlAttrXmlnsMc)), + "xmlns:r": makeweakref(thisFunction(WriteXmlAttrXmlnsR)), + "xmlns:w": makeweakref(thisFunction(WriteXmlAttrXmlnsW)), + "xmlns:w14": makeweakref(thisFunction(WriteXmlAttrXmlnsW14)), + "xmlns:w15": makeweakref(thisFunction(WriteXmlAttrXmlnsW15)), + "xmlns:w16cex": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Cex)), + "xmlns:w16cid": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Cid)), + "xmlns:w16": makeweakref(thisFunction(WriteXmlAttrXmlnsW16)), + "xmlns:w16du": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Du)), + "xmlns:w16sdtdh": makeweakref(thisFunction(WriteXmlAttrXmlnsW16sdtdh)), + "xmlns:w16se": makeweakref(thisFunction(WriteXmlAttrXmlnsW16se)), + "mc:Ignorable": makeweakref(thisFunction(WriteXmlAttrMcIgnorable)), ); sorted_child_ := array( - "": -1, + pre + "font": array(0, makeweakref(thisFunction(AppendFont))), ); -end; - -function Fonts.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "font": obj := {self.}AppendFont(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Fonts.Copy(_obj: Fonts);override; begin - if not ifnil(_obj.XmlAttrXmlnsMc.Value) then - {self.}XmlAttrXmlnsMc.Value := _obj.XmlAttrXmlnsMc.Value; - if not ifnil(_obj.XmlAttrXmlnsR.Value) then - {self.}XmlAttrXmlnsR.Value := _obj.XmlAttrXmlnsR.Value; - if not ifnil(_obj.XmlAttrXmlnsW.Value) then - {self.}XmlAttrXmlnsW.Value := _obj.XmlAttrXmlnsW.Value; - if not ifnil(_obj.XmlAttrXmlnsW14.Value) then - {self.}XmlAttrXmlnsW14.Value := _obj.XmlAttrXmlnsW14.Value; - if not ifnil(_obj.XmlAttrXmlnsW15.Value) then - {self.}XmlAttrXmlnsW15.Value := _obj.XmlAttrXmlnsW15.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Cex.Value) then - {self.}XmlAttrXmlnsW16Cex.Value := _obj.XmlAttrXmlnsW16Cex.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Cid.Value) then - {self.}XmlAttrXmlnsW16Cid.Value := _obj.XmlAttrXmlnsW16Cid.Value; - if not ifnil(_obj.XmlAttrXmlnsW16.Value) then - {self.}XmlAttrXmlnsW16.Value := _obj.XmlAttrXmlnsW16.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Du.Value) then - {self.}XmlAttrXmlnsW16Du.Value := _obj.XmlAttrXmlnsW16Du.Value; - if not ifnil(_obj.XmlAttrXmlnsW16sdtdh.Value) then - {self.}XmlAttrXmlnsW16sdtdh.Value := _obj.XmlAttrXmlnsW16sdtdh.Value; - if not ifnil(_obj.XmlAttrXmlnsW16se.Value) then - {self.}XmlAttrXmlnsW16se.Value := _obj.XmlAttrXmlnsW16se.Value; - if not ifnil(_obj.XmlAttrMcIgnorable.Value) then - {self.}XmlAttrMcIgnorable.Value := _obj.XmlAttrMcIgnorable.Value; -end; - -function Fonts.AddFont(): Font; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "font" then break; - end - obj := new Font(self, {self.}Prefix, "font"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function Fonts.AppendFont(): Font; -begin - obj := new Font(self, {self.}Prefix, "font"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function Fonts.ReadFonts(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "font" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlnsMc) then + {self.}XmlnsMc := _obj.XmlnsMc; + if not ifnil(_obj.XmlnsR) then + {self.}XmlnsR := _obj.XmlnsR; + if not ifnil(_obj.XmlnsW) then + {self.}XmlnsW := _obj.XmlnsW; + if not ifnil(_obj.XmlnsW14) then + {self.}XmlnsW14 := _obj.XmlnsW14; + if not ifnil(_obj.XmlnsW15) then + {self.}XmlnsW15 := _obj.XmlnsW15; + if not ifnil(_obj.XmlnsW16Cex) then + {self.}XmlnsW16Cex := _obj.XmlnsW16Cex; + if not ifnil(_obj.XmlnsW16Cid) then + {self.}XmlnsW16Cid := _obj.XmlnsW16Cid; + if not ifnil(_obj.XmlnsW16) then + {self.}XmlnsW16 := _obj.XmlnsW16; + if not ifnil(_obj.XmlnsW16Du) then + {self.}XmlnsW16Du := _obj.XmlnsW16Du; + if not ifnil(_obj.XmlnsW16sdtdh) then + {self.}XmlnsW16sdtdh := _obj.XmlnsW16sdtdh; + if not ifnil(_obj.XmlnsW16se) then + {self.}XmlnsW16se := _obj.XmlnsW16se; + if not ifnil(_obj.McIgnorable) then + {self.}McIgnorable := _obj.McIgnorable; + tslassigning := tslassigning_backup; end; function Fonts.ReadXmlAttrXmlnsMc(); @@ -238,6 +150,11 @@ end; function Fonts.WriteXmlAttrXmlnsMc(_value); begin + if ifnil({self.}XmlAttrXmlnsMc) then + begin + {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsMc; + end {self.}XmlAttrXmlnsMc.Value := _value; end; @@ -248,6 +165,11 @@ end; function Fonts.WriteXmlAttrXmlnsR(_value); begin + if ifnil({self.}XmlAttrXmlnsR) then + begin + {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsR; + end {self.}XmlAttrXmlnsR.Value := _value; end; @@ -258,6 +180,11 @@ end; function Fonts.WriteXmlAttrXmlnsW(_value); begin + if ifnil({self.}XmlAttrXmlnsW) then + begin + {self.}XmlAttrXmlnsW := new OpenXmlAttribute("xmlns", "w", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW; + end {self.}XmlAttrXmlnsW.Value := _value; end; @@ -268,6 +195,11 @@ end; function Fonts.WriteXmlAttrXmlnsW14(_value); begin + if ifnil({self.}XmlAttrXmlnsW14) then + begin + {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW14; + end {self.}XmlAttrXmlnsW14.Value := _value; end; @@ -278,6 +210,11 @@ end; function Fonts.WriteXmlAttrXmlnsW15(_value); begin + if ifnil({self.}XmlAttrXmlnsW15) then + begin + {self.}XmlAttrXmlnsW15 := new OpenXmlAttribute("xmlns", "w15", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW15; + end {self.}XmlAttrXmlnsW15.Value := _value; end; @@ -288,6 +225,11 @@ end; function Fonts.WriteXmlAttrXmlnsW16Cex(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Cex) then + begin + {self.}XmlAttrXmlnsW16Cex := new OpenXmlAttribute("xmlns", "w16cex", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Cex; + end {self.}XmlAttrXmlnsW16Cex.Value := _value; end; @@ -298,6 +240,11 @@ end; function Fonts.WriteXmlAttrXmlnsW16Cid(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Cid) then + begin + {self.}XmlAttrXmlnsW16Cid := new OpenXmlAttribute("xmlns", "w16cid", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Cid; + end {self.}XmlAttrXmlnsW16Cid.Value := _value; end; @@ -308,6 +255,11 @@ end; function Fonts.WriteXmlAttrXmlnsW16(_value); begin + if ifnil({self.}XmlAttrXmlnsW16) then + begin + {self.}XmlAttrXmlnsW16 := new OpenXmlAttribute("xmlns", "w16", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16; + end {self.}XmlAttrXmlnsW16.Value := _value; end; @@ -318,6 +270,11 @@ end; function Fonts.WriteXmlAttrXmlnsW16Du(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Du) then + begin + {self.}XmlAttrXmlnsW16Du := new OpenXmlAttribute("xmlns", "w16du", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Du; + end {self.}XmlAttrXmlnsW16Du.Value := _value; end; @@ -328,6 +285,11 @@ end; function Fonts.WriteXmlAttrXmlnsW16sdtdh(_value); begin + if ifnil({self.}XmlAttrXmlnsW16sdtdh) then + begin + {self.}XmlAttrXmlnsW16sdtdh := new OpenXmlAttribute("xmlns", "w16sdtdh", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16sdtdh; + end {self.}XmlAttrXmlnsW16sdtdh.Value := _value; end; @@ -338,6 +300,11 @@ end; function Fonts.WriteXmlAttrXmlnsW16se(_value); begin + if ifnil({self.}XmlAttrXmlnsW16se) then + begin + {self.}XmlAttrXmlnsW16se := new OpenXmlAttribute("xmlns", "w16se", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16se; + end {self.}XmlAttrXmlnsW16se.Value := _value; end; @@ -348,5 +315,31 @@ end; function Fonts.WriteXmlAttrMcIgnorable(_value); begin + if ifnil({self.}XmlAttrMcIgnorable) then + begin + {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); + attributes_[length(attributes_)] := {self.}XmlAttrMcIgnorable; + end {self.}XmlAttrMcIgnorable.Value := _value; end; + +function Fonts.ReadFonts(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "font", ind); +end; + +function Fonts.AddFont(): Font; +begin + obj := new Font(self, {self.}Prefix, "font"); + container_.Insert(obj); + return obj; +end; + +function Fonts.AppendFont(): Font; +begin + obj := new Font(self, {self.}Prefix, "font"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/Footnote@DOCX.tsf b/autoclass/docx/Footnote@DOCX.tsf index f6a6285..11c6306 100644 --- a/autoclass/docx/Footnote@DOCX.tsf +++ b/autoclass/docx/Footnote@DOCX.tsf @@ -4,16 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Footnote);override; - function AddP(): P; - function AppendP(): P; - property Ps read ReadPs; - function ReadPs(_index); +public + // attributes property property Type read ReadXmlAttrType write WriteXmlAttrType; property Id read ReadXmlAttrId write WriteXmlAttrId; function ReadXmlAttrType(); @@ -21,8 +16,14 @@ public function ReadXmlAttrId(); function WriteXmlAttrId(_value); + // multi property + property Ps read ReadPs; + function ReadPs(_index); + function AddP(): P; + function AppendP(): P; + public - // Attributes + // Attributes XmlAttrType: OpenXmlAttribute; XmlAttrId: OpenXmlAttribute; @@ -42,113 +43,34 @@ end; function Footnote.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Footnote.Init();override; begin - {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); - {self.}XmlAttrId := new OpenXmlAttribute({self.}Prefix, "id", nil); -end; - -function Footnote.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrType, - {self.}XmlAttrId, - ); -end; - -function Footnote.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "type": makeweakref(thisFunction(WriteXmlAttrType)), + pre + "id": makeweakref(thisFunction(WriteXmlAttrId)), ); sorted_child_ := array( - "": -1, + pre + "p": array(0, makeweakref(thisFunction(AppendP))), ); -end; - -function Footnote.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "p": obj := {self.}AppendP(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Footnote.Copy(_obj: Footnote);override; begin - if not ifnil(_obj.XmlAttrType.Value) then - {self.}XmlAttrType.Value := _obj.XmlAttrType.Value; - if not ifnil(_obj.XmlAttrId.Value) then - {self.}XmlAttrId.Value := _obj.XmlAttrId.Value; -end; - -function Footnote.AddP(): P; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "p" then break; - end - obj := new P(self, {self.}Prefix, "p"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function Footnote.AppendP(): P; -begin - obj := new P(self, {self.}Prefix, "p"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function Footnote.ReadPs(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "p" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Type) then + {self.}Type := _obj.Type; + if not ifnil(_obj.Id) then + {self.}Id := _obj.Id; + tslassigning := tslassigning_backup; end; function Footnote.ReadXmlAttrType(); @@ -158,6 +80,11 @@ end; function Footnote.WriteXmlAttrType(_value); begin + if ifnil({self.}XmlAttrType) then + begin + {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); + attributes_[length(attributes_)] := {self.}XmlAttrType; + end {self.}XmlAttrType.Value := _value; end; @@ -168,5 +95,31 @@ end; function Footnote.WriteXmlAttrId(_value); begin + if ifnil({self.}XmlAttrId) then + begin + {self.}XmlAttrId := new OpenXmlAttribute({self.}Prefix, "id", nil); + attributes_[length(attributes_)] := {self.}XmlAttrId; + end {self.}XmlAttrId.Value := _value; end; + +function Footnote.ReadPs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "p", ind); +end; + +function Footnote.AddP(): P; +begin + obj := new P(self, {self.}Prefix, "p"); + container_.Insert(obj); + return obj; +end; + +function Footnote.AppendP(): P; +begin + obj := new P(self, {self.}Prefix, "p"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/FootnotePr@DOCX.tsf b/autoclass/docx/FootnotePr@DOCX.tsf index 2f3b451..02a00bc 100644 --- a/autoclass/docx/FootnotePr@DOCX.tsf +++ b/autoclass/docx/FootnotePr@DOCX.tsf @@ -4,20 +4,29 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: FootnotePr);override; + +public + + // normal property + property Pos read ReadXmlChildPos; + property NumFmt read ReadXmlChildNumFmt; + property NumStart read ReadXmlChildNumStart; + function ReadXmlChildPos(); + function ReadXmlChildNumFmt(); + function ReadXmlChildNumStart(); + + // multi property + property Footnotes read ReadFootnotes; + function ReadFootnotes(_index); function AddFootnote(): Footnote; function AppendFootnote(): Footnote; - property Footnotes read ReadFootnotes; - function ReadFootnotes(_index); - public - // Attributes - // Children + XmlChildPos: PureWVal; + XmlChildNumFmt: PureWVal; + XmlChildNumStart: PureWVal; end; @@ -33,105 +42,86 @@ end; function FootnotePr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function FootnotePr.Init();override; begin - -end; - -function FootnotePr.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function FootnotePr.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, + pre + "pos": array(0, makeweakref(thisFunction(ReadXmlChildPos))), + pre + "numFmt": array(1, makeweakref(thisFunction(ReadXmlChildNumFmt))), + pre + "numStart": array(2, makeweakref(thisFunction(ReadXmlChildNumStart))), + pre + "footnote": array(3, makeweakref(thisFunction(AppendFootnote))), ); -end; - -function FootnotePr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "footnote": obj := {self.}AppendFootnote(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function FootnotePr.Copy(_obj: FootnotePr);override; begin + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildPos) then + {self.}Pos.Copy(_obj.XmlChildPos); + if not ifnil(_obj.XmlChildNumFmt) then + {self.}NumFmt.Copy(_obj.XmlChildNumFmt); + if not ifnil(_obj.XmlChildNumStart) then + {self.}NumStart.Copy(_obj.XmlChildNumStart); + tslassigning := tslassigning_backup; +end; +function FootnotePr.ReadXmlChildPos(); +begin + if tslassigning and ifnil({self.}XmlChildPos) then + begin + {self.}XmlChildPos := new PureWVal(self, {self.}Prefix, "pos"); + container_.Set({self.}XmlChildPos); + end + return {self.}XmlChildPos; +end; + +function FootnotePr.ReadXmlChildNumFmt(); +begin + if tslassigning and ifnil({self.}XmlChildNumFmt) then + begin + {self.}XmlChildNumFmt := new PureWVal(self, {self.}Prefix, "numFmt"); + container_.Set({self.}XmlChildNumFmt); + end + return {self.}XmlChildNumFmt; +end; + +function FootnotePr.ReadXmlChildNumStart(); +begin + if tslassigning and ifnil({self.}XmlChildNumStart) then + begin + {self.}XmlChildNumStart := new PureWVal(self, {self.}Prefix, "numStart"); + container_.Set({self.}XmlChildNumStart); + end + return {self.}XmlChildNumStart; +end; + +function FootnotePr.ReadFootnotes(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "footnote", ind); end; function FootnotePr.AddFootnote(): Footnote; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "footnote" then break; - end obj := new Footnote(self, {self.}Prefix, "footnote"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function FootnotePr.AppendFootnote(): Footnote; begin obj := new Footnote(self, {self.}Prefix, "footnote"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function FootnotePr.ReadFootnotes(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "footnote" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; diff --git a/autoclass/docx/Footnotes@DOCX.tsf b/autoclass/docx/Footnotes@DOCX.tsf index 0acd1f7..d5e1e21 100644 --- a/autoclass/docx/Footnotes@DOCX.tsf +++ b/autoclass/docx/Footnotes@DOCX.tsf @@ -4,16 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Footnotes);override; - function AddFootnote(): Footnote; - function AppendFootnote(): Footnote; - property Footnotes read ReadFootnotes; - function ReadFootnotes(_index); +public + // attributes property property XmlnsWpc read ReadXmlAttrXmlnsWpc write WriteXmlAttrXmlnsWpc; property XmlnsCx read ReadXmlAttrXmlnsCx write WriteXmlAttrXmlnsCx; property XmlnsCx1 read ReadXmlAttrXmlnsCx1 write WriteXmlAttrXmlnsCx1; @@ -114,8 +109,14 @@ public function ReadXmlAttrMcIgnorable(); function WriteXmlAttrMcIgnorable(_value); + // multi property + property Footnotes read ReadFootnotes; + function ReadFootnotes(_index); + function AddFootnote(): Footnote; + function AppendFootnote(): Footnote; + public - // Attributes + // Attributes XmlAttrXmlnsWpc: OpenXmlAttribute; XmlAttrXmlnsCx: OpenXmlAttribute; XmlAttrXmlnsCx1: OpenXmlAttribute; @@ -166,237 +167,127 @@ end; function Footnotes.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Footnotes.Init();override; begin - {self.}XmlAttrXmlnsWpc := new OpenXmlAttribute("xmlns", "wpc", nil); - {self.}XmlAttrXmlnsCx := new OpenXmlAttribute("xmlns", "cx", nil); - {self.}XmlAttrXmlnsCx1 := new OpenXmlAttribute("xmlns", "cx1", nil); - {self.}XmlAttrXmlnsCx2 := new OpenXmlAttribute("xmlns", "cx2", nil); - {self.}XmlAttrXmlnsCx3 := new OpenXmlAttribute("xmlns", "cx3", nil); - {self.}XmlAttrXmlnsCx4 := new OpenXmlAttribute("xmlns", "cx4", nil); - {self.}XmlAttrXmlnsCx5 := new OpenXmlAttribute("xmlns", "cx5", nil); - {self.}XmlAttrXmlnsCx6 := new OpenXmlAttribute("xmlns", "cx6", nil); - {self.}XmlAttrXmlnsCx7 := new OpenXmlAttribute("xmlns", "cx7", nil); - {self.}XmlAttrXmlnsCx8 := new OpenXmlAttribute("xmlns", "cx8", nil); - {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); - {self.}XmlAttrXmlnsAink := new OpenXmlAttribute("xmlns", "aink", nil); - {self.}XmlAttrXmlnsAm3d := new OpenXmlAttribute("xmlns", "am3d", nil); - {self.}XmlAttrXmlnsO := new OpenXmlAttribute("xmlns", "o", nil); - {self.}XmlAttrXmlnsOel := new OpenXmlAttribute("xmlns", "oel", nil); - {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); - {self.}XmlAttrXmlnsM := new OpenXmlAttribute("xmlns", "m", nil); - {self.}XmlAttrXmlnsV := new OpenXmlAttribute("xmlns", "v", nil); - {self.}XmlAttrXmlnsWp14 := new OpenXmlAttribute("xmlns", "wp14", nil); - {self.}XmlAttrXmlnsWp := new OpenXmlAttribute("xmlns", "wp", nil); - {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); - {self.}XmlAttrXmlnsW15 := new OpenXmlAttribute("xmlns", "w15", nil); - {self.}XmlAttrXmlnsW16Cex := new OpenXmlAttribute("xmlns", "w16cex", nil); - {self.}XmlAttrXmlnsW16Cid := new OpenXmlAttribute("xmlns", "w16cid", nil); - {self.}XmlAttrXmlnsW16 := new OpenXmlAttribute("xmlns", "w16", nil); - {self.}XmlAttrXmlnsW16Du := new OpenXmlAttribute("xmlns", "w16du", nil); - {self.}XmlAttrXmlnsW16sdtdh := new OpenXmlAttribute("xmlns", "w16sdtdh", nil); - {self.}XmlAttrXmlnsW16se := new OpenXmlAttribute("xmlns", "w16se", nil); - {self.}XmlAttrXmlnsWpg := new OpenXmlAttribute("xmlns", "wpg", nil); - {self.}XmlAttrXmlnsWpi := new OpenXmlAttribute("xmlns", "wpi", nil); - {self.}XmlAttrXmlnsWne := new OpenXmlAttribute("xmlns", "wne", nil); - {self.}XmlAttrXmlnsWps := new OpenXmlAttribute("xmlns", "wps", nil); - {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); -end; - -function Footnotes.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXmlnsWpc, - {self.}XmlAttrXmlnsCx, - {self.}XmlAttrXmlnsCx1, - {self.}XmlAttrXmlnsCx2, - {self.}XmlAttrXmlnsCx3, - {self.}XmlAttrXmlnsCx4, - {self.}XmlAttrXmlnsCx5, - {self.}XmlAttrXmlnsCx6, - {self.}XmlAttrXmlnsCx7, - {self.}XmlAttrXmlnsCx8, - {self.}XmlAttrXmlnsMc, - {self.}XmlAttrXmlnsAink, - {self.}XmlAttrXmlnsAm3d, - {self.}XmlAttrXmlnsO, - {self.}XmlAttrXmlnsOel, - {self.}XmlAttrXmlnsR, - {self.}XmlAttrXmlnsM, - {self.}XmlAttrXmlnsV, - {self.}XmlAttrXmlnsWp14, - {self.}XmlAttrXmlnsWp, - {self.}XmlAttrXmlnsW14, - {self.}XmlAttrXmlnsW15, - {self.}XmlAttrXmlnsW16Cex, - {self.}XmlAttrXmlnsW16Cid, - {self.}XmlAttrXmlnsW16, - {self.}XmlAttrXmlnsW16Du, - {self.}XmlAttrXmlnsW16sdtdh, - {self.}XmlAttrXmlnsW16se, - {self.}XmlAttrXmlnsWpg, - {self.}XmlAttrXmlnsWpi, - {self.}XmlAttrXmlnsWne, - {self.}XmlAttrXmlnsWps, - {self.}XmlAttrMcIgnorable, - ); -end; - -function Footnotes.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns:wpc": makeweakref(thisFunction(WriteXmlAttrXmlnsWpc)), + "xmlns:cx": makeweakref(thisFunction(WriteXmlAttrXmlnsCx)), + "xmlns:cx1": makeweakref(thisFunction(WriteXmlAttrXmlnsCx1)), + "xmlns:cx2": makeweakref(thisFunction(WriteXmlAttrXmlnsCx2)), + "xmlns:cx3": makeweakref(thisFunction(WriteXmlAttrXmlnsCx3)), + "xmlns:cx4": makeweakref(thisFunction(WriteXmlAttrXmlnsCx4)), + "xmlns:cx5": makeweakref(thisFunction(WriteXmlAttrXmlnsCx5)), + "xmlns:cx6": makeweakref(thisFunction(WriteXmlAttrXmlnsCx6)), + "xmlns:cx7": makeweakref(thisFunction(WriteXmlAttrXmlnsCx7)), + "xmlns:cx8": makeweakref(thisFunction(WriteXmlAttrXmlnsCx8)), + "xmlns:mc": makeweakref(thisFunction(WriteXmlAttrXmlnsMc)), + "xmlns:aink": makeweakref(thisFunction(WriteXmlAttrXmlnsAink)), + "xmlns:am3d": makeweakref(thisFunction(WriteXmlAttrXmlnsAm3d)), + "xmlns:o": makeweakref(thisFunction(WriteXmlAttrXmlnsO)), + "xmlns:oel": makeweakref(thisFunction(WriteXmlAttrXmlnsOel)), + "xmlns:r": makeweakref(thisFunction(WriteXmlAttrXmlnsR)), + "xmlns:m": makeweakref(thisFunction(WriteXmlAttrXmlnsM)), + "xmlns:v": makeweakref(thisFunction(WriteXmlAttrXmlnsV)), + "xmlns:wp14": makeweakref(thisFunction(WriteXmlAttrXmlnsWp14)), + "xmlns:wp": makeweakref(thisFunction(WriteXmlAttrXmlnsWp)), + "xmlns:w14": makeweakref(thisFunction(WriteXmlAttrXmlnsW14)), + "xmlns:w15": makeweakref(thisFunction(WriteXmlAttrXmlnsW15)), + "xmlns:w16cex": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Cex)), + "xmlns:w16cid": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Cid)), + "xmlns:w16": makeweakref(thisFunction(WriteXmlAttrXmlnsW16)), + "xmlns:w16du": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Du)), + "xmlns:w16sdtdh": makeweakref(thisFunction(WriteXmlAttrXmlnsW16sdtdh)), + "xmlns:w16se": makeweakref(thisFunction(WriteXmlAttrXmlnsW16se)), + "xmlns:wpg": makeweakref(thisFunction(WriteXmlAttrXmlnsWpg)), + "xmlns:wpi": makeweakref(thisFunction(WriteXmlAttrXmlnsWpi)), + "xmlns:wne": makeweakref(thisFunction(WriteXmlAttrXmlnsWne)), + "xmlns:wps": makeweakref(thisFunction(WriteXmlAttrXmlnsWps)), + "mc:Ignorable": makeweakref(thisFunction(WriteXmlAttrMcIgnorable)), ); sorted_child_ := array( - "": -1, + pre + "footnote": array(0, makeweakref(thisFunction(AppendFootnote))), ); -end; - -function Footnotes.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "footnote": obj := {self.}AppendFootnote(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Footnotes.Copy(_obj: Footnotes);override; begin - if not ifnil(_obj.XmlAttrXmlnsWpc.Value) then - {self.}XmlAttrXmlnsWpc.Value := _obj.XmlAttrXmlnsWpc.Value; - if not ifnil(_obj.XmlAttrXmlnsCx.Value) then - {self.}XmlAttrXmlnsCx.Value := _obj.XmlAttrXmlnsCx.Value; - if not ifnil(_obj.XmlAttrXmlnsCx1.Value) then - {self.}XmlAttrXmlnsCx1.Value := _obj.XmlAttrXmlnsCx1.Value; - if not ifnil(_obj.XmlAttrXmlnsCx2.Value) then - {self.}XmlAttrXmlnsCx2.Value := _obj.XmlAttrXmlnsCx2.Value; - if not ifnil(_obj.XmlAttrXmlnsCx3.Value) then - {self.}XmlAttrXmlnsCx3.Value := _obj.XmlAttrXmlnsCx3.Value; - if not ifnil(_obj.XmlAttrXmlnsCx4.Value) then - {self.}XmlAttrXmlnsCx4.Value := _obj.XmlAttrXmlnsCx4.Value; - if not ifnil(_obj.XmlAttrXmlnsCx5.Value) then - {self.}XmlAttrXmlnsCx5.Value := _obj.XmlAttrXmlnsCx5.Value; - if not ifnil(_obj.XmlAttrXmlnsCx6.Value) then - {self.}XmlAttrXmlnsCx6.Value := _obj.XmlAttrXmlnsCx6.Value; - if not ifnil(_obj.XmlAttrXmlnsCx7.Value) then - {self.}XmlAttrXmlnsCx7.Value := _obj.XmlAttrXmlnsCx7.Value; - if not ifnil(_obj.XmlAttrXmlnsCx8.Value) then - {self.}XmlAttrXmlnsCx8.Value := _obj.XmlAttrXmlnsCx8.Value; - if not ifnil(_obj.XmlAttrXmlnsMc.Value) then - {self.}XmlAttrXmlnsMc.Value := _obj.XmlAttrXmlnsMc.Value; - if not ifnil(_obj.XmlAttrXmlnsAink.Value) then - {self.}XmlAttrXmlnsAink.Value := _obj.XmlAttrXmlnsAink.Value; - if not ifnil(_obj.XmlAttrXmlnsAm3d.Value) then - {self.}XmlAttrXmlnsAm3d.Value := _obj.XmlAttrXmlnsAm3d.Value; - if not ifnil(_obj.XmlAttrXmlnsO.Value) then - {self.}XmlAttrXmlnsO.Value := _obj.XmlAttrXmlnsO.Value; - if not ifnil(_obj.XmlAttrXmlnsOel.Value) then - {self.}XmlAttrXmlnsOel.Value := _obj.XmlAttrXmlnsOel.Value; - if not ifnil(_obj.XmlAttrXmlnsR.Value) then - {self.}XmlAttrXmlnsR.Value := _obj.XmlAttrXmlnsR.Value; - if not ifnil(_obj.XmlAttrXmlnsM.Value) then - {self.}XmlAttrXmlnsM.Value := _obj.XmlAttrXmlnsM.Value; - if not ifnil(_obj.XmlAttrXmlnsV.Value) then - {self.}XmlAttrXmlnsV.Value := _obj.XmlAttrXmlnsV.Value; - if not ifnil(_obj.XmlAttrXmlnsWp14.Value) then - {self.}XmlAttrXmlnsWp14.Value := _obj.XmlAttrXmlnsWp14.Value; - if not ifnil(_obj.XmlAttrXmlnsWp.Value) then - {self.}XmlAttrXmlnsWp.Value := _obj.XmlAttrXmlnsWp.Value; - if not ifnil(_obj.XmlAttrXmlnsW14.Value) then - {self.}XmlAttrXmlnsW14.Value := _obj.XmlAttrXmlnsW14.Value; - if not ifnil(_obj.XmlAttrXmlnsW15.Value) then - {self.}XmlAttrXmlnsW15.Value := _obj.XmlAttrXmlnsW15.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Cex.Value) then - {self.}XmlAttrXmlnsW16Cex.Value := _obj.XmlAttrXmlnsW16Cex.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Cid.Value) then - {self.}XmlAttrXmlnsW16Cid.Value := _obj.XmlAttrXmlnsW16Cid.Value; - if not ifnil(_obj.XmlAttrXmlnsW16.Value) then - {self.}XmlAttrXmlnsW16.Value := _obj.XmlAttrXmlnsW16.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Du.Value) then - {self.}XmlAttrXmlnsW16Du.Value := _obj.XmlAttrXmlnsW16Du.Value; - if not ifnil(_obj.XmlAttrXmlnsW16sdtdh.Value) then - {self.}XmlAttrXmlnsW16sdtdh.Value := _obj.XmlAttrXmlnsW16sdtdh.Value; - if not ifnil(_obj.XmlAttrXmlnsW16se.Value) then - {self.}XmlAttrXmlnsW16se.Value := _obj.XmlAttrXmlnsW16se.Value; - if not ifnil(_obj.XmlAttrXmlnsWpg.Value) then - {self.}XmlAttrXmlnsWpg.Value := _obj.XmlAttrXmlnsWpg.Value; - if not ifnil(_obj.XmlAttrXmlnsWpi.Value) then - {self.}XmlAttrXmlnsWpi.Value := _obj.XmlAttrXmlnsWpi.Value; - if not ifnil(_obj.XmlAttrXmlnsWne.Value) then - {self.}XmlAttrXmlnsWne.Value := _obj.XmlAttrXmlnsWne.Value; - if not ifnil(_obj.XmlAttrXmlnsWps.Value) then - {self.}XmlAttrXmlnsWps.Value := _obj.XmlAttrXmlnsWps.Value; - if not ifnil(_obj.XmlAttrMcIgnorable.Value) then - {self.}XmlAttrMcIgnorable.Value := _obj.XmlAttrMcIgnorable.Value; -end; - -function Footnotes.AddFootnote(): Footnote; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "footnote" then break; - end - obj := new Footnote(self, {self.}Prefix, "footnote"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function Footnotes.AppendFootnote(): Footnote; -begin - obj := new Footnote(self, {self.}Prefix, "footnote"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function Footnotes.ReadFootnotes(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "footnote" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlnsWpc) then + {self.}XmlnsWpc := _obj.XmlnsWpc; + if not ifnil(_obj.XmlnsCx) then + {self.}XmlnsCx := _obj.XmlnsCx; + if not ifnil(_obj.XmlnsCx1) then + {self.}XmlnsCx1 := _obj.XmlnsCx1; + if not ifnil(_obj.XmlnsCx2) then + {self.}XmlnsCx2 := _obj.XmlnsCx2; + if not ifnil(_obj.XmlnsCx3) then + {self.}XmlnsCx3 := _obj.XmlnsCx3; + if not ifnil(_obj.XmlnsCx4) then + {self.}XmlnsCx4 := _obj.XmlnsCx4; + if not ifnil(_obj.XmlnsCx5) then + {self.}XmlnsCx5 := _obj.XmlnsCx5; + if not ifnil(_obj.XmlnsCx6) then + {self.}XmlnsCx6 := _obj.XmlnsCx6; + if not ifnil(_obj.XmlnsCx7) then + {self.}XmlnsCx7 := _obj.XmlnsCx7; + if not ifnil(_obj.XmlnsCx8) then + {self.}XmlnsCx8 := _obj.XmlnsCx8; + if not ifnil(_obj.XmlnsMc) then + {self.}XmlnsMc := _obj.XmlnsMc; + if not ifnil(_obj.XmlnsAink) then + {self.}XmlnsAink := _obj.XmlnsAink; + if not ifnil(_obj.XmlnsAm3d) then + {self.}XmlnsAm3d := _obj.XmlnsAm3d; + if not ifnil(_obj.XmlnsO) then + {self.}XmlnsO := _obj.XmlnsO; + if not ifnil(_obj.XmlnsOel) then + {self.}XmlnsOel := _obj.XmlnsOel; + if not ifnil(_obj.XmlnsR) then + {self.}XmlnsR := _obj.XmlnsR; + if not ifnil(_obj.XmlnsM) then + {self.}XmlnsM := _obj.XmlnsM; + if not ifnil(_obj.XmlnsV) then + {self.}XmlnsV := _obj.XmlnsV; + if not ifnil(_obj.XmlnsWp14) then + {self.}XmlnsWp14 := _obj.XmlnsWp14; + if not ifnil(_obj.XmlnsWp) then + {self.}XmlnsWp := _obj.XmlnsWp; + if not ifnil(_obj.XmlnsW14) then + {self.}XmlnsW14 := _obj.XmlnsW14; + if not ifnil(_obj.XmlnsW15) then + {self.}XmlnsW15 := _obj.XmlnsW15; + if not ifnil(_obj.XmlnsW16Cex) then + {self.}XmlnsW16Cex := _obj.XmlnsW16Cex; + if not ifnil(_obj.XmlnsW16Cid) then + {self.}XmlnsW16Cid := _obj.XmlnsW16Cid; + if not ifnil(_obj.XmlnsW16) then + {self.}XmlnsW16 := _obj.XmlnsW16; + if not ifnil(_obj.XmlnsW16Du) then + {self.}XmlnsW16Du := _obj.XmlnsW16Du; + if not ifnil(_obj.XmlnsW16sdtdh) then + {self.}XmlnsW16sdtdh := _obj.XmlnsW16sdtdh; + if not ifnil(_obj.XmlnsW16se) then + {self.}XmlnsW16se := _obj.XmlnsW16se; + if not ifnil(_obj.XmlnsWpg) then + {self.}XmlnsWpg := _obj.XmlnsWpg; + if not ifnil(_obj.XmlnsWpi) then + {self.}XmlnsWpi := _obj.XmlnsWpi; + if not ifnil(_obj.XmlnsWne) then + {self.}XmlnsWne := _obj.XmlnsWne; + if not ifnil(_obj.XmlnsWps) then + {self.}XmlnsWps := _obj.XmlnsWps; + if not ifnil(_obj.McIgnorable) then + {self.}McIgnorable := _obj.McIgnorable; + tslassigning := tslassigning_backup; end; function Footnotes.ReadXmlAttrXmlnsWpc(); @@ -406,6 +297,11 @@ end; function Footnotes.WriteXmlAttrXmlnsWpc(_value); begin + if ifnil({self.}XmlAttrXmlnsWpc) then + begin + {self.}XmlAttrXmlnsWpc := new OpenXmlAttribute("xmlns", "wpc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpc; + end {self.}XmlAttrXmlnsWpc.Value := _value; end; @@ -416,6 +312,11 @@ end; function Footnotes.WriteXmlAttrXmlnsCx(_value); begin + if ifnil({self.}XmlAttrXmlnsCx) then + begin + {self.}XmlAttrXmlnsCx := new OpenXmlAttribute("xmlns", "cx", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx; + end {self.}XmlAttrXmlnsCx.Value := _value; end; @@ -426,6 +327,11 @@ end; function Footnotes.WriteXmlAttrXmlnsCx1(_value); begin + if ifnil({self.}XmlAttrXmlnsCx1) then + begin + {self.}XmlAttrXmlnsCx1 := new OpenXmlAttribute("xmlns", "cx1", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx1; + end {self.}XmlAttrXmlnsCx1.Value := _value; end; @@ -436,6 +342,11 @@ end; function Footnotes.WriteXmlAttrXmlnsCx2(_value); begin + if ifnil({self.}XmlAttrXmlnsCx2) then + begin + {self.}XmlAttrXmlnsCx2 := new OpenXmlAttribute("xmlns", "cx2", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx2; + end {self.}XmlAttrXmlnsCx2.Value := _value; end; @@ -446,6 +357,11 @@ end; function Footnotes.WriteXmlAttrXmlnsCx3(_value); begin + if ifnil({self.}XmlAttrXmlnsCx3) then + begin + {self.}XmlAttrXmlnsCx3 := new OpenXmlAttribute("xmlns", "cx3", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx3; + end {self.}XmlAttrXmlnsCx3.Value := _value; end; @@ -456,6 +372,11 @@ end; function Footnotes.WriteXmlAttrXmlnsCx4(_value); begin + if ifnil({self.}XmlAttrXmlnsCx4) then + begin + {self.}XmlAttrXmlnsCx4 := new OpenXmlAttribute("xmlns", "cx4", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx4; + end {self.}XmlAttrXmlnsCx4.Value := _value; end; @@ -466,6 +387,11 @@ end; function Footnotes.WriteXmlAttrXmlnsCx5(_value); begin + if ifnil({self.}XmlAttrXmlnsCx5) then + begin + {self.}XmlAttrXmlnsCx5 := new OpenXmlAttribute("xmlns", "cx5", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx5; + end {self.}XmlAttrXmlnsCx5.Value := _value; end; @@ -476,6 +402,11 @@ end; function Footnotes.WriteXmlAttrXmlnsCx6(_value); begin + if ifnil({self.}XmlAttrXmlnsCx6) then + begin + {self.}XmlAttrXmlnsCx6 := new OpenXmlAttribute("xmlns", "cx6", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx6; + end {self.}XmlAttrXmlnsCx6.Value := _value; end; @@ -486,6 +417,11 @@ end; function Footnotes.WriteXmlAttrXmlnsCx7(_value); begin + if ifnil({self.}XmlAttrXmlnsCx7) then + begin + {self.}XmlAttrXmlnsCx7 := new OpenXmlAttribute("xmlns", "cx7", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx7; + end {self.}XmlAttrXmlnsCx7.Value := _value; end; @@ -496,6 +432,11 @@ end; function Footnotes.WriteXmlAttrXmlnsCx8(_value); begin + if ifnil({self.}XmlAttrXmlnsCx8) then + begin + {self.}XmlAttrXmlnsCx8 := new OpenXmlAttribute("xmlns", "cx8", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx8; + end {self.}XmlAttrXmlnsCx8.Value := _value; end; @@ -506,6 +447,11 @@ end; function Footnotes.WriteXmlAttrXmlnsMc(_value); begin + if ifnil({self.}XmlAttrXmlnsMc) then + begin + {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsMc; + end {self.}XmlAttrXmlnsMc.Value := _value; end; @@ -516,6 +462,11 @@ end; function Footnotes.WriteXmlAttrXmlnsAink(_value); begin + if ifnil({self.}XmlAttrXmlnsAink) then + begin + {self.}XmlAttrXmlnsAink := new OpenXmlAttribute("xmlns", "aink", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsAink; + end {self.}XmlAttrXmlnsAink.Value := _value; end; @@ -526,6 +477,11 @@ end; function Footnotes.WriteXmlAttrXmlnsAm3d(_value); begin + if ifnil({self.}XmlAttrXmlnsAm3d) then + begin + {self.}XmlAttrXmlnsAm3d := new OpenXmlAttribute("xmlns", "am3d", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsAm3d; + end {self.}XmlAttrXmlnsAm3d.Value := _value; end; @@ -536,6 +492,11 @@ end; function Footnotes.WriteXmlAttrXmlnsO(_value); begin + if ifnil({self.}XmlAttrXmlnsO) then + begin + {self.}XmlAttrXmlnsO := new OpenXmlAttribute("xmlns", "o", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsO; + end {self.}XmlAttrXmlnsO.Value := _value; end; @@ -546,6 +507,11 @@ end; function Footnotes.WriteXmlAttrXmlnsOel(_value); begin + if ifnil({self.}XmlAttrXmlnsOel) then + begin + {self.}XmlAttrXmlnsOel := new OpenXmlAttribute("xmlns", "oel", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsOel; + end {self.}XmlAttrXmlnsOel.Value := _value; end; @@ -556,6 +522,11 @@ end; function Footnotes.WriteXmlAttrXmlnsR(_value); begin + if ifnil({self.}XmlAttrXmlnsR) then + begin + {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsR; + end {self.}XmlAttrXmlnsR.Value := _value; end; @@ -566,6 +537,11 @@ end; function Footnotes.WriteXmlAttrXmlnsM(_value); begin + if ifnil({self.}XmlAttrXmlnsM) then + begin + {self.}XmlAttrXmlnsM := new OpenXmlAttribute("xmlns", "m", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsM; + end {self.}XmlAttrXmlnsM.Value := _value; end; @@ -576,6 +552,11 @@ end; function Footnotes.WriteXmlAttrXmlnsV(_value); begin + if ifnil({self.}XmlAttrXmlnsV) then + begin + {self.}XmlAttrXmlnsV := new OpenXmlAttribute("xmlns", "v", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsV; + end {self.}XmlAttrXmlnsV.Value := _value; end; @@ -586,6 +567,11 @@ end; function Footnotes.WriteXmlAttrXmlnsWp14(_value); begin + if ifnil({self.}XmlAttrXmlnsWp14) then + begin + {self.}XmlAttrXmlnsWp14 := new OpenXmlAttribute("xmlns", "wp14", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWp14; + end {self.}XmlAttrXmlnsWp14.Value := _value; end; @@ -596,6 +582,11 @@ end; function Footnotes.WriteXmlAttrXmlnsWp(_value); begin + if ifnil({self.}XmlAttrXmlnsWp) then + begin + {self.}XmlAttrXmlnsWp := new OpenXmlAttribute("xmlns", "wp", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWp; + end {self.}XmlAttrXmlnsWp.Value := _value; end; @@ -606,6 +597,11 @@ end; function Footnotes.WriteXmlAttrXmlnsW14(_value); begin + if ifnil({self.}XmlAttrXmlnsW14) then + begin + {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW14; + end {self.}XmlAttrXmlnsW14.Value := _value; end; @@ -616,6 +612,11 @@ end; function Footnotes.WriteXmlAttrXmlnsW15(_value); begin + if ifnil({self.}XmlAttrXmlnsW15) then + begin + {self.}XmlAttrXmlnsW15 := new OpenXmlAttribute("xmlns", "w15", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW15; + end {self.}XmlAttrXmlnsW15.Value := _value; end; @@ -626,6 +627,11 @@ end; function Footnotes.WriteXmlAttrXmlnsW16Cex(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Cex) then + begin + {self.}XmlAttrXmlnsW16Cex := new OpenXmlAttribute("xmlns", "w16cex", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Cex; + end {self.}XmlAttrXmlnsW16Cex.Value := _value; end; @@ -636,6 +642,11 @@ end; function Footnotes.WriteXmlAttrXmlnsW16Cid(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Cid) then + begin + {self.}XmlAttrXmlnsW16Cid := new OpenXmlAttribute("xmlns", "w16cid", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Cid; + end {self.}XmlAttrXmlnsW16Cid.Value := _value; end; @@ -646,6 +657,11 @@ end; function Footnotes.WriteXmlAttrXmlnsW16(_value); begin + if ifnil({self.}XmlAttrXmlnsW16) then + begin + {self.}XmlAttrXmlnsW16 := new OpenXmlAttribute("xmlns", "w16", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16; + end {self.}XmlAttrXmlnsW16.Value := _value; end; @@ -656,6 +672,11 @@ end; function Footnotes.WriteXmlAttrXmlnsW16Du(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Du) then + begin + {self.}XmlAttrXmlnsW16Du := new OpenXmlAttribute("xmlns", "w16du", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Du; + end {self.}XmlAttrXmlnsW16Du.Value := _value; end; @@ -666,6 +687,11 @@ end; function Footnotes.WriteXmlAttrXmlnsW16sdtdh(_value); begin + if ifnil({self.}XmlAttrXmlnsW16sdtdh) then + begin + {self.}XmlAttrXmlnsW16sdtdh := new OpenXmlAttribute("xmlns", "w16sdtdh", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16sdtdh; + end {self.}XmlAttrXmlnsW16sdtdh.Value := _value; end; @@ -676,6 +702,11 @@ end; function Footnotes.WriteXmlAttrXmlnsW16se(_value); begin + if ifnil({self.}XmlAttrXmlnsW16se) then + begin + {self.}XmlAttrXmlnsW16se := new OpenXmlAttribute("xmlns", "w16se", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16se; + end {self.}XmlAttrXmlnsW16se.Value := _value; end; @@ -686,6 +717,11 @@ end; function Footnotes.WriteXmlAttrXmlnsWpg(_value); begin + if ifnil({self.}XmlAttrXmlnsWpg) then + begin + {self.}XmlAttrXmlnsWpg := new OpenXmlAttribute("xmlns", "wpg", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpg; + end {self.}XmlAttrXmlnsWpg.Value := _value; end; @@ -696,6 +732,11 @@ end; function Footnotes.WriteXmlAttrXmlnsWpi(_value); begin + if ifnil({self.}XmlAttrXmlnsWpi) then + begin + {self.}XmlAttrXmlnsWpi := new OpenXmlAttribute("xmlns", "wpi", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpi; + end {self.}XmlAttrXmlnsWpi.Value := _value; end; @@ -706,6 +747,11 @@ end; function Footnotes.WriteXmlAttrXmlnsWne(_value); begin + if ifnil({self.}XmlAttrXmlnsWne) then + begin + {self.}XmlAttrXmlnsWne := new OpenXmlAttribute("xmlns", "wne", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWne; + end {self.}XmlAttrXmlnsWne.Value := _value; end; @@ -716,6 +762,11 @@ end; function Footnotes.WriteXmlAttrXmlnsWps(_value); begin + if ifnil({self.}XmlAttrXmlnsWps) then + begin + {self.}XmlAttrXmlnsWps := new OpenXmlAttribute("xmlns", "wps", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWps; + end {self.}XmlAttrXmlnsWps.Value := _value; end; @@ -726,5 +777,31 @@ end; function Footnotes.WriteXmlAttrMcIgnorable(_value); begin + if ifnil({self.}XmlAttrMcIgnorable) then + begin + {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); + attributes_[length(attributes_)] := {self.}XmlAttrMcIgnorable; + end {self.}XmlAttrMcIgnorable.Value := _value; end; + +function Footnotes.ReadFootnotes(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "footnote", ind); +end; + +function Footnotes.AddFootnote(): Footnote; +begin + obj := new Footnote(self, {self.}Prefix, "footnote"); + container_.Insert(obj); + return obj; +end; + +function Footnotes.AppendFootnote(): Footnote; +begin + obj := new Footnote(self, {self.}Prefix, "footnote"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/Ftr@DOCX.tsf b/autoclass/docx/Ftr@DOCX.tsf index 908c06c..27ecedf 100644 --- a/autoclass/docx/Ftr@DOCX.tsf +++ b/autoclass/docx/Ftr@DOCX.tsf @@ -4,16 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Ftr);override; - function AddP(): P; - function AppendP(): P; - property Ps read ReadPs; - function ReadPs(_index); +public + // attributes property property XmlnsM read ReadXmlAttrXmlnsM write WriteXmlAttrXmlnsM; property XmlnsMc read ReadXmlAttrXmlnsMc write WriteXmlAttrXmlnsMc; property XmlnsMo read ReadXmlAttrXmlnsMo write WriteXmlAttrXmlnsMo; @@ -60,8 +55,14 @@ public function ReadXmlAttrMcIgnorable(); function WriteXmlAttrMcIgnorable(_value); + // multi property + property Ps read ReadPs; + function ReadPs(_index); + function AddP(): P; + function AppendP(): P; + public - // Attributes + // Attributes XmlAttrXmlnsM: OpenXmlAttribute; XmlAttrXmlnsMc: OpenXmlAttribute; XmlAttrXmlnsMo: OpenXmlAttribute; @@ -94,165 +95,73 @@ end; function Ftr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Ftr.Init();override; begin - {self.}XmlAttrXmlnsM := new OpenXmlAttribute("xmlns", "m", nil); - {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); - {self.}XmlAttrXmlnsMo := new OpenXmlAttribute("xmlns", "mo", nil); - {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); - {self.}XmlAttrXmlnsV := new OpenXmlAttribute("xmlns", "v", nil); - {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); - {self.}XmlAttrXmlnsW := new OpenXmlAttribute("xmlns", "w", nil); - {self.}XmlAttrXmlnsWne := new OpenXmlAttribute("xmlns", "wne", nil); - {self.}XmlAttrXmlnsWp14 := new OpenXmlAttribute("xmlns", "wp14", nil); - {self.}XmlAttrXmlnsWp := new OpenXmlAttribute("xmlns", "wp", nil); - {self.}XmlAttrXmlnsWpc := new OpenXmlAttribute("xmlns", "wpc", nil); - {self.}XmlAttrXmlnsWpg := new OpenXmlAttribute("xmlns", "wpg", nil); - {self.}XmlAttrXmlnsWpi := new OpenXmlAttribute("xmlns", "wpi", nil); - {self.}XmlAttrXmlnsWps := new OpenXmlAttribute("xmlns", "wps", nil); - {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); -end; - -function Ftr.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXmlnsM, - {self.}XmlAttrXmlnsMc, - {self.}XmlAttrXmlnsMo, - {self.}XmlAttrXmlnsR, - {self.}XmlAttrXmlnsV, - {self.}XmlAttrXmlnsW14, - {self.}XmlAttrXmlnsW, - {self.}XmlAttrXmlnsWne, - {self.}XmlAttrXmlnsWp14, - {self.}XmlAttrXmlnsWp, - {self.}XmlAttrXmlnsWpc, - {self.}XmlAttrXmlnsWpg, - {self.}XmlAttrXmlnsWpi, - {self.}XmlAttrXmlnsWps, - {self.}XmlAttrMcIgnorable, - ); -end; - -function Ftr.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns:m": makeweakref(thisFunction(WriteXmlAttrXmlnsM)), + "xmlns:mc": makeweakref(thisFunction(WriteXmlAttrXmlnsMc)), + "xmlns:mo": makeweakref(thisFunction(WriteXmlAttrXmlnsMo)), + "xmlns:r": makeweakref(thisFunction(WriteXmlAttrXmlnsR)), + "xmlns:v": makeweakref(thisFunction(WriteXmlAttrXmlnsV)), + "xmlns:w14": makeweakref(thisFunction(WriteXmlAttrXmlnsW14)), + "xmlns:w": makeweakref(thisFunction(WriteXmlAttrXmlnsW)), + "xmlns:wne": makeweakref(thisFunction(WriteXmlAttrXmlnsWne)), + "xmlns:wp14": makeweakref(thisFunction(WriteXmlAttrXmlnsWp14)), + "xmlns:wp": makeweakref(thisFunction(WriteXmlAttrXmlnsWp)), + "xmlns:wpc": makeweakref(thisFunction(WriteXmlAttrXmlnsWpc)), + "xmlns:wpg": makeweakref(thisFunction(WriteXmlAttrXmlnsWpg)), + "xmlns:wpi": makeweakref(thisFunction(WriteXmlAttrXmlnsWpi)), + "xmlns:wps": makeweakref(thisFunction(WriteXmlAttrXmlnsWps)), + "mc:Ignorable": makeweakref(thisFunction(WriteXmlAttrMcIgnorable)), ); sorted_child_ := array( - "": -1, + pre + "p": array(0, makeweakref(thisFunction(AppendP))), ); -end; - -function Ftr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "p": obj := {self.}AppendP(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Ftr.Copy(_obj: Ftr);override; begin - if not ifnil(_obj.XmlAttrXmlnsM.Value) then - {self.}XmlAttrXmlnsM.Value := _obj.XmlAttrXmlnsM.Value; - if not ifnil(_obj.XmlAttrXmlnsMc.Value) then - {self.}XmlAttrXmlnsMc.Value := _obj.XmlAttrXmlnsMc.Value; - if not ifnil(_obj.XmlAttrXmlnsMo.Value) then - {self.}XmlAttrXmlnsMo.Value := _obj.XmlAttrXmlnsMo.Value; - if not ifnil(_obj.XmlAttrXmlnsR.Value) then - {self.}XmlAttrXmlnsR.Value := _obj.XmlAttrXmlnsR.Value; - if not ifnil(_obj.XmlAttrXmlnsV.Value) then - {self.}XmlAttrXmlnsV.Value := _obj.XmlAttrXmlnsV.Value; - if not ifnil(_obj.XmlAttrXmlnsW14.Value) then - {self.}XmlAttrXmlnsW14.Value := _obj.XmlAttrXmlnsW14.Value; - if not ifnil(_obj.XmlAttrXmlnsW.Value) then - {self.}XmlAttrXmlnsW.Value := _obj.XmlAttrXmlnsW.Value; - if not ifnil(_obj.XmlAttrXmlnsWne.Value) then - {self.}XmlAttrXmlnsWne.Value := _obj.XmlAttrXmlnsWne.Value; - if not ifnil(_obj.XmlAttrXmlnsWp14.Value) then - {self.}XmlAttrXmlnsWp14.Value := _obj.XmlAttrXmlnsWp14.Value; - if not ifnil(_obj.XmlAttrXmlnsWp.Value) then - {self.}XmlAttrXmlnsWp.Value := _obj.XmlAttrXmlnsWp.Value; - if not ifnil(_obj.XmlAttrXmlnsWpc.Value) then - {self.}XmlAttrXmlnsWpc.Value := _obj.XmlAttrXmlnsWpc.Value; - if not ifnil(_obj.XmlAttrXmlnsWpg.Value) then - {self.}XmlAttrXmlnsWpg.Value := _obj.XmlAttrXmlnsWpg.Value; - if not ifnil(_obj.XmlAttrXmlnsWpi.Value) then - {self.}XmlAttrXmlnsWpi.Value := _obj.XmlAttrXmlnsWpi.Value; - if not ifnil(_obj.XmlAttrXmlnsWps.Value) then - {self.}XmlAttrXmlnsWps.Value := _obj.XmlAttrXmlnsWps.Value; - if not ifnil(_obj.XmlAttrMcIgnorable.Value) then - {self.}XmlAttrMcIgnorable.Value := _obj.XmlAttrMcIgnorable.Value; -end; - -function Ftr.AddP(): P; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "p" then break; - end - obj := new P(self, {self.}Prefix, "p"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function Ftr.AppendP(): P; -begin - obj := new P(self, {self.}Prefix, "p"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function Ftr.ReadPs(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "p" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlnsM) then + {self.}XmlnsM := _obj.XmlnsM; + if not ifnil(_obj.XmlnsMc) then + {self.}XmlnsMc := _obj.XmlnsMc; + if not ifnil(_obj.XmlnsMo) then + {self.}XmlnsMo := _obj.XmlnsMo; + if not ifnil(_obj.XmlnsR) then + {self.}XmlnsR := _obj.XmlnsR; + if not ifnil(_obj.XmlnsV) then + {self.}XmlnsV := _obj.XmlnsV; + if not ifnil(_obj.XmlnsW14) then + {self.}XmlnsW14 := _obj.XmlnsW14; + if not ifnil(_obj.XmlnsW) then + {self.}XmlnsW := _obj.XmlnsW; + if not ifnil(_obj.XmlnsWne) then + {self.}XmlnsWne := _obj.XmlnsWne; + if not ifnil(_obj.XmlnsWp14) then + {self.}XmlnsWp14 := _obj.XmlnsWp14; + if not ifnil(_obj.XmlnsWp) then + {self.}XmlnsWp := _obj.XmlnsWp; + if not ifnil(_obj.XmlnsWpc) then + {self.}XmlnsWpc := _obj.XmlnsWpc; + if not ifnil(_obj.XmlnsWpg) then + {self.}XmlnsWpg := _obj.XmlnsWpg; + if not ifnil(_obj.XmlnsWpi) then + {self.}XmlnsWpi := _obj.XmlnsWpi; + if not ifnil(_obj.XmlnsWps) then + {self.}XmlnsWps := _obj.XmlnsWps; + if not ifnil(_obj.McIgnorable) then + {self.}McIgnorable := _obj.McIgnorable; + tslassigning := tslassigning_backup; end; function Ftr.ReadXmlAttrXmlnsM(); @@ -262,6 +171,11 @@ end; function Ftr.WriteXmlAttrXmlnsM(_value); begin + if ifnil({self.}XmlAttrXmlnsM) then + begin + {self.}XmlAttrXmlnsM := new OpenXmlAttribute("xmlns", "m", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsM; + end {self.}XmlAttrXmlnsM.Value := _value; end; @@ -272,6 +186,11 @@ end; function Ftr.WriteXmlAttrXmlnsMc(_value); begin + if ifnil({self.}XmlAttrXmlnsMc) then + begin + {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsMc; + end {self.}XmlAttrXmlnsMc.Value := _value; end; @@ -282,6 +201,11 @@ end; function Ftr.WriteXmlAttrXmlnsMo(_value); begin + if ifnil({self.}XmlAttrXmlnsMo) then + begin + {self.}XmlAttrXmlnsMo := new OpenXmlAttribute("xmlns", "mo", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsMo; + end {self.}XmlAttrXmlnsMo.Value := _value; end; @@ -292,6 +216,11 @@ end; function Ftr.WriteXmlAttrXmlnsR(_value); begin + if ifnil({self.}XmlAttrXmlnsR) then + begin + {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsR; + end {self.}XmlAttrXmlnsR.Value := _value; end; @@ -302,6 +231,11 @@ end; function Ftr.WriteXmlAttrXmlnsV(_value); begin + if ifnil({self.}XmlAttrXmlnsV) then + begin + {self.}XmlAttrXmlnsV := new OpenXmlAttribute("xmlns", "v", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsV; + end {self.}XmlAttrXmlnsV.Value := _value; end; @@ -312,6 +246,11 @@ end; function Ftr.WriteXmlAttrXmlnsW14(_value); begin + if ifnil({self.}XmlAttrXmlnsW14) then + begin + {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW14; + end {self.}XmlAttrXmlnsW14.Value := _value; end; @@ -322,6 +261,11 @@ end; function Ftr.WriteXmlAttrXmlnsW(_value); begin + if ifnil({self.}XmlAttrXmlnsW) then + begin + {self.}XmlAttrXmlnsW := new OpenXmlAttribute("xmlns", "w", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW; + end {self.}XmlAttrXmlnsW.Value := _value; end; @@ -332,6 +276,11 @@ end; function Ftr.WriteXmlAttrXmlnsWne(_value); begin + if ifnil({self.}XmlAttrXmlnsWne) then + begin + {self.}XmlAttrXmlnsWne := new OpenXmlAttribute("xmlns", "wne", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWne; + end {self.}XmlAttrXmlnsWne.Value := _value; end; @@ -342,6 +291,11 @@ end; function Ftr.WriteXmlAttrXmlnsWp14(_value); begin + if ifnil({self.}XmlAttrXmlnsWp14) then + begin + {self.}XmlAttrXmlnsWp14 := new OpenXmlAttribute("xmlns", "wp14", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWp14; + end {self.}XmlAttrXmlnsWp14.Value := _value; end; @@ -352,6 +306,11 @@ end; function Ftr.WriteXmlAttrXmlnsWp(_value); begin + if ifnil({self.}XmlAttrXmlnsWp) then + begin + {self.}XmlAttrXmlnsWp := new OpenXmlAttribute("xmlns", "wp", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWp; + end {self.}XmlAttrXmlnsWp.Value := _value; end; @@ -362,6 +321,11 @@ end; function Ftr.WriteXmlAttrXmlnsWpc(_value); begin + if ifnil({self.}XmlAttrXmlnsWpc) then + begin + {self.}XmlAttrXmlnsWpc := new OpenXmlAttribute("xmlns", "wpc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpc; + end {self.}XmlAttrXmlnsWpc.Value := _value; end; @@ -372,6 +336,11 @@ end; function Ftr.WriteXmlAttrXmlnsWpg(_value); begin + if ifnil({self.}XmlAttrXmlnsWpg) then + begin + {self.}XmlAttrXmlnsWpg := new OpenXmlAttribute("xmlns", "wpg", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpg; + end {self.}XmlAttrXmlnsWpg.Value := _value; end; @@ -382,6 +351,11 @@ end; function Ftr.WriteXmlAttrXmlnsWpi(_value); begin + if ifnil({self.}XmlAttrXmlnsWpi) then + begin + {self.}XmlAttrXmlnsWpi := new OpenXmlAttribute("xmlns", "wpi", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpi; + end {self.}XmlAttrXmlnsWpi.Value := _value; end; @@ -392,6 +366,11 @@ end; function Ftr.WriteXmlAttrXmlnsWps(_value); begin + if ifnil({self.}XmlAttrXmlnsWps) then + begin + {self.}XmlAttrXmlnsWps := new OpenXmlAttribute("xmlns", "wps", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWps; + end {self.}XmlAttrXmlnsWps.Value := _value; end; @@ -402,5 +381,31 @@ end; function Ftr.WriteXmlAttrMcIgnorable(_value); begin + if ifnil({self.}XmlAttrMcIgnorable) then + begin + {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); + attributes_[length(attributes_)] := {self.}XmlAttrMcIgnorable; + end {self.}XmlAttrMcIgnorable.Value := _value; end; + +function Ftr.ReadPs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "p", ind); +end; + +function Ftr.AddP(): P; +begin + obj := new P(self, {self.}Prefix, "p"); + container_.Insert(obj); + return obj; +end; + +function Ftr.AppendP(): P; +begin + obj := new P(self, {self.}Prefix, "p"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/GradFill@DOCX.tsf b/autoclass/docx/GradFill@DOCX.tsf index 050f310..490858d 100644 --- a/autoclass/docx/GradFill@DOCX.tsf +++ b/autoclass/docx/GradFill@DOCX.tsf @@ -4,22 +4,28 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: GradFill);override; +public + + // attributes property property RotWithShape read ReadXmlAttrRotWithShape write WriteXmlAttrRotWithShape; function ReadXmlAttrRotWithShape(); function WriteXmlAttrRotWithShape(_value); + // normal property + property GsLst read ReadXmlChildGsLst; + property Lin read ReadXmlChildLin; + function ReadXmlChildGsLst(); + function ReadXmlChildLin(); + public - // Attributes + // Attributes XmlAttrRotWithShape: OpenXmlAttribute; // Children - GsLst: GsLst; - Lin: Lin; + XmlChildGsLst: GsLst; + XmlChildLin: Lin; end; @@ -35,80 +41,36 @@ end; function GradFill.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function GradFill.Init();override; begin - {self.}XmlAttrRotWithShape := new OpenXmlAttribute(nil, "rotWithShape", nil); - {self.}GsLst := new GsLst(self, {self.}Prefix, "gsLst"); - {self.}Lin := new Lin(self, {self.}Prefix, "lin"); -end; - -function GradFill.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrRotWithShape, - ); -end; - -function GradFill.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}GsLst, - 1: {self.}Lin, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "rotWithShape": makeweakref(thisFunction(WriteXmlAttrRotWithShape)), ); sorted_child_ := array( - "": -1, - {self.}GsLst.ElementName: 0, - {self.}Lin.ElementName: 1, + pre + "gsLst": array(0, makeweakref(thisFunction(ReadXmlChildGsLst))), + pre + "lin": array(1, makeweakref(thisFunction(ReadXmlChildLin))), ); -end; - -function GradFill.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function GradFill.Copy(_obj: GradFill);override; begin - if not ifnil(_obj.XmlAttrRotWithShape.Value) then - {self.}XmlAttrRotWithShape.Value := _obj.XmlAttrRotWithShape.Value; - {self.}GsLst.Copy(_obj.GsLst); - {self.}Lin.Copy(_obj.Lin); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.RotWithShape) then + {self.}RotWithShape := _obj.RotWithShape; + if not ifnil(_obj.XmlChildGsLst) then + {self.}GsLst.Copy(_obj.XmlChildGsLst); + if not ifnil(_obj.XmlChildLin) then + {self.}Lin.Copy(_obj.XmlChildLin); + tslassigning := tslassigning_backup; end; function GradFill.ReadXmlAttrRotWithShape(); @@ -118,5 +80,30 @@ end; function GradFill.WriteXmlAttrRotWithShape(_value); begin + if ifnil({self.}XmlAttrRotWithShape) then + begin + {self.}XmlAttrRotWithShape := new OpenXmlAttribute("", "rotWithShape", nil); + attributes_[length(attributes_)] := {self.}XmlAttrRotWithShape; + end {self.}XmlAttrRotWithShape.Value := _value; end; + +function GradFill.ReadXmlChildGsLst(); +begin + if tslassigning and ifnil({self.}XmlChildGsLst) then + begin + {self.}XmlChildGsLst := new GsLst(self, {self.}Prefix, "gsLst"); + container_.Set({self.}XmlChildGsLst); + end + return {self.}XmlChildGsLst; +end; + +function GradFill.ReadXmlChildLin(); +begin + if tslassigning and ifnil({self.}XmlChildLin) then + begin + {self.}XmlChildLin := new Lin(self, {self.}Prefix, "lin"); + container_.Set({self.}XmlChildLin); + end + return {self.}XmlChildLin; +end; diff --git a/autoclass/docx/Graphic@DOCX.tsf b/autoclass/docx/Graphic@DOCX.tsf index 2653f63..8467186 100644 --- a/autoclass/docx/Graphic@DOCX.tsf +++ b/autoclass/docx/Graphic@DOCX.tsf @@ -4,27 +4,31 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Graphic);override; +public + + // attributes property property XmlnsA read ReadXmlAttrXmlnsA write WriteXmlAttrXmlnsA; function ReadXmlAttrXmlnsA(); function WriteXmlAttrXmlnsA(_value); + // normal property + property GraphicData read ReadXmlChildGraphicData; + function ReadXmlChildGraphicData(); + public - // Attributes + // Attributes XmlAttrXmlnsA: OpenXmlAttribute; // Children - GraphicData: GraphicData; + XmlChildGraphicData: GraphicData; end; function Graphic.Create();overload; begin - {self.}Create(nil, nil, ""); + {self.}Create(nil, "", ""); end; function Graphic.Create(_node: XmlNode);overload; @@ -34,76 +38,33 @@ end; function Graphic.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Graphic.Init();override; begin - {self.}XmlAttrXmlnsA := new OpenXmlAttribute("xmlns", "a", nil); - {self.}GraphicData := new GraphicData(self, "a", "graphicData"); -end; - -function Graphic.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXmlnsA, - ); -end; - -function Graphic.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}GraphicData, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns:a": makeweakref(thisFunction(WriteXmlAttrXmlnsA)), ); sorted_child_ := array( - "": -1, - {self.}GraphicData.ElementName: 0, + "a:graphicData": array(0, makeweakref(thisFunction(ReadXmlChildGraphicData))), ); -end; - -function Graphic.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Graphic.Copy(_obj: Graphic);override; begin - if not ifnil(_obj.XmlAttrXmlnsA.Value) then - {self.}XmlAttrXmlnsA.Value := _obj.XmlAttrXmlnsA.Value; - {self.}GraphicData.Copy(_obj.GraphicData); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlnsA) then + {self.}XmlnsA := _obj.XmlnsA; + if not ifnil(_obj.XmlChildGraphicData) then + {self.}GraphicData.Copy(_obj.XmlChildGraphicData); + tslassigning := tslassigning_backup; end; function Graphic.ReadXmlAttrXmlnsA(); @@ -113,5 +74,20 @@ end; function Graphic.WriteXmlAttrXmlnsA(_value); begin + if ifnil({self.}XmlAttrXmlnsA) then + begin + {self.}XmlAttrXmlnsA := new OpenXmlAttribute("xmlns", "a", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsA; + end {self.}XmlAttrXmlnsA.Value := _value; end; + +function Graphic.ReadXmlChildGraphicData(); +begin + if tslassigning and ifnil({self.}XmlChildGraphicData) then + begin + {self.}XmlChildGraphicData := new GraphicData(self, "a", "graphicData"); + container_.Set({self.}XmlChildGraphicData); + end + return {self.}XmlChildGraphicData; +end; diff --git a/autoclass/docx/GraphicData@DOCX.tsf b/autoclass/docx/GraphicData@DOCX.tsf index da968ce..fb6c7b7 100644 --- a/autoclass/docx/GraphicData@DOCX.tsf +++ b/autoclass/docx/GraphicData@DOCX.tsf @@ -4,23 +4,31 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: GraphicData);override; +public + + // attributes property property Uri read ReadXmlAttrUri write WriteXmlAttrUri; function ReadXmlAttrUri(); function WriteXmlAttrUri(_value); + // normal property + property Pic read ReadXmlChildPic; + property Chart read ReadXmlChildChart; + property Wsp read ReadXmlChildWsp; + function ReadXmlChildPic(); + function ReadXmlChildChart(); + function ReadXmlChildWsp(); + public - // Attributes + // Attributes XmlAttrUri: OpenXmlAttribute; // Children - Pic: Pic; - Chart: Chart; - Wsp: Wsp; + XmlChildPic: Pic; + XmlChildChart: Chart; + XmlChildWsp: Wsp; end; @@ -36,84 +44,39 @@ end; function GraphicData.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function GraphicData.Init();override; begin - {self.}XmlAttrUri := new OpenXmlAttribute(nil, "uri", nil); - {self.}Pic := new Pic(self, "pic", "pic"); - {self.}Chart := new Chart(self, "c", "chart"); - {self.}Wsp := new Wsp(self, "wps", "wsp"); -end; - -function GraphicData.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrUri, - ); -end; - -function GraphicData.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Pic, - 1: {self.}Chart, - 2: {self.}Wsp, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "uri": makeweakref(thisFunction(WriteXmlAttrUri)), ); sorted_child_ := array( - "": -1, - {self.}Pic.ElementName: 0, - {self.}Chart.ElementName: 1, - {self.}Wsp.ElementName: 2, + "pic:pic": array(0, makeweakref(thisFunction(ReadXmlChildPic))), + "c:chart": array(1, makeweakref(thisFunction(ReadXmlChildChart))), + "wps:wsp": array(2, makeweakref(thisFunction(ReadXmlChildWsp))), ); -end; - -function GraphicData.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function GraphicData.Copy(_obj: GraphicData);override; begin - if not ifnil(_obj.XmlAttrUri.Value) then - {self.}XmlAttrUri.Value := _obj.XmlAttrUri.Value; - {self.}Pic.Copy(_obj.Pic); - {self.}Chart.Copy(_obj.Chart); - {self.}Wsp.Copy(_obj.Wsp); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Uri) then + {self.}Uri := _obj.Uri; + if not ifnil(_obj.XmlChildPic) then + {self.}Pic.Copy(_obj.XmlChildPic); + if not ifnil(_obj.XmlChildChart) then + {self.}Chart.Copy(_obj.XmlChildChart); + if not ifnil(_obj.XmlChildWsp) then + {self.}Wsp.Copy(_obj.XmlChildWsp); + tslassigning := tslassigning_backup; end; function GraphicData.ReadXmlAttrUri(); @@ -123,5 +86,40 @@ end; function GraphicData.WriteXmlAttrUri(_value); begin + if ifnil({self.}XmlAttrUri) then + begin + {self.}XmlAttrUri := new OpenXmlAttribute("", "uri", nil); + attributes_[length(attributes_)] := {self.}XmlAttrUri; + end {self.}XmlAttrUri.Value := _value; end; + +function GraphicData.ReadXmlChildPic(); +begin + if tslassigning and ifnil({self.}XmlChildPic) then + begin + {self.}XmlChildPic := new Pic(self, "pic", "pic"); + container_.Set({self.}XmlChildPic); + end + return {self.}XmlChildPic; +end; + +function GraphicData.ReadXmlChildChart(); +begin + if tslassigning and ifnil({self.}XmlChildChart) then + begin + {self.}XmlChildChart := new Chart(self, "c", "chart"); + container_.Set({self.}XmlChildChart); + end + return {self.}XmlChildChart; +end; + +function GraphicData.ReadXmlChildWsp(); +begin + if tslassigning and ifnil({self.}XmlChildWsp) then + begin + {self.}XmlChildWsp := new Wsp(self, "wps", "wsp"); + container_.Set({self.}XmlChildWsp); + end + return {self.}XmlChildWsp; +end; diff --git a/autoclass/docx/GraphicFrameLocks@DOCX.tsf b/autoclass/docx/GraphicFrameLocks@DOCX.tsf index f36abf3..3a15367 100644 --- a/autoclass/docx/GraphicFrameLocks@DOCX.tsf +++ b/autoclass/docx/GraphicFrameLocks@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: GraphicFrameLocks);override; +public + + // attributes property property NoChangeAspect read ReadXmlAttrNoChangeAspect write WriteXmlAttrNoChangeAspect; property XmlnsA read ReadXmlAttrXmlnsA write WriteXmlAttrXmlnsA; function ReadXmlAttrNoChangeAspect(); @@ -17,17 +17,16 @@ public function WriteXmlAttrXmlnsA(_value); public - // Attributes + // Attributes XmlAttrNoChangeAspect: OpenXmlAttribute; XmlAttrXmlnsA: OpenXmlAttribute; - // Children end; function GraphicFrameLocks.Create();overload; begin - {self.}Create(nil, nil, ""); + {self.}Create(nil, "", ""); end; function GraphicFrameLocks.Create(_node: XmlNode);overload; @@ -37,45 +36,33 @@ end; function GraphicFrameLocks.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function GraphicFrameLocks.Init();override; begin - {self.}XmlAttrNoChangeAspect := new OpenXmlAttribute(nil, "noChangeAspect", nil); - {self.}XmlAttrXmlnsA := new OpenXmlAttribute("xmlns", "a", nil); -end; - -function GraphicFrameLocks.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrNoChangeAspect, - {self.}XmlAttrXmlnsA, - ); -end; - -function GraphicFrameLocks.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "noChangeAspect": makeweakref(thisFunction(WriteXmlAttrNoChangeAspect)), + "xmlns:a": makeweakref(thisFunction(WriteXmlAttrXmlnsA)), ); sorted_child_ := array( - "": -1, ); -end; - -function GraphicFrameLocks.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function GraphicFrameLocks.Copy(_obj: GraphicFrameLocks);override; begin - if not ifnil(_obj.XmlAttrNoChangeAspect.Value) then - {self.}XmlAttrNoChangeAspect.Value := _obj.XmlAttrNoChangeAspect.Value; - if not ifnil(_obj.XmlAttrXmlnsA.Value) then - {self.}XmlAttrXmlnsA.Value := _obj.XmlAttrXmlnsA.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.NoChangeAspect) then + {self.}NoChangeAspect := _obj.NoChangeAspect; + if not ifnil(_obj.XmlnsA) then + {self.}XmlnsA := _obj.XmlnsA; + tslassigning := tslassigning_backup; end; function GraphicFrameLocks.ReadXmlAttrNoChangeAspect(); @@ -85,6 +72,11 @@ end; function GraphicFrameLocks.WriteXmlAttrNoChangeAspect(_value); begin + if ifnil({self.}XmlAttrNoChangeAspect) then + begin + {self.}XmlAttrNoChangeAspect := new OpenXmlAttribute("", "noChangeAspect", nil); + attributes_[length(attributes_)] := {self.}XmlAttrNoChangeAspect; + end {self.}XmlAttrNoChangeAspect.Value := _value; end; @@ -95,5 +87,10 @@ end; function GraphicFrameLocks.WriteXmlAttrXmlnsA(_value); begin + if ifnil({self.}XmlAttrXmlnsA) then + begin + {self.}XmlAttrXmlnsA := new OpenXmlAttribute("xmlns", "a", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsA; + end {self.}XmlAttrXmlnsA.Value := _value; end; diff --git a/autoclass/docx/GridCol@DOCX.tsf b/autoclass/docx/GridCol@DOCX.tsf index b0c4067..1605bdc 100644 --- a/autoclass/docx/GridCol@DOCX.tsf +++ b/autoclass/docx/GridCol@DOCX.tsf @@ -4,20 +4,19 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: GridCol);override; +public + + // attributes property property w read ReadXmlAttrw write WriteXmlAttrw; function ReadXmlAttrw(); function WriteXmlAttrw(_value); public - // Attributes + // Attributes XmlAttrw: OpenXmlAttribute; - // Children end; @@ -33,41 +32,30 @@ end; function GridCol.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function GridCol.Init();override; begin - {self.}XmlAttrw := new OpenXmlAttribute({self.}Prefix, "w", nil); -end; - -function GridCol.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrw, - ); -end; - -function GridCol.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "w": makeweakref(thisFunction(WriteXmlAttrw)), ); sorted_child_ := array( - "": -1, ); -end; - -function GridCol.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function GridCol.Copy(_obj: GridCol);override; begin - if not ifnil(_obj.XmlAttrw.Value) then - {self.}XmlAttrw.Value := _obj.XmlAttrw.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.w) then + {self.}w := _obj.w; + tslassigning := tslassigning_backup; end; function GridCol.ReadXmlAttrw(); @@ -77,5 +65,10 @@ end; function GridCol.WriteXmlAttrw(_value); begin + if ifnil({self.}XmlAttrw) then + begin + {self.}XmlAttrw := new OpenXmlAttribute({self.}Prefix, "w", nil); + attributes_[length(attributes_)] := {self.}XmlAttrw; + end {self.}XmlAttrw.Value := _value; end; diff --git a/autoclass/docx/GridSpan@DOCX.tsf b/autoclass/docx/GridSpan@DOCX.tsf index c0f8632..02fa795 100644 --- a/autoclass/docx/GridSpan@DOCX.tsf +++ b/autoclass/docx/GridSpan@DOCX.tsf @@ -4,20 +4,19 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: GridSpan);override; +public + + // attributes property property Val read ReadXmlAttrVal write WriteXmlAttrVal; function ReadXmlAttrVal(); function WriteXmlAttrVal(_value); public - // Attributes + // Attributes XmlAttrVal: OpenXmlAttribute; - // Children end; @@ -33,41 +32,30 @@ end; function GridSpan.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function GridSpan.Init();override; begin - {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); -end; - -function GridSpan.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrVal, - ); -end; - -function GridSpan.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "val": makeweakref(thisFunction(WriteXmlAttrVal)), ); sorted_child_ := array( - "": -1, ); -end; - -function GridSpan.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function GridSpan.Copy(_obj: GridSpan);override; begin - if not ifnil(_obj.XmlAttrVal.Value) then - {self.}XmlAttrVal.Value := _obj.XmlAttrVal.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Val) then + {self.}Val := _obj.Val; + tslassigning := tslassigning_backup; end; function GridSpan.ReadXmlAttrVal(); @@ -77,5 +65,10 @@ end; function GridSpan.WriteXmlAttrVal(_value); begin + if ifnil({self.}XmlAttrVal) then + begin + {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVal; + end {self.}XmlAttrVal.Value := _value; end; diff --git a/autoclass/docx/Gs@DOCX.tsf b/autoclass/docx/Gs@DOCX.tsf index 1836c3b..29331e0 100644 --- a/autoclass/docx/Gs@DOCX.tsf +++ b/autoclass/docx/Gs@DOCX.tsf @@ -4,21 +4,25 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Gs);override; +public + + // attributes property property Pos read ReadXmlAttrPos write WriteXmlAttrPos; function ReadXmlAttrPos(); function WriteXmlAttrPos(_value); + // normal property + property SchemeClr read ReadXmlChildSchemeClr; + function ReadXmlChildSchemeClr(); + public - // Attributes + // Attributes XmlAttrPos: OpenXmlAttribute; // Children - SchemeClr: SchemeClr; + XmlChildSchemeClr: SchemeClr; end; @@ -34,76 +38,33 @@ end; function Gs.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Gs.Init();override; begin - {self.}XmlAttrPos := new OpenXmlAttribute(nil, "pos", nil); - {self.}SchemeClr := new SchemeClr(self, {self.}Prefix, "schemeClr"); -end; - -function Gs.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrPos, - ); -end; - -function Gs.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}SchemeClr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "pos": makeweakref(thisFunction(WriteXmlAttrPos)), ); sorted_child_ := array( - "": -1, - {self.}SchemeClr.ElementName: 0, + pre + "schemeClr": array(0, makeweakref(thisFunction(ReadXmlChildSchemeClr))), ); -end; - -function Gs.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Gs.Copy(_obj: Gs);override; begin - if not ifnil(_obj.XmlAttrPos.Value) then - {self.}XmlAttrPos.Value := _obj.XmlAttrPos.Value; - {self.}SchemeClr.Copy(_obj.SchemeClr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Pos) then + {self.}Pos := _obj.Pos; + if not ifnil(_obj.XmlChildSchemeClr) then + {self.}SchemeClr.Copy(_obj.XmlChildSchemeClr); + tslassigning := tslassigning_backup; end; function Gs.ReadXmlAttrPos(); @@ -113,5 +74,20 @@ end; function Gs.WriteXmlAttrPos(_value); begin + if ifnil({self.}XmlAttrPos) then + begin + {self.}XmlAttrPos := new OpenXmlAttribute("", "pos", nil); + attributes_[length(attributes_)] := {self.}XmlAttrPos; + end {self.}XmlAttrPos.Value := _value; end; + +function Gs.ReadXmlChildSchemeClr(); +begin + if tslassigning and ifnil({self.}XmlChildSchemeClr) then + begin + {self.}XmlChildSchemeClr := new SchemeClr(self, {self.}Prefix, "schemeClr"); + container_.Set({self.}XmlChildSchemeClr); + end + return {self.}XmlChildSchemeClr; +end; diff --git a/autoclass/docx/GsLst@DOCX.tsf b/autoclass/docx/GsLst@DOCX.tsf index 328f23a..61c5520 100644 --- a/autoclass/docx/GsLst@DOCX.tsf +++ b/autoclass/docx/GsLst@DOCX.tsf @@ -4,19 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: GsLst);override; + +public + + // multi property + property Gses read ReadGses; + function ReadGses(_index); function AddGs(): Gs; function AppendGs(): Gs; - property Gses read ReadGses; - function ReadGses(_index); - public - // Attributes - // Children end; @@ -33,105 +31,47 @@ end; function GsLst.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function GsLst.Init();override; begin - -end; - -function GsLst.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function GsLst.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, + pre + "gs": array(0, makeweakref(thisFunction(AppendGs))), ); -end; - -function GsLst.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "gs": obj := {self.}AppendGs(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function GsLst.Copy(_obj: GsLst);override; begin + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + tslassigning := tslassigning_backup; +end; +function GsLst.ReadGses(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "gs", ind); end; function GsLst.AddGs(): Gs; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "gs" then break; - end obj := new Gs(self, {self.}Prefix, "gs"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function GsLst.AppendGs(): Gs; begin obj := new Gs(self, {self.}Prefix, "gs"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function GsLst.ReadGses(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "gs" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; diff --git a/autoclass/docx/Hdr@DOCX.tsf b/autoclass/docx/Hdr@DOCX.tsf index 95b2b2d..14bf972 100644 --- a/autoclass/docx/Hdr@DOCX.tsf +++ b/autoclass/docx/Hdr@DOCX.tsf @@ -4,16 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Hdr);override; - function AddP(): P; - function AppendP(): P; - property Ps read ReadPs; - function ReadPs(_index); +public + // attributes property property XmlnsM read ReadXmlAttrXmlnsM write WriteXmlAttrXmlnsM; property XmlnsMc read ReadXmlAttrXmlnsMc write WriteXmlAttrXmlnsMc; property XmlnsMo read ReadXmlAttrXmlnsMo write WriteXmlAttrXmlnsMo; @@ -60,8 +55,14 @@ public function ReadXmlAttrMcIgnorable(); function WriteXmlAttrMcIgnorable(_value); + // multi property + property Ps read ReadPs; + function ReadPs(_index); + function AddP(): P; + function AppendP(): P; + public - // Attributes + // Attributes XmlAttrXmlnsM: OpenXmlAttribute; XmlAttrXmlnsMc: OpenXmlAttribute; XmlAttrXmlnsMo: OpenXmlAttribute; @@ -94,165 +95,73 @@ end; function Hdr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Hdr.Init();override; begin - {self.}XmlAttrXmlnsM := new OpenXmlAttribute("xmlns", "m", nil); - {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); - {self.}XmlAttrXmlnsMo := new OpenXmlAttribute("xmlns", "mo", nil); - {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); - {self.}XmlAttrXmlnsV := new OpenXmlAttribute("xmlns", "v", nil); - {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); - {self.}XmlAttrXmlnsW := new OpenXmlAttribute("xmlns", "w", nil); - {self.}XmlAttrXmlnsWne := new OpenXmlAttribute("xmlns", "wne", nil); - {self.}XmlAttrXmlnsWp14 := new OpenXmlAttribute("xmlns", "wp14", nil); - {self.}XmlAttrXmlnsWp := new OpenXmlAttribute("xmlns", "wp", nil); - {self.}XmlAttrXmlnsWpc := new OpenXmlAttribute("xmlns", "wpc", nil); - {self.}XmlAttrXmlnsWpg := new OpenXmlAttribute("xmlns", "wpg", nil); - {self.}XmlAttrXmlnsWpi := new OpenXmlAttribute("xmlns", "wpi", nil); - {self.}XmlAttrXmlnsWps := new OpenXmlAttribute("xmlns", "wps", nil); - {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); -end; - -function Hdr.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXmlnsM, - {self.}XmlAttrXmlnsMc, - {self.}XmlAttrXmlnsMo, - {self.}XmlAttrXmlnsR, - {self.}XmlAttrXmlnsV, - {self.}XmlAttrXmlnsW14, - {self.}XmlAttrXmlnsW, - {self.}XmlAttrXmlnsWne, - {self.}XmlAttrXmlnsWp14, - {self.}XmlAttrXmlnsWp, - {self.}XmlAttrXmlnsWpc, - {self.}XmlAttrXmlnsWpg, - {self.}XmlAttrXmlnsWpi, - {self.}XmlAttrXmlnsWps, - {self.}XmlAttrMcIgnorable, - ); -end; - -function Hdr.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns:m": makeweakref(thisFunction(WriteXmlAttrXmlnsM)), + "xmlns:mc": makeweakref(thisFunction(WriteXmlAttrXmlnsMc)), + "xmlns:mo": makeweakref(thisFunction(WriteXmlAttrXmlnsMo)), + "xmlns:r": makeweakref(thisFunction(WriteXmlAttrXmlnsR)), + "xmlns:v": makeweakref(thisFunction(WriteXmlAttrXmlnsV)), + "xmlns:w14": makeweakref(thisFunction(WriteXmlAttrXmlnsW14)), + "xmlns:w": makeweakref(thisFunction(WriteXmlAttrXmlnsW)), + "xmlns:wne": makeweakref(thisFunction(WriteXmlAttrXmlnsWne)), + "xmlns:wp14": makeweakref(thisFunction(WriteXmlAttrXmlnsWp14)), + "xmlns:wp": makeweakref(thisFunction(WriteXmlAttrXmlnsWp)), + "xmlns:wpc": makeweakref(thisFunction(WriteXmlAttrXmlnsWpc)), + "xmlns:wpg": makeweakref(thisFunction(WriteXmlAttrXmlnsWpg)), + "xmlns:wpi": makeweakref(thisFunction(WriteXmlAttrXmlnsWpi)), + "xmlns:wps": makeweakref(thisFunction(WriteXmlAttrXmlnsWps)), + "mc:Ignorable": makeweakref(thisFunction(WriteXmlAttrMcIgnorable)), ); sorted_child_ := array( - "": -1, + pre + "p": array(0, makeweakref(thisFunction(AppendP))), ); -end; - -function Hdr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "p": obj := {self.}AppendP(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Hdr.Copy(_obj: Hdr);override; begin - if not ifnil(_obj.XmlAttrXmlnsM.Value) then - {self.}XmlAttrXmlnsM.Value := _obj.XmlAttrXmlnsM.Value; - if not ifnil(_obj.XmlAttrXmlnsMc.Value) then - {self.}XmlAttrXmlnsMc.Value := _obj.XmlAttrXmlnsMc.Value; - if not ifnil(_obj.XmlAttrXmlnsMo.Value) then - {self.}XmlAttrXmlnsMo.Value := _obj.XmlAttrXmlnsMo.Value; - if not ifnil(_obj.XmlAttrXmlnsR.Value) then - {self.}XmlAttrXmlnsR.Value := _obj.XmlAttrXmlnsR.Value; - if not ifnil(_obj.XmlAttrXmlnsV.Value) then - {self.}XmlAttrXmlnsV.Value := _obj.XmlAttrXmlnsV.Value; - if not ifnil(_obj.XmlAttrXmlnsW14.Value) then - {self.}XmlAttrXmlnsW14.Value := _obj.XmlAttrXmlnsW14.Value; - if not ifnil(_obj.XmlAttrXmlnsW.Value) then - {self.}XmlAttrXmlnsW.Value := _obj.XmlAttrXmlnsW.Value; - if not ifnil(_obj.XmlAttrXmlnsWne.Value) then - {self.}XmlAttrXmlnsWne.Value := _obj.XmlAttrXmlnsWne.Value; - if not ifnil(_obj.XmlAttrXmlnsWp14.Value) then - {self.}XmlAttrXmlnsWp14.Value := _obj.XmlAttrXmlnsWp14.Value; - if not ifnil(_obj.XmlAttrXmlnsWp.Value) then - {self.}XmlAttrXmlnsWp.Value := _obj.XmlAttrXmlnsWp.Value; - if not ifnil(_obj.XmlAttrXmlnsWpc.Value) then - {self.}XmlAttrXmlnsWpc.Value := _obj.XmlAttrXmlnsWpc.Value; - if not ifnil(_obj.XmlAttrXmlnsWpg.Value) then - {self.}XmlAttrXmlnsWpg.Value := _obj.XmlAttrXmlnsWpg.Value; - if not ifnil(_obj.XmlAttrXmlnsWpi.Value) then - {self.}XmlAttrXmlnsWpi.Value := _obj.XmlAttrXmlnsWpi.Value; - if not ifnil(_obj.XmlAttrXmlnsWps.Value) then - {self.}XmlAttrXmlnsWps.Value := _obj.XmlAttrXmlnsWps.Value; - if not ifnil(_obj.XmlAttrMcIgnorable.Value) then - {self.}XmlAttrMcIgnorable.Value := _obj.XmlAttrMcIgnorable.Value; -end; - -function Hdr.AddP(): P; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "p" then break; - end - obj := new P(self, {self.}Prefix, "p"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function Hdr.AppendP(): P; -begin - obj := new P(self, {self.}Prefix, "p"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function Hdr.ReadPs(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "p" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlnsM) then + {self.}XmlnsM := _obj.XmlnsM; + if not ifnil(_obj.XmlnsMc) then + {self.}XmlnsMc := _obj.XmlnsMc; + if not ifnil(_obj.XmlnsMo) then + {self.}XmlnsMo := _obj.XmlnsMo; + if not ifnil(_obj.XmlnsR) then + {self.}XmlnsR := _obj.XmlnsR; + if not ifnil(_obj.XmlnsV) then + {self.}XmlnsV := _obj.XmlnsV; + if not ifnil(_obj.XmlnsW14) then + {self.}XmlnsW14 := _obj.XmlnsW14; + if not ifnil(_obj.XmlnsW) then + {self.}XmlnsW := _obj.XmlnsW; + if not ifnil(_obj.XmlnsWne) then + {self.}XmlnsWne := _obj.XmlnsWne; + if not ifnil(_obj.XmlnsWp14) then + {self.}XmlnsWp14 := _obj.XmlnsWp14; + if not ifnil(_obj.XmlnsWp) then + {self.}XmlnsWp := _obj.XmlnsWp; + if not ifnil(_obj.XmlnsWpc) then + {self.}XmlnsWpc := _obj.XmlnsWpc; + if not ifnil(_obj.XmlnsWpg) then + {self.}XmlnsWpg := _obj.XmlnsWpg; + if not ifnil(_obj.XmlnsWpi) then + {self.}XmlnsWpi := _obj.XmlnsWpi; + if not ifnil(_obj.XmlnsWps) then + {self.}XmlnsWps := _obj.XmlnsWps; + if not ifnil(_obj.McIgnorable) then + {self.}McIgnorable := _obj.McIgnorable; + tslassigning := tslassigning_backup; end; function Hdr.ReadXmlAttrXmlnsM(); @@ -262,6 +171,11 @@ end; function Hdr.WriteXmlAttrXmlnsM(_value); begin + if ifnil({self.}XmlAttrXmlnsM) then + begin + {self.}XmlAttrXmlnsM := new OpenXmlAttribute("xmlns", "m", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsM; + end {self.}XmlAttrXmlnsM.Value := _value; end; @@ -272,6 +186,11 @@ end; function Hdr.WriteXmlAttrXmlnsMc(_value); begin + if ifnil({self.}XmlAttrXmlnsMc) then + begin + {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsMc; + end {self.}XmlAttrXmlnsMc.Value := _value; end; @@ -282,6 +201,11 @@ end; function Hdr.WriteXmlAttrXmlnsMo(_value); begin + if ifnil({self.}XmlAttrXmlnsMo) then + begin + {self.}XmlAttrXmlnsMo := new OpenXmlAttribute("xmlns", "mo", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsMo; + end {self.}XmlAttrXmlnsMo.Value := _value; end; @@ -292,6 +216,11 @@ end; function Hdr.WriteXmlAttrXmlnsR(_value); begin + if ifnil({self.}XmlAttrXmlnsR) then + begin + {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsR; + end {self.}XmlAttrXmlnsR.Value := _value; end; @@ -302,6 +231,11 @@ end; function Hdr.WriteXmlAttrXmlnsV(_value); begin + if ifnil({self.}XmlAttrXmlnsV) then + begin + {self.}XmlAttrXmlnsV := new OpenXmlAttribute("xmlns", "v", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsV; + end {self.}XmlAttrXmlnsV.Value := _value; end; @@ -312,6 +246,11 @@ end; function Hdr.WriteXmlAttrXmlnsW14(_value); begin + if ifnil({self.}XmlAttrXmlnsW14) then + begin + {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW14; + end {self.}XmlAttrXmlnsW14.Value := _value; end; @@ -322,6 +261,11 @@ end; function Hdr.WriteXmlAttrXmlnsW(_value); begin + if ifnil({self.}XmlAttrXmlnsW) then + begin + {self.}XmlAttrXmlnsW := new OpenXmlAttribute("xmlns", "w", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW; + end {self.}XmlAttrXmlnsW.Value := _value; end; @@ -332,6 +276,11 @@ end; function Hdr.WriteXmlAttrXmlnsWne(_value); begin + if ifnil({self.}XmlAttrXmlnsWne) then + begin + {self.}XmlAttrXmlnsWne := new OpenXmlAttribute("xmlns", "wne", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWne; + end {self.}XmlAttrXmlnsWne.Value := _value; end; @@ -342,6 +291,11 @@ end; function Hdr.WriteXmlAttrXmlnsWp14(_value); begin + if ifnil({self.}XmlAttrXmlnsWp14) then + begin + {self.}XmlAttrXmlnsWp14 := new OpenXmlAttribute("xmlns", "wp14", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWp14; + end {self.}XmlAttrXmlnsWp14.Value := _value; end; @@ -352,6 +306,11 @@ end; function Hdr.WriteXmlAttrXmlnsWp(_value); begin + if ifnil({self.}XmlAttrXmlnsWp) then + begin + {self.}XmlAttrXmlnsWp := new OpenXmlAttribute("xmlns", "wp", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWp; + end {self.}XmlAttrXmlnsWp.Value := _value; end; @@ -362,6 +321,11 @@ end; function Hdr.WriteXmlAttrXmlnsWpc(_value); begin + if ifnil({self.}XmlAttrXmlnsWpc) then + begin + {self.}XmlAttrXmlnsWpc := new OpenXmlAttribute("xmlns", "wpc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpc; + end {self.}XmlAttrXmlnsWpc.Value := _value; end; @@ -372,6 +336,11 @@ end; function Hdr.WriteXmlAttrXmlnsWpg(_value); begin + if ifnil({self.}XmlAttrXmlnsWpg) then + begin + {self.}XmlAttrXmlnsWpg := new OpenXmlAttribute("xmlns", "wpg", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpg; + end {self.}XmlAttrXmlnsWpg.Value := _value; end; @@ -382,6 +351,11 @@ end; function Hdr.WriteXmlAttrXmlnsWpi(_value); begin + if ifnil({self.}XmlAttrXmlnsWpi) then + begin + {self.}XmlAttrXmlnsWpi := new OpenXmlAttribute("xmlns", "wpi", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpi; + end {self.}XmlAttrXmlnsWpi.Value := _value; end; @@ -392,6 +366,11 @@ end; function Hdr.WriteXmlAttrXmlnsWps(_value); begin + if ifnil({self.}XmlAttrXmlnsWps) then + begin + {self.}XmlAttrXmlnsWps := new OpenXmlAttribute("xmlns", "wps", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWps; + end {self.}XmlAttrXmlnsWps.Value := _value; end; @@ -402,5 +381,31 @@ end; function Hdr.WriteXmlAttrMcIgnorable(_value); begin + if ifnil({self.}XmlAttrMcIgnorable) then + begin + {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); + attributes_[length(attributes_)] := {self.}XmlAttrMcIgnorable; + end {self.}XmlAttrMcIgnorable.Value := _value; end; + +function Hdr.ReadPs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "p", ind); +end; + +function Hdr.AddP(): P; +begin + obj := new P(self, {self.}Prefix, "p"); + container_.Insert(obj); + return obj; +end; + +function Hdr.AppendP(): P; +begin + obj := new P(self, {self.}Prefix, "p"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/HdrShapeDefaults@DOCX.tsf b/autoclass/docx/HdrShapeDefaults@DOCX.tsf index 57365e7..7083308 100644 --- a/autoclass/docx/HdrShapeDefaults@DOCX.tsf +++ b/autoclass/docx/HdrShapeDefaults@DOCX.tsf @@ -4,16 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: HdrShapeDefaults);override; public - // Attributes + // normal property + property ShapeDefaults read ReadXmlChildShapeDefaults; + function ReadXmlChildShapeDefaults(); + +public // Children - ShapeDefaults: ShapeDefaults; + XmlChildShapeDefaults: ShapeDefaults; end; @@ -29,70 +30,38 @@ end; function HdrShapeDefaults.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function HdrShapeDefaults.Init();override; begin - {self.}ShapeDefaults := new ShapeDefaults(self, "o", "shapeDefaults"); -end; - -function HdrShapeDefaults.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function HdrShapeDefaults.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}ShapeDefaults, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}ShapeDefaults.ElementName: 0, + "o:shapeDefaults": array(0, makeweakref(thisFunction(ReadXmlChildShapeDefaults))), ); -end; - -function HdrShapeDefaults.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function HdrShapeDefaults.Copy(_obj: HdrShapeDefaults);override; begin - {self.}ShapeDefaults.Copy(_obj.ShapeDefaults); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildShapeDefaults) then + {self.}ShapeDefaults.Copy(_obj.XmlChildShapeDefaults); + tslassigning := tslassigning_backup; +end; + +function HdrShapeDefaults.ReadXmlChildShapeDefaults(); +begin + if tslassigning and ifnil({self.}XmlChildShapeDefaults) then + begin + {self.}XmlChildShapeDefaults := new ShapeDefaults(self, "o", "shapeDefaults"); + container_.Set({self.}XmlChildShapeDefaults); + end + return {self.}XmlChildShapeDefaults; end; diff --git a/autoclass/docx/HyperLink@DOCX.tsf b/autoclass/docx/HyperLink@DOCX.tsf index 7b0a9c4..bbc2023 100644 --- a/autoclass/docx/HyperLink@DOCX.tsf +++ b/autoclass/docx/HyperLink@DOCX.tsf @@ -4,16 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: HyperLink);override; - function AddR(): R; - function AppendR(): R; - property Rs read ReadRs; - function ReadRs(_index); +public + // attributes property property Anchor read ReadXmlAttrAnchor write WriteXmlAttrAnchor; property Id read ReadXmlAttrId write WriteXmlAttrId; property History read ReadXmlAttrHistory write WriteXmlAttrHistory; @@ -24,8 +19,14 @@ public function ReadXmlAttrHistory(); function WriteXmlAttrHistory(_value); + // multi property + property Rs read ReadRs; + function ReadRs(_index); + function AddR(): R; + function AppendR(): R; + public - // Attributes + // Attributes XmlAttrAnchor: OpenXmlAttribute; XmlAttrId: OpenXmlAttribute; XmlAttrHistory: OpenXmlAttribute; @@ -46,117 +47,37 @@ end; function HyperLink.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function HyperLink.Init();override; begin - {self.}XmlAttrAnchor := new OpenXmlAttribute({self.}Prefix, "anchor", nil); - {self.}XmlAttrId := new OpenXmlAttribute("r", "id", nil); - {self.}XmlAttrHistory := new OpenXmlAttribute({self.}Prefix, "history", nil); -end; - -function HyperLink.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrAnchor, - {self.}XmlAttrId, - {self.}XmlAttrHistory, - ); -end; - -function HyperLink.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "anchor": makeweakref(thisFunction(WriteXmlAttrAnchor)), + "r:id": makeweakref(thisFunction(WriteXmlAttrId)), + pre + "history": makeweakref(thisFunction(WriteXmlAttrHistory)), ); sorted_child_ := array( - "": -1, + pre + "r": array(0, makeweakref(thisFunction(AppendR))), ); -end; - -function HyperLink.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "r": obj := {self.}AppendR(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function HyperLink.Copy(_obj: HyperLink);override; begin - if not ifnil(_obj.XmlAttrAnchor.Value) then - {self.}XmlAttrAnchor.Value := _obj.XmlAttrAnchor.Value; - if not ifnil(_obj.XmlAttrId.Value) then - {self.}XmlAttrId.Value := _obj.XmlAttrId.Value; - if not ifnil(_obj.XmlAttrHistory.Value) then - {self.}XmlAttrHistory.Value := _obj.XmlAttrHistory.Value; -end; - -function HyperLink.AddR(): R; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "r" then break; - end - obj := new R(self, {self.}Prefix, "r"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function HyperLink.AppendR(): R; -begin - obj := new R(self, {self.}Prefix, "r"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function HyperLink.ReadRs(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "r" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Anchor) then + {self.}Anchor := _obj.Anchor; + if not ifnil(_obj.Id) then + {self.}Id := _obj.Id; + if not ifnil(_obj.History) then + {self.}History := _obj.History; + tslassigning := tslassigning_backup; end; function HyperLink.ReadXmlAttrAnchor(); @@ -166,6 +87,11 @@ end; function HyperLink.WriteXmlAttrAnchor(_value); begin + if ifnil({self.}XmlAttrAnchor) then + begin + {self.}XmlAttrAnchor := new OpenXmlAttribute({self.}Prefix, "anchor", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAnchor; + end {self.}XmlAttrAnchor.Value := _value; end; @@ -176,6 +102,11 @@ end; function HyperLink.WriteXmlAttrId(_value); begin + if ifnil({self.}XmlAttrId) then + begin + {self.}XmlAttrId := new OpenXmlAttribute("r", "id", nil); + attributes_[length(attributes_)] := {self.}XmlAttrId; + end {self.}XmlAttrId.Value := _value; end; @@ -186,5 +117,31 @@ end; function HyperLink.WriteXmlAttrHistory(_value); begin + if ifnil({self.}XmlAttrHistory) then + begin + {self.}XmlAttrHistory := new OpenXmlAttribute({self.}Prefix, "history", nil); + attributes_[length(attributes_)] := {self.}XmlAttrHistory; + end {self.}XmlAttrHistory.Value := _value; end; + +function HyperLink.ReadRs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "r", ind); +end; + +function HyperLink.AddR(): R; +begin + obj := new R(self, {self.}Prefix, "r"); + container_.Insert(obj); + return obj; +end; + +function HyperLink.AppendR(): R; +begin + obj := new R(self, {self.}Prefix, "r"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/IdMap@DOCX.tsf b/autoclass/docx/IdMap@DOCX.tsf index d20641c..c5a9af7 100644 --- a/autoclass/docx/IdMap@DOCX.tsf +++ b/autoclass/docx/IdMap@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: IdMap);override; +public + + // attributes property property Ext read ReadXmlAttrExt write WriteXmlAttrExt; property Data read ReadXmlAttrData write WriteXmlAttrData; function ReadXmlAttrExt(); @@ -17,11 +17,10 @@ public function WriteXmlAttrData(_value); public - // Attributes + // Attributes XmlAttrExt: OpenXmlAttribute; XmlAttrData: OpenXmlAttribute; - // Children end; @@ -37,45 +36,33 @@ end; function IdMap.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function IdMap.Init();override; begin - {self.}XmlAttrExt := new OpenXmlAttribute("v", "ext", nil); - {self.}XmlAttrData := new OpenXmlAttribute(nil, "data", nil); -end; - -function IdMap.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrExt, - {self.}XmlAttrData, - ); -end; - -function IdMap.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "v:ext": makeweakref(thisFunction(WriteXmlAttrExt)), + "data": makeweakref(thisFunction(WriteXmlAttrData)), ); sorted_child_ := array( - "": -1, ); -end; - -function IdMap.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function IdMap.Copy(_obj: IdMap);override; begin - if not ifnil(_obj.XmlAttrExt.Value) then - {self.}XmlAttrExt.Value := _obj.XmlAttrExt.Value; - if not ifnil(_obj.XmlAttrData.Value) then - {self.}XmlAttrData.Value := _obj.XmlAttrData.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Ext) then + {self.}Ext := _obj.Ext; + if not ifnil(_obj.Data) then + {self.}Data := _obj.Data; + tslassigning := tslassigning_backup; end; function IdMap.ReadXmlAttrExt(); @@ -85,6 +72,11 @@ end; function IdMap.WriteXmlAttrExt(_value); begin + if ifnil({self.}XmlAttrExt) then + begin + {self.}XmlAttrExt := new OpenXmlAttribute("v", "ext", nil); + attributes_[length(attributes_)] := {self.}XmlAttrExt; + end {self.}XmlAttrExt.Value := _value; end; @@ -95,5 +87,10 @@ end; function IdMap.WriteXmlAttrData(_value); begin + if ifnil({self.}XmlAttrData) then + begin + {self.}XmlAttrData := new OpenXmlAttribute("", "data", nil); + attributes_[length(attributes_)] := {self.}XmlAttrData; + end {self.}XmlAttrData.Value := _value; end; diff --git a/autoclass/docx/Ind@DOCX.tsf b/autoclass/docx/Ind@DOCX.tsf index 5ac7353..bd7694d 100644 --- a/autoclass/docx/Ind@DOCX.tsf +++ b/autoclass/docx/Ind@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Ind);override; +public + + // attributes property property FirstLineChars read ReadXmlAttrFirstLineChars write WriteXmlAttrFirstLineChars; property FirstLine read ReadXmlAttrFirstLine write WriteXmlAttrFirstLine; property RightChars read ReadXmlAttrRightChars write WriteXmlAttrRightChars; @@ -35,7 +35,7 @@ public function WriteXmlAttrHangingChars(_value); public - // Attributes + // Attributes XmlAttrFirstLineChars: OpenXmlAttribute; XmlAttrFirstLine: OpenXmlAttribute; XmlAttrRightChars: OpenXmlAttribute; @@ -45,7 +45,6 @@ public XmlAttrHanging: OpenXmlAttribute; XmlAttrHangingChars: OpenXmlAttribute; - // Children end; @@ -61,69 +60,51 @@ end; function Ind.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Ind.Init();override; begin - {self.}XmlAttrFirstLineChars := new OpenXmlAttribute({self.}Prefix, "firstLineChars", nil); - {self.}XmlAttrFirstLine := new OpenXmlAttribute({self.}Prefix, "firstLine", nil); - {self.}XmlAttrRightChars := new OpenXmlAttribute({self.}Prefix, "rightChars", nil); - {self.}XmlAttrRight := new OpenXmlAttribute({self.}Prefix, "right", nil); - {self.}XmlAttrLeftChars := new OpenXmlAttribute({self.}Prefix, "leftChars", nil); - {self.}XmlAttrLeft := new OpenXmlAttribute({self.}Prefix, "left", nil); - {self.}XmlAttrHanging := new OpenXmlAttribute({self.}Prefix, "hainging", nil); - {self.}XmlAttrHangingChars := new OpenXmlAttribute({self.}Prefix, "hangingChars", nil); -end; - -function Ind.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrFirstLineChars, - {self.}XmlAttrFirstLine, - {self.}XmlAttrRightChars, - {self.}XmlAttrRight, - {self.}XmlAttrLeftChars, - {self.}XmlAttrLeft, - {self.}XmlAttrHanging, - {self.}XmlAttrHangingChars, - ); -end; - -function Ind.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "firstLineChars": makeweakref(thisFunction(WriteXmlAttrFirstLineChars)), + pre + "firstLine": makeweakref(thisFunction(WriteXmlAttrFirstLine)), + pre + "rightChars": makeweakref(thisFunction(WriteXmlAttrRightChars)), + pre + "right": makeweakref(thisFunction(WriteXmlAttrRight)), + pre + "leftChars": makeweakref(thisFunction(WriteXmlAttrLeftChars)), + pre + "left": makeweakref(thisFunction(WriteXmlAttrLeft)), + pre + "hainging": makeweakref(thisFunction(WriteXmlAttrHanging)), + pre + "hangingChars": makeweakref(thisFunction(WriteXmlAttrHangingChars)), ); sorted_child_ := array( - "": -1, ); -end; - -function Ind.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Ind.Copy(_obj: Ind);override; begin - if not ifnil(_obj.XmlAttrFirstLineChars.Value) then - {self.}XmlAttrFirstLineChars.Value := _obj.XmlAttrFirstLineChars.Value; - if not ifnil(_obj.XmlAttrFirstLine.Value) then - {self.}XmlAttrFirstLine.Value := _obj.XmlAttrFirstLine.Value; - if not ifnil(_obj.XmlAttrRightChars.Value) then - {self.}XmlAttrRightChars.Value := _obj.XmlAttrRightChars.Value; - if not ifnil(_obj.XmlAttrRight.Value) then - {self.}XmlAttrRight.Value := _obj.XmlAttrRight.Value; - if not ifnil(_obj.XmlAttrLeftChars.Value) then - {self.}XmlAttrLeftChars.Value := _obj.XmlAttrLeftChars.Value; - if not ifnil(_obj.XmlAttrLeft.Value) then - {self.}XmlAttrLeft.Value := _obj.XmlAttrLeft.Value; - if not ifnil(_obj.XmlAttrHanging.Value) then - {self.}XmlAttrHanging.Value := _obj.XmlAttrHanging.Value; - if not ifnil(_obj.XmlAttrHangingChars.Value) then - {self.}XmlAttrHangingChars.Value := _obj.XmlAttrHangingChars.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.FirstLineChars) then + {self.}FirstLineChars := _obj.FirstLineChars; + if not ifnil(_obj.FirstLine) then + {self.}FirstLine := _obj.FirstLine; + if not ifnil(_obj.RightChars) then + {self.}RightChars := _obj.RightChars; + if not ifnil(_obj.Right) then + {self.}Right := _obj.Right; + if not ifnil(_obj.LeftChars) then + {self.}LeftChars := _obj.LeftChars; + if not ifnil(_obj.Left) then + {self.}Left := _obj.Left; + if not ifnil(_obj.Hanging) then + {self.}Hanging := _obj.Hanging; + if not ifnil(_obj.HangingChars) then + {self.}HangingChars := _obj.HangingChars; + tslassigning := tslassigning_backup; end; function Ind.ReadXmlAttrFirstLineChars(); @@ -133,6 +114,11 @@ end; function Ind.WriteXmlAttrFirstLineChars(_value); begin + if ifnil({self.}XmlAttrFirstLineChars) then + begin + {self.}XmlAttrFirstLineChars := new OpenXmlAttribute({self.}Prefix, "firstLineChars", nil); + attributes_[length(attributes_)] := {self.}XmlAttrFirstLineChars; + end {self.}XmlAttrFirstLineChars.Value := _value; end; @@ -143,6 +129,11 @@ end; function Ind.WriteXmlAttrFirstLine(_value); begin + if ifnil({self.}XmlAttrFirstLine) then + begin + {self.}XmlAttrFirstLine := new OpenXmlAttribute({self.}Prefix, "firstLine", nil); + attributes_[length(attributes_)] := {self.}XmlAttrFirstLine; + end {self.}XmlAttrFirstLine.Value := _value; end; @@ -153,6 +144,11 @@ end; function Ind.WriteXmlAttrRightChars(_value); begin + if ifnil({self.}XmlAttrRightChars) then + begin + {self.}XmlAttrRightChars := new OpenXmlAttribute({self.}Prefix, "rightChars", nil); + attributes_[length(attributes_)] := {self.}XmlAttrRightChars; + end {self.}XmlAttrRightChars.Value := _value; end; @@ -163,6 +159,11 @@ end; function Ind.WriteXmlAttrRight(_value); begin + if ifnil({self.}XmlAttrRight) then + begin + {self.}XmlAttrRight := new OpenXmlAttribute({self.}Prefix, "right", nil); + attributes_[length(attributes_)] := {self.}XmlAttrRight; + end {self.}XmlAttrRight.Value := _value; end; @@ -173,6 +174,11 @@ end; function Ind.WriteXmlAttrLeftChars(_value); begin + if ifnil({self.}XmlAttrLeftChars) then + begin + {self.}XmlAttrLeftChars := new OpenXmlAttribute({self.}Prefix, "leftChars", nil); + attributes_[length(attributes_)] := {self.}XmlAttrLeftChars; + end {self.}XmlAttrLeftChars.Value := _value; end; @@ -183,6 +189,11 @@ end; function Ind.WriteXmlAttrLeft(_value); begin + if ifnil({self.}XmlAttrLeft) then + begin + {self.}XmlAttrLeft := new OpenXmlAttribute({self.}Prefix, "left", nil); + attributes_[length(attributes_)] := {self.}XmlAttrLeft; + end {self.}XmlAttrLeft.Value := _value; end; @@ -193,6 +204,11 @@ end; function Ind.WriteXmlAttrHanging(_value); begin + if ifnil({self.}XmlAttrHanging) then + begin + {self.}XmlAttrHanging := new OpenXmlAttribute({self.}Prefix, "hainging", nil); + attributes_[length(attributes_)] := {self.}XmlAttrHanging; + end {self.}XmlAttrHanging.Value := _value; end; @@ -203,5 +219,10 @@ end; function Ind.WriteXmlAttrHangingChars(_value); begin + if ifnil({self.}XmlAttrHangingChars) then + begin + {self.}XmlAttrHangingChars := new OpenXmlAttribute({self.}Prefix, "hangingChars", nil); + attributes_[length(attributes_)] := {self.}XmlAttrHangingChars; + end {self.}XmlAttrHangingChars.Value := _value; end; diff --git a/autoclass/docx/InstrText@DOCX.tsf b/autoclass/docx/InstrText@DOCX.tsf index ce041d7..16d7d1d 100644 --- a/autoclass/docx/InstrText@DOCX.tsf +++ b/autoclass/docx/InstrText@DOCX.tsf @@ -4,19 +4,19 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: InstrText);override; +public + + // attributes property property Space read ReadXmlAttrSpace write WriteXmlAttrSpace; function ReadXmlAttrSpace(); function WriteXmlAttrSpace(_value); public - // Attributes + // Attributes XmlAttrSpace: OpenXmlAttribute; - // Children end; @@ -32,32 +32,27 @@ end; function InstrText.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlPcdata).Create(_parent, _prefix, _local_name); end; function InstrText.Init();override; begin - {self.}XmlAttrSpace := new OpenXmlAttribute("xml", "Space", nil); -end; - -function InstrText.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrSpace, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xml:Space": makeweakref(thisFunction(WriteXmlAttrSpace)), ); end; -function InstrText.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; -end; - function InstrText.Copy(_obj: InstrText);override; begin - if not ifnil(_obj.XmlAttrSpace.Value) then - {self.}XmlAttrSpace.Value := _obj.XmlAttrSpace.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlPcdata).Copy(_obj); + if not ifnil(_obj.Space) then + {self.}Space := _obj.Space; + tslassigning := tslassigning_backup; end; function InstrText.ReadXmlAttrSpace(); @@ -67,5 +62,10 @@ end; function InstrText.WriteXmlAttrSpace(_value); begin + if ifnil({self.}XmlAttrSpace) then + begin + {self.}XmlAttrSpace := new OpenXmlAttribute("xml", "Space", nil); + attributes_[length(attributes_)] := {self.}XmlAttrSpace; + end {self.}XmlAttrSpace.Value := _value; end; diff --git a/autoclass/docx/Lang@DOCX.tsf b/autoclass/docx/Lang@DOCX.tsf index 32b5d4c..7a6dd5a 100644 --- a/autoclass/docx/Lang@DOCX.tsf +++ b/autoclass/docx/Lang@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Lang);override; +public + + // attributes property property Val read ReadXmlAttrVal write WriteXmlAttrVal; property EastAsia read ReadXmlAttrEastAsia write WriteXmlAttrEastAsia; property Bidi read ReadXmlAttrBidi write WriteXmlAttrBidi; @@ -20,12 +20,11 @@ public function WriteXmlAttrBidi(_value); public - // Attributes + // Attributes XmlAttrVal: OpenXmlAttribute; XmlAttrEastAsia: OpenXmlAttribute; XmlAttrBidi: OpenXmlAttribute; - // Children end; @@ -41,49 +40,36 @@ end; function Lang.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Lang.Init();override; begin - {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); - {self.}XmlAttrEastAsia := new OpenXmlAttribute({self.}Prefix, "eastAsia", nil); - {self.}XmlAttrBidi := new OpenXmlAttribute({self.}Prefix, "bidi", nil); -end; - -function Lang.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrVal, - {self.}XmlAttrEastAsia, - {self.}XmlAttrBidi, - ); -end; - -function Lang.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "val": makeweakref(thisFunction(WriteXmlAttrVal)), + pre + "eastAsia": makeweakref(thisFunction(WriteXmlAttrEastAsia)), + pre + "bidi": makeweakref(thisFunction(WriteXmlAttrBidi)), ); sorted_child_ := array( - "": -1, ); -end; - -function Lang.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Lang.Copy(_obj: Lang);override; begin - if not ifnil(_obj.XmlAttrVal.Value) then - {self.}XmlAttrVal.Value := _obj.XmlAttrVal.Value; - if not ifnil(_obj.XmlAttrEastAsia.Value) then - {self.}XmlAttrEastAsia.Value := _obj.XmlAttrEastAsia.Value; - if not ifnil(_obj.XmlAttrBidi.Value) then - {self.}XmlAttrBidi.Value := _obj.XmlAttrBidi.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Val) then + {self.}Val := _obj.Val; + if not ifnil(_obj.EastAsia) then + {self.}EastAsia := _obj.EastAsia; + if not ifnil(_obj.Bidi) then + {self.}Bidi := _obj.Bidi; + tslassigning := tslassigning_backup; end; function Lang.ReadXmlAttrVal(); @@ -93,6 +79,11 @@ end; function Lang.WriteXmlAttrVal(_value); begin + if ifnil({self.}XmlAttrVal) then + begin + {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVal; + end {self.}XmlAttrVal.Value := _value; end; @@ -103,6 +94,11 @@ end; function Lang.WriteXmlAttrEastAsia(_value); begin + if ifnil({self.}XmlAttrEastAsia) then + begin + {self.}XmlAttrEastAsia := new OpenXmlAttribute({self.}Prefix, "eastAsia", nil); + attributes_[length(attributes_)] := {self.}XmlAttrEastAsia; + end {self.}XmlAttrEastAsia.Value := _value; end; @@ -113,5 +109,10 @@ end; function Lang.WriteXmlAttrBidi(_value); begin + if ifnil({self.}XmlAttrBidi) then + begin + {self.}XmlAttrBidi := new OpenXmlAttribute({self.}Prefix, "bidi", nil); + attributes_[length(attributes_)] := {self.}XmlAttrBidi; + end {self.}XmlAttrBidi.Value := _value; end; diff --git a/autoclass/docx/LatenStyles@DOCX.tsf b/autoclass/docx/LatenStyles@DOCX.tsf index 85617ad..7476002 100644 --- a/autoclass/docx/LatenStyles@DOCX.tsf +++ b/autoclass/docx/LatenStyles@DOCX.tsf @@ -4,16 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: LatenStyles);override; - function AddLsdException(): LsdException; - function AppendLsdException(): LsdException; - property LsdExceptions read ReadLsdExceptions; - function ReadLsdExceptions(_index); +public + // attributes property property DefLickedState read ReadXmlAttrDefLickedState write WriteXmlAttrDefLickedState; property DefUIPriority read ReadXmlAttrDefUIPriority write WriteXmlAttrDefUIPriority; property DefSemiHidden read ReadXmlAttrDefSemiHidden write WriteXmlAttrDefSemiHidden; @@ -33,8 +28,14 @@ public function ReadXmlAttrCount(); function WriteXmlAttrCount(_value); + // multi property + property LsdExceptions read ReadLsdExceptions; + function ReadLsdExceptions(_index); + function AddLsdException(): LsdException; + function AppendLsdException(): LsdException; + public - // Attributes + // Attributes XmlAttrDefLickedState: OpenXmlAttribute; XmlAttrDefUIPriority: OpenXmlAttribute; XmlAttrDefSemiHidden: OpenXmlAttribute; @@ -58,129 +59,46 @@ end; function LatenStyles.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function LatenStyles.Init();override; begin - {self.}XmlAttrDefLickedState := new OpenXmlAttribute({self.}Prefix, "defLickedState", nil); - {self.}XmlAttrDefUIPriority := new OpenXmlAttribute({self.}Prefix, "defUIPriority", nil); - {self.}XmlAttrDefSemiHidden := new OpenXmlAttribute({self.}Prefix, "defSemiHidden", nil); - {self.}XmlAttrDefUnhideWhenUsed := new OpenXmlAttribute({self.}Prefix, "defUnhideWhenUsed", nil); - {self.}XmlAttrDefQFormat := new OpenXmlAttribute({self.}Prefix, "defQFormat", nil); - {self.}XmlAttrCount := new OpenXmlAttribute({self.}Prefix, "count", nil); -end; - -function LatenStyles.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrDefLickedState, - {self.}XmlAttrDefUIPriority, - {self.}XmlAttrDefSemiHidden, - {self.}XmlAttrDefUnhideWhenUsed, - {self.}XmlAttrDefQFormat, - {self.}XmlAttrCount, - ); -end; - -function LatenStyles.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "defLickedState": makeweakref(thisFunction(WriteXmlAttrDefLickedState)), + pre + "defUIPriority": makeweakref(thisFunction(WriteXmlAttrDefUIPriority)), + pre + "defSemiHidden": makeweakref(thisFunction(WriteXmlAttrDefSemiHidden)), + pre + "defUnhideWhenUsed": makeweakref(thisFunction(WriteXmlAttrDefUnhideWhenUsed)), + pre + "defQFormat": makeweakref(thisFunction(WriteXmlAttrDefQFormat)), + pre + "count": makeweakref(thisFunction(WriteXmlAttrCount)), ); sorted_child_ := array( - "": -1, + pre + "lsdException": array(0, makeweakref(thisFunction(AppendLsdException))), ); -end; - -function LatenStyles.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "lsdException": obj := {self.}AppendLsdException(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function LatenStyles.Copy(_obj: LatenStyles);override; begin - if not ifnil(_obj.XmlAttrDefLickedState.Value) then - {self.}XmlAttrDefLickedState.Value := _obj.XmlAttrDefLickedState.Value; - if not ifnil(_obj.XmlAttrDefUIPriority.Value) then - {self.}XmlAttrDefUIPriority.Value := _obj.XmlAttrDefUIPriority.Value; - if not ifnil(_obj.XmlAttrDefSemiHidden.Value) then - {self.}XmlAttrDefSemiHidden.Value := _obj.XmlAttrDefSemiHidden.Value; - if not ifnil(_obj.XmlAttrDefUnhideWhenUsed.Value) then - {self.}XmlAttrDefUnhideWhenUsed.Value := _obj.XmlAttrDefUnhideWhenUsed.Value; - if not ifnil(_obj.XmlAttrDefQFormat.Value) then - {self.}XmlAttrDefQFormat.Value := _obj.XmlAttrDefQFormat.Value; - if not ifnil(_obj.XmlAttrCount.Value) then - {self.}XmlAttrCount.Value := _obj.XmlAttrCount.Value; -end; - -function LatenStyles.AddLsdException(): LsdException; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "lsdException" then break; - end - obj := new LsdException(self, {self.}Prefix, "lsdException"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function LatenStyles.AppendLsdException(): LsdException; -begin - obj := new LsdException(self, {self.}Prefix, "lsdException"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function LatenStyles.ReadLsdExceptions(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "lsdException" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.DefLickedState) then + {self.}DefLickedState := _obj.DefLickedState; + if not ifnil(_obj.DefUIPriority) then + {self.}DefUIPriority := _obj.DefUIPriority; + if not ifnil(_obj.DefSemiHidden) then + {self.}DefSemiHidden := _obj.DefSemiHidden; + if not ifnil(_obj.DefUnhideWhenUsed) then + {self.}DefUnhideWhenUsed := _obj.DefUnhideWhenUsed; + if not ifnil(_obj.DefQFormat) then + {self.}DefQFormat := _obj.DefQFormat; + if not ifnil(_obj.Count) then + {self.}Count := _obj.Count; + tslassigning := tslassigning_backup; end; function LatenStyles.ReadXmlAttrDefLickedState(); @@ -190,6 +108,11 @@ end; function LatenStyles.WriteXmlAttrDefLickedState(_value); begin + if ifnil({self.}XmlAttrDefLickedState) then + begin + {self.}XmlAttrDefLickedState := new OpenXmlAttribute({self.}Prefix, "defLickedState", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDefLickedState; + end {self.}XmlAttrDefLickedState.Value := _value; end; @@ -200,6 +123,11 @@ end; function LatenStyles.WriteXmlAttrDefUIPriority(_value); begin + if ifnil({self.}XmlAttrDefUIPriority) then + begin + {self.}XmlAttrDefUIPriority := new OpenXmlAttribute({self.}Prefix, "defUIPriority", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDefUIPriority; + end {self.}XmlAttrDefUIPriority.Value := _value; end; @@ -210,6 +138,11 @@ end; function LatenStyles.WriteXmlAttrDefSemiHidden(_value); begin + if ifnil({self.}XmlAttrDefSemiHidden) then + begin + {self.}XmlAttrDefSemiHidden := new OpenXmlAttribute({self.}Prefix, "defSemiHidden", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDefSemiHidden; + end {self.}XmlAttrDefSemiHidden.Value := _value; end; @@ -220,6 +153,11 @@ end; function LatenStyles.WriteXmlAttrDefUnhideWhenUsed(_value); begin + if ifnil({self.}XmlAttrDefUnhideWhenUsed) then + begin + {self.}XmlAttrDefUnhideWhenUsed := new OpenXmlAttribute({self.}Prefix, "defUnhideWhenUsed", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDefUnhideWhenUsed; + end {self.}XmlAttrDefUnhideWhenUsed.Value := _value; end; @@ -230,6 +168,11 @@ end; function LatenStyles.WriteXmlAttrDefQFormat(_value); begin + if ifnil({self.}XmlAttrDefQFormat) then + begin + {self.}XmlAttrDefQFormat := new OpenXmlAttribute({self.}Prefix, "defQFormat", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDefQFormat; + end {self.}XmlAttrDefQFormat.Value := _value; end; @@ -240,5 +183,31 @@ end; function LatenStyles.WriteXmlAttrCount(_value); begin + if ifnil({self.}XmlAttrCount) then + begin + {self.}XmlAttrCount := new OpenXmlAttribute({self.}Prefix, "count", nil); + attributes_[length(attributes_)] := {self.}XmlAttrCount; + end {self.}XmlAttrCount.Value := _value; end; + +function LatenStyles.ReadLsdExceptions(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "lsdException", ind); +end; + +function LatenStyles.AddLsdException(): LsdException; +begin + obj := new LsdException(self, {self.}Prefix, "lsdException"); + container_.Insert(obj); + return obj; +end; + +function LatenStyles.AppendLsdException(): LsdException; +begin + obj := new LsdException(self, {self.}Prefix, "lsdException"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/Latin@DOCX.tsf b/autoclass/docx/Latin@DOCX.tsf index 1d9e822..38e350f 100644 --- a/autoclass/docx/Latin@DOCX.tsf +++ b/autoclass/docx/Latin@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Latin);override; +public + + // attributes property property Typeface read ReadXmlAttrTypeface write WriteXmlAttrTypeface; property Panose read ReadXmlAttrPanose write WriteXmlAttrPanose; function ReadXmlAttrTypeface(); @@ -17,11 +17,10 @@ public function WriteXmlAttrPanose(_value); public - // Attributes + // Attributes XmlAttrTypeface: OpenXmlAttribute; XmlAttrPanose: OpenXmlAttribute; - // Children end; @@ -37,45 +36,33 @@ end; function Latin.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Latin.Init();override; begin - {self.}XmlAttrTypeface := new OpenXmlAttribute(nil, "typeface", nil); - {self.}XmlAttrPanose := new OpenXmlAttribute(nil, "panose", nil); -end; - -function Latin.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrTypeface, - {self.}XmlAttrPanose, - ); -end; - -function Latin.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "typeface": makeweakref(thisFunction(WriteXmlAttrTypeface)), + "panose": makeweakref(thisFunction(WriteXmlAttrPanose)), ); sorted_child_ := array( - "": -1, ); -end; - -function Latin.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Latin.Copy(_obj: Latin);override; begin - if not ifnil(_obj.XmlAttrTypeface.Value) then - {self.}XmlAttrTypeface.Value := _obj.XmlAttrTypeface.Value; - if not ifnil(_obj.XmlAttrPanose.Value) then - {self.}XmlAttrPanose.Value := _obj.XmlAttrPanose.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Typeface) then + {self.}Typeface := _obj.Typeface; + if not ifnil(_obj.Panose) then + {self.}Panose := _obj.Panose; + tslassigning := tslassigning_backup; end; function Latin.ReadXmlAttrTypeface(); @@ -85,6 +72,11 @@ end; function Latin.WriteXmlAttrTypeface(_value); begin + if ifnil({self.}XmlAttrTypeface) then + begin + {self.}XmlAttrTypeface := new OpenXmlAttribute("", "typeface", nil); + attributes_[length(attributes_)] := {self.}XmlAttrTypeface; + end {self.}XmlAttrTypeface.Value := _value; end; @@ -95,5 +87,10 @@ end; function Latin.WriteXmlAttrPanose(_value); begin + if ifnil({self.}XmlAttrPanose) then + begin + {self.}XmlAttrPanose := new OpenXmlAttribute("", "panose", nil); + attributes_[length(attributes_)] := {self.}XmlAttrPanose; + end {self.}XmlAttrPanose.Value := _value; end; diff --git a/autoclass/docx/Legend@DOCX.tsf b/autoclass/docx/Legend@DOCX.tsf index 7b892a8..b588f39 100644 --- a/autoclass/docx/Legend@DOCX.tsf +++ b/autoclass/docx/Legend@DOCX.tsf @@ -4,23 +4,29 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Legend);override; +public + + // empty property property Layout read ReadXmlChildLayout write WriteXmlChildLayout; function ReadXmlChildLayout(); function WriteXmlChildLayout(_value); -public - // Attributes + // normal property + property LegendPos read ReadXmlChildLegendPos; + property Overlay read ReadXmlChildOverlay; + property TxPr read ReadXmlChildTxPr; + function ReadXmlChildLegendPos(); + function ReadXmlChildOverlay(); + function ReadXmlChildTxPr(); +public // Children - LegendPos: PureVal; + XmlChildLegendPos: PureVal; XmlChildLayout: OpenXmlEmpty; - Overlay: PureVal; - TxPr: TxPr; + XmlChildOverlay: PureVal; + XmlChildTxPr: TxPr; end; @@ -36,92 +42,88 @@ end; function Legend.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Legend.Init();override; begin - {self.}LegendPos := new PureVal(self, {self.}Prefix, "legendPos"); - {self.}XmlChildLayout := new OpenXmlEmpty(self, {self.}Prefix, "layout"); - {self.}Overlay := new PureVal(self, {self.}Prefix, "overlay"); - {self.}TxPr := new TxPr(self, {self.}Prefix, "txPr"); -end; - -function Legend.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Legend.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}LegendPos, - 1: {self.}XmlChildLayout, - 2: {self.}Overlay, - 3: {self.}TxPr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}LegendPos.ElementName: 0, - {self.}XmlChildLayout.ElementName: 1, - {self.}Overlay.ElementName: 2, - {self.}TxPr.ElementName: 3, + pre + "legendPos": array(0, makeweakref(thisFunction(ReadXmlChildLegendPos))), + pre + "layout": array(1, makeweakref(thisFunction(ReadXmlChildLayout))), + pre + "overlay": array(2, makeweakref(thisFunction(ReadXmlChildOverlay))), + pre + "txPr": array(3, makeweakref(thisFunction(ReadXmlChildTxPr))), ); -end; - -function Legend.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Legend.Copy(_obj: Legend);override; begin - {self.}LegendPos.Copy(_obj.LegendPos); - {self.}XmlChildLayout.Copy(_obj.XmlChildLayout); - {self.}Overlay.Copy(_obj.Overlay); - {self.}TxPr.Copy(_obj.TxPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildLegendPos) then + {self.}LegendPos.Copy(_obj.XmlChildLegendPos); + if not ifnil(_obj.XmlChildLayout) then + ifnil({self.}XmlChildLayout) ? {self.}Layout.Copy(_obj.XmlChildLayout) : {self.}XmlChildLayout.Copy(_obj.XmlChildLayout); + if not ifnil(_obj.XmlChildOverlay) then + {self.}Overlay.Copy(_obj.XmlChildOverlay); + if not ifnil(_obj.XmlChildTxPr) then + {self.}TxPr.Copy(_obj.XmlChildTxPr); + tslassigning := tslassigning_backup; end; function Legend.ReadXmlChildLayout(); begin - return ifnil({self.}XmlChildLayout.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildLayout) then + begin + {self.}XmlChildLayout := new OpenXmlEmpty(self, {self.}Prefix, "layout"); + container_.Set({self.}XmlChildLayout); + return {self.}XmlChildLayout; + end + return {self.}XmlChildLayout.BoolValue(); end; function Legend.WriteXmlChildLayout(_value); begin + if ifnil({self.}XmlChildLayout) then + begin + {self.}XmlChildLayout := new OpenXmlEmpty(self, {self.}Prefix, "layout"); + container_.Set({self.}XmlChildLayout); + end {self.}XmlChildLayout.Value := _value; end; + +function Legend.ReadXmlChildLegendPos(); +begin + if tslassigning and ifnil({self.}XmlChildLegendPos) then + begin + {self.}XmlChildLegendPos := new PureVal(self, {self.}Prefix, "legendPos"); + container_.Set({self.}XmlChildLegendPos); + end + return {self.}XmlChildLegendPos; +end; + +function Legend.ReadXmlChildOverlay(); +begin + if tslassigning and ifnil({self.}XmlChildOverlay) then + begin + {self.}XmlChildOverlay := new PureVal(self, {self.}Prefix, "overlay"); + container_.Set({self.}XmlChildOverlay); + end + return {self.}XmlChildOverlay; +end; + +function Legend.ReadXmlChildTxPr(); +begin + if tslassigning and ifnil({self.}XmlChildTxPr) then + begin + {self.}XmlChildTxPr := new TxPr(self, {self.}Prefix, "txPr"); + container_.Set({self.}XmlChildTxPr); + end + return {self.}XmlChildTxPr; +end; diff --git a/autoclass/docx/Lin@DOCX.tsf b/autoclass/docx/Lin@DOCX.tsf index 17130a6..8044c58 100644 --- a/autoclass/docx/Lin@DOCX.tsf +++ b/autoclass/docx/Lin@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Lin);override; +public + + // attributes property property Ang read ReadXmlAttrAng write WriteXmlAttrAng; property Scaled read ReadXmlAttrScaled write WriteXmlAttrScaled; function ReadXmlAttrAng(); @@ -17,11 +17,10 @@ public function WriteXmlAttrScaled(_value); public - // Attributes + // Attributes XmlAttrAng: OpenXmlAttribute; XmlAttrScaled: OpenXmlAttribute; - // Children end; @@ -37,45 +36,33 @@ end; function Lin.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Lin.Init();override; begin - {self.}XmlAttrAng := new OpenXmlAttribute(nil, "ang", nil); - {self.}XmlAttrScaled := new OpenXmlAttribute(nil, "scaled", nil); -end; - -function Lin.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrAng, - {self.}XmlAttrScaled, - ); -end; - -function Lin.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "ang": makeweakref(thisFunction(WriteXmlAttrAng)), + "scaled": makeweakref(thisFunction(WriteXmlAttrScaled)), ); sorted_child_ := array( - "": -1, ); -end; - -function Lin.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Lin.Copy(_obj: Lin);override; begin - if not ifnil(_obj.XmlAttrAng.Value) then - {self.}XmlAttrAng.Value := _obj.XmlAttrAng.Value; - if not ifnil(_obj.XmlAttrScaled.Value) then - {self.}XmlAttrScaled.Value := _obj.XmlAttrScaled.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Ang) then + {self.}Ang := _obj.Ang; + if not ifnil(_obj.Scaled) then + {self.}Scaled := _obj.Scaled; + tslassigning := tslassigning_backup; end; function Lin.ReadXmlAttrAng(); @@ -85,6 +72,11 @@ end; function Lin.WriteXmlAttrAng(_value); begin + if ifnil({self.}XmlAttrAng) then + begin + {self.}XmlAttrAng := new OpenXmlAttribute("", "ang", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAng; + end {self.}XmlAttrAng.Value := _value; end; @@ -95,5 +87,10 @@ end; function Lin.WriteXmlAttrScaled(_value); begin + if ifnil({self.}XmlAttrScaled) then + begin + {self.}XmlAttrScaled := new OpenXmlAttribute("", "scaled", nil); + attributes_[length(attributes_)] := {self.}XmlAttrScaled; + end {self.}XmlAttrScaled.Value := _value; end; diff --git a/autoclass/docx/Ln@DOCX.tsf b/autoclass/docx/Ln@DOCX.tsf index a74dec2..32538fa 100644 --- a/autoclass/docx/Ln@DOCX.tsf +++ b/autoclass/docx/Ln@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Ln);override; +public + + // attributes property property W read ReadXmlAttrW write WriteXmlAttrW; property Cap read ReadXmlAttrCap write WriteXmlAttrCap; property Cmpd read ReadXmlAttrCmpd write WriteXmlAttrCmpd; @@ -22,17 +22,25 @@ public function ReadXmlAttrAlgn(); function WriteXmlAttrAlgn(_value); + // normal property + property SolidFill read ReadXmlChildSolidFill; + property PrstDash read ReadXmlChildPrstDash; + property Miter read ReadXmlChildMiter; + function ReadXmlChildSolidFill(); + function ReadXmlChildPrstDash(); + function ReadXmlChildMiter(); + public - // Attributes + // Attributes XmlAttrW: OpenXmlAttribute; XmlAttrCap: OpenXmlAttribute; XmlAttrCmpd: OpenXmlAttribute; XmlAttrAlgn: OpenXmlAttribute; // Children - SolidFill: SolidFill; - PrstDash: PureVal; - Miter: Miter; + XmlChildSolidFill: SolidFill; + XmlChildPrstDash: PureVal; + XmlChildMiter: Miter; end; @@ -48,96 +56,48 @@ end; function Ln.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Ln.Init();override; begin - {self.}XmlAttrW := new OpenXmlAttribute(nil, "w", nil); - {self.}XmlAttrCap := new OpenXmlAttribute(nil, "cap", nil); - {self.}XmlAttrCmpd := new OpenXmlAttribute(nil, "cmpd", nil); - {self.}XmlAttrAlgn := new OpenXmlAttribute(nil, "algn", nil); - {self.}SolidFill := new SolidFill(self, {self.}Prefix, "solidFill"); - {self.}PrstDash := new PureVal(self, {self.}Prefix, "prstDash"); - {self.}Miter := new Miter(self, {self.}Prefix, "miter"); -end; - -function Ln.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrW, - {self.}XmlAttrCap, - {self.}XmlAttrCmpd, - {self.}XmlAttrAlgn, - ); -end; - -function Ln.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}SolidFill, - 1: {self.}PrstDash, - 2: {self.}Miter, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "w": makeweakref(thisFunction(WriteXmlAttrW)), + "cap": makeweakref(thisFunction(WriteXmlAttrCap)), + "cmpd": makeweakref(thisFunction(WriteXmlAttrCmpd)), + "algn": makeweakref(thisFunction(WriteXmlAttrAlgn)), ); sorted_child_ := array( - "": -1, - {self.}SolidFill.ElementName: 0, - {self.}PrstDash.ElementName: 1, - {self.}Miter.ElementName: 2, + pre + "solidFill": array(0, makeweakref(thisFunction(ReadXmlChildSolidFill))), + pre + "prstDash": array(1, makeweakref(thisFunction(ReadXmlChildPrstDash))), + pre + "miter": array(2, makeweakref(thisFunction(ReadXmlChildMiter))), ); -end; - -function Ln.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Ln.Copy(_obj: Ln);override; begin - if not ifnil(_obj.XmlAttrW.Value) then - {self.}XmlAttrW.Value := _obj.XmlAttrW.Value; - if not ifnil(_obj.XmlAttrCap.Value) then - {self.}XmlAttrCap.Value := _obj.XmlAttrCap.Value; - if not ifnil(_obj.XmlAttrCmpd.Value) then - {self.}XmlAttrCmpd.Value := _obj.XmlAttrCmpd.Value; - if not ifnil(_obj.XmlAttrAlgn.Value) then - {self.}XmlAttrAlgn.Value := _obj.XmlAttrAlgn.Value; - {self.}SolidFill.Copy(_obj.SolidFill); - {self.}PrstDash.Copy(_obj.PrstDash); - {self.}Miter.Copy(_obj.Miter); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.W) then + {self.}W := _obj.W; + if not ifnil(_obj.Cap) then + {self.}Cap := _obj.Cap; + if not ifnil(_obj.Cmpd) then + {self.}Cmpd := _obj.Cmpd; + if not ifnil(_obj.Algn) then + {self.}Algn := _obj.Algn; + if not ifnil(_obj.XmlChildSolidFill) then + {self.}SolidFill.Copy(_obj.XmlChildSolidFill); + if not ifnil(_obj.XmlChildPrstDash) then + {self.}PrstDash.Copy(_obj.XmlChildPrstDash); + if not ifnil(_obj.XmlChildMiter) then + {self.}Miter.Copy(_obj.XmlChildMiter); + tslassigning := tslassigning_backup; end; function Ln.ReadXmlAttrW(); @@ -147,6 +107,11 @@ end; function Ln.WriteXmlAttrW(_value); begin + if ifnil({self.}XmlAttrW) then + begin + {self.}XmlAttrW := new OpenXmlAttribute("", "w", nil); + attributes_[length(attributes_)] := {self.}XmlAttrW; + end {self.}XmlAttrW.Value := _value; end; @@ -157,6 +122,11 @@ end; function Ln.WriteXmlAttrCap(_value); begin + if ifnil({self.}XmlAttrCap) then + begin + {self.}XmlAttrCap := new OpenXmlAttribute("", "cap", nil); + attributes_[length(attributes_)] := {self.}XmlAttrCap; + end {self.}XmlAttrCap.Value := _value; end; @@ -167,6 +137,11 @@ end; function Ln.WriteXmlAttrCmpd(_value); begin + if ifnil({self.}XmlAttrCmpd) then + begin + {self.}XmlAttrCmpd := new OpenXmlAttribute("", "cmpd", nil); + attributes_[length(attributes_)] := {self.}XmlAttrCmpd; + end {self.}XmlAttrCmpd.Value := _value; end; @@ -177,5 +152,40 @@ end; function Ln.WriteXmlAttrAlgn(_value); begin + if ifnil({self.}XmlAttrAlgn) then + begin + {self.}XmlAttrAlgn := new OpenXmlAttribute("", "algn", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAlgn; + end {self.}XmlAttrAlgn.Value := _value; end; + +function Ln.ReadXmlChildSolidFill(); +begin + if tslassigning and ifnil({self.}XmlChildSolidFill) then + begin + {self.}XmlChildSolidFill := new SolidFill(self, {self.}Prefix, "solidFill"); + container_.Set({self.}XmlChildSolidFill); + end + return {self.}XmlChildSolidFill; +end; + +function Ln.ReadXmlChildPrstDash(); +begin + if tslassigning and ifnil({self.}XmlChildPrstDash) then + begin + {self.}XmlChildPrstDash := new PureVal(self, {self.}Prefix, "prstDash"); + container_.Set({self.}XmlChildPrstDash); + end + return {self.}XmlChildPrstDash; +end; + +function Ln.ReadXmlChildMiter(); +begin + if tslassigning and ifnil({self.}XmlChildMiter) then + begin + {self.}XmlChildMiter := new Miter(self, {self.}Prefix, "miter"); + container_.Set({self.}XmlChildMiter); + end + return {self.}XmlChildMiter; +end; diff --git a/autoclass/docx/LnStyleLst@DOCX.tsf b/autoclass/docx/LnStyleLst@DOCX.tsf index 7b9c1b0..e23fc24 100644 --- a/autoclass/docx/LnStyleLst@DOCX.tsf +++ b/autoclass/docx/LnStyleLst@DOCX.tsf @@ -4,19 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: LnStyleLst);override; + +public + + // multi property + property Lns read ReadLns; + function ReadLns(_index); function AddLn(): Ln; function AppendLn(): Ln; - property Lns read ReadLns; - function ReadLns(_index); - public - // Attributes - // Children end; @@ -33,105 +31,47 @@ end; function LnStyleLst.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function LnStyleLst.Init();override; begin - -end; - -function LnStyleLst.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function LnStyleLst.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, + pre + "ln": array(0, makeweakref(thisFunction(AppendLn))), ); -end; - -function LnStyleLst.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "ln": obj := {self.}AppendLn(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function LnStyleLst.Copy(_obj: LnStyleLst);override; begin + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + tslassigning := tslassigning_backup; +end; +function LnStyleLst.ReadLns(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "ln", ind); end; function LnStyleLst.AddLn(): Ln; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "ln" then break; - end obj := new Ln(self, {self.}Prefix, "ln"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function LnStyleLst.AppendLn(): Ln; begin obj := new Ln(self, {self.}Prefix, "ln"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function LnStyleLst.ReadLns(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "ln" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; diff --git a/autoclass/docx/LsdException@DOCX.tsf b/autoclass/docx/LsdException@DOCX.tsf index 734d33d..b2d5057 100644 --- a/autoclass/docx/LsdException@DOCX.tsf +++ b/autoclass/docx/LsdException@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: LsdException);override; +public + + // attributes property property Name read ReadXmlAttrName write WriteXmlAttrName; property UIPriority read ReadXmlAttrUIPriority write WriteXmlAttrUIPriority; property SemiHidden read ReadXmlAttrSemiHidden write WriteXmlAttrSemiHidden; @@ -26,14 +26,13 @@ public function WriteXmlAttrQFormat(_value); public - // Attributes + // Attributes XmlAttrName: OpenXmlAttribute; XmlAttrUIPriority: OpenXmlAttribute; XmlAttrSemiHidden: OpenXmlAttribute; XmlAttrUnhideWhenUsed: OpenXmlAttribute; XmlAttrQFormat: OpenXmlAttribute; - // Children end; @@ -49,57 +48,42 @@ end; function LsdException.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function LsdException.Init();override; begin - {self.}XmlAttrName := new OpenXmlAttribute({self.}Prefix, "name", nil); - {self.}XmlAttrUIPriority := new OpenXmlAttribute({self.}Prefix, "uiPriority", nil); - {self.}XmlAttrSemiHidden := new OpenXmlAttribute({self.}Prefix, "semiHidden", nil); - {self.}XmlAttrUnhideWhenUsed := new OpenXmlAttribute({self.}Prefix, "unhideWhenUsed", nil); - {self.}XmlAttrQFormat := new OpenXmlAttribute({self.}Prefix, "qFormat", nil); -end; - -function LsdException.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrName, - {self.}XmlAttrUIPriority, - {self.}XmlAttrSemiHidden, - {self.}XmlAttrUnhideWhenUsed, - {self.}XmlAttrQFormat, - ); -end; - -function LsdException.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "name": makeweakref(thisFunction(WriteXmlAttrName)), + pre + "uiPriority": makeweakref(thisFunction(WriteXmlAttrUIPriority)), + pre + "semiHidden": makeweakref(thisFunction(WriteXmlAttrSemiHidden)), + pre + "unhideWhenUsed": makeweakref(thisFunction(WriteXmlAttrUnhideWhenUsed)), + pre + "qFormat": makeweakref(thisFunction(WriteXmlAttrQFormat)), ); sorted_child_ := array( - "": -1, ); -end; - -function LsdException.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function LsdException.Copy(_obj: LsdException);override; begin - if not ifnil(_obj.XmlAttrName.Value) then - {self.}XmlAttrName.Value := _obj.XmlAttrName.Value; - if not ifnil(_obj.XmlAttrUIPriority.Value) then - {self.}XmlAttrUIPriority.Value := _obj.XmlAttrUIPriority.Value; - if not ifnil(_obj.XmlAttrSemiHidden.Value) then - {self.}XmlAttrSemiHidden.Value := _obj.XmlAttrSemiHidden.Value; - if not ifnil(_obj.XmlAttrUnhideWhenUsed.Value) then - {self.}XmlAttrUnhideWhenUsed.Value := _obj.XmlAttrUnhideWhenUsed.Value; - if not ifnil(_obj.XmlAttrQFormat.Value) then - {self.}XmlAttrQFormat.Value := _obj.XmlAttrQFormat.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Name) then + {self.}Name := _obj.Name; + if not ifnil(_obj.UIPriority) then + {self.}UIPriority := _obj.UIPriority; + if not ifnil(_obj.SemiHidden) then + {self.}SemiHidden := _obj.SemiHidden; + if not ifnil(_obj.UnhideWhenUsed) then + {self.}UnhideWhenUsed := _obj.UnhideWhenUsed; + if not ifnil(_obj.QFormat) then + {self.}QFormat := _obj.QFormat; + tslassigning := tslassigning_backup; end; function LsdException.ReadXmlAttrName(); @@ -109,6 +93,11 @@ end; function LsdException.WriteXmlAttrName(_value); begin + if ifnil({self.}XmlAttrName) then + begin + {self.}XmlAttrName := new OpenXmlAttribute({self.}Prefix, "name", nil); + attributes_[length(attributes_)] := {self.}XmlAttrName; + end {self.}XmlAttrName.Value := _value; end; @@ -119,6 +108,11 @@ end; function LsdException.WriteXmlAttrUIPriority(_value); begin + if ifnil({self.}XmlAttrUIPriority) then + begin + {self.}XmlAttrUIPriority := new OpenXmlAttribute({self.}Prefix, "uiPriority", nil); + attributes_[length(attributes_)] := {self.}XmlAttrUIPriority; + end {self.}XmlAttrUIPriority.Value := _value; end; @@ -129,6 +123,11 @@ end; function LsdException.WriteXmlAttrSemiHidden(_value); begin + if ifnil({self.}XmlAttrSemiHidden) then + begin + {self.}XmlAttrSemiHidden := new OpenXmlAttribute({self.}Prefix, "semiHidden", nil); + attributes_[length(attributes_)] := {self.}XmlAttrSemiHidden; + end {self.}XmlAttrSemiHidden.Value := _value; end; @@ -139,6 +138,11 @@ end; function LsdException.WriteXmlAttrUnhideWhenUsed(_value); begin + if ifnil({self.}XmlAttrUnhideWhenUsed) then + begin + {self.}XmlAttrUnhideWhenUsed := new OpenXmlAttribute({self.}Prefix, "unhideWhenUsed", nil); + attributes_[length(attributes_)] := {self.}XmlAttrUnhideWhenUsed; + end {self.}XmlAttrUnhideWhenUsed.Value := _value; end; @@ -149,5 +153,10 @@ end; function LsdException.WriteXmlAttrQFormat(_value); begin + if ifnil({self.}XmlAttrQFormat) then + begin + {self.}XmlAttrQFormat := new OpenXmlAttribute({self.}Prefix, "qFormat", nil); + attributes_[length(attributes_)] := {self.}XmlAttrQFormat; + end {self.}XmlAttrQFormat.Value := _value; end; diff --git a/autoclass/docx/Lvl@DOCX.tsf b/autoclass/docx/Lvl@DOCX.tsf index 56d70ef..155644a 100644 --- a/autoclass/docx/Lvl@DOCX.tsf +++ b/autoclass/docx/Lvl@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Lvl);override; +public + + // attributes property property Ilvl read ReadXmlAttrIlvl write WriteXmlAttrIlvl; property Tentative read ReadXmlAttrTentative write WriteXmlAttrTentative; function ReadXmlAttrIlvl(); @@ -16,20 +16,38 @@ public function ReadXmlAttrTentative(); function WriteXmlAttrTentative(_value); + // normal property + property Start read ReadXmlChildStart; + property NumFmt read ReadXmlChildNumFmt; + property PStyle read ReadXmlChildPStyle; + property Suff read ReadXmlChildSuff; + property LvlText read ReadXmlChildLvlText; + property LvlJc read ReadXmlChildLvlJc; + property PPr read ReadXmlChildPPr; + property RPr read ReadXmlChildRPr; + function ReadXmlChildStart(); + function ReadXmlChildNumFmt(); + function ReadXmlChildPStyle(); + function ReadXmlChildSuff(); + function ReadXmlChildLvlText(); + function ReadXmlChildLvlJc(); + function ReadXmlChildPPr(); + function ReadXmlChildRPr(); + public - // Attributes + // Attributes XmlAttrIlvl: OpenXmlAttribute; XmlAttrTentative: OpenXmlAttribute; // Children - Start: PureWVal; - NumFmt: PureWVal; - PStyle: PureWVal; - Suff: PureWVal; - LvlText: PureWVal; - LvlJc: PureWVal; - PPr: PPr; - RPr: RPr; + XmlChildStart: PureWVal; + XmlChildNumFmt: PureWVal; + XmlChildPStyle: PureWVal; + XmlChildSuff: PureWVal; + XmlChildLvlText: PureWVal; + XmlChildLvlJc: PureWVal; + XmlChildPPr: PPr; + XmlChildRPr: RPr; end; @@ -45,108 +63,57 @@ end; function Lvl.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Lvl.Init();override; begin - {self.}XmlAttrIlvl := new OpenXmlAttribute({self.}Prefix, "ilvl", nil); - {self.}XmlAttrTentative := new OpenXmlAttribute({self.}Prefix, "tentative", nil); - {self.}Start := new PureWVal(self, {self.}Prefix, "start"); - {self.}NumFmt := new PureWVal(self, {self.}Prefix, "numFmt"); - {self.}PStyle := new PureWVal(self, {self.}Prefix, "pStyle"); - {self.}Suff := new PureWVal(self, {self.}Prefix, "suff"); - {self.}LvlText := new PureWVal(self, {self.}Prefix, "lvlText"); - {self.}LvlJc := new PureWVal(self, {self.}Prefix, "lvlJc"); - {self.}PPr := new PPr(self, {self.}Prefix, "pPr"); - {self.}RPr := new RPr(self, {self.}Prefix, "rPr"); -end; - -function Lvl.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrIlvl, - {self.}XmlAttrTentative, - ); -end; - -function Lvl.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Start, - 1: {self.}NumFmt, - 2: {self.}PStyle, - 3: {self.}Suff, - 4: {self.}LvlText, - 5: {self.}LvlJc, - 6: {self.}PPr, - 7: {self.}RPr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "ilvl": makeweakref(thisFunction(WriteXmlAttrIlvl)), + pre + "tentative": makeweakref(thisFunction(WriteXmlAttrTentative)), ); sorted_child_ := array( - "": -1, - {self.}Start.ElementName: 0, - {self.}NumFmt.ElementName: 1, - {self.}PStyle.ElementName: 2, - {self.}Suff.ElementName: 3, - {self.}LvlText.ElementName: 4, - {self.}LvlJc.ElementName: 5, - {self.}PPr.ElementName: 6, - {self.}RPr.ElementName: 7, + pre + "start": array(0, makeweakref(thisFunction(ReadXmlChildStart))), + pre + "numFmt": array(1, makeweakref(thisFunction(ReadXmlChildNumFmt))), + pre + "pStyle": array(2, makeweakref(thisFunction(ReadXmlChildPStyle))), + pre + "suff": array(3, makeweakref(thisFunction(ReadXmlChildSuff))), + pre + "lvlText": array(4, makeweakref(thisFunction(ReadXmlChildLvlText))), + pre + "lvlJc": array(5, makeweakref(thisFunction(ReadXmlChildLvlJc))), + pre + "pPr": array(6, makeweakref(thisFunction(ReadXmlChildPPr))), + pre + "rPr": array(7, makeweakref(thisFunction(ReadXmlChildRPr))), ); -end; - -function Lvl.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Lvl.Copy(_obj: Lvl);override; begin - if not ifnil(_obj.XmlAttrIlvl.Value) then - {self.}XmlAttrIlvl.Value := _obj.XmlAttrIlvl.Value; - if not ifnil(_obj.XmlAttrTentative.Value) then - {self.}XmlAttrTentative.Value := _obj.XmlAttrTentative.Value; - {self.}Start.Copy(_obj.Start); - {self.}NumFmt.Copy(_obj.NumFmt); - {self.}PStyle.Copy(_obj.PStyle); - {self.}Suff.Copy(_obj.Suff); - {self.}LvlText.Copy(_obj.LvlText); - {self.}LvlJc.Copy(_obj.LvlJc); - {self.}PPr.Copy(_obj.PPr); - {self.}RPr.Copy(_obj.RPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Ilvl) then + {self.}Ilvl := _obj.Ilvl; + if not ifnil(_obj.Tentative) then + {self.}Tentative := _obj.Tentative; + if not ifnil(_obj.XmlChildStart) then + {self.}Start.Copy(_obj.XmlChildStart); + if not ifnil(_obj.XmlChildNumFmt) then + {self.}NumFmt.Copy(_obj.XmlChildNumFmt); + if not ifnil(_obj.XmlChildPStyle) then + {self.}PStyle.Copy(_obj.XmlChildPStyle); + if not ifnil(_obj.XmlChildSuff) then + {self.}Suff.Copy(_obj.XmlChildSuff); + if not ifnil(_obj.XmlChildLvlText) then + {self.}LvlText.Copy(_obj.XmlChildLvlText); + if not ifnil(_obj.XmlChildLvlJc) then + {self.}LvlJc.Copy(_obj.XmlChildLvlJc); + if not ifnil(_obj.XmlChildPPr) then + {self.}PPr.Copy(_obj.XmlChildPPr); + if not ifnil(_obj.XmlChildRPr) then + {self.}RPr.Copy(_obj.XmlChildRPr); + tslassigning := tslassigning_backup; end; function Lvl.ReadXmlAttrIlvl(); @@ -156,6 +123,11 @@ end; function Lvl.WriteXmlAttrIlvl(_value); begin + if ifnil({self.}XmlAttrIlvl) then + begin + {self.}XmlAttrIlvl := new OpenXmlAttribute({self.}Prefix, "ilvl", nil); + attributes_[length(attributes_)] := {self.}XmlAttrIlvl; + end {self.}XmlAttrIlvl.Value := _value; end; @@ -166,5 +138,90 @@ end; function Lvl.WriteXmlAttrTentative(_value); begin + if ifnil({self.}XmlAttrTentative) then + begin + {self.}XmlAttrTentative := new OpenXmlAttribute({self.}Prefix, "tentative", nil); + attributes_[length(attributes_)] := {self.}XmlAttrTentative; + end {self.}XmlAttrTentative.Value := _value; end; + +function Lvl.ReadXmlChildStart(); +begin + if tslassigning and ifnil({self.}XmlChildStart) then + begin + {self.}XmlChildStart := new PureWVal(self, {self.}Prefix, "start"); + container_.Set({self.}XmlChildStart); + end + return {self.}XmlChildStart; +end; + +function Lvl.ReadXmlChildNumFmt(); +begin + if tslassigning and ifnil({self.}XmlChildNumFmt) then + begin + {self.}XmlChildNumFmt := new PureWVal(self, {self.}Prefix, "numFmt"); + container_.Set({self.}XmlChildNumFmt); + end + return {self.}XmlChildNumFmt; +end; + +function Lvl.ReadXmlChildPStyle(); +begin + if tslassigning and ifnil({self.}XmlChildPStyle) then + begin + {self.}XmlChildPStyle := new PureWVal(self, {self.}Prefix, "pStyle"); + container_.Set({self.}XmlChildPStyle); + end + return {self.}XmlChildPStyle; +end; + +function Lvl.ReadXmlChildSuff(); +begin + if tslassigning and ifnil({self.}XmlChildSuff) then + begin + {self.}XmlChildSuff := new PureWVal(self, {self.}Prefix, "suff"); + container_.Set({self.}XmlChildSuff); + end + return {self.}XmlChildSuff; +end; + +function Lvl.ReadXmlChildLvlText(); +begin + if tslassigning and ifnil({self.}XmlChildLvlText) then + begin + {self.}XmlChildLvlText := new PureWVal(self, {self.}Prefix, "lvlText"); + container_.Set({self.}XmlChildLvlText); + end + return {self.}XmlChildLvlText; +end; + +function Lvl.ReadXmlChildLvlJc(); +begin + if tslassigning and ifnil({self.}XmlChildLvlJc) then + begin + {self.}XmlChildLvlJc := new PureWVal(self, {self.}Prefix, "lvlJc"); + container_.Set({self.}XmlChildLvlJc); + end + return {self.}XmlChildLvlJc; +end; + +function Lvl.ReadXmlChildPPr(); +begin + if tslassigning and ifnil({self.}XmlChildPPr) then + begin + {self.}XmlChildPPr := new PPr(self, {self.}Prefix, "pPr"); + container_.Set({self.}XmlChildPPr); + end + return {self.}XmlChildPPr; +end; + +function Lvl.ReadXmlChildRPr(); +begin + if tslassigning and ifnil({self.}XmlChildRPr) then + begin + {self.}XmlChildRPr := new RPr(self, {self.}Prefix, "rPr"); + container_.Set({self.}XmlChildRPr); + end + return {self.}XmlChildRPr; +end; diff --git a/autoclass/docx/MFont@DOCX.tsf b/autoclass/docx/MFont@DOCX.tsf index 50a1ccc..d241f60 100644 --- a/autoclass/docx/MFont@DOCX.tsf +++ b/autoclass/docx/MFont@DOCX.tsf @@ -4,23 +4,29 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: MFont);override; + +public + + // normal property + property Latin read ReadXmlChildLatin; + property Ea read ReadXmlChildEa; + property Cs read ReadXmlChildCs; + function ReadXmlChildLatin(); + function ReadXmlChildEa(); + function ReadXmlChildCs(); + + // multi property + property Fonts read ReadFonts; + function ReadFonts(_index); function AddFont(): MFontFont; function AppendFont(): MFontFont; - property Fonts read ReadFonts; - function ReadFonts(_index); - public - // Attributes - // Children - Latin: Latin; - Ea: Latin; - Cs: Latin; + XmlChildLatin: Latin; + XmlChildEa: Latin; + XmlChildCs: Latin; end; @@ -36,115 +42,86 @@ end; function MFont.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function MFont.Init();override; begin - {self.}Latin := new Latin(self, {self.}Prefix, "latin"); - {self.}Ea := new Latin(self, {self.}Prefix, "ea"); - {self.}Cs := new Latin(self, {self.}Prefix, "cs"); -end; - -function MFont.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function MFont.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Latin, - 1: {self.}Ea, - 2: {self.}Cs, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}Latin.ElementName: 0, - {self.}Ea.ElementName: 1, - {self.}Cs.ElementName: 2, + pre + "latin": array(0, makeweakref(thisFunction(ReadXmlChildLatin))), + pre + "ea": array(1, makeweakref(thisFunction(ReadXmlChildEa))), + pre + "cs": array(2, makeweakref(thisFunction(ReadXmlChildCs))), + pre + "font": array(3, makeweakref(thisFunction(AppendFont))), ); -end; - -function MFont.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "font": obj := {self.}AppendFont(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function MFont.Copy(_obj: MFont);override; begin - {self.}Latin.Copy(_obj.Latin); - {self.}Ea.Copy(_obj.Ea); - {self.}Cs.Copy(_obj.Cs); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildLatin) then + {self.}Latin.Copy(_obj.XmlChildLatin); + if not ifnil(_obj.XmlChildEa) then + {self.}Ea.Copy(_obj.XmlChildEa); + if not ifnil(_obj.XmlChildCs) then + {self.}Cs.Copy(_obj.XmlChildCs); + tslassigning := tslassigning_backup; +end; + +function MFont.ReadXmlChildLatin(); +begin + if tslassigning and ifnil({self.}XmlChildLatin) then + begin + {self.}XmlChildLatin := new Latin(self, {self.}Prefix, "latin"); + container_.Set({self.}XmlChildLatin); + end + return {self.}XmlChildLatin; +end; + +function MFont.ReadXmlChildEa(); +begin + if tslassigning and ifnil({self.}XmlChildEa) then + begin + {self.}XmlChildEa := new Latin(self, {self.}Prefix, "ea"); + container_.Set({self.}XmlChildEa); + end + return {self.}XmlChildEa; +end; + +function MFont.ReadXmlChildCs(); +begin + if tslassigning and ifnil({self.}XmlChildCs) then + begin + {self.}XmlChildCs := new Latin(self, {self.}Prefix, "cs"); + container_.Set({self.}XmlChildCs); + end + return {self.}XmlChildCs; +end; + +function MFont.ReadFonts(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "font", ind); end; function MFont.AddFont(): MFontFont; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "font" then break; - end obj := new MFontFont(self, {self.}Prefix, "font"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function MFont.AppendFont(): MFontFont; begin obj := new MFontFont(self, {self.}Prefix, "font"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function MFont.ReadFonts(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "font" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; diff --git a/autoclass/docx/MFontFont@DOCX.tsf b/autoclass/docx/MFontFont@DOCX.tsf index c89e688..4ed876d 100644 --- a/autoclass/docx/MFontFont@DOCX.tsf +++ b/autoclass/docx/MFontFont@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: MFontFont);override; +public + + // attributes property property Script read ReadXmlAttrScript write WriteXmlAttrScript; property Typeface read ReadXmlAttrTypeface write WriteXmlAttrTypeface; function ReadXmlAttrScript(); @@ -17,11 +17,10 @@ public function WriteXmlAttrTypeface(_value); public - // Attributes + // Attributes XmlAttrScript: OpenXmlAttribute; XmlAttrTypeface: OpenXmlAttribute; - // Children end; @@ -37,45 +36,33 @@ end; function MFontFont.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function MFontFont.Init();override; begin - {self.}XmlAttrScript := new OpenXmlAttribute(nil, "script", nil); - {self.}XmlAttrTypeface := new OpenXmlAttribute(nil, "typeface", nil); -end; - -function MFontFont.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrScript, - {self.}XmlAttrTypeface, - ); -end; - -function MFontFont.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "script": makeweakref(thisFunction(WriteXmlAttrScript)), + "typeface": makeweakref(thisFunction(WriteXmlAttrTypeface)), ); sorted_child_ := array( - "": -1, ); -end; - -function MFontFont.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function MFontFont.Copy(_obj: MFontFont);override; begin - if not ifnil(_obj.XmlAttrScript.Value) then - {self.}XmlAttrScript.Value := _obj.XmlAttrScript.Value; - if not ifnil(_obj.XmlAttrTypeface.Value) then - {self.}XmlAttrTypeface.Value := _obj.XmlAttrTypeface.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Script) then + {self.}Script := _obj.Script; + if not ifnil(_obj.Typeface) then + {self.}Typeface := _obj.Typeface; + tslassigning := tslassigning_backup; end; function MFontFont.ReadXmlAttrScript(); @@ -85,6 +72,11 @@ end; function MFontFont.WriteXmlAttrScript(_value); begin + if ifnil({self.}XmlAttrScript) then + begin + {self.}XmlAttrScript := new OpenXmlAttribute("", "script", nil); + attributes_[length(attributes_)] := {self.}XmlAttrScript; + end {self.}XmlAttrScript.Value := _value; end; @@ -95,5 +87,10 @@ end; function MFontFont.WriteXmlAttrTypeface(_value); begin + if ifnil({self.}XmlAttrTypeface) then + begin + {self.}XmlAttrTypeface := new OpenXmlAttribute("", "typeface", nil); + attributes_[length(attributes_)] := {self.}XmlAttrTypeface; + end {self.}XmlAttrTypeface.Value := _value; end; diff --git a/autoclass/docx/MathPr@DOCX.tsf b/autoclass/docx/MathPr@DOCX.tsf index 6f79567..4c4c5f3 100644 --- a/autoclass/docx/MathPr@DOCX.tsf +++ b/autoclass/docx/MathPr@DOCX.tsf @@ -4,30 +4,50 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: MathPr);override; +public + + // empty property property DispDef read ReadXmlChildDispDef write WriteXmlChildDispDef; function ReadXmlChildDispDef(); function WriteXmlChildDispDef(_value); -public - // Attributes + // normal property + property MathFont read ReadXmlChildMathFont; + property BrkBin read ReadXmlChildBrkBin; + property BrkBinSub read ReadXmlChildBrkBinSub; + property SmallFrac read ReadXmlChildSmallFrac; + property LMargin read ReadXmlChildLMargin; + property RMargin read ReadXmlChildRMargin; + property DefJc read ReadXmlChildDefJc; + property WrapIndent read ReadXmlChildWrapIndent; + property IntLim read ReadXmlChildIntLim; + property NaryLim read ReadXmlChildNaryLim; + function ReadXmlChildMathFont(); + function ReadXmlChildBrkBin(); + function ReadXmlChildBrkBinSub(); + function ReadXmlChildSmallFrac(); + function ReadXmlChildLMargin(); + function ReadXmlChildRMargin(); + function ReadXmlChildDefJc(); + function ReadXmlChildWrapIndent(); + function ReadXmlChildIntLim(); + function ReadXmlChildNaryLim(); +public // Children - MathFont: PureWVal; - BrkBin: PureWVal; - BrkBinSub: PureWVal; - SmallFrac: PureWVal; + XmlChildMathFont: PureWVal; + XmlChildBrkBin: PureWVal; + XmlChildBrkBinSub: PureWVal; + XmlChildSmallFrac: PureWVal; XmlChildDispDef: OpenXmlEmpty; - LMargin: PureWVal; - RMargin: PureWVal; - DefJc: PureWVal; - WrapIndent: PureWVal; - IntLim: PureWVal; - NaryLim: PureWVal; + XmlChildLMargin: PureWVal; + XmlChildRMargin: PureWVal; + XmlChildDefJc: PureWVal; + XmlChildWrapIndent: PureWVal; + XmlChildIntLim: PureWVal; + XmlChildNaryLim: PureWVal; end; @@ -43,120 +63,179 @@ end; function MathPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function MathPr.Init();override; begin - {self.}MathFont := new PureWVal(self, {self.}Prefix, "mathFont"); - {self.}BrkBin := new PureWVal(self, {self.}Prefix, "brkBin"); - {self.}BrkBinSub := new PureWVal(self, {self.}Prefix, "brkBinSub"); - {self.}SmallFrac := new PureWVal(self, {self.}Prefix, "smallFrac"); - {self.}XmlChildDispDef := new OpenXmlEmpty(self, {self.}Prefix, "dispDef"); - {self.}LMargin := new PureWVal(self, {self.}Prefix, "lMargin"); - {self.}RMargin := new PureWVal(self, {self.}Prefix, "rMargin"); - {self.}DefJc := new PureWVal(self, {self.}Prefix, "defJc"); - {self.}WrapIndent := new PureWVal(self, {self.}Prefix, "wrapIndent"); - {self.}IntLim := new PureWVal(self, {self.}Prefix, "intLim"); - {self.}NaryLim := new PureWVal(self, {self.}Prefix, "naryLim"); -end; - -function MathPr.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function MathPr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}MathFont, - 1: {self.}BrkBin, - 2: {self.}BrkBinSub, - 3: {self.}SmallFrac, - 4: {self.}XmlChildDispDef, - 5: {self.}LMargin, - 6: {self.}RMargin, - 7: {self.}DefJc, - 8: {self.}WrapIndent, - 9: {self.}IntLim, - 10: {self.}NaryLim, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}MathFont.ElementName: 0, - {self.}BrkBin.ElementName: 1, - {self.}BrkBinSub.ElementName: 2, - {self.}SmallFrac.ElementName: 3, - {self.}XmlChildDispDef.ElementName: 4, - {self.}LMargin.ElementName: 5, - {self.}RMargin.ElementName: 6, - {self.}DefJc.ElementName: 7, - {self.}WrapIndent.ElementName: 8, - {self.}IntLim.ElementName: 9, - {self.}NaryLim.ElementName: 10, + pre + "mathFont": array(0, makeweakref(thisFunction(ReadXmlChildMathFont))), + pre + "brkBin": array(1, makeweakref(thisFunction(ReadXmlChildBrkBin))), + pre + "brkBinSub": array(2, makeweakref(thisFunction(ReadXmlChildBrkBinSub))), + pre + "smallFrac": array(3, makeweakref(thisFunction(ReadXmlChildSmallFrac))), + pre + "dispDef": array(4, makeweakref(thisFunction(ReadXmlChildDispDef))), + pre + "lMargin": array(5, makeweakref(thisFunction(ReadXmlChildLMargin))), + pre + "rMargin": array(6, makeweakref(thisFunction(ReadXmlChildRMargin))), + pre + "defJc": array(7, makeweakref(thisFunction(ReadXmlChildDefJc))), + pre + "wrapIndent": array(8, makeweakref(thisFunction(ReadXmlChildWrapIndent))), + pre + "intLim": array(9, makeweakref(thisFunction(ReadXmlChildIntLim))), + pre + "naryLim": array(10, makeweakref(thisFunction(ReadXmlChildNaryLim))), ); -end; - -function MathPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function MathPr.Copy(_obj: MathPr);override; begin - {self.}MathFont.Copy(_obj.MathFont); - {self.}BrkBin.Copy(_obj.BrkBin); - {self.}BrkBinSub.Copy(_obj.BrkBinSub); - {self.}SmallFrac.Copy(_obj.SmallFrac); - {self.}XmlChildDispDef.Copy(_obj.XmlChildDispDef); - {self.}LMargin.Copy(_obj.LMargin); - {self.}RMargin.Copy(_obj.RMargin); - {self.}DefJc.Copy(_obj.DefJc); - {self.}WrapIndent.Copy(_obj.WrapIndent); - {self.}IntLim.Copy(_obj.IntLim); - {self.}NaryLim.Copy(_obj.NaryLim); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildMathFont) then + {self.}MathFont.Copy(_obj.XmlChildMathFont); + if not ifnil(_obj.XmlChildBrkBin) then + {self.}BrkBin.Copy(_obj.XmlChildBrkBin); + if not ifnil(_obj.XmlChildBrkBinSub) then + {self.}BrkBinSub.Copy(_obj.XmlChildBrkBinSub); + if not ifnil(_obj.XmlChildSmallFrac) then + {self.}SmallFrac.Copy(_obj.XmlChildSmallFrac); + if not ifnil(_obj.XmlChildDispDef) then + ifnil({self.}XmlChildDispDef) ? {self.}DispDef.Copy(_obj.XmlChildDispDef) : {self.}XmlChildDispDef.Copy(_obj.XmlChildDispDef); + if not ifnil(_obj.XmlChildLMargin) then + {self.}LMargin.Copy(_obj.XmlChildLMargin); + if not ifnil(_obj.XmlChildRMargin) then + {self.}RMargin.Copy(_obj.XmlChildRMargin); + if not ifnil(_obj.XmlChildDefJc) then + {self.}DefJc.Copy(_obj.XmlChildDefJc); + if not ifnil(_obj.XmlChildWrapIndent) then + {self.}WrapIndent.Copy(_obj.XmlChildWrapIndent); + if not ifnil(_obj.XmlChildIntLim) then + {self.}IntLim.Copy(_obj.XmlChildIntLim); + if not ifnil(_obj.XmlChildNaryLim) then + {self.}NaryLim.Copy(_obj.XmlChildNaryLim); + tslassigning := tslassigning_backup; end; function MathPr.ReadXmlChildDispDef(); begin - return ifnil({self.}XmlChildDispDef.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildDispDef) then + begin + {self.}XmlChildDispDef := new OpenXmlEmpty(self, {self.}Prefix, "dispDef"); + container_.Set({self.}XmlChildDispDef); + return {self.}XmlChildDispDef; + end + return {self.}XmlChildDispDef.BoolValue(); end; function MathPr.WriteXmlChildDispDef(_value); begin + if ifnil({self.}XmlChildDispDef) then + begin + {self.}XmlChildDispDef := new OpenXmlEmpty(self, {self.}Prefix, "dispDef"); + container_.Set({self.}XmlChildDispDef); + end {self.}XmlChildDispDef.Value := _value; end; + +function MathPr.ReadXmlChildMathFont(); +begin + if tslassigning and ifnil({self.}XmlChildMathFont) then + begin + {self.}XmlChildMathFont := new PureWVal(self, {self.}Prefix, "mathFont"); + container_.Set({self.}XmlChildMathFont); + end + return {self.}XmlChildMathFont; +end; + +function MathPr.ReadXmlChildBrkBin(); +begin + if tslassigning and ifnil({self.}XmlChildBrkBin) then + begin + {self.}XmlChildBrkBin := new PureWVal(self, {self.}Prefix, "brkBin"); + container_.Set({self.}XmlChildBrkBin); + end + return {self.}XmlChildBrkBin; +end; + +function MathPr.ReadXmlChildBrkBinSub(); +begin + if tslassigning and ifnil({self.}XmlChildBrkBinSub) then + begin + {self.}XmlChildBrkBinSub := new PureWVal(self, {self.}Prefix, "brkBinSub"); + container_.Set({self.}XmlChildBrkBinSub); + end + return {self.}XmlChildBrkBinSub; +end; + +function MathPr.ReadXmlChildSmallFrac(); +begin + if tslassigning and ifnil({self.}XmlChildSmallFrac) then + begin + {self.}XmlChildSmallFrac := new PureWVal(self, {self.}Prefix, "smallFrac"); + container_.Set({self.}XmlChildSmallFrac); + end + return {self.}XmlChildSmallFrac; +end; + +function MathPr.ReadXmlChildLMargin(); +begin + if tslassigning and ifnil({self.}XmlChildLMargin) then + begin + {self.}XmlChildLMargin := new PureWVal(self, {self.}Prefix, "lMargin"); + container_.Set({self.}XmlChildLMargin); + end + return {self.}XmlChildLMargin; +end; + +function MathPr.ReadXmlChildRMargin(); +begin + if tslassigning and ifnil({self.}XmlChildRMargin) then + begin + {self.}XmlChildRMargin := new PureWVal(self, {self.}Prefix, "rMargin"); + container_.Set({self.}XmlChildRMargin); + end + return {self.}XmlChildRMargin; +end; + +function MathPr.ReadXmlChildDefJc(); +begin + if tslassigning and ifnil({self.}XmlChildDefJc) then + begin + {self.}XmlChildDefJc := new PureWVal(self, {self.}Prefix, "defJc"); + container_.Set({self.}XmlChildDefJc); + end + return {self.}XmlChildDefJc; +end; + +function MathPr.ReadXmlChildWrapIndent(); +begin + if tslassigning and ifnil({self.}XmlChildWrapIndent) then + begin + {self.}XmlChildWrapIndent := new PureWVal(self, {self.}Prefix, "wrapIndent"); + container_.Set({self.}XmlChildWrapIndent); + end + return {self.}XmlChildWrapIndent; +end; + +function MathPr.ReadXmlChildIntLim(); +begin + if tslassigning and ifnil({self.}XmlChildIntLim) then + begin + {self.}XmlChildIntLim := new PureWVal(self, {self.}Prefix, "intLim"); + container_.Set({self.}XmlChildIntLim); + end + return {self.}XmlChildIntLim; +end; + +function MathPr.ReadXmlChildNaryLim(); +begin + if tslassigning and ifnil({self.}XmlChildNaryLim) then + begin + {self.}XmlChildNaryLim := new PureWVal(self, {self.}Prefix, "naryLim"); + container_.Set({self.}XmlChildNaryLim); + end + return {self.}XmlChildNaryLim; +end; diff --git a/autoclass/docx/Miter@DOCX.tsf b/autoclass/docx/Miter@DOCX.tsf index d893263..92068c4 100644 --- a/autoclass/docx/Miter@DOCX.tsf +++ b/autoclass/docx/Miter@DOCX.tsf @@ -4,20 +4,19 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Miter);override; +public + + // attributes property property Lim read ReadXmlAttrLim write WriteXmlAttrLim; function ReadXmlAttrLim(); function WriteXmlAttrLim(_value); public - // Attributes + // Attributes XmlAttrLim: OpenXmlAttribute; - // Children end; @@ -33,41 +32,30 @@ end; function Miter.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Miter.Init();override; begin - {self.}XmlAttrLim := new OpenXmlAttribute(nil, "lim", nil); -end; - -function Miter.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrLim, - ); -end; - -function Miter.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "lim": makeweakref(thisFunction(WriteXmlAttrLim)), ); sorted_child_ := array( - "": -1, ); -end; - -function Miter.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Miter.Copy(_obj: Miter);override; begin - if not ifnil(_obj.XmlAttrLim.Value) then - {self.}XmlAttrLim.Value := _obj.XmlAttrLim.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Lim) then + {self.}Lim := _obj.Lim; + tslassigning := tslassigning_backup; end; function Miter.ReadXmlAttrLim(); @@ -77,5 +65,10 @@ end; function Miter.WriteXmlAttrLim(_value); begin + if ifnil({self.}XmlAttrLim) then + begin + {self.}XmlAttrLim := new OpenXmlAttribute("", "lim", nil); + attributes_[length(attributes_)] := {self.}XmlAttrLim; + end {self.}XmlAttrLim.Value := _value; end; diff --git a/autoclass/docx/Modified@DOCX.tsf b/autoclass/docx/Modified@DOCX.tsf index 0debb7c..ae25408 100644 --- a/autoclass/docx/Modified@DOCX.tsf +++ b/autoclass/docx/Modified@DOCX.tsf @@ -4,19 +4,19 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Modified);override; +public + + // attributes property property XsiType read ReadXmlAttrXsiType write WriteXmlAttrXsiType; function ReadXmlAttrXsiType(); function WriteXmlAttrXsiType(_value); public - // Attributes + // Attributes XmlAttrXsiType: OpenXmlAttribute; - // Children end; @@ -32,32 +32,27 @@ end; function Modified.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlPcdata).Create(_parent, _prefix, _local_name); end; function Modified.Init();override; begin - {self.}XmlAttrXsiType := new OpenXmlAttribute("xsi", "type", nil); -end; - -function Modified.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXsiType, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xsi:type": makeweakref(thisFunction(WriteXmlAttrXsiType)), ); end; -function Modified.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; -end; - function Modified.Copy(_obj: Modified);override; begin - if not ifnil(_obj.XmlAttrXsiType.Value) then - {self.}XmlAttrXsiType.Value := _obj.XmlAttrXsiType.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlPcdata).Copy(_obj); + if not ifnil(_obj.XsiType) then + {self.}XsiType := _obj.XsiType; + tslassigning := tslassigning_backup; end; function Modified.ReadXmlAttrXsiType(); @@ -67,5 +62,10 @@ end; function Modified.WriteXmlAttrXsiType(_value); begin + if ifnil({self.}XmlAttrXsiType) then + begin + {self.}XmlAttrXsiType := new OpenXmlAttribute("xsi", "type", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXsiType; + end {self.}XmlAttrXsiType.Value := _value; end; diff --git a/autoclass/docx/Num@DOCX.tsf b/autoclass/docx/Num@DOCX.tsf index 54757b4..6db982e 100644 --- a/autoclass/docx/Num@DOCX.tsf +++ b/autoclass/docx/Num@DOCX.tsf @@ -4,21 +4,25 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Num);override; +public + + // attributes property property NumId read ReadXmlAttrNumId write WriteXmlAttrNumId; function ReadXmlAttrNumId(); function WriteXmlAttrNumId(_value); + // normal property + property AbstractNumId read ReadXmlChildAbstractNumId; + function ReadXmlChildAbstractNumId(); + public - // Attributes + // Attributes XmlAttrNumId: OpenXmlAttribute; // Children - AbstractNumId: PureWVal; + XmlChildAbstractNumId: PureWVal; end; @@ -34,76 +38,33 @@ end; function Num.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Num.Init();override; begin - {self.}XmlAttrNumId := new OpenXmlAttribute({self.}Prefix, "numId", nil); - {self.}AbstractNumId := new PureWVal(self, {self.}Prefix, "abstractNumId"); -end; - -function Num.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrNumId, - ); -end; - -function Num.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}AbstractNumId, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "numId": makeweakref(thisFunction(WriteXmlAttrNumId)), ); sorted_child_ := array( - "": -1, - {self.}AbstractNumId.ElementName: 0, + pre + "abstractNumId": array(0, makeweakref(thisFunction(ReadXmlChildAbstractNumId))), ); -end; - -function Num.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Num.Copy(_obj: Num);override; begin - if not ifnil(_obj.XmlAttrNumId.Value) then - {self.}XmlAttrNumId.Value := _obj.XmlAttrNumId.Value; - {self.}AbstractNumId.Copy(_obj.AbstractNumId); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.NumId) then + {self.}NumId := _obj.NumId; + if not ifnil(_obj.XmlChildAbstractNumId) then + {self.}AbstractNumId.Copy(_obj.XmlChildAbstractNumId); + tslassigning := tslassigning_backup; end; function Num.ReadXmlAttrNumId(); @@ -113,5 +74,20 @@ end; function Num.WriteXmlAttrNumId(_value); begin + if ifnil({self.}XmlAttrNumId) then + begin + {self.}XmlAttrNumId := new OpenXmlAttribute({self.}Prefix, "numId", nil); + attributes_[length(attributes_)] := {self.}XmlAttrNumId; + end {self.}XmlAttrNumId.Value := _value; end; + +function Num.ReadXmlChildAbstractNumId(); +begin + if tslassigning and ifnil({self.}XmlChildAbstractNumId) then + begin + {self.}XmlChildAbstractNumId := new PureWVal(self, {self.}Prefix, "abstractNumId"); + container_.Set({self.}XmlChildAbstractNumId); + end + return {self.}XmlChildAbstractNumId; +end; diff --git a/autoclass/docx/NumFmt@DOCX.tsf b/autoclass/docx/NumFmt@DOCX.tsf index 262edc9..15b57bb 100644 --- a/autoclass/docx/NumFmt@DOCX.tsf +++ b/autoclass/docx/NumFmt@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: NumFmt);override; +public + + // attributes property property FormatCode read ReadXmlAttrFormatCode write WriteXmlAttrFormatCode; property SourceLinked read ReadXmlAttrSourceLinked write WriteXmlAttrSourceLinked; function ReadXmlAttrFormatCode(); @@ -17,11 +17,10 @@ public function WriteXmlAttrSourceLinked(_value); public - // Attributes + // Attributes XmlAttrFormatCode: OpenXmlAttribute; XmlAttrSourceLinked: OpenXmlAttribute; - // Children end; @@ -37,45 +36,33 @@ end; function NumFmt.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function NumFmt.Init();override; begin - {self.}XmlAttrFormatCode := new OpenXmlAttribute(nil, "formatCode", nil); - {self.}XmlAttrSourceLinked := new OpenXmlAttribute(nil, "sourceLinked", nil); -end; - -function NumFmt.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrFormatCode, - {self.}XmlAttrSourceLinked, - ); -end; - -function NumFmt.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "formatCode": makeweakref(thisFunction(WriteXmlAttrFormatCode)), + "sourceLinked": makeweakref(thisFunction(WriteXmlAttrSourceLinked)), ); sorted_child_ := array( - "": -1, ); -end; - -function NumFmt.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function NumFmt.Copy(_obj: NumFmt);override; begin - if not ifnil(_obj.XmlAttrFormatCode.Value) then - {self.}XmlAttrFormatCode.Value := _obj.XmlAttrFormatCode.Value; - if not ifnil(_obj.XmlAttrSourceLinked.Value) then - {self.}XmlAttrSourceLinked.Value := _obj.XmlAttrSourceLinked.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.FormatCode) then + {self.}FormatCode := _obj.FormatCode; + if not ifnil(_obj.SourceLinked) then + {self.}SourceLinked := _obj.SourceLinked; + tslassigning := tslassigning_backup; end; function NumFmt.ReadXmlAttrFormatCode(); @@ -85,6 +72,11 @@ end; function NumFmt.WriteXmlAttrFormatCode(_value); begin + if ifnil({self.}XmlAttrFormatCode) then + begin + {self.}XmlAttrFormatCode := new OpenXmlAttribute("", "formatCode", nil); + attributes_[length(attributes_)] := {self.}XmlAttrFormatCode; + end {self.}XmlAttrFormatCode.Value := _value; end; @@ -95,5 +87,10 @@ end; function NumFmt.WriteXmlAttrSourceLinked(_value); begin + if ifnil({self.}XmlAttrSourceLinked) then + begin + {self.}XmlAttrSourceLinked := new OpenXmlAttribute("", "sourceLinked", nil); + attributes_[length(attributes_)] := {self.}XmlAttrSourceLinked; + end {self.}XmlAttrSourceLinked.Value := _value; end; diff --git a/autoclass/docx/NumPr@DOCX.tsf b/autoclass/docx/NumPr@DOCX.tsf index 8db28d3..b509301 100644 --- a/autoclass/docx/NumPr@DOCX.tsf +++ b/autoclass/docx/NumPr@DOCX.tsf @@ -4,17 +4,20 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: NumPr);override; public - // Attributes + // normal property + property Ilvl read ReadXmlChildIlvl; + property NumId read ReadXmlChildNumId; + function ReadXmlChildIlvl(); + function ReadXmlChildNumId(); + +public // Children - Ilvl: PureWVal; - NumId: PureWVal; + XmlChildIlvl: PureWVal; + XmlChildNumId: PureWVal; end; @@ -30,74 +33,51 @@ end; function NumPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function NumPr.Init();override; begin - {self.}Ilvl := new PureWVal(self, {self.}Prefix, "ilvl"); - {self.}NumId := new PureWVal(self, {self.}Prefix, "numId"); -end; - -function NumPr.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function NumPr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Ilvl, - 1: {self.}NumId, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}Ilvl.ElementName: 0, - {self.}NumId.ElementName: 1, + pre + "ilvl": array(0, makeweakref(thisFunction(ReadXmlChildIlvl))), + pre + "numId": array(1, makeweakref(thisFunction(ReadXmlChildNumId))), ); -end; - -function NumPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function NumPr.Copy(_obj: NumPr);override; begin - {self.}Ilvl.Copy(_obj.Ilvl); - {self.}NumId.Copy(_obj.NumId); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildIlvl) then + {self.}Ilvl.Copy(_obj.XmlChildIlvl); + if not ifnil(_obj.XmlChildNumId) then + {self.}NumId.Copy(_obj.XmlChildNumId); + tslassigning := tslassigning_backup; +end; + +function NumPr.ReadXmlChildIlvl(); +begin + if tslassigning and ifnil({self.}XmlChildIlvl) then + begin + {self.}XmlChildIlvl := new PureWVal(self, {self.}Prefix, "ilvl"); + container_.Set({self.}XmlChildIlvl); + end + return {self.}XmlChildIlvl; +end; + +function NumPr.ReadXmlChildNumId(); +begin + if tslassigning and ifnil({self.}XmlChildNumId) then + begin + {self.}XmlChildNumId := new PureWVal(self, {self.}Prefix, "numId"); + container_.Set({self.}XmlChildNumId); + end + return {self.}XmlChildNumId; end; diff --git a/autoclass/docx/NumRef@DOCX.tsf b/autoclass/docx/NumRef@DOCX.tsf index c0e8630..17fd9bd 100644 --- a/autoclass/docx/NumRef@DOCX.tsf +++ b/autoclass/docx/NumRef@DOCX.tsf @@ -4,17 +4,22 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: NumRef);override; public - // Attributes + // pcdata property + property F read ReadXmlChildF; + function ReadXmlChildF(); + + // normal property + property NumCache read ReadXmlChildNumCache; + function ReadXmlChildNumCache(); + +public // Children - F: OpenXmlPcdata; - NumCache: Cache; + XmlChildF: OpenXmlPcdata; + XmlChildNumCache: Cache; end; @@ -30,74 +35,51 @@ end; function NumRef.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function NumRef.Init();override; begin - {self.}F := new OpenXmlPcdata(self, {self.}Prefix, "f"); - {self.}NumCache := new Cache(self, {self.}Prefix, "numCache"); -end; - -function NumRef.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function NumRef.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}F, - 1: {self.}NumCache, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}F.ElementName: 0, - {self.}NumCache.ElementName: 1, + pre + "f": array(0, makeweakref(thisFunction(ReadXmlChildF))), + pre + "numCache": array(1, makeweakref(thisFunction(ReadXmlChildNumCache))), ); -end; - -function NumRef.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function NumRef.Copy(_obj: NumRef);override; begin - {self.}F.Copy(_obj.F); - {self.}NumCache.Copy(_obj.NumCache); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildF) then + {self.}F.Copy(_obj.XmlChildF); + if not ifnil(_obj.XmlChildNumCache) then + {self.}NumCache.Copy(_obj.XmlChildNumCache); + tslassigning := tslassigning_backup; +end; + +function NumRef.ReadXmlChildF(); +begin + if tslassigning and ifnil({self.}XmlChildF) then + begin + {self.}XmlChildF := new OpenXmlPcdata(self, {self.}Prefix, "f"); + container_.Set({self.}XmlChildF); + end + return {self.}XmlChildF; +end; + +function NumRef.ReadXmlChildNumCache(); +begin + if tslassigning and ifnil({self.}XmlChildNumCache) then + begin + {self.}XmlChildNumCache := new Cache(self, {self.}Prefix, "numCache"); + container_.Set({self.}XmlChildNumCache); + end + return {self.}XmlChildNumCache; end; diff --git a/autoclass/docx/Numbering@DOCX.tsf b/autoclass/docx/Numbering@DOCX.tsf index 059da29..ba62c24 100644 --- a/autoclass/docx/Numbering@DOCX.tsf +++ b/autoclass/docx/Numbering@DOCX.tsf @@ -4,20 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Numbering);override; - function AddAbstractNum(): AbstractNum; - function AddNum(): Num; - function AppendAbstractNum(): AbstractNum; - function AppendNum(): Num; - property AbstractNums read ReadAbstractNums; - property Nums read ReadNums; - function ReadAbstractNums(_index); - function ReadNums(_index); +public + // attributes property property XmlnsWpc read ReadXmlAttrXmlnsWpc write WriteXmlAttrXmlnsWpc; property XmlnsCx read ReadXmlAttrXmlnsCx write WriteXmlAttrXmlnsCx; property XmlnsCx1 read ReadXmlAttrXmlnsCx1 write WriteXmlAttrXmlnsCx1; @@ -124,8 +115,18 @@ public function ReadXmlAttrMcIgnorable(); function WriteXmlAttrMcIgnorable(_value); + // multi property + property AbstractNums read ReadAbstractNums; + property Nums read ReadNums; + function ReadAbstractNums(_index); + function ReadNums(_index); + function AddAbstractNum(): AbstractNum; + function AddNum(): Num; + function AppendAbstractNum(): AbstractNum; + function AppendNum(): Num; + public - // Attributes + // Attributes XmlAttrXmlnsWpc: OpenXmlAttribute; XmlAttrXmlnsCx: OpenXmlAttribute; XmlAttrXmlnsCx1: OpenXmlAttribute; @@ -178,282 +179,134 @@ end; function Numbering.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Numbering.Init();override; begin - {self.}XmlAttrXmlnsWpc := new OpenXmlAttribute("xmlns", "wpc", nil); - {self.}XmlAttrXmlnsCx := new OpenXmlAttribute("xmlns", "cx", nil); - {self.}XmlAttrXmlnsCx1 := new OpenXmlAttribute("xmlns", "cx1", nil); - {self.}XmlAttrXmlnsCx2 := new OpenXmlAttribute("xmlns", "cx2", nil); - {self.}XmlAttrXmlnsCx3 := new OpenXmlAttribute("xmlns", "cx3", nil); - {self.}XmlAttrXmlnsCx4 := new OpenXmlAttribute("xmlns", "cx4", nil); - {self.}XmlAttrXmlnsCx5 := new OpenXmlAttribute("xmlns", "cx5", nil); - {self.}XmlAttrXmlnsCx6 := new OpenXmlAttribute("xmlns", "cx6", nil); - {self.}XmlAttrXmlnsCx7 := new OpenXmlAttribute("xmlns", "cx7", nil); - {self.}XmlAttrXmlnsCx8 := new OpenXmlAttribute("xmlns", "cx8", nil); - {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); - {self.}XmlAttrXmlnsAink := new OpenXmlAttribute("xmlns", "aink", nil); - {self.}XmlAttrXmlnsAm3d := new OpenXmlAttribute("xmlns", "am3d", nil); - {self.}XmlAttrXmlnsO := new OpenXmlAttribute("xmlns", "o", nil); - {self.}XmlAttrXmlnsOel := new OpenXmlAttribute("xmlns", "oel", nil); - {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); - {self.}XmlAttrXmlnsM := new OpenXmlAttribute("xmlns", "m", nil); - {self.}XmlAttrXmlnsV := new OpenXmlAttribute("xmlns", "v", nil); - {self.}XmlAttrXmlnsWp14 := new OpenXmlAttribute("xmlns", "wp14", nil); - {self.}XmlAttrXmlnsWp := new OpenXmlAttribute("xmlns", "wp", nil); - {self.}XmlAttrXmlnsW10 := new OpenXmlAttribute("xmlns", "w10", nil); - {self.}XmlAttrXmlnsW := new OpenXmlAttribute("xmlns", "w", nil); - {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); - {self.}XmlAttrXmlnsW15 := new OpenXmlAttribute("xmlns", "w15", nil); - {self.}XmlAttrXmlnsW16Cex := new OpenXmlAttribute("xmlns", "w16cex", nil); - {self.}XmlAttrXmlnsW16Cid := new OpenXmlAttribute("xmlns", "w16cid", nil); - {self.}XmlAttrXmlnsW16 := new OpenXmlAttribute("xmlns", "w16", nil); - {self.}XmlAttrXmlnsW16Du := new OpenXmlAttribute("xmlns", "w16du", nil); - {self.}XmlAttrXmlnsW16sdtdh := new OpenXmlAttribute("xmlns", "w16sdtdh", nil); - {self.}XmlAttrXmlnsW16se := new OpenXmlAttribute("xmlns", "w16se", nil); - {self.}XmlAttrXmlnsWpg := new OpenXmlAttribute("xmlns", "wpg", nil); - {self.}XmlAttrXmlnsWpi := new OpenXmlAttribute("xmlns", "wpi", nil); - {self.}XmlAttrXmlnsWne := new OpenXmlAttribute("xmlns", "wne", nil); - {self.}XmlAttrXmlnsWps := new OpenXmlAttribute("xmlns", "wps", nil); - {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); -end; - -function Numbering.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXmlnsWpc, - {self.}XmlAttrXmlnsCx, - {self.}XmlAttrXmlnsCx1, - {self.}XmlAttrXmlnsCx2, - {self.}XmlAttrXmlnsCx3, - {self.}XmlAttrXmlnsCx4, - {self.}XmlAttrXmlnsCx5, - {self.}XmlAttrXmlnsCx6, - {self.}XmlAttrXmlnsCx7, - {self.}XmlAttrXmlnsCx8, - {self.}XmlAttrXmlnsMc, - {self.}XmlAttrXmlnsAink, - {self.}XmlAttrXmlnsAm3d, - {self.}XmlAttrXmlnsO, - {self.}XmlAttrXmlnsOel, - {self.}XmlAttrXmlnsR, - {self.}XmlAttrXmlnsM, - {self.}XmlAttrXmlnsV, - {self.}XmlAttrXmlnsWp14, - {self.}XmlAttrXmlnsWp, - {self.}XmlAttrXmlnsW10, - {self.}XmlAttrXmlnsW, - {self.}XmlAttrXmlnsW14, - {self.}XmlAttrXmlnsW15, - {self.}XmlAttrXmlnsW16Cex, - {self.}XmlAttrXmlnsW16Cid, - {self.}XmlAttrXmlnsW16, - {self.}XmlAttrXmlnsW16Du, - {self.}XmlAttrXmlnsW16sdtdh, - {self.}XmlAttrXmlnsW16se, - {self.}XmlAttrXmlnsWpg, - {self.}XmlAttrXmlnsWpi, - {self.}XmlAttrXmlnsWne, - {self.}XmlAttrXmlnsWps, - {self.}XmlAttrMcIgnorable, - ); -end; - -function Numbering.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns:wpc": makeweakref(thisFunction(WriteXmlAttrXmlnsWpc)), + "xmlns:cx": makeweakref(thisFunction(WriteXmlAttrXmlnsCx)), + "xmlns:cx1": makeweakref(thisFunction(WriteXmlAttrXmlnsCx1)), + "xmlns:cx2": makeweakref(thisFunction(WriteXmlAttrXmlnsCx2)), + "xmlns:cx3": makeweakref(thisFunction(WriteXmlAttrXmlnsCx3)), + "xmlns:cx4": makeweakref(thisFunction(WriteXmlAttrXmlnsCx4)), + "xmlns:cx5": makeweakref(thisFunction(WriteXmlAttrXmlnsCx5)), + "xmlns:cx6": makeweakref(thisFunction(WriteXmlAttrXmlnsCx6)), + "xmlns:cx7": makeweakref(thisFunction(WriteXmlAttrXmlnsCx7)), + "xmlns:cx8": makeweakref(thisFunction(WriteXmlAttrXmlnsCx8)), + "xmlns:mc": makeweakref(thisFunction(WriteXmlAttrXmlnsMc)), + "xmlns:aink": makeweakref(thisFunction(WriteXmlAttrXmlnsAink)), + "xmlns:am3d": makeweakref(thisFunction(WriteXmlAttrXmlnsAm3d)), + "xmlns:o": makeweakref(thisFunction(WriteXmlAttrXmlnsO)), + "xmlns:oel": makeweakref(thisFunction(WriteXmlAttrXmlnsOel)), + "xmlns:r": makeweakref(thisFunction(WriteXmlAttrXmlnsR)), + "xmlns:m": makeweakref(thisFunction(WriteXmlAttrXmlnsM)), + "xmlns:v": makeweakref(thisFunction(WriteXmlAttrXmlnsV)), + "xmlns:wp14": makeweakref(thisFunction(WriteXmlAttrXmlnsWp14)), + "xmlns:wp": makeweakref(thisFunction(WriteXmlAttrXmlnsWp)), + "xmlns:w10": makeweakref(thisFunction(WriteXmlAttrXmlnsW10)), + "xmlns:w": makeweakref(thisFunction(WriteXmlAttrXmlnsW)), + "xmlns:w14": makeweakref(thisFunction(WriteXmlAttrXmlnsW14)), + "xmlns:w15": makeweakref(thisFunction(WriteXmlAttrXmlnsW15)), + "xmlns:w16cex": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Cex)), + "xmlns:w16cid": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Cid)), + "xmlns:w16": makeweakref(thisFunction(WriteXmlAttrXmlnsW16)), + "xmlns:w16du": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Du)), + "xmlns:w16sdtdh": makeweakref(thisFunction(WriteXmlAttrXmlnsW16sdtdh)), + "xmlns:w16se": makeweakref(thisFunction(WriteXmlAttrXmlnsW16se)), + "xmlns:wpg": makeweakref(thisFunction(WriteXmlAttrXmlnsWpg)), + "xmlns:wpi": makeweakref(thisFunction(WriteXmlAttrXmlnsWpi)), + "xmlns:wne": makeweakref(thisFunction(WriteXmlAttrXmlnsWne)), + "xmlns:wps": makeweakref(thisFunction(WriteXmlAttrXmlnsWps)), + "mc:Ignorable": makeweakref(thisFunction(WriteXmlAttrMcIgnorable)), ); sorted_child_ := array( - "": -1, + pre + "abstractNum": array(0, makeweakref(thisFunction(AppendAbstractNum))), + pre + "num": array(1, makeweakref(thisFunction(AppendNum))), ); -end; - -function Numbering.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "abstractNum": obj := {self.}AppendAbstractNum(); - pre + "num": obj := {self.}AppendNum(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Numbering.Copy(_obj: Numbering);override; begin - if not ifnil(_obj.XmlAttrXmlnsWpc.Value) then - {self.}XmlAttrXmlnsWpc.Value := _obj.XmlAttrXmlnsWpc.Value; - if not ifnil(_obj.XmlAttrXmlnsCx.Value) then - {self.}XmlAttrXmlnsCx.Value := _obj.XmlAttrXmlnsCx.Value; - if not ifnil(_obj.XmlAttrXmlnsCx1.Value) then - {self.}XmlAttrXmlnsCx1.Value := _obj.XmlAttrXmlnsCx1.Value; - if not ifnil(_obj.XmlAttrXmlnsCx2.Value) then - {self.}XmlAttrXmlnsCx2.Value := _obj.XmlAttrXmlnsCx2.Value; - if not ifnil(_obj.XmlAttrXmlnsCx3.Value) then - {self.}XmlAttrXmlnsCx3.Value := _obj.XmlAttrXmlnsCx3.Value; - if not ifnil(_obj.XmlAttrXmlnsCx4.Value) then - {self.}XmlAttrXmlnsCx4.Value := _obj.XmlAttrXmlnsCx4.Value; - if not ifnil(_obj.XmlAttrXmlnsCx5.Value) then - {self.}XmlAttrXmlnsCx5.Value := _obj.XmlAttrXmlnsCx5.Value; - if not ifnil(_obj.XmlAttrXmlnsCx6.Value) then - {self.}XmlAttrXmlnsCx6.Value := _obj.XmlAttrXmlnsCx6.Value; - if not ifnil(_obj.XmlAttrXmlnsCx7.Value) then - {self.}XmlAttrXmlnsCx7.Value := _obj.XmlAttrXmlnsCx7.Value; - if not ifnil(_obj.XmlAttrXmlnsCx8.Value) then - {self.}XmlAttrXmlnsCx8.Value := _obj.XmlAttrXmlnsCx8.Value; - if not ifnil(_obj.XmlAttrXmlnsMc.Value) then - {self.}XmlAttrXmlnsMc.Value := _obj.XmlAttrXmlnsMc.Value; - if not ifnil(_obj.XmlAttrXmlnsAink.Value) then - {self.}XmlAttrXmlnsAink.Value := _obj.XmlAttrXmlnsAink.Value; - if not ifnil(_obj.XmlAttrXmlnsAm3d.Value) then - {self.}XmlAttrXmlnsAm3d.Value := _obj.XmlAttrXmlnsAm3d.Value; - if not ifnil(_obj.XmlAttrXmlnsO.Value) then - {self.}XmlAttrXmlnsO.Value := _obj.XmlAttrXmlnsO.Value; - if not ifnil(_obj.XmlAttrXmlnsOel.Value) then - {self.}XmlAttrXmlnsOel.Value := _obj.XmlAttrXmlnsOel.Value; - if not ifnil(_obj.XmlAttrXmlnsR.Value) then - {self.}XmlAttrXmlnsR.Value := _obj.XmlAttrXmlnsR.Value; - if not ifnil(_obj.XmlAttrXmlnsM.Value) then - {self.}XmlAttrXmlnsM.Value := _obj.XmlAttrXmlnsM.Value; - if not ifnil(_obj.XmlAttrXmlnsV.Value) then - {self.}XmlAttrXmlnsV.Value := _obj.XmlAttrXmlnsV.Value; - if not ifnil(_obj.XmlAttrXmlnsWp14.Value) then - {self.}XmlAttrXmlnsWp14.Value := _obj.XmlAttrXmlnsWp14.Value; - if not ifnil(_obj.XmlAttrXmlnsWp.Value) then - {self.}XmlAttrXmlnsWp.Value := _obj.XmlAttrXmlnsWp.Value; - if not ifnil(_obj.XmlAttrXmlnsW10.Value) then - {self.}XmlAttrXmlnsW10.Value := _obj.XmlAttrXmlnsW10.Value; - if not ifnil(_obj.XmlAttrXmlnsW.Value) then - {self.}XmlAttrXmlnsW.Value := _obj.XmlAttrXmlnsW.Value; - if not ifnil(_obj.XmlAttrXmlnsW14.Value) then - {self.}XmlAttrXmlnsW14.Value := _obj.XmlAttrXmlnsW14.Value; - if not ifnil(_obj.XmlAttrXmlnsW15.Value) then - {self.}XmlAttrXmlnsW15.Value := _obj.XmlAttrXmlnsW15.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Cex.Value) then - {self.}XmlAttrXmlnsW16Cex.Value := _obj.XmlAttrXmlnsW16Cex.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Cid.Value) then - {self.}XmlAttrXmlnsW16Cid.Value := _obj.XmlAttrXmlnsW16Cid.Value; - if not ifnil(_obj.XmlAttrXmlnsW16.Value) then - {self.}XmlAttrXmlnsW16.Value := _obj.XmlAttrXmlnsW16.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Du.Value) then - {self.}XmlAttrXmlnsW16Du.Value := _obj.XmlAttrXmlnsW16Du.Value; - if not ifnil(_obj.XmlAttrXmlnsW16sdtdh.Value) then - {self.}XmlAttrXmlnsW16sdtdh.Value := _obj.XmlAttrXmlnsW16sdtdh.Value; - if not ifnil(_obj.XmlAttrXmlnsW16se.Value) then - {self.}XmlAttrXmlnsW16se.Value := _obj.XmlAttrXmlnsW16se.Value; - if not ifnil(_obj.XmlAttrXmlnsWpg.Value) then - {self.}XmlAttrXmlnsWpg.Value := _obj.XmlAttrXmlnsWpg.Value; - if not ifnil(_obj.XmlAttrXmlnsWpi.Value) then - {self.}XmlAttrXmlnsWpi.Value := _obj.XmlAttrXmlnsWpi.Value; - if not ifnil(_obj.XmlAttrXmlnsWne.Value) then - {self.}XmlAttrXmlnsWne.Value := _obj.XmlAttrXmlnsWne.Value; - if not ifnil(_obj.XmlAttrXmlnsWps.Value) then - {self.}XmlAttrXmlnsWps.Value := _obj.XmlAttrXmlnsWps.Value; - if not ifnil(_obj.XmlAttrMcIgnorable.Value) then - {self.}XmlAttrMcIgnorable.Value := _obj.XmlAttrMcIgnorable.Value; -end; - -function Numbering.AddAbstractNum(): AbstractNum; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "abstractNum" then break; - end - obj := new AbstractNum(self, {self.}Prefix, "abstractNum"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function Numbering.AddNum(): Num; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "num" then break; - end - obj := new Num(self, {self.}Prefix, "num"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function Numbering.AppendAbstractNum(): AbstractNum; -begin - obj := new AbstractNum(self, {self.}Prefix, "abstractNum"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function Numbering.AppendNum(): Num; -begin - obj := new Num(self, {self.}Prefix, "num"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function Numbering.ReadAbstractNums(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "abstractNum" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; - -function Numbering.ReadNums(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "num" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlnsWpc) then + {self.}XmlnsWpc := _obj.XmlnsWpc; + if not ifnil(_obj.XmlnsCx) then + {self.}XmlnsCx := _obj.XmlnsCx; + if not ifnil(_obj.XmlnsCx1) then + {self.}XmlnsCx1 := _obj.XmlnsCx1; + if not ifnil(_obj.XmlnsCx2) then + {self.}XmlnsCx2 := _obj.XmlnsCx2; + if not ifnil(_obj.XmlnsCx3) then + {self.}XmlnsCx3 := _obj.XmlnsCx3; + if not ifnil(_obj.XmlnsCx4) then + {self.}XmlnsCx4 := _obj.XmlnsCx4; + if not ifnil(_obj.XmlnsCx5) then + {self.}XmlnsCx5 := _obj.XmlnsCx5; + if not ifnil(_obj.XmlnsCx6) then + {self.}XmlnsCx6 := _obj.XmlnsCx6; + if not ifnil(_obj.XmlnsCx7) then + {self.}XmlnsCx7 := _obj.XmlnsCx7; + if not ifnil(_obj.XmlnsCx8) then + {self.}XmlnsCx8 := _obj.XmlnsCx8; + if not ifnil(_obj.XmlnsMc) then + {self.}XmlnsMc := _obj.XmlnsMc; + if not ifnil(_obj.XmlnsAink) then + {self.}XmlnsAink := _obj.XmlnsAink; + if not ifnil(_obj.XmlnsAm3d) then + {self.}XmlnsAm3d := _obj.XmlnsAm3d; + if not ifnil(_obj.XmlnsO) then + {self.}XmlnsO := _obj.XmlnsO; + if not ifnil(_obj.XmlnsOel) then + {self.}XmlnsOel := _obj.XmlnsOel; + if not ifnil(_obj.XmlnsR) then + {self.}XmlnsR := _obj.XmlnsR; + if not ifnil(_obj.XmlnsM) then + {self.}XmlnsM := _obj.XmlnsM; + if not ifnil(_obj.XmlnsV) then + {self.}XmlnsV := _obj.XmlnsV; + if not ifnil(_obj.XmlnsWp14) then + {self.}XmlnsWp14 := _obj.XmlnsWp14; + if not ifnil(_obj.XmlnsWp) then + {self.}XmlnsWp := _obj.XmlnsWp; + if not ifnil(_obj.XmlnsW10) then + {self.}XmlnsW10 := _obj.XmlnsW10; + if not ifnil(_obj.XmlnsW) then + {self.}XmlnsW := _obj.XmlnsW; + if not ifnil(_obj.XmlnsW14) then + {self.}XmlnsW14 := _obj.XmlnsW14; + if not ifnil(_obj.XmlnsW15) then + {self.}XmlnsW15 := _obj.XmlnsW15; + if not ifnil(_obj.XmlnsW16Cex) then + {self.}XmlnsW16Cex := _obj.XmlnsW16Cex; + if not ifnil(_obj.XmlnsW16Cid) then + {self.}XmlnsW16Cid := _obj.XmlnsW16Cid; + if not ifnil(_obj.XmlnsW16) then + {self.}XmlnsW16 := _obj.XmlnsW16; + if not ifnil(_obj.XmlnsW16Du) then + {self.}XmlnsW16Du := _obj.XmlnsW16Du; + if not ifnil(_obj.XmlnsW16sdtdh) then + {self.}XmlnsW16sdtdh := _obj.XmlnsW16sdtdh; + if not ifnil(_obj.XmlnsW16se) then + {self.}XmlnsW16se := _obj.XmlnsW16se; + if not ifnil(_obj.XmlnsWpg) then + {self.}XmlnsWpg := _obj.XmlnsWpg; + if not ifnil(_obj.XmlnsWpi) then + {self.}XmlnsWpi := _obj.XmlnsWpi; + if not ifnil(_obj.XmlnsWne) then + {self.}XmlnsWne := _obj.XmlnsWne; + if not ifnil(_obj.XmlnsWps) then + {self.}XmlnsWps := _obj.XmlnsWps; + if not ifnil(_obj.McIgnorable) then + {self.}McIgnorable := _obj.McIgnorable; + tslassigning := tslassigning_backup; end; function Numbering.ReadXmlAttrXmlnsWpc(); @@ -463,6 +316,11 @@ end; function Numbering.WriteXmlAttrXmlnsWpc(_value); begin + if ifnil({self.}XmlAttrXmlnsWpc) then + begin + {self.}XmlAttrXmlnsWpc := new OpenXmlAttribute("xmlns", "wpc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpc; + end {self.}XmlAttrXmlnsWpc.Value := _value; end; @@ -473,6 +331,11 @@ end; function Numbering.WriteXmlAttrXmlnsCx(_value); begin + if ifnil({self.}XmlAttrXmlnsCx) then + begin + {self.}XmlAttrXmlnsCx := new OpenXmlAttribute("xmlns", "cx", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx; + end {self.}XmlAttrXmlnsCx.Value := _value; end; @@ -483,6 +346,11 @@ end; function Numbering.WriteXmlAttrXmlnsCx1(_value); begin + if ifnil({self.}XmlAttrXmlnsCx1) then + begin + {self.}XmlAttrXmlnsCx1 := new OpenXmlAttribute("xmlns", "cx1", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx1; + end {self.}XmlAttrXmlnsCx1.Value := _value; end; @@ -493,6 +361,11 @@ end; function Numbering.WriteXmlAttrXmlnsCx2(_value); begin + if ifnil({self.}XmlAttrXmlnsCx2) then + begin + {self.}XmlAttrXmlnsCx2 := new OpenXmlAttribute("xmlns", "cx2", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx2; + end {self.}XmlAttrXmlnsCx2.Value := _value; end; @@ -503,6 +376,11 @@ end; function Numbering.WriteXmlAttrXmlnsCx3(_value); begin + if ifnil({self.}XmlAttrXmlnsCx3) then + begin + {self.}XmlAttrXmlnsCx3 := new OpenXmlAttribute("xmlns", "cx3", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx3; + end {self.}XmlAttrXmlnsCx3.Value := _value; end; @@ -513,6 +391,11 @@ end; function Numbering.WriteXmlAttrXmlnsCx4(_value); begin + if ifnil({self.}XmlAttrXmlnsCx4) then + begin + {self.}XmlAttrXmlnsCx4 := new OpenXmlAttribute("xmlns", "cx4", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx4; + end {self.}XmlAttrXmlnsCx4.Value := _value; end; @@ -523,6 +406,11 @@ end; function Numbering.WriteXmlAttrXmlnsCx5(_value); begin + if ifnil({self.}XmlAttrXmlnsCx5) then + begin + {self.}XmlAttrXmlnsCx5 := new OpenXmlAttribute("xmlns", "cx5", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx5; + end {self.}XmlAttrXmlnsCx5.Value := _value; end; @@ -533,6 +421,11 @@ end; function Numbering.WriteXmlAttrXmlnsCx6(_value); begin + if ifnil({self.}XmlAttrXmlnsCx6) then + begin + {self.}XmlAttrXmlnsCx6 := new OpenXmlAttribute("xmlns", "cx6", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx6; + end {self.}XmlAttrXmlnsCx6.Value := _value; end; @@ -543,6 +436,11 @@ end; function Numbering.WriteXmlAttrXmlnsCx7(_value); begin + if ifnil({self.}XmlAttrXmlnsCx7) then + begin + {self.}XmlAttrXmlnsCx7 := new OpenXmlAttribute("xmlns", "cx7", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx7; + end {self.}XmlAttrXmlnsCx7.Value := _value; end; @@ -553,6 +451,11 @@ end; function Numbering.WriteXmlAttrXmlnsCx8(_value); begin + if ifnil({self.}XmlAttrXmlnsCx8) then + begin + {self.}XmlAttrXmlnsCx8 := new OpenXmlAttribute("xmlns", "cx8", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsCx8; + end {self.}XmlAttrXmlnsCx8.Value := _value; end; @@ -563,6 +466,11 @@ end; function Numbering.WriteXmlAttrXmlnsMc(_value); begin + if ifnil({self.}XmlAttrXmlnsMc) then + begin + {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsMc; + end {self.}XmlAttrXmlnsMc.Value := _value; end; @@ -573,6 +481,11 @@ end; function Numbering.WriteXmlAttrXmlnsAink(_value); begin + if ifnil({self.}XmlAttrXmlnsAink) then + begin + {self.}XmlAttrXmlnsAink := new OpenXmlAttribute("xmlns", "aink", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsAink; + end {self.}XmlAttrXmlnsAink.Value := _value; end; @@ -583,6 +496,11 @@ end; function Numbering.WriteXmlAttrXmlnsAm3d(_value); begin + if ifnil({self.}XmlAttrXmlnsAm3d) then + begin + {self.}XmlAttrXmlnsAm3d := new OpenXmlAttribute("xmlns", "am3d", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsAm3d; + end {self.}XmlAttrXmlnsAm3d.Value := _value; end; @@ -593,6 +511,11 @@ end; function Numbering.WriteXmlAttrXmlnsO(_value); begin + if ifnil({self.}XmlAttrXmlnsO) then + begin + {self.}XmlAttrXmlnsO := new OpenXmlAttribute("xmlns", "o", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsO; + end {self.}XmlAttrXmlnsO.Value := _value; end; @@ -603,6 +526,11 @@ end; function Numbering.WriteXmlAttrXmlnsOel(_value); begin + if ifnil({self.}XmlAttrXmlnsOel) then + begin + {self.}XmlAttrXmlnsOel := new OpenXmlAttribute("xmlns", "oel", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsOel; + end {self.}XmlAttrXmlnsOel.Value := _value; end; @@ -613,6 +541,11 @@ end; function Numbering.WriteXmlAttrXmlnsR(_value); begin + if ifnil({self.}XmlAttrXmlnsR) then + begin + {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsR; + end {self.}XmlAttrXmlnsR.Value := _value; end; @@ -623,6 +556,11 @@ end; function Numbering.WriteXmlAttrXmlnsM(_value); begin + if ifnil({self.}XmlAttrXmlnsM) then + begin + {self.}XmlAttrXmlnsM := new OpenXmlAttribute("xmlns", "m", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsM; + end {self.}XmlAttrXmlnsM.Value := _value; end; @@ -633,6 +571,11 @@ end; function Numbering.WriteXmlAttrXmlnsV(_value); begin + if ifnil({self.}XmlAttrXmlnsV) then + begin + {self.}XmlAttrXmlnsV := new OpenXmlAttribute("xmlns", "v", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsV; + end {self.}XmlAttrXmlnsV.Value := _value; end; @@ -643,6 +586,11 @@ end; function Numbering.WriteXmlAttrXmlnsWp14(_value); begin + if ifnil({self.}XmlAttrXmlnsWp14) then + begin + {self.}XmlAttrXmlnsWp14 := new OpenXmlAttribute("xmlns", "wp14", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWp14; + end {self.}XmlAttrXmlnsWp14.Value := _value; end; @@ -653,6 +601,11 @@ end; function Numbering.WriteXmlAttrXmlnsWp(_value); begin + if ifnil({self.}XmlAttrXmlnsWp) then + begin + {self.}XmlAttrXmlnsWp := new OpenXmlAttribute("xmlns", "wp", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWp; + end {self.}XmlAttrXmlnsWp.Value := _value; end; @@ -663,6 +616,11 @@ end; function Numbering.WriteXmlAttrXmlnsW10(_value); begin + if ifnil({self.}XmlAttrXmlnsW10) then + begin + {self.}XmlAttrXmlnsW10 := new OpenXmlAttribute("xmlns", "w10", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW10; + end {self.}XmlAttrXmlnsW10.Value := _value; end; @@ -673,6 +631,11 @@ end; function Numbering.WriteXmlAttrXmlnsW(_value); begin + if ifnil({self.}XmlAttrXmlnsW) then + begin + {self.}XmlAttrXmlnsW := new OpenXmlAttribute("xmlns", "w", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW; + end {self.}XmlAttrXmlnsW.Value := _value; end; @@ -683,6 +646,11 @@ end; function Numbering.WriteXmlAttrXmlnsW14(_value); begin + if ifnil({self.}XmlAttrXmlnsW14) then + begin + {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW14; + end {self.}XmlAttrXmlnsW14.Value := _value; end; @@ -693,6 +661,11 @@ end; function Numbering.WriteXmlAttrXmlnsW15(_value); begin + if ifnil({self.}XmlAttrXmlnsW15) then + begin + {self.}XmlAttrXmlnsW15 := new OpenXmlAttribute("xmlns", "w15", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW15; + end {self.}XmlAttrXmlnsW15.Value := _value; end; @@ -703,6 +676,11 @@ end; function Numbering.WriteXmlAttrXmlnsW16Cex(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Cex) then + begin + {self.}XmlAttrXmlnsW16Cex := new OpenXmlAttribute("xmlns", "w16cex", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Cex; + end {self.}XmlAttrXmlnsW16Cex.Value := _value; end; @@ -713,6 +691,11 @@ end; function Numbering.WriteXmlAttrXmlnsW16Cid(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Cid) then + begin + {self.}XmlAttrXmlnsW16Cid := new OpenXmlAttribute("xmlns", "w16cid", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Cid; + end {self.}XmlAttrXmlnsW16Cid.Value := _value; end; @@ -723,6 +706,11 @@ end; function Numbering.WriteXmlAttrXmlnsW16(_value); begin + if ifnil({self.}XmlAttrXmlnsW16) then + begin + {self.}XmlAttrXmlnsW16 := new OpenXmlAttribute("xmlns", "w16", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16; + end {self.}XmlAttrXmlnsW16.Value := _value; end; @@ -733,6 +721,11 @@ end; function Numbering.WriteXmlAttrXmlnsW16Du(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Du) then + begin + {self.}XmlAttrXmlnsW16Du := new OpenXmlAttribute("xmlns", "w16du", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Du; + end {self.}XmlAttrXmlnsW16Du.Value := _value; end; @@ -743,6 +736,11 @@ end; function Numbering.WriteXmlAttrXmlnsW16sdtdh(_value); begin + if ifnil({self.}XmlAttrXmlnsW16sdtdh) then + begin + {self.}XmlAttrXmlnsW16sdtdh := new OpenXmlAttribute("xmlns", "w16sdtdh", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16sdtdh; + end {self.}XmlAttrXmlnsW16sdtdh.Value := _value; end; @@ -753,6 +751,11 @@ end; function Numbering.WriteXmlAttrXmlnsW16se(_value); begin + if ifnil({self.}XmlAttrXmlnsW16se) then + begin + {self.}XmlAttrXmlnsW16se := new OpenXmlAttribute("xmlns", "w16se", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16se; + end {self.}XmlAttrXmlnsW16se.Value := _value; end; @@ -763,6 +766,11 @@ end; function Numbering.WriteXmlAttrXmlnsWpg(_value); begin + if ifnil({self.}XmlAttrXmlnsWpg) then + begin + {self.}XmlAttrXmlnsWpg := new OpenXmlAttribute("xmlns", "wpg", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpg; + end {self.}XmlAttrXmlnsWpg.Value := _value; end; @@ -773,6 +781,11 @@ end; function Numbering.WriteXmlAttrXmlnsWpi(_value); begin + if ifnil({self.}XmlAttrXmlnsWpi) then + begin + {self.}XmlAttrXmlnsWpi := new OpenXmlAttribute("xmlns", "wpi", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWpi; + end {self.}XmlAttrXmlnsWpi.Value := _value; end; @@ -783,6 +796,11 @@ end; function Numbering.WriteXmlAttrXmlnsWne(_value); begin + if ifnil({self.}XmlAttrXmlnsWne) then + begin + {self.}XmlAttrXmlnsWne := new OpenXmlAttribute("xmlns", "wne", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWne; + end {self.}XmlAttrXmlnsWne.Value := _value; end; @@ -793,6 +811,11 @@ end; function Numbering.WriteXmlAttrXmlnsWps(_value); begin + if ifnil({self.}XmlAttrXmlnsWps) then + begin + {self.}XmlAttrXmlnsWps := new OpenXmlAttribute("xmlns", "wps", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsWps; + end {self.}XmlAttrXmlnsWps.Value := _value; end; @@ -803,5 +826,52 @@ end; function Numbering.WriteXmlAttrMcIgnorable(_value); begin + if ifnil({self.}XmlAttrMcIgnorable) then + begin + {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); + attributes_[length(attributes_)] := {self.}XmlAttrMcIgnorable; + end {self.}XmlAttrMcIgnorable.Value := _value; end; + +function Numbering.ReadAbstractNums(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "abstractNum", ind); +end; + +function Numbering.ReadNums(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "num", ind); +end; + +function Numbering.AddAbstractNum(): AbstractNum; +begin + obj := new AbstractNum(self, {self.}Prefix, "abstractNum"); + container_.Insert(obj); + return obj; +end; + +function Numbering.AddNum(): Num; +begin + obj := new Num(self, {self.}Prefix, "num"); + container_.Insert(obj); + return obj; +end; + +function Numbering.AppendAbstractNum(): AbstractNum; +begin + obj := new AbstractNum(self, {self.}Prefix, "abstractNum"); + container_.Append(obj); + return obj; +end; + +function Numbering.AppendNum(): Num; +begin + obj := new Num(self, {self.}Prefix, "num"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/NvPicPr@DOCX.tsf b/autoclass/docx/NvPicPr@DOCX.tsf index 701781a..f634af7 100644 --- a/autoclass/docx/NvPicPr@DOCX.tsf +++ b/autoclass/docx/NvPicPr@DOCX.tsf @@ -4,17 +4,20 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: NvPicPr);override; public - // Attributes + // normal property + property CNvPr read ReadXmlChildCNvPr; + property CNvPicPr read ReadXmlChildCNvPicPr; + function ReadXmlChildCNvPr(); + function ReadXmlChildCNvPicPr(); + +public // Children - CNvPr: CNvPr; - CNvPicPr: CNvPicPr; + XmlChildCNvPr: CNvPr; + XmlChildCNvPicPr: CNvPicPr; end; @@ -30,74 +33,51 @@ end; function NvPicPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function NvPicPr.Init();override; begin - {self.}CNvPr := new CNvPr(self, "pic", "cNvPr"); - {self.}CNvPicPr := new CNvPicPr(self, "pic", "cNvPicPr"); -end; - -function NvPicPr.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function NvPicPr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}CNvPr, - 1: {self.}CNvPicPr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}CNvPr.ElementName: 0, - {self.}CNvPicPr.ElementName: 1, + "pic:cNvPr": array(0, makeweakref(thisFunction(ReadXmlChildCNvPr))), + "pic:cNvPicPr": array(1, makeweakref(thisFunction(ReadXmlChildCNvPicPr))), ); -end; - -function NvPicPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function NvPicPr.Copy(_obj: NvPicPr);override; begin - {self.}CNvPr.Copy(_obj.CNvPr); - {self.}CNvPicPr.Copy(_obj.CNvPicPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildCNvPr) then + {self.}CNvPr.Copy(_obj.XmlChildCNvPr); + if not ifnil(_obj.XmlChildCNvPicPr) then + {self.}CNvPicPr.Copy(_obj.XmlChildCNvPicPr); + tslassigning := tslassigning_backup; +end; + +function NvPicPr.ReadXmlChildCNvPr(); +begin + if tslassigning and ifnil({self.}XmlChildCNvPr) then + begin + {self.}XmlChildCNvPr := new CNvPr(self, "pic", "cNvPr"); + container_.Set({self.}XmlChildCNvPr); + end + return {self.}XmlChildCNvPr; +end; + +function NvPicPr.ReadXmlChildCNvPicPr(); +begin + if tslassigning and ifnil({self.}XmlChildCNvPicPr) then + begin + {self.}XmlChildCNvPicPr := new CNvPicPr(self, "pic", "cNvPicPr"); + container_.Set({self.}XmlChildCNvPicPr); + end + return {self.}XmlChildCNvPicPr; end; diff --git a/autoclass/docx/OuterShdw@DOCX.tsf b/autoclass/docx/OuterShdw@DOCX.tsf index 7ee4b67..96a951c 100644 --- a/autoclass/docx/OuterShdw@DOCX.tsf +++ b/autoclass/docx/OuterShdw@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: OuterShdw);override; +public + + // attributes property property BlurRad read ReadXmlAttrBlurRad write WriteXmlAttrBlurRad; property Dist read ReadXmlAttrDist write WriteXmlAttrDist; property Dir read ReadXmlAttrDir write WriteXmlAttrDir; @@ -25,8 +25,12 @@ public function ReadXmlAttrRotWithShape(); function WriteXmlAttrRotWithShape(_value); + // normal property + property SrgbClr read ReadXmlChildSrgbClr; + function ReadXmlChildSrgbClr(); + public - // Attributes + // Attributes XmlAttrBlurRad: OpenXmlAttribute; XmlAttrDist: OpenXmlAttribute; XmlAttrDir: OpenXmlAttribute; @@ -34,7 +38,7 @@ public XmlAttrRotWithShape: OpenXmlAttribute; // Children - SrgbClr: SrgbClr; + XmlChildSrgbClr: SrgbClr; end; @@ -50,92 +54,45 @@ end; function OuterShdw.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function OuterShdw.Init();override; begin - {self.}XmlAttrBlurRad := new OpenXmlAttribute(nil, "blurRad", nil); - {self.}XmlAttrDist := new OpenXmlAttribute(nil, "dist", nil); - {self.}XmlAttrDir := new OpenXmlAttribute(nil, "dir", nil); - {self.}XmlAttrAlgn := new OpenXmlAttribute(nil, "algn", nil); - {self.}XmlAttrRotWithShape := new OpenXmlAttribute(nil, "rotWithShape", nil); - {self.}SrgbClr := new SrgbClr(self, {self.}Prefix, "srgbClr"); -end; - -function OuterShdw.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrBlurRad, - {self.}XmlAttrDist, - {self.}XmlAttrDir, - {self.}XmlAttrAlgn, - {self.}XmlAttrRotWithShape, - ); -end; - -function OuterShdw.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}SrgbClr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "blurRad": makeweakref(thisFunction(WriteXmlAttrBlurRad)), + "dist": makeweakref(thisFunction(WriteXmlAttrDist)), + "dir": makeweakref(thisFunction(WriteXmlAttrDir)), + "algn": makeweakref(thisFunction(WriteXmlAttrAlgn)), + "rotWithShape": makeweakref(thisFunction(WriteXmlAttrRotWithShape)), ); sorted_child_ := array( - "": -1, - {self.}SrgbClr.ElementName: 0, + pre + "srgbClr": array(0, makeweakref(thisFunction(ReadXmlChildSrgbClr))), ); -end; - -function OuterShdw.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function OuterShdw.Copy(_obj: OuterShdw);override; begin - if not ifnil(_obj.XmlAttrBlurRad.Value) then - {self.}XmlAttrBlurRad.Value := _obj.XmlAttrBlurRad.Value; - if not ifnil(_obj.XmlAttrDist.Value) then - {self.}XmlAttrDist.Value := _obj.XmlAttrDist.Value; - if not ifnil(_obj.XmlAttrDir.Value) then - {self.}XmlAttrDir.Value := _obj.XmlAttrDir.Value; - if not ifnil(_obj.XmlAttrAlgn.Value) then - {self.}XmlAttrAlgn.Value := _obj.XmlAttrAlgn.Value; - if not ifnil(_obj.XmlAttrRotWithShape.Value) then - {self.}XmlAttrRotWithShape.Value := _obj.XmlAttrRotWithShape.Value; - {self.}SrgbClr.Copy(_obj.SrgbClr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.BlurRad) then + {self.}BlurRad := _obj.BlurRad; + if not ifnil(_obj.Dist) then + {self.}Dist := _obj.Dist; + if not ifnil(_obj.Dir) then + {self.}Dir := _obj.Dir; + if not ifnil(_obj.Algn) then + {self.}Algn := _obj.Algn; + if not ifnil(_obj.RotWithShape) then + {self.}RotWithShape := _obj.RotWithShape; + if not ifnil(_obj.XmlChildSrgbClr) then + {self.}SrgbClr.Copy(_obj.XmlChildSrgbClr); + tslassigning := tslassigning_backup; end; function OuterShdw.ReadXmlAttrBlurRad(); @@ -145,6 +102,11 @@ end; function OuterShdw.WriteXmlAttrBlurRad(_value); begin + if ifnil({self.}XmlAttrBlurRad) then + begin + {self.}XmlAttrBlurRad := new OpenXmlAttribute("", "blurRad", nil); + attributes_[length(attributes_)] := {self.}XmlAttrBlurRad; + end {self.}XmlAttrBlurRad.Value := _value; end; @@ -155,6 +117,11 @@ end; function OuterShdw.WriteXmlAttrDist(_value); begin + if ifnil({self.}XmlAttrDist) then + begin + {self.}XmlAttrDist := new OpenXmlAttribute("", "dist", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDist; + end {self.}XmlAttrDist.Value := _value; end; @@ -165,6 +132,11 @@ end; function OuterShdw.WriteXmlAttrDir(_value); begin + if ifnil({self.}XmlAttrDir) then + begin + {self.}XmlAttrDir := new OpenXmlAttribute("", "dir", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDir; + end {self.}XmlAttrDir.Value := _value; end; @@ -175,6 +147,11 @@ end; function OuterShdw.WriteXmlAttrAlgn(_value); begin + if ifnil({self.}XmlAttrAlgn) then + begin + {self.}XmlAttrAlgn := new OpenXmlAttribute("", "algn", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAlgn; + end {self.}XmlAttrAlgn.Value := _value; end; @@ -185,5 +162,20 @@ end; function OuterShdw.WriteXmlAttrRotWithShape(_value); begin + if ifnil({self.}XmlAttrRotWithShape) then + begin + {self.}XmlAttrRotWithShape := new OpenXmlAttribute("", "rotWithShape", nil); + attributes_[length(attributes_)] := {self.}XmlAttrRotWithShape; + end {self.}XmlAttrRotWithShape.Value := _value; end; + +function OuterShdw.ReadXmlChildSrgbClr(); +begin + if tslassigning and ifnil({self.}XmlChildSrgbClr) then + begin + {self.}XmlChildSrgbClr := new SrgbClr(self, {self.}Prefix, "srgbClr"); + container_.Set({self.}XmlChildSrgbClr); + end + return {self.}XmlChildSrgbClr; +end; diff --git a/autoclass/docx/P@DOCX.tsf b/autoclass/docx/P@DOCX.tsf index f90c89e..b92f071 100644 --- a/autoclass/docx/P@DOCX.tsf +++ b/autoclass/docx/P@DOCX.tsf @@ -4,40 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: P);override; - function AddR(): R; - function AddCommentRangeStart(): CommentRange; - function AddCommentRangeEnd(): CommentRange; - function AddBookmarkStart(): Bookmark; - function AddBookmarkEnd(): Bookmark; - function AddHyperLink(): HyperLink; - function AddFldSimple(): FldSimple; - function AppendR(): R; - function AppendCommentRangeStart(): CommentRange; - function AppendCommentRangeEnd(): CommentRange; - function AppendBookmarkStart(): Bookmark; - function AppendBookmarkEnd(): Bookmark; - function AppendHyperLink(): HyperLink; - function AppendFldSimple(): FldSimple; - property Rs read ReadRs; - property CommentRangeStarts read ReadCommentRangeStarts; - property CommentRangeEnds read ReadCommentRangeEnds; - property BookmarkStarts read ReadBookmarkStarts; - property BookmarkEnds read ReadBookmarkEnds; - property Hyperlinks read ReadHyperlinks; - property FldSimples read ReadFldSimples; - function ReadRs(_index); - function ReadCommentRangeStarts(_index); - function ReadCommentRangeEnds(_index); - function ReadBookmarkStarts(_index); - function ReadBookmarkEnds(_index); - function ReadHyperlinks(_index); - function ReadFldSimples(_index); +public + // attributes property property W14ParaId read ReadXmlAttrW14ParaId write WriteXmlAttrW14ParaId; property W14TextId read ReadXmlAttrW14TextId write WriteXmlAttrW14TextId; property WRsidR read ReadXmlAttrWRsidR write WriteXmlAttrWRsidR; @@ -57,8 +28,42 @@ public function ReadXmlAttrWRsidP(); function WriteXmlAttrWRsidP(_value); + // normal property + property PPr read ReadXmlChildPPr; + function ReadXmlChildPPr(); + + // multi property + property Rs read ReadRs; + property CommentRangeStarts read ReadCommentRangeStarts; + property CommentRangeEnds read ReadCommentRangeEnds; + property BookmarkStarts read ReadBookmarkStarts; + property BookmarkEnds read ReadBookmarkEnds; + property Hyperlinks read ReadHyperlinks; + property FldSimples read ReadFldSimples; + function ReadRs(_index); + function ReadCommentRangeStarts(_index); + function ReadCommentRangeEnds(_index); + function ReadBookmarkStarts(_index); + function ReadBookmarkEnds(_index); + function ReadHyperlinks(_index); + function ReadFldSimples(_index); + function AddR(): R; + function AddCommentRangeStart(): CommentRange; + function AddCommentRangeEnd(): CommentRange; + function AddBookmarkStart(): Bookmark; + function AddBookmarkEnd(): Bookmark; + function AddHyperLink(): HyperLink; + function AddFldSimple(): FldSimple; + function AppendR(): R; + function AppendCommentRangeStart(): CommentRange; + function AppendCommentRangeEnd(): CommentRange; + function AppendBookmarkStart(): Bookmark; + function AppendBookmarkEnd(): Bookmark; + function AppendHyperLink(): HyperLink; + function AppendFldSimple(): FldSimple; + public - // Attributes + // Attributes XmlAttrW14ParaId: OpenXmlAttribute; XmlAttrW14TextId: OpenXmlAttribute; XmlAttrWRsidR: OpenXmlAttribute; @@ -67,7 +72,7 @@ public XmlAttrWRsidP: OpenXmlAttribute; // Children - PPr: PPr; + XmlChildPPr: PPr; end; @@ -83,355 +88,55 @@ end; function P.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function P.Init();override; begin - {self.}XmlAttrW14ParaId := new OpenXmlAttribute("w14", "paraId", nil); - {self.}XmlAttrW14TextId := new OpenXmlAttribute("w14", "textId", nil); - {self.}XmlAttrWRsidR := new OpenXmlAttribute("w", "rsidR", nil); - {self.}XmlAttrWRsidRPr := new OpenXmlAttribute("w", "rsidRPr", nil); - {self.}XmlAttrWRsidRDefault := new OpenXmlAttribute("w", "rsidRDefault", nil); - {self.}XmlAttrWRsidP := new OpenXmlAttribute("w", "rsidP", nil); - {self.}PPr := new PPr(self, {self.}Prefix, "pPr"); -end; - -function P.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrW14ParaId, - {self.}XmlAttrW14TextId, - {self.}XmlAttrWRsidR, - {self.}XmlAttrWRsidRPr, - {self.}XmlAttrWRsidRDefault, - {self.}XmlAttrWRsidP, - ); -end; - -function P.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}PPr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "w14:paraId": makeweakref(thisFunction(WriteXmlAttrW14ParaId)), + "w14:textId": makeweakref(thisFunction(WriteXmlAttrW14TextId)), + "w:rsidR": makeweakref(thisFunction(WriteXmlAttrWRsidR)), + "w:rsidRPr": makeweakref(thisFunction(WriteXmlAttrWRsidRPr)), + "w:rsidRDefault": makeweakref(thisFunction(WriteXmlAttrWRsidRDefault)), + "w:rsidP": makeweakref(thisFunction(WriteXmlAttrWRsidP)), ); sorted_child_ := array( - "": -1, - {self.}PPr.ElementName: 0, + pre + "pPr": array(0, makeweakref(thisFunction(ReadXmlChildPPr))), + pre + "r": array(1, makeweakref(thisFunction(AppendR))), + pre + "commentRangeStart": array(2, makeweakref(thisFunction(AppendCommentRangeStart))), + pre + "commentRangeEnd": array(3, makeweakref(thisFunction(AppendCommentRangeEnd))), + pre + "bookmarkStart": array(4, makeweakref(thisFunction(AppendBookmarkStart))), + pre + "bookmarkEnd": array(5, makeweakref(thisFunction(AppendBookmarkEnd))), + pre + "hyperlink": array(6, makeweakref(thisFunction(AppendHyperLink))), + pre + "fldSimple": array(7, makeweakref(thisFunction(AppendFldSimple))), ); -end; - -function P.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "r": obj := {self.}AppendR(); - pre + "commentRangeStart": obj := {self.}AppendCommentRangeStart(); - pre + "commentRangeEnd": obj := {self.}AppendCommentRangeEnd(); - pre + "bookmarkStart": obj := {self.}AppendBookmarkStart(); - pre + "bookmarkEnd": obj := {self.}AppendBookmarkEnd(); - pre + "hyperlink": obj := {self.}AppendHyperLink(); - pre + "fldSimple": obj := {self.}AppendFldSimple(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function P.Copy(_obj: P);override; begin - if not ifnil(_obj.XmlAttrW14ParaId.Value) then - {self.}XmlAttrW14ParaId.Value := _obj.XmlAttrW14ParaId.Value; - if not ifnil(_obj.XmlAttrW14TextId.Value) then - {self.}XmlAttrW14TextId.Value := _obj.XmlAttrW14TextId.Value; - if not ifnil(_obj.XmlAttrWRsidR.Value) then - {self.}XmlAttrWRsidR.Value := _obj.XmlAttrWRsidR.Value; - if not ifnil(_obj.XmlAttrWRsidRPr.Value) then - {self.}XmlAttrWRsidRPr.Value := _obj.XmlAttrWRsidRPr.Value; - if not ifnil(_obj.XmlAttrWRsidRDefault.Value) then - {self.}XmlAttrWRsidRDefault.Value := _obj.XmlAttrWRsidRDefault.Value; - if not ifnil(_obj.XmlAttrWRsidP.Value) then - {self.}XmlAttrWRsidP.Value := _obj.XmlAttrWRsidP.Value; - {self.}PPr.Copy(_obj.PPr); -end; - -function P.AddR(): R; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "r" then break; - end - obj := new R(self, {self.}Prefix, "r"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function P.AddCommentRangeStart(): CommentRange; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "commentRangeStart" then break; - end - obj := new CommentRange(self, {self.}Prefix, "commentRangeStart"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function P.AddCommentRangeEnd(): CommentRange; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "commentRangeEnd" then break; - end - obj := new CommentRange(self, {self.}Prefix, "commentRangeEnd"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function P.AddBookmarkStart(): Bookmark; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "bookmarkStart" then break; - end - obj := new Bookmark(self, {self.}Prefix, "bookmarkStart"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function P.AddBookmarkEnd(): Bookmark; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "bookmarkEnd" then break; - end - obj := new Bookmark(self, {self.}Prefix, "bookmarkEnd"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function P.AddHyperLink(): HyperLink; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "hyperlink" then break; - end - obj := new HyperLink(self, {self.}Prefix, "hyperlink"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function P.AddFldSimple(): FldSimple; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "fldSimple" then break; - end - obj := new FldSimple(self, {self.}Prefix, "fldSimple"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function P.AppendR(): R; -begin - obj := new R(self, {self.}Prefix, "r"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function P.AppendCommentRangeStart(): CommentRange; -begin - obj := new CommentRange(self, {self.}Prefix, "commentRangeStart"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function P.AppendCommentRangeEnd(): CommentRange; -begin - obj := new CommentRange(self, {self.}Prefix, "commentRangeEnd"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function P.AppendBookmarkStart(): Bookmark; -begin - obj := new Bookmark(self, {self.}Prefix, "bookmarkStart"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function P.AppendBookmarkEnd(): Bookmark; -begin - obj := new Bookmark(self, {self.}Prefix, "bookmarkEnd"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function P.AppendHyperLink(): HyperLink; -begin - obj := new HyperLink(self, {self.}Prefix, "hyperlink"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function P.AppendFldSimple(): FldSimple; -begin - obj := new FldSimple(self, {self.}Prefix, "fldSimple"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function P.ReadRs(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "r" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; - -function P.ReadCommentRangeStarts(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "commentRangeStart" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; - -function P.ReadCommentRangeEnds(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "commentRangeEnd" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; - -function P.ReadBookmarkStarts(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "bookmarkStart" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; - -function P.ReadBookmarkEnds(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "bookmarkEnd" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; - -function P.ReadHyperlinks(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "hyperlink" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; - -function P.ReadFldSimples(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "fldSimple" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.W14ParaId) then + {self.}W14ParaId := _obj.W14ParaId; + if not ifnil(_obj.W14TextId) then + {self.}W14TextId := _obj.W14TextId; + if not ifnil(_obj.WRsidR) then + {self.}WRsidR := _obj.WRsidR; + if not ifnil(_obj.WRsidRPr) then + {self.}WRsidRPr := _obj.WRsidRPr; + if not ifnil(_obj.WRsidRDefault) then + {self.}WRsidRDefault := _obj.WRsidRDefault; + if not ifnil(_obj.WRsidP) then + {self.}WRsidP := _obj.WRsidP; + if not ifnil(_obj.XmlChildPPr) then + {self.}PPr.Copy(_obj.XmlChildPPr); + tslassigning := tslassigning_backup; end; function P.ReadXmlAttrW14ParaId(); @@ -441,6 +146,11 @@ end; function P.WriteXmlAttrW14ParaId(_value); begin + if ifnil({self.}XmlAttrW14ParaId) then + begin + {self.}XmlAttrW14ParaId := new OpenXmlAttribute("w14", "paraId", nil); + attributes_[length(attributes_)] := {self.}XmlAttrW14ParaId; + end {self.}XmlAttrW14ParaId.Value := _value; end; @@ -451,6 +161,11 @@ end; function P.WriteXmlAttrW14TextId(_value); begin + if ifnil({self.}XmlAttrW14TextId) then + begin + {self.}XmlAttrW14TextId := new OpenXmlAttribute("w14", "textId", nil); + attributes_[length(attributes_)] := {self.}XmlAttrW14TextId; + end {self.}XmlAttrW14TextId.Value := _value; end; @@ -461,6 +176,11 @@ end; function P.WriteXmlAttrWRsidR(_value); begin + if ifnil({self.}XmlAttrWRsidR) then + begin + {self.}XmlAttrWRsidR := new OpenXmlAttribute("w", "rsidR", nil); + attributes_[length(attributes_)] := {self.}XmlAttrWRsidR; + end {self.}XmlAttrWRsidR.Value := _value; end; @@ -471,6 +191,11 @@ end; function P.WriteXmlAttrWRsidRPr(_value); begin + if ifnil({self.}XmlAttrWRsidRPr) then + begin + {self.}XmlAttrWRsidRPr := new OpenXmlAttribute("w", "rsidRPr", nil); + attributes_[length(attributes_)] := {self.}XmlAttrWRsidRPr; + end {self.}XmlAttrWRsidRPr.Value := _value; end; @@ -481,6 +206,11 @@ end; function P.WriteXmlAttrWRsidRDefault(_value); begin + if ifnil({self.}XmlAttrWRsidRDefault) then + begin + {self.}XmlAttrWRsidRDefault := new OpenXmlAttribute("w", "rsidRDefault", nil); + attributes_[length(attributes_)] := {self.}XmlAttrWRsidRDefault; + end {self.}XmlAttrWRsidRDefault.Value := _value; end; @@ -491,5 +221,167 @@ end; function P.WriteXmlAttrWRsidP(_value); begin + if ifnil({self.}XmlAttrWRsidP) then + begin + {self.}XmlAttrWRsidP := new OpenXmlAttribute("w", "rsidP", nil); + attributes_[length(attributes_)] := {self.}XmlAttrWRsidP; + end {self.}XmlAttrWRsidP.Value := _value; end; + +function P.ReadXmlChildPPr(); +begin + if tslassigning and ifnil({self.}XmlChildPPr) then + begin + {self.}XmlChildPPr := new PPr(self, {self.}Prefix, "pPr"); + container_.Set({self.}XmlChildPPr); + end + return {self.}XmlChildPPr; +end; + +function P.ReadRs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "r", ind); +end; + +function P.ReadCommentRangeStarts(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "commentRangeStart", ind); +end; + +function P.ReadCommentRangeEnds(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "commentRangeEnd", ind); +end; + +function P.ReadBookmarkStarts(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "bookmarkStart", ind); +end; + +function P.ReadBookmarkEnds(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "bookmarkEnd", ind); +end; + +function P.ReadHyperlinks(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "hyperlink", ind); +end; + +function P.ReadFldSimples(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "fldSimple", ind); +end; + +function P.AddR(): R; +begin + obj := new R(self, {self.}Prefix, "r"); + container_.Insert(obj); + return obj; +end; + +function P.AddCommentRangeStart(): CommentRange; +begin + obj := new CommentRange(self, {self.}Prefix, "commentRangeStart"); + container_.Insert(obj); + return obj; +end; + +function P.AddCommentRangeEnd(): CommentRange; +begin + obj := new CommentRange(self, {self.}Prefix, "commentRangeEnd"); + container_.Insert(obj); + return obj; +end; + +function P.AddBookmarkStart(): Bookmark; +begin + obj := new Bookmark(self, {self.}Prefix, "bookmarkStart"); + container_.Insert(obj); + return obj; +end; + +function P.AddBookmarkEnd(): Bookmark; +begin + obj := new Bookmark(self, {self.}Prefix, "bookmarkEnd"); + container_.Insert(obj); + return obj; +end; + +function P.AddHyperLink(): HyperLink; +begin + obj := new HyperLink(self, {self.}Prefix, "hyperlink"); + container_.Insert(obj); + return obj; +end; + +function P.AddFldSimple(): FldSimple; +begin + obj := new FldSimple(self, {self.}Prefix, "fldSimple"); + container_.Insert(obj); + return obj; +end; + +function P.AppendR(): R; +begin + obj := new R(self, {self.}Prefix, "r"); + container_.Append(obj); + return obj; +end; + +function P.AppendCommentRangeStart(): CommentRange; +begin + obj := new CommentRange(self, {self.}Prefix, "commentRangeStart"); + container_.Append(obj); + return obj; +end; + +function P.AppendCommentRangeEnd(): CommentRange; +begin + obj := new CommentRange(self, {self.}Prefix, "commentRangeEnd"); + container_.Append(obj); + return obj; +end; + +function P.AppendBookmarkStart(): Bookmark; +begin + obj := new Bookmark(self, {self.}Prefix, "bookmarkStart"); + container_.Append(obj); + return obj; +end; + +function P.AppendBookmarkEnd(): Bookmark; +begin + obj := new Bookmark(self, {self.}Prefix, "bookmarkEnd"); + container_.Append(obj); + return obj; +end; + +function P.AppendHyperLink(): HyperLink; +begin + obj := new HyperLink(self, {self.}Prefix, "hyperlink"); + container_.Append(obj); + return obj; +end; + +function P.AppendFldSimple(): FldSimple; +begin + obj := new FldSimple(self, {self.}Prefix, "fldSimple"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/PBdr@DOCX.tsf b/autoclass/docx/PBdr@DOCX.tsf index 6d82cbf..5d87bb9 100644 --- a/autoclass/docx/PBdr@DOCX.tsf +++ b/autoclass/docx/PBdr@DOCX.tsf @@ -4,17 +4,20 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: PBdr);override; public - // Attributes + // normal property + property Top read ReadXmlChildTop; + property Bottom read ReadXmlChildBottom; + function ReadXmlChildTop(); + function ReadXmlChildBottom(); + +public // Children - Top: PBorder; - Bottom: PBorder; + XmlChildTop: PBorder; + XmlChildBottom: PBorder; end; @@ -30,74 +33,51 @@ end; function PBdr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function PBdr.Init();override; begin - {self.}Top := new PBorder(self, {self.}Prefix, "top"); - {self.}Bottom := new PBorder(self, {self.}Prefix, "bottom"); -end; - -function PBdr.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function PBdr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Top, - 1: {self.}Bottom, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}Top.ElementName: 0, - {self.}Bottom.ElementName: 1, + pre + "top": array(0, makeweakref(thisFunction(ReadXmlChildTop))), + pre + "bottom": array(1, makeweakref(thisFunction(ReadXmlChildBottom))), ); -end; - -function PBdr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function PBdr.Copy(_obj: PBdr);override; begin - {self.}Top.Copy(_obj.Top); - {self.}Bottom.Copy(_obj.Bottom); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildTop) then + {self.}Top.Copy(_obj.XmlChildTop); + if not ifnil(_obj.XmlChildBottom) then + {self.}Bottom.Copy(_obj.XmlChildBottom); + tslassigning := tslassigning_backup; +end; + +function PBdr.ReadXmlChildTop(); +begin + if tslassigning and ifnil({self.}XmlChildTop) then + begin + {self.}XmlChildTop := new PBorder(self, {self.}Prefix, "top"); + container_.Set({self.}XmlChildTop); + end + return {self.}XmlChildTop; +end; + +function PBdr.ReadXmlChildBottom(); +begin + if tslassigning and ifnil({self.}XmlChildBottom) then + begin + {self.}XmlChildBottom := new PBorder(self, {self.}Prefix, "bottom"); + container_.Set({self.}XmlChildBottom); + end + return {self.}XmlChildBottom; end; diff --git a/autoclass/docx/PBorder@DOCX.tsf b/autoclass/docx/PBorder@DOCX.tsf index e4f9bb1..d4a0c74 100644 --- a/autoclass/docx/PBorder@DOCX.tsf +++ b/autoclass/docx/PBorder@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: PBorder);override; +public + + // attributes property property Val read ReadXmlAttrVal write WriteXmlAttrVal; property Color read ReadXmlAttrColor write WriteXmlAttrColor; property Space read ReadXmlAttrSpace write WriteXmlAttrSpace; @@ -29,7 +29,7 @@ public function WriteXmlAttrSz(_value); public - // Attributes + // Attributes XmlAttrVal: OpenXmlAttribute; XmlAttrColor: OpenXmlAttribute; XmlAttrSpace: OpenXmlAttribute; @@ -37,7 +37,6 @@ public XmlAttrThemeTint: OpenXmlAttribute; XmlAttrSz: OpenXmlAttribute; - // Children end; @@ -53,61 +52,45 @@ end; function PBorder.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function PBorder.Init();override; begin - {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); - {self.}XmlAttrColor := new OpenXmlAttribute({self.}Prefix, "color", nil); - {self.}XmlAttrSpace := new OpenXmlAttribute({self.}Prefix, "space", nil); - {self.}XmlAttrThemeColor := new OpenXmlAttribute({self.}Prefix, "themeColor", nil); - {self.}XmlAttrThemeTint := new OpenXmlAttribute({self.}Prefix, "themeTint", nil); - {self.}XmlAttrSz := new OpenXmlAttribute({self.}Prefix, "sz", nil); -end; - -function PBorder.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrVal, - {self.}XmlAttrColor, - {self.}XmlAttrSpace, - {self.}XmlAttrThemeColor, - {self.}XmlAttrThemeTint, - {self.}XmlAttrSz, - ); -end; - -function PBorder.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "val": makeweakref(thisFunction(WriteXmlAttrVal)), + pre + "color": makeweakref(thisFunction(WriteXmlAttrColor)), + pre + "space": makeweakref(thisFunction(WriteXmlAttrSpace)), + pre + "themeColor": makeweakref(thisFunction(WriteXmlAttrThemeColor)), + pre + "themeTint": makeweakref(thisFunction(WriteXmlAttrThemeTint)), + pre + "sz": makeweakref(thisFunction(WriteXmlAttrSz)), ); sorted_child_ := array( - "": -1, ); -end; - -function PBorder.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function PBorder.Copy(_obj: PBorder);override; begin - if not ifnil(_obj.XmlAttrVal.Value) then - {self.}XmlAttrVal.Value := _obj.XmlAttrVal.Value; - if not ifnil(_obj.XmlAttrColor.Value) then - {self.}XmlAttrColor.Value := _obj.XmlAttrColor.Value; - if not ifnil(_obj.XmlAttrSpace.Value) then - {self.}XmlAttrSpace.Value := _obj.XmlAttrSpace.Value; - if not ifnil(_obj.XmlAttrThemeColor.Value) then - {self.}XmlAttrThemeColor.Value := _obj.XmlAttrThemeColor.Value; - if not ifnil(_obj.XmlAttrThemeTint.Value) then - {self.}XmlAttrThemeTint.Value := _obj.XmlAttrThemeTint.Value; - if not ifnil(_obj.XmlAttrSz.Value) then - {self.}XmlAttrSz.Value := _obj.XmlAttrSz.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Val) then + {self.}Val := _obj.Val; + if not ifnil(_obj.Color) then + {self.}Color := _obj.Color; + if not ifnil(_obj.Space) then + {self.}Space := _obj.Space; + if not ifnil(_obj.ThemeColor) then + {self.}ThemeColor := _obj.ThemeColor; + if not ifnil(_obj.ThemeTint) then + {self.}ThemeTint := _obj.ThemeTint; + if not ifnil(_obj.Sz) then + {self.}Sz := _obj.Sz; + tslassigning := tslassigning_backup; end; function PBorder.ReadXmlAttrVal(); @@ -117,6 +100,11 @@ end; function PBorder.WriteXmlAttrVal(_value); begin + if ifnil({self.}XmlAttrVal) then + begin + {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVal; + end {self.}XmlAttrVal.Value := _value; end; @@ -127,6 +115,11 @@ end; function PBorder.WriteXmlAttrColor(_value); begin + if ifnil({self.}XmlAttrColor) then + begin + {self.}XmlAttrColor := new OpenXmlAttribute({self.}Prefix, "color", nil); + attributes_[length(attributes_)] := {self.}XmlAttrColor; + end {self.}XmlAttrColor.Value := _value; end; @@ -137,6 +130,11 @@ end; function PBorder.WriteXmlAttrSpace(_value); begin + if ifnil({self.}XmlAttrSpace) then + begin + {self.}XmlAttrSpace := new OpenXmlAttribute({self.}Prefix, "space", nil); + attributes_[length(attributes_)] := {self.}XmlAttrSpace; + end {self.}XmlAttrSpace.Value := _value; end; @@ -147,6 +145,11 @@ end; function PBorder.WriteXmlAttrThemeColor(_value); begin + if ifnil({self.}XmlAttrThemeColor) then + begin + {self.}XmlAttrThemeColor := new OpenXmlAttribute({self.}Prefix, "themeColor", nil); + attributes_[length(attributes_)] := {self.}XmlAttrThemeColor; + end {self.}XmlAttrThemeColor.Value := _value; end; @@ -157,6 +160,11 @@ end; function PBorder.WriteXmlAttrThemeTint(_value); begin + if ifnil({self.}XmlAttrThemeTint) then + begin + {self.}XmlAttrThemeTint := new OpenXmlAttribute({self.}Prefix, "themeTint", nil); + attributes_[length(attributes_)] := {self.}XmlAttrThemeTint; + end {self.}XmlAttrThemeTint.Value := _value; end; @@ -167,5 +175,10 @@ end; function PBorder.WriteXmlAttrSz(_value); begin + if ifnil({self.}XmlAttrSz) then + begin + {self.}XmlAttrSz := new OpenXmlAttribute({self.}Prefix, "sz", nil); + attributes_[length(attributes_)] := {self.}XmlAttrSz; + end {self.}XmlAttrSz.Value := _value; end; diff --git a/autoclass/docx/PPr@DOCX.tsf b/autoclass/docx/PPr@DOCX.tsf index c19b679..590b66f 100644 --- a/autoclass/docx/PPr@DOCX.tsf +++ b/autoclass/docx/PPr@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: PPr);override; +public + + // empty property property WidowControl read ReadXmlChildWidowControl write WriteXmlChildWidowControl; property KeepNext read ReadXmlChildKeepNext write WriteXmlChildKeepNext; property KeepLines read ReadXmlChildKeepLines write WriteXmlChildKeepLines; @@ -22,27 +22,55 @@ public function ReadXmlChildContextualSpacing(); function WriteXmlChildContextualSpacing(_value); -public - // Attributes + // normal property + property SectPr read ReadXmlChildSectPr; + property Tabs read ReadXmlChildTabs; + property SnapToGrid read ReadXmlChildSnapToGrid; + property PStyle read ReadXmlChildPStyle; + property NumPr read ReadXmlChildNumPr; + property Jc read ReadXmlChildJc; + property Ind read ReadXmlChildInd; + property AdjustRightInd read ReadXmlChildAdjustRightInd; + property Spacing read ReadXmlChildSpacing; + property OutlineLvl read ReadXmlChildOutlineLvl; + property AutoSpaceDE read ReadXmlChildAutoSpaceDE; + property AutoSpaceDN read ReadXmlChildAutoSpaceDN; + property RPr read ReadXmlChildRPr; + property PBdr read ReadXmlChildPBdr; + function ReadXmlChildSectPr(); + function ReadXmlChildTabs(); + function ReadXmlChildSnapToGrid(); + function ReadXmlChildPStyle(); + function ReadXmlChildNumPr(); + function ReadXmlChildJc(); + function ReadXmlChildInd(); + function ReadXmlChildAdjustRightInd(); + function ReadXmlChildSpacing(); + function ReadXmlChildOutlineLvl(); + function ReadXmlChildAutoSpaceDE(); + function ReadXmlChildAutoSpaceDN(); + function ReadXmlChildRPr(); + function ReadXmlChildPBdr(); +public // Children - SectPr: SectPr; - Tabs: Tabs; + XmlChildSectPr: SectPr; + XmlChildTabs: Tabs; XmlChildWidowControl: OpenXmlEmpty; - SnapToGrid: PureWVal; - PStyle: PureWVal; - NumPr: NumPr; - Jc: PureWVal; - Ind: Ind; + XmlChildSnapToGrid: PureWVal; + XmlChildPStyle: PureWVal; + XmlChildNumPr: NumPr; + XmlChildJc: PureWVal; + XmlChildInd: Ind; XmlChildKeepNext: OpenXmlEmpty; XmlChildKeepLines: OpenXmlEmpty; - AdjustRightInd: PureWVal; - Spacing: Spacing; - OutlineLvl: PureWVal; - AutoSpaceDE: PureWVal; - AutoSpaceDN: PureWVal; - RPr: RPr; - PBdr: PBdr; + XmlChildAdjustRightInd: PureWVal; + XmlChildSpacing: Spacing; + XmlChildOutlineLvl: PureWVal; + XmlChildAutoSpaceDE: PureWVal; + XmlChildAutoSpaceDN: PureWVal; + XmlChildRPr: RPr; + XmlChildPBdr: PBdr; XmlChildContextualSpacing: OpenXmlEmpty; end; @@ -59,178 +87,303 @@ end; function PPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function PPr.Init();override; begin - {self.}SectPr := new SectPr(self, {self.}Prefix, "sectPr"); - {self.}Tabs := new Tabs(self, {self.}Prefix, "tabs"); - {self.}XmlChildWidowControl := new OpenXmlEmpty(self, {self.}Prefix, "widowControl"); - {self.}SnapToGrid := new PureWVal(self, {self.}Prefix, "snapToGrid"); - {self.}PStyle := new PureWVal(self, {self.}Prefix, "pStyle"); - {self.}NumPr := new NumPr(self, {self.}Prefix, "numPr"); - {self.}Jc := new PureWVal(self, {self.}Prefix, "jc"); - {self.}Ind := new Ind(self, {self.}Prefix, "ind"); - {self.}XmlChildKeepNext := new OpenXmlEmpty(self, {self.}Prefix, "keepNext"); - {self.}XmlChildKeepLines := new OpenXmlEmpty(self, {self.}Prefix, "keepLines"); - {self.}AdjustRightInd := new PureWVal(self, {self.}Prefix, "adjustRightInd"); - {self.}Spacing := new Spacing(self, {self.}Prefix, "spacing"); - {self.}OutlineLvl := new PureWVal(self, {self.}Prefix, "outlineLvl"); - {self.}AutoSpaceDE := new PureWVal(self, {self.}Prefix, "autoSpaceDE"); - {self.}AutoSpaceDN := new PureWVal(self, {self.}Prefix, "autoSpaceDN"); - {self.}RPr := new RPr(self, {self.}Prefix, "rPr"); - {self.}PBdr := new PBdr(self, {self.}Prefix, "pBdr"); - {self.}XmlChildContextualSpacing := new OpenXmlEmpty(self, {self.}Prefix, "contextualSpacing"); -end; - -function PPr.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function PPr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}SectPr, - 1: {self.}Tabs, - 2: {self.}XmlChildWidowControl, - 3: {self.}SnapToGrid, - 4: {self.}PStyle, - 5: {self.}NumPr, - 6: {self.}Jc, - 7: {self.}Ind, - 8: {self.}XmlChildKeepNext, - 9: {self.}XmlChildKeepLines, - 10: {self.}AdjustRightInd, - 11: {self.}Spacing, - 12: {self.}OutlineLvl, - 13: {self.}AutoSpaceDE, - 14: {self.}AutoSpaceDN, - 15: {self.}RPr, - 16: {self.}PBdr, - 17: {self.}XmlChildContextualSpacing, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}SectPr.ElementName: 0, - {self.}Tabs.ElementName: 1, - {self.}XmlChildWidowControl.ElementName: 2, - {self.}SnapToGrid.ElementName: 3, - {self.}PStyle.ElementName: 4, - {self.}NumPr.ElementName: 5, - {self.}Jc.ElementName: 6, - {self.}Ind.ElementName: 7, - {self.}XmlChildKeepNext.ElementName: 8, - {self.}XmlChildKeepLines.ElementName: 9, - {self.}AdjustRightInd.ElementName: 10, - {self.}Spacing.ElementName: 11, - {self.}OutlineLvl.ElementName: 12, - {self.}AutoSpaceDE.ElementName: 13, - {self.}AutoSpaceDN.ElementName: 14, - {self.}RPr.ElementName: 15, - {self.}PBdr.ElementName: 16, - {self.}XmlChildContextualSpacing.ElementName: 17, + pre + "sectPr": array(0, makeweakref(thisFunction(ReadXmlChildSectPr))), + pre + "tabs": array(1, makeweakref(thisFunction(ReadXmlChildTabs))), + pre + "widowControl": array(2, makeweakref(thisFunction(ReadXmlChildWidowControl))), + pre + "snapToGrid": array(3, makeweakref(thisFunction(ReadXmlChildSnapToGrid))), + pre + "pStyle": array(4, makeweakref(thisFunction(ReadXmlChildPStyle))), + pre + "numPr": array(5, makeweakref(thisFunction(ReadXmlChildNumPr))), + pre + "jc": array(6, makeweakref(thisFunction(ReadXmlChildJc))), + pre + "ind": array(7, makeweakref(thisFunction(ReadXmlChildInd))), + pre + "keepNext": array(8, makeweakref(thisFunction(ReadXmlChildKeepNext))), + pre + "keepLines": array(9, makeweakref(thisFunction(ReadXmlChildKeepLines))), + pre + "adjustRightInd": array(10, makeweakref(thisFunction(ReadXmlChildAdjustRightInd))), + pre + "spacing": array(11, makeweakref(thisFunction(ReadXmlChildSpacing))), + pre + "outlineLvl": array(12, makeweakref(thisFunction(ReadXmlChildOutlineLvl))), + pre + "autoSpaceDE": array(13, makeweakref(thisFunction(ReadXmlChildAutoSpaceDE))), + pre + "autoSpaceDN": array(14, makeweakref(thisFunction(ReadXmlChildAutoSpaceDN))), + pre + "rPr": array(15, makeweakref(thisFunction(ReadXmlChildRPr))), + pre + "pBdr": array(16, makeweakref(thisFunction(ReadXmlChildPBdr))), + pre + "contextualSpacing": array(17, makeweakref(thisFunction(ReadXmlChildContextualSpacing))), ); -end; - -function PPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function PPr.Copy(_obj: PPr);override; begin - {self.}SectPr.Copy(_obj.SectPr); - {self.}Tabs.Copy(_obj.Tabs); - {self.}XmlChildWidowControl.Copy(_obj.XmlChildWidowControl); - {self.}SnapToGrid.Copy(_obj.SnapToGrid); - {self.}PStyle.Copy(_obj.PStyle); - {self.}NumPr.Copy(_obj.NumPr); - {self.}Jc.Copy(_obj.Jc); - {self.}Ind.Copy(_obj.Ind); - {self.}XmlChildKeepNext.Copy(_obj.XmlChildKeepNext); - {self.}XmlChildKeepLines.Copy(_obj.XmlChildKeepLines); - {self.}AdjustRightInd.Copy(_obj.AdjustRightInd); - {self.}Spacing.Copy(_obj.Spacing); - {self.}OutlineLvl.Copy(_obj.OutlineLvl); - {self.}AutoSpaceDE.Copy(_obj.AutoSpaceDE); - {self.}AutoSpaceDN.Copy(_obj.AutoSpaceDN); - {self.}RPr.Copy(_obj.RPr); - {self.}PBdr.Copy(_obj.PBdr); - {self.}XmlChildContextualSpacing.Copy(_obj.XmlChildContextualSpacing); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildSectPr) then + {self.}SectPr.Copy(_obj.XmlChildSectPr); + if not ifnil(_obj.XmlChildTabs) then + {self.}Tabs.Copy(_obj.XmlChildTabs); + if not ifnil(_obj.XmlChildWidowControl) then + ifnil({self.}XmlChildWidowControl) ? {self.}WidowControl.Copy(_obj.XmlChildWidowControl) : {self.}XmlChildWidowControl.Copy(_obj.XmlChildWidowControl); + if not ifnil(_obj.XmlChildSnapToGrid) then + {self.}SnapToGrid.Copy(_obj.XmlChildSnapToGrid); + if not ifnil(_obj.XmlChildPStyle) then + {self.}PStyle.Copy(_obj.XmlChildPStyle); + if not ifnil(_obj.XmlChildNumPr) then + {self.}NumPr.Copy(_obj.XmlChildNumPr); + if not ifnil(_obj.XmlChildJc) then + {self.}Jc.Copy(_obj.XmlChildJc); + if not ifnil(_obj.XmlChildInd) then + {self.}Ind.Copy(_obj.XmlChildInd); + if not ifnil(_obj.XmlChildKeepNext) then + ifnil({self.}XmlChildKeepNext) ? {self.}KeepNext.Copy(_obj.XmlChildKeepNext) : {self.}XmlChildKeepNext.Copy(_obj.XmlChildKeepNext); + if not ifnil(_obj.XmlChildKeepLines) then + ifnil({self.}XmlChildKeepLines) ? {self.}KeepLines.Copy(_obj.XmlChildKeepLines) : {self.}XmlChildKeepLines.Copy(_obj.XmlChildKeepLines); + if not ifnil(_obj.XmlChildAdjustRightInd) then + {self.}AdjustRightInd.Copy(_obj.XmlChildAdjustRightInd); + if not ifnil(_obj.XmlChildSpacing) then + {self.}Spacing.Copy(_obj.XmlChildSpacing); + if not ifnil(_obj.XmlChildOutlineLvl) then + {self.}OutlineLvl.Copy(_obj.XmlChildOutlineLvl); + if not ifnil(_obj.XmlChildAutoSpaceDE) then + {self.}AutoSpaceDE.Copy(_obj.XmlChildAutoSpaceDE); + if not ifnil(_obj.XmlChildAutoSpaceDN) then + {self.}AutoSpaceDN.Copy(_obj.XmlChildAutoSpaceDN); + if not ifnil(_obj.XmlChildRPr) then + {self.}RPr.Copy(_obj.XmlChildRPr); + if not ifnil(_obj.XmlChildPBdr) then + {self.}PBdr.Copy(_obj.XmlChildPBdr); + if not ifnil(_obj.XmlChildContextualSpacing) then + ifnil({self.}XmlChildContextualSpacing) ? {self.}ContextualSpacing.Copy(_obj.XmlChildContextualSpacing) : {self.}XmlChildContextualSpacing.Copy(_obj.XmlChildContextualSpacing); + tslassigning := tslassigning_backup; end; function PPr.ReadXmlChildWidowControl(); begin - return ifnil({self.}XmlChildWidowControl.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildWidowControl) then + begin + {self.}XmlChildWidowControl := new OpenXmlEmpty(self, {self.}Prefix, "widowControl"); + container_.Set({self.}XmlChildWidowControl); + return {self.}XmlChildWidowControl; + end + return {self.}XmlChildWidowControl.BoolValue(); end; function PPr.WriteXmlChildWidowControl(_value); begin + if ifnil({self.}XmlChildWidowControl) then + begin + {self.}XmlChildWidowControl := new OpenXmlEmpty(self, {self.}Prefix, "widowControl"); + container_.Set({self.}XmlChildWidowControl); + end {self.}XmlChildWidowControl.Value := _value; end; function PPr.ReadXmlChildKeepNext(); begin - return ifnil({self.}XmlChildKeepNext.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildKeepNext) then + begin + {self.}XmlChildKeepNext := new OpenXmlEmpty(self, {self.}Prefix, "keepNext"); + container_.Set({self.}XmlChildKeepNext); + return {self.}XmlChildKeepNext; + end + return {self.}XmlChildKeepNext.BoolValue(); end; function PPr.WriteXmlChildKeepNext(_value); begin + if ifnil({self.}XmlChildKeepNext) then + begin + {self.}XmlChildKeepNext := new OpenXmlEmpty(self, {self.}Prefix, "keepNext"); + container_.Set({self.}XmlChildKeepNext); + end {self.}XmlChildKeepNext.Value := _value; end; function PPr.ReadXmlChildKeepLines(); begin - return ifnil({self.}XmlChildKeepLines.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildKeepLines) then + begin + {self.}XmlChildKeepLines := new OpenXmlEmpty(self, {self.}Prefix, "keepLines"); + container_.Set({self.}XmlChildKeepLines); + return {self.}XmlChildKeepLines; + end + return {self.}XmlChildKeepLines.BoolValue(); end; function PPr.WriteXmlChildKeepLines(_value); begin + if ifnil({self.}XmlChildKeepLines) then + begin + {self.}XmlChildKeepLines := new OpenXmlEmpty(self, {self.}Prefix, "keepLines"); + container_.Set({self.}XmlChildKeepLines); + end {self.}XmlChildKeepLines.Value := _value; end; function PPr.ReadXmlChildContextualSpacing(); begin - return ifnil({self.}XmlChildContextualSpacing.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildContextualSpacing) then + begin + {self.}XmlChildContextualSpacing := new OpenXmlEmpty(self, {self.}Prefix, "contextualSpacing"); + container_.Set({self.}XmlChildContextualSpacing); + return {self.}XmlChildContextualSpacing; + end + return {self.}XmlChildContextualSpacing.BoolValue(); end; function PPr.WriteXmlChildContextualSpacing(_value); begin + if ifnil({self.}XmlChildContextualSpacing) then + begin + {self.}XmlChildContextualSpacing := new OpenXmlEmpty(self, {self.}Prefix, "contextualSpacing"); + container_.Set({self.}XmlChildContextualSpacing); + end {self.}XmlChildContextualSpacing.Value := _value; end; + +function PPr.ReadXmlChildSectPr(); +begin + if tslassigning and ifnil({self.}XmlChildSectPr) then + begin + {self.}XmlChildSectPr := new SectPr(self, {self.}Prefix, "sectPr"); + container_.Set({self.}XmlChildSectPr); + end + return {self.}XmlChildSectPr; +end; + +function PPr.ReadXmlChildTabs(); +begin + if tslassigning and ifnil({self.}XmlChildTabs) then + begin + {self.}XmlChildTabs := new Tabs(self, {self.}Prefix, "tabs"); + container_.Set({self.}XmlChildTabs); + end + return {self.}XmlChildTabs; +end; + +function PPr.ReadXmlChildSnapToGrid(); +begin + if tslassigning and ifnil({self.}XmlChildSnapToGrid) then + begin + {self.}XmlChildSnapToGrid := new PureWVal(self, {self.}Prefix, "snapToGrid"); + container_.Set({self.}XmlChildSnapToGrid); + end + return {self.}XmlChildSnapToGrid; +end; + +function PPr.ReadXmlChildPStyle(); +begin + if tslassigning and ifnil({self.}XmlChildPStyle) then + begin + {self.}XmlChildPStyle := new PureWVal(self, {self.}Prefix, "pStyle"); + container_.Set({self.}XmlChildPStyle); + end + return {self.}XmlChildPStyle; +end; + +function PPr.ReadXmlChildNumPr(); +begin + if tslassigning and ifnil({self.}XmlChildNumPr) then + begin + {self.}XmlChildNumPr := new NumPr(self, {self.}Prefix, "numPr"); + container_.Set({self.}XmlChildNumPr); + end + return {self.}XmlChildNumPr; +end; + +function PPr.ReadXmlChildJc(); +begin + if tslassigning and ifnil({self.}XmlChildJc) then + begin + {self.}XmlChildJc := new PureWVal(self, {self.}Prefix, "jc"); + container_.Set({self.}XmlChildJc); + end + return {self.}XmlChildJc; +end; + +function PPr.ReadXmlChildInd(); +begin + if tslassigning and ifnil({self.}XmlChildInd) then + begin + {self.}XmlChildInd := new Ind(self, {self.}Prefix, "ind"); + container_.Set({self.}XmlChildInd); + end + return {self.}XmlChildInd; +end; + +function PPr.ReadXmlChildAdjustRightInd(); +begin + if tslassigning and ifnil({self.}XmlChildAdjustRightInd) then + begin + {self.}XmlChildAdjustRightInd := new PureWVal(self, {self.}Prefix, "adjustRightInd"); + container_.Set({self.}XmlChildAdjustRightInd); + end + return {self.}XmlChildAdjustRightInd; +end; + +function PPr.ReadXmlChildSpacing(); +begin + if tslassigning and ifnil({self.}XmlChildSpacing) then + begin + {self.}XmlChildSpacing := new Spacing(self, {self.}Prefix, "spacing"); + container_.Set({self.}XmlChildSpacing); + end + return {self.}XmlChildSpacing; +end; + +function PPr.ReadXmlChildOutlineLvl(); +begin + if tslassigning and ifnil({self.}XmlChildOutlineLvl) then + begin + {self.}XmlChildOutlineLvl := new PureWVal(self, {self.}Prefix, "outlineLvl"); + container_.Set({self.}XmlChildOutlineLvl); + end + return {self.}XmlChildOutlineLvl; +end; + +function PPr.ReadXmlChildAutoSpaceDE(); +begin + if tslassigning and ifnil({self.}XmlChildAutoSpaceDE) then + begin + {self.}XmlChildAutoSpaceDE := new PureWVal(self, {self.}Prefix, "autoSpaceDE"); + container_.Set({self.}XmlChildAutoSpaceDE); + end + return {self.}XmlChildAutoSpaceDE; +end; + +function PPr.ReadXmlChildAutoSpaceDN(); +begin + if tslassigning and ifnil({self.}XmlChildAutoSpaceDN) then + begin + {self.}XmlChildAutoSpaceDN := new PureWVal(self, {self.}Prefix, "autoSpaceDN"); + container_.Set({self.}XmlChildAutoSpaceDN); + end + return {self.}XmlChildAutoSpaceDN; +end; + +function PPr.ReadXmlChildRPr(); +begin + if tslassigning and ifnil({self.}XmlChildRPr) then + begin + {self.}XmlChildRPr := new RPr(self, {self.}Prefix, "rPr"); + container_.Set({self.}XmlChildRPr); + end + return {self.}XmlChildRPr; +end; + +function PPr.ReadXmlChildPBdr(); +begin + if tslassigning and ifnil({self.}XmlChildPBdr) then + begin + {self.}XmlChildPBdr := new PBdr(self, {self.}Prefix, "pBdr"); + container_.Set({self.}XmlChildPBdr); + end + return {self.}XmlChildPBdr; +end; diff --git a/autoclass/docx/PPrDefault@DOCX.tsf b/autoclass/docx/PPrDefault@DOCX.tsf index e4f3df0..12693b4 100644 --- a/autoclass/docx/PPrDefault@DOCX.tsf +++ b/autoclass/docx/PPrDefault@DOCX.tsf @@ -4,16 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: PPrDefault);override; public - // Attributes + // normal property + property PPr read ReadXmlChildPPr; + function ReadXmlChildPPr(); + +public // Children - PPr: PPr; + XmlChildPPr: PPr; end; @@ -29,70 +30,38 @@ end; function PPrDefault.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function PPrDefault.Init();override; begin - {self.}PPr := new PPr(self, {self.}Prefix, "pPr"); -end; - -function PPrDefault.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function PPrDefault.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}PPr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}PPr.ElementName: 0, + pre + "pPr": array(0, makeweakref(thisFunction(ReadXmlChildPPr))), ); -end; - -function PPrDefault.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function PPrDefault.Copy(_obj: PPrDefault);override; begin - {self.}PPr.Copy(_obj.PPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildPPr) then + {self.}PPr.Copy(_obj.XmlChildPPr); + tslassigning := tslassigning_backup; +end; + +function PPrDefault.ReadXmlChildPPr(); +begin + if tslassigning and ifnil({self.}XmlChildPPr) then + begin + {self.}XmlChildPPr := new PPr(self, {self.}Prefix, "pPr"); + container_.Set({self.}XmlChildPPr); + end + return {self.}XmlChildPPr; end; diff --git a/autoclass/docx/Path@DOCX.tsf b/autoclass/docx/Path@DOCX.tsf index ae4053f..bf12fe0 100644 --- a/autoclass/docx/Path@DOCX.tsf +++ b/autoclass/docx/Path@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Path);override; +public + + // attributes property property Gradientshapeok read ReadXmlAttrGradientshapeok write WriteXmlAttrGradientshapeok; property Connecttype read ReadXmlAttrConnecttype write WriteXmlAttrConnecttype; function ReadXmlAttrGradientshapeok(); @@ -17,11 +17,10 @@ public function WriteXmlAttrConnecttype(_value); public - // Attributes + // Attributes XmlAttrGradientshapeok: OpenXmlAttribute; XmlAttrConnecttype: OpenXmlAttribute; - // Children end; @@ -37,45 +36,33 @@ end; function Path.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Path.Init();override; begin - {self.}XmlAttrGradientshapeok := new OpenXmlAttribute(nil, "gradientshapeok", nil); - {self.}XmlAttrConnecttype := new OpenXmlAttribute("o", "connecttype", nil); -end; - -function Path.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrGradientshapeok, - {self.}XmlAttrConnecttype, - ); -end; - -function Path.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "gradientshapeok": makeweakref(thisFunction(WriteXmlAttrGradientshapeok)), + "o:connecttype": makeweakref(thisFunction(WriteXmlAttrConnecttype)), ); sorted_child_ := array( - "": -1, ); -end; - -function Path.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Path.Copy(_obj: Path);override; begin - if not ifnil(_obj.XmlAttrGradientshapeok.Value) then - {self.}XmlAttrGradientshapeok.Value := _obj.XmlAttrGradientshapeok.Value; - if not ifnil(_obj.XmlAttrConnecttype.Value) then - {self.}XmlAttrConnecttype.Value := _obj.XmlAttrConnecttype.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Gradientshapeok) then + {self.}Gradientshapeok := _obj.Gradientshapeok; + if not ifnil(_obj.Connecttype) then + {self.}Connecttype := _obj.Connecttype; + tslassigning := tslassigning_backup; end; function Path.ReadXmlAttrGradientshapeok(); @@ -85,6 +72,11 @@ end; function Path.WriteXmlAttrGradientshapeok(_value); begin + if ifnil({self.}XmlAttrGradientshapeok) then + begin + {self.}XmlAttrGradientshapeok := new OpenXmlAttribute("", "gradientshapeok", nil); + attributes_[length(attributes_)] := {self.}XmlAttrGradientshapeok; + end {self.}XmlAttrGradientshapeok.Value := _value; end; @@ -95,5 +87,10 @@ end; function Path.WriteXmlAttrConnecttype(_value); begin + if ifnil({self.}XmlAttrConnecttype) then + begin + {self.}XmlAttrConnecttype := new OpenXmlAttribute("o", "connecttype", nil); + attributes_[length(attributes_)] := {self.}XmlAttrConnecttype; + end {self.}XmlAttrConnecttype.Value := _value; end; diff --git a/autoclass/docx/PgMar@DOCX.tsf b/autoclass/docx/PgMar@DOCX.tsf index d9668df..83320db 100644 --- a/autoclass/docx/PgMar@DOCX.tsf +++ b/autoclass/docx/PgMar@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: PgMar);override; +public + + // attributes property property Top read ReadXmlAttrTop write WriteXmlAttrTop; property Right read ReadXmlAttrRight write WriteXmlAttrRight; property Bottom read ReadXmlAttrBottom write WriteXmlAttrBottom; @@ -32,7 +32,7 @@ public function WriteXmlAttrGutter(_value); public - // Attributes + // Attributes XmlAttrTop: OpenXmlAttribute; XmlAttrRight: OpenXmlAttribute; XmlAttrBottom: OpenXmlAttribute; @@ -41,7 +41,6 @@ public XmlAttrFooter: OpenXmlAttribute; XmlAttrGutter: OpenXmlAttribute; - // Children end; @@ -57,65 +56,48 @@ end; function PgMar.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function PgMar.Init();override; begin - {self.}XmlAttrTop := new OpenXmlAttribute({self.}Prefix, "top", nil); - {self.}XmlAttrRight := new OpenXmlAttribute({self.}Prefix, "right", nil); - {self.}XmlAttrBottom := new OpenXmlAttribute({self.}Prefix, "bottom", nil); - {self.}XmlAttrLeft := new OpenXmlAttribute({self.}Prefix, "left", nil); - {self.}XmlAttrHeader := new OpenXmlAttribute({self.}Prefix, "header", nil); - {self.}XmlAttrFooter := new OpenXmlAttribute({self.}Prefix, "footer", nil); - {self.}XmlAttrGutter := new OpenXmlAttribute({self.}Prefix, "gutter", nil); -end; - -function PgMar.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrTop, - {self.}XmlAttrRight, - {self.}XmlAttrBottom, - {self.}XmlAttrLeft, - {self.}XmlAttrHeader, - {self.}XmlAttrFooter, - {self.}XmlAttrGutter, - ); -end; - -function PgMar.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "top": makeweakref(thisFunction(WriteXmlAttrTop)), + pre + "right": makeweakref(thisFunction(WriteXmlAttrRight)), + pre + "bottom": makeweakref(thisFunction(WriteXmlAttrBottom)), + pre + "left": makeweakref(thisFunction(WriteXmlAttrLeft)), + pre + "header": makeweakref(thisFunction(WriteXmlAttrHeader)), + pre + "footer": makeweakref(thisFunction(WriteXmlAttrFooter)), + pre + "gutter": makeweakref(thisFunction(WriteXmlAttrGutter)), ); sorted_child_ := array( - "": -1, ); -end; - -function PgMar.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function PgMar.Copy(_obj: PgMar);override; begin - if not ifnil(_obj.XmlAttrTop.Value) then - {self.}XmlAttrTop.Value := _obj.XmlAttrTop.Value; - if not ifnil(_obj.XmlAttrRight.Value) then - {self.}XmlAttrRight.Value := _obj.XmlAttrRight.Value; - if not ifnil(_obj.XmlAttrBottom.Value) then - {self.}XmlAttrBottom.Value := _obj.XmlAttrBottom.Value; - if not ifnil(_obj.XmlAttrLeft.Value) then - {self.}XmlAttrLeft.Value := _obj.XmlAttrLeft.Value; - if not ifnil(_obj.XmlAttrHeader.Value) then - {self.}XmlAttrHeader.Value := _obj.XmlAttrHeader.Value; - if not ifnil(_obj.XmlAttrFooter.Value) then - {self.}XmlAttrFooter.Value := _obj.XmlAttrFooter.Value; - if not ifnil(_obj.XmlAttrGutter.Value) then - {self.}XmlAttrGutter.Value := _obj.XmlAttrGutter.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Top) then + {self.}Top := _obj.Top; + if not ifnil(_obj.Right) then + {self.}Right := _obj.Right; + if not ifnil(_obj.Bottom) then + {self.}Bottom := _obj.Bottom; + if not ifnil(_obj.Left) then + {self.}Left := _obj.Left; + if not ifnil(_obj.Header) then + {self.}Header := _obj.Header; + if not ifnil(_obj.Footer) then + {self.}Footer := _obj.Footer; + if not ifnil(_obj.Gutter) then + {self.}Gutter := _obj.Gutter; + tslassigning := tslassigning_backup; end; function PgMar.ReadXmlAttrTop(); @@ -125,6 +107,11 @@ end; function PgMar.WriteXmlAttrTop(_value); begin + if ifnil({self.}XmlAttrTop) then + begin + {self.}XmlAttrTop := new OpenXmlAttribute({self.}Prefix, "top", nil); + attributes_[length(attributes_)] := {self.}XmlAttrTop; + end {self.}XmlAttrTop.Value := _value; end; @@ -135,6 +122,11 @@ end; function PgMar.WriteXmlAttrRight(_value); begin + if ifnil({self.}XmlAttrRight) then + begin + {self.}XmlAttrRight := new OpenXmlAttribute({self.}Prefix, "right", nil); + attributes_[length(attributes_)] := {self.}XmlAttrRight; + end {self.}XmlAttrRight.Value := _value; end; @@ -145,6 +137,11 @@ end; function PgMar.WriteXmlAttrBottom(_value); begin + if ifnil({self.}XmlAttrBottom) then + begin + {self.}XmlAttrBottom := new OpenXmlAttribute({self.}Prefix, "bottom", nil); + attributes_[length(attributes_)] := {self.}XmlAttrBottom; + end {self.}XmlAttrBottom.Value := _value; end; @@ -155,6 +152,11 @@ end; function PgMar.WriteXmlAttrLeft(_value); begin + if ifnil({self.}XmlAttrLeft) then + begin + {self.}XmlAttrLeft := new OpenXmlAttribute({self.}Prefix, "left", nil); + attributes_[length(attributes_)] := {self.}XmlAttrLeft; + end {self.}XmlAttrLeft.Value := _value; end; @@ -165,6 +167,11 @@ end; function PgMar.WriteXmlAttrHeader(_value); begin + if ifnil({self.}XmlAttrHeader) then + begin + {self.}XmlAttrHeader := new OpenXmlAttribute({self.}Prefix, "header", nil); + attributes_[length(attributes_)] := {self.}XmlAttrHeader; + end {self.}XmlAttrHeader.Value := _value; end; @@ -175,6 +182,11 @@ end; function PgMar.WriteXmlAttrFooter(_value); begin + if ifnil({self.}XmlAttrFooter) then + begin + {self.}XmlAttrFooter := new OpenXmlAttribute({self.}Prefix, "footer", nil); + attributes_[length(attributes_)] := {self.}XmlAttrFooter; + end {self.}XmlAttrFooter.Value := _value; end; @@ -185,5 +197,10 @@ end; function PgMar.WriteXmlAttrGutter(_value); begin + if ifnil({self.}XmlAttrGutter) then + begin + {self.}XmlAttrGutter := new OpenXmlAttribute({self.}Prefix, "gutter", nil); + attributes_[length(attributes_)] := {self.}XmlAttrGutter; + end {self.}XmlAttrGutter.Value := _value; end; diff --git a/autoclass/docx/PgNumType@DOCX.tsf b/autoclass/docx/PgNumType@DOCX.tsf index 6020957..9af1ec8 100644 --- a/autoclass/docx/PgNumType@DOCX.tsf +++ b/autoclass/docx/PgNumType@DOCX.tsf @@ -4,20 +4,19 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: PgNumType);override; +public + + // attributes property property Start read ReadXmlAttrStart write WriteXmlAttrStart; function ReadXmlAttrStart(); function WriteXmlAttrStart(_value); public - // Attributes + // Attributes XmlAttrStart: OpenXmlAttribute; - // Children end; @@ -33,41 +32,30 @@ end; function PgNumType.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function PgNumType.Init();override; begin - {self.}XmlAttrStart := new OpenXmlAttribute({self.}Prefix, "start", nil); -end; - -function PgNumType.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrStart, - ); -end; - -function PgNumType.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "start": makeweakref(thisFunction(WriteXmlAttrStart)), ); sorted_child_ := array( - "": -1, ); -end; - -function PgNumType.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function PgNumType.Copy(_obj: PgNumType);override; begin - if not ifnil(_obj.XmlAttrStart.Value) then - {self.}XmlAttrStart.Value := _obj.XmlAttrStart.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Start) then + {self.}Start := _obj.Start; + tslassigning := tslassigning_backup; end; function PgNumType.ReadXmlAttrStart(); @@ -77,5 +65,10 @@ end; function PgNumType.WriteXmlAttrStart(_value); begin + if ifnil({self.}XmlAttrStart) then + begin + {self.}XmlAttrStart := new OpenXmlAttribute({self.}Prefix, "start", nil); + attributes_[length(attributes_)] := {self.}XmlAttrStart; + end {self.}XmlAttrStart.Value := _value; end; diff --git a/autoclass/docx/PgSz@DOCX.tsf b/autoclass/docx/PgSz@DOCX.tsf index 79cfa69..3f3b5f7 100644 --- a/autoclass/docx/PgSz@DOCX.tsf +++ b/autoclass/docx/PgSz@DOCX.tsf @@ -4,28 +4,31 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: PgSz);override; +public + + // attributes property property W read ReadXmlAttrW write WriteXmlAttrW; property H read ReadXmlAttrH write WriteXmlAttrH; property Orient read ReadXmlAttrOrient write WriteXmlAttrOrient; + property Code read ReadXmlAttrCode write WriteXmlAttrCode; function ReadXmlAttrW(); function WriteXmlAttrW(_value); function ReadXmlAttrH(); function WriteXmlAttrH(_value); function ReadXmlAttrOrient(); function WriteXmlAttrOrient(_value); + function ReadXmlAttrCode(); + function WriteXmlAttrCode(_value); public - // Attributes + // Attributes XmlAttrW: OpenXmlAttribute; XmlAttrH: OpenXmlAttribute; XmlAttrOrient: OpenXmlAttribute; + XmlAttrCode: OpenXmlAttribute; - // Children end; @@ -41,49 +44,39 @@ end; function PgSz.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function PgSz.Init();override; begin - {self.}XmlAttrW := new OpenXmlAttribute({self.}Prefix, "w", nil); - {self.}XmlAttrH := new OpenXmlAttribute({self.}Prefix, "h", nil); - {self.}XmlAttrOrient := new OpenXmlAttribute({self.}Prefix, "orient", nil); -end; - -function PgSz.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrW, - {self.}XmlAttrH, - {self.}XmlAttrOrient, - ); -end; - -function PgSz.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "w": makeweakref(thisFunction(WriteXmlAttrW)), + pre + "h": makeweakref(thisFunction(WriteXmlAttrH)), + pre + "orient": makeweakref(thisFunction(WriteXmlAttrOrient)), + pre + "code": makeweakref(thisFunction(WriteXmlAttrCode)), ); sorted_child_ := array( - "": -1, ); -end; - -function PgSz.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function PgSz.Copy(_obj: PgSz);override; begin - if not ifnil(_obj.XmlAttrW.Value) then - {self.}XmlAttrW.Value := _obj.XmlAttrW.Value; - if not ifnil(_obj.XmlAttrH.Value) then - {self.}XmlAttrH.Value := _obj.XmlAttrH.Value; - if not ifnil(_obj.XmlAttrOrient.Value) then - {self.}XmlAttrOrient.Value := _obj.XmlAttrOrient.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.W) then + {self.}W := _obj.W; + if not ifnil(_obj.H) then + {self.}H := _obj.H; + if not ifnil(_obj.Orient) then + {self.}Orient := _obj.Orient; + if not ifnil(_obj.Code) then + {self.}Code := _obj.Code; + tslassigning := tslassigning_backup; end; function PgSz.ReadXmlAttrW(); @@ -93,6 +86,11 @@ end; function PgSz.WriteXmlAttrW(_value); begin + if ifnil({self.}XmlAttrW) then + begin + {self.}XmlAttrW := new OpenXmlAttribute({self.}Prefix, "w", nil); + attributes_[length(attributes_)] := {self.}XmlAttrW; + end {self.}XmlAttrW.Value := _value; end; @@ -103,6 +101,11 @@ end; function PgSz.WriteXmlAttrH(_value); begin + if ifnil({self.}XmlAttrH) then + begin + {self.}XmlAttrH := new OpenXmlAttribute({self.}Prefix, "h", nil); + attributes_[length(attributes_)] := {self.}XmlAttrH; + end {self.}XmlAttrH.Value := _value; end; @@ -113,5 +116,25 @@ end; function PgSz.WriteXmlAttrOrient(_value); begin + if ifnil({self.}XmlAttrOrient) then + begin + {self.}XmlAttrOrient := new OpenXmlAttribute({self.}Prefix, "orient", nil); + attributes_[length(attributes_)] := {self.}XmlAttrOrient; + end {self.}XmlAttrOrient.Value := _value; end; + +function PgSz.ReadXmlAttrCode(); +begin + return {self.}XmlAttrCode.Value; +end; + +function PgSz.WriteXmlAttrCode(_value); +begin + if ifnil({self.}XmlAttrCode) then + begin + {self.}XmlAttrCode := new OpenXmlAttribute({self.}Prefix, "code", nil); + attributes_[length(attributes_)] := {self.}XmlAttrCode; + end + {self.}XmlAttrCode.Value := _value; +end; diff --git a/autoclass/docx/Pic@DOCX.tsf b/autoclass/docx/Pic@DOCX.tsf index 20e10b2..5bc95ba 100644 --- a/autoclass/docx/Pic@DOCX.tsf +++ b/autoclass/docx/Pic@DOCX.tsf @@ -4,23 +4,31 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Pic);override; +public + + // attributes property property XmlnsPic read ReadXmlAttrXmlnsPic write WriteXmlAttrXmlnsPic; function ReadXmlAttrXmlnsPic(); function WriteXmlAttrXmlnsPic(_value); + // normal property + property NvPicPr read ReadXmlChildNvPicPr; + property BlipFill read ReadXmlChildBlipFill; + property SpPr read ReadXmlChildSpPr; + function ReadXmlChildNvPicPr(); + function ReadXmlChildBlipFill(); + function ReadXmlChildSpPr(); + public - // Attributes + // Attributes XmlAttrXmlnsPic: OpenXmlAttribute; // Children - NvPicPr: NvPicPr; - BlipFill: BlipFill; - SpPr: SpPr; + XmlChildNvPicPr: NvPicPr; + XmlChildBlipFill: BlipFill; + XmlChildSpPr: SpPr; end; @@ -36,84 +44,39 @@ end; function Pic.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Pic.Init();override; begin - {self.}XmlAttrXmlnsPic := new OpenXmlAttribute("xmlns", "pic", nil); - {self.}NvPicPr := new NvPicPr(self, {self.}Prefix, "nvPicPr"); - {self.}BlipFill := new BlipFill(self, {self.}Prefix, "blipFill"); - {self.}SpPr := new SpPr(self, {self.}Prefix, "spPr"); -end; - -function Pic.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXmlnsPic, - ); -end; - -function Pic.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}NvPicPr, - 1: {self.}BlipFill, - 2: {self.}SpPr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns:pic": makeweakref(thisFunction(WriteXmlAttrXmlnsPic)), ); sorted_child_ := array( - "": -1, - {self.}NvPicPr.ElementName: 0, - {self.}BlipFill.ElementName: 1, - {self.}SpPr.ElementName: 2, + pre + "nvPicPr": array(0, makeweakref(thisFunction(ReadXmlChildNvPicPr))), + pre + "blipFill": array(1, makeweakref(thisFunction(ReadXmlChildBlipFill))), + pre + "spPr": array(2, makeweakref(thisFunction(ReadXmlChildSpPr))), ); -end; - -function Pic.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Pic.Copy(_obj: Pic);override; begin - if not ifnil(_obj.XmlAttrXmlnsPic.Value) then - {self.}XmlAttrXmlnsPic.Value := _obj.XmlAttrXmlnsPic.Value; - {self.}NvPicPr.Copy(_obj.NvPicPr); - {self.}BlipFill.Copy(_obj.BlipFill); - {self.}SpPr.Copy(_obj.SpPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlnsPic) then + {self.}XmlnsPic := _obj.XmlnsPic; + if not ifnil(_obj.XmlChildNvPicPr) then + {self.}NvPicPr.Copy(_obj.XmlChildNvPicPr); + if not ifnil(_obj.XmlChildBlipFill) then + {self.}BlipFill.Copy(_obj.XmlChildBlipFill); + if not ifnil(_obj.XmlChildSpPr) then + {self.}SpPr.Copy(_obj.XmlChildSpPr); + tslassigning := tslassigning_backup; end; function Pic.ReadXmlAttrXmlnsPic(); @@ -123,5 +86,40 @@ end; function Pic.WriteXmlAttrXmlnsPic(_value); begin + if ifnil({self.}XmlAttrXmlnsPic) then + begin + {self.}XmlAttrXmlnsPic := new OpenXmlAttribute("xmlns", "pic", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsPic; + end {self.}XmlAttrXmlnsPic.Value := _value; end; + +function Pic.ReadXmlChildNvPicPr(); +begin + if tslassigning and ifnil({self.}XmlChildNvPicPr) then + begin + {self.}XmlChildNvPicPr := new NvPicPr(self, {self.}Prefix, "nvPicPr"); + container_.Set({self.}XmlChildNvPicPr); + end + return {self.}XmlChildNvPicPr; +end; + +function Pic.ReadXmlChildBlipFill(); +begin + if tslassigning and ifnil({self.}XmlChildBlipFill) then + begin + {self.}XmlChildBlipFill := new BlipFill(self, {self.}Prefix, "blipFill"); + container_.Set({self.}XmlChildBlipFill); + end + return {self.}XmlChildBlipFill; +end; + +function Pic.ReadXmlChildSpPr(); +begin + if tslassigning and ifnil({self.}XmlChildSpPr) then + begin + {self.}XmlChildSpPr := new SpPr(self, {self.}Prefix, "spPr"); + container_.Set({self.}XmlChildSpPr); + end + return {self.}XmlChildSpPr; +end; diff --git a/autoclass/docx/PicLocks@DOCX.tsf b/autoclass/docx/PicLocks@DOCX.tsf index 95c0b7b..ec6de36 100644 --- a/autoclass/docx/PicLocks@DOCX.tsf +++ b/autoclass/docx/PicLocks@DOCX.tsf @@ -4,20 +4,19 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: PicLocks);override; +public + + // attributes property property NoChangeAspect read ReadXmlAttrNoChangeAspect write WriteXmlAttrNoChangeAspect; function ReadXmlAttrNoChangeAspect(); function WriteXmlAttrNoChangeAspect(_value); public - // Attributes + // Attributes XmlAttrNoChangeAspect: OpenXmlAttribute; - // Children end; @@ -33,41 +32,30 @@ end; function PicLocks.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function PicLocks.Init();override; begin - {self.}XmlAttrNoChangeAspect := new OpenXmlAttribute(nil, "noChangeAspect", nil); -end; - -function PicLocks.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrNoChangeAspect, - ); -end; - -function PicLocks.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "noChangeAspect": makeweakref(thisFunction(WriteXmlAttrNoChangeAspect)), ); sorted_child_ := array( - "": -1, ); -end; - -function PicLocks.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function PicLocks.Copy(_obj: PicLocks);override; begin - if not ifnil(_obj.XmlAttrNoChangeAspect.Value) then - {self.}XmlAttrNoChangeAspect.Value := _obj.XmlAttrNoChangeAspect.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.NoChangeAspect) then + {self.}NoChangeAspect := _obj.NoChangeAspect; + tslassigning := tslassigning_backup; end; function PicLocks.ReadXmlAttrNoChangeAspect(); @@ -77,5 +65,10 @@ end; function PicLocks.WriteXmlAttrNoChangeAspect(_value); begin + if ifnil({self.}XmlAttrNoChangeAspect) then + begin + {self.}XmlAttrNoChangeAspect := new OpenXmlAttribute("", "noChangeAspect", nil); + attributes_[length(attributes_)] := {self.}XmlAttrNoChangeAspect; + end {self.}XmlAttrNoChangeAspect.Value := _value; end; diff --git a/autoclass/docx/Pict@DOCX.tsf b/autoclass/docx/Pict@DOCX.tsf index 0b382bf..f413b92 100644 --- a/autoclass/docx/Pict@DOCX.tsf +++ b/autoclass/docx/Pict@DOCX.tsf @@ -4,17 +4,20 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Pict);override; public - // Attributes + // normal property + property Shapetype read ReadXmlChildShapetype; + property Shape read ReadXmlChildShape; + function ReadXmlChildShapetype(); + function ReadXmlChildShape(); + +public // Children - Shapetype: Shapetype; - Shape: Shape; + XmlChildShapetype: Shapetype; + XmlChildShape: Shape; end; @@ -30,74 +33,51 @@ end; function Pict.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Pict.Init();override; begin - {self.}Shapetype := new Shapetype(self, "v", "shapetype"); - {self.}Shape := new Shape(self, "v", "shape"); -end; - -function Pict.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Pict.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Shapetype, - 1: {self.}Shape, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}Shapetype.ElementName: 0, - {self.}Shape.ElementName: 1, + "v:shapetype": array(0, makeweakref(thisFunction(ReadXmlChildShapetype))), + "v:shape": array(1, makeweakref(thisFunction(ReadXmlChildShape))), ); -end; - -function Pict.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Pict.Copy(_obj: Pict);override; begin - {self.}Shapetype.Copy(_obj.Shapetype); - {self.}Shape.Copy(_obj.Shape); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildShapetype) then + {self.}Shapetype.Copy(_obj.XmlChildShapetype); + if not ifnil(_obj.XmlChildShape) then + {self.}Shape.Copy(_obj.XmlChildShape); + tslassigning := tslassigning_backup; +end; + +function Pict.ReadXmlChildShapetype(); +begin + if tslassigning and ifnil({self.}XmlChildShapetype) then + begin + {self.}XmlChildShapetype := new Shapetype(self, "v", "shapetype"); + container_.Set({self.}XmlChildShapetype); + end + return {self.}XmlChildShapetype; +end; + +function Pict.ReadXmlChildShape(); +begin + if tslassigning and ifnil({self.}XmlChildShape) then + begin + {self.}XmlChildShape := new Shape(self, "v", "shape"); + container_.Set({self.}XmlChildShape); + end + return {self.}XmlChildShape; end; diff --git a/autoclass/docx/PlotArea@DOCX.tsf b/autoclass/docx/PlotArea@DOCX.tsf index a0a8152..3ec0fad 100644 --- a/autoclass/docx/PlotArea@DOCX.tsf +++ b/autoclass/docx/PlotArea@DOCX.tsf @@ -4,25 +4,35 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: PlotArea);override; +public + + // empty property property Layout read ReadXmlChildLayout write WriteXmlChildLayout; function ReadXmlChildLayout(); function WriteXmlChildLayout(_value); -public - // Attributes + // normal property + property BarChart read ReadXmlChildBarChart; + property CatAx read ReadXmlChildCatAx; + property ValAx read ReadXmlChildValAx; + property DTable read ReadXmlChildDTable; + property SpPr read ReadXmlChildSpPr; + function ReadXmlChildBarChart(); + function ReadXmlChildCatAx(); + function ReadXmlChildValAx(); + function ReadXmlChildDTable(); + function ReadXmlChildSpPr(); +public // Children XmlChildLayout: OpenXmlEmpty; - BarChart: BarChart; - CatAx: Ax; - ValAx: Ax; - DTable: DTable; - SpPr: SpPr; + XmlChildBarChart: BarChart; + XmlChildCatAx: Ax; + XmlChildValAx: Ax; + XmlChildDTable: DTable; + XmlChildSpPr: SpPr; end; @@ -38,100 +48,114 @@ end; function PlotArea.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function PlotArea.Init();override; begin - {self.}XmlChildLayout := new OpenXmlEmpty(self, {self.}Prefix, "layout"); - {self.}BarChart := new BarChart(self, {self.}Prefix, "barChart"); - {self.}CatAx := new Ax(self, {self.}Prefix, "catAx"); - {self.}ValAx := new Ax(self, {self.}Prefix, "ValAx"); - {self.}DTable := new DTable(self, {self.}Prefix, "dTable"); - {self.}SpPr := new SpPr(self, {self.}Prefix, "SpPr"); -end; - -function PlotArea.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function PlotArea.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}XmlChildLayout, - 1: {self.}BarChart, - 2: {self.}CatAx, - 3: {self.}ValAx, - 4: {self.}DTable, - 5: {self.}SpPr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}XmlChildLayout.ElementName: 0, - {self.}BarChart.ElementName: 1, - {self.}CatAx.ElementName: 2, - {self.}ValAx.ElementName: 3, - {self.}DTable.ElementName: 4, - {self.}SpPr.ElementName: 5, + pre + "layout": array(0, makeweakref(thisFunction(ReadXmlChildLayout))), + pre + "barChart": array(1, makeweakref(thisFunction(ReadXmlChildBarChart))), + pre + "catAx": array(2, makeweakref(thisFunction(ReadXmlChildCatAx))), + pre + "ValAx": array(3, makeweakref(thisFunction(ReadXmlChildValAx))), + pre + "dTable": array(4, makeweakref(thisFunction(ReadXmlChildDTable))), + pre + "SpPr": array(5, makeweakref(thisFunction(ReadXmlChildSpPr))), ); -end; - -function PlotArea.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function PlotArea.Copy(_obj: PlotArea);override; begin - {self.}XmlChildLayout.Copy(_obj.XmlChildLayout); - {self.}BarChart.Copy(_obj.BarChart); - {self.}CatAx.Copy(_obj.CatAx); - {self.}ValAx.Copy(_obj.ValAx); - {self.}DTable.Copy(_obj.DTable); - {self.}SpPr.Copy(_obj.SpPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildLayout) then + ifnil({self.}XmlChildLayout) ? {self.}Layout.Copy(_obj.XmlChildLayout) : {self.}XmlChildLayout.Copy(_obj.XmlChildLayout); + if not ifnil(_obj.XmlChildBarChart) then + {self.}BarChart.Copy(_obj.XmlChildBarChart); + if not ifnil(_obj.XmlChildCatAx) then + {self.}CatAx.Copy(_obj.XmlChildCatAx); + if not ifnil(_obj.XmlChildValAx) then + {self.}ValAx.Copy(_obj.XmlChildValAx); + if not ifnil(_obj.XmlChildDTable) then + {self.}DTable.Copy(_obj.XmlChildDTable); + if not ifnil(_obj.XmlChildSpPr) then + {self.}SpPr.Copy(_obj.XmlChildSpPr); + tslassigning := tslassigning_backup; end; function PlotArea.ReadXmlChildLayout(); begin - return ifnil({self.}XmlChildLayout.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildLayout) then + begin + {self.}XmlChildLayout := new OpenXmlEmpty(self, {self.}Prefix, "layout"); + container_.Set({self.}XmlChildLayout); + return {self.}XmlChildLayout; + end + return {self.}XmlChildLayout.BoolValue(); end; function PlotArea.WriteXmlChildLayout(_value); begin + if ifnil({self.}XmlChildLayout) then + begin + {self.}XmlChildLayout := new OpenXmlEmpty(self, {self.}Prefix, "layout"); + container_.Set({self.}XmlChildLayout); + end {self.}XmlChildLayout.Value := _value; end; + +function PlotArea.ReadXmlChildBarChart(); +begin + if tslassigning and ifnil({self.}XmlChildBarChart) then + begin + {self.}XmlChildBarChart := new BarChart(self, {self.}Prefix, "barChart"); + container_.Set({self.}XmlChildBarChart); + end + return {self.}XmlChildBarChart; +end; + +function PlotArea.ReadXmlChildCatAx(); +begin + if tslassigning and ifnil({self.}XmlChildCatAx) then + begin + {self.}XmlChildCatAx := new Ax(self, {self.}Prefix, "catAx"); + container_.Set({self.}XmlChildCatAx); + end + return {self.}XmlChildCatAx; +end; + +function PlotArea.ReadXmlChildValAx(); +begin + if tslassigning and ifnil({self.}XmlChildValAx) then + begin + {self.}XmlChildValAx := new Ax(self, {self.}Prefix, "ValAx"); + container_.Set({self.}XmlChildValAx); + end + return {self.}XmlChildValAx; +end; + +function PlotArea.ReadXmlChildDTable(); +begin + if tslassigning and ifnil({self.}XmlChildDTable) then + begin + {self.}XmlChildDTable := new DTable(self, {self.}Prefix, "dTable"); + container_.Set({self.}XmlChildDTable); + end + return {self.}XmlChildDTable; +end; + +function PlotArea.ReadXmlChildSpPr(); +begin + if tslassigning and ifnil({self.}XmlChildSpPr) then + begin + {self.}XmlChildSpPr := new SpPr(self, {self.}Prefix, "SpPr"); + container_.Set({self.}XmlChildSpPr); + end + return {self.}XmlChildSpPr; +end; diff --git a/autoclass/docx/PositionH@DOCX.tsf b/autoclass/docx/PositionH@DOCX.tsf index 9999ba0..7de6292 100644 --- a/autoclass/docx/PositionH@DOCX.tsf +++ b/autoclass/docx/PositionH@DOCX.tsf @@ -4,21 +4,25 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: PositionH);override; +public + + // attributes property property RelativeFrom read ReadXmlAttrRelativeFrom write WriteXmlAttrRelativeFrom; function ReadXmlAttrRelativeFrom(); function WriteXmlAttrRelativeFrom(_value); + // pcdata property + property PosOffset read ReadXmlChildPosOffset; + function ReadXmlChildPosOffset(); + public - // Attributes + // Attributes XmlAttrRelativeFrom: OpenXmlAttribute; // Children - PosOffset: OpenXmlPcdata; + XmlChildPosOffset: OpenXmlPcdata; end; @@ -34,76 +38,33 @@ end; function PositionH.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function PositionH.Init();override; begin - {self.}XmlAttrRelativeFrom := new OpenXmlAttribute(nil, "relativeFrom", nil); - {self.}PosOffset := new OpenXmlPcdata(self, {self.}Prefix, "posOffset"); -end; - -function PositionH.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrRelativeFrom, - ); -end; - -function PositionH.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}PosOffset, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "relativeFrom": makeweakref(thisFunction(WriteXmlAttrRelativeFrom)), ); sorted_child_ := array( - "": -1, - {self.}PosOffset.ElementName: 0, + pre + "posOffset": array(0, makeweakref(thisFunction(ReadXmlChildPosOffset))), ); -end; - -function PositionH.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function PositionH.Copy(_obj: PositionH);override; begin - if not ifnil(_obj.XmlAttrRelativeFrom.Value) then - {self.}XmlAttrRelativeFrom.Value := _obj.XmlAttrRelativeFrom.Value; - {self.}PosOffset.Copy(_obj.PosOffset); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.RelativeFrom) then + {self.}RelativeFrom := _obj.RelativeFrom; + if not ifnil(_obj.XmlChildPosOffset) then + {self.}PosOffset.Copy(_obj.XmlChildPosOffset); + tslassigning := tslassigning_backup; end; function PositionH.ReadXmlAttrRelativeFrom(); @@ -113,5 +74,20 @@ end; function PositionH.WriteXmlAttrRelativeFrom(_value); begin + if ifnil({self.}XmlAttrRelativeFrom) then + begin + {self.}XmlAttrRelativeFrom := new OpenXmlAttribute("", "relativeFrom", nil); + attributes_[length(attributes_)] := {self.}XmlAttrRelativeFrom; + end {self.}XmlAttrRelativeFrom.Value := _value; end; + +function PositionH.ReadXmlChildPosOffset(); +begin + if tslassigning and ifnil({self.}XmlChildPosOffset) then + begin + {self.}XmlChildPosOffset := new OpenXmlPcdata(self, {self.}Prefix, "posOffset"); + container_.Set({self.}XmlChildPosOffset); + end + return {self.}XmlChildPosOffset; +end; diff --git a/autoclass/docx/PositionV@DOCX.tsf b/autoclass/docx/PositionV@DOCX.tsf index e649005..493b553 100644 --- a/autoclass/docx/PositionV@DOCX.tsf +++ b/autoclass/docx/PositionV@DOCX.tsf @@ -4,21 +4,25 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: PositionV);override; +public + + // attributes property property RelativeFrom read ReadXmlAttrRelativeFrom write WriteXmlAttrRelativeFrom; function ReadXmlAttrRelativeFrom(); function WriteXmlAttrRelativeFrom(_value); + // pcdata property + property PosOffset read ReadXmlChildPosOffset; + function ReadXmlChildPosOffset(); + public - // Attributes + // Attributes XmlAttrRelativeFrom: OpenXmlAttribute; // Children - PosOffset: OpenXmlPcdata; + XmlChildPosOffset: OpenXmlPcdata; end; @@ -34,76 +38,33 @@ end; function PositionV.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function PositionV.Init();override; begin - {self.}XmlAttrRelativeFrom := new OpenXmlAttribute(nil, "relativeFrom", nil); - {self.}PosOffset := new OpenXmlPcdata(self, {self.}Prefix, "posOffset"); -end; - -function PositionV.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrRelativeFrom, - ); -end; - -function PositionV.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}PosOffset, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "relativeFrom": makeweakref(thisFunction(WriteXmlAttrRelativeFrom)), ); sorted_child_ := array( - "": -1, - {self.}PosOffset.ElementName: 0, + pre + "posOffset": array(0, makeweakref(thisFunction(ReadXmlChildPosOffset))), ); -end; - -function PositionV.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function PositionV.Copy(_obj: PositionV);override; begin - if not ifnil(_obj.XmlAttrRelativeFrom.Value) then - {self.}XmlAttrRelativeFrom.Value := _obj.XmlAttrRelativeFrom.Value; - {self.}PosOffset.Copy(_obj.PosOffset); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.RelativeFrom) then + {self.}RelativeFrom := _obj.RelativeFrom; + if not ifnil(_obj.XmlChildPosOffset) then + {self.}PosOffset.Copy(_obj.XmlChildPosOffset); + tslassigning := tslassigning_backup; end; function PositionV.ReadXmlAttrRelativeFrom(); @@ -113,5 +74,20 @@ end; function PositionV.WriteXmlAttrRelativeFrom(_value); begin + if ifnil({self.}XmlAttrRelativeFrom) then + begin + {self.}XmlAttrRelativeFrom := new OpenXmlAttribute("", "relativeFrom", nil); + attributes_[length(attributes_)] := {self.}XmlAttrRelativeFrom; + end {self.}XmlAttrRelativeFrom.Value := _value; end; + +function PositionV.ReadXmlChildPosOffset(); +begin + if tslassigning and ifnil({self.}XmlChildPosOffset) then + begin + {self.}XmlChildPosOffset := new OpenXmlPcdata(self, {self.}Prefix, "posOffset"); + container_.Set({self.}XmlChildPosOffset); + end + return {self.}XmlChildPosOffset; +end; diff --git a/autoclass/docx/Properties@DOCX.tsf b/autoclass/docx/Properties@DOCX.tsf index 3c57ecd..38dcae8 100644 --- a/autoclass/docx/Properties@DOCX.tsf +++ b/autoclass/docx/Properties@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Properties);override; +public + + // attributes property property Xmlns read ReadXmlAttrXmlns write WriteXmlAttrXmlns; property XmlnsVt read ReadXmlAttrXmlnsVt write WriteXmlAttrXmlnsVt; function ReadXmlAttrXmlns(); @@ -16,34 +16,68 @@ public function ReadXmlAttrXmlnsVt(); function WriteXmlAttrXmlnsVt(_value); + // pcdata property + property Template read ReadXmlChildTemplate; + property TotalTime read ReadXmlChildTotalTime; + property Pages read ReadXmlChildPages; + property Words read ReadXmlChildWords; + property Characters read ReadXmlChildCharacters; + property Application read ReadXmlChildApplication; + property DocSecurity read ReadXmlChildDocSecurity; + property Lines read ReadXmlChildLines; + property Paragraphs read ReadXmlChildParagraphs; + property ScaleCrop read ReadXmlChildScaleCrop; + property Company read ReadXmlChildCompany; + property LinksUpToDate read ReadXmlChildLinksUpToDate; + property CharactersWithSpaces read ReadXmlChildCharactersWithSpaces; + property SharedDoc read ReadXmlChildSharedDoc; + property HyperlinksChanged read ReadXmlChildHyperlinksChanged; + property AppVersion read ReadXmlChildAppVersion; + function ReadXmlChildTemplate(); + function ReadXmlChildTotalTime(); + function ReadXmlChildPages(); + function ReadXmlChildWords(); + function ReadXmlChildCharacters(); + function ReadXmlChildApplication(); + function ReadXmlChildDocSecurity(); + function ReadXmlChildLines(); + function ReadXmlChildParagraphs(); + function ReadXmlChildScaleCrop(); + function ReadXmlChildCompany(); + function ReadXmlChildLinksUpToDate(); + function ReadXmlChildCharactersWithSpaces(); + function ReadXmlChildSharedDoc(); + function ReadXmlChildHyperlinksChanged(); + function ReadXmlChildAppVersion(); + public - // Attributes + // Attributes XmlAttrXmlns: OpenXmlAttribute; XmlAttrXmlnsVt: OpenXmlAttribute; // Children - Template: OpenXmlPcdata; - TotalTime: OpenXmlPcdata; - Pages: OpenXmlPcdata; - Words: OpenXmlPcdata; - Characters: OpenXmlPcdata; - Application: OpenXmlPcdata; - DocSecurity: OpenXmlPcdata; - Lines: OpenXmlPcdata; - Paragraphs: OpenXmlPcdata; - ScaleCrop: OpenXmlPcdata; - Company: OpenXmlPcdata; - LinksUpToDate: OpenXmlPcdata; - CharactersWithSpaces: OpenXmlPcdata; - SharedDoc: OpenXmlPcdata; - HyperlinksChanged: OpenXmlPcdata; - AppVersion: OpenXmlPcdata; + XmlChildTemplate: OpenXmlPcdata; + XmlChildTotalTime: OpenXmlPcdata; + XmlChildPages: OpenXmlPcdata; + XmlChildWords: OpenXmlPcdata; + XmlChildCharacters: OpenXmlPcdata; + XmlChildApplication: OpenXmlPcdata; + XmlChildDocSecurity: OpenXmlPcdata; + XmlChildLines: OpenXmlPcdata; + XmlChildParagraphs: OpenXmlPcdata; + XmlChildScaleCrop: OpenXmlPcdata; + XmlChildCompany: OpenXmlPcdata; + XmlChildLinksUpToDate: OpenXmlPcdata; + XmlChildCharactersWithSpaces: OpenXmlPcdata; + XmlChildSharedDoc: OpenXmlPcdata; + XmlChildHyperlinksChanged: OpenXmlPcdata; + XmlChildAppVersion: OpenXmlPcdata; end; function Properties.Create();overload; begin - {self.}Create(nil, nil, "Properties"); + {self.}Create(nil, "", "Properties"); end; function Properties.Create(_node: XmlNode);overload; @@ -53,140 +87,81 @@ end; function Properties.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Properties.Init();override; begin - {self.}XmlAttrXmlns := new OpenXmlAttribute(nil, "xmlns", nil); - {self.}XmlAttrXmlnsVt := new OpenXmlAttribute("xmlns", "vt", nil); - {self.}Template := new OpenXmlPcdata(self, nil, "Template"); - {self.}TotalTime := new OpenXmlPcdata(self, nil, "TotalTime"); - {self.}Pages := new OpenXmlPcdata(self, nil, "Pages"); - {self.}Words := new OpenXmlPcdata(self, nil, "Words"); - {self.}Characters := new OpenXmlPcdata(self, nil, "Characters"); - {self.}Application := new OpenXmlPcdata(self, nil, "Application"); - {self.}DocSecurity := new OpenXmlPcdata(self, nil, "DocSecurity"); - {self.}Lines := new OpenXmlPcdata(self, nil, "Lines"); - {self.}Paragraphs := new OpenXmlPcdata(self, nil, "Paragraphs"); - {self.}ScaleCrop := new OpenXmlPcdata(self, nil, "ScaleCrop"); - {self.}Company := new OpenXmlPcdata(self, nil, "Company"); - {self.}LinksUpToDate := new OpenXmlPcdata(self, nil, "LinksUpToDate"); - {self.}CharactersWithSpaces := new OpenXmlPcdata(self, nil, "charactersWithSpaces"); - {self.}SharedDoc := new OpenXmlPcdata(self, nil, "SharedDoc"); - {self.}HyperlinksChanged := new OpenXmlPcdata(self, nil, "HyperlinksChanged"); - {self.}AppVersion := new OpenXmlPcdata(self, nil, "AppVersion"); -end; - -function Properties.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXmlns, - {self.}XmlAttrXmlnsVt, - ); -end; - -function Properties.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Template, - 1: {self.}TotalTime, - 2: {self.}Pages, - 3: {self.}Words, - 4: {self.}Characters, - 5: {self.}Application, - 6: {self.}DocSecurity, - 7: {self.}Lines, - 8: {self.}Paragraphs, - 9: {self.}ScaleCrop, - 10: {self.}Company, - 11: {self.}LinksUpToDate, - 12: {self.}CharactersWithSpaces, - 13: {self.}SharedDoc, - 14: {self.}HyperlinksChanged, - 15: {self.}AppVersion, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns": makeweakref(thisFunction(WriteXmlAttrXmlns)), + "xmlns:vt": makeweakref(thisFunction(WriteXmlAttrXmlnsVt)), ); sorted_child_ := array( - "": -1, - {self.}Template.ElementName: 0, - {self.}TotalTime.ElementName: 1, - {self.}Pages.ElementName: 2, - {self.}Words.ElementName: 3, - {self.}Characters.ElementName: 4, - {self.}Application.ElementName: 5, - {self.}DocSecurity.ElementName: 6, - {self.}Lines.ElementName: 7, - {self.}Paragraphs.ElementName: 8, - {self.}ScaleCrop.ElementName: 9, - {self.}Company.ElementName: 10, - {self.}LinksUpToDate.ElementName: 11, - {self.}CharactersWithSpaces.ElementName: 12, - {self.}SharedDoc.ElementName: 13, - {self.}HyperlinksChanged.ElementName: 14, - {self.}AppVersion.ElementName: 15, + "Template": array(0, makeweakref(thisFunction(ReadXmlChildTemplate))), + "TotalTime": array(1, makeweakref(thisFunction(ReadXmlChildTotalTime))), + "Pages": array(2, makeweakref(thisFunction(ReadXmlChildPages))), + "Words": array(3, makeweakref(thisFunction(ReadXmlChildWords))), + "Characters": array(4, makeweakref(thisFunction(ReadXmlChildCharacters))), + "Application": array(5, makeweakref(thisFunction(ReadXmlChildApplication))), + "DocSecurity": array(6, makeweakref(thisFunction(ReadXmlChildDocSecurity))), + "Lines": array(7, makeweakref(thisFunction(ReadXmlChildLines))), + "Paragraphs": array(8, makeweakref(thisFunction(ReadXmlChildParagraphs))), + "ScaleCrop": array(9, makeweakref(thisFunction(ReadXmlChildScaleCrop))), + "Company": array(10, makeweakref(thisFunction(ReadXmlChildCompany))), + "LinksUpToDate": array(11, makeweakref(thisFunction(ReadXmlChildLinksUpToDate))), + "charactersWithSpaces": array(12, makeweakref(thisFunction(ReadXmlChildCharactersWithSpaces))), + "SharedDoc": array(13, makeweakref(thisFunction(ReadXmlChildSharedDoc))), + "HyperlinksChanged": array(14, makeweakref(thisFunction(ReadXmlChildHyperlinksChanged))), + "AppVersion": array(15, makeweakref(thisFunction(ReadXmlChildAppVersion))), ); -end; - -function Properties.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Properties.Copy(_obj: Properties);override; begin - if not ifnil(_obj.XmlAttrXmlns.Value) then - {self.}XmlAttrXmlns.Value := _obj.XmlAttrXmlns.Value; - if not ifnil(_obj.XmlAttrXmlnsVt.Value) then - {self.}XmlAttrXmlnsVt.Value := _obj.XmlAttrXmlnsVt.Value; - {self.}Template.Copy(_obj.Template); - {self.}TotalTime.Copy(_obj.TotalTime); - {self.}Pages.Copy(_obj.Pages); - {self.}Words.Copy(_obj.Words); - {self.}Characters.Copy(_obj.Characters); - {self.}Application.Copy(_obj.Application); - {self.}DocSecurity.Copy(_obj.DocSecurity); - {self.}Lines.Copy(_obj.Lines); - {self.}Paragraphs.Copy(_obj.Paragraphs); - {self.}ScaleCrop.Copy(_obj.ScaleCrop); - {self.}Company.Copy(_obj.Company); - {self.}LinksUpToDate.Copy(_obj.LinksUpToDate); - {self.}CharactersWithSpaces.Copy(_obj.CharactersWithSpaces); - {self.}SharedDoc.Copy(_obj.SharedDoc); - {self.}HyperlinksChanged.Copy(_obj.HyperlinksChanged); - {self.}AppVersion.Copy(_obj.AppVersion); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Xmlns) then + {self.}Xmlns := _obj.Xmlns; + if not ifnil(_obj.XmlnsVt) then + {self.}XmlnsVt := _obj.XmlnsVt; + if not ifnil(_obj.XmlChildTemplate) then + {self.}Template.Copy(_obj.XmlChildTemplate); + if not ifnil(_obj.XmlChildTotalTime) then + {self.}TotalTime.Copy(_obj.XmlChildTotalTime); + if not ifnil(_obj.XmlChildPages) then + {self.}Pages.Copy(_obj.XmlChildPages); + if not ifnil(_obj.XmlChildWords) then + {self.}Words.Copy(_obj.XmlChildWords); + if not ifnil(_obj.XmlChildCharacters) then + {self.}Characters.Copy(_obj.XmlChildCharacters); + if not ifnil(_obj.XmlChildApplication) then + {self.}Application.Copy(_obj.XmlChildApplication); + if not ifnil(_obj.XmlChildDocSecurity) then + {self.}DocSecurity.Copy(_obj.XmlChildDocSecurity); + if not ifnil(_obj.XmlChildLines) then + {self.}Lines.Copy(_obj.XmlChildLines); + if not ifnil(_obj.XmlChildParagraphs) then + {self.}Paragraphs.Copy(_obj.XmlChildParagraphs); + if not ifnil(_obj.XmlChildScaleCrop) then + {self.}ScaleCrop.Copy(_obj.XmlChildScaleCrop); + if not ifnil(_obj.XmlChildCompany) then + {self.}Company.Copy(_obj.XmlChildCompany); + if not ifnil(_obj.XmlChildLinksUpToDate) then + {self.}LinksUpToDate.Copy(_obj.XmlChildLinksUpToDate); + if not ifnil(_obj.XmlChildCharactersWithSpaces) then + {self.}CharactersWithSpaces.Copy(_obj.XmlChildCharactersWithSpaces); + if not ifnil(_obj.XmlChildSharedDoc) then + {self.}SharedDoc.Copy(_obj.XmlChildSharedDoc); + if not ifnil(_obj.XmlChildHyperlinksChanged) then + {self.}HyperlinksChanged.Copy(_obj.XmlChildHyperlinksChanged); + if not ifnil(_obj.XmlChildAppVersion) then + {self.}AppVersion.Copy(_obj.XmlChildAppVersion); + tslassigning := tslassigning_backup; end; function Properties.ReadXmlAttrXmlns(); @@ -196,6 +171,11 @@ end; function Properties.WriteXmlAttrXmlns(_value); begin + if ifnil({self.}XmlAttrXmlns) then + begin + {self.}XmlAttrXmlns := new OpenXmlAttribute("", "xmlns", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlns; + end {self.}XmlAttrXmlns.Value := _value; end; @@ -206,5 +186,170 @@ end; function Properties.WriteXmlAttrXmlnsVt(_value); begin + if ifnil({self.}XmlAttrXmlnsVt) then + begin + {self.}XmlAttrXmlnsVt := new OpenXmlAttribute("xmlns", "vt", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsVt; + end {self.}XmlAttrXmlnsVt.Value := _value; end; + +function Properties.ReadXmlChildTemplate(); +begin + if tslassigning and ifnil({self.}XmlChildTemplate) then + begin + {self.}XmlChildTemplate := new OpenXmlPcdata(self, "", "Template"); + container_.Set({self.}XmlChildTemplate); + end + return {self.}XmlChildTemplate; +end; + +function Properties.ReadXmlChildTotalTime(); +begin + if tslassigning and ifnil({self.}XmlChildTotalTime) then + begin + {self.}XmlChildTotalTime := new OpenXmlPcdata(self, "", "TotalTime"); + container_.Set({self.}XmlChildTotalTime); + end + return {self.}XmlChildTotalTime; +end; + +function Properties.ReadXmlChildPages(); +begin + if tslassigning and ifnil({self.}XmlChildPages) then + begin + {self.}XmlChildPages := new OpenXmlPcdata(self, "", "Pages"); + container_.Set({self.}XmlChildPages); + end + return {self.}XmlChildPages; +end; + +function Properties.ReadXmlChildWords(); +begin + if tslassigning and ifnil({self.}XmlChildWords) then + begin + {self.}XmlChildWords := new OpenXmlPcdata(self, "", "Words"); + container_.Set({self.}XmlChildWords); + end + return {self.}XmlChildWords; +end; + +function Properties.ReadXmlChildCharacters(); +begin + if tslassigning and ifnil({self.}XmlChildCharacters) then + begin + {self.}XmlChildCharacters := new OpenXmlPcdata(self, "", "Characters"); + container_.Set({self.}XmlChildCharacters); + end + return {self.}XmlChildCharacters; +end; + +function Properties.ReadXmlChildApplication(); +begin + if tslassigning and ifnil({self.}XmlChildApplication) then + begin + {self.}XmlChildApplication := new OpenXmlPcdata(self, "", "Application"); + container_.Set({self.}XmlChildApplication); + end + return {self.}XmlChildApplication; +end; + +function Properties.ReadXmlChildDocSecurity(); +begin + if tslassigning and ifnil({self.}XmlChildDocSecurity) then + begin + {self.}XmlChildDocSecurity := new OpenXmlPcdata(self, "", "DocSecurity"); + container_.Set({self.}XmlChildDocSecurity); + end + return {self.}XmlChildDocSecurity; +end; + +function Properties.ReadXmlChildLines(); +begin + if tslassigning and ifnil({self.}XmlChildLines) then + begin + {self.}XmlChildLines := new OpenXmlPcdata(self, "", "Lines"); + container_.Set({self.}XmlChildLines); + end + return {self.}XmlChildLines; +end; + +function Properties.ReadXmlChildParagraphs(); +begin + if tslassigning and ifnil({self.}XmlChildParagraphs) then + begin + {self.}XmlChildParagraphs := new OpenXmlPcdata(self, "", "Paragraphs"); + container_.Set({self.}XmlChildParagraphs); + end + return {self.}XmlChildParagraphs; +end; + +function Properties.ReadXmlChildScaleCrop(); +begin + if tslassigning and ifnil({self.}XmlChildScaleCrop) then + begin + {self.}XmlChildScaleCrop := new OpenXmlPcdata(self, "", "ScaleCrop"); + container_.Set({self.}XmlChildScaleCrop); + end + return {self.}XmlChildScaleCrop; +end; + +function Properties.ReadXmlChildCompany(); +begin + if tslassigning and ifnil({self.}XmlChildCompany) then + begin + {self.}XmlChildCompany := new OpenXmlPcdata(self, "", "Company"); + container_.Set({self.}XmlChildCompany); + end + return {self.}XmlChildCompany; +end; + +function Properties.ReadXmlChildLinksUpToDate(); +begin + if tslassigning and ifnil({self.}XmlChildLinksUpToDate) then + begin + {self.}XmlChildLinksUpToDate := new OpenXmlPcdata(self, "", "LinksUpToDate"); + container_.Set({self.}XmlChildLinksUpToDate); + end + return {self.}XmlChildLinksUpToDate; +end; + +function Properties.ReadXmlChildCharactersWithSpaces(); +begin + if tslassigning and ifnil({self.}XmlChildCharactersWithSpaces) then + begin + {self.}XmlChildCharactersWithSpaces := new OpenXmlPcdata(self, "", "charactersWithSpaces"); + container_.Set({self.}XmlChildCharactersWithSpaces); + end + return {self.}XmlChildCharactersWithSpaces; +end; + +function Properties.ReadXmlChildSharedDoc(); +begin + if tslassigning and ifnil({self.}XmlChildSharedDoc) then + begin + {self.}XmlChildSharedDoc := new OpenXmlPcdata(self, "", "SharedDoc"); + container_.Set({self.}XmlChildSharedDoc); + end + return {self.}XmlChildSharedDoc; +end; + +function Properties.ReadXmlChildHyperlinksChanged(); +begin + if tslassigning and ifnil({self.}XmlChildHyperlinksChanged) then + begin + {self.}XmlChildHyperlinksChanged := new OpenXmlPcdata(self, "", "HyperlinksChanged"); + container_.Set({self.}XmlChildHyperlinksChanged); + end + return {self.}XmlChildHyperlinksChanged; +end; + +function Properties.ReadXmlChildAppVersion(); +begin + if tslassigning and ifnil({self.}XmlChildAppVersion) then + begin + {self.}XmlChildAppVersion := new OpenXmlPcdata(self, "", "AppVersion"); + container_.Set({self.}XmlChildAppVersion); + end + return {self.}XmlChildAppVersion; +end; diff --git a/autoclass/docx/PrstGeom@DOCX.tsf b/autoclass/docx/PrstGeom@DOCX.tsf index 2f85d72..a34c16c 100644 --- a/autoclass/docx/PrstGeom@DOCX.tsf +++ b/autoclass/docx/PrstGeom@DOCX.tsf @@ -4,21 +4,25 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: PrstGeom);override; +public + + // attributes property property Prst read ReadXmlAttrPrst write WriteXmlAttrPrst; function ReadXmlAttrPrst(); function WriteXmlAttrPrst(_value); + // normal property + property AvLst read ReadXmlChildAvLst; + function ReadXmlChildAvLst(); + public - // Attributes + // Attributes XmlAttrPrst: OpenXmlAttribute; // Children - AvLst: PureVal; + XmlChildAvLst: PureVal; end; @@ -34,76 +38,33 @@ end; function PrstGeom.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function PrstGeom.Init();override; begin - {self.}XmlAttrPrst := new OpenXmlAttribute(nil, "prst", nil); - {self.}AvLst := new PureVal(self, {self.}Prefix, "avLst"); -end; - -function PrstGeom.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrPrst, - ); -end; - -function PrstGeom.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}AvLst, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "prst": makeweakref(thisFunction(WriteXmlAttrPrst)), ); sorted_child_ := array( - "": -1, - {self.}AvLst.ElementName: 0, + pre + "avLst": array(0, makeweakref(thisFunction(ReadXmlChildAvLst))), ); -end; - -function PrstGeom.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function PrstGeom.Copy(_obj: PrstGeom);override; begin - if not ifnil(_obj.XmlAttrPrst.Value) then - {self.}XmlAttrPrst.Value := _obj.XmlAttrPrst.Value; - {self.}AvLst.Copy(_obj.AvLst); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Prst) then + {self.}Prst := _obj.Prst; + if not ifnil(_obj.XmlChildAvLst) then + {self.}AvLst.Copy(_obj.XmlChildAvLst); + tslassigning := tslassigning_backup; end; function PrstGeom.ReadXmlAttrPrst(); @@ -113,5 +74,20 @@ end; function PrstGeom.WriteXmlAttrPrst(_value); begin + if ifnil({self.}XmlAttrPrst) then + begin + {self.}XmlAttrPrst := new OpenXmlAttribute("", "prst", nil); + attributes_[length(attributes_)] := {self.}XmlAttrPrst; + end {self.}XmlAttrPrst.Value := _value; end; + +function PrstGeom.ReadXmlChildAvLst(); +begin + if tslassigning and ifnil({self.}XmlChildAvLst) then + begin + {self.}XmlChildAvLst := new PureVal(self, {self.}Prefix, "avLst"); + container_.Set({self.}XmlChildAvLst); + end + return {self.}XmlChildAvLst; +end; diff --git a/autoclass/docx/PrstTxWrap@DOCX.tsf b/autoclass/docx/PrstTxWrap@DOCX.tsf index d913c4d..df74f4a 100644 --- a/autoclass/docx/PrstTxWrap@DOCX.tsf +++ b/autoclass/docx/PrstTxWrap@DOCX.tsf @@ -4,21 +4,22 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: PrstTxWrap);override; +public + + // attributes property property Prst read ReadXmlAttrPrst write WriteXmlAttrPrst; function ReadXmlAttrPrst(); function WriteXmlAttrPrst(_value); + // empty property property AvLst read ReadXmlChildAvLst write WriteXmlChildAvLst; function ReadXmlChildAvLst(); function WriteXmlChildAvLst(_value); public - // Attributes + // Attributes XmlAttrPrst: OpenXmlAttribute; // Children @@ -38,76 +39,33 @@ end; function PrstTxWrap.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function PrstTxWrap.Init();override; begin - {self.}XmlAttrPrst := new OpenXmlAttribute(nil, "prst", nil); - {self.}XmlChildAvLst := new OpenXmlEmpty(self, "a", "avLst"); -end; - -function PrstTxWrap.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrPrst, - ); -end; - -function PrstTxWrap.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}XmlChildAvLst, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "prst": makeweakref(thisFunction(WriteXmlAttrPrst)), ); sorted_child_ := array( - "": -1, - {self.}XmlChildAvLst.ElementName: 0, + "a:avLst": array(0, makeweakref(thisFunction(ReadXmlChildAvLst))), ); -end; - -function PrstTxWrap.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function PrstTxWrap.Copy(_obj: PrstTxWrap);override; begin - if not ifnil(_obj.XmlAttrPrst.Value) then - {self.}XmlAttrPrst.Value := _obj.XmlAttrPrst.Value; - {self.}XmlChildAvLst.Copy(_obj.XmlChildAvLst); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Prst) then + {self.}Prst := _obj.Prst; + if not ifnil(_obj.XmlChildAvLst) then + ifnil({self.}XmlChildAvLst) ? {self.}AvLst.Copy(_obj.XmlChildAvLst) : {self.}XmlChildAvLst.Copy(_obj.XmlChildAvLst); + tslassigning := tslassigning_backup; end; function PrstTxWrap.ReadXmlAttrPrst(); @@ -117,15 +75,31 @@ end; function PrstTxWrap.WriteXmlAttrPrst(_value); begin + if ifnil({self.}XmlAttrPrst) then + begin + {self.}XmlAttrPrst := new OpenXmlAttribute("", "prst", nil); + attributes_[length(attributes_)] := {self.}XmlAttrPrst; + end {self.}XmlAttrPrst.Value := _value; end; function PrstTxWrap.ReadXmlChildAvLst(); begin - return ifnil({self.}XmlChildAvLst.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildAvLst) then + begin + {self.}XmlChildAvLst := new OpenXmlEmpty(self, "a", "avLst"); + container_.Set({self.}XmlChildAvLst); + return {self.}XmlChildAvLst; + end + return {self.}XmlChildAvLst.BoolValue(); end; function PrstTxWrap.WriteXmlChildAvLst(_value); begin + if ifnil({self.}XmlChildAvLst) then + begin + {self.}XmlChildAvLst := new OpenXmlEmpty(self, "a", "avLst"); + container_.Set({self.}XmlChildAvLst); + end {self.}XmlChildAvLst.Value := _value; end; diff --git a/autoclass/docx/Pt@DOCX.tsf b/autoclass/docx/Pt@DOCX.tsf index da45c9f..45b9f53 100644 --- a/autoclass/docx/Pt@DOCX.tsf +++ b/autoclass/docx/Pt@DOCX.tsf @@ -4,21 +4,25 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Pt);override; +public + + // attributes property property Idx read ReadXmlAttrIdx write WriteXmlAttrIdx; function ReadXmlAttrIdx(); function WriteXmlAttrIdx(_value); + // pcdata property + property V read ReadXmlChildV; + function ReadXmlChildV(); + public - // Attributes + // Attributes XmlAttrIdx: OpenXmlAttribute; // Children - V: OpenXmlPcdata; + XmlChildV: OpenXmlPcdata; end; @@ -34,76 +38,33 @@ end; function Pt.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Pt.Init();override; begin - {self.}XmlAttrIdx := new OpenXmlAttribute(nil, "idx", nil); - {self.}V := new OpenXmlPcdata(self, {self.}Prefix, "v"); -end; - -function Pt.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrIdx, - ); -end; - -function Pt.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}V, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "idx": makeweakref(thisFunction(WriteXmlAttrIdx)), ); sorted_child_ := array( - "": -1, - {self.}V.ElementName: 0, + pre + "v": array(0, makeweakref(thisFunction(ReadXmlChildV))), ); -end; - -function Pt.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Pt.Copy(_obj: Pt);override; begin - if not ifnil(_obj.XmlAttrIdx.Value) then - {self.}XmlAttrIdx.Value := _obj.XmlAttrIdx.Value; - {self.}V.Copy(_obj.V); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Idx) then + {self.}Idx := _obj.Idx; + if not ifnil(_obj.XmlChildV) then + {self.}V.Copy(_obj.XmlChildV); + tslassigning := tslassigning_backup; end; function Pt.ReadXmlAttrIdx(); @@ -113,5 +74,20 @@ end; function Pt.WriteXmlAttrIdx(_value); begin + if ifnil({self.}XmlAttrIdx) then + begin + {self.}XmlAttrIdx := new OpenXmlAttribute("", "idx", nil); + attributes_[length(attributes_)] := {self.}XmlAttrIdx; + end {self.}XmlAttrIdx.Value := _value; end; + +function Pt.ReadXmlChildV(); +begin + if tslassigning and ifnil({self.}XmlChildV) then + begin + {self.}XmlChildV := new OpenXmlPcdata(self, {self.}Prefix, "v"); + container_.Set({self.}XmlChildV); + end + return {self.}XmlChildV; +end; diff --git a/autoclass/docx/PureVal@DOCX.tsf b/autoclass/docx/PureVal@DOCX.tsf index 990c1fd..8e66484 100644 --- a/autoclass/docx/PureVal@DOCX.tsf +++ b/autoclass/docx/PureVal@DOCX.tsf @@ -4,26 +4,25 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: PureVal);override; +public + + // attributes property property Val read ReadXmlAttrVal write WriteXmlAttrVal; function ReadXmlAttrVal(); function WriteXmlAttrVal(_value); public - // Attributes + // Attributes XmlAttrVal: OpenXmlAttribute; - // Children end; function PureVal.Create();overload; begin - {self.}Create(nil, nil, ""); + {self.}Create(nil, "", ""); end; function PureVal.Create(_node: XmlNode);overload; @@ -33,41 +32,30 @@ end; function PureVal.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function PureVal.Init();override; begin - {self.}XmlAttrVal := new OpenXmlAttribute(nil, "val", nil); -end; - -function PureVal.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrVal, - ); -end; - -function PureVal.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "val": makeweakref(thisFunction(WriteXmlAttrVal)), ); sorted_child_ := array( - "": -1, ); -end; - -function PureVal.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function PureVal.Copy(_obj: PureVal);override; begin - if not ifnil(_obj.XmlAttrVal.Value) then - {self.}XmlAttrVal.Value := _obj.XmlAttrVal.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Val) then + {self.}Val := _obj.Val; + tslassigning := tslassigning_backup; end; function PureVal.ReadXmlAttrVal(); @@ -77,5 +65,10 @@ end; function PureVal.WriteXmlAttrVal(_value); begin + if ifnil({self.}XmlAttrVal) then + begin + {self.}XmlAttrVal := new OpenXmlAttribute("", "val", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVal; + end {self.}XmlAttrVal.Value := _value; end; diff --git a/autoclass/docx/PureWVal@DOCX.tsf b/autoclass/docx/PureWVal@DOCX.tsf index b8c5cca..2943e93 100644 --- a/autoclass/docx/PureWVal@DOCX.tsf +++ b/autoclass/docx/PureWVal@DOCX.tsf @@ -4,26 +4,25 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: PureWVal);override; +public + + // attributes property property Val read ReadXmlAttrVal write WriteXmlAttrVal; function ReadXmlAttrVal(); function WriteXmlAttrVal(_value); public - // Attributes + // Attributes XmlAttrVal: OpenXmlAttribute; - // Children end; function PureWVal.Create();overload; begin - {self.}Create(nil, nil, ""); + {self.}Create(nil, "", ""); end; function PureWVal.Create(_node: XmlNode);overload; @@ -33,41 +32,30 @@ end; function PureWVal.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function PureWVal.Init();override; begin - {self.}XmlAttrVal := new OpenXmlAttribute("w", "val", nil); -end; - -function PureWVal.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrVal, - ); -end; - -function PureWVal.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "w:val": makeweakref(thisFunction(WriteXmlAttrVal)), ); sorted_child_ := array( - "": -1, ); -end; - -function PureWVal.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function PureWVal.Copy(_obj: PureWVal);override; begin - if not ifnil(_obj.XmlAttrVal.Value) then - {self.}XmlAttrVal.Value := _obj.XmlAttrVal.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Val) then + {self.}Val := _obj.Val; + tslassigning := tslassigning_backup; end; function PureWVal.ReadXmlAttrVal(); @@ -77,5 +65,10 @@ end; function PureWVal.WriteXmlAttrVal(_value); begin + if ifnil({self.}XmlAttrVal) then + begin + {self.}XmlAttrVal := new OpenXmlAttribute("w", "val", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVal; + end {self.}XmlAttrVal.Value := _value; end; diff --git a/autoclass/docx/R@DOCX.tsf b/autoclass/docx/R@DOCX.tsf index 702534e..3967e93 100644 --- a/autoclass/docx/R@DOCX.tsf +++ b/autoclass/docx/R@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: R);override; +public + + // attributes property property WRsidRPr read ReadXmlAttrWRsidRPr write WriteXmlAttrWRsidRPr; property Anchor read ReadXmlAttrAnchor write WriteXmlAttrAnchor; property History read ReadXmlAttrHistory write WriteXmlAttrHistory; @@ -19,6 +19,7 @@ public function ReadXmlAttrHistory(); function WriteXmlAttrHistory(_value); + // empty property property Separator read ReadXmlChildSeparator write WriteXmlChildSeparator; property ContinuationSeparator read ReadXmlChildContinuationSeparator write WriteXmlChildContinuationSeparator; property LastRenderedPageBreak read ReadXmlChildLastRenderedPageBreak write WriteXmlChildLastRenderedPageBreak; @@ -29,23 +30,42 @@ public function ReadXmlChildLastRenderedPageBreak(); function WriteXmlChildLastRenderedPageBreak(_value); + // normal property + property RPr read ReadXmlChildRPr; + property Br read ReadXmlChildBr; + property FldChar read ReadXmlChildFldChar; + property InstrText read ReadXmlChildInstrText; + property AlternateContent read ReadXmlChildAlternateContent; + property Drawing read ReadXmlChildDrawing; + property T read ReadXmlChildT; + property FootnoteReference read ReadXmlChildFootnoteReference; + function ReadXmlChildRPr(); + function ReadXmlChildBr(); + function ReadXmlChildFldChar(); + function ReadXmlChildInstrText(); + function ReadXmlChildAlternateContent(); + function ReadXmlChildDrawing(); + function ReadXmlChildT(); + function ReadXmlChildFootnoteReference(); + public - // Attributes + // Attributes XmlAttrWRsidRPr: OpenXmlAttribute; XmlAttrAnchor: OpenXmlAttribute; XmlAttrHistory: OpenXmlAttribute; // Children - RPr: RPr; - Br: Br; - FldChar: FldChar; - InstrText: InstrText; + XmlChildRPr: RPr; + XmlChildBr: Br; + XmlChildFldChar: FldChar; + XmlChildInstrText: InstrText; XmlChildSeparator: OpenXmlEmpty; XmlChildContinuationSeparator: OpenXmlEmpty; XmlChildLastRenderedPageBreak: OpenXmlEmpty; - AlternateContent: AlternateContent; - Drawing: Drawing; - T: T; + XmlChildAlternateContent: AlternateContent; + XmlChildDrawing: Drawing; + XmlChildT: T; + XmlChildFootnoteReference: FootnoteReference; end; @@ -61,120 +81,69 @@ end; function R.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function R.Init();override; begin - {self.}XmlAttrWRsidRPr := new OpenXmlAttribute("w", "rsidRPr", nil); - {self.}XmlAttrAnchor := new OpenXmlAttribute("w", "anchor", nil); - {self.}XmlAttrHistory := new OpenXmlAttribute("w", "history", nil); - {self.}RPr := new RPr(self, {self.}Prefix, "rPr"); - {self.}Br := new Br(self, {self.}Prefix, "br"); - {self.}FldChar := new FldChar(self, {self.}Prefix, "fldChar"); - {self.}InstrText := new InstrText(self, {self.}Prefix, "instrText"); - {self.}XmlChildSeparator := new OpenXmlEmpty(self, {self.}Prefix, "separator"); - {self.}XmlChildContinuationSeparator := new OpenXmlEmpty(self, {self.}Prefix, "continuationSeparator"); - {self.}XmlChildLastRenderedPageBreak := new OpenXmlEmpty(self, {self.}Prefix, "lastRenderedPageBreak"); - {self.}AlternateContent := new AlternateContent(self, "mc", "AlternateContent"); - {self.}Drawing := new Drawing(self, {self.}Prefix, "drawing"); - {self.}T := new T(self, {self.}Prefix, "t"); -end; - -function R.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrWRsidRPr, - {self.}XmlAttrAnchor, - {self.}XmlAttrHistory, - ); -end; - -function R.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}RPr, - 1: {self.}Br, - 2: {self.}FldChar, - 3: {self.}InstrText, - 4: {self.}XmlChildSeparator, - 5: {self.}XmlChildContinuationSeparator, - 6: {self.}XmlChildLastRenderedPageBreak, - 7: {self.}AlternateContent, - 8: {self.}Drawing, - 9: {self.}T, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "w:rsidRPr": makeweakref(thisFunction(WriteXmlAttrWRsidRPr)), + "w:anchor": makeweakref(thisFunction(WriteXmlAttrAnchor)), + "w:history": makeweakref(thisFunction(WriteXmlAttrHistory)), ); sorted_child_ := array( - "": -1, - {self.}RPr.ElementName: 0, - {self.}Br.ElementName: 1, - {self.}FldChar.ElementName: 2, - {self.}InstrText.ElementName: 3, - {self.}XmlChildSeparator.ElementName: 4, - {self.}XmlChildContinuationSeparator.ElementName: 5, - {self.}XmlChildLastRenderedPageBreak.ElementName: 6, - {self.}AlternateContent.ElementName: 7, - {self.}Drawing.ElementName: 8, - {self.}T.ElementName: 9, + pre + "rPr": array(0, makeweakref(thisFunction(ReadXmlChildRPr))), + pre + "br": array(1, makeweakref(thisFunction(ReadXmlChildBr))), + pre + "fldChar": array(2, makeweakref(thisFunction(ReadXmlChildFldChar))), + pre + "instrText": array(3, makeweakref(thisFunction(ReadXmlChildInstrText))), + pre + "separator": array(4, makeweakref(thisFunction(ReadXmlChildSeparator))), + pre + "continuationSeparator": array(5, makeweakref(thisFunction(ReadXmlChildContinuationSeparator))), + pre + "lastRenderedPageBreak": array(6, makeweakref(thisFunction(ReadXmlChildLastRenderedPageBreak))), + "mc:AlternateContent": array(7, makeweakref(thisFunction(ReadXmlChildAlternateContent))), + pre + "drawing": array(8, makeweakref(thisFunction(ReadXmlChildDrawing))), + pre + "t": array(9, makeweakref(thisFunction(ReadXmlChildT))), + pre + "footnoteReference": array(10, makeweakref(thisFunction(ReadXmlChildFootnoteReference))), ); -end; - -function R.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function R.Copy(_obj: R);override; begin - if not ifnil(_obj.XmlAttrWRsidRPr.Value) then - {self.}XmlAttrWRsidRPr.Value := _obj.XmlAttrWRsidRPr.Value; - if not ifnil(_obj.XmlAttrAnchor.Value) then - {self.}XmlAttrAnchor.Value := _obj.XmlAttrAnchor.Value; - if not ifnil(_obj.XmlAttrHistory.Value) then - {self.}XmlAttrHistory.Value := _obj.XmlAttrHistory.Value; - {self.}RPr.Copy(_obj.RPr); - {self.}Br.Copy(_obj.Br); - {self.}FldChar.Copy(_obj.FldChar); - {self.}InstrText.Copy(_obj.InstrText); - {self.}XmlChildSeparator.Copy(_obj.XmlChildSeparator); - {self.}XmlChildContinuationSeparator.Copy(_obj.XmlChildContinuationSeparator); - {self.}XmlChildLastRenderedPageBreak.Copy(_obj.XmlChildLastRenderedPageBreak); - {self.}AlternateContent.Copy(_obj.AlternateContent); - {self.}Drawing.Copy(_obj.Drawing); - {self.}T.Copy(_obj.T); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.WRsidRPr) then + {self.}WRsidRPr := _obj.WRsidRPr; + if not ifnil(_obj.Anchor) then + {self.}Anchor := _obj.Anchor; + if not ifnil(_obj.History) then + {self.}History := _obj.History; + if not ifnil(_obj.XmlChildRPr) then + {self.}RPr.Copy(_obj.XmlChildRPr); + if not ifnil(_obj.XmlChildBr) then + {self.}Br.Copy(_obj.XmlChildBr); + if not ifnil(_obj.XmlChildFldChar) then + {self.}FldChar.Copy(_obj.XmlChildFldChar); + if not ifnil(_obj.XmlChildInstrText) then + {self.}InstrText.Copy(_obj.XmlChildInstrText); + if not ifnil(_obj.XmlChildSeparator) then + ifnil({self.}XmlChildSeparator) ? {self.}Separator.Copy(_obj.XmlChildSeparator) : {self.}XmlChildSeparator.Copy(_obj.XmlChildSeparator); + if not ifnil(_obj.XmlChildContinuationSeparator) then + ifnil({self.}XmlChildContinuationSeparator) ? {self.}ContinuationSeparator.Copy(_obj.XmlChildContinuationSeparator) : {self.}XmlChildContinuationSeparator.Copy(_obj.XmlChildContinuationSeparator); + if not ifnil(_obj.XmlChildLastRenderedPageBreak) then + ifnil({self.}XmlChildLastRenderedPageBreak) ? {self.}LastRenderedPageBreak.Copy(_obj.XmlChildLastRenderedPageBreak) : {self.}XmlChildLastRenderedPageBreak.Copy(_obj.XmlChildLastRenderedPageBreak); + if not ifnil(_obj.XmlChildAlternateContent) then + {self.}AlternateContent.Copy(_obj.XmlChildAlternateContent); + if not ifnil(_obj.XmlChildDrawing) then + {self.}Drawing.Copy(_obj.XmlChildDrawing); + if not ifnil(_obj.XmlChildT) then + {self.}T.Copy(_obj.XmlChildT); + if not ifnil(_obj.XmlChildFootnoteReference) then + {self.}FootnoteReference.Copy(_obj.XmlChildFootnoteReference); + tslassigning := tslassigning_backup; end; function R.ReadXmlAttrWRsidRPr(); @@ -184,6 +153,11 @@ end; function R.WriteXmlAttrWRsidRPr(_value); begin + if ifnil({self.}XmlAttrWRsidRPr) then + begin + {self.}XmlAttrWRsidRPr := new OpenXmlAttribute("w", "rsidRPr", nil); + attributes_[length(attributes_)] := {self.}XmlAttrWRsidRPr; + end {self.}XmlAttrWRsidRPr.Value := _value; end; @@ -194,6 +168,11 @@ end; function R.WriteXmlAttrAnchor(_value); begin + if ifnil({self.}XmlAttrAnchor) then + begin + {self.}XmlAttrAnchor := new OpenXmlAttribute("w", "anchor", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAnchor; + end {self.}XmlAttrAnchor.Value := _value; end; @@ -204,35 +183,153 @@ end; function R.WriteXmlAttrHistory(_value); begin + if ifnil({self.}XmlAttrHistory) then + begin + {self.}XmlAttrHistory := new OpenXmlAttribute("w", "history", nil); + attributes_[length(attributes_)] := {self.}XmlAttrHistory; + end {self.}XmlAttrHistory.Value := _value; end; function R.ReadXmlChildSeparator(); begin - return ifnil({self.}XmlChildSeparator.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildSeparator) then + begin + {self.}XmlChildSeparator := new OpenXmlEmpty(self, {self.}Prefix, "separator"); + container_.Set({self.}XmlChildSeparator); + return {self.}XmlChildSeparator; + end + return {self.}XmlChildSeparator.BoolValue(); end; function R.WriteXmlChildSeparator(_value); begin + if ifnil({self.}XmlChildSeparator) then + begin + {self.}XmlChildSeparator := new OpenXmlEmpty(self, {self.}Prefix, "separator"); + container_.Set({self.}XmlChildSeparator); + end {self.}XmlChildSeparator.Value := _value; end; function R.ReadXmlChildContinuationSeparator(); begin - return ifnil({self.}XmlChildContinuationSeparator.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildContinuationSeparator) then + begin + {self.}XmlChildContinuationSeparator := new OpenXmlEmpty(self, {self.}Prefix, "continuationSeparator"); + container_.Set({self.}XmlChildContinuationSeparator); + return {self.}XmlChildContinuationSeparator; + end + return {self.}XmlChildContinuationSeparator.BoolValue(); end; function R.WriteXmlChildContinuationSeparator(_value); begin + if ifnil({self.}XmlChildContinuationSeparator) then + begin + {self.}XmlChildContinuationSeparator := new OpenXmlEmpty(self, {self.}Prefix, "continuationSeparator"); + container_.Set({self.}XmlChildContinuationSeparator); + end {self.}XmlChildContinuationSeparator.Value := _value; end; function R.ReadXmlChildLastRenderedPageBreak(); begin - return ifnil({self.}XmlChildLastRenderedPageBreak.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildLastRenderedPageBreak) then + begin + {self.}XmlChildLastRenderedPageBreak := new OpenXmlEmpty(self, {self.}Prefix, "lastRenderedPageBreak"); + container_.Set({self.}XmlChildLastRenderedPageBreak); + return {self.}XmlChildLastRenderedPageBreak; + end + return {self.}XmlChildLastRenderedPageBreak.BoolValue(); end; function R.WriteXmlChildLastRenderedPageBreak(_value); begin + if ifnil({self.}XmlChildLastRenderedPageBreak) then + begin + {self.}XmlChildLastRenderedPageBreak := new OpenXmlEmpty(self, {self.}Prefix, "lastRenderedPageBreak"); + container_.Set({self.}XmlChildLastRenderedPageBreak); + end {self.}XmlChildLastRenderedPageBreak.Value := _value; end; + +function R.ReadXmlChildRPr(); +begin + if tslassigning and ifnil({self.}XmlChildRPr) then + begin + {self.}XmlChildRPr := new RPr(self, {self.}Prefix, "rPr"); + container_.Set({self.}XmlChildRPr); + end + return {self.}XmlChildRPr; +end; + +function R.ReadXmlChildBr(); +begin + if tslassigning and ifnil({self.}XmlChildBr) then + begin + {self.}XmlChildBr := new Br(self, {self.}Prefix, "br"); + container_.Set({self.}XmlChildBr); + end + return {self.}XmlChildBr; +end; + +function R.ReadXmlChildFldChar(); +begin + if tslassigning and ifnil({self.}XmlChildFldChar) then + begin + {self.}XmlChildFldChar := new FldChar(self, {self.}Prefix, "fldChar"); + container_.Set({self.}XmlChildFldChar); + end + return {self.}XmlChildFldChar; +end; + +function R.ReadXmlChildInstrText(); +begin + if tslassigning and ifnil({self.}XmlChildInstrText) then + begin + {self.}XmlChildInstrText := new InstrText(self, {self.}Prefix, "instrText"); + container_.Set({self.}XmlChildInstrText); + end + return {self.}XmlChildInstrText; +end; + +function R.ReadXmlChildAlternateContent(); +begin + if tslassigning and ifnil({self.}XmlChildAlternateContent) then + begin + {self.}XmlChildAlternateContent := new AlternateContent(self, "mc", "AlternateContent"); + container_.Set({self.}XmlChildAlternateContent); + end + return {self.}XmlChildAlternateContent; +end; + +function R.ReadXmlChildDrawing(); +begin + if tslassigning and ifnil({self.}XmlChildDrawing) then + begin + {self.}XmlChildDrawing := new Drawing(self, {self.}Prefix, "drawing"); + container_.Set({self.}XmlChildDrawing); + end + return {self.}XmlChildDrawing; +end; + +function R.ReadXmlChildT(); +begin + if tslassigning and ifnil({self.}XmlChildT) then + begin + {self.}XmlChildT := new T(self, {self.}Prefix, "t"); + container_.Set({self.}XmlChildT); + end + return {self.}XmlChildT; +end; + +function R.ReadXmlChildFootnoteReference(); +begin + if tslassigning and ifnil({self.}XmlChildFootnoteReference) then + begin + {self.}XmlChildFootnoteReference := new FootnoteReference(self, {self.}Prefix, "footnoteReference"); + container_.Set({self.}XmlChildFootnoteReference); + end + return {self.}XmlChildFootnoteReference; +end; diff --git a/autoclass/docx/RFonts@DOCX.tsf b/autoclass/docx/RFonts@DOCX.tsf index c7ada74..84affbe 100644 --- a/autoclass/docx/RFonts@DOCX.tsf +++ b/autoclass/docx/RFonts@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: RFonts);override; +public + + // attributes property property Ascii read ReadXmlAttrAscii write WriteXmlAttrAscii; property AsciiTheme read ReadXmlAttrAsciiTheme write WriteXmlAttrAsciiTheme; property EastAsia read ReadXmlAttrEastAsia write WriteXmlAttrEastAsia; @@ -35,7 +35,7 @@ public function WriteXmlAttrCsTheme(_value); public - // Attributes + // Attributes XmlAttrAscii: OpenXmlAttribute; XmlAttrAsciiTheme: OpenXmlAttribute; XmlAttrEastAsia: OpenXmlAttribute; @@ -45,7 +45,6 @@ public XmlAttrHint: OpenXmlAttribute; XmlAttrCsTheme: OpenXmlAttribute; - // Children end; @@ -61,69 +60,51 @@ end; function RFonts.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function RFonts.Init();override; begin - {self.}XmlAttrAscii := new OpenXmlAttribute({self.}Prefix, "ascii", nil); - {self.}XmlAttrAsciiTheme := new OpenXmlAttribute({self.}Prefix, "asciiTheme", nil); - {self.}XmlAttrEastAsia := new OpenXmlAttribute({self.}Prefix, "eastAsia", nil); - {self.}XmlAttrEastAsiaTheme := new OpenXmlAttribute({self.}Prefix, "eastAsiaTheme", nil); - {self.}XmlAttrHAnsi := new OpenXmlAttribute({self.}Prefix, "hAnsi", nil); - {self.}XmlAttrHAnsiTheme := new OpenXmlAttribute({self.}Prefix, "hAnsiTheme", nil); - {self.}XmlAttrHint := new OpenXmlAttribute({self.}Prefix, "hint", nil); - {self.}XmlAttrCsTheme := new OpenXmlAttribute({self.}Prefix, "cstheme", nil); -end; - -function RFonts.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrAscii, - {self.}XmlAttrAsciiTheme, - {self.}XmlAttrEastAsia, - {self.}XmlAttrEastAsiaTheme, - {self.}XmlAttrHAnsi, - {self.}XmlAttrHAnsiTheme, - {self.}XmlAttrHint, - {self.}XmlAttrCsTheme, - ); -end; - -function RFonts.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "ascii": makeweakref(thisFunction(WriteXmlAttrAscii)), + pre + "asciiTheme": makeweakref(thisFunction(WriteXmlAttrAsciiTheme)), + pre + "eastAsia": makeweakref(thisFunction(WriteXmlAttrEastAsia)), + pre + "eastAsiaTheme": makeweakref(thisFunction(WriteXmlAttrEastAsiaTheme)), + pre + "hAnsi": makeweakref(thisFunction(WriteXmlAttrHAnsi)), + pre + "hAnsiTheme": makeweakref(thisFunction(WriteXmlAttrHAnsiTheme)), + pre + "hint": makeweakref(thisFunction(WriteXmlAttrHint)), + pre + "cstheme": makeweakref(thisFunction(WriteXmlAttrCsTheme)), ); sorted_child_ := array( - "": -1, ); -end; - -function RFonts.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function RFonts.Copy(_obj: RFonts);override; begin - if not ifnil(_obj.XmlAttrAscii.Value) then - {self.}XmlAttrAscii.Value := _obj.XmlAttrAscii.Value; - if not ifnil(_obj.XmlAttrAsciiTheme.Value) then - {self.}XmlAttrAsciiTheme.Value := _obj.XmlAttrAsciiTheme.Value; - if not ifnil(_obj.XmlAttrEastAsia.Value) then - {self.}XmlAttrEastAsia.Value := _obj.XmlAttrEastAsia.Value; - if not ifnil(_obj.XmlAttrEastAsiaTheme.Value) then - {self.}XmlAttrEastAsiaTheme.Value := _obj.XmlAttrEastAsiaTheme.Value; - if not ifnil(_obj.XmlAttrHAnsi.Value) then - {self.}XmlAttrHAnsi.Value := _obj.XmlAttrHAnsi.Value; - if not ifnil(_obj.XmlAttrHAnsiTheme.Value) then - {self.}XmlAttrHAnsiTheme.Value := _obj.XmlAttrHAnsiTheme.Value; - if not ifnil(_obj.XmlAttrHint.Value) then - {self.}XmlAttrHint.Value := _obj.XmlAttrHint.Value; - if not ifnil(_obj.XmlAttrCsTheme.Value) then - {self.}XmlAttrCsTheme.Value := _obj.XmlAttrCsTheme.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Ascii) then + {self.}Ascii := _obj.Ascii; + if not ifnil(_obj.AsciiTheme) then + {self.}AsciiTheme := _obj.AsciiTheme; + if not ifnil(_obj.EastAsia) then + {self.}EastAsia := _obj.EastAsia; + if not ifnil(_obj.EastAsiaTheme) then + {self.}EastAsiaTheme := _obj.EastAsiaTheme; + if not ifnil(_obj.HAnsi) then + {self.}HAnsi := _obj.HAnsi; + if not ifnil(_obj.HAnsiTheme) then + {self.}HAnsiTheme := _obj.HAnsiTheme; + if not ifnil(_obj.Hint) then + {self.}Hint := _obj.Hint; + if not ifnil(_obj.CsTheme) then + {self.}CsTheme := _obj.CsTheme; + tslassigning := tslassigning_backup; end; function RFonts.ReadXmlAttrAscii(); @@ -133,6 +114,11 @@ end; function RFonts.WriteXmlAttrAscii(_value); begin + if ifnil({self.}XmlAttrAscii) then + begin + {self.}XmlAttrAscii := new OpenXmlAttribute({self.}Prefix, "ascii", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAscii; + end {self.}XmlAttrAscii.Value := _value; end; @@ -143,6 +129,11 @@ end; function RFonts.WriteXmlAttrAsciiTheme(_value); begin + if ifnil({self.}XmlAttrAsciiTheme) then + begin + {self.}XmlAttrAsciiTheme := new OpenXmlAttribute({self.}Prefix, "asciiTheme", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAsciiTheme; + end {self.}XmlAttrAsciiTheme.Value := _value; end; @@ -153,6 +144,11 @@ end; function RFonts.WriteXmlAttrEastAsia(_value); begin + if ifnil({self.}XmlAttrEastAsia) then + begin + {self.}XmlAttrEastAsia := new OpenXmlAttribute({self.}Prefix, "eastAsia", nil); + attributes_[length(attributes_)] := {self.}XmlAttrEastAsia; + end {self.}XmlAttrEastAsia.Value := _value; end; @@ -163,6 +159,11 @@ end; function RFonts.WriteXmlAttrEastAsiaTheme(_value); begin + if ifnil({self.}XmlAttrEastAsiaTheme) then + begin + {self.}XmlAttrEastAsiaTheme := new OpenXmlAttribute({self.}Prefix, "eastAsiaTheme", nil); + attributes_[length(attributes_)] := {self.}XmlAttrEastAsiaTheme; + end {self.}XmlAttrEastAsiaTheme.Value := _value; end; @@ -173,6 +174,11 @@ end; function RFonts.WriteXmlAttrHAnsi(_value); begin + if ifnil({self.}XmlAttrHAnsi) then + begin + {self.}XmlAttrHAnsi := new OpenXmlAttribute({self.}Prefix, "hAnsi", nil); + attributes_[length(attributes_)] := {self.}XmlAttrHAnsi; + end {self.}XmlAttrHAnsi.Value := _value; end; @@ -183,6 +189,11 @@ end; function RFonts.WriteXmlAttrHAnsiTheme(_value); begin + if ifnil({self.}XmlAttrHAnsiTheme) then + begin + {self.}XmlAttrHAnsiTheme := new OpenXmlAttribute({self.}Prefix, "hAnsiTheme", nil); + attributes_[length(attributes_)] := {self.}XmlAttrHAnsiTheme; + end {self.}XmlAttrHAnsiTheme.Value := _value; end; @@ -193,6 +204,11 @@ end; function RFonts.WriteXmlAttrHint(_value); begin + if ifnil({self.}XmlAttrHint) then + begin + {self.}XmlAttrHint := new OpenXmlAttribute({self.}Prefix, "hint", nil); + attributes_[length(attributes_)] := {self.}XmlAttrHint; + end {self.}XmlAttrHint.Value := _value; end; @@ -203,5 +219,10 @@ end; function RFonts.WriteXmlAttrCsTheme(_value); begin + if ifnil({self.}XmlAttrCsTheme) then + begin + {self.}XmlAttrCsTheme := new OpenXmlAttribute({self.}Prefix, "cstheme", nil); + attributes_[length(attributes_)] := {self.}XmlAttrCsTheme; + end {self.}XmlAttrCsTheme.Value := _value; end; diff --git a/autoclass/docx/RPr@DOCX.tsf b/autoclass/docx/RPr@DOCX.tsf index 351b528..86af7a2 100644 --- a/autoclass/docx/RPr@DOCX.tsf +++ b/autoclass/docx/RPr@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: RPr);override; +public + + // empty property property I read ReadXmlChildI write WriteXmlChildI; property ICs read ReadXmlChildICs write WriteXmlChildICs; property B read ReadXmlChildB write WriteXmlChildB; @@ -28,26 +28,46 @@ public function ReadXmlChildU(); function WriteXmlChildU(_value); -public - // Attributes + // normal property + property NoProof read ReadXmlChildNoProof; + property WebHidden read ReadXmlChildWebHidden; + property RStyle read ReadXmlChildRStyle; + property RFonts read ReadXmlChildRFonts; + property Kern read ReadXmlChildKern; + property Color read ReadXmlChildColor; + property Sz read ReadXmlChildSz; + property SzCs read ReadXmlChildSzCs; + property Lang read ReadXmlChildLang; + property W14Ligatures read ReadXmlChildW14Ligatures; + function ReadXmlChildNoProof(); + function ReadXmlChildWebHidden(); + function ReadXmlChildRStyle(); + function ReadXmlChildRFonts(); + function ReadXmlChildKern(); + function ReadXmlChildColor(); + function ReadXmlChildSz(); + function ReadXmlChildSzCs(); + function ReadXmlChildLang(); + function ReadXmlChildW14Ligatures(); +public // Children - NoProof: PureVal; - WebHidden: PureWVal; - RStyle: PureWVal; - RFonts: RFonts; - Kern: PureWVal; + XmlChildNoProof: PureVal; + XmlChildWebHidden: PureWVal; + XmlChildRStyle: PureWVal; + XmlChildRFonts: RFonts; + XmlChildKern: PureWVal; XmlChildI: OpenXmlEmpty; XmlChildICs: OpenXmlEmpty; XmlChildB: OpenXmlEmpty; XmlChildBCs: OpenXmlEmpty; XmlChildStrike: OpenXmlEmpty; - Color: Color; - Sz: Sz; - SzCs: SzCs; + XmlChildColor: Color; + XmlChildSz: Sz; + XmlChildSzCs: SzCs; XmlChildU: OpenXmlEmpty; - Lang: Lang; - W14Ligatures: PureWVal; + XmlChildLang: Lang; + XmlChildW14Ligatures: PureWVal; end; @@ -63,190 +83,299 @@ end; function RPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function RPr.Init();override; begin - {self.}NoProof := new PureVal(self, {self.}Prefix, "noProof"); - {self.}WebHidden := new PureWVal(self, {self.}Prefix, "wedHidden"); - {self.}RStyle := new PureWVal(self, {self.}Prefix, "rStyle"); - {self.}RFonts := new RFonts(self, {self.}Prefix, "rFonts"); - {self.}Kern := new PureWVal(self, {self.}Prefix, "kern"); - {self.}XmlChildI := new OpenXmlEmpty(self, {self.}Prefix, "i"); - {self.}XmlChildICs := new OpenXmlEmpty(self, {self.}Prefix, "iCs"); - {self.}XmlChildB := new OpenXmlEmpty(self, {self.}Prefix, "b"); - {self.}XmlChildBCs := new OpenXmlEmpty(self, {self.}Prefix, "bCs"); - {self.}XmlChildStrike := new OpenXmlEmpty(self, {self.}Prefix, "strike"); - {self.}Color := new Color(self, {self.}Prefix, "color"); - {self.}Sz := new Sz(self, {self.}Prefix, "sz"); - {self.}SzCs := new SzCs(self, {self.}Prefix, "szCs"); - {self.}XmlChildU := new OpenXmlEmpty(self, {self.}Prefix, "u"); - {self.}Lang := new Lang(self, {self.}Prefix, "lang"); - {self.}W14Ligatures := new PureWVal(self, "w14", "ligatures"); -end; - -function RPr.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function RPr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}NoProof, - 1: {self.}WebHidden, - 2: {self.}RStyle, - 3: {self.}RFonts, - 4: {self.}Kern, - 5: {self.}XmlChildI, - 6: {self.}XmlChildICs, - 7: {self.}XmlChildB, - 8: {self.}XmlChildBCs, - 9: {self.}XmlChildStrike, - 10: {self.}Color, - 11: {self.}Sz, - 12: {self.}SzCs, - 13: {self.}XmlChildU, - 14: {self.}Lang, - 15: {self.}W14Ligatures, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}NoProof.ElementName: 0, - {self.}WebHidden.ElementName: 1, - {self.}RStyle.ElementName: 2, - {self.}RFonts.ElementName: 3, - {self.}Kern.ElementName: 4, - {self.}XmlChildI.ElementName: 5, - {self.}XmlChildICs.ElementName: 6, - {self.}XmlChildB.ElementName: 7, - {self.}XmlChildBCs.ElementName: 8, - {self.}XmlChildStrike.ElementName: 9, - {self.}Color.ElementName: 10, - {self.}Sz.ElementName: 11, - {self.}SzCs.ElementName: 12, - {self.}XmlChildU.ElementName: 13, - {self.}Lang.ElementName: 14, - {self.}W14Ligatures.ElementName: 15, + pre + "noProof": array(0, makeweakref(thisFunction(ReadXmlChildNoProof))), + pre + "wedHidden": array(1, makeweakref(thisFunction(ReadXmlChildWebHidden))), + pre + "rStyle": array(2, makeweakref(thisFunction(ReadXmlChildRStyle))), + pre + "rFonts": array(3, makeweakref(thisFunction(ReadXmlChildRFonts))), + pre + "kern": array(4, makeweakref(thisFunction(ReadXmlChildKern))), + pre + "i": array(5, makeweakref(thisFunction(ReadXmlChildI))), + pre + "iCs": array(6, makeweakref(thisFunction(ReadXmlChildICs))), + pre + "b": array(7, makeweakref(thisFunction(ReadXmlChildB))), + pre + "bCs": array(8, makeweakref(thisFunction(ReadXmlChildBCs))), + pre + "strike": array(9, makeweakref(thisFunction(ReadXmlChildStrike))), + pre + "color": array(10, makeweakref(thisFunction(ReadXmlChildColor))), + pre + "sz": array(11, makeweakref(thisFunction(ReadXmlChildSz))), + pre + "szCs": array(12, makeweakref(thisFunction(ReadXmlChildSzCs))), + pre + "u": array(13, makeweakref(thisFunction(ReadXmlChildU))), + pre + "lang": array(14, makeweakref(thisFunction(ReadXmlChildLang))), + "w14:ligatures": array(15, makeweakref(thisFunction(ReadXmlChildW14Ligatures))), ); -end; - -function RPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function RPr.Copy(_obj: RPr);override; begin - {self.}NoProof.Copy(_obj.NoProof); - {self.}WebHidden.Copy(_obj.WebHidden); - {self.}RStyle.Copy(_obj.RStyle); - {self.}RFonts.Copy(_obj.RFonts); - {self.}Kern.Copy(_obj.Kern); - {self.}XmlChildI.Copy(_obj.XmlChildI); - {self.}XmlChildICs.Copy(_obj.XmlChildICs); - {self.}XmlChildB.Copy(_obj.XmlChildB); - {self.}XmlChildBCs.Copy(_obj.XmlChildBCs); - {self.}XmlChildStrike.Copy(_obj.XmlChildStrike); - {self.}Color.Copy(_obj.Color); - {self.}Sz.Copy(_obj.Sz); - {self.}SzCs.Copy(_obj.SzCs); - {self.}XmlChildU.Copy(_obj.XmlChildU); - {self.}Lang.Copy(_obj.Lang); - {self.}W14Ligatures.Copy(_obj.W14Ligatures); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildNoProof) then + {self.}NoProof.Copy(_obj.XmlChildNoProof); + if not ifnil(_obj.XmlChildWebHidden) then + {self.}WebHidden.Copy(_obj.XmlChildWebHidden); + if not ifnil(_obj.XmlChildRStyle) then + {self.}RStyle.Copy(_obj.XmlChildRStyle); + if not ifnil(_obj.XmlChildRFonts) then + {self.}RFonts.Copy(_obj.XmlChildRFonts); + if not ifnil(_obj.XmlChildKern) then + {self.}Kern.Copy(_obj.XmlChildKern); + if not ifnil(_obj.XmlChildI) then + ifnil({self.}XmlChildI) ? {self.}I.Copy(_obj.XmlChildI) : {self.}XmlChildI.Copy(_obj.XmlChildI); + if not ifnil(_obj.XmlChildICs) then + ifnil({self.}XmlChildICs) ? {self.}ICs.Copy(_obj.XmlChildICs) : {self.}XmlChildICs.Copy(_obj.XmlChildICs); + if not ifnil(_obj.XmlChildB) then + ifnil({self.}XmlChildB) ? {self.}B.Copy(_obj.XmlChildB) : {self.}XmlChildB.Copy(_obj.XmlChildB); + if not ifnil(_obj.XmlChildBCs) then + ifnil({self.}XmlChildBCs) ? {self.}BCs.Copy(_obj.XmlChildBCs) : {self.}XmlChildBCs.Copy(_obj.XmlChildBCs); + if not ifnil(_obj.XmlChildStrike) then + ifnil({self.}XmlChildStrike) ? {self.}Strike.Copy(_obj.XmlChildStrike) : {self.}XmlChildStrike.Copy(_obj.XmlChildStrike); + if not ifnil(_obj.XmlChildColor) then + {self.}Color.Copy(_obj.XmlChildColor); + if not ifnil(_obj.XmlChildSz) then + {self.}Sz.Copy(_obj.XmlChildSz); + if not ifnil(_obj.XmlChildSzCs) then + {self.}SzCs.Copy(_obj.XmlChildSzCs); + if not ifnil(_obj.XmlChildU) then + ifnil({self.}XmlChildU) ? {self.}U.Copy(_obj.XmlChildU) : {self.}XmlChildU.Copy(_obj.XmlChildU); + if not ifnil(_obj.XmlChildLang) then + {self.}Lang.Copy(_obj.XmlChildLang); + if not ifnil(_obj.XmlChildW14Ligatures) then + {self.}W14Ligatures.Copy(_obj.XmlChildW14Ligatures); + tslassigning := tslassigning_backup; end; function RPr.ReadXmlChildI(); begin - return ifnil({self.}XmlChildI.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildI) then + begin + {self.}XmlChildI := new OpenXmlEmpty(self, {self.}Prefix, "i"); + container_.Set({self.}XmlChildI); + return {self.}XmlChildI; + end + return {self.}XmlChildI.BoolValue(); end; function RPr.WriteXmlChildI(_value); begin + if ifnil({self.}XmlChildI) then + begin + {self.}XmlChildI := new OpenXmlEmpty(self, {self.}Prefix, "i"); + container_.Set({self.}XmlChildI); + end {self.}XmlChildI.Value := _value; end; function RPr.ReadXmlChildICs(); begin - return ifnil({self.}XmlChildICs.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildICs) then + begin + {self.}XmlChildICs := new OpenXmlEmpty(self, {self.}Prefix, "iCs"); + container_.Set({self.}XmlChildICs); + return {self.}XmlChildICs; + end + return {self.}XmlChildICs.BoolValue(); end; function RPr.WriteXmlChildICs(_value); begin + if ifnil({self.}XmlChildICs) then + begin + {self.}XmlChildICs := new OpenXmlEmpty(self, {self.}Prefix, "iCs"); + container_.Set({self.}XmlChildICs); + end {self.}XmlChildICs.Value := _value; end; function RPr.ReadXmlChildB(); begin - return ifnil({self.}XmlChildB.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildB) then + begin + {self.}XmlChildB := new OpenXmlEmpty(self, {self.}Prefix, "b"); + container_.Set({self.}XmlChildB); + return {self.}XmlChildB; + end + return {self.}XmlChildB.BoolValue(); end; function RPr.WriteXmlChildB(_value); begin + if ifnil({self.}XmlChildB) then + begin + {self.}XmlChildB := new OpenXmlEmpty(self, {self.}Prefix, "b"); + container_.Set({self.}XmlChildB); + end {self.}XmlChildB.Value := _value; end; function RPr.ReadXmlChildBCs(); begin - return ifnil({self.}XmlChildBCs.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildBCs) then + begin + {self.}XmlChildBCs := new OpenXmlEmpty(self, {self.}Prefix, "bCs"); + container_.Set({self.}XmlChildBCs); + return {self.}XmlChildBCs; + end + return {self.}XmlChildBCs.BoolValue(); end; function RPr.WriteXmlChildBCs(_value); begin + if ifnil({self.}XmlChildBCs) then + begin + {self.}XmlChildBCs := new OpenXmlEmpty(self, {self.}Prefix, "bCs"); + container_.Set({self.}XmlChildBCs); + end {self.}XmlChildBCs.Value := _value; end; function RPr.ReadXmlChildStrike(); begin - return ifnil({self.}XmlChildStrike.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildStrike) then + begin + {self.}XmlChildStrike := new OpenXmlEmpty(self, {self.}Prefix, "strike"); + container_.Set({self.}XmlChildStrike); + return {self.}XmlChildStrike; + end + return {self.}XmlChildStrike.BoolValue(); end; function RPr.WriteXmlChildStrike(_value); begin + if ifnil({self.}XmlChildStrike) then + begin + {self.}XmlChildStrike := new OpenXmlEmpty(self, {self.}Prefix, "strike"); + container_.Set({self.}XmlChildStrike); + end {self.}XmlChildStrike.Value := _value; end; function RPr.ReadXmlChildU(); begin - return ifnil({self.}XmlChildU.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildU) then + begin + {self.}XmlChildU := new OpenXmlEmpty(self, {self.}Prefix, "u"); + container_.Set({self.}XmlChildU); + return {self.}XmlChildU; + end + return {self.}XmlChildU.BoolValue(); end; function RPr.WriteXmlChildU(_value); begin + if ifnil({self.}XmlChildU) then + begin + {self.}XmlChildU := new OpenXmlEmpty(self, {self.}Prefix, "u"); + container_.Set({self.}XmlChildU); + end {self.}XmlChildU.Value := _value; end; + +function RPr.ReadXmlChildNoProof(); +begin + if tslassigning and ifnil({self.}XmlChildNoProof) then + begin + {self.}XmlChildNoProof := new PureVal(self, {self.}Prefix, "noProof"); + container_.Set({self.}XmlChildNoProof); + end + return {self.}XmlChildNoProof; +end; + +function RPr.ReadXmlChildWebHidden(); +begin + if tslassigning and ifnil({self.}XmlChildWebHidden) then + begin + {self.}XmlChildWebHidden := new PureWVal(self, {self.}Prefix, "wedHidden"); + container_.Set({self.}XmlChildWebHidden); + end + return {self.}XmlChildWebHidden; +end; + +function RPr.ReadXmlChildRStyle(); +begin + if tslassigning and ifnil({self.}XmlChildRStyle) then + begin + {self.}XmlChildRStyle := new PureWVal(self, {self.}Prefix, "rStyle"); + container_.Set({self.}XmlChildRStyle); + end + return {self.}XmlChildRStyle; +end; + +function RPr.ReadXmlChildRFonts(); +begin + if tslassigning and ifnil({self.}XmlChildRFonts) then + begin + {self.}XmlChildRFonts := new RFonts(self, {self.}Prefix, "rFonts"); + container_.Set({self.}XmlChildRFonts); + end + return {self.}XmlChildRFonts; +end; + +function RPr.ReadXmlChildKern(); +begin + if tslassigning and ifnil({self.}XmlChildKern) then + begin + {self.}XmlChildKern := new PureWVal(self, {self.}Prefix, "kern"); + container_.Set({self.}XmlChildKern); + end + return {self.}XmlChildKern; +end; + +function RPr.ReadXmlChildColor(); +begin + if tslassigning and ifnil({self.}XmlChildColor) then + begin + {self.}XmlChildColor := new Color(self, {self.}Prefix, "color"); + container_.Set({self.}XmlChildColor); + end + return {self.}XmlChildColor; +end; + +function RPr.ReadXmlChildSz(); +begin + if tslassigning and ifnil({self.}XmlChildSz) then + begin + {self.}XmlChildSz := new Sz(self, {self.}Prefix, "sz"); + container_.Set({self.}XmlChildSz); + end + return {self.}XmlChildSz; +end; + +function RPr.ReadXmlChildSzCs(); +begin + if tslassigning and ifnil({self.}XmlChildSzCs) then + begin + {self.}XmlChildSzCs := new SzCs(self, {self.}Prefix, "szCs"); + container_.Set({self.}XmlChildSzCs); + end + return {self.}XmlChildSzCs; +end; + +function RPr.ReadXmlChildLang(); +begin + if tslassigning and ifnil({self.}XmlChildLang) then + begin + {self.}XmlChildLang := new Lang(self, {self.}Prefix, "lang"); + container_.Set({self.}XmlChildLang); + end + return {self.}XmlChildLang; +end; + +function RPr.ReadXmlChildW14Ligatures(); +begin + if tslassigning and ifnil({self.}XmlChildW14Ligatures) then + begin + {self.}XmlChildW14Ligatures := new PureWVal(self, "w14", "ligatures"); + container_.Set({self.}XmlChildW14Ligatures); + end + return {self.}XmlChildW14Ligatures; +end; diff --git a/autoclass/docx/RPrDefault@DOCX.tsf b/autoclass/docx/RPrDefault@DOCX.tsf index ae55b45..71dd944 100644 --- a/autoclass/docx/RPrDefault@DOCX.tsf +++ b/autoclass/docx/RPrDefault@DOCX.tsf @@ -4,16 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: RPrDefault);override; public - // Attributes + // normal property + property RPr read ReadXmlChildRPr; + function ReadXmlChildRPr(); + +public // Children - RPr: RPr; + XmlChildRPr: RPr; end; @@ -29,70 +30,38 @@ end; function RPrDefault.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function RPrDefault.Init();override; begin - {self.}RPr := new RPr(self, {self.}Prefix, "rPr"); -end; - -function RPrDefault.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function RPrDefault.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}RPr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}RPr.ElementName: 0, + pre + "rPr": array(0, makeweakref(thisFunction(ReadXmlChildRPr))), ); -end; - -function RPrDefault.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function RPrDefault.Copy(_obj: RPrDefault);override; begin - {self.}RPr.Copy(_obj.RPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildRPr) then + {self.}RPr.Copy(_obj.XmlChildRPr); + tslassigning := tslassigning_backup; +end; + +function RPrDefault.ReadXmlChildRPr(); +begin + if tslassigning and ifnil({self.}XmlChildRPr) then + begin + {self.}XmlChildRPr := new RPr(self, {self.}Prefix, "rPr"); + container_.Set({self.}XmlChildRPr); + end + return {self.}XmlChildRPr; end; diff --git a/autoclass/docx/Reference@DOCX.tsf b/autoclass/docx/Reference@DOCX.tsf index c06f3f3..000ccfe 100644 --- a/autoclass/docx/Reference@DOCX.tsf +++ b/autoclass/docx/Reference@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Reference);override; +public + + // attributes property property Type read ReadXmlAttrType write WriteXmlAttrType; property Id read ReadXmlAttrId write WriteXmlAttrId; function ReadXmlAttrType(); @@ -17,11 +17,10 @@ public function WriteXmlAttrId(_value); public - // Attributes + // Attributes XmlAttrType: OpenXmlAttribute; XmlAttrId: OpenXmlAttribute; - // Children end; @@ -37,45 +36,33 @@ end; function Reference.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Reference.Init();override; begin - {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); - {self.}XmlAttrId := new OpenXmlAttribute("r", "id", nil); -end; - -function Reference.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrType, - {self.}XmlAttrId, - ); -end; - -function Reference.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "type": makeweakref(thisFunction(WriteXmlAttrType)), + "r:id": makeweakref(thisFunction(WriteXmlAttrId)), ); sorted_child_ := array( - "": -1, ); -end; - -function Reference.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Reference.Copy(_obj: Reference);override; begin - if not ifnil(_obj.XmlAttrType.Value) then - {self.}XmlAttrType.Value := _obj.XmlAttrType.Value; - if not ifnil(_obj.XmlAttrId.Value) then - {self.}XmlAttrId.Value := _obj.XmlAttrId.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Type) then + {self.}Type := _obj.Type; + if not ifnil(_obj.Id) then + {self.}Id := _obj.Id; + tslassigning := tslassigning_backup; end; function Reference.ReadXmlAttrType(); @@ -85,6 +72,11 @@ end; function Reference.WriteXmlAttrType(_value); begin + if ifnil({self.}XmlAttrType) then + begin + {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); + attributes_[length(attributes_)] := {self.}XmlAttrType; + end {self.}XmlAttrType.Value := _value; end; @@ -95,5 +87,10 @@ end; function Reference.WriteXmlAttrId(_value); begin + if ifnil({self.}XmlAttrId) then + begin + {self.}XmlAttrId := new OpenXmlAttribute("r", "id", nil); + attributes_[length(attributes_)] := {self.}XmlAttrId; + end {self.}XmlAttrId.Value := _value; end; diff --git a/autoclass/docx/Relationship@DOCX.tsf b/autoclass/docx/Relationship@DOCX.tsf index 85ba5c2..8617932 100644 --- a/autoclass/docx/Relationship@DOCX.tsf +++ b/autoclass/docx/Relationship@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Relationship);override; +public + + // attributes property property Id read ReadXmlAttrId write WriteXmlAttrId; property Type read ReadXmlAttrType write WriteXmlAttrType; property Target read ReadXmlAttrTarget write WriteXmlAttrTarget; @@ -20,18 +20,17 @@ public function WriteXmlAttrTarget(_value); public - // Attributes + // Attributes XmlAttrId: OpenXmlAttribute; XmlAttrType: OpenXmlAttribute; XmlAttrTarget: OpenXmlAttribute; - // Children end; function Relationship.Create();overload; begin - {self.}Create(nil, nil, "Relationship"); + {self.}Create(nil, "", "Relationship"); end; function Relationship.Create(_node: XmlNode);overload; @@ -41,49 +40,36 @@ end; function Relationship.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Relationship.Init();override; begin - {self.}XmlAttrId := new OpenXmlAttribute(nil, "Id", nil); - {self.}XmlAttrType := new OpenXmlAttribute(nil, "Type", nil); - {self.}XmlAttrTarget := new OpenXmlAttribute(nil, "Target", nil); -end; - -function Relationship.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrId, - {self.}XmlAttrType, - {self.}XmlAttrTarget, - ); -end; - -function Relationship.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "Id": makeweakref(thisFunction(WriteXmlAttrId)), + "Type": makeweakref(thisFunction(WriteXmlAttrType)), + "Target": makeweakref(thisFunction(WriteXmlAttrTarget)), ); sorted_child_ := array( - "": -1, ); -end; - -function Relationship.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Relationship.Copy(_obj: Relationship);override; begin - if not ifnil(_obj.XmlAttrId.Value) then - {self.}XmlAttrId.Value := _obj.XmlAttrId.Value; - if not ifnil(_obj.XmlAttrType.Value) then - {self.}XmlAttrType.Value := _obj.XmlAttrType.Value; - if not ifnil(_obj.XmlAttrTarget.Value) then - {self.}XmlAttrTarget.Value := _obj.XmlAttrTarget.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Id) then + {self.}Id := _obj.Id; + if not ifnil(_obj.Type) then + {self.}Type := _obj.Type; + if not ifnil(_obj.Target) then + {self.}Target := _obj.Target; + tslassigning := tslassigning_backup; end; function Relationship.ReadXmlAttrId(); @@ -93,6 +79,11 @@ end; function Relationship.WriteXmlAttrId(_value); begin + if ifnil({self.}XmlAttrId) then + begin + {self.}XmlAttrId := new OpenXmlAttribute("", "Id", nil); + attributes_[length(attributes_)] := {self.}XmlAttrId; + end {self.}XmlAttrId.Value := _value; end; @@ -103,6 +94,11 @@ end; function Relationship.WriteXmlAttrType(_value); begin + if ifnil({self.}XmlAttrType) then + begin + {self.}XmlAttrType := new OpenXmlAttribute("", "Type", nil); + attributes_[length(attributes_)] := {self.}XmlAttrType; + end {self.}XmlAttrType.Value := _value; end; @@ -113,5 +109,10 @@ end; function Relationship.WriteXmlAttrTarget(_value); begin + if ifnil({self.}XmlAttrTarget) then + begin + {self.}XmlAttrTarget := new OpenXmlAttribute("", "Target", nil); + attributes_[length(attributes_)] := {self.}XmlAttrTarget; + end {self.}XmlAttrTarget.Value := _value; end; diff --git a/autoclass/docx/Relationships@DOCX.tsf b/autoclass/docx/Relationships@DOCX.tsf index aac30b8..30754b1 100644 --- a/autoclass/docx/Relationships@DOCX.tsf +++ b/autoclass/docx/Relationships@DOCX.tsf @@ -4,22 +4,23 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Relationships);override; - function AddRelationship(): Relationship; - function AppendRelationship(): Relationship; - property Relationships read ReadRelationships; - function ReadRelationships(_index); +public + // attributes property property xmlns read ReadXmlAttrxmlns write WriteXmlAttrxmlns; function ReadXmlAttrxmlns(); function WriteXmlAttrxmlns(_value); + // multi property + property Relationships read ReadRelationships; + function ReadRelationships(_index); + function AddRelationship(): Relationship; + function AppendRelationship(): Relationship; + public - // Attributes + // Attributes XmlAttrxmlns: OpenXmlAttribute; // Children @@ -28,7 +29,7 @@ end; function Relationships.Create();overload; begin - {self.}Create(nil, nil, "Relationships"); + {self.}Create(nil, "", "Relationships"); end; function Relationships.Create(_node: XmlNode);overload; @@ -38,109 +39,31 @@ end; function Relationships.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Relationships.Init();override; begin - {self.}XmlAttrxmlns := new OpenXmlAttribute(nil, "xmlns", nil); -end; - -function Relationships.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrxmlns, - ); -end; - -function Relationships.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns": makeweakref(thisFunction(WriteXmlAttrxmlns)), ); sorted_child_ := array( - "": -1, + "Relationship": array(0, makeweakref(thisFunction(AppendRelationship))), ); -end; - -function Relationships.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - "Relationship": obj := {self.}AppendRelationship(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Relationships.Copy(_obj: Relationships);override; begin - if not ifnil(_obj.XmlAttrxmlns.Value) then - {self.}XmlAttrxmlns.Value := _obj.XmlAttrxmlns.Value; -end; - -function Relationships.AddRelationship(): Relationship; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "Relationship" then break; - end - obj := new Relationship(self, nil, "Relationship"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function Relationships.AppendRelationship(): Relationship; -begin - obj := new Relationship(self, nil, "Relationship"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function Relationships.ReadRelationships(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "Relationship" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.xmlns) then + {self.}xmlns := _obj.xmlns; + tslassigning := tslassigning_backup; end; function Relationships.ReadXmlAttrxmlns(); @@ -150,5 +73,31 @@ end; function Relationships.WriteXmlAttrxmlns(_value); begin + if ifnil({self.}XmlAttrxmlns) then + begin + {self.}XmlAttrxmlns := new OpenXmlAttribute("", "xmlns", nil); + attributes_[length(attributes_)] := {self.}XmlAttrxmlns; + end {self.}XmlAttrxmlns.Value := _value; end; + +function Relationships.ReadRelationships(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get("Relationship", ind); +end; + +function Relationships.AddRelationship(): Relationship; +begin + obj := new Relationship(self, "", "Relationship"); + container_.Insert(obj); + return obj; +end; + +function Relationships.AppendRelationship(): Relationship; +begin + obj := new Relationship(self, "", "Relationship"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/Rich@DOCX.tsf b/autoclass/docx/Rich@DOCX.tsf index 11430e8..86c1fca 100644 --- a/autoclass/docx/Rich@DOCX.tsf +++ b/autoclass/docx/Rich@DOCX.tsf @@ -4,25 +4,28 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Rich);override; - function AddP(): Ap; - function AppendP(): Ap; - property Ps read ReadPs; - function ReadPs(_index); +public + // empty property property LstStyle read ReadXmlChildLstStyle write WriteXmlChildLstStyle; function ReadXmlChildLstStyle(); function WriteXmlChildLstStyle(_value); -public - // Attributes + // normal property + property BodyPr read ReadXmlChildBodyPr; + function ReadXmlChildBodyPr(); + // multi property + property Ps read ReadPs; + function ReadPs(_index); + function AddP(): Ap; + function AppendP(): Ap; + +public // Children - BodyPr: BodyPr; + XmlChildBodyPr: BodyPr; XmlChildLstStyle: OpenXmlEmpty; end; @@ -39,121 +42,84 @@ end; function Rich.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Rich.Init();override; begin - {self.}BodyPr := new BodyPr(self, "a", "bodyPr"); - {self.}XmlChildLstStyle := new OpenXmlEmpty(self, "a", "lstStyle"); -end; - -function Rich.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Rich.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}BodyPr, - 1: {self.}XmlChildLstStyle, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}BodyPr.ElementName: 0, - {self.}XmlChildLstStyle.ElementName: 1, + "a:bodyPr": array(0, makeweakref(thisFunction(ReadXmlChildBodyPr))), + "a:lstStyle": array(1, makeweakref(thisFunction(ReadXmlChildLstStyle))), + "a:p": array(2, makeweakref(thisFunction(AppendP))), ); -end; - -function Rich.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - "a:p": obj := {self.}AppendP(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Rich.Copy(_obj: Rich);override; begin - {self.}BodyPr.Copy(_obj.BodyPr); - {self.}XmlChildLstStyle.Copy(_obj.XmlChildLstStyle); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildBodyPr) then + {self.}BodyPr.Copy(_obj.XmlChildBodyPr); + if not ifnil(_obj.XmlChildLstStyle) then + ifnil({self.}XmlChildLstStyle) ? {self.}LstStyle.Copy(_obj.XmlChildLstStyle) : {self.}XmlChildLstStyle.Copy(_obj.XmlChildLstStyle); + tslassigning := tslassigning_backup; +end; + +function Rich.ReadXmlChildLstStyle(); +begin + if tslassigning and ifnil({self.}XmlChildLstStyle) then + begin + {self.}XmlChildLstStyle := new OpenXmlEmpty(self, "a", "lstStyle"); + container_.Set({self.}XmlChildLstStyle); + return {self.}XmlChildLstStyle; + end + return {self.}XmlChildLstStyle.BoolValue(); +end; + +function Rich.WriteXmlChildLstStyle(_value); +begin + if ifnil({self.}XmlChildLstStyle) then + begin + {self.}XmlChildLstStyle := new OpenXmlEmpty(self, "a", "lstStyle"); + container_.Set({self.}XmlChildLstStyle); + end + {self.}XmlChildLstStyle.Value := _value; +end; + +function Rich.ReadXmlChildBodyPr(); +begin + if tslassigning and ifnil({self.}XmlChildBodyPr) then + begin + {self.}XmlChildBodyPr := new BodyPr(self, "a", "bodyPr"); + container_.Set({self.}XmlChildBodyPr); + end + return {self.}XmlChildBodyPr; +end; + +function Rich.ReadPs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get("a:p", ind); end; function Rich.AddP(): Ap; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "p" then break; - end obj := new Ap(self, "a", "p"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function Rich.AppendP(): Ap; begin obj := new Ap(self, "a", "p"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function Rich.ReadPs(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "p" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; - -function Rich.ReadXmlChildLstStyle(); -begin - return ifnil({self.}XmlChildLstStyle.Value) ? false : true; -end; - -function Rich.WriteXmlChildLstStyle(_value); -begin - {self.}XmlChildLstStyle.Value := _value; -end; diff --git a/autoclass/docx/Rsids@DOCX.tsf b/autoclass/docx/Rsids@DOCX.tsf index 5a2e29c..7824806 100644 --- a/autoclass/docx/Rsids@DOCX.tsf +++ b/autoclass/docx/Rsids@DOCX.tsf @@ -4,21 +4,23 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Rsids);override; + +public + + // normal property + property RsidRoot read ReadXmlChildRsidRoot; + function ReadXmlChildRsidRoot(); + + // multi property + property Rsids read ReadRsids; + function ReadRsids(_index); function AddRsid(): PureWVal; function AppendRsid(): PureWVal; - property Rsids read ReadRsids; - function ReadRsids(_index); - public - // Attributes - // Children - RsidRoot: PureWVal; + XmlChildRsidRoot: PureWVal; end; @@ -34,107 +36,60 @@ end; function Rsids.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Rsids.Init();override; begin - {self.}RsidRoot := new PureWVal(self, {self.}Prefix, "rsidRoot"); -end; - -function Rsids.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Rsids.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}RsidRoot, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}RsidRoot.ElementName: 0, + pre + "rsidRoot": array(0, makeweakref(thisFunction(ReadXmlChildRsidRoot))), + pre + "rsid": array(1, makeweakref(thisFunction(AppendRsid))), ); -end; - -function Rsids.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "rsid": obj := {self.}AppendRsid(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Rsids.Copy(_obj: Rsids);override; begin - {self.}RsidRoot.Copy(_obj.RsidRoot); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildRsidRoot) then + {self.}RsidRoot.Copy(_obj.XmlChildRsidRoot); + tslassigning := tslassigning_backup; +end; + +function Rsids.ReadXmlChildRsidRoot(); +begin + if tslassigning and ifnil({self.}XmlChildRsidRoot) then + begin + {self.}XmlChildRsidRoot := new PureWVal(self, {self.}Prefix, "rsidRoot"); + container_.Set({self.}XmlChildRsidRoot); + end + return {self.}XmlChildRsidRoot; +end; + +function Rsids.ReadRsids(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "rsid", ind); end; function Rsids.AddRsid(): PureWVal; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "rsid" then break; - end obj := new PureWVal(self, {self.}Prefix, "rsid"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function Rsids.AppendRsid(): PureWVal; begin obj := new PureWVal(self, {self.}Prefix, "rsid"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function Rsids.ReadRsids(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "rsid" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; diff --git a/autoclass/docx/Scaling@DOCX.tsf b/autoclass/docx/Scaling@DOCX.tsf index aae45c4..b790bf4 100644 --- a/autoclass/docx/Scaling@DOCX.tsf +++ b/autoclass/docx/Scaling@DOCX.tsf @@ -4,18 +4,16 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Scaling);override; +public + + // empty property property Orientation read ReadXmlChildOrientation write WriteXmlChildOrientation; function ReadXmlChildOrientation(); function WriteXmlChildOrientation(_value); public - // Attributes - // Children XmlChildOrientation: OpenXmlEmpty; @@ -33,80 +31,49 @@ end; function Scaling.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Scaling.Init();override; begin - {self.}XmlChildOrientation := new PureVal(self, {self.}Prefix, "orientation"); -end; - -function Scaling.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Scaling.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}XmlChildOrientation, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}XmlChildOrientation.ElementName: 0, + pre + "orientation": array(0, makeweakref(thisFunction(ReadXmlChildOrientation))), ); -end; - -function Scaling.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Scaling.Copy(_obj: Scaling);override; begin - {self.}XmlChildOrientation.Copy(_obj.XmlChildOrientation); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildOrientation) then + ifnil({self.}XmlChildOrientation) ? {self.}Orientation.Copy(_obj.XmlChildOrientation) : {self.}XmlChildOrientation.Copy(_obj.XmlChildOrientation); + tslassigning := tslassigning_backup; end; function Scaling.ReadXmlChildOrientation(); begin - return ifnil({self.}XmlChildOrientation.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildOrientation) then + begin + {self.}XmlChildOrientation := new OpenXmlEmpty(self, {self.}Prefix, "orientation"); + container_.Set({self.}XmlChildOrientation); + return {self.}XmlChildOrientation; + end + return {self.}XmlChildOrientation.BoolValue(); end; function Scaling.WriteXmlChildOrientation(_value); begin + if ifnil({self.}XmlChildOrientation) then + begin + {self.}XmlChildOrientation := new OpenXmlEmpty(self, {self.}Prefix, "orientation"); + container_.Set({self.}XmlChildOrientation); + end {self.}XmlChildOrientation.Value := _value; end; diff --git a/autoclass/docx/SchemeClr@DOCX.tsf b/autoclass/docx/SchemeClr@DOCX.tsf index 1edcab7..e098634 100644 --- a/autoclass/docx/SchemeClr@DOCX.tsf +++ b/autoclass/docx/SchemeClr@DOCX.tsf @@ -4,23 +4,31 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: SchemeClr);override; +public + + // attributes property property Val read ReadXmlAttrVal write WriteXmlAttrVal; function ReadXmlAttrVal(); function WriteXmlAttrVal(_value); + // normal property + property LumMod read ReadXmlChildLumMod; + property SatMod read ReadXmlChildSatMod; + property Tint read ReadXmlChildTint; + function ReadXmlChildLumMod(); + function ReadXmlChildSatMod(); + function ReadXmlChildTint(); + public - // Attributes + // Attributes XmlAttrVal: OpenXmlAttribute; // Children - LumMod: PureVal; - SatMod: PureVal; - Tint: PureVal; + XmlChildLumMod: PureVal; + XmlChildSatMod: PureVal; + XmlChildTint: PureVal; end; @@ -36,84 +44,39 @@ end; function SchemeClr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function SchemeClr.Init();override; begin - {self.}XmlAttrVal := new OpenXmlAttribute(nil, "val", nil); - {self.}LumMod := new PureVal(self, {self.}Prefix, "lumMod"); - {self.}SatMod := new PureVal(self, {self.}Prefix, "satMod"); - {self.}Tint := new PureVal(self, {self.}Prefix, "tint"); -end; - -function SchemeClr.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrVal, - ); -end; - -function SchemeClr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}LumMod, - 1: {self.}SatMod, - 2: {self.}Tint, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "val": makeweakref(thisFunction(WriteXmlAttrVal)), ); sorted_child_ := array( - "": -1, - {self.}LumMod.ElementName: 0, - {self.}SatMod.ElementName: 1, - {self.}Tint.ElementName: 2, + pre + "lumMod": array(0, makeweakref(thisFunction(ReadXmlChildLumMod))), + pre + "satMod": array(1, makeweakref(thisFunction(ReadXmlChildSatMod))), + pre + "tint": array(2, makeweakref(thisFunction(ReadXmlChildTint))), ); -end; - -function SchemeClr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function SchemeClr.Copy(_obj: SchemeClr);override; begin - if not ifnil(_obj.XmlAttrVal.Value) then - {self.}XmlAttrVal.Value := _obj.XmlAttrVal.Value; - {self.}LumMod.Copy(_obj.LumMod); - {self.}SatMod.Copy(_obj.SatMod); - {self.}Tint.Copy(_obj.Tint); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Val) then + {self.}Val := _obj.Val; + if not ifnil(_obj.XmlChildLumMod) then + {self.}LumMod.Copy(_obj.XmlChildLumMod); + if not ifnil(_obj.XmlChildSatMod) then + {self.}SatMod.Copy(_obj.XmlChildSatMod); + if not ifnil(_obj.XmlChildTint) then + {self.}Tint.Copy(_obj.XmlChildTint); + tslassigning := tslassigning_backup; end; function SchemeClr.ReadXmlAttrVal(); @@ -123,5 +86,40 @@ end; function SchemeClr.WriteXmlAttrVal(_value); begin + if ifnil({self.}XmlAttrVal) then + begin + {self.}XmlAttrVal := new OpenXmlAttribute("", "val", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVal; + end {self.}XmlAttrVal.Value := _value; end; + +function SchemeClr.ReadXmlChildLumMod(); +begin + if tslassigning and ifnil({self.}XmlChildLumMod) then + begin + {self.}XmlChildLumMod := new PureVal(self, {self.}Prefix, "lumMod"); + container_.Set({self.}XmlChildLumMod); + end + return {self.}XmlChildLumMod; +end; + +function SchemeClr.ReadXmlChildSatMod(); +begin + if tslassigning and ifnil({self.}XmlChildSatMod) then + begin + {self.}XmlChildSatMod := new PureVal(self, {self.}Prefix, "satMod"); + container_.Set({self.}XmlChildSatMod); + end + return {self.}XmlChildSatMod; +end; + +function SchemeClr.ReadXmlChildTint(); +begin + if tslassigning and ifnil({self.}XmlChildTint) then + begin + {self.}XmlChildTint := new PureVal(self, {self.}Prefix, "tint"); + container_.Set({self.}XmlChildTint); + end + return {self.}XmlChildTint; +end; diff --git a/autoclass/docx/Sdt@DOCX.tsf b/autoclass/docx/Sdt@DOCX.tsf index 8251aea..1e69617 100644 --- a/autoclass/docx/Sdt@DOCX.tsf +++ b/autoclass/docx/Sdt@DOCX.tsf @@ -4,18 +4,23 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Sdt);override; public - // Attributes + // normal property + property SdtPr read ReadXmlChildSdtPr; + property SdtEndPr read ReadXmlChildSdtEndPr; + property SdtContent read ReadXmlChildSdtContent; + function ReadXmlChildSdtPr(); + function ReadXmlChildSdtEndPr(); + function ReadXmlChildSdtContent(); + +public // Children - SdtPr: SdtPr; - SdtEndPr: SdtEndPr; - SdtContent: SdtContent; + XmlChildSdtPr: SdtPr; + XmlChildSdtEndPr: SdtEndPr; + XmlChildSdtContent: SdtContent; end; @@ -31,78 +36,64 @@ end; function Sdt.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Sdt.Init();override; begin - {self.}SdtPr := new SdtPr(self, {self.}Prefix, "stdPr"); - {self.}SdtEndPr := new SdtEndPr(self, {self.}Prefix, "sdtEndPr"); - {self.}SdtContent := new SdtContent(self, {self.}Prefix, "sdtContent"); -end; - -function Sdt.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Sdt.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}SdtPr, - 1: {self.}SdtEndPr, - 2: {self.}SdtContent, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}SdtPr.ElementName: 0, - {self.}SdtEndPr.ElementName: 1, - {self.}SdtContent.ElementName: 2, + pre + "stdPr": array(0, makeweakref(thisFunction(ReadXmlChildSdtPr))), + pre + "sdtEndPr": array(1, makeweakref(thisFunction(ReadXmlChildSdtEndPr))), + pre + "sdtContent": array(2, makeweakref(thisFunction(ReadXmlChildSdtContent))), ); -end; - -function Sdt.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Sdt.Copy(_obj: Sdt);override; begin - {self.}SdtPr.Copy(_obj.SdtPr); - {self.}SdtEndPr.Copy(_obj.SdtEndPr); - {self.}SdtContent.Copy(_obj.SdtContent); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildSdtPr) then + {self.}SdtPr.Copy(_obj.XmlChildSdtPr); + if not ifnil(_obj.XmlChildSdtEndPr) then + {self.}SdtEndPr.Copy(_obj.XmlChildSdtEndPr); + if not ifnil(_obj.XmlChildSdtContent) then + {self.}SdtContent.Copy(_obj.XmlChildSdtContent); + tslassigning := tslassigning_backup; +end; + +function Sdt.ReadXmlChildSdtPr(); +begin + if tslassigning and ifnil({self.}XmlChildSdtPr) then + begin + {self.}XmlChildSdtPr := new SdtPr(self, {self.}Prefix, "stdPr"); + container_.Set({self.}XmlChildSdtPr); + end + return {self.}XmlChildSdtPr; +end; + +function Sdt.ReadXmlChildSdtEndPr(); +begin + if tslassigning and ifnil({self.}XmlChildSdtEndPr) then + begin + {self.}XmlChildSdtEndPr := new SdtEndPr(self, {self.}Prefix, "sdtEndPr"); + container_.Set({self.}XmlChildSdtEndPr); + end + return {self.}XmlChildSdtEndPr; +end; + +function Sdt.ReadXmlChildSdtContent(); +begin + if tslassigning and ifnil({self.}XmlChildSdtContent) then + begin + {self.}XmlChildSdtContent := new SdtContent(self, {self.}Prefix, "sdtContent"); + container_.Set({self.}XmlChildSdtContent); + end + return {self.}XmlChildSdtContent; end; diff --git a/autoclass/docx/SdtContent@DOCX.tsf b/autoclass/docx/SdtContent@DOCX.tsf index 3b210f7..afc0f48 100644 --- a/autoclass/docx/SdtContent@DOCX.tsf +++ b/autoclass/docx/SdtContent@DOCX.tsf @@ -4,19 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: SdtContent);override; + +public + + // multi property + property Ps read ReadPs; + function ReadPs(_index); function AddP(): P; function AppendP(): P; - property Ps read ReadPs; - function ReadPs(_index); - public - // Attributes - // Children end; @@ -33,105 +31,47 @@ end; function SdtContent.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function SdtContent.Init();override; begin - -end; - -function SdtContent.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function SdtContent.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, + pre + "p": array(0, makeweakref(thisFunction(AppendP))), ); -end; - -function SdtContent.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "p": obj := {self.}AppendP(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function SdtContent.Copy(_obj: SdtContent);override; begin + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + tslassigning := tslassigning_backup; +end; +function SdtContent.ReadPs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "p", ind); end; function SdtContent.AddP(): P; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "p" then break; - end obj := new P(self, {self.}Prefix, "p"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function SdtContent.AppendP(): P; begin obj := new P(self, {self.}Prefix, "p"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function SdtContent.ReadPs(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "p" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; diff --git a/autoclass/docx/SdtEndPr@DOCX.tsf b/autoclass/docx/SdtEndPr@DOCX.tsf index 4e2df2c..9eb536f 100644 --- a/autoclass/docx/SdtEndPr@DOCX.tsf +++ b/autoclass/docx/SdtEndPr@DOCX.tsf @@ -4,16 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: SdtEndPr);override; public - // Attributes + // normal property + property RPr read ReadXmlChildRPr; + function ReadXmlChildRPr(); + +public // Children - RPr: RPr; + XmlChildRPr: RPr; end; @@ -29,70 +30,38 @@ end; function SdtEndPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function SdtEndPr.Init();override; begin - {self.}RPr := new RPr(self, {self.}Prefix, "rPr"); -end; - -function SdtEndPr.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function SdtEndPr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}RPr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}RPr.ElementName: 0, + pre + "rPr": array(0, makeweakref(thisFunction(ReadXmlChildRPr))), ); -end; - -function SdtEndPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function SdtEndPr.Copy(_obj: SdtEndPr);override; begin - {self.}RPr.Copy(_obj.RPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildRPr) then + {self.}RPr.Copy(_obj.XmlChildRPr); + tslassigning := tslassigning_backup; +end; + +function SdtEndPr.ReadXmlChildRPr(); +begin + if tslassigning and ifnil({self.}XmlChildRPr) then + begin + {self.}XmlChildRPr := new RPr(self, {self.}Prefix, "rPr"); + container_.Set({self.}XmlChildRPr); + end + return {self.}XmlChildRPr; end; diff --git a/autoclass/docx/SdtPr@DOCX.tsf b/autoclass/docx/SdtPr@DOCX.tsf index d4ee27d..397bfe3 100644 --- a/autoclass/docx/SdtPr@DOCX.tsf +++ b/autoclass/docx/SdtPr@DOCX.tsf @@ -4,18 +4,23 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: SdtPr);override; public - // Attributes + // normal property + property RPr read ReadXmlChildRPr; + property Id read ReadXmlChildId; + property DocPartObj read ReadXmlChildDocPartObj; + function ReadXmlChildRPr(); + function ReadXmlChildId(); + function ReadXmlChildDocPartObj(); + +public // Children - RPr: RPr; - Id: PureWVal; - DocPartObj: DocPartObj; + XmlChildRPr: RPr; + XmlChildId: PureWVal; + XmlChildDocPartObj: DocPartObj; end; @@ -31,78 +36,64 @@ end; function SdtPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function SdtPr.Init();override; begin - {self.}RPr := new RPr(self, {self.}Prefix, "rPr"); - {self.}Id := new PureWVal(self, {self.}Prefix, "id"); - {self.}DocPartObj := new DocPartObj(self, {self.}Prefix, "docPartObj"); -end; - -function SdtPr.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function SdtPr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}RPr, - 1: {self.}Id, - 2: {self.}DocPartObj, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}RPr.ElementName: 0, - {self.}Id.ElementName: 1, - {self.}DocPartObj.ElementName: 2, + pre + "rPr": array(0, makeweakref(thisFunction(ReadXmlChildRPr))), + pre + "id": array(1, makeweakref(thisFunction(ReadXmlChildId))), + pre + "docPartObj": array(2, makeweakref(thisFunction(ReadXmlChildDocPartObj))), ); -end; - -function SdtPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function SdtPr.Copy(_obj: SdtPr);override; begin - {self.}RPr.Copy(_obj.RPr); - {self.}Id.Copy(_obj.Id); - {self.}DocPartObj.Copy(_obj.DocPartObj); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildRPr) then + {self.}RPr.Copy(_obj.XmlChildRPr); + if not ifnil(_obj.XmlChildId) then + {self.}Id.Copy(_obj.XmlChildId); + if not ifnil(_obj.XmlChildDocPartObj) then + {self.}DocPartObj.Copy(_obj.XmlChildDocPartObj); + tslassigning := tslassigning_backup; +end; + +function SdtPr.ReadXmlChildRPr(); +begin + if tslassigning and ifnil({self.}XmlChildRPr) then + begin + {self.}XmlChildRPr := new RPr(self, {self.}Prefix, "rPr"); + container_.Set({self.}XmlChildRPr); + end + return {self.}XmlChildRPr; +end; + +function SdtPr.ReadXmlChildId(); +begin + if tslassigning and ifnil({self.}XmlChildId) then + begin + {self.}XmlChildId := new PureWVal(self, {self.}Prefix, "id"); + container_.Set({self.}XmlChildId); + end + return {self.}XmlChildId; +end; + +function SdtPr.ReadXmlChildDocPartObj(); +begin + if tslassigning and ifnil({self.}XmlChildDocPartObj) then + begin + {self.}XmlChildDocPartObj := new DocPartObj(self, {self.}Prefix, "docPartObj"); + container_.Set({self.}XmlChildDocPartObj); + end + return {self.}XmlChildDocPartObj; end; diff --git a/autoclass/docx/SectPr@DOCX.tsf b/autoclass/docx/SectPr@DOCX.tsf index 0c66333..3a0a770 100644 --- a/autoclass/docx/SectPr@DOCX.tsf +++ b/autoclass/docx/SectPr@DOCX.tsf @@ -4,20 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: SectPr);override; - function AddHeaderReference(): Reference; - function AddFooterReference(): Reference; - function AppendHeaderReference(): Reference; - function AppendFooterReference(): Reference; - property HeaderReferences read ReadHeaderReferences; - property FooterReferences read ReadFooterReferences; - function ReadHeaderReferences(_index); - function ReadFooterReferences(_index); +public + // attributes property property WRsidR read ReadXmlAttrWRsidR write WriteXmlAttrWRsidR; property WRsidSect read ReadXmlAttrWRsidSect write WriteXmlAttrWRsidSect; function ReadXmlAttrWRsidR(); @@ -25,23 +16,51 @@ public function ReadXmlAttrWRsidSect(); function WriteXmlAttrWRsidSect(_value); + // empty property property TitlePg read ReadXmlChildTitlePg write WriteXmlChildTitlePg; function ReadXmlChildTitlePg(); function WriteXmlChildTitlePg(_value); + // normal property + property FootnotePr read ReadXmlChildFootnotePr; + property Type read ReadXmlChildType; + property PgSz read ReadXmlChildPgSz; + property PgMar read ReadXmlChildPgMar; + property PgNumType read ReadXmlChildPgNumType; + property Cols read ReadXmlChildCols; + property DocGrid read ReadXmlChildDocGrid; + function ReadXmlChildFootnotePr(); + function ReadXmlChildType(); + function ReadXmlChildPgSz(); + function ReadXmlChildPgMar(); + function ReadXmlChildPgNumType(); + function ReadXmlChildCols(); + function ReadXmlChildDocGrid(); + + // multi property + property HeaderReferences read ReadHeaderReferences; + property FooterReferences read ReadFooterReferences; + function ReadHeaderReferences(_index); + function ReadFooterReferences(_index); + function AddHeaderReference(): Reference; + function AddFooterReference(): Reference; + function AppendHeaderReference(): Reference; + function AppendFooterReference(): Reference; + public - // Attributes + // Attributes XmlAttrWRsidR: OpenXmlAttribute; XmlAttrWRsidSect: OpenXmlAttribute; // Children - Type: PureWVal; - PgSz: PgSz; - PgMar: PgMar; - PgNumType: PgNumType; - Cols: Cols; + XmlChildFootnotePr: FootnotePr; + XmlChildType: PureWVal; + XmlChildPgSz: PgSz; + XmlChildPgMar: PgMar; + XmlChildPgNumType: PgNumType; + XmlChildCols: Cols; XmlChildTitlePg: OpenXmlEmpty; - DocGrid: docGrid; + XmlChildDocGrid: docGrid; end; @@ -57,178 +76,59 @@ end; function SectPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function SectPr.Init();override; begin - {self.}XmlAttrWRsidR := new OpenXmlAttribute({self.}Prefix, "rsidR", nil); - {self.}XmlAttrWRsidSect := new OpenXmlAttribute({self.}Prefix, "rsidSect", nil); - {self.}Type := new PureWVal(self, {self.}Prefix, "type"); - {self.}PgSz := new PgSz(self, {self.}Prefix, "pgSz"); - {self.}PgMar := new PgMar(self, {self.}Prefix, "pgMar"); - {self.}PgNumType := new PgNumType(self, {self.}Prefix, "pgNumType"); - {self.}Cols := new Cols(self, {self.}Prefix, "cols"); - {self.}XmlChildTitlePg := new OpenXmlEmpty(self, {self.}Prefix, "titlePg"); - {self.}DocGrid := new docGrid(self, {self.}Prefix, "docGrid"); -end; - -function SectPr.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrWRsidR, - {self.}XmlAttrWRsidSect, - ); -end; - -function SectPr.InitChildren();override; -begin - child_elements_ := array( - 2: {self.}Type, - 3: {self.}PgSz, - 4: {self.}PgMar, - 5: {self.}PgNumType, - 6: {self.}Cols, - 7: {self.}XmlChildTitlePg, - 8: {self.}DocGrid, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "rsidR": makeweakref(thisFunction(WriteXmlAttrWRsidR)), + pre + "rsidSect": makeweakref(thisFunction(WriteXmlAttrWRsidSect)), ); sorted_child_ := array( - "": -1, - {self.}Type.ElementName: 2, - {self.}PgSz.ElementName: 3, - {self.}PgMar.ElementName: 4, - {self.}PgNumType.ElementName: 5, - {self.}Cols.ElementName: 6, - {self.}XmlChildTitlePg.ElementName: 7, - {self.}DocGrid.ElementName: 8, + pre + "headerReference": array(0, makeweakref(thisFunction(AppendHeaderReference))), + pre + "footerReference": array(1, makeweakref(thisFunction(AppendFooterReference))), + pre + "footnotePr": array(2, makeweakref(thisFunction(ReadXmlChildFootnotePr))), + pre + "type": array(3, makeweakref(thisFunction(ReadXmlChildType))), + pre + "pgSz": array(4, makeweakref(thisFunction(ReadXmlChildPgSz))), + pre + "pgMar": array(5, makeweakref(thisFunction(ReadXmlChildPgMar))), + pre + "pgNumType": array(6, makeweakref(thisFunction(ReadXmlChildPgNumType))), + pre + "cols": array(7, makeweakref(thisFunction(ReadXmlChildCols))), + pre + "titlePg": array(8, makeweakref(thisFunction(ReadXmlChildTitlePg))), + pre + "docGrid": array(9, makeweakref(thisFunction(ReadXmlChildDocGrid))), ); -end; - -function SectPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "headerReference": obj := {self.}AppendHeaderReference(); - pre + "footerReference": obj := {self.}AppendFooterReference(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function SectPr.Copy(_obj: SectPr);override; begin - if not ifnil(_obj.XmlAttrWRsidR.Value) then - {self.}XmlAttrWRsidR.Value := _obj.XmlAttrWRsidR.Value; - if not ifnil(_obj.XmlAttrWRsidSect.Value) then - {self.}XmlAttrWRsidSect.Value := _obj.XmlAttrWRsidSect.Value; - {self.}Type.Copy(_obj.Type); - {self.}PgSz.Copy(_obj.PgSz); - {self.}PgMar.Copy(_obj.PgMar); - {self.}PgNumType.Copy(_obj.PgNumType); - {self.}Cols.Copy(_obj.Cols); - {self.}XmlChildTitlePg.Copy(_obj.XmlChildTitlePg); - {self.}DocGrid.Copy(_obj.DocGrid); -end; - -function SectPr.AddHeaderReference(): Reference; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "headerReference" then break; - end - obj := new Reference(self, {self.}Prefix, "headerReference"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function SectPr.AddFooterReference(): Reference; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "footerReference" then break; - end - obj := new Reference(self, {self.}Prefix, "footerReference"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function SectPr.AppendHeaderReference(): Reference; -begin - obj := new Reference(self, {self.}Prefix, "headerReference"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function SectPr.AppendFooterReference(): Reference; -begin - obj := new Reference(self, {self.}Prefix, "footerReference"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function SectPr.ReadHeaderReferences(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "headerReference" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; - -function SectPr.ReadFooterReferences(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "footerReference" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.WRsidR) then + {self.}WRsidR := _obj.WRsidR; + if not ifnil(_obj.WRsidSect) then + {self.}WRsidSect := _obj.WRsidSect; + if not ifnil(_obj.XmlChildFootnotePr) then + {self.}FootnotePr.Copy(_obj.XmlChildFootnotePr); + if not ifnil(_obj.XmlChildType) then + {self.}Type.Copy(_obj.XmlChildType); + if not ifnil(_obj.XmlChildPgSz) then + {self.}PgSz.Copy(_obj.XmlChildPgSz); + if not ifnil(_obj.XmlChildPgMar) then + {self.}PgMar.Copy(_obj.XmlChildPgMar); + if not ifnil(_obj.XmlChildPgNumType) then + {self.}PgNumType.Copy(_obj.XmlChildPgNumType); + if not ifnil(_obj.XmlChildCols) then + {self.}Cols.Copy(_obj.XmlChildCols); + if not ifnil(_obj.XmlChildTitlePg) then + ifnil({self.}XmlChildTitlePg) ? {self.}TitlePg.Copy(_obj.XmlChildTitlePg) : {self.}XmlChildTitlePg.Copy(_obj.XmlChildTitlePg); + if not ifnil(_obj.XmlChildDocGrid) then + {self.}DocGrid.Copy(_obj.XmlChildDocGrid); + tslassigning := tslassigning_backup; end; function SectPr.ReadXmlAttrWRsidR(); @@ -238,6 +138,11 @@ end; function SectPr.WriteXmlAttrWRsidR(_value); begin + if ifnil({self.}XmlAttrWRsidR) then + begin + {self.}XmlAttrWRsidR := new OpenXmlAttribute({self.}Prefix, "rsidR", nil); + attributes_[length(attributes_)] := {self.}XmlAttrWRsidR; + end {self.}XmlAttrWRsidR.Value := _value; end; @@ -248,15 +153,143 @@ end; function SectPr.WriteXmlAttrWRsidSect(_value); begin + if ifnil({self.}XmlAttrWRsidSect) then + begin + {self.}XmlAttrWRsidSect := new OpenXmlAttribute({self.}Prefix, "rsidSect", nil); + attributes_[length(attributes_)] := {self.}XmlAttrWRsidSect; + end {self.}XmlAttrWRsidSect.Value := _value; end; function SectPr.ReadXmlChildTitlePg(); begin - return ifnil({self.}XmlChildTitlePg.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildTitlePg) then + begin + {self.}XmlChildTitlePg := new OpenXmlEmpty(self, {self.}Prefix, "titlePg"); + container_.Set({self.}XmlChildTitlePg); + return {self.}XmlChildTitlePg; + end + return {self.}XmlChildTitlePg.BoolValue(); end; function SectPr.WriteXmlChildTitlePg(_value); begin + if ifnil({self.}XmlChildTitlePg) then + begin + {self.}XmlChildTitlePg := new OpenXmlEmpty(self, {self.}Prefix, "titlePg"); + container_.Set({self.}XmlChildTitlePg); + end {self.}XmlChildTitlePg.Value := _value; end; + +function SectPr.ReadXmlChildFootnotePr(); +begin + if tslassigning and ifnil({self.}XmlChildFootnotePr) then + begin + {self.}XmlChildFootnotePr := new FootnotePr(self, {self.}Prefix, "footnotePr"); + container_.Set({self.}XmlChildFootnotePr); + end + return {self.}XmlChildFootnotePr; +end; + +function SectPr.ReadXmlChildType(); +begin + if tslassigning and ifnil({self.}XmlChildType) then + begin + {self.}XmlChildType := new PureWVal(self, {self.}Prefix, "type"); + container_.Set({self.}XmlChildType); + end + return {self.}XmlChildType; +end; + +function SectPr.ReadXmlChildPgSz(); +begin + if tslassigning and ifnil({self.}XmlChildPgSz) then + begin + {self.}XmlChildPgSz := new PgSz(self, {self.}Prefix, "pgSz"); + container_.Set({self.}XmlChildPgSz); + end + return {self.}XmlChildPgSz; +end; + +function SectPr.ReadXmlChildPgMar(); +begin + if tslassigning and ifnil({self.}XmlChildPgMar) then + begin + {self.}XmlChildPgMar := new PgMar(self, {self.}Prefix, "pgMar"); + container_.Set({self.}XmlChildPgMar); + end + return {self.}XmlChildPgMar; +end; + +function SectPr.ReadXmlChildPgNumType(); +begin + if tslassigning and ifnil({self.}XmlChildPgNumType) then + begin + {self.}XmlChildPgNumType := new PgNumType(self, {self.}Prefix, "pgNumType"); + container_.Set({self.}XmlChildPgNumType); + end + return {self.}XmlChildPgNumType; +end; + +function SectPr.ReadXmlChildCols(); +begin + if tslassigning and ifnil({self.}XmlChildCols) then + begin + {self.}XmlChildCols := new Cols(self, {self.}Prefix, "cols"); + container_.Set({self.}XmlChildCols); + end + return {self.}XmlChildCols; +end; + +function SectPr.ReadXmlChildDocGrid(); +begin + if tslassigning and ifnil({self.}XmlChildDocGrid) then + begin + {self.}XmlChildDocGrid := new docGrid(self, {self.}Prefix, "docGrid"); + container_.Set({self.}XmlChildDocGrid); + end + return {self.}XmlChildDocGrid; +end; + +function SectPr.ReadHeaderReferences(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "headerReference", ind); +end; + +function SectPr.ReadFooterReferences(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "footerReference", ind); +end; + +function SectPr.AddHeaderReference(): Reference; +begin + obj := new Reference(self, {self.}Prefix, "headerReference"); + container_.Insert(obj); + return obj; +end; + +function SectPr.AddFooterReference(): Reference; +begin + obj := new Reference(self, {self.}Prefix, "footerReference"); + container_.Insert(obj); + return obj; +end; + +function SectPr.AppendHeaderReference(): Reference; +begin + obj := new Reference(self, {self.}Prefix, "headerReference"); + container_.Append(obj); + return obj; +end; + +function SectPr.AppendFooterReference(): Reference; +begin + obj := new Reference(self, {self.}Prefix, "footerReference"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/Ser@DOCX.tsf b/autoclass/docx/Ser@DOCX.tsf index 2a1facf..f26627a 100644 --- a/autoclass/docx/Ser@DOCX.tsf +++ b/autoclass/docx/Ser@DOCX.tsf @@ -4,23 +4,38 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Ser);override; public - // Attributes + // normal property + property Idx read ReadXmlChildIdx; + property Order read ReadXmlChildOrder; + property Tx read ReadXmlChildTx; + property InvertIfNegative read ReadXmlChildInvertIfNegative; + property DLbls read ReadXmlChildDLbls; + property Cat read ReadXmlChildCat; + property Val read ReadXmlChildVal; + property ExtLst read ReadXmlChildExtLst; + function ReadXmlChildIdx(); + function ReadXmlChildOrder(); + function ReadXmlChildTx(); + function ReadXmlChildInvertIfNegative(); + function ReadXmlChildDLbls(); + function ReadXmlChildCat(); + function ReadXmlChildVal(); + function ReadXmlChildExtLst(); + +public // Children - Idx: PureVal; - Order: PureVal; - Tx: Tx; - InvertIfNegative: PureVal; - DLbls: DLbls; - Cat: Cat; - Val: Val; - ExtLst: ExtLst; + XmlChildIdx: PureVal; + XmlChildOrder: PureVal; + XmlChildTx: Tx; + XmlChildInvertIfNegative: PureVal; + XmlChildDLbls: DLbls; + XmlChildCat: Cat; + XmlChildVal: Val; + XmlChildExtLst: ExtLst; end; @@ -36,98 +51,129 @@ end; function Ser.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Ser.Init();override; begin - {self.}Idx := new PureVal(self, {self.}Prefix, "idx"); - {self.}Order := new PureVal(self, {self.}Prefix, "order"); - {self.}Tx := new Tx(self, {self.}Prefix, "tx"); - {self.}InvertIfNegative := new PureVal(self, {self.}Prefix, "invertIfNegative"); - {self.}DLbls := new DLbls(self, {self.}Prefix, "dLbls"); - {self.}Cat := new Cat(self, {self.}Prefix, "cat"); - {self.}Val := new Val(self, {self.}Prefix, "val"); - {self.}ExtLst := new ExtLst(self, {self.}Prefix, "extLst"); -end; - -function Ser.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Ser.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Idx, - 1: {self.}Order, - 2: {self.}Tx, - 3: {self.}InvertIfNegative, - 4: {self.}DLbls, - 5: {self.}Cat, - 6: {self.}Val, - 7: {self.}ExtLst, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}Idx.ElementName: 0, - {self.}Order.ElementName: 1, - {self.}Tx.ElementName: 2, - {self.}InvertIfNegative.ElementName: 3, - {self.}DLbls.ElementName: 4, - {self.}Cat.ElementName: 5, - {self.}Val.ElementName: 6, - {self.}ExtLst.ElementName: 7, + pre + "idx": array(0, makeweakref(thisFunction(ReadXmlChildIdx))), + pre + "order": array(1, makeweakref(thisFunction(ReadXmlChildOrder))), + pre + "tx": array(2, makeweakref(thisFunction(ReadXmlChildTx))), + pre + "invertIfNegative": array(3, makeweakref(thisFunction(ReadXmlChildInvertIfNegative))), + pre + "dLbls": array(4, makeweakref(thisFunction(ReadXmlChildDLbls))), + pre + "cat": array(5, makeweakref(thisFunction(ReadXmlChildCat))), + pre + "val": array(6, makeweakref(thisFunction(ReadXmlChildVal))), + pre + "extLst": array(7, makeweakref(thisFunction(ReadXmlChildExtLst))), ); -end; - -function Ser.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Ser.Copy(_obj: Ser);override; begin - {self.}Idx.Copy(_obj.Idx); - {self.}Order.Copy(_obj.Order); - {self.}Tx.Copy(_obj.Tx); - {self.}InvertIfNegative.Copy(_obj.InvertIfNegative); - {self.}DLbls.Copy(_obj.DLbls); - {self.}Cat.Copy(_obj.Cat); - {self.}Val.Copy(_obj.Val); - {self.}ExtLst.Copy(_obj.ExtLst); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildIdx) then + {self.}Idx.Copy(_obj.XmlChildIdx); + if not ifnil(_obj.XmlChildOrder) then + {self.}Order.Copy(_obj.XmlChildOrder); + if not ifnil(_obj.XmlChildTx) then + {self.}Tx.Copy(_obj.XmlChildTx); + if not ifnil(_obj.XmlChildInvertIfNegative) then + {self.}InvertIfNegative.Copy(_obj.XmlChildInvertIfNegative); + if not ifnil(_obj.XmlChildDLbls) then + {self.}DLbls.Copy(_obj.XmlChildDLbls); + if not ifnil(_obj.XmlChildCat) then + {self.}Cat.Copy(_obj.XmlChildCat); + if not ifnil(_obj.XmlChildVal) then + {self.}Val.Copy(_obj.XmlChildVal); + if not ifnil(_obj.XmlChildExtLst) then + {self.}ExtLst.Copy(_obj.XmlChildExtLst); + tslassigning := tslassigning_backup; +end; + +function Ser.ReadXmlChildIdx(); +begin + if tslassigning and ifnil({self.}XmlChildIdx) then + begin + {self.}XmlChildIdx := new PureVal(self, {self.}Prefix, "idx"); + container_.Set({self.}XmlChildIdx); + end + return {self.}XmlChildIdx; +end; + +function Ser.ReadXmlChildOrder(); +begin + if tslassigning and ifnil({self.}XmlChildOrder) then + begin + {self.}XmlChildOrder := new PureVal(self, {self.}Prefix, "order"); + container_.Set({self.}XmlChildOrder); + end + return {self.}XmlChildOrder; +end; + +function Ser.ReadXmlChildTx(); +begin + if tslassigning and ifnil({self.}XmlChildTx) then + begin + {self.}XmlChildTx := new Tx(self, {self.}Prefix, "tx"); + container_.Set({self.}XmlChildTx); + end + return {self.}XmlChildTx; +end; + +function Ser.ReadXmlChildInvertIfNegative(); +begin + if tslassigning and ifnil({self.}XmlChildInvertIfNegative) then + begin + {self.}XmlChildInvertIfNegative := new PureVal(self, {self.}Prefix, "invertIfNegative"); + container_.Set({self.}XmlChildInvertIfNegative); + end + return {self.}XmlChildInvertIfNegative; +end; + +function Ser.ReadXmlChildDLbls(); +begin + if tslassigning and ifnil({self.}XmlChildDLbls) then + begin + {self.}XmlChildDLbls := new DLbls(self, {self.}Prefix, "dLbls"); + container_.Set({self.}XmlChildDLbls); + end + return {self.}XmlChildDLbls; +end; + +function Ser.ReadXmlChildCat(); +begin + if tslassigning and ifnil({self.}XmlChildCat) then + begin + {self.}XmlChildCat := new Cat(self, {self.}Prefix, "cat"); + container_.Set({self.}XmlChildCat); + end + return {self.}XmlChildCat; +end; + +function Ser.ReadXmlChildVal(); +begin + if tslassigning and ifnil({self.}XmlChildVal) then + begin + {self.}XmlChildVal := new Val(self, {self.}Prefix, "val"); + container_.Set({self.}XmlChildVal); + end + return {self.}XmlChildVal; +end; + +function Ser.ReadXmlChildExtLst(); +begin + if tslassigning and ifnil({self.}XmlChildExtLst) then + begin + {self.}XmlChildExtLst := new ExtLst(self, {self.}Prefix, "extLst"); + container_.Set({self.}XmlChildExtLst); + end + return {self.}XmlChildExtLst; end; diff --git a/autoclass/docx/Settings@DOCX.tsf b/autoclass/docx/Settings@DOCX.tsf index 8528e73..82c5d97 100644 --- a/autoclass/docx/Settings@DOCX.tsf +++ b/autoclass/docx/Settings@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Settings);override; +public + + // attributes property property XmlnsO read ReadXmlAttrXmlnsO write WriteXmlAttrXmlnsO; property XmlnsR read ReadXmlAttrXmlnsR write WriteXmlAttrXmlnsR; property XmlnsM read ReadXmlAttrXmlnsM write WriteXmlAttrXmlnsM; @@ -52,6 +52,7 @@ public function ReadXmlAttrMcIgnorable(); function WriteXmlAttrMcIgnorable(_value); + // empty property property BordersDoNotSurroundHeader read ReadXmlChildBordersDoNotSurroundHeader write WriteXmlChildBordersDoNotSurroundHeader; property BordersDoNotSurroundFooter read ReadXmlChildBordersDoNotSurroundFooter write WriteXmlChildBordersDoNotSurroundFooter; property EvenAndOddHeaders read ReadXmlChildEvenAndOddHeaders write WriteXmlChildEvenAndOddHeaders; @@ -68,8 +69,48 @@ public function ReadXmlChildW15ChartTrackingRefBased(); function WriteXmlChildW15ChartTrackingRefBased(_value); + // normal property + property Zoom read ReadXmlChildZoom; + property DefaultTabStop read ReadXmlChildDefaultTabStop; + property DrawingGridVerticalSpacing read ReadXmlChildDrawingGridVerticalSpacing; + property DisplayHorizontalDrawingGridEvery read ReadXmlChildDisplayHorizontalDrawingGridEvery; + property DisplayVerticalDrawingGridEvery read ReadXmlChildDisplayVerticalDrawingGridEvery; + property CharacterSpacingControl read ReadXmlChildCharacterSpacingControl; + property HdrShapeDefaults read ReadXmlChildHdrShapeDefaults; + property FootnotePr read ReadXmlChildFootnotePr; + property EndnotePr read ReadXmlChildEndnotePr; + property Compat read ReadXmlChildCompat; + property Rsids read ReadXmlChildRsids; + property MathPr read ReadXmlChildMathPr; + property ThemeFontLang read ReadXmlChildThemeFontLang; + property ClrSchemeMapping read ReadXmlChildClrSchemeMapping; + property ShapeDefaults read ReadXmlChildShapeDefaults; + property DecimalSymbol read ReadXmlChildDecimalSymbol; + property ListSeparator read ReadXmlChildListSeparator; + property W14DocId read ReadXmlChildW14DocId; + property W15DocId read ReadXmlChildW15DocId; + function ReadXmlChildZoom(); + function ReadXmlChildDefaultTabStop(); + function ReadXmlChildDrawingGridVerticalSpacing(); + function ReadXmlChildDisplayHorizontalDrawingGridEvery(); + function ReadXmlChildDisplayVerticalDrawingGridEvery(); + function ReadXmlChildCharacterSpacingControl(); + function ReadXmlChildHdrShapeDefaults(); + function ReadXmlChildFootnotePr(); + function ReadXmlChildEndnotePr(); + function ReadXmlChildCompat(); + function ReadXmlChildRsids(); + function ReadXmlChildMathPr(); + function ReadXmlChildThemeFontLang(); + function ReadXmlChildClrSchemeMapping(); + function ReadXmlChildShapeDefaults(); + function ReadXmlChildDecimalSymbol(); + function ReadXmlChildListSeparator(); + function ReadXmlChildW14DocId(); + function ReadXmlChildW15DocId(); + public - // Attributes + // Attributes XmlAttrXmlnsO: OpenXmlAttribute; XmlAttrXmlnsR: OpenXmlAttribute; XmlAttrXmlnsM: OpenXmlAttribute; @@ -86,30 +127,30 @@ public XmlAttrMcIgnorable: OpenXmlAttribute; // Children - Zoom: Zoom; + XmlChildZoom: Zoom; XmlChildBordersDoNotSurroundHeader: OpenXmlEmpty; XmlChildBordersDoNotSurroundFooter: OpenXmlEmpty; - DefaultTabStop: PureWVal; + XmlChildDefaultTabStop: PureWVal; XmlChildEvenAndOddHeaders: OpenXmlEmpty; - DrawingGridVerticalSpacing: PureWVal; - DisplayHorizontalDrawingGridEvery: PureWVal; - DisplayVerticalDrawingGridEvery: PureWVal; - CharacterSpacingControl: PureWVal; - HdrShapeDefaults: HdrShapeDefaults; - FootnotePr: FootnotePr; - EndnotePr: EndnotePr; - Compat: Compat; - Rsids: Rsids; - MathPr: MathPr; - ThemeFontLang: ThemeFontLang; - ClrSchemeMapping: ClrSchemeMapping; + XmlChildDrawingGridVerticalSpacing: PureWVal; + XmlChildDisplayHorizontalDrawingGridEvery: PureWVal; + XmlChildDisplayVerticalDrawingGridEvery: PureWVal; + XmlChildCharacterSpacingControl: PureWVal; + XmlChildHdrShapeDefaults: HdrShapeDefaults; + XmlChildFootnotePr: FootnotePr; + XmlChildEndnotePr: EndnotePr; + XmlChildCompat: Compat; + XmlChildRsids: Rsids; + XmlChildMathPr: MathPr; + XmlChildThemeFontLang: ThemeFontLang; + XmlChildClrSchemeMapping: ClrSchemeMapping; XmlChildDoNotIncludeSubdocsInStats: OpenXmlEmpty; - ShapeDefaults: ShapeDefaults2; - DecimalSymbol: PureWVal; - ListSeparator: PureWVal; - W14DocId: PureWVal; + XmlChildShapeDefaults: ShapeDefaults2; + XmlChildDecimalSymbol: PureWVal; + XmlChildListSeparator: PureWVal; + XmlChildW14DocId: PureWVal; XmlChildW15ChartTrackingRefBased: OpenXmlEmpty; - W15DocId: PureWVal; + XmlChildW15DocId: PureWVal; end; @@ -125,220 +166,141 @@ end; function Settings.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Settings.Init();override; begin - {self.}XmlAttrXmlnsO := new OpenXmlAttribute("xmlns", "o", nil); - {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); - {self.}XmlAttrXmlnsM := new OpenXmlAttribute("xmlns", "m", nil); - {self.}XmlAttrXmlnsV := new OpenXmlAttribute("xmlns", "v", nil); - {self.}XmlAttrXmlnsW := new OpenXmlAttribute("xmlns", "w", nil); - {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); - {self.}XmlAttrXmlnsW15 := new OpenXmlAttribute("xmlns", "w15", nil); - {self.}XmlAttrXmlnsW16Cex := new OpenXmlAttribute("xmlns", "w16cex", nil); - {self.}XmlAttrXmlnsW16Cid := new OpenXmlAttribute("xmlns", "w16cid", nil); - {self.}XmlAttrXmlnsW16 := new OpenXmlAttribute("xmlns", "w16", nil); - {self.}XmlAttrXmlnsW16Du := new OpenXmlAttribute("xmlns", "w16du", nil); - {self.}XmlAttrXmlnsW16se := new OpenXmlAttribute("xmlns", "w16se", nil); - {self.}XmlAttrXmlnsSl := new OpenXmlAttribute("xmlns", "sl", nil); - {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); - {self.}Zoom := new Zoom(self, {self.}Prefix, "zoom"); - {self.}XmlChildBordersDoNotSurroundHeader := new OpenXmlEmpty(self, {self.}Prefix, "bordersDoNotSurroundHeader"); - {self.}XmlChildBordersDoNotSurroundFooter := new OpenXmlEmpty(self, {self.}Prefix, "bordersDoNotSurroundFooter"); - {self.}DefaultTabStop := new PureWVal(self, {self.}Prefix, "defaultTabStop"); - {self.}XmlChildEvenAndOddHeaders := new OpenXmlEmpty(self, {self.}Prefix, "evenAndOddHeaders"); - {self.}DrawingGridVerticalSpacing := new PureWVal(self, {self.}Prefix, "drawingGridVerticalSpacing"); - {self.}DisplayHorizontalDrawingGridEvery := new PureWVal(self, {self.}Prefix, "displayHorizontalDrawingGridEvery"); - {self.}DisplayVerticalDrawingGridEvery := new PureWVal(self, {self.}Prefix, "DisplayVerticalDrawingGridEvery"); - {self.}CharacterSpacingControl := new PureWVal(self, {self.}Prefix, "characterSpacingControl"); - {self.}HdrShapeDefaults := new HdrShapeDefaults(self, {self.}Prefix, "hdrShapeDefaults"); - {self.}FootnotePr := new FootnotePr(self, {self.}Prefix, "footnotePr"); - {self.}EndnotePr := new EndnotePr(self, {self.}Prefix, "endnotePr"); - {self.}Compat := new Compat(self, {self.}Prefix, "Compat"); - {self.}Rsids := new Rsids(self, {self.}Prefix, "rsids"); - {self.}MathPr := new MathPr(self, "m", "mathPr"); - {self.}ThemeFontLang := new ThemeFontLang(self, {self.}Prefix, "themeFontLang"); - {self.}ClrSchemeMapping := new ClrSchemeMapping(self, {self.}Prefix, "clrSchemeMapping"); - {self.}XmlChildDoNotIncludeSubdocsInStats := new OpenXmlEmpty(self, {self.}Prefix, "doNotIncludeSubdocsInStats"); - {self.}ShapeDefaults := new ShapeDefaults2(self, {self.}Prefix, "shapeDefaults"); - {self.}DecimalSymbol := new PureWVal(self, {self.}Prefix, "decimalSymbol"); - {self.}ListSeparator := new PureWVal(self, {self.}Prefix, "listSeparator"); - {self.}W14DocId := new PureWVal(self, "w14", "docId"); - {self.}XmlChildW15ChartTrackingRefBased := new OpenXmlEmpty(self, "w15", "chartTrackingRefBased"); - {self.}W15DocId := new PureWVal(self, "w15", "docId"); -end; - -function Settings.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXmlnsO, - {self.}XmlAttrXmlnsR, - {self.}XmlAttrXmlnsM, - {self.}XmlAttrXmlnsV, - {self.}XmlAttrXmlnsW, - {self.}XmlAttrXmlnsW14, - {self.}XmlAttrXmlnsW15, - {self.}XmlAttrXmlnsW16Cex, - {self.}XmlAttrXmlnsW16Cid, - {self.}XmlAttrXmlnsW16, - {self.}XmlAttrXmlnsW16Du, - {self.}XmlAttrXmlnsW16se, - {self.}XmlAttrXmlnsSl, - {self.}XmlAttrMcIgnorable, - ); -end; - -function Settings.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Zoom, - 1: {self.}XmlChildBordersDoNotSurroundHeader, - 2: {self.}XmlChildBordersDoNotSurroundFooter, - 3: {self.}DefaultTabStop, - 4: {self.}XmlChildEvenAndOddHeaders, - 5: {self.}DrawingGridVerticalSpacing, - 6: {self.}DisplayHorizontalDrawingGridEvery, - 7: {self.}DisplayVerticalDrawingGridEvery, - 8: {self.}CharacterSpacingControl, - 9: {self.}HdrShapeDefaults, - 10: {self.}FootnotePr, - 11: {self.}EndnotePr, - 12: {self.}Compat, - 13: {self.}Rsids, - 14: {self.}MathPr, - 15: {self.}ThemeFontLang, - 16: {self.}ClrSchemeMapping, - 17: {self.}XmlChildDoNotIncludeSubdocsInStats, - 18: {self.}ShapeDefaults, - 19: {self.}DecimalSymbol, - 20: {self.}ListSeparator, - 21: {self.}W14DocId, - 22: {self.}XmlChildW15ChartTrackingRefBased, - 23: {self.}W15DocId, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns:o": makeweakref(thisFunction(WriteXmlAttrXmlnsO)), + "xmlns:r": makeweakref(thisFunction(WriteXmlAttrXmlnsR)), + "xmlns:m": makeweakref(thisFunction(WriteXmlAttrXmlnsM)), + "xmlns:v": makeweakref(thisFunction(WriteXmlAttrXmlnsV)), + "xmlns:w": makeweakref(thisFunction(WriteXmlAttrXmlnsW)), + "xmlns:w14": makeweakref(thisFunction(WriteXmlAttrXmlnsW14)), + "xmlns:w15": makeweakref(thisFunction(WriteXmlAttrXmlnsW15)), + "xmlns:w16cex": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Cex)), + "xmlns:w16cid": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Cid)), + "xmlns:w16": makeweakref(thisFunction(WriteXmlAttrXmlnsW16)), + "xmlns:w16du": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Du)), + "xmlns:w16se": makeweakref(thisFunction(WriteXmlAttrXmlnsW16se)), + "xmlns:sl": makeweakref(thisFunction(WriteXmlAttrXmlnsSl)), + "mc:Ignorable": makeweakref(thisFunction(WriteXmlAttrMcIgnorable)), ); sorted_child_ := array( - "": -1, - {self.}Zoom.ElementName: 0, - {self.}XmlChildBordersDoNotSurroundHeader.ElementName: 1, - {self.}XmlChildBordersDoNotSurroundFooter.ElementName: 2, - {self.}DefaultTabStop.ElementName: 3, - {self.}XmlChildEvenAndOddHeaders.ElementName: 4, - {self.}DrawingGridVerticalSpacing.ElementName: 5, - {self.}DisplayHorizontalDrawingGridEvery.ElementName: 6, - {self.}DisplayVerticalDrawingGridEvery.ElementName: 7, - {self.}CharacterSpacingControl.ElementName: 8, - {self.}HdrShapeDefaults.ElementName: 9, - {self.}FootnotePr.ElementName: 10, - {self.}EndnotePr.ElementName: 11, - {self.}Compat.ElementName: 12, - {self.}Rsids.ElementName: 13, - {self.}MathPr.ElementName: 14, - {self.}ThemeFontLang.ElementName: 15, - {self.}ClrSchemeMapping.ElementName: 16, - {self.}XmlChildDoNotIncludeSubdocsInStats.ElementName: 17, - {self.}ShapeDefaults.ElementName: 18, - {self.}DecimalSymbol.ElementName: 19, - {self.}ListSeparator.ElementName: 20, - {self.}W14DocId.ElementName: 21, - {self.}XmlChildW15ChartTrackingRefBased.ElementName: 22, - {self.}W15DocId.ElementName: 23, + pre + "zoom": array(0, makeweakref(thisFunction(ReadXmlChildZoom))), + pre + "bordersDoNotSurroundHeader": array(1, makeweakref(thisFunction(ReadXmlChildBordersDoNotSurroundHeader))), + pre + "bordersDoNotSurroundFooter": array(2, makeweakref(thisFunction(ReadXmlChildBordersDoNotSurroundFooter))), + pre + "defaultTabStop": array(3, makeweakref(thisFunction(ReadXmlChildDefaultTabStop))), + pre + "evenAndOddHeaders": array(4, makeweakref(thisFunction(ReadXmlChildEvenAndOddHeaders))), + pre + "drawingGridVerticalSpacing": array(5, makeweakref(thisFunction(ReadXmlChildDrawingGridVerticalSpacing))), + pre + "displayHorizontalDrawingGridEvery": array(6, makeweakref(thisFunction(ReadXmlChildDisplayHorizontalDrawingGridEvery))), + pre + "DisplayVerticalDrawingGridEvery": array(7, makeweakref(thisFunction(ReadXmlChildDisplayVerticalDrawingGridEvery))), + pre + "characterSpacingControl": array(8, makeweakref(thisFunction(ReadXmlChildCharacterSpacingControl))), + pre + "hdrShapeDefaults": array(9, makeweakref(thisFunction(ReadXmlChildHdrShapeDefaults))), + pre + "footnotePr": array(10, makeweakref(thisFunction(ReadXmlChildFootnotePr))), + pre + "endnotePr": array(11, makeweakref(thisFunction(ReadXmlChildEndnotePr))), + pre + "Compat": array(12, makeweakref(thisFunction(ReadXmlChildCompat))), + pre + "rsids": array(13, makeweakref(thisFunction(ReadXmlChildRsids))), + "m:mathPr": array(14, makeweakref(thisFunction(ReadXmlChildMathPr))), + pre + "themeFontLang": array(15, makeweakref(thisFunction(ReadXmlChildThemeFontLang))), + pre + "clrSchemeMapping": array(16, makeweakref(thisFunction(ReadXmlChildClrSchemeMapping))), + pre + "doNotIncludeSubdocsInStats": array(17, makeweakref(thisFunction(ReadXmlChildDoNotIncludeSubdocsInStats))), + pre + "shapeDefaults": array(18, makeweakref(thisFunction(ReadXmlChildShapeDefaults))), + pre + "decimalSymbol": array(19, makeweakref(thisFunction(ReadXmlChildDecimalSymbol))), + pre + "listSeparator": array(20, makeweakref(thisFunction(ReadXmlChildListSeparator))), + "w14:docId": array(21, makeweakref(thisFunction(ReadXmlChildW14DocId))), + "w15:chartTrackingRefBased": array(22, makeweakref(thisFunction(ReadXmlChildW15ChartTrackingRefBased))), + "w15:docId": array(23, makeweakref(thisFunction(ReadXmlChildW15DocId))), ); -end; - -function Settings.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Settings.Copy(_obj: Settings);override; begin - if not ifnil(_obj.XmlAttrXmlnsO.Value) then - {self.}XmlAttrXmlnsO.Value := _obj.XmlAttrXmlnsO.Value; - if not ifnil(_obj.XmlAttrXmlnsR.Value) then - {self.}XmlAttrXmlnsR.Value := _obj.XmlAttrXmlnsR.Value; - if not ifnil(_obj.XmlAttrXmlnsM.Value) then - {self.}XmlAttrXmlnsM.Value := _obj.XmlAttrXmlnsM.Value; - if not ifnil(_obj.XmlAttrXmlnsV.Value) then - {self.}XmlAttrXmlnsV.Value := _obj.XmlAttrXmlnsV.Value; - if not ifnil(_obj.XmlAttrXmlnsW.Value) then - {self.}XmlAttrXmlnsW.Value := _obj.XmlAttrXmlnsW.Value; - if not ifnil(_obj.XmlAttrXmlnsW14.Value) then - {self.}XmlAttrXmlnsW14.Value := _obj.XmlAttrXmlnsW14.Value; - if not ifnil(_obj.XmlAttrXmlnsW15.Value) then - {self.}XmlAttrXmlnsW15.Value := _obj.XmlAttrXmlnsW15.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Cex.Value) then - {self.}XmlAttrXmlnsW16Cex.Value := _obj.XmlAttrXmlnsW16Cex.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Cid.Value) then - {self.}XmlAttrXmlnsW16Cid.Value := _obj.XmlAttrXmlnsW16Cid.Value; - if not ifnil(_obj.XmlAttrXmlnsW16.Value) then - {self.}XmlAttrXmlnsW16.Value := _obj.XmlAttrXmlnsW16.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Du.Value) then - {self.}XmlAttrXmlnsW16Du.Value := _obj.XmlAttrXmlnsW16Du.Value; - if not ifnil(_obj.XmlAttrXmlnsW16se.Value) then - {self.}XmlAttrXmlnsW16se.Value := _obj.XmlAttrXmlnsW16se.Value; - if not ifnil(_obj.XmlAttrXmlnsSl.Value) then - {self.}XmlAttrXmlnsSl.Value := _obj.XmlAttrXmlnsSl.Value; - if not ifnil(_obj.XmlAttrMcIgnorable.Value) then - {self.}XmlAttrMcIgnorable.Value := _obj.XmlAttrMcIgnorable.Value; - {self.}Zoom.Copy(_obj.Zoom); - {self.}XmlChildBordersDoNotSurroundHeader.Copy(_obj.XmlChildBordersDoNotSurroundHeader); - {self.}XmlChildBordersDoNotSurroundFooter.Copy(_obj.XmlChildBordersDoNotSurroundFooter); - {self.}DefaultTabStop.Copy(_obj.DefaultTabStop); - {self.}XmlChildEvenAndOddHeaders.Copy(_obj.XmlChildEvenAndOddHeaders); - {self.}DrawingGridVerticalSpacing.Copy(_obj.DrawingGridVerticalSpacing); - {self.}DisplayHorizontalDrawingGridEvery.Copy(_obj.DisplayHorizontalDrawingGridEvery); - {self.}DisplayVerticalDrawingGridEvery.Copy(_obj.DisplayVerticalDrawingGridEvery); - {self.}CharacterSpacingControl.Copy(_obj.CharacterSpacingControl); - {self.}HdrShapeDefaults.Copy(_obj.HdrShapeDefaults); - {self.}FootnotePr.Copy(_obj.FootnotePr); - {self.}EndnotePr.Copy(_obj.EndnotePr); - {self.}Compat.Copy(_obj.Compat); - {self.}Rsids.Copy(_obj.Rsids); - {self.}MathPr.Copy(_obj.MathPr); - {self.}ThemeFontLang.Copy(_obj.ThemeFontLang); - {self.}ClrSchemeMapping.Copy(_obj.ClrSchemeMapping); - {self.}XmlChildDoNotIncludeSubdocsInStats.Copy(_obj.XmlChildDoNotIncludeSubdocsInStats); - {self.}ShapeDefaults.Copy(_obj.ShapeDefaults); - {self.}DecimalSymbol.Copy(_obj.DecimalSymbol); - {self.}ListSeparator.Copy(_obj.ListSeparator); - {self.}W14DocId.Copy(_obj.W14DocId); - {self.}XmlChildW15ChartTrackingRefBased.Copy(_obj.XmlChildW15ChartTrackingRefBased); - {self.}W15DocId.Copy(_obj.W15DocId); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlnsO) then + {self.}XmlnsO := _obj.XmlnsO; + if not ifnil(_obj.XmlnsR) then + {self.}XmlnsR := _obj.XmlnsR; + if not ifnil(_obj.XmlnsM) then + {self.}XmlnsM := _obj.XmlnsM; + if not ifnil(_obj.XmlnsV) then + {self.}XmlnsV := _obj.XmlnsV; + if not ifnil(_obj.XmlnsW) then + {self.}XmlnsW := _obj.XmlnsW; + if not ifnil(_obj.XmlnsW14) then + {self.}XmlnsW14 := _obj.XmlnsW14; + if not ifnil(_obj.XmlnsW15) then + {self.}XmlnsW15 := _obj.XmlnsW15; + if not ifnil(_obj.XmlnsW16Cex) then + {self.}XmlnsW16Cex := _obj.XmlnsW16Cex; + if not ifnil(_obj.XmlnsW16Cid) then + {self.}XmlnsW16Cid := _obj.XmlnsW16Cid; + if not ifnil(_obj.XmlnsW16) then + {self.}XmlnsW16 := _obj.XmlnsW16; + if not ifnil(_obj.XmlnsW16Du) then + {self.}XmlnsW16Du := _obj.XmlnsW16Du; + if not ifnil(_obj.XmlnsW16se) then + {self.}XmlnsW16se := _obj.XmlnsW16se; + if not ifnil(_obj.XmlnsSl) then + {self.}XmlnsSl := _obj.XmlnsSl; + if not ifnil(_obj.McIgnorable) then + {self.}McIgnorable := _obj.McIgnorable; + if not ifnil(_obj.XmlChildZoom) then + {self.}Zoom.Copy(_obj.XmlChildZoom); + if not ifnil(_obj.XmlChildBordersDoNotSurroundHeader) then + ifnil({self.}XmlChildBordersDoNotSurroundHeader) ? {self.}BordersDoNotSurroundHeader.Copy(_obj.XmlChildBordersDoNotSurroundHeader) : {self.}XmlChildBordersDoNotSurroundHeader.Copy(_obj.XmlChildBordersDoNotSurroundHeader); + if not ifnil(_obj.XmlChildBordersDoNotSurroundFooter) then + ifnil({self.}XmlChildBordersDoNotSurroundFooter) ? {self.}BordersDoNotSurroundFooter.Copy(_obj.XmlChildBordersDoNotSurroundFooter) : {self.}XmlChildBordersDoNotSurroundFooter.Copy(_obj.XmlChildBordersDoNotSurroundFooter); + if not ifnil(_obj.XmlChildDefaultTabStop) then + {self.}DefaultTabStop.Copy(_obj.XmlChildDefaultTabStop); + if not ifnil(_obj.XmlChildEvenAndOddHeaders) then + ifnil({self.}XmlChildEvenAndOddHeaders) ? {self.}EvenAndOddHeaders.Copy(_obj.XmlChildEvenAndOddHeaders) : {self.}XmlChildEvenAndOddHeaders.Copy(_obj.XmlChildEvenAndOddHeaders); + if not ifnil(_obj.XmlChildDrawingGridVerticalSpacing) then + {self.}DrawingGridVerticalSpacing.Copy(_obj.XmlChildDrawingGridVerticalSpacing); + if not ifnil(_obj.XmlChildDisplayHorizontalDrawingGridEvery) then + {self.}DisplayHorizontalDrawingGridEvery.Copy(_obj.XmlChildDisplayHorizontalDrawingGridEvery); + if not ifnil(_obj.XmlChildDisplayVerticalDrawingGridEvery) then + {self.}DisplayVerticalDrawingGridEvery.Copy(_obj.XmlChildDisplayVerticalDrawingGridEvery); + if not ifnil(_obj.XmlChildCharacterSpacingControl) then + {self.}CharacterSpacingControl.Copy(_obj.XmlChildCharacterSpacingControl); + if not ifnil(_obj.XmlChildHdrShapeDefaults) then + {self.}HdrShapeDefaults.Copy(_obj.XmlChildHdrShapeDefaults); + if not ifnil(_obj.XmlChildFootnotePr) then + {self.}FootnotePr.Copy(_obj.XmlChildFootnotePr); + if not ifnil(_obj.XmlChildEndnotePr) then + {self.}EndnotePr.Copy(_obj.XmlChildEndnotePr); + if not ifnil(_obj.XmlChildCompat) then + {self.}Compat.Copy(_obj.XmlChildCompat); + if not ifnil(_obj.XmlChildRsids) then + {self.}Rsids.Copy(_obj.XmlChildRsids); + if not ifnil(_obj.XmlChildMathPr) then + {self.}MathPr.Copy(_obj.XmlChildMathPr); + if not ifnil(_obj.XmlChildThemeFontLang) then + {self.}ThemeFontLang.Copy(_obj.XmlChildThemeFontLang); + if not ifnil(_obj.XmlChildClrSchemeMapping) then + {self.}ClrSchemeMapping.Copy(_obj.XmlChildClrSchemeMapping); + if not ifnil(_obj.XmlChildDoNotIncludeSubdocsInStats) then + ifnil({self.}XmlChildDoNotIncludeSubdocsInStats) ? {self.}DoNotIncludeSubdocsInStats.Copy(_obj.XmlChildDoNotIncludeSubdocsInStats) : {self.}XmlChildDoNotIncludeSubdocsInStats.Copy(_obj.XmlChildDoNotIncludeSubdocsInStats); + if not ifnil(_obj.XmlChildShapeDefaults) then + {self.}ShapeDefaults.Copy(_obj.XmlChildShapeDefaults); + if not ifnil(_obj.XmlChildDecimalSymbol) then + {self.}DecimalSymbol.Copy(_obj.XmlChildDecimalSymbol); + if not ifnil(_obj.XmlChildListSeparator) then + {self.}ListSeparator.Copy(_obj.XmlChildListSeparator); + if not ifnil(_obj.XmlChildW14DocId) then + {self.}W14DocId.Copy(_obj.XmlChildW14DocId); + if not ifnil(_obj.XmlChildW15ChartTrackingRefBased) then + ifnil({self.}XmlChildW15ChartTrackingRefBased) ? {self.}W15ChartTrackingRefBased.Copy(_obj.XmlChildW15ChartTrackingRefBased) : {self.}XmlChildW15ChartTrackingRefBased.Copy(_obj.XmlChildW15ChartTrackingRefBased); + if not ifnil(_obj.XmlChildW15DocId) then + {self.}W15DocId.Copy(_obj.XmlChildW15DocId); + tslassigning := tslassigning_backup; end; function Settings.ReadXmlAttrXmlnsO(); @@ -348,6 +310,11 @@ end; function Settings.WriteXmlAttrXmlnsO(_value); begin + if ifnil({self.}XmlAttrXmlnsO) then + begin + {self.}XmlAttrXmlnsO := new OpenXmlAttribute("xmlns", "o", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsO; + end {self.}XmlAttrXmlnsO.Value := _value; end; @@ -358,6 +325,11 @@ end; function Settings.WriteXmlAttrXmlnsR(_value); begin + if ifnil({self.}XmlAttrXmlnsR) then + begin + {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsR; + end {self.}XmlAttrXmlnsR.Value := _value; end; @@ -368,6 +340,11 @@ end; function Settings.WriteXmlAttrXmlnsM(_value); begin + if ifnil({self.}XmlAttrXmlnsM) then + begin + {self.}XmlAttrXmlnsM := new OpenXmlAttribute("xmlns", "m", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsM; + end {self.}XmlAttrXmlnsM.Value := _value; end; @@ -378,6 +355,11 @@ end; function Settings.WriteXmlAttrXmlnsV(_value); begin + if ifnil({self.}XmlAttrXmlnsV) then + begin + {self.}XmlAttrXmlnsV := new OpenXmlAttribute("xmlns", "v", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsV; + end {self.}XmlAttrXmlnsV.Value := _value; end; @@ -388,6 +370,11 @@ end; function Settings.WriteXmlAttrXmlnsW(_value); begin + if ifnil({self.}XmlAttrXmlnsW) then + begin + {self.}XmlAttrXmlnsW := new OpenXmlAttribute("xmlns", "w", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW; + end {self.}XmlAttrXmlnsW.Value := _value; end; @@ -398,6 +385,11 @@ end; function Settings.WriteXmlAttrXmlnsW14(_value); begin + if ifnil({self.}XmlAttrXmlnsW14) then + begin + {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW14; + end {self.}XmlAttrXmlnsW14.Value := _value; end; @@ -408,6 +400,11 @@ end; function Settings.WriteXmlAttrXmlnsW15(_value); begin + if ifnil({self.}XmlAttrXmlnsW15) then + begin + {self.}XmlAttrXmlnsW15 := new OpenXmlAttribute("xmlns", "w15", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW15; + end {self.}XmlAttrXmlnsW15.Value := _value; end; @@ -418,6 +415,11 @@ end; function Settings.WriteXmlAttrXmlnsW16Cex(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Cex) then + begin + {self.}XmlAttrXmlnsW16Cex := new OpenXmlAttribute("xmlns", "w16cex", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Cex; + end {self.}XmlAttrXmlnsW16Cex.Value := _value; end; @@ -428,6 +430,11 @@ end; function Settings.WriteXmlAttrXmlnsW16Cid(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Cid) then + begin + {self.}XmlAttrXmlnsW16Cid := new OpenXmlAttribute("xmlns", "w16cid", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Cid; + end {self.}XmlAttrXmlnsW16Cid.Value := _value; end; @@ -438,6 +445,11 @@ end; function Settings.WriteXmlAttrXmlnsW16(_value); begin + if ifnil({self.}XmlAttrXmlnsW16) then + begin + {self.}XmlAttrXmlnsW16 := new OpenXmlAttribute("xmlns", "w16", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16; + end {self.}XmlAttrXmlnsW16.Value := _value; end; @@ -448,6 +460,11 @@ end; function Settings.WriteXmlAttrXmlnsW16Du(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Du) then + begin + {self.}XmlAttrXmlnsW16Du := new OpenXmlAttribute("xmlns", "w16du", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Du; + end {self.}XmlAttrXmlnsW16Du.Value := _value; end; @@ -458,6 +475,11 @@ end; function Settings.WriteXmlAttrXmlnsW16se(_value); begin + if ifnil({self.}XmlAttrXmlnsW16se) then + begin + {self.}XmlAttrXmlnsW16se := new OpenXmlAttribute("xmlns", "w16se", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16se; + end {self.}XmlAttrXmlnsW16se.Value := _value; end; @@ -468,6 +490,11 @@ end; function Settings.WriteXmlAttrXmlnsSl(_value); begin + if ifnil({self.}XmlAttrXmlnsSl) then + begin + {self.}XmlAttrXmlnsSl := new OpenXmlAttribute("xmlns", "sl", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsSl; + end {self.}XmlAttrXmlnsSl.Value := _value; end; @@ -478,55 +505,305 @@ end; function Settings.WriteXmlAttrMcIgnorable(_value); begin + if ifnil({self.}XmlAttrMcIgnorable) then + begin + {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); + attributes_[length(attributes_)] := {self.}XmlAttrMcIgnorable; + end {self.}XmlAttrMcIgnorable.Value := _value; end; function Settings.ReadXmlChildBordersDoNotSurroundHeader(); begin - return ifnil({self.}XmlChildBordersDoNotSurroundHeader.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildBordersDoNotSurroundHeader) then + begin + {self.}XmlChildBordersDoNotSurroundHeader := new OpenXmlEmpty(self, {self.}Prefix, "bordersDoNotSurroundHeader"); + container_.Set({self.}XmlChildBordersDoNotSurroundHeader); + return {self.}XmlChildBordersDoNotSurroundHeader; + end + return {self.}XmlChildBordersDoNotSurroundHeader.BoolValue(); end; function Settings.WriteXmlChildBordersDoNotSurroundHeader(_value); begin + if ifnil({self.}XmlChildBordersDoNotSurroundHeader) then + begin + {self.}XmlChildBordersDoNotSurroundHeader := new OpenXmlEmpty(self, {self.}Prefix, "bordersDoNotSurroundHeader"); + container_.Set({self.}XmlChildBordersDoNotSurroundHeader); + end {self.}XmlChildBordersDoNotSurroundHeader.Value := _value; end; function Settings.ReadXmlChildBordersDoNotSurroundFooter(); begin - return ifnil({self.}XmlChildBordersDoNotSurroundFooter.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildBordersDoNotSurroundFooter) then + begin + {self.}XmlChildBordersDoNotSurroundFooter := new OpenXmlEmpty(self, {self.}Prefix, "bordersDoNotSurroundFooter"); + container_.Set({self.}XmlChildBordersDoNotSurroundFooter); + return {self.}XmlChildBordersDoNotSurroundFooter; + end + return {self.}XmlChildBordersDoNotSurroundFooter.BoolValue(); end; function Settings.WriteXmlChildBordersDoNotSurroundFooter(_value); begin + if ifnil({self.}XmlChildBordersDoNotSurroundFooter) then + begin + {self.}XmlChildBordersDoNotSurroundFooter := new OpenXmlEmpty(self, {self.}Prefix, "bordersDoNotSurroundFooter"); + container_.Set({self.}XmlChildBordersDoNotSurroundFooter); + end {self.}XmlChildBordersDoNotSurroundFooter.Value := _value; end; function Settings.ReadXmlChildEvenAndOddHeaders(); begin - return ifnil({self.}XmlChildEvenAndOddHeaders.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildEvenAndOddHeaders) then + begin + {self.}XmlChildEvenAndOddHeaders := new OpenXmlEmpty(self, {self.}Prefix, "evenAndOddHeaders"); + container_.Set({self.}XmlChildEvenAndOddHeaders); + return {self.}XmlChildEvenAndOddHeaders; + end + return {self.}XmlChildEvenAndOddHeaders.BoolValue(); end; function Settings.WriteXmlChildEvenAndOddHeaders(_value); begin + if ifnil({self.}XmlChildEvenAndOddHeaders) then + begin + {self.}XmlChildEvenAndOddHeaders := new OpenXmlEmpty(self, {self.}Prefix, "evenAndOddHeaders"); + container_.Set({self.}XmlChildEvenAndOddHeaders); + end {self.}XmlChildEvenAndOddHeaders.Value := _value; end; function Settings.ReadXmlChildDoNotIncludeSubdocsInStats(); begin - return ifnil({self.}XmlChildDoNotIncludeSubdocsInStats.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildDoNotIncludeSubdocsInStats) then + begin + {self.}XmlChildDoNotIncludeSubdocsInStats := new OpenXmlEmpty(self, {self.}Prefix, "doNotIncludeSubdocsInStats"); + container_.Set({self.}XmlChildDoNotIncludeSubdocsInStats); + return {self.}XmlChildDoNotIncludeSubdocsInStats; + end + return {self.}XmlChildDoNotIncludeSubdocsInStats.BoolValue(); end; function Settings.WriteXmlChildDoNotIncludeSubdocsInStats(_value); begin + if ifnil({self.}XmlChildDoNotIncludeSubdocsInStats) then + begin + {self.}XmlChildDoNotIncludeSubdocsInStats := new OpenXmlEmpty(self, {self.}Prefix, "doNotIncludeSubdocsInStats"); + container_.Set({self.}XmlChildDoNotIncludeSubdocsInStats); + end {self.}XmlChildDoNotIncludeSubdocsInStats.Value := _value; end; function Settings.ReadXmlChildW15ChartTrackingRefBased(); begin - return ifnil({self.}XmlChildW15ChartTrackingRefBased.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildW15ChartTrackingRefBased) then + begin + {self.}XmlChildW15ChartTrackingRefBased := new OpenXmlEmpty(self, "w15", "chartTrackingRefBased"); + container_.Set({self.}XmlChildW15ChartTrackingRefBased); + return {self.}XmlChildW15ChartTrackingRefBased; + end + return {self.}XmlChildW15ChartTrackingRefBased.BoolValue(); end; function Settings.WriteXmlChildW15ChartTrackingRefBased(_value); begin + if ifnil({self.}XmlChildW15ChartTrackingRefBased) then + begin + {self.}XmlChildW15ChartTrackingRefBased := new OpenXmlEmpty(self, "w15", "chartTrackingRefBased"); + container_.Set({self.}XmlChildW15ChartTrackingRefBased); + end {self.}XmlChildW15ChartTrackingRefBased.Value := _value; end; + +function Settings.ReadXmlChildZoom(); +begin + if tslassigning and ifnil({self.}XmlChildZoom) then + begin + {self.}XmlChildZoom := new Zoom(self, {self.}Prefix, "zoom"); + container_.Set({self.}XmlChildZoom); + end + return {self.}XmlChildZoom; +end; + +function Settings.ReadXmlChildDefaultTabStop(); +begin + if tslassigning and ifnil({self.}XmlChildDefaultTabStop) then + begin + {self.}XmlChildDefaultTabStop := new PureWVal(self, {self.}Prefix, "defaultTabStop"); + container_.Set({self.}XmlChildDefaultTabStop); + end + return {self.}XmlChildDefaultTabStop; +end; + +function Settings.ReadXmlChildDrawingGridVerticalSpacing(); +begin + if tslassigning and ifnil({self.}XmlChildDrawingGridVerticalSpacing) then + begin + {self.}XmlChildDrawingGridVerticalSpacing := new PureWVal(self, {self.}Prefix, "drawingGridVerticalSpacing"); + container_.Set({self.}XmlChildDrawingGridVerticalSpacing); + end + return {self.}XmlChildDrawingGridVerticalSpacing; +end; + +function Settings.ReadXmlChildDisplayHorizontalDrawingGridEvery(); +begin + if tslassigning and ifnil({self.}XmlChildDisplayHorizontalDrawingGridEvery) then + begin + {self.}XmlChildDisplayHorizontalDrawingGridEvery := new PureWVal(self, {self.}Prefix, "displayHorizontalDrawingGridEvery"); + container_.Set({self.}XmlChildDisplayHorizontalDrawingGridEvery); + end + return {self.}XmlChildDisplayHorizontalDrawingGridEvery; +end; + +function Settings.ReadXmlChildDisplayVerticalDrawingGridEvery(); +begin + if tslassigning and ifnil({self.}XmlChildDisplayVerticalDrawingGridEvery) then + begin + {self.}XmlChildDisplayVerticalDrawingGridEvery := new PureWVal(self, {self.}Prefix, "DisplayVerticalDrawingGridEvery"); + container_.Set({self.}XmlChildDisplayVerticalDrawingGridEvery); + end + return {self.}XmlChildDisplayVerticalDrawingGridEvery; +end; + +function Settings.ReadXmlChildCharacterSpacingControl(); +begin + if tslassigning and ifnil({self.}XmlChildCharacterSpacingControl) then + begin + {self.}XmlChildCharacterSpacingControl := new PureWVal(self, {self.}Prefix, "characterSpacingControl"); + container_.Set({self.}XmlChildCharacterSpacingControl); + end + return {self.}XmlChildCharacterSpacingControl; +end; + +function Settings.ReadXmlChildHdrShapeDefaults(); +begin + if tslassigning and ifnil({self.}XmlChildHdrShapeDefaults) then + begin + {self.}XmlChildHdrShapeDefaults := new HdrShapeDefaults(self, {self.}Prefix, "hdrShapeDefaults"); + container_.Set({self.}XmlChildHdrShapeDefaults); + end + return {self.}XmlChildHdrShapeDefaults; +end; + +function Settings.ReadXmlChildFootnotePr(); +begin + if tslassigning and ifnil({self.}XmlChildFootnotePr) then + begin + {self.}XmlChildFootnotePr := new FootnotePr(self, {self.}Prefix, "footnotePr"); + container_.Set({self.}XmlChildFootnotePr); + end + return {self.}XmlChildFootnotePr; +end; + +function Settings.ReadXmlChildEndnotePr(); +begin + if tslassigning and ifnil({self.}XmlChildEndnotePr) then + begin + {self.}XmlChildEndnotePr := new EndnotePr(self, {self.}Prefix, "endnotePr"); + container_.Set({self.}XmlChildEndnotePr); + end + return {self.}XmlChildEndnotePr; +end; + +function Settings.ReadXmlChildCompat(); +begin + if tslassigning and ifnil({self.}XmlChildCompat) then + begin + {self.}XmlChildCompat := new Compat(self, {self.}Prefix, "Compat"); + container_.Set({self.}XmlChildCompat); + end + return {self.}XmlChildCompat; +end; + +function Settings.ReadXmlChildRsids(); +begin + if tslassigning and ifnil({self.}XmlChildRsids) then + begin + {self.}XmlChildRsids := new Rsids(self, {self.}Prefix, "rsids"); + container_.Set({self.}XmlChildRsids); + end + return {self.}XmlChildRsids; +end; + +function Settings.ReadXmlChildMathPr(); +begin + if tslassigning and ifnil({self.}XmlChildMathPr) then + begin + {self.}XmlChildMathPr := new MathPr(self, "m", "mathPr"); + container_.Set({self.}XmlChildMathPr); + end + return {self.}XmlChildMathPr; +end; + +function Settings.ReadXmlChildThemeFontLang(); +begin + if tslassigning and ifnil({self.}XmlChildThemeFontLang) then + begin + {self.}XmlChildThemeFontLang := new ThemeFontLang(self, {self.}Prefix, "themeFontLang"); + container_.Set({self.}XmlChildThemeFontLang); + end + return {self.}XmlChildThemeFontLang; +end; + +function Settings.ReadXmlChildClrSchemeMapping(); +begin + if tslassigning and ifnil({self.}XmlChildClrSchemeMapping) then + begin + {self.}XmlChildClrSchemeMapping := new ClrSchemeMapping(self, {self.}Prefix, "clrSchemeMapping"); + container_.Set({self.}XmlChildClrSchemeMapping); + end + return {self.}XmlChildClrSchemeMapping; +end; + +function Settings.ReadXmlChildShapeDefaults(); +begin + if tslassigning and ifnil({self.}XmlChildShapeDefaults) then + begin + {self.}XmlChildShapeDefaults := new ShapeDefaults2(self, {self.}Prefix, "shapeDefaults"); + container_.Set({self.}XmlChildShapeDefaults); + end + return {self.}XmlChildShapeDefaults; +end; + +function Settings.ReadXmlChildDecimalSymbol(); +begin + if tslassigning and ifnil({self.}XmlChildDecimalSymbol) then + begin + {self.}XmlChildDecimalSymbol := new PureWVal(self, {self.}Prefix, "decimalSymbol"); + container_.Set({self.}XmlChildDecimalSymbol); + end + return {self.}XmlChildDecimalSymbol; +end; + +function Settings.ReadXmlChildListSeparator(); +begin + if tslassigning and ifnil({self.}XmlChildListSeparator) then + begin + {self.}XmlChildListSeparator := new PureWVal(self, {self.}Prefix, "listSeparator"); + container_.Set({self.}XmlChildListSeparator); + end + return {self.}XmlChildListSeparator; +end; + +function Settings.ReadXmlChildW14DocId(); +begin + if tslassigning and ifnil({self.}XmlChildW14DocId) then + begin + {self.}XmlChildW14DocId := new PureWVal(self, "w14", "docId"); + container_.Set({self.}XmlChildW14DocId); + end + return {self.}XmlChildW14DocId; +end; + +function Settings.ReadXmlChildW15DocId(); +begin + if tslassigning and ifnil({self.}XmlChildW15DocId) then + begin + {self.}XmlChildW15DocId := new PureWVal(self, "w15", "docId"); + container_.Set({self.}XmlChildW15DocId); + end + return {self.}XmlChildW15DocId; +end; diff --git a/autoclass/docx/Shape@DOCX.tsf b/autoclass/docx/Shape@DOCX.tsf index c144bed..5d4b75a 100644 --- a/autoclass/docx/Shape@DOCX.tsf +++ b/autoclass/docx/Shape@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Shape);override; +public + + // attributes property property Id read ReadXmlAttrId write WriteXmlAttrId; property Spid read ReadXmlAttrSpid write WriteXmlAttrSpid; property Type read ReadXmlAttrType write WriteXmlAttrType; @@ -28,8 +28,12 @@ public function ReadXmlAttrStroked(); function WriteXmlAttrStroked(_value); + // normal property + property Textbox read ReadXmlChildTextbox; + function ReadXmlChildTextbox(); + public - // Attributes + // Attributes XmlAttrId: OpenXmlAttribute; XmlAttrSpid: OpenXmlAttribute; XmlAttrType: OpenXmlAttribute; @@ -38,7 +42,7 @@ public XmlAttrStroked: OpenXmlAttribute; // Children - Textbox: Textbox; + XmlChildTextbox: Textbox; end; @@ -54,96 +58,48 @@ end; function Shape.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Shape.Init();override; begin - {self.}XmlAttrId := new OpenXmlAttribute(nil, "id", nil); - {self.}XmlAttrSpid := new OpenXmlAttribute("o", "spid", nil); - {self.}XmlAttrType := new OpenXmlAttribute(nil, "type", nil); - {self.}XmlAttrGfxdata := new OpenXmlAttribute("o", "gfxdata", nil); - {self.}XmlAttrFilled := new OpenXmlAttribute(nil, "filled", nil); - {self.}XmlAttrStroked := new OpenXmlAttribute(nil, "stroked", nil); - {self.}Textbox := new Textbox(self, {self.}Prefix, "textbox"); -end; - -function Shape.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrId, - {self.}XmlAttrSpid, - {self.}XmlAttrType, - {self.}XmlAttrGfxdata, - {self.}XmlAttrFilled, - {self.}XmlAttrStroked, - ); -end; - -function Shape.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Textbox, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "id": makeweakref(thisFunction(WriteXmlAttrId)), + "o:spid": makeweakref(thisFunction(WriteXmlAttrSpid)), + "type": makeweakref(thisFunction(WriteXmlAttrType)), + "o:gfxdata": makeweakref(thisFunction(WriteXmlAttrGfxdata)), + "filled": makeweakref(thisFunction(WriteXmlAttrFilled)), + "stroked": makeweakref(thisFunction(WriteXmlAttrStroked)), ); sorted_child_ := array( - "": -1, - {self.}Textbox.ElementName: 0, + pre + "textbox": array(0, makeweakref(thisFunction(ReadXmlChildTextbox))), ); -end; - -function Shape.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Shape.Copy(_obj: Shape);override; begin - if not ifnil(_obj.XmlAttrId.Value) then - {self.}XmlAttrId.Value := _obj.XmlAttrId.Value; - if not ifnil(_obj.XmlAttrSpid.Value) then - {self.}XmlAttrSpid.Value := _obj.XmlAttrSpid.Value; - if not ifnil(_obj.XmlAttrType.Value) then - {self.}XmlAttrType.Value := _obj.XmlAttrType.Value; - if not ifnil(_obj.XmlAttrGfxdata.Value) then - {self.}XmlAttrGfxdata.Value := _obj.XmlAttrGfxdata.Value; - if not ifnil(_obj.XmlAttrFilled.Value) then - {self.}XmlAttrFilled.Value := _obj.XmlAttrFilled.Value; - if not ifnil(_obj.XmlAttrStroked.Value) then - {self.}XmlAttrStroked.Value := _obj.XmlAttrStroked.Value; - {self.}Textbox.Copy(_obj.Textbox); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Id) then + {self.}Id := _obj.Id; + if not ifnil(_obj.Spid) then + {self.}Spid := _obj.Spid; + if not ifnil(_obj.Type) then + {self.}Type := _obj.Type; + if not ifnil(_obj.Gfxdata) then + {self.}Gfxdata := _obj.Gfxdata; + if not ifnil(_obj.Filled) then + {self.}Filled := _obj.Filled; + if not ifnil(_obj.Stroked) then + {self.}Stroked := _obj.Stroked; + if not ifnil(_obj.XmlChildTextbox) then + {self.}Textbox.Copy(_obj.XmlChildTextbox); + tslassigning := tslassigning_backup; end; function Shape.ReadXmlAttrId(); @@ -153,6 +109,11 @@ end; function Shape.WriteXmlAttrId(_value); begin + if ifnil({self.}XmlAttrId) then + begin + {self.}XmlAttrId := new OpenXmlAttribute("", "id", nil); + attributes_[length(attributes_)] := {self.}XmlAttrId; + end {self.}XmlAttrId.Value := _value; end; @@ -163,6 +124,11 @@ end; function Shape.WriteXmlAttrSpid(_value); begin + if ifnil({self.}XmlAttrSpid) then + begin + {self.}XmlAttrSpid := new OpenXmlAttribute("o", "spid", nil); + attributes_[length(attributes_)] := {self.}XmlAttrSpid; + end {self.}XmlAttrSpid.Value := _value; end; @@ -173,6 +139,11 @@ end; function Shape.WriteXmlAttrType(_value); begin + if ifnil({self.}XmlAttrType) then + begin + {self.}XmlAttrType := new OpenXmlAttribute("", "type", nil); + attributes_[length(attributes_)] := {self.}XmlAttrType; + end {self.}XmlAttrType.Value := _value; end; @@ -183,6 +154,11 @@ end; function Shape.WriteXmlAttrGfxdata(_value); begin + if ifnil({self.}XmlAttrGfxdata) then + begin + {self.}XmlAttrGfxdata := new OpenXmlAttribute("o", "gfxdata", nil); + attributes_[length(attributes_)] := {self.}XmlAttrGfxdata; + end {self.}XmlAttrGfxdata.Value := _value; end; @@ -193,6 +169,11 @@ end; function Shape.WriteXmlAttrFilled(_value); begin + if ifnil({self.}XmlAttrFilled) then + begin + {self.}XmlAttrFilled := new OpenXmlAttribute("", "filled", nil); + attributes_[length(attributes_)] := {self.}XmlAttrFilled; + end {self.}XmlAttrFilled.Value := _value; end; @@ -203,5 +184,20 @@ end; function Shape.WriteXmlAttrStroked(_value); begin + if ifnil({self.}XmlAttrStroked) then + begin + {self.}XmlAttrStroked := new OpenXmlAttribute("", "stroked", nil); + attributes_[length(attributes_)] := {self.}XmlAttrStroked; + end {self.}XmlAttrStroked.Value := _value; end; + +function Shape.ReadXmlChildTextbox(); +begin + if tslassigning and ifnil({self.}XmlChildTextbox) then + begin + {self.}XmlChildTextbox := new Textbox(self, {self.}Prefix, "textbox"); + container_.Set({self.}XmlChildTextbox); + end + return {self.}XmlChildTextbox; +end; diff --git a/autoclass/docx/ShapeDefaults2@DOCX.tsf b/autoclass/docx/ShapeDefaults2@DOCX.tsf index ff21587..a41604c 100644 --- a/autoclass/docx/ShapeDefaults2@DOCX.tsf +++ b/autoclass/docx/ShapeDefaults2@DOCX.tsf @@ -4,17 +4,20 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: ShapeDefaults2);override; public - // Attributes + // normal property + property ShapeDefaults read ReadXmlChildShapeDefaults; + property ShapeLayout read ReadXmlChildShapeLayout; + function ReadXmlChildShapeDefaults(); + function ReadXmlChildShapeLayout(); + +public // Children - ShapeDefaults: ShapeDefaults; - ShapeLayout: ShapeLayout; + XmlChildShapeDefaults: ShapeDefaults; + XmlChildShapeLayout: ShapeLayout; end; @@ -30,74 +33,51 @@ end; function ShapeDefaults2.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function ShapeDefaults2.Init();override; begin - {self.}ShapeDefaults := new ShapeDefaults(self, "o", "shapeDefaults"); - {self.}ShapeLayout := new ShapeLayout(self, "o", "shapelayout"); -end; - -function ShapeDefaults2.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function ShapeDefaults2.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}ShapeDefaults, - 1: {self.}ShapeLayout, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}ShapeDefaults.ElementName: 0, - {self.}ShapeLayout.ElementName: 1, + "o:shapeDefaults": array(0, makeweakref(thisFunction(ReadXmlChildShapeDefaults))), + "o:shapelayout": array(1, makeweakref(thisFunction(ReadXmlChildShapeLayout))), ); -end; - -function ShapeDefaults2.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function ShapeDefaults2.Copy(_obj: ShapeDefaults2);override; begin - {self.}ShapeDefaults.Copy(_obj.ShapeDefaults); - {self.}ShapeLayout.Copy(_obj.ShapeLayout); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildShapeDefaults) then + {self.}ShapeDefaults.Copy(_obj.XmlChildShapeDefaults); + if not ifnil(_obj.XmlChildShapeLayout) then + {self.}ShapeLayout.Copy(_obj.XmlChildShapeLayout); + tslassigning := tslassigning_backup; +end; + +function ShapeDefaults2.ReadXmlChildShapeDefaults(); +begin + if tslassigning and ifnil({self.}XmlChildShapeDefaults) then + begin + {self.}XmlChildShapeDefaults := new ShapeDefaults(self, "o", "shapeDefaults"); + container_.Set({self.}XmlChildShapeDefaults); + end + return {self.}XmlChildShapeDefaults; +end; + +function ShapeDefaults2.ReadXmlChildShapeLayout(); +begin + if tslassigning and ifnil({self.}XmlChildShapeLayout) then + begin + {self.}XmlChildShapeLayout := new ShapeLayout(self, "o", "shapelayout"); + container_.Set({self.}XmlChildShapeLayout); + end + return {self.}XmlChildShapeLayout; end; diff --git a/autoclass/docx/ShapeDefaults@DOCX.tsf b/autoclass/docx/ShapeDefaults@DOCX.tsf index cec55e1..270d6cc 100644 --- a/autoclass/docx/ShapeDefaults@DOCX.tsf +++ b/autoclass/docx/ShapeDefaults@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: ShapeDefaults);override; +public + + // attributes property property Ext read ReadXmlAttrExt write WriteXmlAttrExt; property Spidmax read ReadXmlAttrSpidmax write WriteXmlAttrSpidmax; function ReadXmlAttrExt(); @@ -17,11 +17,10 @@ public function WriteXmlAttrSpidmax(_value); public - // Attributes + // Attributes XmlAttrExt: OpenXmlAttribute; XmlAttrSpidmax: OpenXmlAttribute; - // Children end; @@ -37,45 +36,33 @@ end; function ShapeDefaults.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function ShapeDefaults.Init();override; begin - {self.}XmlAttrExt := new OpenXmlAttribute("v", "ext", nil); - {self.}XmlAttrSpidmax := new OpenXmlAttribute(nil, "spidmax", nil); -end; - -function ShapeDefaults.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrExt, - {self.}XmlAttrSpidmax, - ); -end; - -function ShapeDefaults.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "v:ext": makeweakref(thisFunction(WriteXmlAttrExt)), + "spidmax": makeweakref(thisFunction(WriteXmlAttrSpidmax)), ); sorted_child_ := array( - "": -1, ); -end; - -function ShapeDefaults.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function ShapeDefaults.Copy(_obj: ShapeDefaults);override; begin - if not ifnil(_obj.XmlAttrExt.Value) then - {self.}XmlAttrExt.Value := _obj.XmlAttrExt.Value; - if not ifnil(_obj.XmlAttrSpidmax.Value) then - {self.}XmlAttrSpidmax.Value := _obj.XmlAttrSpidmax.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Ext) then + {self.}Ext := _obj.Ext; + if not ifnil(_obj.Spidmax) then + {self.}Spidmax := _obj.Spidmax; + tslassigning := tslassigning_backup; end; function ShapeDefaults.ReadXmlAttrExt(); @@ -85,6 +72,11 @@ end; function ShapeDefaults.WriteXmlAttrExt(_value); begin + if ifnil({self.}XmlAttrExt) then + begin + {self.}XmlAttrExt := new OpenXmlAttribute("v", "ext", nil); + attributes_[length(attributes_)] := {self.}XmlAttrExt; + end {self.}XmlAttrExt.Value := _value; end; @@ -95,5 +87,10 @@ end; function ShapeDefaults.WriteXmlAttrSpidmax(_value); begin + if ifnil({self.}XmlAttrSpidmax) then + begin + {self.}XmlAttrSpidmax := new OpenXmlAttribute("", "spidmax", nil); + attributes_[length(attributes_)] := {self.}XmlAttrSpidmax; + end {self.}XmlAttrSpidmax.Value := _value; end; diff --git a/autoclass/docx/ShapeLayout@DOCX.tsf b/autoclass/docx/ShapeLayout@DOCX.tsf index 7313dd5..669d07c 100644 --- a/autoclass/docx/ShapeLayout@DOCX.tsf +++ b/autoclass/docx/ShapeLayout@DOCX.tsf @@ -4,21 +4,25 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: ShapeLayout);override; +public + + // attributes property property Ext read ReadXmlAttrExt write WriteXmlAttrExt; function ReadXmlAttrExt(); function WriteXmlAttrExt(_value); + // normal property + property IdMap read ReadXmlChildIdMap; + function ReadXmlChildIdMap(); + public - // Attributes + // Attributes XmlAttrExt: OpenXmlAttribute; // Children - IdMap: IdMap; + XmlChildIdMap: IdMap; end; @@ -34,76 +38,33 @@ end; function ShapeLayout.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function ShapeLayout.Init();override; begin - {self.}XmlAttrExt := new OpenXmlAttribute("v", "ext", nil); - {self.}IdMap := new IdMap(self, {self.}Prefix, "idmap"); -end; - -function ShapeLayout.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrExt, - ); -end; - -function ShapeLayout.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}IdMap, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "v:ext": makeweakref(thisFunction(WriteXmlAttrExt)), ); sorted_child_ := array( - "": -1, - {self.}IdMap.ElementName: 0, + pre + "idmap": array(0, makeweakref(thisFunction(ReadXmlChildIdMap))), ); -end; - -function ShapeLayout.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function ShapeLayout.Copy(_obj: ShapeLayout);override; begin - if not ifnil(_obj.XmlAttrExt.Value) then - {self.}XmlAttrExt.Value := _obj.XmlAttrExt.Value; - {self.}IdMap.Copy(_obj.IdMap); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Ext) then + {self.}Ext := _obj.Ext; + if not ifnil(_obj.XmlChildIdMap) then + {self.}IdMap.Copy(_obj.XmlChildIdMap); + tslassigning := tslassigning_backup; end; function ShapeLayout.ReadXmlAttrExt(); @@ -113,5 +74,20 @@ end; function ShapeLayout.WriteXmlAttrExt(_value); begin + if ifnil({self.}XmlAttrExt) then + begin + {self.}XmlAttrExt := new OpenXmlAttribute("v", "ext", nil); + attributes_[length(attributes_)] := {self.}XmlAttrExt; + end {self.}XmlAttrExt.Value := _value; end; + +function ShapeLayout.ReadXmlChildIdMap(); +begin + if tslassigning and ifnil({self.}XmlChildIdMap) then + begin + {self.}XmlChildIdMap := new IdMap(self, {self.}Prefix, "idmap"); + container_.Set({self.}XmlChildIdMap); + end + return {self.}XmlChildIdMap; +end; diff --git a/autoclass/docx/Shapetype@DOCX.tsf b/autoclass/docx/Shapetype@DOCX.tsf index 8e5b7eb..fe5acd0 100644 --- a/autoclass/docx/Shapetype@DOCX.tsf +++ b/autoclass/docx/Shapetype@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Shapetype);override; +public + + // attributes property property AnchorId read ReadXmlAttrAnchorId write WriteXmlAttrAnchorId; property Id read ReadXmlAttrId write WriteXmlAttrId; property Coordsize read ReadXmlAttrCoordsize write WriteXmlAttrCoordsize; @@ -25,8 +25,14 @@ public function ReadXmlAttrPath(); function WriteXmlAttrPath(_value); + // normal property + property Stroke read ReadXmlChildStroke; + property Path read ReadXmlChildPath; + function ReadXmlChildStroke(); + function ReadXmlChildPath(); + public - // Attributes + // Attributes XmlAttrAnchorId: OpenXmlAttribute; XmlAttrId: OpenXmlAttribute; XmlAttrCoordsize: OpenXmlAttribute; @@ -34,8 +40,8 @@ public XmlAttrPath: OpenXmlAttribute; // Children - Stroke: Stroke; - Path: Path; + XmlChildStroke: Stroke; + XmlChildPath: Path; end; @@ -51,96 +57,48 @@ end; function Shapetype.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Shapetype.Init();override; begin - {self.}XmlAttrAnchorId := new OpenXmlAttribute("w14", "anchorId", nil); - {self.}XmlAttrId := new OpenXmlAttribute(nil, "id", nil); - {self.}XmlAttrCoordsize := new OpenXmlAttribute(nil, "coordsize", nil); - {self.}XmlAttrSpt := new OpenXmlAttribute("o", "spt", nil); - {self.}XmlAttrPath := new OpenXmlAttribute(nil, "path", nil); - {self.}Stroke := new Stroke(self, {self.}Prefix, "stroke"); - {self.}Path := new Path(self, {self.}Prefix, "path"); -end; - -function Shapetype.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrAnchorId, - {self.}XmlAttrId, - {self.}XmlAttrCoordsize, - {self.}XmlAttrSpt, - {self.}XmlAttrPath, - ); -end; - -function Shapetype.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Stroke, - 1: {self.}Path, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "w14:anchorId": makeweakref(thisFunction(WriteXmlAttrAnchorId)), + "id": makeweakref(thisFunction(WriteXmlAttrId)), + "coordsize": makeweakref(thisFunction(WriteXmlAttrCoordsize)), + "o:spt": makeweakref(thisFunction(WriteXmlAttrSpt)), + "path": makeweakref(thisFunction(WriteXmlAttrPath)), ); sorted_child_ := array( - "": -1, - {self.}Stroke.ElementName: 0, - {self.}Path.ElementName: 1, + pre + "stroke": array(0, makeweakref(thisFunction(ReadXmlChildStroke))), + pre + "path": array(1, makeweakref(thisFunction(ReadXmlChildPath))), ); -end; - -function Shapetype.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Shapetype.Copy(_obj: Shapetype);override; begin - if not ifnil(_obj.XmlAttrAnchorId.Value) then - {self.}XmlAttrAnchorId.Value := _obj.XmlAttrAnchorId.Value; - if not ifnil(_obj.XmlAttrId.Value) then - {self.}XmlAttrId.Value := _obj.XmlAttrId.Value; - if not ifnil(_obj.XmlAttrCoordsize.Value) then - {self.}XmlAttrCoordsize.Value := _obj.XmlAttrCoordsize.Value; - if not ifnil(_obj.XmlAttrSpt.Value) then - {self.}XmlAttrSpt.Value := _obj.XmlAttrSpt.Value; - if not ifnil(_obj.XmlAttrPath.Value) then - {self.}XmlAttrPath.Value := _obj.XmlAttrPath.Value; - {self.}Stroke.Copy(_obj.Stroke); - {self.}Path.Copy(_obj.Path); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.AnchorId) then + {self.}AnchorId := _obj.AnchorId; + if not ifnil(_obj.Id) then + {self.}Id := _obj.Id; + if not ifnil(_obj.Coordsize) then + {self.}Coordsize := _obj.Coordsize; + if not ifnil(_obj.Spt) then + {self.}Spt := _obj.Spt; + if not ifnil(_obj.Path) then + {self.}Path := _obj.Path; + if not ifnil(_obj.XmlChildStroke) then + {self.}Stroke.Copy(_obj.XmlChildStroke); + if not ifnil(_obj.XmlChildPath) then + {self.}Path.Copy(_obj.XmlChildPath); + tslassigning := tslassigning_backup; end; function Shapetype.ReadXmlAttrAnchorId(); @@ -150,6 +108,11 @@ end; function Shapetype.WriteXmlAttrAnchorId(_value); begin + if ifnil({self.}XmlAttrAnchorId) then + begin + {self.}XmlAttrAnchorId := new OpenXmlAttribute("w14", "anchorId", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAnchorId; + end {self.}XmlAttrAnchorId.Value := _value; end; @@ -160,6 +123,11 @@ end; function Shapetype.WriteXmlAttrId(_value); begin + if ifnil({self.}XmlAttrId) then + begin + {self.}XmlAttrId := new OpenXmlAttribute("", "id", nil); + attributes_[length(attributes_)] := {self.}XmlAttrId; + end {self.}XmlAttrId.Value := _value; end; @@ -170,6 +138,11 @@ end; function Shapetype.WriteXmlAttrCoordsize(_value); begin + if ifnil({self.}XmlAttrCoordsize) then + begin + {self.}XmlAttrCoordsize := new OpenXmlAttribute("", "coordsize", nil); + attributes_[length(attributes_)] := {self.}XmlAttrCoordsize; + end {self.}XmlAttrCoordsize.Value := _value; end; @@ -180,6 +153,11 @@ end; function Shapetype.WriteXmlAttrSpt(_value); begin + if ifnil({self.}XmlAttrSpt) then + begin + {self.}XmlAttrSpt := new OpenXmlAttribute("o", "spt", nil); + attributes_[length(attributes_)] := {self.}XmlAttrSpt; + end {self.}XmlAttrSpt.Value := _value; end; @@ -190,5 +168,30 @@ end; function Shapetype.WriteXmlAttrPath(_value); begin + if ifnil({self.}XmlAttrPath) then + begin + {self.}XmlAttrPath := new OpenXmlAttribute("", "path", nil); + attributes_[length(attributes_)] := {self.}XmlAttrPath; + end {self.}XmlAttrPath.Value := _value; end; + +function Shapetype.ReadXmlChildStroke(); +begin + if tslassigning and ifnil({self.}XmlChildStroke) then + begin + {self.}XmlChildStroke := new Stroke(self, {self.}Prefix, "stroke"); + container_.Set({self.}XmlChildStroke); + end + return {self.}XmlChildStroke; +end; + +function Shapetype.ReadXmlChildPath(); +begin + if tslassigning and ifnil({self.}XmlChildPath) then + begin + {self.}XmlChildPath := new Path(self, {self.}Prefix, "path"); + container_.Set({self.}XmlChildPath); + end + return {self.}XmlChildPath; +end; diff --git a/autoclass/docx/Shd@DOCX.tsf b/autoclass/docx/Shd@DOCX.tsf index 07d68e2..da85a8e 100644 --- a/autoclass/docx/Shd@DOCX.tsf +++ b/autoclass/docx/Shd@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Shd);override; +public + + // attributes property property Val read ReadXmlAttrVal write WriteXmlAttrVal; property Color read ReadXmlAttrColor write WriteXmlAttrColor; property Fill read ReadXmlAttrFill write WriteXmlAttrFill; @@ -26,14 +26,13 @@ public function WriteXmlAttrThemeFillTint(_value); public - // Attributes + // Attributes XmlAttrVal: OpenXmlAttribute; XmlAttrColor: OpenXmlAttribute; XmlAttrFill: OpenXmlAttribute; XmlAttrThemeFill: OpenXmlAttribute; XmlAttrThemeFillTint: OpenXmlAttribute; - // Children end; @@ -49,57 +48,42 @@ end; function Shd.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Shd.Init();override; begin - {self.}XmlAttrVal := new OpenXmlAttribute("w", "val", nil); - {self.}XmlAttrColor := new OpenXmlAttribute("w", "color", nil); - {self.}XmlAttrFill := new OpenXmlAttribute("w", "fill", nil); - {self.}XmlAttrThemeFill := new OpenXmlAttribute("w", "themeFill", nil); - {self.}XmlAttrThemeFillTint := new OpenXmlAttribute("w", "themeFillTint", nil); -end; - -function Shd.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrVal, - {self.}XmlAttrColor, - {self.}XmlAttrFill, - {self.}XmlAttrThemeFill, - {self.}XmlAttrThemeFillTint, - ); -end; - -function Shd.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "w:val": makeweakref(thisFunction(WriteXmlAttrVal)), + "w:color": makeweakref(thisFunction(WriteXmlAttrColor)), + "w:fill": makeweakref(thisFunction(WriteXmlAttrFill)), + "w:themeFill": makeweakref(thisFunction(WriteXmlAttrThemeFill)), + "w:themeFillTint": makeweakref(thisFunction(WriteXmlAttrThemeFillTint)), ); sorted_child_ := array( - "": -1, ); -end; - -function Shd.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Shd.Copy(_obj: Shd);override; begin - if not ifnil(_obj.XmlAttrVal.Value) then - {self.}XmlAttrVal.Value := _obj.XmlAttrVal.Value; - if not ifnil(_obj.XmlAttrColor.Value) then - {self.}XmlAttrColor.Value := _obj.XmlAttrColor.Value; - if not ifnil(_obj.XmlAttrFill.Value) then - {self.}XmlAttrFill.Value := _obj.XmlAttrFill.Value; - if not ifnil(_obj.XmlAttrThemeFill.Value) then - {self.}XmlAttrThemeFill.Value := _obj.XmlAttrThemeFill.Value; - if not ifnil(_obj.XmlAttrThemeFillTint.Value) then - {self.}XmlAttrThemeFillTint.Value := _obj.XmlAttrThemeFillTint.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Val) then + {self.}Val := _obj.Val; + if not ifnil(_obj.Color) then + {self.}Color := _obj.Color; + if not ifnil(_obj.Fill) then + {self.}Fill := _obj.Fill; + if not ifnil(_obj.ThemeFill) then + {self.}ThemeFill := _obj.ThemeFill; + if not ifnil(_obj.ThemeFillTint) then + {self.}ThemeFillTint := _obj.ThemeFillTint; + tslassigning := tslassigning_backup; end; function Shd.ReadXmlAttrVal(); @@ -109,6 +93,11 @@ end; function Shd.WriteXmlAttrVal(_value); begin + if ifnil({self.}XmlAttrVal) then + begin + {self.}XmlAttrVal := new OpenXmlAttribute("w", "val", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVal; + end {self.}XmlAttrVal.Value := _value; end; @@ -119,6 +108,11 @@ end; function Shd.WriteXmlAttrColor(_value); begin + if ifnil({self.}XmlAttrColor) then + begin + {self.}XmlAttrColor := new OpenXmlAttribute("w", "color", nil); + attributes_[length(attributes_)] := {self.}XmlAttrColor; + end {self.}XmlAttrColor.Value := _value; end; @@ -129,6 +123,11 @@ end; function Shd.WriteXmlAttrFill(_value); begin + if ifnil({self.}XmlAttrFill) then + begin + {self.}XmlAttrFill := new OpenXmlAttribute("w", "fill", nil); + attributes_[length(attributes_)] := {self.}XmlAttrFill; + end {self.}XmlAttrFill.Value := _value; end; @@ -139,6 +138,11 @@ end; function Shd.WriteXmlAttrThemeFill(_value); begin + if ifnil({self.}XmlAttrThemeFill) then + begin + {self.}XmlAttrThemeFill := new OpenXmlAttribute("w", "themeFill", nil); + attributes_[length(attributes_)] := {self.}XmlAttrThemeFill; + end {self.}XmlAttrThemeFill.Value := _value; end; @@ -149,5 +153,10 @@ end; function Shd.WriteXmlAttrThemeFillTint(_value); begin + if ifnil({self.}XmlAttrThemeFillTint) then + begin + {self.}XmlAttrThemeFillTint := new OpenXmlAttribute("w", "themeFillTint", nil); + attributes_[length(attributes_)] := {self.}XmlAttrThemeFillTint; + end {self.}XmlAttrThemeFillTint.Value := _value; end; diff --git a/autoclass/docx/Sig@DOCX.tsf b/autoclass/docx/Sig@DOCX.tsf index 0b99e6f..0dcd665 100644 --- a/autoclass/docx/Sig@DOCX.tsf +++ b/autoclass/docx/Sig@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Sig);override; +public + + // attributes property property Usb0 read ReadXmlAttrUsb0 write WriteXmlAttrUsb0; property Usb1 read ReadXmlAttrUsb1 write WriteXmlAttrUsb1; property Usb2 read ReadXmlAttrUsb2 write WriteXmlAttrUsb2; @@ -29,7 +29,7 @@ public function WriteXmlAttrcsb1(_value); public - // Attributes + // Attributes XmlAttrUsb0: OpenXmlAttribute; XmlAttrUsb1: OpenXmlAttribute; XmlAttrUsb2: OpenXmlAttribute; @@ -37,7 +37,6 @@ public XmlAttrcsb0: OpenXmlAttribute; XmlAttrcsb1: OpenXmlAttribute; - // Children end; @@ -53,61 +52,45 @@ end; function Sig.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Sig.Init();override; begin - {self.}XmlAttrUsb0 := new OpenXmlAttribute({self.}Prefix, "usb0", nil); - {self.}XmlAttrUsb1 := new OpenXmlAttribute({self.}Prefix, "usb1", nil); - {self.}XmlAttrUsb2 := new OpenXmlAttribute({self.}Prefix, "usb2", nil); - {self.}XmlAttrUsb3 := new OpenXmlAttribute({self.}Prefix, "usb3", nil); - {self.}XmlAttrcsb0 := new OpenXmlAttribute({self.}Prefix, "csb0", nil); - {self.}XmlAttrcsb1 := new OpenXmlAttribute({self.}Prefix, "csb1", nil); -end; - -function Sig.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrUsb0, - {self.}XmlAttrUsb1, - {self.}XmlAttrUsb2, - {self.}XmlAttrUsb3, - {self.}XmlAttrcsb0, - {self.}XmlAttrcsb1, - ); -end; - -function Sig.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "usb0": makeweakref(thisFunction(WriteXmlAttrUsb0)), + pre + "usb1": makeweakref(thisFunction(WriteXmlAttrUsb1)), + pre + "usb2": makeweakref(thisFunction(WriteXmlAttrUsb2)), + pre + "usb3": makeweakref(thisFunction(WriteXmlAttrUsb3)), + pre + "csb0": makeweakref(thisFunction(WriteXmlAttrcsb0)), + pre + "csb1": makeweakref(thisFunction(WriteXmlAttrcsb1)), ); sorted_child_ := array( - "": -1, ); -end; - -function Sig.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Sig.Copy(_obj: Sig);override; begin - if not ifnil(_obj.XmlAttrUsb0.Value) then - {self.}XmlAttrUsb0.Value := _obj.XmlAttrUsb0.Value; - if not ifnil(_obj.XmlAttrUsb1.Value) then - {self.}XmlAttrUsb1.Value := _obj.XmlAttrUsb1.Value; - if not ifnil(_obj.XmlAttrUsb2.Value) then - {self.}XmlAttrUsb2.Value := _obj.XmlAttrUsb2.Value; - if not ifnil(_obj.XmlAttrUsb3.Value) then - {self.}XmlAttrUsb3.Value := _obj.XmlAttrUsb3.Value; - if not ifnil(_obj.XmlAttrcsb0.Value) then - {self.}XmlAttrcsb0.Value := _obj.XmlAttrcsb0.Value; - if not ifnil(_obj.XmlAttrcsb1.Value) then - {self.}XmlAttrcsb1.Value := _obj.XmlAttrcsb1.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Usb0) then + {self.}Usb0 := _obj.Usb0; + if not ifnil(_obj.Usb1) then + {self.}Usb1 := _obj.Usb1; + if not ifnil(_obj.Usb2) then + {self.}Usb2 := _obj.Usb2; + if not ifnil(_obj.Usb3) then + {self.}Usb3 := _obj.Usb3; + if not ifnil(_obj.csb0) then + {self.}csb0 := _obj.csb0; + if not ifnil(_obj.csb1) then + {self.}csb1 := _obj.csb1; + tslassigning := tslassigning_backup; end; function Sig.ReadXmlAttrUsb0(); @@ -117,6 +100,11 @@ end; function Sig.WriteXmlAttrUsb0(_value); begin + if ifnil({self.}XmlAttrUsb0) then + begin + {self.}XmlAttrUsb0 := new OpenXmlAttribute({self.}Prefix, "usb0", nil); + attributes_[length(attributes_)] := {self.}XmlAttrUsb0; + end {self.}XmlAttrUsb0.Value := _value; end; @@ -127,6 +115,11 @@ end; function Sig.WriteXmlAttrUsb1(_value); begin + if ifnil({self.}XmlAttrUsb1) then + begin + {self.}XmlAttrUsb1 := new OpenXmlAttribute({self.}Prefix, "usb1", nil); + attributes_[length(attributes_)] := {self.}XmlAttrUsb1; + end {self.}XmlAttrUsb1.Value := _value; end; @@ -137,6 +130,11 @@ end; function Sig.WriteXmlAttrUsb2(_value); begin + if ifnil({self.}XmlAttrUsb2) then + begin + {self.}XmlAttrUsb2 := new OpenXmlAttribute({self.}Prefix, "usb2", nil); + attributes_[length(attributes_)] := {self.}XmlAttrUsb2; + end {self.}XmlAttrUsb2.Value := _value; end; @@ -147,6 +145,11 @@ end; function Sig.WriteXmlAttrUsb3(_value); begin + if ifnil({self.}XmlAttrUsb3) then + begin + {self.}XmlAttrUsb3 := new OpenXmlAttribute({self.}Prefix, "usb3", nil); + attributes_[length(attributes_)] := {self.}XmlAttrUsb3; + end {self.}XmlAttrUsb3.Value := _value; end; @@ -157,6 +160,11 @@ end; function Sig.WriteXmlAttrcsb0(_value); begin + if ifnil({self.}XmlAttrcsb0) then + begin + {self.}XmlAttrcsb0 := new OpenXmlAttribute({self.}Prefix, "csb0", nil); + attributes_[length(attributes_)] := {self.}XmlAttrcsb0; + end {self.}XmlAttrcsb0.Value := _value; end; @@ -167,5 +175,10 @@ end; function Sig.WriteXmlAttrcsb1(_value); begin + if ifnil({self.}XmlAttrcsb1) then + begin + {self.}XmlAttrcsb1 := new OpenXmlAttribute({self.}Prefix, "csb1", nil); + attributes_[length(attributes_)] := {self.}XmlAttrcsb1; + end {self.}XmlAttrcsb1.Value := _value; end; diff --git a/autoclass/docx/SizeRelH@DOCX.tsf b/autoclass/docx/SizeRelH@DOCX.tsf index bb9c3a4..144db49 100644 --- a/autoclass/docx/SizeRelH@DOCX.tsf +++ b/autoclass/docx/SizeRelH@DOCX.tsf @@ -4,21 +4,25 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: SizeRelH);override; +public + + // attributes property property RelativeFrom read ReadXmlAttrRelativeFrom write WriteXmlAttrRelativeFrom; function ReadXmlAttrRelativeFrom(); function WriteXmlAttrRelativeFrom(_value); + // pcdata property + property PctWidth read ReadXmlChildPctWidth; + function ReadXmlChildPctWidth(); + public - // Attributes + // Attributes XmlAttrRelativeFrom: OpenXmlAttribute; // Children - PctWidth: OpenXmlPcdata; + XmlChildPctWidth: OpenXmlPcdata; end; @@ -34,76 +38,33 @@ end; function SizeRelH.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function SizeRelH.Init();override; begin - {self.}XmlAttrRelativeFrom := new OpenXmlAttribute(nil, "relativeFrom", nil); - {self.}PctWidth := new OpenXmlPcdata(self, {self.}Prefix, "pctWidth"); -end; - -function SizeRelH.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrRelativeFrom, - ); -end; - -function SizeRelH.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}PctWidth, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "relativeFrom": makeweakref(thisFunction(WriteXmlAttrRelativeFrom)), ); sorted_child_ := array( - "": -1, - {self.}PctWidth.ElementName: 0, + pre + "pctWidth": array(0, makeweakref(thisFunction(ReadXmlChildPctWidth))), ); -end; - -function SizeRelH.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function SizeRelH.Copy(_obj: SizeRelH);override; begin - if not ifnil(_obj.XmlAttrRelativeFrom.Value) then - {self.}XmlAttrRelativeFrom.Value := _obj.XmlAttrRelativeFrom.Value; - {self.}PctWidth.Copy(_obj.PctWidth); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.RelativeFrom) then + {self.}RelativeFrom := _obj.RelativeFrom; + if not ifnil(_obj.XmlChildPctWidth) then + {self.}PctWidth.Copy(_obj.XmlChildPctWidth); + tslassigning := tslassigning_backup; end; function SizeRelH.ReadXmlAttrRelativeFrom(); @@ -113,5 +74,20 @@ end; function SizeRelH.WriteXmlAttrRelativeFrom(_value); begin + if ifnil({self.}XmlAttrRelativeFrom) then + begin + {self.}XmlAttrRelativeFrom := new OpenXmlAttribute("", "relativeFrom", nil); + attributes_[length(attributes_)] := {self.}XmlAttrRelativeFrom; + end {self.}XmlAttrRelativeFrom.Value := _value; end; + +function SizeRelH.ReadXmlChildPctWidth(); +begin + if tslassigning and ifnil({self.}XmlChildPctWidth) then + begin + {self.}XmlChildPctWidth := new OpenXmlPcdata(self, {self.}Prefix, "pctWidth"); + container_.Set({self.}XmlChildPctWidth); + end + return {self.}XmlChildPctWidth; +end; diff --git a/autoclass/docx/SizeRelV@DOCX.tsf b/autoclass/docx/SizeRelV@DOCX.tsf index 143a632..253398b 100644 --- a/autoclass/docx/SizeRelV@DOCX.tsf +++ b/autoclass/docx/SizeRelV@DOCX.tsf @@ -4,21 +4,25 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: SizeRelV);override; +public + + // attributes property property RelativeFrom read ReadXmlAttrRelativeFrom write WriteXmlAttrRelativeFrom; function ReadXmlAttrRelativeFrom(); function WriteXmlAttrRelativeFrom(_value); + // pcdata property + property PctHeight read ReadXmlChildPctHeight; + function ReadXmlChildPctHeight(); + public - // Attributes + // Attributes XmlAttrRelativeFrom: OpenXmlAttribute; // Children - PctHeight: OpenXmlPcdata; + XmlChildPctHeight: OpenXmlPcdata; end; @@ -34,76 +38,33 @@ end; function SizeRelV.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function SizeRelV.Init();override; begin - {self.}XmlAttrRelativeFrom := new OpenXmlAttribute(nil, "relativeFrom", nil); - {self.}PctHeight := new OpenXmlPcdata(self, {self.}Prefix, "pctHeight"); -end; - -function SizeRelV.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrRelativeFrom, - ); -end; - -function SizeRelV.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}PctHeight, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "relativeFrom": makeweakref(thisFunction(WriteXmlAttrRelativeFrom)), ); sorted_child_ := array( - "": -1, - {self.}PctHeight.ElementName: 0, + pre + "pctHeight": array(0, makeweakref(thisFunction(ReadXmlChildPctHeight))), ); -end; - -function SizeRelV.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function SizeRelV.Copy(_obj: SizeRelV);override; begin - if not ifnil(_obj.XmlAttrRelativeFrom.Value) then - {self.}XmlAttrRelativeFrom.Value := _obj.XmlAttrRelativeFrom.Value; - {self.}PctHeight.Copy(_obj.PctHeight); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.RelativeFrom) then + {self.}RelativeFrom := _obj.RelativeFrom; + if not ifnil(_obj.XmlChildPctHeight) then + {self.}PctHeight.Copy(_obj.XmlChildPctHeight); + tslassigning := tslassigning_backup; end; function SizeRelV.ReadXmlAttrRelativeFrom(); @@ -113,5 +74,20 @@ end; function SizeRelV.WriteXmlAttrRelativeFrom(_value); begin + if ifnil({self.}XmlAttrRelativeFrom) then + begin + {self.}XmlAttrRelativeFrom := new OpenXmlAttribute("", "relativeFrom", nil); + attributes_[length(attributes_)] := {self.}XmlAttrRelativeFrom; + end {self.}XmlAttrRelativeFrom.Value := _value; end; + +function SizeRelV.ReadXmlChildPctHeight(); +begin + if tslassigning and ifnil({self.}XmlChildPctHeight) then + begin + {self.}XmlChildPctHeight := new OpenXmlPcdata(self, {self.}Prefix, "pctHeight"); + container_.Set({self.}XmlChildPctHeight); + end + return {self.}XmlChildPctHeight; +end; diff --git a/autoclass/docx/SolidFill@DOCX.tsf b/autoclass/docx/SolidFill@DOCX.tsf index 569ecb1..89e168f 100644 --- a/autoclass/docx/SolidFill@DOCX.tsf +++ b/autoclass/docx/SolidFill@DOCX.tsf @@ -4,16 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: SolidFill);override; public - // Attributes + // normal property + property SchemeClr read ReadXmlChildSchemeClr; + function ReadXmlChildSchemeClr(); + +public // Children - SchemeClr: SchemeClr; + XmlChildSchemeClr: SchemeClr; end; @@ -29,70 +30,38 @@ end; function SolidFill.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function SolidFill.Init();override; begin - {self.}SchemeClr := new SchemeClr(self, {self.}Prefix, "schemeClr"); -end; - -function SolidFill.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function SolidFill.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}SchemeClr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}SchemeClr.ElementName: 0, + pre + "schemeClr": array(0, makeweakref(thisFunction(ReadXmlChildSchemeClr))), ); -end; - -function SolidFill.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function SolidFill.Copy(_obj: SolidFill);override; begin - {self.}SchemeClr.Copy(_obj.SchemeClr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildSchemeClr) then + {self.}SchemeClr.Copy(_obj.XmlChildSchemeClr); + tslassigning := tslassigning_backup; +end; + +function SolidFill.ReadXmlChildSchemeClr(); +begin + if tslassigning and ifnil({self.}XmlChildSchemeClr) then + begin + {self.}XmlChildSchemeClr := new SchemeClr(self, {self.}Prefix, "schemeClr"); + container_.Set({self.}XmlChildSchemeClr); + end + return {self.}XmlChildSchemeClr; end; diff --git a/autoclass/docx/SpLocks@DOCX.tsf b/autoclass/docx/SpLocks@DOCX.tsf index bf4954b..2649cf5 100644 --- a/autoclass/docx/SpLocks@DOCX.tsf +++ b/autoclass/docx/SpLocks@DOCX.tsf @@ -4,20 +4,19 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: SpLocks);override; +public + + // attributes property property NoChangeArrowheads read ReadXmlAttrNoChangeArrowheads write WriteXmlAttrNoChangeArrowheads; function ReadXmlAttrNoChangeArrowheads(); function WriteXmlAttrNoChangeArrowheads(_value); public - // Attributes + // Attributes XmlAttrNoChangeArrowheads: OpenXmlAttribute; - // Children end; @@ -33,41 +32,30 @@ end; function SpLocks.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function SpLocks.Init();override; begin - {self.}XmlAttrNoChangeArrowheads := new OpenXmlAttribute(nil, "noChangeArrowheads", nil); -end; - -function SpLocks.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrNoChangeArrowheads, - ); -end; - -function SpLocks.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "noChangeArrowheads": makeweakref(thisFunction(WriteXmlAttrNoChangeArrowheads)), ); sorted_child_ := array( - "": -1, ); -end; - -function SpLocks.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function SpLocks.Copy(_obj: SpLocks);override; begin - if not ifnil(_obj.XmlAttrNoChangeArrowheads.Value) then - {self.}XmlAttrNoChangeArrowheads.Value := _obj.XmlAttrNoChangeArrowheads.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.NoChangeArrowheads) then + {self.}NoChangeArrowheads := _obj.NoChangeArrowheads; + tslassigning := tslassigning_backup; end; function SpLocks.ReadXmlAttrNoChangeArrowheads(); @@ -77,5 +65,10 @@ end; function SpLocks.WriteXmlAttrNoChangeArrowheads(_value); begin + if ifnil({self.}XmlAttrNoChangeArrowheads) then + begin + {self.}XmlAttrNoChangeArrowheads := new OpenXmlAttribute("", "noChangeArrowheads", nil); + attributes_[length(attributes_)] := {self.}XmlAttrNoChangeArrowheads; + end {self.}XmlAttrNoChangeArrowheads.Value := _value; end; diff --git a/autoclass/docx/SpPr@DOCX.tsf b/autoclass/docx/SpPr@DOCX.tsf index 3d48e59..a0083d1 100644 --- a/autoclass/docx/SpPr@DOCX.tsf +++ b/autoclass/docx/SpPr@DOCX.tsf @@ -4,30 +4,43 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: SpPr);override; +public + + // attributes property property BwMode read ReadXmlAttrBwMode write WriteXmlAttrBwMode; function ReadXmlAttrBwMode(); function WriteXmlAttrBwMode(_value); + // empty property property NoFill read ReadXmlChildNoFill write WriteXmlChildNoFill; function ReadXmlChildNoFill(); function WriteXmlChildNoFill(_value); + // normal property + property Xfrm read ReadXmlChildXfrm; + property PrstGeom read ReadXmlChildPrstGeom; + property SolidFill read ReadXmlChildSolidFill; + property Ln read ReadXmlChildLn; + property EffectLst read ReadXmlChildEffectLst; + function ReadXmlChildXfrm(); + function ReadXmlChildPrstGeom(); + function ReadXmlChildSolidFill(); + function ReadXmlChildLn(); + function ReadXmlChildEffectLst(); + public - // Attributes + // Attributes XmlAttrBwMode: OpenXmlAttribute; // Children - Xfrm: Xfrm; - PrstGeom: PrstGeom; + XmlChildXfrm: Xfrm; + XmlChildPrstGeom: PrstGeom; XmlChildNoFill: OpenXmlEmpty; - SolidFill: SolidFill; - Ln: Ln; - EffectLst: EffectLst; + XmlChildSolidFill: SolidFill; + XmlChildLn: Ln; + XmlChildEffectLst: EffectLst; end; @@ -43,96 +56,48 @@ end; function SpPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function SpPr.Init();override; begin - {self.}XmlAttrBwMode := new OpenXmlAttribute(nil, "bwMode", nil); - {self.}Xfrm := new Xfrm(self, "a", "xfrm"); - {self.}PrstGeom := new PrstGeom(self, "a", "prstGeom"); - {self.}XmlChildNoFill := new OpenXmlEmpty(self, "a", "noFill"); - {self.}SolidFill := new SolidFill(self, "a", "solidFill"); - {self.}Ln := new Ln(self, "a", "ln"); - {self.}EffectLst := new EffectLst(self, "a", "effectLst"); -end; - -function SpPr.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrBwMode, - ); -end; - -function SpPr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Xfrm, - 1: {self.}PrstGeom, - 2: {self.}XmlChildNoFill, - 3: {self.}SolidFill, - 4: {self.}Ln, - 5: {self.}EffectLst, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "bwMode": makeweakref(thisFunction(WriteXmlAttrBwMode)), ); sorted_child_ := array( - "": -1, - {self.}Xfrm.ElementName: 0, - {self.}PrstGeom.ElementName: 1, - {self.}XmlChildNoFill.ElementName: 2, - {self.}SolidFill.ElementName: 3, - {self.}Ln.ElementName: 4, - {self.}EffectLst.ElementName: 5, + "a:xfrm": array(0, makeweakref(thisFunction(ReadXmlChildXfrm))), + "a:prstGeom": array(1, makeweakref(thisFunction(ReadXmlChildPrstGeom))), + "a:noFill": array(2, makeweakref(thisFunction(ReadXmlChildNoFill))), + "a:solidFill": array(3, makeweakref(thisFunction(ReadXmlChildSolidFill))), + "a:ln": array(4, makeweakref(thisFunction(ReadXmlChildLn))), + "a:effectLst": array(5, makeweakref(thisFunction(ReadXmlChildEffectLst))), ); -end; - -function SpPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function SpPr.Copy(_obj: SpPr);override; begin - if not ifnil(_obj.XmlAttrBwMode.Value) then - {self.}XmlAttrBwMode.Value := _obj.XmlAttrBwMode.Value; - {self.}Xfrm.Copy(_obj.Xfrm); - {self.}PrstGeom.Copy(_obj.PrstGeom); - {self.}XmlChildNoFill.Copy(_obj.XmlChildNoFill); - {self.}SolidFill.Copy(_obj.SolidFill); - {self.}Ln.Copy(_obj.Ln); - {self.}EffectLst.Copy(_obj.EffectLst); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.BwMode) then + {self.}BwMode := _obj.BwMode; + if not ifnil(_obj.XmlChildXfrm) then + {self.}Xfrm.Copy(_obj.XmlChildXfrm); + if not ifnil(_obj.XmlChildPrstGeom) then + {self.}PrstGeom.Copy(_obj.XmlChildPrstGeom); + if not ifnil(_obj.XmlChildNoFill) then + ifnil({self.}XmlChildNoFill) ? {self.}NoFill.Copy(_obj.XmlChildNoFill) : {self.}XmlChildNoFill.Copy(_obj.XmlChildNoFill); + if not ifnil(_obj.XmlChildSolidFill) then + {self.}SolidFill.Copy(_obj.XmlChildSolidFill); + if not ifnil(_obj.XmlChildLn) then + {self.}Ln.Copy(_obj.XmlChildLn); + if not ifnil(_obj.XmlChildEffectLst) then + {self.}EffectLst.Copy(_obj.XmlChildEffectLst); + tslassigning := tslassigning_backup; end; function SpPr.ReadXmlAttrBwMode(); @@ -142,15 +107,81 @@ end; function SpPr.WriteXmlAttrBwMode(_value); begin + if ifnil({self.}XmlAttrBwMode) then + begin + {self.}XmlAttrBwMode := new OpenXmlAttribute("", "bwMode", nil); + attributes_[length(attributes_)] := {self.}XmlAttrBwMode; + end {self.}XmlAttrBwMode.Value := _value; end; function SpPr.ReadXmlChildNoFill(); begin - return ifnil({self.}XmlChildNoFill.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildNoFill) then + begin + {self.}XmlChildNoFill := new OpenXmlEmpty(self, "a", "noFill"); + container_.Set({self.}XmlChildNoFill); + return {self.}XmlChildNoFill; + end + return {self.}XmlChildNoFill.BoolValue(); end; function SpPr.WriteXmlChildNoFill(_value); begin + if ifnil({self.}XmlChildNoFill) then + begin + {self.}XmlChildNoFill := new OpenXmlEmpty(self, "a", "noFill"); + container_.Set({self.}XmlChildNoFill); + end {self.}XmlChildNoFill.Value := _value; end; + +function SpPr.ReadXmlChildXfrm(); +begin + if tslassigning and ifnil({self.}XmlChildXfrm) then + begin + {self.}XmlChildXfrm := new Xfrm(self, "a", "xfrm"); + container_.Set({self.}XmlChildXfrm); + end + return {self.}XmlChildXfrm; +end; + +function SpPr.ReadXmlChildPrstGeom(); +begin + if tslassigning and ifnil({self.}XmlChildPrstGeom) then + begin + {self.}XmlChildPrstGeom := new PrstGeom(self, "a", "prstGeom"); + container_.Set({self.}XmlChildPrstGeom); + end + return {self.}XmlChildPrstGeom; +end; + +function SpPr.ReadXmlChildSolidFill(); +begin + if tslassigning and ifnil({self.}XmlChildSolidFill) then + begin + {self.}XmlChildSolidFill := new SolidFill(self, "a", "solidFill"); + container_.Set({self.}XmlChildSolidFill); + end + return {self.}XmlChildSolidFill; +end; + +function SpPr.ReadXmlChildLn(); +begin + if tslassigning and ifnil({self.}XmlChildLn) then + begin + {self.}XmlChildLn := new Ln(self, "a", "ln"); + container_.Set({self.}XmlChildLn); + end + return {self.}XmlChildLn; +end; + +function SpPr.ReadXmlChildEffectLst(); +begin + if tslassigning and ifnil({self.}XmlChildEffectLst) then + begin + {self.}XmlChildEffectLst := new EffectLst(self, "a", "effectLst"); + container_.Set({self.}XmlChildEffectLst); + end + return {self.}XmlChildEffectLst; +end; diff --git a/autoclass/docx/Spacing@DOCX.tsf b/autoclass/docx/Spacing@DOCX.tsf index 97646f0..8c607db 100644 --- a/autoclass/docx/Spacing@DOCX.tsf +++ b/autoclass/docx/Spacing@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Spacing);override; +public + + // attributes property property Before read ReadXmlAttrBefore write WriteXmlAttrBefore; property BeforeLines read ReadXmlAttrBeforeLines write WriteXmlAttrBeforeLines; property BeforeAutospacing read ReadXmlAttrBeforeAutospacing write WriteXmlAttrBeforeAutospacing; @@ -35,7 +35,7 @@ public function WriteXmlAttrLineRule(_value); public - // Attributes + // Attributes XmlAttrBefore: OpenXmlAttribute; XmlAttrBeforeLines: OpenXmlAttribute; XmlAttrBeforeAutospacing: OpenXmlAttribute; @@ -45,7 +45,6 @@ public XmlAttrLine: OpenXmlAttribute; XmlAttrLineRule: OpenXmlAttribute; - // Children end; @@ -61,69 +60,51 @@ end; function Spacing.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Spacing.Init();override; begin - {self.}XmlAttrBefore := new OpenXmlAttribute({self.}Prefix, "before", nil); - {self.}XmlAttrBeforeLines := new OpenXmlAttribute({self.}Prefix, "beforeLines", nil); - {self.}XmlAttrBeforeAutospacing := new OpenXmlAttribute({self.}Prefix, "beforeAutospacing", nil); - {self.}XmlAttrAfter := new OpenXmlAttribute({self.}Prefix, "after", nil); - {self.}XmlAttrAfterLines := new OpenXmlAttribute({self.}Prefix, "afterLines", nil); - {self.}XmlAttrAfterAutospacing := new OpenXmlAttribute({self.}Prefix, "afterAutospacing", nil); - {self.}XmlAttrLine := new OpenXmlAttribute({self.}Prefix, "line", nil); - {self.}XmlAttrLineRule := new OpenXmlAttribute({self.}Prefix, "lineRule", nil); -end; - -function Spacing.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrBefore, - {self.}XmlAttrBeforeLines, - {self.}XmlAttrBeforeAutospacing, - {self.}XmlAttrAfter, - {self.}XmlAttrAfterLines, - {self.}XmlAttrAfterAutospacing, - {self.}XmlAttrLine, - {self.}XmlAttrLineRule, - ); -end; - -function Spacing.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "before": makeweakref(thisFunction(WriteXmlAttrBefore)), + pre + "beforeLines": makeweakref(thisFunction(WriteXmlAttrBeforeLines)), + pre + "beforeAutospacing": makeweakref(thisFunction(WriteXmlAttrBeforeAutospacing)), + pre + "after": makeweakref(thisFunction(WriteXmlAttrAfter)), + pre + "afterLines": makeweakref(thisFunction(WriteXmlAttrAfterLines)), + pre + "afterAutospacing": makeweakref(thisFunction(WriteXmlAttrAfterAutospacing)), + pre + "line": makeweakref(thisFunction(WriteXmlAttrLine)), + pre + "lineRule": makeweakref(thisFunction(WriteXmlAttrLineRule)), ); sorted_child_ := array( - "": -1, ); -end; - -function Spacing.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Spacing.Copy(_obj: Spacing);override; begin - if not ifnil(_obj.XmlAttrBefore.Value) then - {self.}XmlAttrBefore.Value := _obj.XmlAttrBefore.Value; - if not ifnil(_obj.XmlAttrBeforeLines.Value) then - {self.}XmlAttrBeforeLines.Value := _obj.XmlAttrBeforeLines.Value; - if not ifnil(_obj.XmlAttrBeforeAutospacing.Value) then - {self.}XmlAttrBeforeAutospacing.Value := _obj.XmlAttrBeforeAutospacing.Value; - if not ifnil(_obj.XmlAttrAfter.Value) then - {self.}XmlAttrAfter.Value := _obj.XmlAttrAfter.Value; - if not ifnil(_obj.XmlAttrAfterLines.Value) then - {self.}XmlAttrAfterLines.Value := _obj.XmlAttrAfterLines.Value; - if not ifnil(_obj.XmlAttrAfterAutospacing.Value) then - {self.}XmlAttrAfterAutospacing.Value := _obj.XmlAttrAfterAutospacing.Value; - if not ifnil(_obj.XmlAttrLine.Value) then - {self.}XmlAttrLine.Value := _obj.XmlAttrLine.Value; - if not ifnil(_obj.XmlAttrLineRule.Value) then - {self.}XmlAttrLineRule.Value := _obj.XmlAttrLineRule.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Before) then + {self.}Before := _obj.Before; + if not ifnil(_obj.BeforeLines) then + {self.}BeforeLines := _obj.BeforeLines; + if not ifnil(_obj.BeforeAutospacing) then + {self.}BeforeAutospacing := _obj.BeforeAutospacing; + if not ifnil(_obj.After) then + {self.}After := _obj.After; + if not ifnil(_obj.AfterLines) then + {self.}AfterLines := _obj.AfterLines; + if not ifnil(_obj.AfterAutospacing) then + {self.}AfterAutospacing := _obj.AfterAutospacing; + if not ifnil(_obj.Line) then + {self.}Line := _obj.Line; + if not ifnil(_obj.LineRule) then + {self.}LineRule := _obj.LineRule; + tslassigning := tslassigning_backup; end; function Spacing.ReadXmlAttrBefore(); @@ -133,6 +114,11 @@ end; function Spacing.WriteXmlAttrBefore(_value); begin + if ifnil({self.}XmlAttrBefore) then + begin + {self.}XmlAttrBefore := new OpenXmlAttribute({self.}Prefix, "before", nil); + attributes_[length(attributes_)] := {self.}XmlAttrBefore; + end {self.}XmlAttrBefore.Value := _value; end; @@ -143,6 +129,11 @@ end; function Spacing.WriteXmlAttrBeforeLines(_value); begin + if ifnil({self.}XmlAttrBeforeLines) then + begin + {self.}XmlAttrBeforeLines := new OpenXmlAttribute({self.}Prefix, "beforeLines", nil); + attributes_[length(attributes_)] := {self.}XmlAttrBeforeLines; + end {self.}XmlAttrBeforeLines.Value := _value; end; @@ -153,6 +144,11 @@ end; function Spacing.WriteXmlAttrBeforeAutospacing(_value); begin + if ifnil({self.}XmlAttrBeforeAutospacing) then + begin + {self.}XmlAttrBeforeAutospacing := new OpenXmlAttribute({self.}Prefix, "beforeAutospacing", nil); + attributes_[length(attributes_)] := {self.}XmlAttrBeforeAutospacing; + end {self.}XmlAttrBeforeAutospacing.Value := _value; end; @@ -163,6 +159,11 @@ end; function Spacing.WriteXmlAttrAfter(_value); begin + if ifnil({self.}XmlAttrAfter) then + begin + {self.}XmlAttrAfter := new OpenXmlAttribute({self.}Prefix, "after", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAfter; + end {self.}XmlAttrAfter.Value := _value; end; @@ -173,6 +174,11 @@ end; function Spacing.WriteXmlAttrAfterLines(_value); begin + if ifnil({self.}XmlAttrAfterLines) then + begin + {self.}XmlAttrAfterLines := new OpenXmlAttribute({self.}Prefix, "afterLines", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAfterLines; + end {self.}XmlAttrAfterLines.Value := _value; end; @@ -183,6 +189,11 @@ end; function Spacing.WriteXmlAttrAfterAutospacing(_value); begin + if ifnil({self.}XmlAttrAfterAutospacing) then + begin + {self.}XmlAttrAfterAutospacing := new OpenXmlAttribute({self.}Prefix, "afterAutospacing", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAfterAutospacing; + end {self.}XmlAttrAfterAutospacing.Value := _value; end; @@ -193,6 +204,11 @@ end; function Spacing.WriteXmlAttrLine(_value); begin + if ifnil({self.}XmlAttrLine) then + begin + {self.}XmlAttrLine := new OpenXmlAttribute({self.}Prefix, "line", nil); + attributes_[length(attributes_)] := {self.}XmlAttrLine; + end {self.}XmlAttrLine.Value := _value; end; @@ -203,5 +219,10 @@ end; function Spacing.WriteXmlAttrLineRule(_value); begin + if ifnil({self.}XmlAttrLineRule) then + begin + {self.}XmlAttrLineRule := new OpenXmlAttribute({self.}Prefix, "lineRule", nil); + attributes_[length(attributes_)] := {self.}XmlAttrLineRule; + end {self.}XmlAttrLineRule.Value := _value; end; diff --git a/autoclass/docx/SrgbClr@DOCX.tsf b/autoclass/docx/SrgbClr@DOCX.tsf index 35c02c2..1b39ea8 100644 --- a/autoclass/docx/SrgbClr@DOCX.tsf +++ b/autoclass/docx/SrgbClr@DOCX.tsf @@ -4,21 +4,25 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: SrgbClr);override; +public + + // attributes property property Val read ReadXmlAttrVal write WriteXmlAttrVal; function ReadXmlAttrVal(); function WriteXmlAttrVal(_value); + // normal property + property Alpha read ReadXmlChildAlpha; + function ReadXmlChildAlpha(); + public - // Attributes + // Attributes XmlAttrVal: OpenXmlAttribute; // Children - Alpha: PureVal; + XmlChildAlpha: PureVal; end; @@ -34,76 +38,33 @@ end; function SrgbClr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function SrgbClr.Init();override; begin - {self.}XmlAttrVal := new OpenXmlAttribute(nil, "val", nil); - {self.}Alpha := new PureVal(self, {self.}Prefix, "aplha"); -end; - -function SrgbClr.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrVal, - ); -end; - -function SrgbClr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Alpha, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "val": makeweakref(thisFunction(WriteXmlAttrVal)), ); sorted_child_ := array( - "": -1, - {self.}Alpha.ElementName: 0, + pre + "aplha": array(0, makeweakref(thisFunction(ReadXmlChildAlpha))), ); -end; - -function SrgbClr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function SrgbClr.Copy(_obj: SrgbClr);override; begin - if not ifnil(_obj.XmlAttrVal.Value) then - {self.}XmlAttrVal.Value := _obj.XmlAttrVal.Value; - {self.}Alpha.Copy(_obj.Alpha); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Val) then + {self.}Val := _obj.Val; + if not ifnil(_obj.XmlChildAlpha) then + {self.}Alpha.Copy(_obj.XmlChildAlpha); + tslassigning := tslassigning_backup; end; function SrgbClr.ReadXmlAttrVal(); @@ -113,5 +74,20 @@ end; function SrgbClr.WriteXmlAttrVal(_value); begin + if ifnil({self.}XmlAttrVal) then + begin + {self.}XmlAttrVal := new OpenXmlAttribute("", "val", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVal; + end {self.}XmlAttrVal.Value := _value; end; + +function SrgbClr.ReadXmlChildAlpha(); +begin + if tslassigning and ifnil({self.}XmlChildAlpha) then + begin + {self.}XmlChildAlpha := new PureVal(self, {self.}Prefix, "aplha"); + container_.Set({self.}XmlChildAlpha); + end + return {self.}XmlChildAlpha; +end; diff --git a/autoclass/docx/StrRef@DOCX.tsf b/autoclass/docx/StrRef@DOCX.tsf index 9e8a5a0..23fdc6d 100644 --- a/autoclass/docx/StrRef@DOCX.tsf +++ b/autoclass/docx/StrRef@DOCX.tsf @@ -4,17 +4,22 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: StrRef);override; public - // Attributes + // pcdata property + property F read ReadXmlChildF; + function ReadXmlChildF(); + + // normal property + property StrCache read ReadXmlChildStrCache; + function ReadXmlChildStrCache(); + +public // Children - F: OpenXmlPcdata; - StrCache: Cache; + XmlChildF: OpenXmlPcdata; + XmlChildStrCache: Cache; end; @@ -30,74 +35,51 @@ end; function StrRef.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function StrRef.Init();override; begin - {self.}F := new OpenXmlPcdata(self, {self.}Prefix, "f"); - {self.}StrCache := new Cache(self, {self.}Prefix, "strCache"); -end; - -function StrRef.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function StrRef.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}F, - 1: {self.}StrCache, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}F.ElementName: 0, - {self.}StrCache.ElementName: 1, + pre + "f": array(0, makeweakref(thisFunction(ReadXmlChildF))), + pre + "strCache": array(1, makeweakref(thisFunction(ReadXmlChildStrCache))), ); -end; - -function StrRef.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function StrRef.Copy(_obj: StrRef);override; begin - {self.}F.Copy(_obj.F); - {self.}StrCache.Copy(_obj.StrCache); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildF) then + {self.}F.Copy(_obj.XmlChildF); + if not ifnil(_obj.XmlChildStrCache) then + {self.}StrCache.Copy(_obj.XmlChildStrCache); + tslassigning := tslassigning_backup; +end; + +function StrRef.ReadXmlChildF(); +begin + if tslassigning and ifnil({self.}XmlChildF) then + begin + {self.}XmlChildF := new OpenXmlPcdata(self, {self.}Prefix, "f"); + container_.Set({self.}XmlChildF); + end + return {self.}XmlChildF; +end; + +function StrRef.ReadXmlChildStrCache(); +begin + if tslassigning and ifnil({self.}XmlChildStrCache) then + begin + {self.}XmlChildStrCache := new Cache(self, {self.}Prefix, "strCache"); + container_.Set({self.}XmlChildStrCache); + end + return {self.}XmlChildStrCache; end; diff --git a/autoclass/docx/Stretch@DOCX.tsf b/autoclass/docx/Stretch@DOCX.tsf index 30541e6..a48603c 100644 --- a/autoclass/docx/Stretch@DOCX.tsf +++ b/autoclass/docx/Stretch@DOCX.tsf @@ -4,16 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Stretch);override; public - // Attributes + // normal property + property FillRect read ReadXmlChildFillRect; + function ReadXmlChildFillRect(); + +public // Children - FillRect: PureVal; + XmlChildFillRect: PureVal; end; @@ -29,70 +30,38 @@ end; function Stretch.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Stretch.Init();override; begin - {self.}FillRect := new PureVal(self, "a", "fillRect"); -end; - -function Stretch.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Stretch.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}FillRect, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}FillRect.ElementName: 0, + "a:fillRect": array(0, makeweakref(thisFunction(ReadXmlChildFillRect))), ); -end; - -function Stretch.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Stretch.Copy(_obj: Stretch);override; begin - {self.}FillRect.Copy(_obj.FillRect); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildFillRect) then + {self.}FillRect.Copy(_obj.XmlChildFillRect); + tslassigning := tslassigning_backup; +end; + +function Stretch.ReadXmlChildFillRect(); +begin + if tslassigning and ifnil({self.}XmlChildFillRect) then + begin + {self.}XmlChildFillRect := new PureVal(self, "a", "fillRect"); + container_.Set({self.}XmlChildFillRect); + end + return {self.}XmlChildFillRect; end; diff --git a/autoclass/docx/Stroke@DOCX.tsf b/autoclass/docx/Stroke@DOCX.tsf index 9b0d57a..414d707 100644 --- a/autoclass/docx/Stroke@DOCX.tsf +++ b/autoclass/docx/Stroke@DOCX.tsf @@ -4,20 +4,19 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Stroke);override; +public + + // attributes property property Joinstyle read ReadXmlAttrJoinstyle write WriteXmlAttrJoinstyle; function ReadXmlAttrJoinstyle(); function WriteXmlAttrJoinstyle(_value); public - // Attributes + // Attributes XmlAttrJoinstyle: OpenXmlAttribute; - // Children end; @@ -33,41 +32,30 @@ end; function Stroke.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Stroke.Init();override; begin - {self.}XmlAttrJoinstyle := new OpenXmlAttribute(nil, "joinstyle", nil); -end; - -function Stroke.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrJoinstyle, - ); -end; - -function Stroke.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "joinstyle": makeweakref(thisFunction(WriteXmlAttrJoinstyle)), ); sorted_child_ := array( - "": -1, ); -end; - -function Stroke.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Stroke.Copy(_obj: Stroke);override; begin - if not ifnil(_obj.XmlAttrJoinstyle.Value) then - {self.}XmlAttrJoinstyle.Value := _obj.XmlAttrJoinstyle.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Joinstyle) then + {self.}Joinstyle := _obj.Joinstyle; + tslassigning := tslassigning_backup; end; function Stroke.ReadXmlAttrJoinstyle(); @@ -77,5 +65,10 @@ end; function Stroke.WriteXmlAttrJoinstyle(_value); begin + if ifnil({self.}XmlAttrJoinstyle) then + begin + {self.}XmlAttrJoinstyle := new OpenXmlAttribute("", "joinstyle", nil); + attributes_[length(attributes_)] := {self.}XmlAttrJoinstyle; + end {self.}XmlAttrJoinstyle.Value := _value; end; diff --git a/autoclass/docx/Style@DOCX.tsf b/autoclass/docx/Style@DOCX.tsf index e490dcc..af82b77 100644 --- a/autoclass/docx/Style@DOCX.tsf +++ b/autoclass/docx/Style@DOCX.tsf @@ -4,16 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Style);override; - function AddTblStylePr(): TblStylePr; - function AppendTblStylePr(): TblStylePr; - property TblStylePrs read ReadTblStylePrs; - function ReadTblStylePrs(_index); +public + // attributes property property Type read ReadXmlAttrType write WriteXmlAttrType; property Default read ReadXmlAttrDefault write WriteXmlAttrDefault; property StyleId read ReadXmlAttrStyleId write WriteXmlAttrStyleId; @@ -24,6 +19,7 @@ public function ReadXmlAttrStyleId(); function WriteXmlAttrStyleId(_value); + // empty property property SemiHidden read ReadXmlChildSemiHidden write WriteXmlChildSemiHidden; property UnhideWhenUsed read ReadXmlChildUnhideWhenUsed write WriteXmlChildUnhideWhenUsed; property QFormat read ReadXmlChildQFormat write WriteXmlChildQFormat; @@ -37,28 +33,58 @@ public function ReadXmlChildRsid(); function WriteXmlChildRsid(_value); + // normal property + property Name read ReadXmlChildName; + property BasedOn read ReadXmlChildBasedOn; + property Next read ReadXmlChildNext; + property AutoRedefine read ReadXmlChildAutoRedefine; + property Link read ReadXmlChildLink; + property UIPriority read ReadXmlChildUIPriority; + property PPr read ReadXmlChildPPr; + property RPr read ReadXmlChildRPr; + property TblPr read ReadXmlChildTblPr; + property TrPr read ReadXmlChildTrPr; + property TcPr read ReadXmlChildTcPr; + function ReadXmlChildName(); + function ReadXmlChildBasedOn(); + function ReadXmlChildNext(); + function ReadXmlChildAutoRedefine(); + function ReadXmlChildLink(); + function ReadXmlChildUIPriority(); + function ReadXmlChildPPr(); + function ReadXmlChildRPr(); + function ReadXmlChildTblPr(); + function ReadXmlChildTrPr(); + function ReadXmlChildTcPr(); + + // multi property + property TblStylePrs read ReadTblStylePrs; + function ReadTblStylePrs(_index); + function AddTblStylePr(): TblStylePr; + function AppendTblStylePr(): TblStylePr; + public - // Attributes + // Attributes XmlAttrType: OpenXmlAttribute; XmlAttrDefault: OpenXmlAttribute; XmlAttrStyleId: OpenXmlAttribute; // Children - Name: PureWVal; - BasedOn: PureWVal; - Next: PureWVal; - AutoRedefine: PureWVal; - Link: PureWVal; - UIPriority: PureWVal; + XmlChildName: PureWVal; + XmlChildBasedOn: PureWVal; + XmlChildNext: PureWVal; + XmlChildAutoRedefine: PureWVal; + XmlChildLink: PureWVal; + XmlChildUIPriority: PureWVal; XmlChildSemiHidden: OpenXmlEmpty; XmlChildUnhideWhenUsed: OpenXmlEmpty; XmlChildQFormat: OpenXmlEmpty; XmlChildRsid: OpenXmlEmpty; - PPr: PPr; - RPr: RPr; - TblPr: TblPr; - TrPr: TrPr; - TcPr: TcPr; + XmlChildPPr: PPr; + XmlChildRPr: RPr; + XmlChildTblPr: TblPr; + XmlChildTrPr: TrPr; + XmlChildTcPr: TcPr; end; @@ -74,177 +100,82 @@ end; function Style.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Style.Init();override; begin - {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); - {self.}XmlAttrDefault := new OpenXmlAttribute({self.}Prefix, "default", nil); - {self.}XmlAttrStyleId := new OpenXmlAttribute({self.}Prefix, "styleId", nil); - {self.}Name := new PureWVal(self, {self.}Prefix, "name"); - {self.}BasedOn := new PureWVal(self, {self.}Prefix, "basedOn"); - {self.}Next := new PureWVal(self, {self.}Prefix, "next"); - {self.}AutoRedefine := new PureWVal(self, {self.}Prefix, "autoRedefine"); - {self.}Link := new PureWVal(self, {self.}Prefix, "link"); - {self.}UIPriority := new PureWVal(self, {self.}Prefix, "uiPriority"); - {self.}XmlChildSemiHidden := new OpenXmlEmpty(self, {self.}Prefix, "semiHidden"); - {self.}XmlChildUnhideWhenUsed := new OpenXmlEmpty(self, {self.}Prefix, "unhideWhenUsed"); - {self.}XmlChildQFormat := new OpenXmlEmpty(self, {self.}Prefix, "qFormat"); - {self.}XmlChildRsid := new PureWVal(self, {self.}Prefix, "rsid"); - {self.}PPr := new PPr(self, {self.}Prefix, "pPr"); - {self.}RPr := new RPr(self, {self.}Prefix, "rPr"); - {self.}TblPr := new TblPr(self, {self.}Prefix, "tblPr"); - {self.}TrPr := new TrPr(self, {self.}Prefix, "trPr"); - {self.}TcPr := new TcPr(self, {self.}Prefix, "tcPr"); -end; - -function Style.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrType, - {self.}XmlAttrDefault, - {self.}XmlAttrStyleId, - ); -end; - -function Style.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Name, - 1: {self.}BasedOn, - 2: {self.}Next, - 3: {self.}AutoRedefine, - 4: {self.}Link, - 5: {self.}UIPriority, - 6: {self.}XmlChildSemiHidden, - 7: {self.}XmlChildUnhideWhenUsed, - 8: {self.}XmlChildQFormat, - 9: {self.}XmlChildRsid, - 10: {self.}PPr, - 11: {self.}RPr, - 12: {self.}TblPr, - 13: {self.}TrPr, - 14: {self.}TcPr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "type": makeweakref(thisFunction(WriteXmlAttrType)), + pre + "default": makeweakref(thisFunction(WriteXmlAttrDefault)), + pre + "styleId": makeweakref(thisFunction(WriteXmlAttrStyleId)), ); sorted_child_ := array( - "": -1, - {self.}Name.ElementName: 0, - {self.}BasedOn.ElementName: 1, - {self.}Next.ElementName: 2, - {self.}AutoRedefine.ElementName: 3, - {self.}Link.ElementName: 4, - {self.}UIPriority.ElementName: 5, - {self.}XmlChildSemiHidden.ElementName: 6, - {self.}XmlChildUnhideWhenUsed.ElementName: 7, - {self.}XmlChildQFormat.ElementName: 8, - {self.}XmlChildRsid.ElementName: 9, - {self.}PPr.ElementName: 10, - {self.}RPr.ElementName: 11, - {self.}TblPr.ElementName: 12, - {self.}TrPr.ElementName: 13, - {self.}TcPr.ElementName: 14, + pre + "name": array(0, makeweakref(thisFunction(ReadXmlChildName))), + pre + "basedOn": array(1, makeweakref(thisFunction(ReadXmlChildBasedOn))), + pre + "next": array(2, makeweakref(thisFunction(ReadXmlChildNext))), + pre + "autoRedefine": array(3, makeweakref(thisFunction(ReadXmlChildAutoRedefine))), + pre + "link": array(4, makeweakref(thisFunction(ReadXmlChildLink))), + pre + "uiPriority": array(5, makeweakref(thisFunction(ReadXmlChildUIPriority))), + pre + "semiHidden": array(6, makeweakref(thisFunction(ReadXmlChildSemiHidden))), + pre + "unhideWhenUsed": array(7, makeweakref(thisFunction(ReadXmlChildUnhideWhenUsed))), + pre + "qFormat": array(8, makeweakref(thisFunction(ReadXmlChildQFormat))), + pre + "rsid": array(9, makeweakref(thisFunction(ReadXmlChildRsid))), + pre + "pPr": array(10, makeweakref(thisFunction(ReadXmlChildPPr))), + pre + "rPr": array(11, makeweakref(thisFunction(ReadXmlChildRPr))), + pre + "tblPr": array(12, makeweakref(thisFunction(ReadXmlChildTblPr))), + pre + "trPr": array(13, makeweakref(thisFunction(ReadXmlChildTrPr))), + pre + "tcPr": array(14, makeweakref(thisFunction(ReadXmlChildTcPr))), + pre + "tblStylePr": array(15, makeweakref(thisFunction(AppendTblStylePr))), ); -end; - -function Style.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "tblStylePr": obj := {self.}AppendTblStylePr(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Style.Copy(_obj: Style);override; begin - if not ifnil(_obj.XmlAttrType.Value) then - {self.}XmlAttrType.Value := _obj.XmlAttrType.Value; - if not ifnil(_obj.XmlAttrDefault.Value) then - {self.}XmlAttrDefault.Value := _obj.XmlAttrDefault.Value; - if not ifnil(_obj.XmlAttrStyleId.Value) then - {self.}XmlAttrStyleId.Value := _obj.XmlAttrStyleId.Value; - {self.}Name.Copy(_obj.Name); - {self.}BasedOn.Copy(_obj.BasedOn); - {self.}Next.Copy(_obj.Next); - {self.}AutoRedefine.Copy(_obj.AutoRedefine); - {self.}Link.Copy(_obj.Link); - {self.}UIPriority.Copy(_obj.UIPriority); - {self.}XmlChildSemiHidden.Copy(_obj.XmlChildSemiHidden); - {self.}XmlChildUnhideWhenUsed.Copy(_obj.XmlChildUnhideWhenUsed); - {self.}XmlChildQFormat.Copy(_obj.XmlChildQFormat); - {self.}XmlChildRsid.Copy(_obj.XmlChildRsid); - {self.}PPr.Copy(_obj.PPr); - {self.}RPr.Copy(_obj.RPr); - {self.}TblPr.Copy(_obj.TblPr); - {self.}TrPr.Copy(_obj.TrPr); - {self.}TcPr.Copy(_obj.TcPr); -end; - -function Style.AddTblStylePr(): TblStylePr; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "tblStylePr" then break; - end - obj := new TblStylePr(self, {self.}Prefix, "tblStylePr"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function Style.AppendTblStylePr(): TblStylePr; -begin - obj := new TblStylePr(self, {self.}Prefix, "tblStylePr"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function Style.ReadTblStylePrs(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "tblStylePr" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Type) then + {self.}Type := _obj.Type; + if not ifnil(_obj.Default) then + {self.}Default := _obj.Default; + if not ifnil(_obj.StyleId) then + {self.}StyleId := _obj.StyleId; + if not ifnil(_obj.XmlChildName) then + {self.}Name.Copy(_obj.XmlChildName); + if not ifnil(_obj.XmlChildBasedOn) then + {self.}BasedOn.Copy(_obj.XmlChildBasedOn); + if not ifnil(_obj.XmlChildNext) then + {self.}Next.Copy(_obj.XmlChildNext); + if not ifnil(_obj.XmlChildAutoRedefine) then + {self.}AutoRedefine.Copy(_obj.XmlChildAutoRedefine); + if not ifnil(_obj.XmlChildLink) then + {self.}Link.Copy(_obj.XmlChildLink); + if not ifnil(_obj.XmlChildUIPriority) then + {self.}UIPriority.Copy(_obj.XmlChildUIPriority); + if not ifnil(_obj.XmlChildSemiHidden) then + ifnil({self.}XmlChildSemiHidden) ? {self.}SemiHidden.Copy(_obj.XmlChildSemiHidden) : {self.}XmlChildSemiHidden.Copy(_obj.XmlChildSemiHidden); + if not ifnil(_obj.XmlChildUnhideWhenUsed) then + ifnil({self.}XmlChildUnhideWhenUsed) ? {self.}UnhideWhenUsed.Copy(_obj.XmlChildUnhideWhenUsed) : {self.}XmlChildUnhideWhenUsed.Copy(_obj.XmlChildUnhideWhenUsed); + if not ifnil(_obj.XmlChildQFormat) then + ifnil({self.}XmlChildQFormat) ? {self.}QFormat.Copy(_obj.XmlChildQFormat) : {self.}XmlChildQFormat.Copy(_obj.XmlChildQFormat); + if not ifnil(_obj.XmlChildRsid) then + ifnil({self.}XmlChildRsid) ? {self.}Rsid.Copy(_obj.XmlChildRsid) : {self.}XmlChildRsid.Copy(_obj.XmlChildRsid); + if not ifnil(_obj.XmlChildPPr) then + {self.}PPr.Copy(_obj.XmlChildPPr); + if not ifnil(_obj.XmlChildRPr) then + {self.}RPr.Copy(_obj.XmlChildRPr); + if not ifnil(_obj.XmlChildTblPr) then + {self.}TblPr.Copy(_obj.XmlChildTblPr); + if not ifnil(_obj.XmlChildTrPr) then + {self.}TrPr.Copy(_obj.XmlChildTrPr); + if not ifnil(_obj.XmlChildTcPr) then + {self.}TcPr.Copy(_obj.XmlChildTcPr); + tslassigning := tslassigning_backup; end; function Style.ReadXmlAttrType(); @@ -254,6 +185,11 @@ end; function Style.WriteXmlAttrType(_value); begin + if ifnil({self.}XmlAttrType) then + begin + {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); + attributes_[length(attributes_)] := {self.}XmlAttrType; + end {self.}XmlAttrType.Value := _value; end; @@ -264,6 +200,11 @@ end; function Style.WriteXmlAttrDefault(_value); begin + if ifnil({self.}XmlAttrDefault) then + begin + {self.}XmlAttrDefault := new OpenXmlAttribute({self.}Prefix, "default", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDefault; + end {self.}XmlAttrDefault.Value := _value; end; @@ -274,45 +215,225 @@ end; function Style.WriteXmlAttrStyleId(_value); begin + if ifnil({self.}XmlAttrStyleId) then + begin + {self.}XmlAttrStyleId := new OpenXmlAttribute({self.}Prefix, "styleId", nil); + attributes_[length(attributes_)] := {self.}XmlAttrStyleId; + end {self.}XmlAttrStyleId.Value := _value; end; function Style.ReadXmlChildSemiHidden(); begin - return ifnil({self.}XmlChildSemiHidden.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildSemiHidden) then + begin + {self.}XmlChildSemiHidden := new OpenXmlEmpty(self, {self.}Prefix, "semiHidden"); + container_.Set({self.}XmlChildSemiHidden); + return {self.}XmlChildSemiHidden; + end + return {self.}XmlChildSemiHidden.BoolValue(); end; function Style.WriteXmlChildSemiHidden(_value); begin + if ifnil({self.}XmlChildSemiHidden) then + begin + {self.}XmlChildSemiHidden := new OpenXmlEmpty(self, {self.}Prefix, "semiHidden"); + container_.Set({self.}XmlChildSemiHidden); + end {self.}XmlChildSemiHidden.Value := _value; end; function Style.ReadXmlChildUnhideWhenUsed(); begin - return ifnil({self.}XmlChildUnhideWhenUsed.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildUnhideWhenUsed) then + begin + {self.}XmlChildUnhideWhenUsed := new OpenXmlEmpty(self, {self.}Prefix, "unhideWhenUsed"); + container_.Set({self.}XmlChildUnhideWhenUsed); + return {self.}XmlChildUnhideWhenUsed; + end + return {self.}XmlChildUnhideWhenUsed.BoolValue(); end; function Style.WriteXmlChildUnhideWhenUsed(_value); begin + if ifnil({self.}XmlChildUnhideWhenUsed) then + begin + {self.}XmlChildUnhideWhenUsed := new OpenXmlEmpty(self, {self.}Prefix, "unhideWhenUsed"); + container_.Set({self.}XmlChildUnhideWhenUsed); + end {self.}XmlChildUnhideWhenUsed.Value := _value; end; function Style.ReadXmlChildQFormat(); begin - return ifnil({self.}XmlChildQFormat.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildQFormat) then + begin + {self.}XmlChildQFormat := new OpenXmlEmpty(self, {self.}Prefix, "qFormat"); + container_.Set({self.}XmlChildQFormat); + return {self.}XmlChildQFormat; + end + return {self.}XmlChildQFormat.BoolValue(); end; function Style.WriteXmlChildQFormat(_value); begin + if ifnil({self.}XmlChildQFormat) then + begin + {self.}XmlChildQFormat := new OpenXmlEmpty(self, {self.}Prefix, "qFormat"); + container_.Set({self.}XmlChildQFormat); + end {self.}XmlChildQFormat.Value := _value; end; function Style.ReadXmlChildRsid(); begin - return ifnil({self.}XmlChildRsid.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildRsid) then + begin + {self.}XmlChildRsid := new OpenXmlEmpty(self, {self.}Prefix, "rsid"); + container_.Set({self.}XmlChildRsid); + return {self.}XmlChildRsid; + end + return {self.}XmlChildRsid.BoolValue(); end; function Style.WriteXmlChildRsid(_value); begin + if ifnil({self.}XmlChildRsid) then + begin + {self.}XmlChildRsid := new OpenXmlEmpty(self, {self.}Prefix, "rsid"); + container_.Set({self.}XmlChildRsid); + end {self.}XmlChildRsid.Value := _value; end; + +function Style.ReadXmlChildName(); +begin + if tslassigning and ifnil({self.}XmlChildName) then + begin + {self.}XmlChildName := new PureWVal(self, {self.}Prefix, "name"); + container_.Set({self.}XmlChildName); + end + return {self.}XmlChildName; +end; + +function Style.ReadXmlChildBasedOn(); +begin + if tslassigning and ifnil({self.}XmlChildBasedOn) then + begin + {self.}XmlChildBasedOn := new PureWVal(self, {self.}Prefix, "basedOn"); + container_.Set({self.}XmlChildBasedOn); + end + return {self.}XmlChildBasedOn; +end; + +function Style.ReadXmlChildNext(); +begin + if tslassigning and ifnil({self.}XmlChildNext) then + begin + {self.}XmlChildNext := new PureWVal(self, {self.}Prefix, "next"); + container_.Set({self.}XmlChildNext); + end + return {self.}XmlChildNext; +end; + +function Style.ReadXmlChildAutoRedefine(); +begin + if tslassigning and ifnil({self.}XmlChildAutoRedefine) then + begin + {self.}XmlChildAutoRedefine := new PureWVal(self, {self.}Prefix, "autoRedefine"); + container_.Set({self.}XmlChildAutoRedefine); + end + return {self.}XmlChildAutoRedefine; +end; + +function Style.ReadXmlChildLink(); +begin + if tslassigning and ifnil({self.}XmlChildLink) then + begin + {self.}XmlChildLink := new PureWVal(self, {self.}Prefix, "link"); + container_.Set({self.}XmlChildLink); + end + return {self.}XmlChildLink; +end; + +function Style.ReadXmlChildUIPriority(); +begin + if tslassigning and ifnil({self.}XmlChildUIPriority) then + begin + {self.}XmlChildUIPriority := new PureWVal(self, {self.}Prefix, "uiPriority"); + container_.Set({self.}XmlChildUIPriority); + end + return {self.}XmlChildUIPriority; +end; + +function Style.ReadXmlChildPPr(); +begin + if tslassigning and ifnil({self.}XmlChildPPr) then + begin + {self.}XmlChildPPr := new PPr(self, {self.}Prefix, "pPr"); + container_.Set({self.}XmlChildPPr); + end + return {self.}XmlChildPPr; +end; + +function Style.ReadXmlChildRPr(); +begin + if tslassigning and ifnil({self.}XmlChildRPr) then + begin + {self.}XmlChildRPr := new RPr(self, {self.}Prefix, "rPr"); + container_.Set({self.}XmlChildRPr); + end + return {self.}XmlChildRPr; +end; + +function Style.ReadXmlChildTblPr(); +begin + if tslassigning and ifnil({self.}XmlChildTblPr) then + begin + {self.}XmlChildTblPr := new TblPr(self, {self.}Prefix, "tblPr"); + container_.Set({self.}XmlChildTblPr); + end + return {self.}XmlChildTblPr; +end; + +function Style.ReadXmlChildTrPr(); +begin + if tslassigning and ifnil({self.}XmlChildTrPr) then + begin + {self.}XmlChildTrPr := new TrPr(self, {self.}Prefix, "trPr"); + container_.Set({self.}XmlChildTrPr); + end + return {self.}XmlChildTrPr; +end; + +function Style.ReadXmlChildTcPr(); +begin + if tslassigning and ifnil({self.}XmlChildTcPr) then + begin + {self.}XmlChildTcPr := new TcPr(self, {self.}Prefix, "tcPr"); + container_.Set({self.}XmlChildTcPr); + end + return {self.}XmlChildTcPr; +end; + +function Style.ReadTblStylePrs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "tblStylePr", ind); +end; + +function Style.AddTblStylePr(): TblStylePr; +begin + obj := new TblStylePr(self, {self.}Prefix, "tblStylePr"); + container_.Insert(obj); + return obj; +end; + +function Style.AppendTblStylePr(): TblStylePr; +begin + obj := new TblStylePr(self, {self.}Prefix, "tblStylePr"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/Styles@DOCX.tsf b/autoclass/docx/Styles@DOCX.tsf index 1d24807..ca004df 100644 --- a/autoclass/docx/Styles@DOCX.tsf +++ b/autoclass/docx/Styles@DOCX.tsf @@ -4,16 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Styles);override; - function AddStyle(): Style; - function AppendStyle(): Style; - property Styles read ReadStyles; - function ReadStyles(_index); +public + // attributes property property XmlnsMc read ReadXmlAttrXmlnsMc write WriteXmlAttrXmlnsMc; property XmlnsR read ReadXmlAttrXmlnsR write WriteXmlAttrXmlnsR; property XmlnsW read ReadXmlAttrXmlnsW write WriteXmlAttrXmlnsW; @@ -51,8 +46,20 @@ public function ReadXmlAttrMcIgnorable(); function WriteXmlAttrMcIgnorable(_value); + // normal property + property DocDefaults read ReadXmlChildDocDefaults; + property LatenStyles read ReadXmlChildLatenStyles; + function ReadXmlChildDocDefaults(); + function ReadXmlChildLatenStyles(); + + // multi property + property Styles read ReadStyles; + function ReadStyles(_index); + function AddStyle(): Style; + function AppendStyle(): Style; + public - // Attributes + // Attributes XmlAttrXmlnsMc: OpenXmlAttribute; XmlAttrXmlnsR: OpenXmlAttribute; XmlAttrXmlnsW: OpenXmlAttribute; @@ -67,8 +74,8 @@ public XmlAttrMcIgnorable: OpenXmlAttribute; // Children - DocDefaults: DocDefaults; - LatenStyles: LatenStyles; + XmlChildDocDefaults: DocDefaults; + XmlChildLatenStyles: LatenStyles; end; @@ -84,161 +91,70 @@ end; function Styles.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Styles.Init();override; begin - {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); - {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); - {self.}XmlAttrXmlnsW := new OpenXmlAttribute("xmlns", "w", nil); - {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); - {self.}XmlAttrXmlnsW15 := new OpenXmlAttribute("xmlns", "w15", nil); - {self.}XmlAttrXmlnsW16Cex := new OpenXmlAttribute("xmlns", "w16cex", nil); - {self.}XmlAttrXmlnsW16Cid := new OpenXmlAttribute("xmlns", "w16cid", nil); - {self.}XmlAttrXmlnsW16 := new OpenXmlAttribute("xmlns", "w16", nil); - {self.}XmlAttrXmlnsW16Du := new OpenXmlAttribute("xmlns", "w16du", nil); - {self.}XmlAttrXmlnsW16sdtdh := new OpenXmlAttribute("xmlns", "w16sdtdh", nil); - {self.}XmlAttrXmlnsW16se := new OpenXmlAttribute("xmlns", "w16se", nil); - {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); - {self.}DocDefaults := new DocDefaults(self, {self.}Prefix, "docDefaults"); - {self.}LatenStyles := new LatenStyles(self, {self.}Prefix, "latenStyles"); -end; - -function Styles.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXmlnsMc, - {self.}XmlAttrXmlnsR, - {self.}XmlAttrXmlnsW, - {self.}XmlAttrXmlnsW14, - {self.}XmlAttrXmlnsW15, - {self.}XmlAttrXmlnsW16Cex, - {self.}XmlAttrXmlnsW16Cid, - {self.}XmlAttrXmlnsW16, - {self.}XmlAttrXmlnsW16Du, - {self.}XmlAttrXmlnsW16sdtdh, - {self.}XmlAttrXmlnsW16se, - {self.}XmlAttrMcIgnorable, - ); -end; - -function Styles.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}DocDefaults, - 1: {self.}LatenStyles, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns:mc": makeweakref(thisFunction(WriteXmlAttrXmlnsMc)), + "xmlns:r": makeweakref(thisFunction(WriteXmlAttrXmlnsR)), + "xmlns:w": makeweakref(thisFunction(WriteXmlAttrXmlnsW)), + "xmlns:w14": makeweakref(thisFunction(WriteXmlAttrXmlnsW14)), + "xmlns:w15": makeweakref(thisFunction(WriteXmlAttrXmlnsW15)), + "xmlns:w16cex": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Cex)), + "xmlns:w16cid": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Cid)), + "xmlns:w16": makeweakref(thisFunction(WriteXmlAttrXmlnsW16)), + "xmlns:w16du": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Du)), + "xmlns:w16sdtdh": makeweakref(thisFunction(WriteXmlAttrXmlnsW16sdtdh)), + "xmlns:w16se": makeweakref(thisFunction(WriteXmlAttrXmlnsW16se)), + "mc:Ignorable": makeweakref(thisFunction(WriteXmlAttrMcIgnorable)), ); sorted_child_ := array( - "": -1, - {self.}DocDefaults.ElementName: 0, - {self.}LatenStyles.ElementName: 1, + pre + "docDefaults": array(0, makeweakref(thisFunction(ReadXmlChildDocDefaults))), + pre + "latenStyles": array(1, makeweakref(thisFunction(ReadXmlChildLatenStyles))), + pre + "style": array(2, makeweakref(thisFunction(AppendStyle))), ); -end; - -function Styles.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "style": obj := {self.}AppendStyle(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Styles.Copy(_obj: Styles);override; begin - if not ifnil(_obj.XmlAttrXmlnsMc.Value) then - {self.}XmlAttrXmlnsMc.Value := _obj.XmlAttrXmlnsMc.Value; - if not ifnil(_obj.XmlAttrXmlnsR.Value) then - {self.}XmlAttrXmlnsR.Value := _obj.XmlAttrXmlnsR.Value; - if not ifnil(_obj.XmlAttrXmlnsW.Value) then - {self.}XmlAttrXmlnsW.Value := _obj.XmlAttrXmlnsW.Value; - if not ifnil(_obj.XmlAttrXmlnsW14.Value) then - {self.}XmlAttrXmlnsW14.Value := _obj.XmlAttrXmlnsW14.Value; - if not ifnil(_obj.XmlAttrXmlnsW15.Value) then - {self.}XmlAttrXmlnsW15.Value := _obj.XmlAttrXmlnsW15.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Cex.Value) then - {self.}XmlAttrXmlnsW16Cex.Value := _obj.XmlAttrXmlnsW16Cex.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Cid.Value) then - {self.}XmlAttrXmlnsW16Cid.Value := _obj.XmlAttrXmlnsW16Cid.Value; - if not ifnil(_obj.XmlAttrXmlnsW16.Value) then - {self.}XmlAttrXmlnsW16.Value := _obj.XmlAttrXmlnsW16.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Du.Value) then - {self.}XmlAttrXmlnsW16Du.Value := _obj.XmlAttrXmlnsW16Du.Value; - if not ifnil(_obj.XmlAttrXmlnsW16sdtdh.Value) then - {self.}XmlAttrXmlnsW16sdtdh.Value := _obj.XmlAttrXmlnsW16sdtdh.Value; - if not ifnil(_obj.XmlAttrXmlnsW16se.Value) then - {self.}XmlAttrXmlnsW16se.Value := _obj.XmlAttrXmlnsW16se.Value; - if not ifnil(_obj.XmlAttrMcIgnorable.Value) then - {self.}XmlAttrMcIgnorable.Value := _obj.XmlAttrMcIgnorable.Value; - {self.}DocDefaults.Copy(_obj.DocDefaults); - {self.}LatenStyles.Copy(_obj.LatenStyles); -end; - -function Styles.AddStyle(): Style; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "style" then break; - end - obj := new Style(self, {self.}Prefix, "style"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function Styles.AppendStyle(): Style; -begin - obj := new Style(self, {self.}Prefix, "style"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function Styles.ReadStyles(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "style" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlnsMc) then + {self.}XmlnsMc := _obj.XmlnsMc; + if not ifnil(_obj.XmlnsR) then + {self.}XmlnsR := _obj.XmlnsR; + if not ifnil(_obj.XmlnsW) then + {self.}XmlnsW := _obj.XmlnsW; + if not ifnil(_obj.XmlnsW14) then + {self.}XmlnsW14 := _obj.XmlnsW14; + if not ifnil(_obj.XmlnsW15) then + {self.}XmlnsW15 := _obj.XmlnsW15; + if not ifnil(_obj.XmlnsW16Cex) then + {self.}XmlnsW16Cex := _obj.XmlnsW16Cex; + if not ifnil(_obj.XmlnsW16Cid) then + {self.}XmlnsW16Cid := _obj.XmlnsW16Cid; + if not ifnil(_obj.XmlnsW16) then + {self.}XmlnsW16 := _obj.XmlnsW16; + if not ifnil(_obj.XmlnsW16Du) then + {self.}XmlnsW16Du := _obj.XmlnsW16Du; + if not ifnil(_obj.XmlnsW16sdtdh) then + {self.}XmlnsW16sdtdh := _obj.XmlnsW16sdtdh; + if not ifnil(_obj.XmlnsW16se) then + {self.}XmlnsW16se := _obj.XmlnsW16se; + if not ifnil(_obj.McIgnorable) then + {self.}McIgnorable := _obj.McIgnorable; + if not ifnil(_obj.XmlChildDocDefaults) then + {self.}DocDefaults.Copy(_obj.XmlChildDocDefaults); + if not ifnil(_obj.XmlChildLatenStyles) then + {self.}LatenStyles.Copy(_obj.XmlChildLatenStyles); + tslassigning := tslassigning_backup; end; function Styles.ReadXmlAttrXmlnsMc(); @@ -248,6 +164,11 @@ end; function Styles.WriteXmlAttrXmlnsMc(_value); begin + if ifnil({self.}XmlAttrXmlnsMc) then + begin + {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsMc; + end {self.}XmlAttrXmlnsMc.Value := _value; end; @@ -258,6 +179,11 @@ end; function Styles.WriteXmlAttrXmlnsR(_value); begin + if ifnil({self.}XmlAttrXmlnsR) then + begin + {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsR; + end {self.}XmlAttrXmlnsR.Value := _value; end; @@ -268,6 +194,11 @@ end; function Styles.WriteXmlAttrXmlnsW(_value); begin + if ifnil({self.}XmlAttrXmlnsW) then + begin + {self.}XmlAttrXmlnsW := new OpenXmlAttribute("xmlns", "w", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW; + end {self.}XmlAttrXmlnsW.Value := _value; end; @@ -278,6 +209,11 @@ end; function Styles.WriteXmlAttrXmlnsW14(_value); begin + if ifnil({self.}XmlAttrXmlnsW14) then + begin + {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW14; + end {self.}XmlAttrXmlnsW14.Value := _value; end; @@ -288,6 +224,11 @@ end; function Styles.WriteXmlAttrXmlnsW15(_value); begin + if ifnil({self.}XmlAttrXmlnsW15) then + begin + {self.}XmlAttrXmlnsW15 := new OpenXmlAttribute("xmlns", "w15", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW15; + end {self.}XmlAttrXmlnsW15.Value := _value; end; @@ -298,6 +239,11 @@ end; function Styles.WriteXmlAttrXmlnsW16Cex(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Cex) then + begin + {self.}XmlAttrXmlnsW16Cex := new OpenXmlAttribute("xmlns", "w16cex", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Cex; + end {self.}XmlAttrXmlnsW16Cex.Value := _value; end; @@ -308,6 +254,11 @@ end; function Styles.WriteXmlAttrXmlnsW16Cid(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Cid) then + begin + {self.}XmlAttrXmlnsW16Cid := new OpenXmlAttribute("xmlns", "w16cid", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Cid; + end {self.}XmlAttrXmlnsW16Cid.Value := _value; end; @@ -318,6 +269,11 @@ end; function Styles.WriteXmlAttrXmlnsW16(_value); begin + if ifnil({self.}XmlAttrXmlnsW16) then + begin + {self.}XmlAttrXmlnsW16 := new OpenXmlAttribute("xmlns", "w16", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16; + end {self.}XmlAttrXmlnsW16.Value := _value; end; @@ -328,6 +284,11 @@ end; function Styles.WriteXmlAttrXmlnsW16Du(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Du) then + begin + {self.}XmlAttrXmlnsW16Du := new OpenXmlAttribute("xmlns", "w16du", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Du; + end {self.}XmlAttrXmlnsW16Du.Value := _value; end; @@ -338,6 +299,11 @@ end; function Styles.WriteXmlAttrXmlnsW16sdtdh(_value); begin + if ifnil({self.}XmlAttrXmlnsW16sdtdh) then + begin + {self.}XmlAttrXmlnsW16sdtdh := new OpenXmlAttribute("xmlns", "w16sdtdh", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16sdtdh; + end {self.}XmlAttrXmlnsW16sdtdh.Value := _value; end; @@ -348,6 +314,11 @@ end; function Styles.WriteXmlAttrXmlnsW16se(_value); begin + if ifnil({self.}XmlAttrXmlnsW16se) then + begin + {self.}XmlAttrXmlnsW16se := new OpenXmlAttribute("xmlns", "w16se", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16se; + end {self.}XmlAttrXmlnsW16se.Value := _value; end; @@ -358,5 +329,51 @@ end; function Styles.WriteXmlAttrMcIgnorable(_value); begin + if ifnil({self.}XmlAttrMcIgnorable) then + begin + {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); + attributes_[length(attributes_)] := {self.}XmlAttrMcIgnorable; + end {self.}XmlAttrMcIgnorable.Value := _value; end; + +function Styles.ReadXmlChildDocDefaults(); +begin + if tslassigning and ifnil({self.}XmlChildDocDefaults) then + begin + {self.}XmlChildDocDefaults := new DocDefaults(self, {self.}Prefix, "docDefaults"); + container_.Set({self.}XmlChildDocDefaults); + end + return {self.}XmlChildDocDefaults; +end; + +function Styles.ReadXmlChildLatenStyles(); +begin + if tslassigning and ifnil({self.}XmlChildLatenStyles) then + begin + {self.}XmlChildLatenStyles := new LatenStyles(self, {self.}Prefix, "latenStyles"); + container_.Set({self.}XmlChildLatenStyles); + end + return {self.}XmlChildLatenStyles; +end; + +function Styles.ReadStyles(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "style", ind); +end; + +function Styles.AddStyle(): Style; +begin + obj := new Style(self, {self.}Prefix, "style"); + container_.Insert(obj); + return obj; +end; + +function Styles.AppendStyle(): Style; +begin + obj := new Style(self, {self.}Prefix, "style"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/SysClr@DOCX.tsf b/autoclass/docx/SysClr@DOCX.tsf index 8383d2e..bdf1140 100644 --- a/autoclass/docx/SysClr@DOCX.tsf +++ b/autoclass/docx/SysClr@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: SysClr);override; +public + + // attributes property property Val read ReadXmlAttrVal write WriteXmlAttrVal; property LastClr read ReadXmlAttrLastClr write WriteXmlAttrLastClr; function ReadXmlAttrVal(); @@ -17,11 +17,10 @@ public function WriteXmlAttrLastClr(_value); public - // Attributes + // Attributes XmlAttrVal: OpenXmlAttribute; XmlAttrLastClr: OpenXmlAttribute; - // Children end; @@ -37,45 +36,33 @@ end; function SysClr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function SysClr.Init();override; begin - {self.}XmlAttrVal := new OpenXmlAttribute(nil, "val", nil); - {self.}XmlAttrLastClr := new OpenXmlAttribute(nil, "LastClr", nil); -end; - -function SysClr.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrVal, - {self.}XmlAttrLastClr, - ); -end; - -function SysClr.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "val": makeweakref(thisFunction(WriteXmlAttrVal)), + "LastClr": makeweakref(thisFunction(WriteXmlAttrLastClr)), ); sorted_child_ := array( - "": -1, ); -end; - -function SysClr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function SysClr.Copy(_obj: SysClr);override; begin - if not ifnil(_obj.XmlAttrVal.Value) then - {self.}XmlAttrVal.Value := _obj.XmlAttrVal.Value; - if not ifnil(_obj.XmlAttrLastClr.Value) then - {self.}XmlAttrLastClr.Value := _obj.XmlAttrLastClr.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Val) then + {self.}Val := _obj.Val; + if not ifnil(_obj.LastClr) then + {self.}LastClr := _obj.LastClr; + tslassigning := tslassigning_backup; end; function SysClr.ReadXmlAttrVal(); @@ -85,6 +72,11 @@ end; function SysClr.WriteXmlAttrVal(_value); begin + if ifnil({self.}XmlAttrVal) then + begin + {self.}XmlAttrVal := new OpenXmlAttribute("", "val", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVal; + end {self.}XmlAttrVal.Value := _value; end; @@ -95,5 +87,10 @@ end; function SysClr.WriteXmlAttrLastClr(_value); begin + if ifnil({self.}XmlAttrLastClr) then + begin + {self.}XmlAttrLastClr := new OpenXmlAttribute("", "LastClr", nil); + attributes_[length(attributes_)] := {self.}XmlAttrLastClr; + end {self.}XmlAttrLastClr.Value := _value; end; diff --git a/autoclass/docx/Sz@DOCX.tsf b/autoclass/docx/Sz@DOCX.tsf index 4d9f81d..3d3f6fd 100644 --- a/autoclass/docx/Sz@DOCX.tsf +++ b/autoclass/docx/Sz@DOCX.tsf @@ -4,20 +4,19 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Sz);override; +public + + // attributes property property Val read ReadXmlAttrVal write WriteXmlAttrVal; function ReadXmlAttrVal(); function WriteXmlAttrVal(_value); public - // Attributes + // Attributes XmlAttrVal: OpenXmlAttribute; - // Children end; @@ -33,41 +32,30 @@ end; function Sz.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Sz.Init();override; begin - {self.}XmlAttrVal := new OpenXmlAttribute("w", "val", nil); -end; - -function Sz.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrVal, - ); -end; - -function Sz.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "w:val": makeweakref(thisFunction(WriteXmlAttrVal)), ); sorted_child_ := array( - "": -1, ); -end; - -function Sz.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Sz.Copy(_obj: Sz);override; begin - if not ifnil(_obj.XmlAttrVal.Value) then - {self.}XmlAttrVal.Value := _obj.XmlAttrVal.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Val) then + {self.}Val := _obj.Val; + tslassigning := tslassigning_backup; end; function Sz.ReadXmlAttrVal(); @@ -77,5 +65,10 @@ end; function Sz.WriteXmlAttrVal(_value); begin + if ifnil({self.}XmlAttrVal) then + begin + {self.}XmlAttrVal := new OpenXmlAttribute("w", "val", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVal; + end {self.}XmlAttrVal.Value := _value; end; diff --git a/autoclass/docx/SzCs@DOCX.tsf b/autoclass/docx/SzCs@DOCX.tsf index ed147d6..d5b2cef 100644 --- a/autoclass/docx/SzCs@DOCX.tsf +++ b/autoclass/docx/SzCs@DOCX.tsf @@ -4,20 +4,19 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: SzCs);override; +public + + // attributes property property Val read ReadXmlAttrVal write WriteXmlAttrVal; function ReadXmlAttrVal(); function WriteXmlAttrVal(_value); public - // Attributes + // Attributes XmlAttrVal: OpenXmlAttribute; - // Children end; @@ -33,41 +32,30 @@ end; function SzCs.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function SzCs.Init();override; begin - {self.}XmlAttrVal := new OpenXmlAttribute("w", "val", nil); -end; - -function SzCs.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrVal, - ); -end; - -function SzCs.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "w:val": makeweakref(thisFunction(WriteXmlAttrVal)), ); sorted_child_ := array( - "": -1, ); -end; - -function SzCs.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function SzCs.Copy(_obj: SzCs);override; begin - if not ifnil(_obj.XmlAttrVal.Value) then - {self.}XmlAttrVal.Value := _obj.XmlAttrVal.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Val) then + {self.}Val := _obj.Val; + tslassigning := tslassigning_backup; end; function SzCs.ReadXmlAttrVal(); @@ -77,5 +65,10 @@ end; function SzCs.WriteXmlAttrVal(_value); begin + if ifnil({self.}XmlAttrVal) then + begin + {self.}XmlAttrVal := new OpenXmlAttribute("w", "val", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVal; + end {self.}XmlAttrVal.Value := _value; end; diff --git a/autoclass/docx/T@DOCX.tsf b/autoclass/docx/T@DOCX.tsf index 6fc9a5c..009dccd 100644 --- a/autoclass/docx/T@DOCX.tsf +++ b/autoclass/docx/T@DOCX.tsf @@ -4,19 +4,19 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: T);override; +public + + // attributes property property Space read ReadXmlAttrSpace write WriteXmlAttrSpace; function ReadXmlAttrSpace(); function WriteXmlAttrSpace(_value); public - // Attributes + // Attributes XmlAttrSpace: OpenXmlAttribute; - // Children end; @@ -32,32 +32,27 @@ end; function T.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlPcdata).Create(_parent, _prefix, _local_name); end; function T.Init();override; begin - {self.}XmlAttrSpace := new OpenXmlAttribute("xml", "space", nil); -end; - -function T.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrSpace, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xml:space": makeweakref(thisFunction(WriteXmlAttrSpace)), ); end; -function T.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; -end; - function T.Copy(_obj: T);override; begin - if not ifnil(_obj.XmlAttrSpace.Value) then - {self.}XmlAttrSpace.Value := _obj.XmlAttrSpace.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlPcdata).Copy(_obj); + if not ifnil(_obj.Space) then + {self.}Space := _obj.Space; + tslassigning := tslassigning_backup; end; function T.ReadXmlAttrSpace(); @@ -67,5 +62,10 @@ end; function T.WriteXmlAttrSpace(_value); begin + if ifnil({self.}XmlAttrSpace) then + begin + {self.}XmlAttrSpace := new OpenXmlAttribute("xml", "space", nil); + attributes_[length(attributes_)] := {self.}XmlAttrSpace; + end {self.}XmlAttrSpace.Value := _value; end; diff --git a/autoclass/docx/Tab@DOCX.tsf b/autoclass/docx/Tab@DOCX.tsf index 42f188c..01fd815 100644 --- a/autoclass/docx/Tab@DOCX.tsf +++ b/autoclass/docx/Tab@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Tab);override; +public + + // attributes property property Val read ReadXmlAttrVal write WriteXmlAttrVal; property Leader read ReadXmlAttrLeader write WriteXmlAttrLeader; property Pos read ReadXmlAttrPos write WriteXmlAttrPos; @@ -20,12 +20,11 @@ public function WriteXmlAttrPos(_value); public - // Attributes + // Attributes XmlAttrVal: OpenXmlAttribute; XmlAttrLeader: OpenXmlAttribute; XmlAttrPos: OpenXmlAttribute; - // Children end; @@ -41,49 +40,36 @@ end; function Tab.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Tab.Init();override; begin - {self.}XmlAttrVal := new OpenXmlAttribute(nil, "val", nil); - {self.}XmlAttrLeader := new OpenXmlAttribute({self.}Prefix, "leader", nil); - {self.}XmlAttrPos := new OpenXmlAttribute({self.}Prefix, "pos", nil); -end; - -function Tab.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrVal, - {self.}XmlAttrLeader, - {self.}XmlAttrPos, - ); -end; - -function Tab.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "val": makeweakref(thisFunction(WriteXmlAttrVal)), + pre + "leader": makeweakref(thisFunction(WriteXmlAttrLeader)), + pre + "pos": makeweakref(thisFunction(WriteXmlAttrPos)), ); sorted_child_ := array( - "": -1, ); -end; - -function Tab.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Tab.Copy(_obj: Tab);override; begin - if not ifnil(_obj.XmlAttrVal.Value) then - {self.}XmlAttrVal.Value := _obj.XmlAttrVal.Value; - if not ifnil(_obj.XmlAttrLeader.Value) then - {self.}XmlAttrLeader.Value := _obj.XmlAttrLeader.Value; - if not ifnil(_obj.XmlAttrPos.Value) then - {self.}XmlAttrPos.Value := _obj.XmlAttrPos.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Val) then + {self.}Val := _obj.Val; + if not ifnil(_obj.Leader) then + {self.}Leader := _obj.Leader; + if not ifnil(_obj.Pos) then + {self.}Pos := _obj.Pos; + tslassigning := tslassigning_backup; end; function Tab.ReadXmlAttrVal(); @@ -93,6 +79,11 @@ end; function Tab.WriteXmlAttrVal(_value); begin + if ifnil({self.}XmlAttrVal) then + begin + {self.}XmlAttrVal := new OpenXmlAttribute("", "val", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVal; + end {self.}XmlAttrVal.Value := _value; end; @@ -103,6 +94,11 @@ end; function Tab.WriteXmlAttrLeader(_value); begin + if ifnil({self.}XmlAttrLeader) then + begin + {self.}XmlAttrLeader := new OpenXmlAttribute({self.}Prefix, "leader", nil); + attributes_[length(attributes_)] := {self.}XmlAttrLeader; + end {self.}XmlAttrLeader.Value := _value; end; @@ -113,5 +109,10 @@ end; function Tab.WriteXmlAttrPos(_value); begin + if ifnil({self.}XmlAttrPos) then + begin + {self.}XmlAttrPos := new OpenXmlAttribute({self.}Prefix, "pos", nil); + attributes_[length(attributes_)] := {self.}XmlAttrPos; + end {self.}XmlAttrPos.Value := _value; end; diff --git a/autoclass/docx/Tabs@DOCX.tsf b/autoclass/docx/Tabs@DOCX.tsf index a89e19b..c396ac7 100644 --- a/autoclass/docx/Tabs@DOCX.tsf +++ b/autoclass/docx/Tabs@DOCX.tsf @@ -4,19 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Tabs);override; + +public + + // multi property + property Tabs read ReadTabs; + function ReadTabs(_index); function AddTab(): Tab; function AppendTab(): Tab; - property Tabs read ReadTabs; - function ReadTabs(_index); - public - // Attributes - // Children end; @@ -33,105 +31,47 @@ end; function Tabs.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Tabs.Init();override; begin - -end; - -function Tabs.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Tabs.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, + pre + "tab": array(0, makeweakref(thisFunction(AppendTab))), ); -end; - -function Tabs.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "tab": obj := {self.}AppendTab(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Tabs.Copy(_obj: Tabs);override; begin + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + tslassigning := tslassigning_backup; +end; +function Tabs.ReadTabs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "tab", ind); end; function Tabs.AddTab(): Tab; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "tab" then break; - end obj := new Tab(self, {self.}Prefix, "tab"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function Tabs.AppendTab(): Tab; begin obj := new Tab(self, {self.}Prefix, "tab"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function Tabs.ReadTabs(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "tab" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; diff --git a/autoclass/docx/Tbl@DOCX.tsf b/autoclass/docx/Tbl@DOCX.tsf index 49cec92..b4c8069 100644 --- a/autoclass/docx/Tbl@DOCX.tsf +++ b/autoclass/docx/Tbl@DOCX.tsf @@ -4,22 +4,26 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Tbl);override; + +public + + // normal property + property TblPr read ReadXmlChildTblPr; + property TblGrid read ReadXmlChildTblGrid; + function ReadXmlChildTblPr(); + function ReadXmlChildTblGrid(); + + // multi property + property Trs read ReadTrs; + function ReadTrs(_index); function AddTr(): Tr; function AppendTr(): Tr; - property Trs read ReadTrs; - function ReadTrs(_index); - public - // Attributes - // Children - TblPr: TblPr; - TblGrid: TblGrid; + XmlChildTblPr: TblPr; + XmlChildTblGrid: TblGrid; end; @@ -35,111 +39,73 @@ end; function Tbl.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Tbl.Init();override; begin - {self.}TblPr := new TblPr(self, {self.}Prefix, "tblPr"); - {self.}TblGrid := new TblGrid(self, {self.}Prefix, "tblGrid"); -end; - -function Tbl.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Tbl.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}TblPr, - 1: {self.}TblGrid, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}TblPr.ElementName: 0, - {self.}TblGrid.ElementName: 1, + pre + "tblPr": array(0, makeweakref(thisFunction(ReadXmlChildTblPr))), + pre + "tblGrid": array(1, makeweakref(thisFunction(ReadXmlChildTblGrid))), + pre + "tr": array(2, makeweakref(thisFunction(AppendTr))), ); -end; - -function Tbl.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "tr": obj := {self.}AppendTr(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Tbl.Copy(_obj: Tbl);override; begin - {self.}TblPr.Copy(_obj.TblPr); - {self.}TblGrid.Copy(_obj.TblGrid); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildTblPr) then + {self.}TblPr.Copy(_obj.XmlChildTblPr); + if not ifnil(_obj.XmlChildTblGrid) then + {self.}TblGrid.Copy(_obj.XmlChildTblGrid); + tslassigning := tslassigning_backup; +end; + +function Tbl.ReadXmlChildTblPr(); +begin + if tslassigning and ifnil({self.}XmlChildTblPr) then + begin + {self.}XmlChildTblPr := new TblPr(self, {self.}Prefix, "tblPr"); + container_.Set({self.}XmlChildTblPr); + end + return {self.}XmlChildTblPr; +end; + +function Tbl.ReadXmlChildTblGrid(); +begin + if tslassigning and ifnil({self.}XmlChildTblGrid) then + begin + {self.}XmlChildTblGrid := new TblGrid(self, {self.}Prefix, "tblGrid"); + container_.Set({self.}XmlChildTblGrid); + end + return {self.}XmlChildTblGrid; +end; + +function Tbl.ReadTrs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "tr", ind); end; function Tbl.AddTr(): Tr; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "tr" then break; - end obj := new Tr(self, {self.}Prefix, "tr"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function Tbl.AppendTr(): Tr; begin obj := new Tr(self, {self.}Prefix, "tr"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function Tbl.ReadTrs(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "tr" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; diff --git a/autoclass/docx/TblBorder@DOCX.tsf b/autoclass/docx/TblBorder@DOCX.tsf index ce03347..b616c2f 100644 --- a/autoclass/docx/TblBorder@DOCX.tsf +++ b/autoclass/docx/TblBorder@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: TblBorder);override; +public + + // attributes property property Val read ReadXmlAttrVal write WriteXmlAttrVal; property Color read ReadXmlAttrColor write WriteXmlAttrColor; property Space read ReadXmlAttrSpace write WriteXmlAttrSpace; @@ -29,7 +29,7 @@ public function WriteXmlAttrSz(_value); public - // Attributes + // Attributes XmlAttrVal: OpenXmlAttribute; XmlAttrColor: OpenXmlAttribute; XmlAttrSpace: OpenXmlAttribute; @@ -37,7 +37,6 @@ public XmlAttrThemeTint: OpenXmlAttribute; XmlAttrSz: OpenXmlAttribute; - // Children end; @@ -53,61 +52,45 @@ end; function TblBorder.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function TblBorder.Init();override; begin - {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); - {self.}XmlAttrColor := new OpenXmlAttribute({self.}Prefix, "color", nil); - {self.}XmlAttrSpace := new OpenXmlAttribute({self.}Prefix, "space", nil); - {self.}XmlAttrThemeColor := new OpenXmlAttribute({self.}Prefix, "themeColor", nil); - {self.}XmlAttrThemeTint := new OpenXmlAttribute({self.}Prefix, "themeTint", nil); - {self.}XmlAttrSz := new OpenXmlAttribute({self.}Prefix, "sz", nil); -end; - -function TblBorder.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrVal, - {self.}XmlAttrColor, - {self.}XmlAttrSpace, - {self.}XmlAttrThemeColor, - {self.}XmlAttrThemeTint, - {self.}XmlAttrSz, - ); -end; - -function TblBorder.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "val": makeweakref(thisFunction(WriteXmlAttrVal)), + pre + "color": makeweakref(thisFunction(WriteXmlAttrColor)), + pre + "space": makeweakref(thisFunction(WriteXmlAttrSpace)), + pre + "themeColor": makeweakref(thisFunction(WriteXmlAttrThemeColor)), + pre + "themeTint": makeweakref(thisFunction(WriteXmlAttrThemeTint)), + pre + "sz": makeweakref(thisFunction(WriteXmlAttrSz)), ); sorted_child_ := array( - "": -1, ); -end; - -function TblBorder.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function TblBorder.Copy(_obj: TblBorder);override; begin - if not ifnil(_obj.XmlAttrVal.Value) then - {self.}XmlAttrVal.Value := _obj.XmlAttrVal.Value; - if not ifnil(_obj.XmlAttrColor.Value) then - {self.}XmlAttrColor.Value := _obj.XmlAttrColor.Value; - if not ifnil(_obj.XmlAttrSpace.Value) then - {self.}XmlAttrSpace.Value := _obj.XmlAttrSpace.Value; - if not ifnil(_obj.XmlAttrThemeColor.Value) then - {self.}XmlAttrThemeColor.Value := _obj.XmlAttrThemeColor.Value; - if not ifnil(_obj.XmlAttrThemeTint.Value) then - {self.}XmlAttrThemeTint.Value := _obj.XmlAttrThemeTint.Value; - if not ifnil(_obj.XmlAttrSz.Value) then - {self.}XmlAttrSz.Value := _obj.XmlAttrSz.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Val) then + {self.}Val := _obj.Val; + if not ifnil(_obj.Color) then + {self.}Color := _obj.Color; + if not ifnil(_obj.Space) then + {self.}Space := _obj.Space; + if not ifnil(_obj.ThemeColor) then + {self.}ThemeColor := _obj.ThemeColor; + if not ifnil(_obj.ThemeTint) then + {self.}ThemeTint := _obj.ThemeTint; + if not ifnil(_obj.Sz) then + {self.}Sz := _obj.Sz; + tslassigning := tslassigning_backup; end; function TblBorder.ReadXmlAttrVal(); @@ -117,6 +100,11 @@ end; function TblBorder.WriteXmlAttrVal(_value); begin + if ifnil({self.}XmlAttrVal) then + begin + {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVal; + end {self.}XmlAttrVal.Value := _value; end; @@ -127,6 +115,11 @@ end; function TblBorder.WriteXmlAttrColor(_value); begin + if ifnil({self.}XmlAttrColor) then + begin + {self.}XmlAttrColor := new OpenXmlAttribute({self.}Prefix, "color", nil); + attributes_[length(attributes_)] := {self.}XmlAttrColor; + end {self.}XmlAttrColor.Value := _value; end; @@ -137,6 +130,11 @@ end; function TblBorder.WriteXmlAttrSpace(_value); begin + if ifnil({self.}XmlAttrSpace) then + begin + {self.}XmlAttrSpace := new OpenXmlAttribute({self.}Prefix, "space", nil); + attributes_[length(attributes_)] := {self.}XmlAttrSpace; + end {self.}XmlAttrSpace.Value := _value; end; @@ -147,6 +145,11 @@ end; function TblBorder.WriteXmlAttrThemeColor(_value); begin + if ifnil({self.}XmlAttrThemeColor) then + begin + {self.}XmlAttrThemeColor := new OpenXmlAttribute({self.}Prefix, "themeColor", nil); + attributes_[length(attributes_)] := {self.}XmlAttrThemeColor; + end {self.}XmlAttrThemeColor.Value := _value; end; @@ -157,6 +160,11 @@ end; function TblBorder.WriteXmlAttrThemeTint(_value); begin + if ifnil({self.}XmlAttrThemeTint) then + begin + {self.}XmlAttrThemeTint := new OpenXmlAttribute({self.}Prefix, "themeTint", nil); + attributes_[length(attributes_)] := {self.}XmlAttrThemeTint; + end {self.}XmlAttrThemeTint.Value := _value; end; @@ -167,5 +175,10 @@ end; function TblBorder.WriteXmlAttrSz(_value); begin + if ifnil({self.}XmlAttrSz) then + begin + {self.}XmlAttrSz := new OpenXmlAttribute({self.}Prefix, "sz", nil); + attributes_[length(attributes_)] := {self.}XmlAttrSz; + end {self.}XmlAttrSz.Value := _value; end; diff --git a/autoclass/docx/TblBorders@DOCX.tsf b/autoclass/docx/TblBorders@DOCX.tsf index 0f13ab1..c366ac6 100644 --- a/autoclass/docx/TblBorders@DOCX.tsf +++ b/autoclass/docx/TblBorders@DOCX.tsf @@ -4,21 +4,32 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: TblBorders);override; public - // Attributes + // normal property + property Top read ReadXmlChildTop; + property Left read ReadXmlChildLeft; + property Bottom read ReadXmlChildBottom; + property Right read ReadXmlChildRight; + property InsideH read ReadXmlChildInsideH; + property InsideV read ReadXmlChildInsideV; + function ReadXmlChildTop(); + function ReadXmlChildLeft(); + function ReadXmlChildBottom(); + function ReadXmlChildRight(); + function ReadXmlChildInsideH(); + function ReadXmlChildInsideV(); + +public // Children - Top: tblBorder; - Left: tblBorder; - Bottom: tblBorder; - Right: tblBorder; - InsideH: PureWVal; - InsideV: PureWVal; + XmlChildTop: tblBorder; + XmlChildLeft: tblBorder; + XmlChildBottom: tblBorder; + XmlChildRight: tblBorder; + XmlChildInsideH: PureWVal; + XmlChildInsideV: PureWVal; end; @@ -34,90 +45,103 @@ end; function TblBorders.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function TblBorders.Init();override; begin - {self.}Top := new tblBorder(self, {self.}Prefix, "top"); - {self.}Left := new tblBorder(self, {self.}Prefix, "left"); - {self.}Bottom := new tblBorder(self, {self.}Prefix, "bottom"); - {self.}Right := new tblBorder(self, {self.}Prefix, "right"); - {self.}InsideH := new PureWVal(self, {self.}Prefix, "insideH"); - {self.}InsideV := new PureWVal(self, {self.}Prefix, "insideV"); -end; - -function TblBorders.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function TblBorders.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Top, - 1: {self.}Left, - 2: {self.}Bottom, - 3: {self.}Right, - 4: {self.}InsideH, - 5: {self.}InsideV, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}Top.ElementName: 0, - {self.}Left.ElementName: 1, - {self.}Bottom.ElementName: 2, - {self.}Right.ElementName: 3, - {self.}InsideH.ElementName: 4, - {self.}InsideV.ElementName: 5, + pre + "top": array(0, makeweakref(thisFunction(ReadXmlChildTop))), + pre + "left": array(1, makeweakref(thisFunction(ReadXmlChildLeft))), + pre + "bottom": array(2, makeweakref(thisFunction(ReadXmlChildBottom))), + pre + "right": array(3, makeweakref(thisFunction(ReadXmlChildRight))), + pre + "insideH": array(4, makeweakref(thisFunction(ReadXmlChildInsideH))), + pre + "insideV": array(5, makeweakref(thisFunction(ReadXmlChildInsideV))), ); -end; - -function TblBorders.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function TblBorders.Copy(_obj: TblBorders);override; begin - {self.}Top.Copy(_obj.Top); - {self.}Left.Copy(_obj.Left); - {self.}Bottom.Copy(_obj.Bottom); - {self.}Right.Copy(_obj.Right); - {self.}InsideH.Copy(_obj.InsideH); - {self.}InsideV.Copy(_obj.InsideV); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildTop) then + {self.}Top.Copy(_obj.XmlChildTop); + if not ifnil(_obj.XmlChildLeft) then + {self.}Left.Copy(_obj.XmlChildLeft); + if not ifnil(_obj.XmlChildBottom) then + {self.}Bottom.Copy(_obj.XmlChildBottom); + if not ifnil(_obj.XmlChildRight) then + {self.}Right.Copy(_obj.XmlChildRight); + if not ifnil(_obj.XmlChildInsideH) then + {self.}InsideH.Copy(_obj.XmlChildInsideH); + if not ifnil(_obj.XmlChildInsideV) then + {self.}InsideV.Copy(_obj.XmlChildInsideV); + tslassigning := tslassigning_backup; +end; + +function TblBorders.ReadXmlChildTop(); +begin + if tslassigning and ifnil({self.}XmlChildTop) then + begin + {self.}XmlChildTop := new tblBorder(self, {self.}Prefix, "top"); + container_.Set({self.}XmlChildTop); + end + return {self.}XmlChildTop; +end; + +function TblBorders.ReadXmlChildLeft(); +begin + if tslassigning and ifnil({self.}XmlChildLeft) then + begin + {self.}XmlChildLeft := new tblBorder(self, {self.}Prefix, "left"); + container_.Set({self.}XmlChildLeft); + end + return {self.}XmlChildLeft; +end; + +function TblBorders.ReadXmlChildBottom(); +begin + if tslassigning and ifnil({self.}XmlChildBottom) then + begin + {self.}XmlChildBottom := new tblBorder(self, {self.}Prefix, "bottom"); + container_.Set({self.}XmlChildBottom); + end + return {self.}XmlChildBottom; +end; + +function TblBorders.ReadXmlChildRight(); +begin + if tslassigning and ifnil({self.}XmlChildRight) then + begin + {self.}XmlChildRight := new tblBorder(self, {self.}Prefix, "right"); + container_.Set({self.}XmlChildRight); + end + return {self.}XmlChildRight; +end; + +function TblBorders.ReadXmlChildInsideH(); +begin + if tslassigning and ifnil({self.}XmlChildInsideH) then + begin + {self.}XmlChildInsideH := new PureWVal(self, {self.}Prefix, "insideH"); + container_.Set({self.}XmlChildInsideH); + end + return {self.}XmlChildInsideH; +end; + +function TblBorders.ReadXmlChildInsideV(); +begin + if tslassigning and ifnil({self.}XmlChildInsideV) then + begin + {self.}XmlChildInsideV := new PureWVal(self, {self.}Prefix, "insideV"); + container_.Set({self.}XmlChildInsideV); + end + return {self.}XmlChildInsideV; end; diff --git a/autoclass/docx/TblCellMar@DOCX.tsf b/autoclass/docx/TblCellMar@DOCX.tsf index a6b0998..1223222 100644 --- a/autoclass/docx/TblCellMar@DOCX.tsf +++ b/autoclass/docx/TblCellMar@DOCX.tsf @@ -4,19 +4,26 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: TblCellMar);override; public - // Attributes + // normal property + property Top read ReadXmlChildTop; + property Left read ReadXmlChildLeft; + property Bottom read ReadXmlChildBottom; + property Right read ReadXmlChildRight; + function ReadXmlChildTop(); + function ReadXmlChildLeft(); + function ReadXmlChildBottom(); + function ReadXmlChildRight(); + +public // Children - Top: TblInd; - Left: TblInd; - Bottom: TblInd; - Right: TblInd; + XmlChildTop: TblInd; + XmlChildLeft: TblInd; + XmlChildBottom: TblInd; + XmlChildRight: TblInd; end; @@ -32,82 +39,77 @@ end; function TblCellMar.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function TblCellMar.Init();override; begin - {self.}Top := new TblInd(self, {self.}Prefix, "top"); - {self.}Left := new TblInd(self, {self.}Prefix, "left"); - {self.}Bottom := new TblInd(self, {self.}Prefix, "bottom"); - {self.}Right := new TblInd(self, {self.}Prefix, "right"); -end; - -function TblCellMar.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function TblCellMar.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Top, - 1: {self.}Left, - 2: {self.}Bottom, - 3: {self.}Right, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}Top.ElementName: 0, - {self.}Left.ElementName: 1, - {self.}Bottom.ElementName: 2, - {self.}Right.ElementName: 3, + pre + "top": array(0, makeweakref(thisFunction(ReadXmlChildTop))), + pre + "left": array(1, makeweakref(thisFunction(ReadXmlChildLeft))), + pre + "bottom": array(2, makeweakref(thisFunction(ReadXmlChildBottom))), + pre + "right": array(3, makeweakref(thisFunction(ReadXmlChildRight))), ); -end; - -function TblCellMar.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function TblCellMar.Copy(_obj: TblCellMar);override; begin - {self.}Top.Copy(_obj.Top); - {self.}Left.Copy(_obj.Left); - {self.}Bottom.Copy(_obj.Bottom); - {self.}Right.Copy(_obj.Right); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildTop) then + {self.}Top.Copy(_obj.XmlChildTop); + if not ifnil(_obj.XmlChildLeft) then + {self.}Left.Copy(_obj.XmlChildLeft); + if not ifnil(_obj.XmlChildBottom) then + {self.}Bottom.Copy(_obj.XmlChildBottom); + if not ifnil(_obj.XmlChildRight) then + {self.}Right.Copy(_obj.XmlChildRight); + tslassigning := tslassigning_backup; +end; + +function TblCellMar.ReadXmlChildTop(); +begin + if tslassigning and ifnil({self.}XmlChildTop) then + begin + {self.}XmlChildTop := new TblInd(self, {self.}Prefix, "top"); + container_.Set({self.}XmlChildTop); + end + return {self.}XmlChildTop; +end; + +function TblCellMar.ReadXmlChildLeft(); +begin + if tslassigning and ifnil({self.}XmlChildLeft) then + begin + {self.}XmlChildLeft := new TblInd(self, {self.}Prefix, "left"); + container_.Set({self.}XmlChildLeft); + end + return {self.}XmlChildLeft; +end; + +function TblCellMar.ReadXmlChildBottom(); +begin + if tslassigning and ifnil({self.}XmlChildBottom) then + begin + {self.}XmlChildBottom := new TblInd(self, {self.}Prefix, "bottom"); + container_.Set({self.}XmlChildBottom); + end + return {self.}XmlChildBottom; +end; + +function TblCellMar.ReadXmlChildRight(); +begin + if tslassigning and ifnil({self.}XmlChildRight) then + begin + {self.}XmlChildRight := new TblInd(self, {self.}Prefix, "right"); + container_.Set({self.}XmlChildRight); + end + return {self.}XmlChildRight; end; diff --git a/autoclass/docx/TblGrid@DOCX.tsf b/autoclass/docx/TblGrid@DOCX.tsf index 976b7f3..cf9d421 100644 --- a/autoclass/docx/TblGrid@DOCX.tsf +++ b/autoclass/docx/TblGrid@DOCX.tsf @@ -4,19 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: TblGrid);override; + +public + + // multi property + property GridCols read ReadGridCols; + function ReadGridCols(_index); function AddGridCol(): GridCol; function AppendGridCol(): GridCol; - property GridCols read ReadGridCols; - function ReadGridCols(_index); - public - // Attributes - // Children end; @@ -33,105 +31,47 @@ end; function TblGrid.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function TblGrid.Init();override; begin - -end; - -function TblGrid.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function TblGrid.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, + pre + "gridCol": array(0, makeweakref(thisFunction(AppendGridCol))), ); -end; - -function TblGrid.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "gridCol": obj := {self.}AppendGridCol(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function TblGrid.Copy(_obj: TblGrid);override; begin + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + tslassigning := tslassigning_backup; +end; +function TblGrid.ReadGridCols(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "gridCol", ind); end; function TblGrid.AddGridCol(): GridCol; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "gridCol" then break; - end obj := new GridCol(self, {self.}Prefix, "gridCol"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function TblGrid.AppendGridCol(): GridCol; begin obj := new GridCol(self, {self.}Prefix, "gridCol"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function TblGrid.ReadGridCols(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "gridCol" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; diff --git a/autoclass/docx/TblInd@DOCX.tsf b/autoclass/docx/TblInd@DOCX.tsf index b7bc52f..f7cae7e 100644 --- a/autoclass/docx/TblInd@DOCX.tsf +++ b/autoclass/docx/TblInd@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: TblInd);override; +public + + // attributes property property W read ReadXmlAttrW write WriteXmlAttrW; property Type read ReadXmlAttrType write WriteXmlAttrType; function ReadXmlAttrW(); @@ -17,11 +17,10 @@ public function WriteXmlAttrType(_value); public - // Attributes + // Attributes XmlAttrW: OpenXmlAttribute; XmlAttrType: OpenXmlAttribute; - // Children end; @@ -37,45 +36,33 @@ end; function TblInd.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function TblInd.Init();override; begin - {self.}XmlAttrW := new OpenXmlAttribute({self.}Prefix, "w", nil); - {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); -end; - -function TblInd.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrW, - {self.}XmlAttrType, - ); -end; - -function TblInd.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "w": makeweakref(thisFunction(WriteXmlAttrW)), + pre + "type": makeweakref(thisFunction(WriteXmlAttrType)), ); sorted_child_ := array( - "": -1, ); -end; - -function TblInd.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function TblInd.Copy(_obj: TblInd);override; begin - if not ifnil(_obj.XmlAttrW.Value) then - {self.}XmlAttrW.Value := _obj.XmlAttrW.Value; - if not ifnil(_obj.XmlAttrType.Value) then - {self.}XmlAttrType.Value := _obj.XmlAttrType.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.W) then + {self.}W := _obj.W; + if not ifnil(_obj.Type) then + {self.}Type := _obj.Type; + tslassigning := tslassigning_backup; end; function TblInd.ReadXmlAttrW(); @@ -85,6 +72,11 @@ end; function TblInd.WriteXmlAttrW(_value); begin + if ifnil({self.}XmlAttrW) then + begin + {self.}XmlAttrW := new OpenXmlAttribute({self.}Prefix, "w", nil); + attributes_[length(attributes_)] := {self.}XmlAttrW; + end {self.}XmlAttrW.Value := _value; end; @@ -95,5 +87,10 @@ end; function TblInd.WriteXmlAttrType(_value); begin + if ifnil({self.}XmlAttrType) then + begin + {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); + attributes_[length(attributes_)] := {self.}XmlAttrType; + end {self.}XmlAttrType.Value := _value; end; diff --git a/autoclass/docx/TblLayout@DOCX.tsf b/autoclass/docx/TblLayout@DOCX.tsf index 7e7ab70..aee095c 100644 --- a/autoclass/docx/TblLayout@DOCX.tsf +++ b/autoclass/docx/TblLayout@DOCX.tsf @@ -4,20 +4,19 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: TblLayout);override; +public + + // attributes property property Type read ReadXmlAttrType write WriteXmlAttrType; function ReadXmlAttrType(); function WriteXmlAttrType(_value); public - // Attributes + // Attributes XmlAttrType: OpenXmlAttribute; - // Children end; @@ -33,41 +32,30 @@ end; function TblLayout.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function TblLayout.Init();override; begin - {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); -end; - -function TblLayout.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrType, - ); -end; - -function TblLayout.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "type": makeweakref(thisFunction(WriteXmlAttrType)), ); sorted_child_ := array( - "": -1, ); -end; - -function TblLayout.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function TblLayout.Copy(_obj: TblLayout);override; begin - if not ifnil(_obj.XmlAttrType.Value) then - {self.}XmlAttrType.Value := _obj.XmlAttrType.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Type) then + {self.}Type := _obj.Type; + tslassigning := tslassigning_backup; end; function TblLayout.ReadXmlAttrType(); @@ -77,5 +65,10 @@ end; function TblLayout.WriteXmlAttrType(_value); begin + if ifnil({self.}XmlAttrType) then + begin + {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); + attributes_[length(attributes_)] := {self.}XmlAttrType; + end {self.}XmlAttrType.Value := _value; end; diff --git a/autoclass/docx/TblLook@DOCX.tsf b/autoclass/docx/TblLook@DOCX.tsf index da6b41a..23c371e 100644 --- a/autoclass/docx/TblLook@DOCX.tsf +++ b/autoclass/docx/TblLook@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: TblLook);override; +public + + // attributes property property Val read ReadXmlAttrVal write WriteXmlAttrVal; property FirstRow read ReadXmlAttrFirstRow write WriteXmlAttrFirstRow; property LastRow read ReadXmlAttrLastRow write WriteXmlAttrLastRow; @@ -32,7 +32,7 @@ public function WriteXmlAttrNoVBand(_value); public - // Attributes + // Attributes XmlAttrVal: OpenXmlAttribute; XmlAttrFirstRow: OpenXmlAttribute; XmlAttrLastRow: OpenXmlAttribute; @@ -41,7 +41,6 @@ public XmlAttrNoHBand: OpenXmlAttribute; XmlAttrNoVBand: OpenXmlAttribute; - // Children end; @@ -57,65 +56,48 @@ end; function TblLook.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function TblLook.Init();override; begin - {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); - {self.}XmlAttrFirstRow := new OpenXmlAttribute({self.}Prefix, "firstRow", nil); - {self.}XmlAttrLastRow := new OpenXmlAttribute({self.}Prefix, "lastRow", nil); - {self.}XmlAttrFirstColumn := new OpenXmlAttribute({self.}Prefix, "firstColumn", nil); - {self.}XmlAttrLastColumn := new OpenXmlAttribute({self.}Prefix, "lastColumn", nil); - {self.}XmlAttrNoHBand := new OpenXmlAttribute({self.}Prefix, "noHBand", nil); - {self.}XmlAttrNoVBand := new OpenXmlAttribute({self.}Prefix, "noVBand", nil); -end; - -function TblLook.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrVal, - {self.}XmlAttrFirstRow, - {self.}XmlAttrLastRow, - {self.}XmlAttrFirstColumn, - {self.}XmlAttrLastColumn, - {self.}XmlAttrNoHBand, - {self.}XmlAttrNoVBand, - ); -end; - -function TblLook.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "val": makeweakref(thisFunction(WriteXmlAttrVal)), + pre + "firstRow": makeweakref(thisFunction(WriteXmlAttrFirstRow)), + pre + "lastRow": makeweakref(thisFunction(WriteXmlAttrLastRow)), + pre + "firstColumn": makeweakref(thisFunction(WriteXmlAttrFirstColumn)), + pre + "lastColumn": makeweakref(thisFunction(WriteXmlAttrLastColumn)), + pre + "noHBand": makeweakref(thisFunction(WriteXmlAttrNoHBand)), + pre + "noVBand": makeweakref(thisFunction(WriteXmlAttrNoVBand)), ); sorted_child_ := array( - "": -1, ); -end; - -function TblLook.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function TblLook.Copy(_obj: TblLook);override; begin - if not ifnil(_obj.XmlAttrVal.Value) then - {self.}XmlAttrVal.Value := _obj.XmlAttrVal.Value; - if not ifnil(_obj.XmlAttrFirstRow.Value) then - {self.}XmlAttrFirstRow.Value := _obj.XmlAttrFirstRow.Value; - if not ifnil(_obj.XmlAttrLastRow.Value) then - {self.}XmlAttrLastRow.Value := _obj.XmlAttrLastRow.Value; - if not ifnil(_obj.XmlAttrFirstColumn.Value) then - {self.}XmlAttrFirstColumn.Value := _obj.XmlAttrFirstColumn.Value; - if not ifnil(_obj.XmlAttrLastColumn.Value) then - {self.}XmlAttrLastColumn.Value := _obj.XmlAttrLastColumn.Value; - if not ifnil(_obj.XmlAttrNoHBand.Value) then - {self.}XmlAttrNoHBand.Value := _obj.XmlAttrNoHBand.Value; - if not ifnil(_obj.XmlAttrNoVBand.Value) then - {self.}XmlAttrNoVBand.Value := _obj.XmlAttrNoVBand.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Val) then + {self.}Val := _obj.Val; + if not ifnil(_obj.FirstRow) then + {self.}FirstRow := _obj.FirstRow; + if not ifnil(_obj.LastRow) then + {self.}LastRow := _obj.LastRow; + if not ifnil(_obj.FirstColumn) then + {self.}FirstColumn := _obj.FirstColumn; + if not ifnil(_obj.LastColumn) then + {self.}LastColumn := _obj.LastColumn; + if not ifnil(_obj.NoHBand) then + {self.}NoHBand := _obj.NoHBand; + if not ifnil(_obj.NoVBand) then + {self.}NoVBand := _obj.NoVBand; + tslassigning := tslassigning_backup; end; function TblLook.ReadXmlAttrVal(); @@ -125,6 +107,11 @@ end; function TblLook.WriteXmlAttrVal(_value); begin + if ifnil({self.}XmlAttrVal) then + begin + {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVal; + end {self.}XmlAttrVal.Value := _value; end; @@ -135,6 +122,11 @@ end; function TblLook.WriteXmlAttrFirstRow(_value); begin + if ifnil({self.}XmlAttrFirstRow) then + begin + {self.}XmlAttrFirstRow := new OpenXmlAttribute({self.}Prefix, "firstRow", nil); + attributes_[length(attributes_)] := {self.}XmlAttrFirstRow; + end {self.}XmlAttrFirstRow.Value := _value; end; @@ -145,6 +137,11 @@ end; function TblLook.WriteXmlAttrLastRow(_value); begin + if ifnil({self.}XmlAttrLastRow) then + begin + {self.}XmlAttrLastRow := new OpenXmlAttribute({self.}Prefix, "lastRow", nil); + attributes_[length(attributes_)] := {self.}XmlAttrLastRow; + end {self.}XmlAttrLastRow.Value := _value; end; @@ -155,6 +152,11 @@ end; function TblLook.WriteXmlAttrFirstColumn(_value); begin + if ifnil({self.}XmlAttrFirstColumn) then + begin + {self.}XmlAttrFirstColumn := new OpenXmlAttribute({self.}Prefix, "firstColumn", nil); + attributes_[length(attributes_)] := {self.}XmlAttrFirstColumn; + end {self.}XmlAttrFirstColumn.Value := _value; end; @@ -165,6 +167,11 @@ end; function TblLook.WriteXmlAttrLastColumn(_value); begin + if ifnil({self.}XmlAttrLastColumn) then + begin + {self.}XmlAttrLastColumn := new OpenXmlAttribute({self.}Prefix, "lastColumn", nil); + attributes_[length(attributes_)] := {self.}XmlAttrLastColumn; + end {self.}XmlAttrLastColumn.Value := _value; end; @@ -175,6 +182,11 @@ end; function TblLook.WriteXmlAttrNoHBand(_value); begin + if ifnil({self.}XmlAttrNoHBand) then + begin + {self.}XmlAttrNoHBand := new OpenXmlAttribute({self.}Prefix, "noHBand", nil); + attributes_[length(attributes_)] := {self.}XmlAttrNoHBand; + end {self.}XmlAttrNoHBand.Value := _value; end; @@ -185,5 +197,10 @@ end; function TblLook.WriteXmlAttrNoVBand(_value); begin + if ifnil({self.}XmlAttrNoVBand) then + begin + {self.}XmlAttrNoVBand := new OpenXmlAttribute({self.}Prefix, "noVBand", nil); + attributes_[length(attributes_)] := {self.}XmlAttrNoVBand; + end {self.}XmlAttrNoVBand.Value := _value; end; diff --git a/autoclass/docx/TblPr@DOCX.tsf b/autoclass/docx/TblPr@DOCX.tsf index 9cd0a56..8a28317 100644 --- a/autoclass/docx/TblPr@DOCX.tsf +++ b/autoclass/docx/TblPr@DOCX.tsf @@ -4,25 +4,44 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: TblPr);override; public - // Attributes + // normal property + property TblStyleRowBandSize read ReadXmlChildTblStyleRowBandSize; + property TblStyleColBandSize read ReadXmlChildTblStyleColBandSize; + property Jc read ReadXmlChildJc; + property TblStyle read ReadXmlChildTblStyle; + property TblW read ReadXmlChildTblW; + property TblInd read ReadXmlChildTblInd; + property TblLayout read ReadXmlChildTblLayout; + property TblLook read ReadXmlChildTblLook; + property TblBorders read ReadXmlChildTblBorders; + property TblCellMar read ReadXmlChildTblCellMar; + function ReadXmlChildTblStyleRowBandSize(); + function ReadXmlChildTblStyleColBandSize(); + function ReadXmlChildJc(); + function ReadXmlChildTblStyle(); + function ReadXmlChildTblW(); + function ReadXmlChildTblInd(); + function ReadXmlChildTblLayout(); + function ReadXmlChildTblLook(); + function ReadXmlChildTblBorders(); + function ReadXmlChildTblCellMar(); + +public // Children - TblStyleRowBandSize: PureWVal; - TblStyleColBandSize: PureWVal; - Jc: PureWVal; - TblStyle: PureWVal; - TblW: TblW; - TblInd: TblW; - TblLayout: TblLayout; - TblLook: TblLook; - TblBorders: TblBorders; - TblCellMar: TblCellMar; + XmlChildTblStyleRowBandSize: PureWVal; + XmlChildTblStyleColBandSize: PureWVal; + XmlChildJc: PureWVal; + XmlChildTblStyle: PureWVal; + XmlChildTblW: TblW; + XmlChildTblInd: TblW; + XmlChildTblLayout: TblLayout; + XmlChildTblLook: TblLook; + XmlChildTblBorders: TblBorders; + XmlChildTblCellMar: TblCellMar; end; @@ -38,106 +57,155 @@ end; function TblPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function TblPr.Init();override; begin - {self.}TblStyleRowBandSize := new PureWVal(self, {self.}Prefix, "tblStyleRowBandSize"); - {self.}TblStyleColBandSize := new PureWVal(self, {self.}Prefix, "tblStyleColBandSize"); - {self.}Jc := new PureWVal(self, {self.}Prefix, "jc"); - {self.}TblStyle := new PureWVal(self, {self.}Prefix, "tblStyle"); - {self.}TblW := new TblW(self, {self.}Prefix, "tblW"); - {self.}TblInd := new TblW(self, {self.}Prefix, "tblInd"); - {self.}TblLayout := new TblLayout(self, {self.}Prefix, "tblLayout"); - {self.}TblLook := new TblLook(self, {self.}Prefix, "tblLook"); - {self.}TblBorders := new TblBorders(self, {self.}Prefix, "tblBorders"); - {self.}TblCellMar := new TblCellMar(self, {self.}Prefix, "tblCellMar"); -end; - -function TblPr.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function TblPr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}TblStyleRowBandSize, - 1: {self.}TblStyleColBandSize, - 2: {self.}Jc, - 3: {self.}TblStyle, - 4: {self.}TblW, - 5: {self.}TblInd, - 6: {self.}TblLayout, - 7: {self.}TblLook, - 8: {self.}TblBorders, - 9: {self.}TblCellMar, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}TblStyleRowBandSize.ElementName: 0, - {self.}TblStyleColBandSize.ElementName: 1, - {self.}Jc.ElementName: 2, - {self.}TblStyle.ElementName: 3, - {self.}TblW.ElementName: 4, - {self.}TblInd.ElementName: 5, - {self.}TblLayout.ElementName: 6, - {self.}TblLook.ElementName: 7, - {self.}TblBorders.ElementName: 8, - {self.}TblCellMar.ElementName: 9, + pre + "tblStyleRowBandSize": array(0, makeweakref(thisFunction(ReadXmlChildTblStyleRowBandSize))), + pre + "tblStyleColBandSize": array(1, makeweakref(thisFunction(ReadXmlChildTblStyleColBandSize))), + pre + "jc": array(2, makeweakref(thisFunction(ReadXmlChildJc))), + pre + "tblStyle": array(3, makeweakref(thisFunction(ReadXmlChildTblStyle))), + pre + "tblW": array(4, makeweakref(thisFunction(ReadXmlChildTblW))), + pre + "tblInd": array(5, makeweakref(thisFunction(ReadXmlChildTblInd))), + pre + "tblLayout": array(6, makeweakref(thisFunction(ReadXmlChildTblLayout))), + pre + "tblLook": array(7, makeweakref(thisFunction(ReadXmlChildTblLook))), + pre + "tblBorders": array(8, makeweakref(thisFunction(ReadXmlChildTblBorders))), + pre + "tblCellMar": array(9, makeweakref(thisFunction(ReadXmlChildTblCellMar))), ); -end; - -function TblPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function TblPr.Copy(_obj: TblPr);override; begin - {self.}TblStyleRowBandSize.Copy(_obj.TblStyleRowBandSize); - {self.}TblStyleColBandSize.Copy(_obj.TblStyleColBandSize); - {self.}Jc.Copy(_obj.Jc); - {self.}TblStyle.Copy(_obj.TblStyle); - {self.}TblW.Copy(_obj.TblW); - {self.}TblInd.Copy(_obj.TblInd); - {self.}TblLayout.Copy(_obj.TblLayout); - {self.}TblLook.Copy(_obj.TblLook); - {self.}TblBorders.Copy(_obj.TblBorders); - {self.}TblCellMar.Copy(_obj.TblCellMar); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildTblStyleRowBandSize) then + {self.}TblStyleRowBandSize.Copy(_obj.XmlChildTblStyleRowBandSize); + if not ifnil(_obj.XmlChildTblStyleColBandSize) then + {self.}TblStyleColBandSize.Copy(_obj.XmlChildTblStyleColBandSize); + if not ifnil(_obj.XmlChildJc) then + {self.}Jc.Copy(_obj.XmlChildJc); + if not ifnil(_obj.XmlChildTblStyle) then + {self.}TblStyle.Copy(_obj.XmlChildTblStyle); + if not ifnil(_obj.XmlChildTblW) then + {self.}TblW.Copy(_obj.XmlChildTblW); + if not ifnil(_obj.XmlChildTblInd) then + {self.}TblInd.Copy(_obj.XmlChildTblInd); + if not ifnil(_obj.XmlChildTblLayout) then + {self.}TblLayout.Copy(_obj.XmlChildTblLayout); + if not ifnil(_obj.XmlChildTblLook) then + {self.}TblLook.Copy(_obj.XmlChildTblLook); + if not ifnil(_obj.XmlChildTblBorders) then + {self.}TblBorders.Copy(_obj.XmlChildTblBorders); + if not ifnil(_obj.XmlChildTblCellMar) then + {self.}TblCellMar.Copy(_obj.XmlChildTblCellMar); + tslassigning := tslassigning_backup; +end; + +function TblPr.ReadXmlChildTblStyleRowBandSize(); +begin + if tslassigning and ifnil({self.}XmlChildTblStyleRowBandSize) then + begin + {self.}XmlChildTblStyleRowBandSize := new PureWVal(self, {self.}Prefix, "tblStyleRowBandSize"); + container_.Set({self.}XmlChildTblStyleRowBandSize); + end + return {self.}XmlChildTblStyleRowBandSize; +end; + +function TblPr.ReadXmlChildTblStyleColBandSize(); +begin + if tslassigning and ifnil({self.}XmlChildTblStyleColBandSize) then + begin + {self.}XmlChildTblStyleColBandSize := new PureWVal(self, {self.}Prefix, "tblStyleColBandSize"); + container_.Set({self.}XmlChildTblStyleColBandSize); + end + return {self.}XmlChildTblStyleColBandSize; +end; + +function TblPr.ReadXmlChildJc(); +begin + if tslassigning and ifnil({self.}XmlChildJc) then + begin + {self.}XmlChildJc := new PureWVal(self, {self.}Prefix, "jc"); + container_.Set({self.}XmlChildJc); + end + return {self.}XmlChildJc; +end; + +function TblPr.ReadXmlChildTblStyle(); +begin + if tslassigning and ifnil({self.}XmlChildTblStyle) then + begin + {self.}XmlChildTblStyle := new PureWVal(self, {self.}Prefix, "tblStyle"); + container_.Set({self.}XmlChildTblStyle); + end + return {self.}XmlChildTblStyle; +end; + +function TblPr.ReadXmlChildTblW(); +begin + if tslassigning and ifnil({self.}XmlChildTblW) then + begin + {self.}XmlChildTblW := new TblW(self, {self.}Prefix, "tblW"); + container_.Set({self.}XmlChildTblW); + end + return {self.}XmlChildTblW; +end; + +function TblPr.ReadXmlChildTblInd(); +begin + if tslassigning and ifnil({self.}XmlChildTblInd) then + begin + {self.}XmlChildTblInd := new TblW(self, {self.}Prefix, "tblInd"); + container_.Set({self.}XmlChildTblInd); + end + return {self.}XmlChildTblInd; +end; + +function TblPr.ReadXmlChildTblLayout(); +begin + if tslassigning and ifnil({self.}XmlChildTblLayout) then + begin + {self.}XmlChildTblLayout := new TblLayout(self, {self.}Prefix, "tblLayout"); + container_.Set({self.}XmlChildTblLayout); + end + return {self.}XmlChildTblLayout; +end; + +function TblPr.ReadXmlChildTblLook(); +begin + if tslassigning and ifnil({self.}XmlChildTblLook) then + begin + {self.}XmlChildTblLook := new TblLook(self, {self.}Prefix, "tblLook"); + container_.Set({self.}XmlChildTblLook); + end + return {self.}XmlChildTblLook; +end; + +function TblPr.ReadXmlChildTblBorders(); +begin + if tslassigning and ifnil({self.}XmlChildTblBorders) then + begin + {self.}XmlChildTblBorders := new TblBorders(self, {self.}Prefix, "tblBorders"); + container_.Set({self.}XmlChildTblBorders); + end + return {self.}XmlChildTblBorders; +end; + +function TblPr.ReadXmlChildTblCellMar(); +begin + if tslassigning and ifnil({self.}XmlChildTblCellMar) then + begin + {self.}XmlChildTblCellMar := new TblCellMar(self, {self.}Prefix, "tblCellMar"); + container_.Set({self.}XmlChildTblCellMar); + end + return {self.}XmlChildTblCellMar; end; diff --git a/autoclass/docx/TblStylePr@DOCX.tsf b/autoclass/docx/TblStylePr@DOCX.tsf index c8c862d..77b8a1d 100644 --- a/autoclass/docx/TblStylePr@DOCX.tsf +++ b/autoclass/docx/TblStylePr@DOCX.tsf @@ -4,24 +4,34 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: TblStylePr);override; +public + + // attributes property property Type read ReadXmlAttrType write WriteXmlAttrType; function ReadXmlAttrType(); function WriteXmlAttrType(_value); + // normal property + property PPr read ReadXmlChildPPr; + property TblPr read ReadXmlChildTblPr; + property TrPr read ReadXmlChildTrPr; + property TcPr read ReadXmlChildTcPr; + function ReadXmlChildPPr(); + function ReadXmlChildTblPr(); + function ReadXmlChildTrPr(); + function ReadXmlChildTcPr(); + public - // Attributes + // Attributes XmlAttrType: OpenXmlAttribute; // Children - PPr: PPr; - TblPr: TblPr; - TrPr: TrPr; - TcPr: TcPr; + XmlChildPPr: PPr; + XmlChildTblPr: TblPr; + XmlChildTrPr: TrPr; + XmlChildTcPr: TcPr; end; @@ -37,88 +47,42 @@ end; function TblStylePr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function TblStylePr.Init();override; begin - {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); - {self.}PPr := new PPr(self, {self.}Prefix, "pPr"); - {self.}TblPr := new TblPr(self, {self.}Prefix, "tblPr"); - {self.}TrPr := new TrPr(self, {self.}Prefix, "trPr"); - {self.}TcPr := new TcPr(self, {self.}Prefix, "tcPr"); -end; - -function TblStylePr.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrType, - ); -end; - -function TblStylePr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}PPr, - 1: {self.}TblPr, - 2: {self.}TrPr, - 3: {self.}TcPr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "type": makeweakref(thisFunction(WriteXmlAttrType)), ); sorted_child_ := array( - "": -1, - {self.}PPr.ElementName: 0, - {self.}TblPr.ElementName: 1, - {self.}TrPr.ElementName: 2, - {self.}TcPr.ElementName: 3, + pre + "pPr": array(0, makeweakref(thisFunction(ReadXmlChildPPr))), + pre + "tblPr": array(1, makeweakref(thisFunction(ReadXmlChildTblPr))), + pre + "trPr": array(2, makeweakref(thisFunction(ReadXmlChildTrPr))), + pre + "tcPr": array(3, makeweakref(thisFunction(ReadXmlChildTcPr))), ); -end; - -function TblStylePr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function TblStylePr.Copy(_obj: TblStylePr);override; begin - if not ifnil(_obj.XmlAttrType.Value) then - {self.}XmlAttrType.Value := _obj.XmlAttrType.Value; - {self.}PPr.Copy(_obj.PPr); - {self.}TblPr.Copy(_obj.TblPr); - {self.}TrPr.Copy(_obj.TrPr); - {self.}TcPr.Copy(_obj.TcPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Type) then + {self.}Type := _obj.Type; + if not ifnil(_obj.XmlChildPPr) then + {self.}PPr.Copy(_obj.XmlChildPPr); + if not ifnil(_obj.XmlChildTblPr) then + {self.}TblPr.Copy(_obj.XmlChildTblPr); + if not ifnil(_obj.XmlChildTrPr) then + {self.}TrPr.Copy(_obj.XmlChildTrPr); + if not ifnil(_obj.XmlChildTcPr) then + {self.}TcPr.Copy(_obj.XmlChildTcPr); + tslassigning := tslassigning_backup; end; function TblStylePr.ReadXmlAttrType(); @@ -128,5 +92,50 @@ end; function TblStylePr.WriteXmlAttrType(_value); begin + if ifnil({self.}XmlAttrType) then + begin + {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); + attributes_[length(attributes_)] := {self.}XmlAttrType; + end {self.}XmlAttrType.Value := _value; end; + +function TblStylePr.ReadXmlChildPPr(); +begin + if tslassigning and ifnil({self.}XmlChildPPr) then + begin + {self.}XmlChildPPr := new PPr(self, {self.}Prefix, "pPr"); + container_.Set({self.}XmlChildPPr); + end + return {self.}XmlChildPPr; +end; + +function TblStylePr.ReadXmlChildTblPr(); +begin + if tslassigning and ifnil({self.}XmlChildTblPr) then + begin + {self.}XmlChildTblPr := new TblPr(self, {self.}Prefix, "tblPr"); + container_.Set({self.}XmlChildTblPr); + end + return {self.}XmlChildTblPr; +end; + +function TblStylePr.ReadXmlChildTrPr(); +begin + if tslassigning and ifnil({self.}XmlChildTrPr) then + begin + {self.}XmlChildTrPr := new TrPr(self, {self.}Prefix, "trPr"); + container_.Set({self.}XmlChildTrPr); + end + return {self.}XmlChildTrPr; +end; + +function TblStylePr.ReadXmlChildTcPr(); +begin + if tslassigning and ifnil({self.}XmlChildTcPr) then + begin + {self.}XmlChildTcPr := new TcPr(self, {self.}Prefix, "tcPr"); + container_.Set({self.}XmlChildTcPr); + end + return {self.}XmlChildTcPr; +end; diff --git a/autoclass/docx/TblW@DOCX.tsf b/autoclass/docx/TblW@DOCX.tsf index b800c7b..af157fb 100644 --- a/autoclass/docx/TblW@DOCX.tsf +++ b/autoclass/docx/TblW@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: TblW);override; +public + + // attributes property property W read ReadXmlAttrW write WriteXmlAttrW; property Type read ReadXmlAttrType write WriteXmlAttrType; function ReadXmlAttrW(); @@ -17,11 +17,10 @@ public function WriteXmlAttrType(_value); public - // Attributes + // Attributes XmlAttrW: OpenXmlAttribute; XmlAttrType: OpenXmlAttribute; - // Children end; @@ -37,45 +36,33 @@ end; function TblW.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function TblW.Init();override; begin - {self.}XmlAttrW := new OpenXmlAttribute({self.}Prefix, "w", nil); - {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); -end; - -function TblW.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrW, - {self.}XmlAttrType, - ); -end; - -function TblW.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "w": makeweakref(thisFunction(WriteXmlAttrW)), + pre + "type": makeweakref(thisFunction(WriteXmlAttrType)), ); sorted_child_ := array( - "": -1, ); -end; - -function TblW.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function TblW.Copy(_obj: TblW);override; begin - if not ifnil(_obj.XmlAttrW.Value) then - {self.}XmlAttrW.Value := _obj.XmlAttrW.Value; - if not ifnil(_obj.XmlAttrType.Value) then - {self.}XmlAttrType.Value := _obj.XmlAttrType.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.W) then + {self.}W := _obj.W; + if not ifnil(_obj.Type) then + {self.}Type := _obj.Type; + tslassigning := tslassigning_backup; end; function TblW.ReadXmlAttrW(); @@ -85,6 +72,11 @@ end; function TblW.WriteXmlAttrW(_value); begin + if ifnil({self.}XmlAttrW) then + begin + {self.}XmlAttrW := new OpenXmlAttribute({self.}Prefix, "w", nil); + attributes_[length(attributes_)] := {self.}XmlAttrW; + end {self.}XmlAttrW.Value := _value; end; @@ -95,5 +87,10 @@ end; function TblW.WriteXmlAttrType(_value); begin + if ifnil({self.}XmlAttrType) then + begin + {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); + attributes_[length(attributes_)] := {self.}XmlAttrType; + end {self.}XmlAttrType.Value := _value; end; diff --git a/autoclass/docx/Tc@DOCX.tsf b/autoclass/docx/Tc@DOCX.tsf index 7c6eabd..e638c4c 100644 --- a/autoclass/docx/Tc@DOCX.tsf +++ b/autoclass/docx/Tc@DOCX.tsf @@ -4,25 +4,27 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Tc);override; + +public + + // normal property + property TcPr read ReadXmlChildTcPr; + function ReadXmlChildTcPr(); + + // multi property + property Ps read ReadPs; + property Tbls read ReadTbls; + function ReadPs(_index); + function ReadTbls(_index); function AddP(): P; function AddTbl(): Tbl; function AppendP(): P; function AppendTbl(): Tbl; - property Ps read ReadPs; - property Tbls read ReadTbls; - function ReadPs(_index); - function ReadTbls(_index); - public - // Attributes - // Children - TcPr: TcPr; + XmlChildTcPr: TcPr; end; @@ -38,144 +40,82 @@ end; function Tc.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Tc.Init();override; begin - {self.}TcPr := new TcPr(self, {self.}Prefix, "tcPr"); -end; - -function Tc.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Tc.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}TcPr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}TcPr.ElementName: 0, + pre + "tcPr": array(0, makeweakref(thisFunction(ReadXmlChildTcPr))), + pre + "p": array(1, makeweakref(thisFunction(AppendP))), + pre + "tbl": array(2, makeweakref(thisFunction(AppendTbl))), ); -end; - -function Tc.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "p": obj := {self.}AppendP(); - pre + "tbl": obj := {self.}AppendTbl(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Tc.Copy(_obj: Tc);override; begin - {self.}TcPr.Copy(_obj.TcPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildTcPr) then + {self.}TcPr.Copy(_obj.XmlChildTcPr); + tslassigning := tslassigning_backup; +end; + +function Tc.ReadXmlChildTcPr(); +begin + if tslassigning and ifnil({self.}XmlChildTcPr) then + begin + {self.}XmlChildTcPr := new TcPr(self, {self.}Prefix, "tcPr"); + container_.Set({self.}XmlChildTcPr); + end + return {self.}XmlChildTcPr; +end; + +function Tc.ReadPs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "p", ind); +end; + +function Tc.ReadTbls(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "tbl", ind); end; function Tc.AddP(): P; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "p" then break; - end obj := new P(self, {self.}Prefix, "p"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function Tc.AddTbl(): Tbl; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "tbl" then break; - end obj := new Tbl(self, {self.}Prefix, "tbl"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function Tc.AppendP(): P; begin obj := new P(self, {self.}Prefix, "p"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; function Tc.AppendTbl(): Tbl; begin obj := new Tbl(self, {self.}Prefix, "tbl"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function Tc.ReadPs(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "p" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; - -function Tc.ReadTbls(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "tbl" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; diff --git a/autoclass/docx/TcPr@DOCX.tsf b/autoclass/docx/TcPr@DOCX.tsf index 9d3e9f5..1ce95aa 100644 --- a/autoclass/docx/TcPr@DOCX.tsf +++ b/autoclass/docx/TcPr@DOCX.tsf @@ -4,24 +4,32 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: TcPr);override; +public + + // empty property property VMerge read ReadXmlChildVMerge write WriteXmlChildVMerge; function ReadXmlChildVMerge(); function WriteXmlChildVMerge(_value); -public - // Attributes + // normal property + property TcW read ReadXmlChildTcW; + property GridSpan read ReadXmlChildGridSpan; + property VAlign read ReadXmlChildVAlign; + property Shd read ReadXmlChildShd; + function ReadXmlChildTcW(); + function ReadXmlChildGridSpan(); + function ReadXmlChildVAlign(); + function ReadXmlChildShd(); +public // Children - TcW: TblW; - GridSpan: GridSpan; + XmlChildTcW: TblW; + XmlChildGridSpan: GridSpan; XmlChildVMerge: OpenXmlEmpty; - VAlign: PureWVal; - Shd: Shd; + XmlChildVAlign: PureWVal; + XmlChildShd: Shd; end; @@ -37,96 +45,101 @@ end; function TcPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function TcPr.Init();override; begin - {self.}TcW := new TblW(self, {self.}Prefix, "tcW"); - {self.}GridSpan := new GridSpan(self, {self.}Prefix, "gridSpan"); - {self.}XmlChildVMerge := new OpenXmlEmpty(self, {self.}Prefix, "vMerge"); - {self.}VAlign := new PureWVal(self, {self.}Prefix, "vAlign"); - {self.}Shd := new Shd(self, {self.}Prefix, "shd"); -end; - -function TcPr.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function TcPr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}TcW, - 1: {self.}GridSpan, - 2: {self.}XmlChildVMerge, - 3: {self.}VAlign, - 4: {self.}Shd, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}TcW.ElementName: 0, - {self.}GridSpan.ElementName: 1, - {self.}XmlChildVMerge.ElementName: 2, - {self.}VAlign.ElementName: 3, - {self.}Shd.ElementName: 4, + pre + "tcW": array(0, makeweakref(thisFunction(ReadXmlChildTcW))), + pre + "gridSpan": array(1, makeweakref(thisFunction(ReadXmlChildGridSpan))), + pre + "vMerge": array(2, makeweakref(thisFunction(ReadXmlChildVMerge))), + pre + "vAlign": array(3, makeweakref(thisFunction(ReadXmlChildVAlign))), + pre + "shd": array(4, makeweakref(thisFunction(ReadXmlChildShd))), ); -end; - -function TcPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function TcPr.Copy(_obj: TcPr);override; begin - {self.}TcW.Copy(_obj.TcW); - {self.}GridSpan.Copy(_obj.GridSpan); - {self.}XmlChildVMerge.Copy(_obj.XmlChildVMerge); - {self.}VAlign.Copy(_obj.VAlign); - {self.}Shd.Copy(_obj.Shd); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildTcW) then + {self.}TcW.Copy(_obj.XmlChildTcW); + if not ifnil(_obj.XmlChildGridSpan) then + {self.}GridSpan.Copy(_obj.XmlChildGridSpan); + if not ifnil(_obj.XmlChildVMerge) then + ifnil({self.}XmlChildVMerge) ? {self.}VMerge.Copy(_obj.XmlChildVMerge) : {self.}XmlChildVMerge.Copy(_obj.XmlChildVMerge); + if not ifnil(_obj.XmlChildVAlign) then + {self.}VAlign.Copy(_obj.XmlChildVAlign); + if not ifnil(_obj.XmlChildShd) then + {self.}Shd.Copy(_obj.XmlChildShd); + tslassigning := tslassigning_backup; end; function TcPr.ReadXmlChildVMerge(); begin - return ifnil({self.}XmlChildVMerge.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildVMerge) then + begin + {self.}XmlChildVMerge := new OpenXmlEmpty(self, {self.}Prefix, "vMerge"); + container_.Set({self.}XmlChildVMerge); + return {self.}XmlChildVMerge; + end + return {self.}XmlChildVMerge.BoolValue(); end; function TcPr.WriteXmlChildVMerge(_value); begin + if ifnil({self.}XmlChildVMerge) then + begin + {self.}XmlChildVMerge := new OpenXmlEmpty(self, {self.}Prefix, "vMerge"); + container_.Set({self.}XmlChildVMerge); + end {self.}XmlChildVMerge.Value := _value; end; + +function TcPr.ReadXmlChildTcW(); +begin + if tslassigning and ifnil({self.}XmlChildTcW) then + begin + {self.}XmlChildTcW := new TblW(self, {self.}Prefix, "tcW"); + container_.Set({self.}XmlChildTcW); + end + return {self.}XmlChildTcW; +end; + +function TcPr.ReadXmlChildGridSpan(); +begin + if tslassigning and ifnil({self.}XmlChildGridSpan) then + begin + {self.}XmlChildGridSpan := new GridSpan(self, {self.}Prefix, "gridSpan"); + container_.Set({self.}XmlChildGridSpan); + end + return {self.}XmlChildGridSpan; +end; + +function TcPr.ReadXmlChildVAlign(); +begin + if tslassigning and ifnil({self.}XmlChildVAlign) then + begin + {self.}XmlChildVAlign := new PureWVal(self, {self.}Prefix, "vAlign"); + container_.Set({self.}XmlChildVAlign); + end + return {self.}XmlChildVAlign; +end; + +function TcPr.ReadXmlChildShd(); +begin + if tslassigning and ifnil({self.}XmlChildShd) then + begin + {self.}XmlChildShd := new Shd(self, {self.}Prefix, "shd"); + container_.Set({self.}XmlChildShd); + end + return {self.}XmlChildShd; +end; diff --git a/autoclass/docx/Textbox@DOCX.tsf b/autoclass/docx/Textbox@DOCX.tsf index c2b0fb0..132c916 100644 --- a/autoclass/docx/Textbox@DOCX.tsf +++ b/autoclass/docx/Textbox@DOCX.tsf @@ -4,16 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Textbox);override; public - // Attributes + // normal property + property TxbxContent read ReadXmlChildTxbxContent; + function ReadXmlChildTxbxContent(); + +public // Children - TxbxContent: TxbxContent; + XmlChildTxbxContent: TxbxContent; end; @@ -29,70 +30,38 @@ end; function Textbox.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Textbox.Init();override; begin - {self.}TxbxContent := new TxbxContent(self, "w", "txbxContent"); -end; - -function Textbox.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Textbox.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}TxbxContent, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}TxbxContent.ElementName: 0, + "w:txbxContent": array(0, makeweakref(thisFunction(ReadXmlChildTxbxContent))), ); -end; - -function Textbox.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Textbox.Copy(_obj: Textbox);override; begin - {self.}TxbxContent.Copy(_obj.TxbxContent); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildTxbxContent) then + {self.}TxbxContent.Copy(_obj.XmlChildTxbxContent); + tslassigning := tslassigning_backup; +end; + +function Textbox.ReadXmlChildTxbxContent(); +begin + if tslassigning and ifnil({self.}XmlChildTxbxContent) then + begin + {self.}XmlChildTxbxContent := new TxbxContent(self, "w", "txbxContent"); + container_.Set({self.}XmlChildTxbxContent); + end + return {self.}XmlChildTxbxContent; end; diff --git a/autoclass/docx/Theme@DOCX.tsf b/autoclass/docx/Theme@DOCX.tsf index 90f4146..d03a914 100644 --- a/autoclass/docx/Theme@DOCX.tsf +++ b/autoclass/docx/Theme@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Theme);override; +public + + // attributes property property XmlnsA read ReadXmlAttrXmlnsA write WriteXmlAttrXmlnsA; property Name read ReadXmlAttrName write WriteXmlAttrName; function ReadXmlAttrXmlnsA(); @@ -16,6 +16,7 @@ public function ReadXmlAttrName(); function WriteXmlAttrName(_value); + // empty property property ObjectDefaults read ReadXmlChildObjectDefaults write WriteXmlChildObjectDefaults; property ExtraClrSchemeLst read ReadXmlChildExtraClrSchemeLst write WriteXmlChildExtraClrSchemeLst; function ReadXmlChildObjectDefaults(); @@ -23,16 +24,22 @@ public function ReadXmlChildExtraClrSchemeLst(); function WriteXmlChildExtraClrSchemeLst(_value); + // normal property + property ThemeElements read ReadXmlChildThemeElements; + property ExtLst read ReadXmlChildExtLst; + function ReadXmlChildThemeElements(); + function ReadXmlChildExtLst(); + public - // Attributes + // Attributes XmlAttrXmlnsA: OpenXmlAttribute; XmlAttrName: OpenXmlAttribute; // Children - ThemeElements: ThemeElements; + XmlChildThemeElements: ThemeElements; XmlChildObjectDefaults: OpenXmlEmpty; XmlChildExtraClrSchemeLst: OpenXmlEmpty; - ExtLst: ExtLst; + XmlChildExtLst: ExtLst; end; @@ -48,92 +55,45 @@ end; function Theme.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Theme.Init();override; begin - {self.}XmlAttrXmlnsA := new OpenXmlAttribute("xmlns", "a", nil); - {self.}XmlAttrName := new OpenXmlAttribute(nil, "name", nil); - {self.}ThemeElements := new ThemeElements(self, {self.}Prefix, "themeElements"); - {self.}XmlChildObjectDefaults := new OpenXmlEmpty(self, {self.}Prefix, "objectDefaults"); - {self.}XmlChildExtraClrSchemeLst := new OpenXmlEmpty(self, {self.}Prefix, "extraClrSchemeLst"); - {self.}ExtLst := new ExtLst(self, {self.}Prefix, "extLst"); -end; - -function Theme.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXmlnsA, - {self.}XmlAttrName, - ); -end; - -function Theme.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}ThemeElements, - 1: {self.}XmlChildObjectDefaults, - 2: {self.}XmlChildExtraClrSchemeLst, - 3: {self.}ExtLst, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns:a": makeweakref(thisFunction(WriteXmlAttrXmlnsA)), + "name": makeweakref(thisFunction(WriteXmlAttrName)), ); sorted_child_ := array( - "": -1, - {self.}ThemeElements.ElementName: 0, - {self.}XmlChildObjectDefaults.ElementName: 1, - {self.}XmlChildExtraClrSchemeLst.ElementName: 2, - {self.}ExtLst.ElementName: 3, + pre + "themeElements": array(0, makeweakref(thisFunction(ReadXmlChildThemeElements))), + pre + "objectDefaults": array(1, makeweakref(thisFunction(ReadXmlChildObjectDefaults))), + pre + "extraClrSchemeLst": array(2, makeweakref(thisFunction(ReadXmlChildExtraClrSchemeLst))), + pre + "extLst": array(3, makeweakref(thisFunction(ReadXmlChildExtLst))), ); -end; - -function Theme.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Theme.Copy(_obj: Theme);override; begin - if not ifnil(_obj.XmlAttrXmlnsA.Value) then - {self.}XmlAttrXmlnsA.Value := _obj.XmlAttrXmlnsA.Value; - if not ifnil(_obj.XmlAttrName.Value) then - {self.}XmlAttrName.Value := _obj.XmlAttrName.Value; - {self.}ThemeElements.Copy(_obj.ThemeElements); - {self.}XmlChildObjectDefaults.Copy(_obj.XmlChildObjectDefaults); - {self.}XmlChildExtraClrSchemeLst.Copy(_obj.XmlChildExtraClrSchemeLst); - {self.}ExtLst.Copy(_obj.ExtLst); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlnsA) then + {self.}XmlnsA := _obj.XmlnsA; + if not ifnil(_obj.Name) then + {self.}Name := _obj.Name; + if not ifnil(_obj.XmlChildThemeElements) then + {self.}ThemeElements.Copy(_obj.XmlChildThemeElements); + if not ifnil(_obj.XmlChildObjectDefaults) then + ifnil({self.}XmlChildObjectDefaults) ? {self.}ObjectDefaults.Copy(_obj.XmlChildObjectDefaults) : {self.}XmlChildObjectDefaults.Copy(_obj.XmlChildObjectDefaults); + if not ifnil(_obj.XmlChildExtraClrSchemeLst) then + ifnil({self.}XmlChildExtraClrSchemeLst) ? {self.}ExtraClrSchemeLst.Copy(_obj.XmlChildExtraClrSchemeLst) : {self.}XmlChildExtraClrSchemeLst.Copy(_obj.XmlChildExtraClrSchemeLst); + if not ifnil(_obj.XmlChildExtLst) then + {self.}ExtLst.Copy(_obj.XmlChildExtLst); + tslassigning := tslassigning_backup; end; function Theme.ReadXmlAttrXmlnsA(); @@ -143,6 +103,11 @@ end; function Theme.WriteXmlAttrXmlnsA(_value); begin + if ifnil({self.}XmlAttrXmlnsA) then + begin + {self.}XmlAttrXmlnsA := new OpenXmlAttribute("xmlns", "a", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsA; + end {self.}XmlAttrXmlnsA.Value := _value; end; @@ -153,25 +118,72 @@ end; function Theme.WriteXmlAttrName(_value); begin + if ifnil({self.}XmlAttrName) then + begin + {self.}XmlAttrName := new OpenXmlAttribute("", "name", nil); + attributes_[length(attributes_)] := {self.}XmlAttrName; + end {self.}XmlAttrName.Value := _value; end; function Theme.ReadXmlChildObjectDefaults(); begin - return ifnil({self.}XmlChildObjectDefaults.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildObjectDefaults) then + begin + {self.}XmlChildObjectDefaults := new OpenXmlEmpty(self, {self.}Prefix, "objectDefaults"); + container_.Set({self.}XmlChildObjectDefaults); + return {self.}XmlChildObjectDefaults; + end + return {self.}XmlChildObjectDefaults.BoolValue(); end; function Theme.WriteXmlChildObjectDefaults(_value); begin + if ifnil({self.}XmlChildObjectDefaults) then + begin + {self.}XmlChildObjectDefaults := new OpenXmlEmpty(self, {self.}Prefix, "objectDefaults"); + container_.Set({self.}XmlChildObjectDefaults); + end {self.}XmlChildObjectDefaults.Value := _value; end; function Theme.ReadXmlChildExtraClrSchemeLst(); begin - return ifnil({self.}XmlChildExtraClrSchemeLst.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildExtraClrSchemeLst) then + begin + {self.}XmlChildExtraClrSchemeLst := new OpenXmlEmpty(self, {self.}Prefix, "extraClrSchemeLst"); + container_.Set({self.}XmlChildExtraClrSchemeLst); + return {self.}XmlChildExtraClrSchemeLst; + end + return {self.}XmlChildExtraClrSchemeLst.BoolValue(); end; function Theme.WriteXmlChildExtraClrSchemeLst(_value); begin + if ifnil({self.}XmlChildExtraClrSchemeLst) then + begin + {self.}XmlChildExtraClrSchemeLst := new OpenXmlEmpty(self, {self.}Prefix, "extraClrSchemeLst"); + container_.Set({self.}XmlChildExtraClrSchemeLst); + end {self.}XmlChildExtraClrSchemeLst.Value := _value; end; + +function Theme.ReadXmlChildThemeElements(); +begin + if tslassigning and ifnil({self.}XmlChildThemeElements) then + begin + {self.}XmlChildThemeElements := new ThemeElements(self, {self.}Prefix, "themeElements"); + container_.Set({self.}XmlChildThemeElements); + end + return {self.}XmlChildThemeElements; +end; + +function Theme.ReadXmlChildExtLst(); +begin + if tslassigning and ifnil({self.}XmlChildExtLst) then + begin + {self.}XmlChildExtLst := new ExtLst(self, {self.}Prefix, "extLst"); + container_.Set({self.}XmlChildExtLst); + end + return {self.}XmlChildExtLst; +end; diff --git a/autoclass/docx/ThemeElements@DOCX.tsf b/autoclass/docx/ThemeElements@DOCX.tsf index 64a1fd0..aab2ad8 100644 --- a/autoclass/docx/ThemeElements@DOCX.tsf +++ b/autoclass/docx/ThemeElements@DOCX.tsf @@ -4,23 +4,31 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: ThemeElements);override; +public + + // attributes property property Name read ReadXmlAttrName write WriteXmlAttrName; function ReadXmlAttrName(); function WriteXmlAttrName(_value); + // normal property + property ClrScheme read ReadXmlChildClrScheme; + property FontScheme read ReadXmlChildFontScheme; + property FmtScheme read ReadXmlChildFmtScheme; + function ReadXmlChildClrScheme(); + function ReadXmlChildFontScheme(); + function ReadXmlChildFmtScheme(); + public - // Attributes + // Attributes XmlAttrName: OpenXmlAttribute; // Children - ClrScheme: ClrScheme; - FontScheme: FontScheme; - FmtScheme: FmtScheme; + XmlChildClrScheme: ClrScheme; + XmlChildFontScheme: FontScheme; + XmlChildFmtScheme: FmtScheme; end; @@ -36,84 +44,39 @@ end; function ThemeElements.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function ThemeElements.Init();override; begin - {self.}XmlAttrName := new OpenXmlAttribute(nil, "name", nil); - {self.}ClrScheme := new ClrScheme(self, {self.}Prefix, "clrScheme"); - {self.}FontScheme := new FontScheme(self, {self.}Prefix, "fontScheme"); - {self.}FmtScheme := new FmtScheme(self, {self.}Prefix, "fmtScheme"); -end; - -function ThemeElements.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrName, - ); -end; - -function ThemeElements.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}ClrScheme, - 1: {self.}FontScheme, - 2: {self.}FmtScheme, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "name": makeweakref(thisFunction(WriteXmlAttrName)), ); sorted_child_ := array( - "": -1, - {self.}ClrScheme.ElementName: 0, - {self.}FontScheme.ElementName: 1, - {self.}FmtScheme.ElementName: 2, + pre + "clrScheme": array(0, makeweakref(thisFunction(ReadXmlChildClrScheme))), + pre + "fontScheme": array(1, makeweakref(thisFunction(ReadXmlChildFontScheme))), + pre + "fmtScheme": array(2, makeweakref(thisFunction(ReadXmlChildFmtScheme))), ); -end; - -function ThemeElements.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function ThemeElements.Copy(_obj: ThemeElements);override; begin - if not ifnil(_obj.XmlAttrName.Value) then - {self.}XmlAttrName.Value := _obj.XmlAttrName.Value; - {self.}ClrScheme.Copy(_obj.ClrScheme); - {self.}FontScheme.Copy(_obj.FontScheme); - {self.}FmtScheme.Copy(_obj.FmtScheme); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Name) then + {self.}Name := _obj.Name; + if not ifnil(_obj.XmlChildClrScheme) then + {self.}ClrScheme.Copy(_obj.XmlChildClrScheme); + if not ifnil(_obj.XmlChildFontScheme) then + {self.}FontScheme.Copy(_obj.XmlChildFontScheme); + if not ifnil(_obj.XmlChildFmtScheme) then + {self.}FmtScheme.Copy(_obj.XmlChildFmtScheme); + tslassigning := tslassigning_backup; end; function ThemeElements.ReadXmlAttrName(); @@ -123,5 +86,40 @@ end; function ThemeElements.WriteXmlAttrName(_value); begin + if ifnil({self.}XmlAttrName) then + begin + {self.}XmlAttrName := new OpenXmlAttribute("", "name", nil); + attributes_[length(attributes_)] := {self.}XmlAttrName; + end {self.}XmlAttrName.Value := _value; end; + +function ThemeElements.ReadXmlChildClrScheme(); +begin + if tslassigning and ifnil({self.}XmlChildClrScheme) then + begin + {self.}XmlChildClrScheme := new ClrScheme(self, {self.}Prefix, "clrScheme"); + container_.Set({self.}XmlChildClrScheme); + end + return {self.}XmlChildClrScheme; +end; + +function ThemeElements.ReadXmlChildFontScheme(); +begin + if tslassigning and ifnil({self.}XmlChildFontScheme) then + begin + {self.}XmlChildFontScheme := new FontScheme(self, {self.}Prefix, "fontScheme"); + container_.Set({self.}XmlChildFontScheme); + end + return {self.}XmlChildFontScheme; +end; + +function ThemeElements.ReadXmlChildFmtScheme(); +begin + if tslassigning and ifnil({self.}XmlChildFmtScheme) then + begin + {self.}XmlChildFmtScheme := new FmtScheme(self, {self.}Prefix, "fmtScheme"); + container_.Set({self.}XmlChildFmtScheme); + end + return {self.}XmlChildFmtScheme; +end; diff --git a/autoclass/docx/ThemeFamily@DOCX.tsf b/autoclass/docx/ThemeFamily@DOCX.tsf index 9c7da1d..ab137f5 100644 --- a/autoclass/docx/ThemeFamily@DOCX.tsf +++ b/autoclass/docx/ThemeFamily@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: ThemeFamily);override; +public + + // attributes property property XmlnsThm15 read ReadXmlAttrXmlnsThm15 write WriteXmlAttrXmlnsThm15; property Name read ReadXmlAttrName write WriteXmlAttrName; property Id read ReadXmlAttrId write WriteXmlAttrId; @@ -23,13 +23,12 @@ public function WriteXmlAttrVid(_value); public - // Attributes + // Attributes XmlAttrXmlnsThm15: OpenXmlAttribute; XmlAttrName: OpenXmlAttribute; XmlAttrId: OpenXmlAttribute; XmlAttrVid: OpenXmlAttribute; - // Children end; @@ -45,53 +44,39 @@ end; function ThemeFamily.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function ThemeFamily.Init();override; begin - {self.}XmlAttrXmlnsThm15 := new OpenXmlAttribute("xmlns", "thm15", nil); - {self.}XmlAttrName := new OpenXmlAttribute(nil, "name", nil); - {self.}XmlAttrId := new OpenXmlAttribute(nil, "Id", nil); - {self.}XmlAttrVid := new OpenXmlAttribute(nil, "vid", nil); -end; - -function ThemeFamily.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXmlnsThm15, - {self.}XmlAttrName, - {self.}XmlAttrId, - {self.}XmlAttrVid, - ); -end; - -function ThemeFamily.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns:thm15": makeweakref(thisFunction(WriteXmlAttrXmlnsThm15)), + "name": makeweakref(thisFunction(WriteXmlAttrName)), + "Id": makeweakref(thisFunction(WriteXmlAttrId)), + "vid": makeweakref(thisFunction(WriteXmlAttrVid)), ); sorted_child_ := array( - "": -1, ); -end; - -function ThemeFamily.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function ThemeFamily.Copy(_obj: ThemeFamily);override; begin - if not ifnil(_obj.XmlAttrXmlnsThm15.Value) then - {self.}XmlAttrXmlnsThm15.Value := _obj.XmlAttrXmlnsThm15.Value; - if not ifnil(_obj.XmlAttrName.Value) then - {self.}XmlAttrName.Value := _obj.XmlAttrName.Value; - if not ifnil(_obj.XmlAttrId.Value) then - {self.}XmlAttrId.Value := _obj.XmlAttrId.Value; - if not ifnil(_obj.XmlAttrVid.Value) then - {self.}XmlAttrVid.Value := _obj.XmlAttrVid.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlnsThm15) then + {self.}XmlnsThm15 := _obj.XmlnsThm15; + if not ifnil(_obj.Name) then + {self.}Name := _obj.Name; + if not ifnil(_obj.Id) then + {self.}Id := _obj.Id; + if not ifnil(_obj.Vid) then + {self.}Vid := _obj.Vid; + tslassigning := tslassigning_backup; end; function ThemeFamily.ReadXmlAttrXmlnsThm15(); @@ -101,6 +86,11 @@ end; function ThemeFamily.WriteXmlAttrXmlnsThm15(_value); begin + if ifnil({self.}XmlAttrXmlnsThm15) then + begin + {self.}XmlAttrXmlnsThm15 := new OpenXmlAttribute("xmlns", "thm15", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsThm15; + end {self.}XmlAttrXmlnsThm15.Value := _value; end; @@ -111,6 +101,11 @@ end; function ThemeFamily.WriteXmlAttrName(_value); begin + if ifnil({self.}XmlAttrName) then + begin + {self.}XmlAttrName := new OpenXmlAttribute("", "name", nil); + attributes_[length(attributes_)] := {self.}XmlAttrName; + end {self.}XmlAttrName.Value := _value; end; @@ -121,6 +116,11 @@ end; function ThemeFamily.WriteXmlAttrId(_value); begin + if ifnil({self.}XmlAttrId) then + begin + {self.}XmlAttrId := new OpenXmlAttribute("", "Id", nil); + attributes_[length(attributes_)] := {self.}XmlAttrId; + end {self.}XmlAttrId.Value := _value; end; @@ -131,5 +131,10 @@ end; function ThemeFamily.WriteXmlAttrVid(_value); begin + if ifnil({self.}XmlAttrVid) then + begin + {self.}XmlAttrVid := new OpenXmlAttribute("", "vid", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVid; + end {self.}XmlAttrVid.Value := _value; end; diff --git a/autoclass/docx/ThemeFontLang@DOCX.tsf b/autoclass/docx/ThemeFontLang@DOCX.tsf index e2f6190..752ddc2 100644 --- a/autoclass/docx/ThemeFontLang@DOCX.tsf +++ b/autoclass/docx/ThemeFontLang@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: ThemeFontLang);override; +public + + // attributes property property Val read ReadXmlAttrVal write WriteXmlAttrVal; property EastAsia read ReadXmlAttrEastAsia write WriteXmlAttrEastAsia; function ReadXmlAttrVal(); @@ -17,11 +17,10 @@ public function WriteXmlAttrEastAsia(_value); public - // Attributes + // Attributes XmlAttrVal: OpenXmlAttribute; XmlAttrEastAsia: OpenXmlAttribute; - // Children end; @@ -37,45 +36,33 @@ end; function ThemeFontLang.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function ThemeFontLang.Init();override; begin - {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); - {self.}XmlAttrEastAsia := new OpenXmlAttribute({self.}Prefix, "eastAsia", nil); -end; - -function ThemeFontLang.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrVal, - {self.}XmlAttrEastAsia, - ); -end; - -function ThemeFontLang.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "val": makeweakref(thisFunction(WriteXmlAttrVal)), + pre + "eastAsia": makeweakref(thisFunction(WriteXmlAttrEastAsia)), ); sorted_child_ := array( - "": -1, ); -end; - -function ThemeFontLang.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function ThemeFontLang.Copy(_obj: ThemeFontLang);override; begin - if not ifnil(_obj.XmlAttrVal.Value) then - {self.}XmlAttrVal.Value := _obj.XmlAttrVal.Value; - if not ifnil(_obj.XmlAttrEastAsia.Value) then - {self.}XmlAttrEastAsia.Value := _obj.XmlAttrEastAsia.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Val) then + {self.}Val := _obj.Val; + if not ifnil(_obj.EastAsia) then + {self.}EastAsia := _obj.EastAsia; + tslassigning := tslassigning_backup; end; function ThemeFontLang.ReadXmlAttrVal(); @@ -85,6 +72,11 @@ end; function ThemeFontLang.WriteXmlAttrVal(_value); begin + if ifnil({self.}XmlAttrVal) then + begin + {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); + attributes_[length(attributes_)] := {self.}XmlAttrVal; + end {self.}XmlAttrVal.Value := _value; end; @@ -95,5 +87,10 @@ end; function ThemeFontLang.WriteXmlAttrEastAsia(_value); begin + if ifnil({self.}XmlAttrEastAsia) then + begin + {self.}XmlAttrEastAsia := new OpenXmlAttribute({self.}Prefix, "eastAsia", nil); + attributes_[length(attributes_)] := {self.}XmlAttrEastAsia; + end {self.}XmlAttrEastAsia.Value := _value; end; diff --git a/autoclass/docx/Title@DOCX.tsf b/autoclass/docx/Title@DOCX.tsf index c8570cb..1447eb8 100644 --- a/autoclass/docx/Title@DOCX.tsf +++ b/autoclass/docx/Title@DOCX.tsf @@ -4,22 +4,26 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Title);override; +public + + // empty property property Layout read ReadXmlChildLayout write WriteXmlChildLayout; function ReadXmlChildLayout(); function WriteXmlChildLayout(_value); -public - // Attributes + // normal property + property Tx read ReadXmlChildTx; + property Overlay read ReadXmlChildOverlay; + function ReadXmlChildTx(); + function ReadXmlChildOverlay(); +public // Children - Tx: Tx; + XmlChildTx: Tx; XmlChildLayout: OpenXmlEmpty; - Overlay: PureVal; + XmlChildOverlay: PureVal; end; @@ -35,88 +39,75 @@ end; function Title.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Title.Init();override; begin - {self.}Tx := new Tx(self, {self.}Prefix, "tx"); - {self.}XmlChildLayout := new OpenXmlEmpty(self, {self.}Prefix, "layout"); - {self.}Overlay := new PureVal(self, {self.}Prefix, "overlay"); -end; - -function Title.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Title.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Tx, - 1: {self.}XmlChildLayout, - 2: {self.}Overlay, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}Tx.ElementName: 0, - {self.}XmlChildLayout.ElementName: 1, - {self.}Overlay.ElementName: 2, + pre + "tx": array(0, makeweakref(thisFunction(ReadXmlChildTx))), + pre + "layout": array(1, makeweakref(thisFunction(ReadXmlChildLayout))), + pre + "overlay": array(2, makeweakref(thisFunction(ReadXmlChildOverlay))), ); -end; - -function Title.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Title.Copy(_obj: Title);override; begin - {self.}Tx.Copy(_obj.Tx); - {self.}XmlChildLayout.Copy(_obj.XmlChildLayout); - {self.}Overlay.Copy(_obj.Overlay); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildTx) then + {self.}Tx.Copy(_obj.XmlChildTx); + if not ifnil(_obj.XmlChildLayout) then + ifnil({self.}XmlChildLayout) ? {self.}Layout.Copy(_obj.XmlChildLayout) : {self.}XmlChildLayout.Copy(_obj.XmlChildLayout); + if not ifnil(_obj.XmlChildOverlay) then + {self.}Overlay.Copy(_obj.XmlChildOverlay); + tslassigning := tslassigning_backup; end; function Title.ReadXmlChildLayout(); begin - return ifnil({self.}XmlChildLayout.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildLayout) then + begin + {self.}XmlChildLayout := new OpenXmlEmpty(self, {self.}Prefix, "layout"); + container_.Set({self.}XmlChildLayout); + return {self.}XmlChildLayout; + end + return {self.}XmlChildLayout.BoolValue(); end; function Title.WriteXmlChildLayout(_value); begin + if ifnil({self.}XmlChildLayout) then + begin + {self.}XmlChildLayout := new OpenXmlEmpty(self, {self.}Prefix, "layout"); + container_.Set({self.}XmlChildLayout); + end {self.}XmlChildLayout.Value := _value; end; + +function Title.ReadXmlChildTx(); +begin + if tslassigning and ifnil({self.}XmlChildTx) then + begin + {self.}XmlChildTx := new Tx(self, {self.}Prefix, "tx"); + container_.Set({self.}XmlChildTx); + end + return {self.}XmlChildTx; +end; + +function Title.ReadXmlChildOverlay(); +begin + if tslassigning and ifnil({self.}XmlChildOverlay) then + begin + {self.}XmlChildOverlay := new PureVal(self, {self.}Prefix, "overlay"); + container_.Set({self.}XmlChildOverlay); + end + return {self.}XmlChildOverlay; +end; diff --git a/autoclass/docx/Tr@DOCX.tsf b/autoclass/docx/Tr@DOCX.tsf index 62fb13b..d3a7c94 100644 --- a/autoclass/docx/Tr@DOCX.tsf +++ b/autoclass/docx/Tr@DOCX.tsf @@ -4,16 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Tr);override; - function AddTc(): Tc; - function AppendTc(): Tc; - property Tcs read ReadTcs; - function ReadTcs(_index); +public + // attributes property property WRsidR read ReadXmlAttrWRsidR write WriteXmlAttrWRsidR; property W14ParaId read ReadXmlAttrW14ParaId write WriteXmlAttrW14ParaId; property W14TextId read ReadXmlAttrW14TextId write WriteXmlAttrW14TextId; @@ -27,15 +22,25 @@ public function ReadXmlAttrWRsidTr(); function WriteXmlAttrWRsidTr(_value); + // normal property + property TrPr read ReadXmlChildTrPr; + function ReadXmlChildTrPr(); + + // multi property + property Tcs read ReadTcs; + function ReadTcs(_index); + function AddTc(): Tc; + function AppendTc(): Tc; + public - // Attributes + // Attributes XmlAttrWRsidR: OpenXmlAttribute; XmlAttrW14ParaId: OpenXmlAttribute; XmlAttrW14TextId: OpenXmlAttribute; XmlAttrWRsidTr: OpenXmlAttribute; // Children - TrPr: TrPr; + XmlChildTrPr: TrPr; end; @@ -51,125 +56,43 @@ end; function Tr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Tr.Init();override; begin - {self.}XmlAttrWRsidR := new OpenXmlAttribute("w", "rsidR", nil); - {self.}XmlAttrW14ParaId := new OpenXmlAttribute("w14", "paraId", nil); - {self.}XmlAttrW14TextId := new OpenXmlAttribute("w14", "textId", nil); - {self.}XmlAttrWRsidTr := new OpenXmlAttribute("w", "rsidTr", nil); - {self.}TrPr := new TrPr(self, {self.}Prefix, "trPr"); -end; - -function Tr.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrWRsidR, - {self.}XmlAttrW14ParaId, - {self.}XmlAttrW14TextId, - {self.}XmlAttrWRsidTr, - ); -end; - -function Tr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}TrPr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "w:rsidR": makeweakref(thisFunction(WriteXmlAttrWRsidR)), + "w14:paraId": makeweakref(thisFunction(WriteXmlAttrW14ParaId)), + "w14:textId": makeweakref(thisFunction(WriteXmlAttrW14TextId)), + "w:rsidTr": makeweakref(thisFunction(WriteXmlAttrWRsidTr)), ); sorted_child_ := array( - "": -1, - {self.}TrPr.ElementName: 0, + pre + "trPr": array(0, makeweakref(thisFunction(ReadXmlChildTrPr))), + pre + "tc": array(1, makeweakref(thisFunction(AppendTc))), ); -end; - -function Tr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "tc": obj := {self.}AppendTc(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Tr.Copy(_obj: Tr);override; begin - if not ifnil(_obj.XmlAttrWRsidR.Value) then - {self.}XmlAttrWRsidR.Value := _obj.XmlAttrWRsidR.Value; - if not ifnil(_obj.XmlAttrW14ParaId.Value) then - {self.}XmlAttrW14ParaId.Value := _obj.XmlAttrW14ParaId.Value; - if not ifnil(_obj.XmlAttrW14TextId.Value) then - {self.}XmlAttrW14TextId.Value := _obj.XmlAttrW14TextId.Value; - if not ifnil(_obj.XmlAttrWRsidTr.Value) then - {self.}XmlAttrWRsidTr.Value := _obj.XmlAttrWRsidTr.Value; - {self.}TrPr.Copy(_obj.TrPr); -end; - -function Tr.AddTc(): Tc; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "tc" then break; - end - obj := new Tc(self, {self.}Prefix, "tc"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function Tr.AppendTc(): Tc; -begin - obj := new Tc(self, {self.}Prefix, "tc"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function Tr.ReadTcs(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "tc" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.WRsidR) then + {self.}WRsidR := _obj.WRsidR; + if not ifnil(_obj.W14ParaId) then + {self.}W14ParaId := _obj.W14ParaId; + if not ifnil(_obj.W14TextId) then + {self.}W14TextId := _obj.W14TextId; + if not ifnil(_obj.WRsidTr) then + {self.}WRsidTr := _obj.WRsidTr; + if not ifnil(_obj.XmlChildTrPr) then + {self.}TrPr.Copy(_obj.XmlChildTrPr); + tslassigning := tslassigning_backup; end; function Tr.ReadXmlAttrWRsidR(); @@ -179,6 +102,11 @@ end; function Tr.WriteXmlAttrWRsidR(_value); begin + if ifnil({self.}XmlAttrWRsidR) then + begin + {self.}XmlAttrWRsidR := new OpenXmlAttribute("w", "rsidR", nil); + attributes_[length(attributes_)] := {self.}XmlAttrWRsidR; + end {self.}XmlAttrWRsidR.Value := _value; end; @@ -189,6 +117,11 @@ end; function Tr.WriteXmlAttrW14ParaId(_value); begin + if ifnil({self.}XmlAttrW14ParaId) then + begin + {self.}XmlAttrW14ParaId := new OpenXmlAttribute("w14", "paraId", nil); + attributes_[length(attributes_)] := {self.}XmlAttrW14ParaId; + end {self.}XmlAttrW14ParaId.Value := _value; end; @@ -199,6 +132,11 @@ end; function Tr.WriteXmlAttrW14TextId(_value); begin + if ifnil({self.}XmlAttrW14TextId) then + begin + {self.}XmlAttrW14TextId := new OpenXmlAttribute("w14", "textId", nil); + attributes_[length(attributes_)] := {self.}XmlAttrW14TextId; + end {self.}XmlAttrW14TextId.Value := _value; end; @@ -209,5 +147,41 @@ end; function Tr.WriteXmlAttrWRsidTr(_value); begin + if ifnil({self.}XmlAttrWRsidTr) then + begin + {self.}XmlAttrWRsidTr := new OpenXmlAttribute("w", "rsidTr", nil); + attributes_[length(attributes_)] := {self.}XmlAttrWRsidTr; + end {self.}XmlAttrWRsidTr.Value := _value; end; + +function Tr.ReadXmlChildTrPr(); +begin + if tslassigning and ifnil({self.}XmlChildTrPr) then + begin + {self.}XmlChildTrPr := new TrPr(self, {self.}Prefix, "trPr"); + container_.Set({self.}XmlChildTrPr); + end + return {self.}XmlChildTrPr; +end; + +function Tr.ReadTcs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "tc", ind); +end; + +function Tr.AddTc(): Tc; +begin + obj := new Tc(self, {self.}Prefix, "tc"); + container_.Insert(obj); + return obj; +end; + +function Tr.AppendTc(): Tc; +begin + obj := new Tc(self, {self.}Prefix, "tc"); + container_.Append(obj); + return obj; +end; diff --git a/autoclass/docx/TrHeight@DOCX.tsf b/autoclass/docx/TrHeight@DOCX.tsf index 132f140..2dec54e 100644 --- a/autoclass/docx/TrHeight@DOCX.tsf +++ b/autoclass/docx/TrHeight@DOCX.tsf @@ -4,20 +4,19 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: TrHeight);override; +public + + // attributes property property val read ReadXmlAttrval write WriteXmlAttrval; function ReadXmlAttrval(); function WriteXmlAttrval(_value); public - // Attributes + // Attributes XmlAttrval: OpenXmlAttribute; - // Children end; @@ -33,41 +32,30 @@ end; function TrHeight.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function TrHeight.Init();override; begin - {self.}XmlAttrval := new OpenXmlAttribute({self.}Prefix, "val", nil); -end; - -function TrHeight.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrval, - ); -end; - -function TrHeight.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "val": makeweakref(thisFunction(WriteXmlAttrval)), ); sorted_child_ := array( - "": -1, ); -end; - -function TrHeight.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function TrHeight.Copy(_obj: TrHeight);override; begin - if not ifnil(_obj.XmlAttrval.Value) then - {self.}XmlAttrval.Value := _obj.XmlAttrval.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.val) then + {self.}val := _obj.val; + tslassigning := tslassigning_backup; end; function TrHeight.ReadXmlAttrval(); @@ -77,5 +65,10 @@ end; function TrHeight.WriteXmlAttrval(_value); begin + if ifnil({self.}XmlAttrval) then + begin + {self.}XmlAttrval := new OpenXmlAttribute({self.}Prefix, "val", nil); + attributes_[length(attributes_)] := {self.}XmlAttrval; + end {self.}XmlAttrval.Value := _value; end; diff --git a/autoclass/docx/TrPr@DOCX.tsf b/autoclass/docx/TrPr@DOCX.tsf index 8883175..4aa92aa 100644 --- a/autoclass/docx/TrPr@DOCX.tsf +++ b/autoclass/docx/TrPr@DOCX.tsf @@ -4,24 +4,32 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: TrPr);override; +public + + // empty property property CantSplit read ReadXmlChildCantSplit write WriteXmlChildCantSplit; function ReadXmlChildCantSplit(); function WriteXmlChildCantSplit(_value); -public - // Attributes + // normal property + property TrHeight read ReadXmlChildTrHeight; + property TblHeader read ReadXmlChildTblHeader; + property Jc read ReadXmlChildJc; + property CnfStyle read ReadXmlChildCnfStyle; + function ReadXmlChildTrHeight(); + function ReadXmlChildTblHeader(); + function ReadXmlChildJc(); + function ReadXmlChildCnfStyle(); +public // Children - TrHeight: TrHeight; - TblHeader: PureWVal; - Jc: PureWVal; + XmlChildTrHeight: TrHeight; + XmlChildTblHeader: PureWVal; + XmlChildJc: PureWVal; XmlChildCantSplit: OpenXmlEmpty; - CnfStyle: CnfStyle; + XmlChildCnfStyle: CnfStyle; end; @@ -37,96 +45,101 @@ end; function TrPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function TrPr.Init();override; begin - {self.}TrHeight := new TrHeight(self, {self.}Prefix, "trHeight"); - {self.}TblHeader := new PureWVal(self, {self.}Prefix, "tblHeader"); - {self.}Jc := new PureWVal(self, {self.}Prefix, "jc"); - {self.}XmlChildCantSplit := new OpenXmlEmpty(self, {self.}Prefix, "cantSplit"); - {self.}CnfStyle := new CnfStyle(self, {self.}Prefix, "cnfStyle"); -end; - -function TrPr.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function TrPr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}TrHeight, - 1: {self.}TblHeader, - 2: {self.}Jc, - 3: {self.}XmlChildCantSplit, - 4: {self.}CnfStyle, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}TrHeight.ElementName: 0, - {self.}TblHeader.ElementName: 1, - {self.}Jc.ElementName: 2, - {self.}XmlChildCantSplit.ElementName: 3, - {self.}CnfStyle.ElementName: 4, + pre + "trHeight": array(0, makeweakref(thisFunction(ReadXmlChildTrHeight))), + pre + "tblHeader": array(1, makeweakref(thisFunction(ReadXmlChildTblHeader))), + pre + "jc": array(2, makeweakref(thisFunction(ReadXmlChildJc))), + pre + "cantSplit": array(3, makeweakref(thisFunction(ReadXmlChildCantSplit))), + pre + "cnfStyle": array(4, makeweakref(thisFunction(ReadXmlChildCnfStyle))), ); -end; - -function TrPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function TrPr.Copy(_obj: TrPr);override; begin - {self.}TrHeight.Copy(_obj.TrHeight); - {self.}TblHeader.Copy(_obj.TblHeader); - {self.}Jc.Copy(_obj.Jc); - {self.}XmlChildCantSplit.Copy(_obj.XmlChildCantSplit); - {self.}CnfStyle.Copy(_obj.CnfStyle); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildTrHeight) then + {self.}TrHeight.Copy(_obj.XmlChildTrHeight); + if not ifnil(_obj.XmlChildTblHeader) then + {self.}TblHeader.Copy(_obj.XmlChildTblHeader); + if not ifnil(_obj.XmlChildJc) then + {self.}Jc.Copy(_obj.XmlChildJc); + if not ifnil(_obj.XmlChildCantSplit) then + ifnil({self.}XmlChildCantSplit) ? {self.}CantSplit.Copy(_obj.XmlChildCantSplit) : {self.}XmlChildCantSplit.Copy(_obj.XmlChildCantSplit); + if not ifnil(_obj.XmlChildCnfStyle) then + {self.}CnfStyle.Copy(_obj.XmlChildCnfStyle); + tslassigning := tslassigning_backup; end; function TrPr.ReadXmlChildCantSplit(); begin - return ifnil({self.}XmlChildCantSplit.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildCantSplit) then + begin + {self.}XmlChildCantSplit := new OpenXmlEmpty(self, {self.}Prefix, "cantSplit"); + container_.Set({self.}XmlChildCantSplit); + return {self.}XmlChildCantSplit; + end + return {self.}XmlChildCantSplit.BoolValue(); end; function TrPr.WriteXmlChildCantSplit(_value); begin + if ifnil({self.}XmlChildCantSplit) then + begin + {self.}XmlChildCantSplit := new OpenXmlEmpty(self, {self.}Prefix, "cantSplit"); + container_.Set({self.}XmlChildCantSplit); + end {self.}XmlChildCantSplit.Value := _value; end; + +function TrPr.ReadXmlChildTrHeight(); +begin + if tslassigning and ifnil({self.}XmlChildTrHeight) then + begin + {self.}XmlChildTrHeight := new TrHeight(self, {self.}Prefix, "trHeight"); + container_.Set({self.}XmlChildTrHeight); + end + return {self.}XmlChildTrHeight; +end; + +function TrPr.ReadXmlChildTblHeader(); +begin + if tslassigning and ifnil({self.}XmlChildTblHeader) then + begin + {self.}XmlChildTblHeader := new PureWVal(self, {self.}Prefix, "tblHeader"); + container_.Set({self.}XmlChildTblHeader); + end + return {self.}XmlChildTblHeader; +end; + +function TrPr.ReadXmlChildJc(); +begin + if tslassigning and ifnil({self.}XmlChildJc) then + begin + {self.}XmlChildJc := new PureWVal(self, {self.}Prefix, "jc"); + container_.Set({self.}XmlChildJc); + end + return {self.}XmlChildJc; +end; + +function TrPr.ReadXmlChildCnfStyle(); +begin + if tslassigning and ifnil({self.}XmlChildCnfStyle) then + begin + {self.}XmlChildCnfStyle := new CnfStyle(self, {self.}Prefix, "cnfStyle"); + container_.Set({self.}XmlChildCnfStyle); + end + return {self.}XmlChildCnfStyle; +end; diff --git a/autoclass/docx/Tx@DOCX.tsf b/autoclass/docx/Tx@DOCX.tsf index e1e3e94..3e09e25 100644 --- a/autoclass/docx/Tx@DOCX.tsf +++ b/autoclass/docx/Tx@DOCX.tsf @@ -4,17 +4,20 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Tx);override; public - // Attributes + // normal property + property StrRef read ReadXmlChildStrRef; + property Rich read ReadXmlChildRich; + function ReadXmlChildStrRef(); + function ReadXmlChildRich(); + +public // Children - StrRef: StrRef; - Rich: Rich; + XmlChildStrRef: StrRef; + XmlChildRich: Rich; end; @@ -30,74 +33,51 @@ end; function Tx.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Tx.Init();override; begin - {self.}StrRef := new StrRef(self, {self.}Prefix, "strRef"); - {self.}Rich := new Rich(self, {self.}Prefix, "rich"); -end; - -function Tx.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Tx.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}StrRef, - 1: {self.}Rich, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}StrRef.ElementName: 0, - {self.}Rich.ElementName: 1, + pre + "strRef": array(0, makeweakref(thisFunction(ReadXmlChildStrRef))), + pre + "rich": array(1, makeweakref(thisFunction(ReadXmlChildRich))), ); -end; - -function Tx.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Tx.Copy(_obj: Tx);override; begin - {self.}StrRef.Copy(_obj.StrRef); - {self.}Rich.Copy(_obj.Rich); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildStrRef) then + {self.}StrRef.Copy(_obj.XmlChildStrRef); + if not ifnil(_obj.XmlChildRich) then + {self.}Rich.Copy(_obj.XmlChildRich); + tslassigning := tslassigning_backup; +end; + +function Tx.ReadXmlChildStrRef(); +begin + if tslassigning and ifnil({self.}XmlChildStrRef) then + begin + {self.}XmlChildStrRef := new StrRef(self, {self.}Prefix, "strRef"); + container_.Set({self.}XmlChildStrRef); + end + return {self.}XmlChildStrRef; +end; + +function Tx.ReadXmlChildRich(); +begin + if tslassigning and ifnil({self.}XmlChildRich) then + begin + {self.}XmlChildRich := new Rich(self, {self.}Prefix, "rich"); + container_.Set({self.}XmlChildRich); + end + return {self.}XmlChildRich; end; diff --git a/autoclass/docx/TxPr@DOCX.tsf b/autoclass/docx/TxPr@DOCX.tsf index 0239b1d..8bdffc6 100644 --- a/autoclass/docx/TxPr@DOCX.tsf +++ b/autoclass/docx/TxPr@DOCX.tsf @@ -4,25 +4,28 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: TxPr);override; - function AddP(): Ap; - function AppendP(): Ap; - property Ps read ReadPs; - function ReadPs(_index); +public + // empty property property LstStyle read ReadXmlChildLstStyle write WriteXmlChildLstStyle; function ReadXmlChildLstStyle(); function WriteXmlChildLstStyle(_value); -public - // Attributes + // normal property + property BodyPr read ReadXmlChildBodyPr; + function ReadXmlChildBodyPr(); + // multi property + property Ps read ReadPs; + function ReadPs(_index); + function AddP(): Ap; + function AppendP(): Ap; + +public // Children - BodyPr: BodyPr; + XmlChildBodyPr: BodyPr; XmlChildLstStyle: OpenXmlEmpty; end; @@ -39,121 +42,84 @@ end; function TxPr.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function TxPr.Init();override; begin - {self.}BodyPr := new BodyPr(self, "a", "bodyPr"); - {self.}XmlChildLstStyle := new OpenXmlEmpty(self, "a", "lstStyle"); -end; - -function TxPr.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function TxPr.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}BodyPr, - 1: {self.}XmlChildLstStyle, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}BodyPr.ElementName: 0, - {self.}XmlChildLstStyle.ElementName: 1, + "a:bodyPr": array(0, makeweakref(thisFunction(ReadXmlChildBodyPr))), + "a:lstStyle": array(1, makeweakref(thisFunction(ReadXmlChildLstStyle))), + "a:p": array(2, makeweakref(thisFunction(AppendP))), ); -end; - -function TxPr.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - "a:p": obj := {self.}AppendP(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function TxPr.Copy(_obj: TxPr);override; begin - {self.}BodyPr.Copy(_obj.BodyPr); - {self.}XmlChildLstStyle.Copy(_obj.XmlChildLstStyle); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildBodyPr) then + {self.}BodyPr.Copy(_obj.XmlChildBodyPr); + if not ifnil(_obj.XmlChildLstStyle) then + ifnil({self.}XmlChildLstStyle) ? {self.}LstStyle.Copy(_obj.XmlChildLstStyle) : {self.}XmlChildLstStyle.Copy(_obj.XmlChildLstStyle); + tslassigning := tslassigning_backup; +end; + +function TxPr.ReadXmlChildLstStyle(); +begin + if tslassigning and ifnil({self.}XmlChildLstStyle) then + begin + {self.}XmlChildLstStyle := new OpenXmlEmpty(self, "a", "lstStyle"); + container_.Set({self.}XmlChildLstStyle); + return {self.}XmlChildLstStyle; + end + return {self.}XmlChildLstStyle.BoolValue(); +end; + +function TxPr.WriteXmlChildLstStyle(_value); +begin + if ifnil({self.}XmlChildLstStyle) then + begin + {self.}XmlChildLstStyle := new OpenXmlEmpty(self, "a", "lstStyle"); + container_.Set({self.}XmlChildLstStyle); + end + {self.}XmlChildLstStyle.Value := _value; +end; + +function TxPr.ReadXmlChildBodyPr(); +begin + if tslassigning and ifnil({self.}XmlChildBodyPr) then + begin + {self.}XmlChildBodyPr := new BodyPr(self, "a", "bodyPr"); + container_.Set({self.}XmlChildBodyPr); + end + return {self.}XmlChildBodyPr; +end; + +function TxPr.ReadPs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get("a:p", ind); end; function TxPr.AddP(): Ap; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "p" then break; - end obj := new Ap(self, "a", "p"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function TxPr.AppendP(): Ap; begin obj := new Ap(self, "a", "p"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function TxPr.ReadPs(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "p" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; - -function TxPr.ReadXmlChildLstStyle(); -begin - return ifnil({self.}XmlChildLstStyle.Value) ? false : true; -end; - -function TxPr.WriteXmlChildLstStyle(_value); -begin - {self.}XmlChildLstStyle.Value := _value; -end; diff --git a/autoclass/docx/Txbx@DOCX.tsf b/autoclass/docx/Txbx@DOCX.tsf index c9a4d9d..d912e23 100644 --- a/autoclass/docx/Txbx@DOCX.tsf +++ b/autoclass/docx/Txbx@DOCX.tsf @@ -4,16 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Txbx);override; public - // Attributes + // normal property + property TxbxContent read ReadXmlChildTxbxContent; + function ReadXmlChildTxbxContent(); + +public // Children - TxbxContent: TxbxContent; + XmlChildTxbxContent: TxbxContent; end; @@ -29,70 +30,38 @@ end; function Txbx.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Txbx.Init();override; begin - {self.}TxbxContent := new TxbxContent(self, "w", "txbxContent"); -end; - -function Txbx.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Txbx.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}TxbxContent, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}TxbxContent.ElementName: 0, + "w:txbxContent": array(0, makeweakref(thisFunction(ReadXmlChildTxbxContent))), ); -end; - -function Txbx.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Txbx.Copy(_obj: Txbx);override; begin - {self.}TxbxContent.Copy(_obj.TxbxContent); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildTxbxContent) then + {self.}TxbxContent.Copy(_obj.XmlChildTxbxContent); + tslassigning := tslassigning_backup; +end; + +function Txbx.ReadXmlChildTxbxContent(); +begin + if tslassigning and ifnil({self.}XmlChildTxbxContent) then + begin + {self.}XmlChildTxbxContent := new TxbxContent(self, "w", "txbxContent"); + container_.Set({self.}XmlChildTxbxContent); + end + return {self.}XmlChildTxbxContent; end; diff --git a/autoclass/docx/TxbxContent@DOCX.tsf b/autoclass/docx/TxbxContent@DOCX.tsf index a5045e7..2d014ab 100644 --- a/autoclass/docx/TxbxContent@DOCX.tsf +++ b/autoclass/docx/TxbxContent@DOCX.tsf @@ -4,19 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: TxbxContent);override; + +public + + // multi property + property Ps read ReadPs; + function ReadPs(_index); function AddP(): P; function AppendP(): P; - property Ps read ReadPs; - function ReadPs(_index); - public - // Attributes - // Children end; @@ -33,105 +31,47 @@ end; function TxbxContent.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function TxbxContent.Init();override; begin - -end; - -function TxbxContent.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function TxbxContent.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, + pre + "p": array(0, makeweakref(thisFunction(AppendP))), ); -end; - -function TxbxContent.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - pre + "p": obj := {self.}AppendP(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function TxbxContent.Copy(_obj: TxbxContent);override; begin + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + tslassigning := tslassigning_backup; +end; +function TxbxContent.ReadPs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "p", ind); end; function TxbxContent.AddP(): P; begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "p" then break; - end obj := new P(self, {self.}Prefix, "p"); - {self.}InsertChild(obj, i+1); + container_.Insert(obj); return obj; end; function TxbxContent.AppendP(): P; begin obj := new P(self, {self.}Prefix, "p"); - child_elements_[length(child_elements_)] := obj; + container_.Append(obj); return obj; end; - -function TxbxContent.ReadPs(_index); -begin - ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "p" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; -end; diff --git a/autoclass/docx/Types@DOCX.tsf b/autoclass/docx/Types@DOCX.tsf index dbd5a32..a915bac 100644 --- a/autoclass/docx/Types@DOCX.tsf +++ b/autoclass/docx/Types@DOCX.tsf @@ -4,22 +4,28 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Types);override; + +public + + // attributes property + property xmlns read ReadXmlAttrxmlns write WriteXmlAttrxmlns; + function ReadXmlAttrxmlns(); + function WriteXmlAttrxmlns(_value); + + // multi property + property Defaults read ReadDefaults; + property Overrides read ReadOverrides; + function ReadDefaults(_index); + function ReadOverrides(_index); function AddDefault(): Default; function AddOverride(): _Override; function AppendDefault(): Default; function AppendOverride(): _Override; - property Defaults read ReadDefaults; - property Overrides read ReadOverrides; - function ReadDefaults(_index); - function ReadOverrides(_index); - public - // Attributes + // Attributes + XmlAttrxmlns: OpenXmlAttribute; // Children @@ -27,7 +33,7 @@ end; function Types.Create();overload; begin - {self.}Create(nil, nil, "Types"); + {self.}Create(nil, "", "Types"); end; function Types.Create(_node: XmlNode);overload; @@ -37,142 +43,87 @@ end; function Types.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Types.Init();override; begin - -end; - -function Types.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Types.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns": makeweakref(thisFunction(WriteXmlAttrxmlns)), ); sorted_child_ := array( - "": -1, + "Default": array(0, makeweakref(thisFunction(AppendDefault))), + "Override": array(1, makeweakref(thisFunction(AppendOverride))), ); -end; - -function Types.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - "Default": obj := {self.}AppendDefault(); - "Override": obj := {self.}AppendOverride(); - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Types.Copy(_obj: Types);override; begin - + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.xmlns) then + {self.}xmlns := _obj.xmlns; + tslassigning := tslassigning_backup; end; -function Types.AddDefault(): Default; +function Types.ReadXmlAttrxmlns(); begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "Default" then break; + return {self.}XmlAttrxmlns.Value; +end; + +function Types.WriteXmlAttrxmlns(_value); +begin + if ifnil({self.}XmlAttrxmlns) then + begin + {self.}XmlAttrxmlns := new OpenXmlAttribute("", "xmlns", nil); + attributes_[length(attributes_)] := {self.}XmlAttrxmlns; end - obj := new Default(self, nil, "Default"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function Types.AddOverride(): _Override; -begin - len := length(child_elements_); - if len = 0 then i := -1; - else begin - for i:=len-1 downto 0 do - if child_elements_[i].LocalName = "Override" then break; - end - obj := new _Override(self, nil, "Override"); - {self.}InsertChild(obj, i+1); - return obj; -end; - -function Types.AppendDefault(): Default; -begin - obj := new Default(self, nil, "Default"); - child_elements_[length(child_elements_)] := obj; - return obj; -end; - -function Types.AppendOverride(): _Override; -begin - obj := new _Override(self, nil, "Override"); - child_elements_[length(child_elements_)] := obj; - return obj; + {self.}XmlAttrxmlns.Value := _value; end; function Types.ReadDefaults(_index); begin ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "Default" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get("Default", ind); end; function Types.ReadOverrides(_index); begin ind := ifnil(_index) ? -2 : _index; - arr := array(); - for k,v in child_elements_ do - begin - if v.LocalName = "Override" then - begin - arr[length(arr)] := v; - ind--; - end; - if ind = -1 then return v; - end; - return arr; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get("Override", ind); +end; + +function Types.AddDefault(): Default; +begin + obj := new Default(self, "", "Default"); + container_.Insert(obj); + return obj; +end; + +function Types.AddOverride(): _Override; +begin + obj := new _Override(self, "", "Override"); + container_.Insert(obj); + return obj; +end; + +function Types.AppendDefault(): Default; +begin + obj := new Default(self, "", "Default"); + container_.Append(obj); + return obj; +end; + +function Types.AppendOverride(): _Override; +begin + obj := new _Override(self, "", "Override"); + container_.Append(obj); + return obj; end; diff --git a/autoclass/docx/Val@DOCX.tsf b/autoclass/docx/Val@DOCX.tsf index f848ae2..c7a15fc 100644 --- a/autoclass/docx/Val@DOCX.tsf +++ b/autoclass/docx/Val@DOCX.tsf @@ -4,16 +4,17 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Val);override; public - // Attributes + // normal property + property NumRef read ReadXmlChildNumRef; + function ReadXmlChildNumRef(); + +public // Children - NumRef: NumRef; + XmlChildNumRef: NumRef; end; @@ -29,70 +30,38 @@ end; function Val.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Val.Init();override; begin - {self.}NumRef := new NumRef(self, {self.}Prefix, "numRef"); -end; - -function Val.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Val.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}NumRef, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}NumRef.ElementName: 0, + pre + "numRef": array(0, makeweakref(thisFunction(ReadXmlChildNumRef))), ); -end; - -function Val.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Val.Copy(_obj: Val);override; begin - {self.}NumRef.Copy(_obj.NumRef); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildNumRef) then + {self.}NumRef.Copy(_obj.XmlChildNumRef); + tslassigning := tslassigning_backup; +end; + +function Val.ReadXmlChildNumRef(); +begin + if tslassigning and ifnil({self.}XmlChildNumRef) then + begin + {self.}XmlChildNumRef := new NumRef(self, {self.}Prefix, "numRef"); + container_.Set({self.}XmlChildNumRef); + end + return {self.}XmlChildNumRef; end; diff --git a/autoclass/docx/View3D@DOCX.tsf b/autoclass/docx/View3D@DOCX.tsf index 9e26afa..eff96ee 100644 --- a/autoclass/docx/View3D@DOCX.tsf +++ b/autoclass/docx/View3D@DOCX.tsf @@ -4,18 +4,23 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: View3D);override; public - // Attributes + // normal property + property RotX read ReadXmlChildRotX; + property RotY read ReadXmlChildRotY; + property RAngAx read ReadXmlChildRAngAx; + function ReadXmlChildRotX(); + function ReadXmlChildRotY(); + function ReadXmlChildRAngAx(); + +public // Children - RotX: PureVal; - RotY: PureVal; - RAngAx: PureVal; + XmlChildRotX: PureVal; + XmlChildRotY: PureVal; + XmlChildRAngAx: PureVal; end; @@ -31,78 +36,64 @@ end; function View3D.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function View3D.Init();override; begin - {self.}RotX := new PureVal(self, {self.}Prefix, "rotX"); - {self.}RotY := new PureVal(self, {self.}Prefix, "rotY"); - {self.}RAngAx := new PureVal(self, {self.}Prefix, "rAngAx"); -end; - -function View3D.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function View3D.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}RotX, - 1: {self.}RotY, - 2: {self.}RAngAx, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}RotX.ElementName: 0, - {self.}RotY.ElementName: 1, - {self.}RAngAx.ElementName: 2, + pre + "rotX": array(0, makeweakref(thisFunction(ReadXmlChildRotX))), + pre + "rotY": array(1, makeweakref(thisFunction(ReadXmlChildRotY))), + pre + "rAngAx": array(2, makeweakref(thisFunction(ReadXmlChildRAngAx))), ); -end; - -function View3D.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function View3D.Copy(_obj: View3D);override; begin - {self.}RotX.Copy(_obj.RotX); - {self.}RotY.Copy(_obj.RotY); - {self.}RAngAx.Copy(_obj.RAngAx); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildRotX) then + {self.}RotX.Copy(_obj.XmlChildRotX); + if not ifnil(_obj.XmlChildRotY) then + {self.}RotY.Copy(_obj.XmlChildRotY); + if not ifnil(_obj.XmlChildRAngAx) then + {self.}RAngAx.Copy(_obj.XmlChildRAngAx); + tslassigning := tslassigning_backup; +end; + +function View3D.ReadXmlChildRotX(); +begin + if tslassigning and ifnil({self.}XmlChildRotX) then + begin + {self.}XmlChildRotX := new PureVal(self, {self.}Prefix, "rotX"); + container_.Set({self.}XmlChildRotX); + end + return {self.}XmlChildRotX; +end; + +function View3D.ReadXmlChildRotY(); +begin + if tslassigning and ifnil({self.}XmlChildRotY) then + begin + {self.}XmlChildRotY := new PureVal(self, {self.}Prefix, "rotY"); + container_.Set({self.}XmlChildRotY); + end + return {self.}XmlChildRotY; +end; + +function View3D.ReadXmlChildRAngAx(); +begin + if tslassigning and ifnil({self.}XmlChildRAngAx) then + begin + {self.}XmlChildRAngAx := new PureVal(self, {self.}Prefix, "rAngAx"); + container_.Set({self.}XmlChildRAngAx); + end + return {self.}XmlChildRAngAx; end; diff --git a/autoclass/docx/WebSettings@DOCX.tsf b/autoclass/docx/WebSettings@DOCX.tsf index 6c6e28e..57fe8fd 100644 --- a/autoclass/docx/WebSettings@DOCX.tsf +++ b/autoclass/docx/WebSettings@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: WebSettings);override; +public + + // attributes property property XmlnsMc read ReadXmlAttrXmlnsMc write WriteXmlAttrXmlnsMc; property XmlnsR read ReadXmlAttrXmlnsR write WriteXmlAttrXmlnsR; property XmlnsW read ReadXmlAttrXmlnsW write WriteXmlAttrXmlnsW; @@ -46,6 +46,7 @@ public function ReadXmlAttrMcIgnorable(); function WriteXmlAttrMcIgnorable(_value); + // empty property property OptimizeForBrowser read ReadXmlChildOptimizeForBrowser write WriteXmlChildOptimizeForBrowser; property AllowPNG read ReadXmlChildAllowPNG write WriteXmlChildAllowPNG; function ReadXmlChildOptimizeForBrowser(); @@ -54,7 +55,7 @@ public function WriteXmlChildAllowPNG(_value); public - // Attributes + // Attributes XmlAttrXmlnsMc: OpenXmlAttribute; XmlAttrXmlnsR: OpenXmlAttribute; XmlAttrXmlnsW: OpenXmlAttribute; @@ -86,124 +87,69 @@ end; function WebSettings.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function WebSettings.Init();override; begin - {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); - {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); - {self.}XmlAttrXmlnsW := new OpenXmlAttribute("xmlns", "w", nil); - {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); - {self.}XmlAttrXmlnsW15 := new OpenXmlAttribute("xmlns", "w15", nil); - {self.}XmlAttrXmlnsW16Cex := new OpenXmlAttribute("xmlns", "w16cex", nil); - {self.}XmlAttrXmlnsW16Cid := new OpenXmlAttribute("xmlns", "w16cid", nil); - {self.}XmlAttrXmlnsW16 := new OpenXmlAttribute("xmlns", "w16", nil); - {self.}XmlAttrXmlnsW16Du := new OpenXmlAttribute("xmlns", "w16du", nil); - {self.}XmlAttrXmlnsW16sdtdh := new OpenXmlAttribute("xmlns", "w16sdtdh", nil); - {self.}XmlAttrXmlnsW16se := new OpenXmlAttribute("xmlns", "w16se", nil); - {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); - {self.}XmlChildOptimizeForBrowser := new OpenXmlEmpty(self, {self.}Prefix, "optimizeForBrowser"); - {self.}XmlChildAllowPNG := new OpenXmlEmpty(self, {self.}Prefix, "allowPNG"); -end; - -function WebSettings.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrXmlnsMc, - {self.}XmlAttrXmlnsR, - {self.}XmlAttrXmlnsW, - {self.}XmlAttrXmlnsW14, - {self.}XmlAttrXmlnsW15, - {self.}XmlAttrXmlnsW16Cex, - {self.}XmlAttrXmlnsW16Cid, - {self.}XmlAttrXmlnsW16, - {self.}XmlAttrXmlnsW16Du, - {self.}XmlAttrXmlnsW16sdtdh, - {self.}XmlAttrXmlnsW16se, - {self.}XmlAttrMcIgnorable, - ); -end; - -function WebSettings.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}XmlChildOptimizeForBrowser, - 1: {self.}XmlChildAllowPNG, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "xmlns:mc": makeweakref(thisFunction(WriteXmlAttrXmlnsMc)), + "xmlns:r": makeweakref(thisFunction(WriteXmlAttrXmlnsR)), + "xmlns:w": makeweakref(thisFunction(WriteXmlAttrXmlnsW)), + "xmlns:w14": makeweakref(thisFunction(WriteXmlAttrXmlnsW14)), + "xmlns:w15": makeweakref(thisFunction(WriteXmlAttrXmlnsW15)), + "xmlns:w16cex": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Cex)), + "xmlns:w16cid": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Cid)), + "xmlns:w16": makeweakref(thisFunction(WriteXmlAttrXmlnsW16)), + "xmlns:w16du": makeweakref(thisFunction(WriteXmlAttrXmlnsW16Du)), + "xmlns:w16sdtdh": makeweakref(thisFunction(WriteXmlAttrXmlnsW16sdtdh)), + "xmlns:w16se": makeweakref(thisFunction(WriteXmlAttrXmlnsW16se)), + "mc:Ignorable": makeweakref(thisFunction(WriteXmlAttrMcIgnorable)), ); sorted_child_ := array( - "": -1, - {self.}XmlChildOptimizeForBrowser.ElementName: 0, - {self.}XmlChildAllowPNG.ElementName: 1, + pre + "optimizeForBrowser": array(0, makeweakref(thisFunction(ReadXmlChildOptimizeForBrowser))), + pre + "allowPNG": array(1, makeweakref(thisFunction(ReadXmlChildAllowPNG))), ); -end; - -function WebSettings.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function WebSettings.Copy(_obj: WebSettings);override; begin - if not ifnil(_obj.XmlAttrXmlnsMc.Value) then - {self.}XmlAttrXmlnsMc.Value := _obj.XmlAttrXmlnsMc.Value; - if not ifnil(_obj.XmlAttrXmlnsR.Value) then - {self.}XmlAttrXmlnsR.Value := _obj.XmlAttrXmlnsR.Value; - if not ifnil(_obj.XmlAttrXmlnsW.Value) then - {self.}XmlAttrXmlnsW.Value := _obj.XmlAttrXmlnsW.Value; - if not ifnil(_obj.XmlAttrXmlnsW14.Value) then - {self.}XmlAttrXmlnsW14.Value := _obj.XmlAttrXmlnsW14.Value; - if not ifnil(_obj.XmlAttrXmlnsW15.Value) then - {self.}XmlAttrXmlnsW15.Value := _obj.XmlAttrXmlnsW15.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Cex.Value) then - {self.}XmlAttrXmlnsW16Cex.Value := _obj.XmlAttrXmlnsW16Cex.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Cid.Value) then - {self.}XmlAttrXmlnsW16Cid.Value := _obj.XmlAttrXmlnsW16Cid.Value; - if not ifnil(_obj.XmlAttrXmlnsW16.Value) then - {self.}XmlAttrXmlnsW16.Value := _obj.XmlAttrXmlnsW16.Value; - if not ifnil(_obj.XmlAttrXmlnsW16Du.Value) then - {self.}XmlAttrXmlnsW16Du.Value := _obj.XmlAttrXmlnsW16Du.Value; - if not ifnil(_obj.XmlAttrXmlnsW16sdtdh.Value) then - {self.}XmlAttrXmlnsW16sdtdh.Value := _obj.XmlAttrXmlnsW16sdtdh.Value; - if not ifnil(_obj.XmlAttrXmlnsW16se.Value) then - {self.}XmlAttrXmlnsW16se.Value := _obj.XmlAttrXmlnsW16se.Value; - if not ifnil(_obj.XmlAttrMcIgnorable.Value) then - {self.}XmlAttrMcIgnorable.Value := _obj.XmlAttrMcIgnorable.Value; - {self.}XmlChildOptimizeForBrowser.Copy(_obj.XmlChildOptimizeForBrowser); - {self.}XmlChildAllowPNG.Copy(_obj.XmlChildAllowPNG); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlnsMc) then + {self.}XmlnsMc := _obj.XmlnsMc; + if not ifnil(_obj.XmlnsR) then + {self.}XmlnsR := _obj.XmlnsR; + if not ifnil(_obj.XmlnsW) then + {self.}XmlnsW := _obj.XmlnsW; + if not ifnil(_obj.XmlnsW14) then + {self.}XmlnsW14 := _obj.XmlnsW14; + if not ifnil(_obj.XmlnsW15) then + {self.}XmlnsW15 := _obj.XmlnsW15; + if not ifnil(_obj.XmlnsW16Cex) then + {self.}XmlnsW16Cex := _obj.XmlnsW16Cex; + if not ifnil(_obj.XmlnsW16Cid) then + {self.}XmlnsW16Cid := _obj.XmlnsW16Cid; + if not ifnil(_obj.XmlnsW16) then + {self.}XmlnsW16 := _obj.XmlnsW16; + if not ifnil(_obj.XmlnsW16Du) then + {self.}XmlnsW16Du := _obj.XmlnsW16Du; + if not ifnil(_obj.XmlnsW16sdtdh) then + {self.}XmlnsW16sdtdh := _obj.XmlnsW16sdtdh; + if not ifnil(_obj.XmlnsW16se) then + {self.}XmlnsW16se := _obj.XmlnsW16se; + if not ifnil(_obj.McIgnorable) then + {self.}McIgnorable := _obj.McIgnorable; + if not ifnil(_obj.XmlChildOptimizeForBrowser) then + ifnil({self.}XmlChildOptimizeForBrowser) ? {self.}OptimizeForBrowser.Copy(_obj.XmlChildOptimizeForBrowser) : {self.}XmlChildOptimizeForBrowser.Copy(_obj.XmlChildOptimizeForBrowser); + if not ifnil(_obj.XmlChildAllowPNG) then + ifnil({self.}XmlChildAllowPNG) ? {self.}AllowPNG.Copy(_obj.XmlChildAllowPNG) : {self.}XmlChildAllowPNG.Copy(_obj.XmlChildAllowPNG); + tslassigning := tslassigning_backup; end; function WebSettings.ReadXmlAttrXmlnsMc(); @@ -213,6 +159,11 @@ end; function WebSettings.WriteXmlAttrXmlnsMc(_value); begin + if ifnil({self.}XmlAttrXmlnsMc) then + begin + {self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsMc; + end {self.}XmlAttrXmlnsMc.Value := _value; end; @@ -223,6 +174,11 @@ end; function WebSettings.WriteXmlAttrXmlnsR(_value); begin + if ifnil({self.}XmlAttrXmlnsR) then + begin + {self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsR; + end {self.}XmlAttrXmlnsR.Value := _value; end; @@ -233,6 +189,11 @@ end; function WebSettings.WriteXmlAttrXmlnsW(_value); begin + if ifnil({self.}XmlAttrXmlnsW) then + begin + {self.}XmlAttrXmlnsW := new OpenXmlAttribute("xmlns", "w", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW; + end {self.}XmlAttrXmlnsW.Value := _value; end; @@ -243,6 +204,11 @@ end; function WebSettings.WriteXmlAttrXmlnsW14(_value); begin + if ifnil({self.}XmlAttrXmlnsW14) then + begin + {self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW14; + end {self.}XmlAttrXmlnsW14.Value := _value; end; @@ -253,6 +219,11 @@ end; function WebSettings.WriteXmlAttrXmlnsW15(_value); begin + if ifnil({self.}XmlAttrXmlnsW15) then + begin + {self.}XmlAttrXmlnsW15 := new OpenXmlAttribute("xmlns", "w15", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW15; + end {self.}XmlAttrXmlnsW15.Value := _value; end; @@ -263,6 +234,11 @@ end; function WebSettings.WriteXmlAttrXmlnsW16Cex(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Cex) then + begin + {self.}XmlAttrXmlnsW16Cex := new OpenXmlAttribute("xmlns", "w16cex", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Cex; + end {self.}XmlAttrXmlnsW16Cex.Value := _value; end; @@ -273,6 +249,11 @@ end; function WebSettings.WriteXmlAttrXmlnsW16Cid(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Cid) then + begin + {self.}XmlAttrXmlnsW16Cid := new OpenXmlAttribute("xmlns", "w16cid", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Cid; + end {self.}XmlAttrXmlnsW16Cid.Value := _value; end; @@ -283,6 +264,11 @@ end; function WebSettings.WriteXmlAttrXmlnsW16(_value); begin + if ifnil({self.}XmlAttrXmlnsW16) then + begin + {self.}XmlAttrXmlnsW16 := new OpenXmlAttribute("xmlns", "w16", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16; + end {self.}XmlAttrXmlnsW16.Value := _value; end; @@ -293,6 +279,11 @@ end; function WebSettings.WriteXmlAttrXmlnsW16Du(_value); begin + if ifnil({self.}XmlAttrXmlnsW16Du) then + begin + {self.}XmlAttrXmlnsW16Du := new OpenXmlAttribute("xmlns", "w16du", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16Du; + end {self.}XmlAttrXmlnsW16Du.Value := _value; end; @@ -303,6 +294,11 @@ end; function WebSettings.WriteXmlAttrXmlnsW16sdtdh(_value); begin + if ifnil({self.}XmlAttrXmlnsW16sdtdh) then + begin + {self.}XmlAttrXmlnsW16sdtdh := new OpenXmlAttribute("xmlns", "w16sdtdh", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16sdtdh; + end {self.}XmlAttrXmlnsW16sdtdh.Value := _value; end; @@ -313,6 +309,11 @@ end; function WebSettings.WriteXmlAttrXmlnsW16se(_value); begin + if ifnil({self.}XmlAttrXmlnsW16se) then + begin + {self.}XmlAttrXmlnsW16se := new OpenXmlAttribute("xmlns", "w16se", nil); + attributes_[length(attributes_)] := {self.}XmlAttrXmlnsW16se; + end {self.}XmlAttrXmlnsW16se.Value := _value; end; @@ -323,25 +324,52 @@ end; function WebSettings.WriteXmlAttrMcIgnorable(_value); begin + if ifnil({self.}XmlAttrMcIgnorable) then + begin + {self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil); + attributes_[length(attributes_)] := {self.}XmlAttrMcIgnorable; + end {self.}XmlAttrMcIgnorable.Value := _value; end; function WebSettings.ReadXmlChildOptimizeForBrowser(); begin - return ifnil({self.}XmlChildOptimizeForBrowser.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildOptimizeForBrowser) then + begin + {self.}XmlChildOptimizeForBrowser := new OpenXmlEmpty(self, {self.}Prefix, "optimizeForBrowser"); + container_.Set({self.}XmlChildOptimizeForBrowser); + return {self.}XmlChildOptimizeForBrowser; + end + return {self.}XmlChildOptimizeForBrowser.BoolValue(); end; function WebSettings.WriteXmlChildOptimizeForBrowser(_value); begin + if ifnil({self.}XmlChildOptimizeForBrowser) then + begin + {self.}XmlChildOptimizeForBrowser := new OpenXmlEmpty(self, {self.}Prefix, "optimizeForBrowser"); + container_.Set({self.}XmlChildOptimizeForBrowser); + end {self.}XmlChildOptimizeForBrowser.Value := _value; end; function WebSettings.ReadXmlChildAllowPNG(); begin - return ifnil({self.}XmlChildAllowPNG.Value) ? false : true; + if tslassigning and ifnil({self.}XmlChildAllowPNG) then + begin + {self.}XmlChildAllowPNG := new OpenXmlEmpty(self, {self.}Prefix, "allowPNG"); + container_.Set({self.}XmlChildAllowPNG); + return {self.}XmlChildAllowPNG; + end + return {self.}XmlChildAllowPNG.BoolValue(); end; function WebSettings.WriteXmlChildAllowPNG(_value); begin + if ifnil({self.}XmlChildAllowPNG) then + begin + {self.}XmlChildAllowPNG := new OpenXmlEmpty(self, {self.}Prefix, "allowPNG"); + container_.Set({self.}XmlChildAllowPNG); + end {self.}XmlChildAllowPNG.Value := _value; end; diff --git a/autoclass/docx/WpsStyle@DOCX.tsf b/autoclass/docx/WpsStyle@DOCX.tsf index 289d71b..7e21354 100644 --- a/autoclass/docx/WpsStyle@DOCX.tsf +++ b/autoclass/docx/WpsStyle@DOCX.tsf @@ -4,19 +4,26 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: WpsStyle);override; public - // Attributes + // normal property + property LnRef read ReadXmlChildLnRef; + property FillRef read ReadXmlChildFillRef; + property EffectRef read ReadXmlChildEffectRef; + property FontRef read ReadXmlChildFontRef; + function ReadXmlChildLnRef(); + function ReadXmlChildFillRef(); + function ReadXmlChildEffectRef(); + function ReadXmlChildFontRef(); + +public // Children - LnRef: XRef; - FillRef: XRef; - EffectRef: XRef; - FontRef: XRef; + XmlChildLnRef: XRef; + XmlChildFillRef: XRef; + XmlChildEffectRef: XRef; + XmlChildFontRef: XRef; end; @@ -32,82 +39,77 @@ end; function WpsStyle.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function WpsStyle.Init();override; begin - {self.}LnRef := new XRef(self, "a", "lnRef"); - {self.}FillRef := new XRef(self, "a", "fillRef"); - {self.}EffectRef := new XRef(self, "a", "effectRef"); - {self.}FontRef := new XRef(self, "a", "fontRef"); -end; - -function WpsStyle.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function WpsStyle.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}LnRef, - 1: {self.}FillRef, - 2: {self.}EffectRef, - 3: {self.}FontRef, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}LnRef.ElementName: 0, - {self.}FillRef.ElementName: 1, - {self.}EffectRef.ElementName: 2, - {self.}FontRef.ElementName: 3, + "a:lnRef": array(0, makeweakref(thisFunction(ReadXmlChildLnRef))), + "a:fillRef": array(1, makeweakref(thisFunction(ReadXmlChildFillRef))), + "a:effectRef": array(2, makeweakref(thisFunction(ReadXmlChildEffectRef))), + "a:fontRef": array(3, makeweakref(thisFunction(ReadXmlChildFontRef))), ); -end; - -function WpsStyle.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function WpsStyle.Copy(_obj: WpsStyle);override; begin - {self.}LnRef.Copy(_obj.LnRef); - {self.}FillRef.Copy(_obj.FillRef); - {self.}EffectRef.Copy(_obj.EffectRef); - {self.}FontRef.Copy(_obj.FontRef); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildLnRef) then + {self.}LnRef.Copy(_obj.XmlChildLnRef); + if not ifnil(_obj.XmlChildFillRef) then + {self.}FillRef.Copy(_obj.XmlChildFillRef); + if not ifnil(_obj.XmlChildEffectRef) then + {self.}EffectRef.Copy(_obj.XmlChildEffectRef); + if not ifnil(_obj.XmlChildFontRef) then + {self.}FontRef.Copy(_obj.XmlChildFontRef); + tslassigning := tslassigning_backup; +end; + +function WpsStyle.ReadXmlChildLnRef(); +begin + if tslassigning and ifnil({self.}XmlChildLnRef) then + begin + {self.}XmlChildLnRef := new XRef(self, "a", "lnRef"); + container_.Set({self.}XmlChildLnRef); + end + return {self.}XmlChildLnRef; +end; + +function WpsStyle.ReadXmlChildFillRef(); +begin + if tslassigning and ifnil({self.}XmlChildFillRef) then + begin + {self.}XmlChildFillRef := new XRef(self, "a", "fillRef"); + container_.Set({self.}XmlChildFillRef); + end + return {self.}XmlChildFillRef; +end; + +function WpsStyle.ReadXmlChildEffectRef(); +begin + if tslassigning and ifnil({self.}XmlChildEffectRef) then + begin + {self.}XmlChildEffectRef := new XRef(self, "a", "effectRef"); + container_.Set({self.}XmlChildEffectRef); + end + return {self.}XmlChildEffectRef; +end; + +function WpsStyle.ReadXmlChildFontRef(); +begin + if tslassigning and ifnil({self.}XmlChildFontRef) then + begin + {self.}XmlChildFontRef := new XRef(self, "a", "fontRef"); + container_.Set({self.}XmlChildFontRef); + end + return {self.}XmlChildFontRef; end; diff --git a/autoclass/docx/Wsp@DOCX.tsf b/autoclass/docx/Wsp@DOCX.tsf index 8f28f70..ee5ea08 100644 --- a/autoclass/docx/Wsp@DOCX.tsf +++ b/autoclass/docx/Wsp@DOCX.tsf @@ -4,20 +4,29 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Wsp);override; public - // Attributes + // normal property + property CNvSpPr read ReadXmlChildCNvSpPr; + property SpPr read ReadXmlChildSpPr; + property Txbx read ReadXmlChildTxbx; + property Style read ReadXmlChildStyle; + property BodyPr read ReadXmlChildBodyPr; + function ReadXmlChildCNvSpPr(); + function ReadXmlChildSpPr(); + function ReadXmlChildTxbx(); + function ReadXmlChildStyle(); + function ReadXmlChildBodyPr(); + +public // Children - CNvSpPr: CNvSpPr; - SpPr: SpPr; - Txbx: Txbx; - Style: WpsStyle; - BodyPr: BodyPr; + XmlChildCNvSpPr: CNvSpPr; + XmlChildSpPr: SpPr; + XmlChildTxbx: Txbx; + XmlChildStyle: WpsStyle; + XmlChildBodyPr: BodyPr; end; @@ -33,86 +42,90 @@ end; function Wsp.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Wsp.Init();override; begin - {self.}CNvSpPr := new CNvSpPr(self, {self.}Prefix, "cNvSpPr"); - {self.}SpPr := new SpPr(self, {self.}Prefix, "spPr"); - {self.}Txbx := new Txbx(self, {self.}Prefix, "txbx"); - {self.}Style := new WpsStyle(self, {self.}Prefix, "style"); - {self.}BodyPr := new BodyPr(self, {self.}Prefix, "bodyPr"); -end; - -function Wsp.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Wsp.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}CNvSpPr, - 1: {self.}SpPr, - 2: {self.}Txbx, - 3: {self.}Style, - 4: {self.}BodyPr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}CNvSpPr.ElementName: 0, - {self.}SpPr.ElementName: 1, - {self.}Txbx.ElementName: 2, - {self.}Style.ElementName: 3, - {self.}BodyPr.ElementName: 4, + pre + "cNvSpPr": array(0, makeweakref(thisFunction(ReadXmlChildCNvSpPr))), + pre + "spPr": array(1, makeweakref(thisFunction(ReadXmlChildSpPr))), + pre + "txbx": array(2, makeweakref(thisFunction(ReadXmlChildTxbx))), + pre + "style": array(3, makeweakref(thisFunction(ReadXmlChildStyle))), + pre + "bodyPr": array(4, makeweakref(thisFunction(ReadXmlChildBodyPr))), ); -end; - -function Wsp.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Wsp.Copy(_obj: Wsp);override; begin - {self.}CNvSpPr.Copy(_obj.CNvSpPr); - {self.}SpPr.Copy(_obj.SpPr); - {self.}Txbx.Copy(_obj.Txbx); - {self.}Style.Copy(_obj.Style); - {self.}BodyPr.Copy(_obj.BodyPr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildCNvSpPr) then + {self.}CNvSpPr.Copy(_obj.XmlChildCNvSpPr); + if not ifnil(_obj.XmlChildSpPr) then + {self.}SpPr.Copy(_obj.XmlChildSpPr); + if not ifnil(_obj.XmlChildTxbx) then + {self.}Txbx.Copy(_obj.XmlChildTxbx); + if not ifnil(_obj.XmlChildStyle) then + {self.}Style.Copy(_obj.XmlChildStyle); + if not ifnil(_obj.XmlChildBodyPr) then + {self.}BodyPr.Copy(_obj.XmlChildBodyPr); + tslassigning := tslassigning_backup; +end; + +function Wsp.ReadXmlChildCNvSpPr(); +begin + if tslassigning and ifnil({self.}XmlChildCNvSpPr) then + begin + {self.}XmlChildCNvSpPr := new CNvSpPr(self, {self.}Prefix, "cNvSpPr"); + container_.Set({self.}XmlChildCNvSpPr); + end + return {self.}XmlChildCNvSpPr; +end; + +function Wsp.ReadXmlChildSpPr(); +begin + if tslassigning and ifnil({self.}XmlChildSpPr) then + begin + {self.}XmlChildSpPr := new SpPr(self, {self.}Prefix, "spPr"); + container_.Set({self.}XmlChildSpPr); + end + return {self.}XmlChildSpPr; +end; + +function Wsp.ReadXmlChildTxbx(); +begin + if tslassigning and ifnil({self.}XmlChildTxbx) then + begin + {self.}XmlChildTxbx := new Txbx(self, {self.}Prefix, "txbx"); + container_.Set({self.}XmlChildTxbx); + end + return {self.}XmlChildTxbx; +end; + +function Wsp.ReadXmlChildStyle(); +begin + if tslassigning and ifnil({self.}XmlChildStyle) then + begin + {self.}XmlChildStyle := new WpsStyle(self, {self.}Prefix, "style"); + container_.Set({self.}XmlChildStyle); + end + return {self.}XmlChildStyle; +end; + +function Wsp.ReadXmlChildBodyPr(); +begin + if tslassigning and ifnil({self.}XmlChildBodyPr) then + begin + {self.}XmlChildBodyPr := new BodyPr(self, {self.}Prefix, "bodyPr"); + container_.Set({self.}XmlChildBodyPr); + end + return {self.}XmlChildBodyPr; end; diff --git a/autoclass/docx/XRef@DOCX.tsf b/autoclass/docx/XRef@DOCX.tsf index df82a46..b69a65e 100644 --- a/autoclass/docx/XRef@DOCX.tsf +++ b/autoclass/docx/XRef@DOCX.tsf @@ -4,21 +4,25 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: XRef);override; +public + + // attributes property property Idx read ReadXmlAttrIdx write WriteXmlAttrIdx; function ReadXmlAttrIdx(); function WriteXmlAttrIdx(_value); + // normal property + property SchemeClr read ReadXmlChildSchemeClr; + function ReadXmlChildSchemeClr(); + public - // Attributes + // Attributes XmlAttrIdx: OpenXmlAttribute; // Children - SchemeClr: SchemeClr; + XmlChildSchemeClr: SchemeClr; end; @@ -34,76 +38,33 @@ end; function XRef.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function XRef.Init();override; begin - {self.}XmlAttrIdx := new OpenXmlAttribute(nil, "idx", nil); - {self.}SchemeClr := new SchemeClr(self, "a", "schemeClr"); -end; - -function XRef.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrIdx, - ); -end; - -function XRef.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}SchemeClr, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "idx": makeweakref(thisFunction(WriteXmlAttrIdx)), ); sorted_child_ := array( - "": -1, - {self.}SchemeClr.ElementName: 0, + "a:schemeClr": array(0, makeweakref(thisFunction(ReadXmlChildSchemeClr))), ); -end; - -function XRef.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function XRef.Copy(_obj: XRef);override; begin - if not ifnil(_obj.XmlAttrIdx.Value) then - {self.}XmlAttrIdx.Value := _obj.XmlAttrIdx.Value; - {self.}SchemeClr.Copy(_obj.SchemeClr); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Idx) then + {self.}Idx := _obj.Idx; + if not ifnil(_obj.XmlChildSchemeClr) then + {self.}SchemeClr.Copy(_obj.XmlChildSchemeClr); + tslassigning := tslassigning_backup; end; function XRef.ReadXmlAttrIdx(); @@ -113,5 +74,20 @@ end; function XRef.WriteXmlAttrIdx(_value); begin + if ifnil({self.}XmlAttrIdx) then + begin + {self.}XmlAttrIdx := new OpenXmlAttribute("", "idx", nil); + attributes_[length(attributes_)] := {self.}XmlAttrIdx; + end {self.}XmlAttrIdx.Value := _value; end; + +function XRef.ReadXmlChildSchemeClr(); +begin + if tslassigning and ifnil({self.}XmlChildSchemeClr) then + begin + {self.}XmlChildSchemeClr := new SchemeClr(self, "a", "schemeClr"); + container_.Set({self.}XmlChildSchemeClr); + end + return {self.}XmlChildSchemeClr; +end; diff --git a/autoclass/docx/XY@DOCX.tsf b/autoclass/docx/XY@DOCX.tsf index 4e86c9c..125ed56 100644 --- a/autoclass/docx/XY@DOCX.tsf +++ b/autoclass/docx/XY@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: XY);override; +public + + // attributes property property X read ReadXmlAttrX write WriteXmlAttrX; property Y read ReadXmlAttrY write WriteXmlAttrY; function ReadXmlAttrX(); @@ -17,17 +17,16 @@ public function WriteXmlAttrY(_value); public - // Attributes + // Attributes XmlAttrX: OpenXmlAttribute; XmlAttrY: OpenXmlAttribute; - // Children end; function XY.Create();overload; begin - {self.}Create(nil, nil, ""); + {self.}Create(nil, "", ""); end; function XY.Create(_node: XmlNode);overload; @@ -37,45 +36,33 @@ end; function XY.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function XY.Init();override; begin - {self.}XmlAttrX := new OpenXmlAttribute(nil, "x", nil); - {self.}XmlAttrY := new OpenXmlAttribute(nil, "y", nil); -end; - -function XY.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrX, - {self.}XmlAttrY, - ); -end; - -function XY.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "x": makeweakref(thisFunction(WriteXmlAttrX)), + "y": makeweakref(thisFunction(WriteXmlAttrY)), ); sorted_child_ := array( - "": -1, ); -end; - -function XY.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function XY.Copy(_obj: XY);override; begin - if not ifnil(_obj.XmlAttrX.Value) then - {self.}XmlAttrX.Value := _obj.XmlAttrX.Value; - if not ifnil(_obj.XmlAttrY.Value) then - {self.}XmlAttrY.Value := _obj.XmlAttrY.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.X) then + {self.}X := _obj.X; + if not ifnil(_obj.Y) then + {self.}Y := _obj.Y; + tslassigning := tslassigning_backup; end; function XY.ReadXmlAttrX(); @@ -85,6 +72,11 @@ end; function XY.WriteXmlAttrX(_value); begin + if ifnil({self.}XmlAttrX) then + begin + {self.}XmlAttrX := new OpenXmlAttribute("", "x", nil); + attributes_[length(attributes_)] := {self.}XmlAttrX; + end {self.}XmlAttrX.Value := _value; end; @@ -95,5 +87,10 @@ end; function XY.WriteXmlAttrY(_value); begin + if ifnil({self.}XmlAttrY) then + begin + {self.}XmlAttrY := new OpenXmlAttribute("", "y", nil); + attributes_[length(attributes_)] := {self.}XmlAttrY; + end {self.}XmlAttrY.Value := _value; end; diff --git a/autoclass/docx/Xfrm@DOCX.tsf b/autoclass/docx/Xfrm@DOCX.tsf index 999d6fe..5e00f98 100644 --- a/autoclass/docx/Xfrm@DOCX.tsf +++ b/autoclass/docx/Xfrm@DOCX.tsf @@ -4,17 +4,20 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Xfrm);override; public - // Attributes + // normal property + property Off read ReadXmlChildOff; + property Ext read ReadXmlChildExt; + function ReadXmlChildOff(); + function ReadXmlChildExt(); + +public // Children - Off: XY; - Ext: CXY; + XmlChildOff: XY; + XmlChildExt: CXY; end; @@ -30,74 +33,51 @@ end; function Xfrm.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Xfrm.Init();override; begin - {self.}Off := new XY(self, {self.}Prefix, "off"); - {self.}Ext := new CXY(self, {self.}Prefix, "ext"); -end; - -function Xfrm.InitAttributes();override; -begin - attributes_ := array( - ); -end; - -function Xfrm.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Off, - 1: {self.}Ext, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( ); sorted_child_ := array( - "": -1, - {self.}Off.ElementName: 0, - {self.}Ext.ElementName: 1, + pre + "off": array(0, makeweakref(thisFunction(ReadXmlChildOff))), + pre + "ext": array(1, makeweakref(thisFunction(ReadXmlChildExt))), ); -end; - -function Xfrm.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function Xfrm.Copy(_obj: Xfrm);override; begin - {self.}Off.Copy(_obj.Off); - {self.}Ext.Copy(_obj.Ext); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.XmlChildOff) then + {self.}Off.Copy(_obj.XmlChildOff); + if not ifnil(_obj.XmlChildExt) then + {self.}Ext.Copy(_obj.XmlChildExt); + tslassigning := tslassigning_backup; +end; + +function Xfrm.ReadXmlChildOff(); +begin + if tslassigning and ifnil({self.}XmlChildOff) then + begin + {self.}XmlChildOff := new XY(self, {self.}Prefix, "off"); + container_.Set({self.}XmlChildOff); + end + return {self.}XmlChildOff; +end; + +function Xfrm.ReadXmlChildExt(); +begin + if tslassigning and ifnil({self.}XmlChildExt) then + begin + {self.}XmlChildExt := new CXY(self, {self.}Prefix, "ext"); + container_.Set({self.}XmlChildExt); + end + return {self.}XmlChildExt; end; diff --git a/autoclass/docx/Zoom@DOCX.tsf b/autoclass/docx/Zoom@DOCX.tsf index 097da3b..78bcccf 100644 --- a/autoclass/docx/Zoom@DOCX.tsf +++ b/autoclass/docx/Zoom@DOCX.tsf @@ -4,20 +4,19 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: Zoom);override; +public + + // attributes property property Percent read ReadXmlAttrPercent write WriteXmlAttrPercent; function ReadXmlAttrPercent(); function WriteXmlAttrPercent(_value); public - // Attributes + // Attributes XmlAttrPercent: OpenXmlAttribute; - // Children end; @@ -33,41 +32,30 @@ end; function Zoom.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Zoom.Init();override; begin - {self.}XmlAttrPercent := new OpenXmlAttribute({self.}Prefix, "percent", nil); -end; - -function Zoom.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrPercent, - ); -end; - -function Zoom.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + pre + "percent": makeweakref(thisFunction(WriteXmlAttrPercent)), ); sorted_child_ := array( - "": -1, ); -end; - -function Zoom.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function Zoom.Copy(_obj: Zoom);override; begin - if not ifnil(_obj.XmlAttrPercent.Value) then - {self.}XmlAttrPercent.Value := _obj.XmlAttrPercent.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.Percent) then + {self.}Percent := _obj.Percent; + tslassigning := tslassigning_backup; end; function Zoom.ReadXmlAttrPercent(); @@ -77,5 +65,10 @@ end; function Zoom.WriteXmlAttrPercent(_value); begin + if ifnil({self.}XmlAttrPercent) then + begin + {self.}XmlAttrPercent := new OpenXmlAttribute({self.}Prefix, "percent", nil); + attributes_[length(attributes_)] := {self.}XmlAttrPercent; + end {self.}XmlAttrPercent.Value := _value; end; diff --git a/autoclass/docx/_Inline@DOCX.tsf b/autoclass/docx/_Inline@DOCX.tsf index 433d6ce..f4dfae6 100644 --- a/autoclass/docx/_Inline@DOCX.tsf +++ b/autoclass/docx/_Inline@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: _Inline);override; +public + + // attributes property property DistT read ReadXmlAttrDistT write WriteXmlAttrDistT; property DistB read ReadXmlAttrDistB write WriteXmlAttrDistB; property DistL read ReadXmlAttrDistL write WriteXmlAttrDistL; @@ -28,8 +28,20 @@ public function ReadXmlAttrEditId(); function WriteXmlAttrEditId(_value); + // normal property + property Extent read ReadXmlChildExtent; + property EffectExtent read ReadXmlChildEffectExtent; + property DocPr read ReadXmlChildDocPr; + property CNvGraphicFramePr read ReadXmlChildCNvGraphicFramePr; + property Graphic read ReadXmlChildGraphic; + function ReadXmlChildExtent(); + function ReadXmlChildEffectExtent(); + function ReadXmlChildDocPr(); + function ReadXmlChildCNvGraphicFramePr(); + function ReadXmlChildGraphic(); + public - // Attributes + // Attributes XmlAttrDistT: OpenXmlAttribute; XmlAttrDistB: OpenXmlAttribute; XmlAttrDistL: OpenXmlAttribute; @@ -38,11 +50,11 @@ public XmlAttrEditId: OpenXmlAttribute; // Children - Extent: CXY; - EffectExtent: EffectExtent; - DocPr: DocPr; - CNvGraphicFramePr: CNvGraphicFramePr; - Graphic: Graphic; + XmlChildExtent: CXY; + XmlChildEffectExtent: EffectExtent; + XmlChildDocPr: DocPr; + XmlChildCNvGraphicFramePr: CNvGraphicFramePr; + XmlChildGraphic: Graphic; end; @@ -58,112 +70,60 @@ end; function _Inline.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function _Inline.Init();override; begin - {self.}XmlAttrDistT := new OpenXmlAttribute(nil, "distT", nil); - {self.}XmlAttrDistB := new OpenXmlAttribute(nil, "distB", nil); - {self.}XmlAttrDistL := new OpenXmlAttribute(nil, "distL", nil); - {self.}XmlAttrDistR := new OpenXmlAttribute(nil, "distR", nil); - {self.}XmlAttrAnchorId := new OpenXmlAttribute("wp14", "anchorId", nil); - {self.}XmlAttrEditId := new OpenXmlAttribute("wp14", "editId", nil); - {self.}Extent := new CXY(self, {self.}Prefix, "extent"); - {self.}EffectExtent := new EffectExtent(self, {self.}Prefix, "effectExtent"); - {self.}DocPr := new DocPr(self, {self.}Prefix, "docPr"); - {self.}CNvGraphicFramePr := new CNvGraphicFramePr(self, {self.}Prefix, "cNvGraphicFramePr"); - {self.}Graphic := new Graphic(self, "a", "graphic"); -end; - -function _Inline.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrDistT, - {self.}XmlAttrDistB, - {self.}XmlAttrDistL, - {self.}XmlAttrDistR, - {self.}XmlAttrAnchorId, - {self.}XmlAttrEditId, - ); -end; - -function _Inline.InitChildren();override; -begin - child_elements_ := array( - 0: {self.}Extent, - 1: {self.}EffectExtent, - 2: {self.}DocPr, - 3: {self.}CNvGraphicFramePr, - 4: {self.}Graphic, + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "distT": makeweakref(thisFunction(WriteXmlAttrDistT)), + "distB": makeweakref(thisFunction(WriteXmlAttrDistB)), + "distL": makeweakref(thisFunction(WriteXmlAttrDistL)), + "distR": makeweakref(thisFunction(WriteXmlAttrDistR)), + "wp14:anchorId": makeweakref(thisFunction(WriteXmlAttrAnchorId)), + "wp14:editId": makeweakref(thisFunction(WriteXmlAttrEditId)), ); sorted_child_ := array( - "": -1, - {self.}Extent.ElementName: 0, - {self.}EffectExtent.ElementName: 1, - {self.}DocPr.ElementName: 2, - {self.}CNvGraphicFramePr.ElementName: 3, - {self.}Graphic.ElementName: 4, + pre + "extent": array(0, makeweakref(thisFunction(ReadXmlChildExtent))), + pre + "effectExtent": array(1, makeweakref(thisFunction(ReadXmlChildEffectExtent))), + pre + "docPr": array(2, makeweakref(thisFunction(ReadXmlChildDocPr))), + pre + "cNvGraphicFramePr": array(3, makeweakref(thisFunction(ReadXmlChildCNvGraphicFramePr))), + "a:graphic": array(4, makeweakref(thisFunction(ReadXmlChildGraphic))), ); -end; - -function _Inline.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; - node := ifObj(_node) ? _node.FirstChild() : nil; - flag := false; - if ifnil(child_elements_[0]) and length(child_elements_) > 0 then - begin - flag := true; - arr := child_elements_; - child_elements_ := array(); - end - pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : ""; - while ifObj(node) do - begin - node_name := node.GetName(); - pos := sorted_child_[node_name]; - if ifnil(pos) or pos = -1 then - begin - obj := nil; - case node_name of - end; - if ifObj(obj) then obj.InitNode(node); - end - else if flag then - begin - obj := arr[pos]; - obj.InitNode(node); - child_elements_[length(child_elements_)] := obj; - end - else begin - child_elements_[pos].InitNode(node); - end - node := node.NextElement(); - end + container_ := new TSOfficeContainer(sorted_child_); end; function _Inline.Copy(_obj: _Inline);override; begin - if not ifnil(_obj.XmlAttrDistT.Value) then - {self.}XmlAttrDistT.Value := _obj.XmlAttrDistT.Value; - if not ifnil(_obj.XmlAttrDistB.Value) then - {self.}XmlAttrDistB.Value := _obj.XmlAttrDistB.Value; - if not ifnil(_obj.XmlAttrDistL.Value) then - {self.}XmlAttrDistL.Value := _obj.XmlAttrDistL.Value; - if not ifnil(_obj.XmlAttrDistR.Value) then - {self.}XmlAttrDistR.Value := _obj.XmlAttrDistR.Value; - if not ifnil(_obj.XmlAttrAnchorId.Value) then - {self.}XmlAttrAnchorId.Value := _obj.XmlAttrAnchorId.Value; - if not ifnil(_obj.XmlAttrEditId.Value) then - {self.}XmlAttrEditId.Value := _obj.XmlAttrEditId.Value; - {self.}Extent.Copy(_obj.Extent); - {self.}EffectExtent.Copy(_obj.EffectExtent); - {self.}DocPr.Copy(_obj.DocPr); - {self.}CNvGraphicFramePr.Copy(_obj.CNvGraphicFramePr); - {self.}Graphic.Copy(_obj.Graphic); + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.DistT) then + {self.}DistT := _obj.DistT; + if not ifnil(_obj.DistB) then + {self.}DistB := _obj.DistB; + if not ifnil(_obj.DistL) then + {self.}DistL := _obj.DistL; + if not ifnil(_obj.DistR) then + {self.}DistR := _obj.DistR; + if not ifnil(_obj.AnchorId) then + {self.}AnchorId := _obj.AnchorId; + if not ifnil(_obj.EditId) then + {self.}EditId := _obj.EditId; + if not ifnil(_obj.XmlChildExtent) then + {self.}Extent.Copy(_obj.XmlChildExtent); + if not ifnil(_obj.XmlChildEffectExtent) then + {self.}EffectExtent.Copy(_obj.XmlChildEffectExtent); + if not ifnil(_obj.XmlChildDocPr) then + {self.}DocPr.Copy(_obj.XmlChildDocPr); + if not ifnil(_obj.XmlChildCNvGraphicFramePr) then + {self.}CNvGraphicFramePr.Copy(_obj.XmlChildCNvGraphicFramePr); + if not ifnil(_obj.XmlChildGraphic) then + {self.}Graphic.Copy(_obj.XmlChildGraphic); + tslassigning := tslassigning_backup; end; function _Inline.ReadXmlAttrDistT(); @@ -173,6 +133,11 @@ end; function _Inline.WriteXmlAttrDistT(_value); begin + if ifnil({self.}XmlAttrDistT) then + begin + {self.}XmlAttrDistT := new OpenXmlAttribute("", "distT", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDistT; + end {self.}XmlAttrDistT.Value := _value; end; @@ -183,6 +148,11 @@ end; function _Inline.WriteXmlAttrDistB(_value); begin + if ifnil({self.}XmlAttrDistB) then + begin + {self.}XmlAttrDistB := new OpenXmlAttribute("", "distB", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDistB; + end {self.}XmlAttrDistB.Value := _value; end; @@ -193,6 +163,11 @@ end; function _Inline.WriteXmlAttrDistL(_value); begin + if ifnil({self.}XmlAttrDistL) then + begin + {self.}XmlAttrDistL := new OpenXmlAttribute("", "distL", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDistL; + end {self.}XmlAttrDistL.Value := _value; end; @@ -203,6 +178,11 @@ end; function _Inline.WriteXmlAttrDistR(_value); begin + if ifnil({self.}XmlAttrDistR) then + begin + {self.}XmlAttrDistR := new OpenXmlAttribute("", "distR", nil); + attributes_[length(attributes_)] := {self.}XmlAttrDistR; + end {self.}XmlAttrDistR.Value := _value; end; @@ -213,6 +193,11 @@ end; function _Inline.WriteXmlAttrAnchorId(_value); begin + if ifnil({self.}XmlAttrAnchorId) then + begin + {self.}XmlAttrAnchorId := new OpenXmlAttribute("wp14", "anchorId", nil); + attributes_[length(attributes_)] := {self.}XmlAttrAnchorId; + end {self.}XmlAttrAnchorId.Value := _value; end; @@ -223,5 +208,60 @@ end; function _Inline.WriteXmlAttrEditId(_value); begin + if ifnil({self.}XmlAttrEditId) then + begin + {self.}XmlAttrEditId := new OpenXmlAttribute("wp14", "editId", nil); + attributes_[length(attributes_)] := {self.}XmlAttrEditId; + end {self.}XmlAttrEditId.Value := _value; end; + +function _Inline.ReadXmlChildExtent(); +begin + if tslassigning and ifnil({self.}XmlChildExtent) then + begin + {self.}XmlChildExtent := new CXY(self, {self.}Prefix, "extent"); + container_.Set({self.}XmlChildExtent); + end + return {self.}XmlChildExtent; +end; + +function _Inline.ReadXmlChildEffectExtent(); +begin + if tslassigning and ifnil({self.}XmlChildEffectExtent) then + begin + {self.}XmlChildEffectExtent := new EffectExtent(self, {self.}Prefix, "effectExtent"); + container_.Set({self.}XmlChildEffectExtent); + end + return {self.}XmlChildEffectExtent; +end; + +function _Inline.ReadXmlChildDocPr(); +begin + if tslassigning and ifnil({self.}XmlChildDocPr) then + begin + {self.}XmlChildDocPr := new DocPr(self, {self.}Prefix, "docPr"); + container_.Set({self.}XmlChildDocPr); + end + return {self.}XmlChildDocPr; +end; + +function _Inline.ReadXmlChildCNvGraphicFramePr(); +begin + if tslassigning and ifnil({self.}XmlChildCNvGraphicFramePr) then + begin + {self.}XmlChildCNvGraphicFramePr := new CNvGraphicFramePr(self, {self.}Prefix, "cNvGraphicFramePr"); + container_.Set({self.}XmlChildCNvGraphicFramePr); + end + return {self.}XmlChildCNvGraphicFramePr; +end; + +function _Inline.ReadXmlChildGraphic(); +begin + if tslassigning and ifnil({self.}XmlChildGraphic) then + begin + {self.}XmlChildGraphic := new Graphic(self, "a", "graphic"); + container_.Set({self.}XmlChildGraphic); + end + return {self.}XmlChildGraphic; +end; diff --git a/autoclass/docx/_Override@DOCX.tsf b/autoclass/docx/_Override@DOCX.tsf index 8107dbb..b293a47 100644 --- a/autoclass/docx/_Override@DOCX.tsf +++ b/autoclass/docx/_Override@DOCX.tsf @@ -4,11 +4,11 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; - function InitAttributes();override; - function InitChildren();override; - function InitNode(_node: XmlNode);override; function Copy(_obj: _Override);override; +public + + // attributes property property PartName read ReadXmlAttrPartName write WriteXmlAttrPartName; property ContentType read ReadXmlAttrContentType write WriteXmlAttrContentType; function ReadXmlAttrPartName(); @@ -17,17 +17,16 @@ public function WriteXmlAttrContentType(_value); public - // Attributes + // Attributes XmlAttrPartName: OpenXmlAttribute; XmlAttrContentType: OpenXmlAttribute; - // Children end; function _Override.Create();overload; begin - {self.}Create(nil, nil, "Override"); + {self.}Create(nil, "", "Override"); end; function _Override.Create(_node: XmlNode);overload; @@ -37,45 +36,33 @@ end; function _Override.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin + setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function _Override.Init();override; begin - {self.}XmlAttrPartName := new OpenXmlAttribute(nil, "PartName", nil); - {self.}XmlAttrContentType := new OpenXmlAttribute(nil, "ContentType", nil); -end; - -function _Override.InitAttributes();override; -begin - attributes_ := array( - {self.}XmlAttrPartName, - {self.}XmlAttrContentType, - ); -end; - -function _Override.InitChildren();override; -begin - child_elements_ := array( + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + attributes_ := array(); + attributes_pf_ := array( + "PartName": makeweakref(thisFunction(WriteXmlAttrPartName)), + "ContentType": makeweakref(thisFunction(WriteXmlAttrContentType)), ); sorted_child_ := array( - "": -1, ); -end; - -function _Override.InitNode(_node: XmlNode);override; -begin - if ifObj({self.}XmlNode) then - for k,v in child_elements_ do v.InitNode(nil); - {self.}XmlNode := ifObj(_node) ? _node : nil; + container_ := new TSOfficeContainer(sorted_child_); end; function _Override.Copy(_obj: _Override);override; begin - if not ifnil(_obj.XmlAttrPartName.Value) then - {self.}XmlAttrPartName.Value := _obj.XmlAttrPartName.Value; - if not ifnil(_obj.XmlAttrContentType.Value) then - {self.}XmlAttrContentType.Value := _obj.XmlAttrContentType.Value; + tslassigning_backup := tslassigning; + tslassigning := 1; + class(OpenXmlElement).Copy(_obj); + if not ifnil(_obj.PartName) then + {self.}PartName := _obj.PartName; + if not ifnil(_obj.ContentType) then + {self.}ContentType := _obj.ContentType; + tslassigning := tslassigning_backup; end; function _Override.ReadXmlAttrPartName(); @@ -85,6 +72,11 @@ end; function _Override.WriteXmlAttrPartName(_value); begin + if ifnil({self.}XmlAttrPartName) then + begin + {self.}XmlAttrPartName := new OpenXmlAttribute("", "PartName", nil); + attributes_[length(attributes_)] := {self.}XmlAttrPartName; + end {self.}XmlAttrPartName.Value := _value; end; @@ -95,5 +87,10 @@ end; function _Override.WriteXmlAttrContentType(_value); begin + if ifnil({self.}XmlAttrContentType) then + begin + {self.}XmlAttrContentType := new OpenXmlAttribute("", "ContentType", nil); + attributes_[length(attributes_)] := {self.}XmlAttrContentType; + end {self.}XmlAttrContentType.Value := _value; end; diff --git a/cp.ps1 b/cp.ps1 index 0b2fa2b..9f69122 100644 --- a/cp.ps1 +++ b/cp.ps1 @@ -1,5 +1,5 @@ -$sourcedir = "D:\code\tinysoft\Office-dev" -$destdir = "D:\code\tinysoft\Office" +$sourcedir = "D:\code\tinysoft\OfficeXml-dev" +$destdir = "D:\code\tinysoft\OfficeXml" # 复制tsf脚本 Remove-Item -Path ($destdir + "\autoclass\") -Recurse -Force @@ -8,8 +8,8 @@ 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\Office\autoclass\") ($destdir + "\autoclass\") -Recurse -Force -Copy-Item -Path ($sourcedir + "\funcext\Office\utils\") ($destdir + "\utils\") -Recurse -Force -Copy-Item -Path ($sourcedir + "\funcext\Office\openxml\") ($destdir + "\openxml\") -Recurse -Force -Copy-Item -Path ($sourcedir + "\funcext\Office\docx\") ($destdir + "\docx\") -Recurse -Force -Copy-Item -Path ($sourcedir + "\funcext\Office\pptx\") ($destdir + "\pptx\") -Recurse -Force +Copy-Item -Path ($sourcedir + "\funcext\OfficeXml\autoclass\") ($destdir + "\autoclass\") -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 diff --git a/docx/Components@DOCX.tsf b/docx/Components@DOCX.tsf index 0f101ce..cb56f3a 100644 --- a/docx/Components@DOCX.tsf +++ b/docx/Components@DOCX.tsf @@ -9,7 +9,7 @@ public property DocumentRels read ReadDocumentRels; property Themes read ReadThemes; property Document read ReadDocument; - property endnotes read Readendnotes; + property Endnotes read ReadEndnotes; property FontTable read ReadFontTable; property Footnotes read ReadFootnotes; property Settings read ReadSettings; @@ -30,7 +30,7 @@ public function ReadDocumentRels(); function ReadThemes(_index); function ReadDocument(); - function Readendnotes(); + function ReadEndnotes(); function ReadFontTable(); function ReadFootnotes(); function ReadSettings(); @@ -194,7 +194,7 @@ begin return {self.}GetProp(document_, "document"); end; -function Components.Readendnotes(); +function Components.ReadEndnotes(); begin return {self.}GetProp(endnotes_, "endnotes"); end; diff --git a/openxml/OpenXmlElement.tsf b/openxml/OpenXmlElement.tsf index f0ba3d3..e0e2856 100644 --- a/openxml/OpenXmlElement.tsf +++ b/openxml/OpenXmlElement.tsf @@ -3,8 +3,6 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();virtual; - function InitAttributes();virtual; - function InitChildren();virtual; function InitNode(_node: XmlNode);virtual; function Copy(_obj: tslobj);virtual; @@ -13,20 +11,22 @@ public function Marshal(): tableArray; function GetOrCreateNode(_obj: tslobj); function GetNode(): XmlNode; - - // 增删改查接口 - function Append(_obj: tslobj): boolean; // OpenXmlElement or OpenXmlPcdata - function InsertAfter(_pos_obj: tslobj; _obj: tslobj): boolean; - function InsertBefore(_pos_obj: tslobj; _obj: tslobj): boolean; - function Prepend(var _obj: tslobj): boolean; - function Remove(_obj: tslobj): boolean; - function AddAttribute(_obj: OpenXmlAttribute): boolean; function Elements(): array of tslobj; + function Attributes(): array of OpenXmlAttribute; -protected - function IsValidChild(_obj: tslobj); - function FindChild(_obj: tslobj); - function InsertChild(_obj: tslobj; _pos: integer); + // 增删改查接口 -- 暂不实现 +// public +// function Append(_obj: tslobj): boolean; // OpenXmlElement or OpenXmlPcdata +// function InsertAfter(_pos_obj: tslobj; _obj: tslobj): boolean; +// function InsertBefore(_pos_obj: tslobj; _obj: tslobj): boolean; +// function Prepend(var _obj: tslobj): boolean; +// function Remove(_obj: tslobj): boolean; +// function AddAttribute(_obj: OpenXmlAttribute): boolean; + +// protected +// function IsValidChild(_obj: tslobj); +// function FindChild(_obj: tslobj); +// function InsertChild(_obj: tslobj; _pos: integer); public LocalName: string; // 本地名称 @@ -37,8 +37,10 @@ public protected attributes_: array of OpenXmlAttribute; // 属性 - child_elements_: array of tslobj; // 子节点元素 + attributes_pf_: tableArray; + // child_elements_: array of tslobj; // 子节点元素 sorted_child_: tableArray; + container_: TSOfficeContainer; end; function OpenXmlElement.Create(_node: XmlNode);overload; @@ -58,15 +60,36 @@ begin {self.}XmlNode := nil; {self.}ElementName := ifString({self.}Prefix) and {self.}Prefix <> "" ? format("%s:%s", {self.}Prefix, {self.}LocalName) : {self.}LocalName; {self.}Init(); - {self.}InitAttributes(); - {self.}InitChildren(); +end; + +function OpenXmlElement.InitNode(_node: XmlNode);virtual; +begin + {self.}XmlNode := _node; + if not _node then return; + tslassigning_backup := tslassigning; + tslassigning := 1; + node := _node.FirstChild(); + while ifObj(node) do + begin + node_name := node.GetName(); + arr := sorted_child_[node_name]; + if ifarray(arr) then + begin + pf := arr[1]; + obj := pf.Do(); + obj.InitNode(node); + end + node := node.NextElement(); + end + tslassigning := tslassigning_backup; end; function OpenXmlElement.GetOrCreateNode(_obj: tslobj); begin if not ifObj({self.}XmlNode) then {self.}XmlNode := {self.}Parent.GetOrCreateNode(self); nearest_node := nil; - for k, v in child_elements_ do + child_elements := container_.Get(); + for k, v in child_elements do begin if ifObj(v.XmlNode) then nearest_node := v.XmlNode; if v = _obj then @@ -87,13 +110,16 @@ end; function OpenXmlElement.Deserialize(); begin - if not ifObj({self.}XmlNode) then return nil; - for k, v in attributes_ do + if not ifObj({self.}XmlNode) then return; + attrs := {self.}XmlNode.Attributes(); + for k, v in attrs do begin - attr := {self.}XmlNode.GetAttribute(v.ElementName); - v.Value := attr = "" ? nil : attr; + pf := attributes_pf_[k]; + if ifnil(pf) then continue; + pf.Do(v); end - for k, v in child_elements_ do + child_elements := container_.Get(); + for k, v in child_elements do v.Deserialize(); end; @@ -103,16 +129,17 @@ begin for k, v in attributes_ do if not ifnil(v.Value) then {self.}GetNode().SetAttribute(v.ElementName, v.Value); // Children - for k, v in child_elements_ do - if ifObj(v) then v.Serialize(); + child_elements := container_.Get(); + for k, v in child_elements do + v.Serialize(); end; function OpenXmlElement.Marshal(): tableArray; begin + child_elements := container_.Get(); child_arr := array(); - for k, v in child_elements_ do + for k, v in child_elements do begin - if ifnil(v) then continue; arr := array("type": "element", "name": v.ElementName, "attributes": array()); if v is Class(OpenXmlPcdata) or v is Class(OpenXmlElement) then begin @@ -128,7 +155,7 @@ begin if length(marshal) > 0 then child_arr[length(child_arr)] := arr; end else begin - echo "error = marshal,\n"; + echo "error = marshal.\n"; end end @@ -140,97 +167,8 @@ begin return tmp_arr; end; -function OpenXmlElement.Append(_obj: tslobj): boolean; // OpenXmlElement or OpenXmlPcdata -begin - if not {self.}IsValidChild(_obj) then return false; - _obj.Parent := self; - child_elements_[length(child_elements_)] := _obj; - // _obj := nil; - return true; -end; - -function OpenXmlElement.InsertAfter(_pos_obj: tslobj; _obj: tslobj): boolean; -begin - if not {self.}IsValidChild(_pos_obj) or not {self.}IsValidChild(_obj) then return false; - find_pos := {self.}FindChild(_pos_obj); - if find_pos = -1 then return false; - {self.}InsertChild(_obj, find_pos); - return true; -end; - -function OpenXmlElement.InsertBefore(_pos_obj: tslobj; _obj: tslobj): boolean; -begin - if not {self.}IsValidChild(_pos_obj) or not {self.}IsValidChild(_obj) then return false; - find_pos := {self.}FindChild(_pos_obj); - if find_pos = -1 then return false; - {self.}InsertChild(_obj, find_pos-1); - return true; -end; - -function OpenXmlElement.Prepend(_obj: tslobj): boolean; -begin - if not {self.}IsValidChild(_pos_obj) or not {self.}IsValidChild(_obj) then return false; - {self.}InsertChild(_obj, 0); - return true; -end; - -function OpenXmlElement.Remove(_obj: tslobj): boolean; -begin - if ifnil(_obj)then // 删除所有 - begin - if not ifObj({self.}XmlNode) or not ifObj({self.}Parent) or not ifObj({self.}PartName.XmlNode) then return false; - {self.}Parent.XmlNode.DeleteChild({self.}XmlNode); - return true; - end - else if {self.}IsValidChild(_obj) then - begin - if not ifObj(_obj.XmlNode) or not ifObj({self.}XmlNode) then return false; - {self.}XmlNode.DeleteChild(_obj.XmlNode); - return true; - end - else if _obj is Class(OpenXmlAttribute) then - begin - if not ifObj({self.}XmlNode) then return false; - {self.}XmlNode.DeleteAttribute(_obj.ElementName); - return false; - end -end; - -function OpenXmlElement.AddAttribute(_obj: OpenXmlAttribute): boolean; -begin - if not _obj is Class(OpenXmlAttribute) then return false; - attributes_[length(attributes_)] := _obj; - return true; -end; - -function OpenXmlElement.InsertChild(_obj: tslobj; _pos: integer); -begin - for i:=length(child_elements_)-1 downto _pos do - child_elements_[i+1] := child_elements_[i]; - _obj.Parent := self; - child_elements_[_pos] := _obj; -end; - -function OpenXmlElement.IsValidChild(_obj: tslobj): boolean; -begin - return _obj is Class(OpenXmlPcdata) or _obj is Class(OpenXmlElement) ? true : false; -end; - -function OpenXmlElement.FindChild(_obj: tslobj); -begin - not_found := true; - for k,v in child_elements_ do - begin - if v = _obj then - begin - not_found := false; - break; - end - end - return not_found ? -1 : k; -end; - function OpenXmlElement.Elements(): array of tslobj; begin - return child_elements_; + return container_.Get(); end; + diff --git a/openxml/OpenXmlEmpty.tsf b/openxml/OpenXmlEmpty.tsf index 6066e99..2965056 100644 --- a/openxml/OpenXmlEmpty.tsf +++ b/openxml/OpenXmlEmpty.tsf @@ -2,15 +2,22 @@ type OpenXmlEmpty = class public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; - function Init(); function InitNode(_node: XmlNode); function Copy(_obj: tslobj);virtual; function GetNode(): XmlNode; function Marshal(): tableArray; + function BoolValue(): boolean; function Deserialize(); function Serialize(); +public + // attributes property + XmlAttrVal; + property Val read ReadXmlAttrVal write WriteXmlAttrVal; + function ReadXmlAttrVal(); + function WriteXmlAttrVal(_value: any); + public LocalName: string; // 本地名称 [weakref]Parent: tslobj; // 父类 @@ -19,11 +26,6 @@ public ElementName: string; Value: any; -public - XmlAttrVal; - property Val read ReadXmlAttrVal write WriteXmlAttrVal; - function ReadXmlAttrVal(); - function WriteXmlAttrVal(_value: any); end; function OpenXmlEmpty.Create(_node: XmlNode);overload; @@ -42,14 +44,8 @@ begin {self.}LocalName := _local_name; {self.}XmlNode := nil; {self.}ElementName := ifString({self.}Prefix) and {self.}Prefix <> "" ? format("%s:%s", {self.}Prefix, {self.}LocalName) : {self.}LocalName; - {self.}Init(); end; -function OpenXmlEmpty.Init(); -begin - {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); -end - function OpenXmlEmpty.InitNode(_node: XmlNode); begin {self.}XmlNode := ifObj(_node) ? _node : nil; @@ -58,7 +54,7 @@ end; function OpenXmlEmpty.Copy(_obj: tslobj); begin if not ifnil(_obj.Value) then {self.}Value := _obj.Value; - if not ifnil(_obj.XmlAttrVal.Value) then {self.}XmlAttrVal.Value := _obj.XmlAttrVal.Value; + if not ifnil(_obj.XmlAttrVal.Value) then {self.}Val := _obj.XmlAttrVal.Value; end; function OpenXmlEmpty.Marshal(): tableArray; @@ -74,13 +70,16 @@ function OpenXmlEmpty.Deserialize(); begin if ifObj({self.}XmlNode) then begin - v := {self.}XmlNode.GetAttribute({self.}XmlAttrVal.ElementName); - {self.}Value := v = "0" ? false : true; - {self.}XmlAttrVal.Value := v = "" ? nil : v; + attrs := {self.}XmlNode.Attributes(); + if length(attrs) > 1 then raise "OpenXmlEmpty.Deserialize error.\n"; + {self.}Val := nil; + for k,v in attrs do + {self.}Val := v; + {self.}Value := ifnil({self.}Val) ? true : {self.}Val = "0" ? false : true; end else begin {self.}Value := nil; - {self.}XmlAttrVal.Value := nil; + {self.}XmlAttrVal := nil; end end; @@ -92,9 +91,19 @@ end; function OpenXmlEmpty.Serialize(); begin - if not ifObj({self.}XmlNode) and not {self.}Value then return; - if ifObj({self.}XmlNode) and not {self.}Value and ifObj({self.}Parent) and ifObj({self.}Parent.XmlNode) then {self.}Parent.XmlNode.DeleteChild({self.}XmlNode); - if not ifObj({self.}XmlNode) and {self.}Value then {self.}GetNode(); + if not ifObj({self.}XmlNode) then + begin + if not ifnil({self.}XmlAttrVal.Value) then {self.}GetNode().SetAttribute({self.}XmlAttrVal.ElementName, {self.}XmlAttrVal.Value); + end + else begin + if not ifnil({self.}XmlAttrVal.Value) then {self.}XmlNode.SetAttribute({self.}XmlAttrVal.ElementName, {self.}XmlAttrVal.Value); + else if not {self.}Value and ifObj({self.}Parent.XmlNode) then{self.}Parent.XmlNode.DeleteChild({self.}XmlNode); + end +end; + +function OpenXmlEmpty.BoolValue(): boolean; +begin + return ifnil({self.}Val) ? {self.}Value : {self.}Val; end; function OpenXmlEmpty.ReadXmlAttrVal(); @@ -104,5 +113,7 @@ end; function OpenXmlEmpty.WriteXmlAttrVal(_value: any); begin + if ifnil({self.}XmlAttrVal) then + {self.}XmlAttrVal := new OpenXmlAttribute({self.}Prefix, "val", nil); {self.}XmlAttrVal.Value := _value; end; diff --git a/openxml/OpenXmlPcdata.tsf b/openxml/OpenXmlPcdata.tsf index 778028a..080caa6 100644 --- a/openxml/OpenXmlPcdata.tsf +++ b/openxml/OpenXmlPcdata.tsf @@ -3,7 +3,6 @@ public function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();virtual; - function InitAttributes();virtual; function InitNode(_node: XmlNode);virtual; function Copy(_obj: tslobj);virtual; @@ -22,6 +21,7 @@ public protected attributes_: array of OpenXmlAttribute; // 属性 + attributes_pf_: tableArray; end; @@ -43,7 +43,6 @@ begin {self.}Text := nil; {self.}ElementName := ifString({self.}Prefix) and {self.}Prefix <> "" ? format("%s:%s", {self.}Prefix, {self.}LocalName) : {self.}LocalName; {self.}Init(); - {self.}InitAttributes(); end; function OpenXmlPcdata.InitNode(_node: XmlNode);virtual; @@ -62,9 +61,15 @@ end; function OpenXmlPcdata.Deserialize(); begin - {self.}Text := ifObj({self.}XmlNode) ? {self.}XmlNode.GetText() : nil; - for k,v in attributes_ do - v.Value := ifObj({self.}XmlNode) ? {self.}XmlNode.GetAttribute(v.ElementName) : nil; + if not ifObj({self.}XmlNode) then return; + {self.}Text := {self.}XmlNode.GetText(); + attrs := {self.}XmlNode.Attributes(); + for k, v in attrs do + begin + pf := attributes_pf_[k]; + if ifnil(pf) then continue; + pf.Do(v); + end end; function OpenXmlPcdata.GetNode(): XmlNode; diff --git a/utils/TSOfficeContainer.tsf b/utils/TSOfficeContainer.tsf new file mode 100644 index 0000000..3e3de6d --- /dev/null +++ b/utils/TSOfficeContainer.tsf @@ -0,0 +1,223 @@ +type TSOfficeContainer = class +public + function Create(arr: array of string); + function Set(data: any): boolean; // 设置data数据 + function Add(data: any): boolean; + function Append(data: any): boolean; + function Insert(data: any): boolean; + function Get(name: string; index: integer);overload; + function Get(): array of tslobj;overload; + +private + function GetBucketObj(str: string): LinkList; + +private + bucket_: array of LinkList; + child_: array of string; + current_index_: integer; + last_index_: integer; +end; + +type LinkList = class +public + function Create(name: string); + function Set(data: any); + function Add(data: any); + function Name(): string; + function Size(): integer; + function First(): Node; + +private + head_: Node; + tail_: Node; + size_: integer; + name_: string; +end; + +type Node = class +public + data; + next; +end; + +function TSOfficeContainer.Create(arr: array of string); +begin + bucket_ := array(); + child_ := array(); + for str,v in arr do + begin + child_[str] := v[0]; + last_index_ := v[0]; + end + current_index_ := -1; +end; + +function TSOfficeContainer.Set(data: any): boolean; +begin + obj := {self.}GetBucketObj(data.ElementName); + if ifnil(obj) then return false; + obj.Set(data); + return true; +end; + +function TSOfficeContainer.Add(data: any): boolean; +begin + obj := {self.}GetBucketObj(data.ElementName); + if ifnil(obj) then return false; + obj.Add(data); + return true; +end; + +function TSOfficeContainer.Append(data: any): boolean; +begin + ind := child_[data.ElementName]; + if ifnil(ind) or ind < current_index_ then + begin + obj := bucket_[current_index_]; + 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; + bucket_[current_index_] := obj; + obj.Add(data); + end + end + else if ind > current_index_ then + begin + obj := new LinkList(data.ElementName); + bucket_[ind] := obj; + obj.Add(data); + current_index_ := ind; + end + else if ind = current_index_ then + begin + obj := bucket_[ind]; + obj.Add(data); + end + return true; +end; + +function TSOfficeContainer.Insert(data: any): boolean; +begin + i := last_index_ + 1; + while i <= current_index_ do + begin + obj := bucket_[i]; + if ifObj(obj) and obj.Name() = data.ElementName then + begin + obj.Add(data); + return; + end + i++; + end + return ifnil(child_[data.ElementName]) ? {self.}Append(data) : {self.}Add(data); +end; + +function TSOfficeContainer.Get(): array of tslobj;overload; +begin + arr := array(); + for i:=0 to current_index_ do + begin + obj := bucket_[i]; + if ifObj(obj) then + begin + node := obj.First(); + while ifObj(node) do + begin + arr[length(arr)] := node.data; + node := node.next; + end + end + end + return arr; +end; + +function TSOfficeContainer.Get(name: string; index: integer);overload; +begin + ind := child_[name]; + arr := array(); + obj := bucket_[ind]; + if ifObj(obj) then + begin + node := obj.First(); + while ifObj(node) do + begin + 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 + begin + obj := bucket_[i]; + if ifObj(obj) and obj.Name() = name then + begin + node := obj.First(); + while ifObj(node) do + begin + arr[length(arr)] := node.data; + index--; + if index = -1 then return node.data; + node := node.next; + end + end + i++; + end + return arr; +end; + +function TSOfficeContainer.GetBucketObj(str: string): LinkList; +begin + ind := child_[str]; + if ifnil(ind) then return nil; + obj := bucket_[ind]; + if not ifObj(obj) then + begin + obj := new LinkList(str); + bucket_[ind] := obj; + if ind > current_index_ then current_index_ := ind; + end + return obj; +end; + +function LinkList.Create(name: string); +begin + head_ := new Node(); + tail_ := head_; + size_ := 0; + name_ := name; +end; + +function LinkList.Set(data: any) +begin + node := new Node(); + node.data := data; + head_.next := node; + tail_ := node; +end; + +function LinkList.Add(data: any) +begin + node := new Node(); + node.data := data; + tail_.next := node; + tail_ := node; + size_++; +end; + +function LinkList.Name(): string; +begin + return name_; +end; + +function LinkList.Size(): integer; +begin + return size_; +end; + +function LinkList.First(): Node; +begin + return head_ = tail_ ? nil : head_.next; +end;