OfficeVba/docx/TSDocxParagraph.tsf

212 lines
8.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Type TSDocxParagraph = Class(TSVbaBase)
public
Function Init(body, paragraph, index);
private
body_;
paragraph_; // TOfficeObj("TParagraph")
index_; // 第N个段落1开始计数
range_;
public
Function CloseUp();
Function Indent();
Function IndentCharWidth(Count);
Function IndentFirstLineCharWidth(Count);
Function JoinList();
Function ListAdvanceTo();
Function Next(Count);
Function OpenOrCloseUp();
Function OpenUp();
Function Outdent();
Function OutlineDemote();
Function OutlineDemoteToBody();
Function OutlinePromote();
Function Previous(Count);
Function Reset();
Function ResetAdvanceTo();
Function SelectNumber();
Function SeparateList();
Function Space1();
Function Space15();
Function Space2();
Function TabHangingIndent(Count);
Function TabIndent(Count);
property AddSpaceBetweenFarEastAndAlpha read ReadAddSpaceBetweenFarEastAndAlpha write WriteAddSpaceBetweenFarEastAndAlpha;
property AddSpaceBetweenFarEastAndDigit read ReadAddSpaceBetweenFarEastAndDigit write WriteAddSpaceBetweenFarEastAndDigit;
property Alignment read ReadAlignment write WriteAlignment;
property AutoAdjustRightIndent read ReadAutoAdjustRightIndent write WriteAutoAdjustRightIndent;
property BaseLineAlignment read ReadBaseLineAlignment write WriteBaseLineAlignment;
property Borders read ReadBorders;
property CharacterUnitFirstLineIndent read ReadCharacterUnitFirstLineIndent write WriteCharacterUnitFirstLineIndent;
property CharacterUnitLeftIndent read ReadCharacterUnitLeftIndent write WriteCharacterUnitLeftIndent;
property CharacterUnitRightIndent read ReadCharacterUnitRightIndent write WriteCharacterUnitRightIndent;
property CollapsedState read ReadCollapsedState write WriteCollapsedState;
property CollapseHeadingByDefault read ReadCollapseHeadingByDefault write WriteCollapseHeadingByDefault;
property DisableLineHeightGrid read ReadDisableLineHeightGrid write WriteDisableLineHeightGrid;
property DropCap read ReadDropCap;
property FarEastLineBreakControl read ReadFarEastLineBreakControl write WriteFarEastLineBreakControl;
property FirstLineIndent read ReadFirstLineIndent write WriteFirstLineIndent;
property Format read ReadFormat write WriteFormat;
property HalfWidthPunctuationOnTopOfLine read ReadHalfWidthPunctuationOnTopOfLine write WriteHalfWidthPunctuationOnTopOfLine;
property HangingPunctuation read ReadHangingPunctuation write WriteHangingPunctuation;
property Hyphenation read ReadHyphenation write WriteHyphenation;
property ID read ReadID write WriteID;
property IsStyleSeparator read ReadIsStyleSeparator;
property KeepTogether read ReadKeepTogether write WriteKeepTogether;
property KeepWithNext read ReadKeepWithNext write WriteKeepWithNext;
property LeftIndent read ReadLeftIndent write WriteLeftIndent;
property LineSpacing read ReadLineSpacing write WriteLineSpacing;
property LineSpacingRule read ReadLineSpacingRule write WriteLineSpacingRule;
property LineUnitAfter read ReadLineUnitAfter write WriteLineUnitAfter;
property LineUnitBefore read ReadLineUnitBefore write WriteLineUnitBefore;
property ListNumberOriginal read ReadListNumberOriginal;
property MirrorIndents read ReadMirrorIndents write WriteMirrorIndents;
property NoLineNumber read ReadNoLineNumber write WriteNoLineNumber;
property OutlineLevel read ReadOutlineLevel write WriteOutlineLevel;
property PageBreakBefore read ReadPageBreakBefore write WritePageBreakBefore;
property Range read ReadRange;
property ReadingOrder read ReadReadingOrder write WriteReadingOrder;
property RightIndent read ReadRightIndent write WriteRightIndent;
property Shading read ReadShading;
property SpaceAfter read ReadSpaceAfter write WriteSpaceAfter;
property SpaceAfterAuto read ReadSpaceAfterAuto write WriteSpaceAfterAuto;
property SpaceBefore read ReadSpaceBefore write WriteSpaceBefore;
property SpaceBeforeAuto read ReadSpaceBeforeAuto write WriteSpaceBeforeAuto;
property Style read ReadStyle write WriteStyle;
property TabStops read ReadTabStops write WriteTabStops;
property TextboxTightWrap read ReadTextboxTightWrap write WriteTextboxTightWrap;
property WidowControl read ReadWidowControl write WriteWidowControl;
property WordWrap read ReadWordWrap write WriteWordWrap;
Function WriteWordWrap(value);
Function ReadWordWrap();
Function WriteWidowControl(value);
Function ReadWidowControl();
Function WriteTextboxTightWrap(value);
Function ReadTextboxTightWrap();
Function WriteTabStops(value);
Function ReadTabStops();
Function WriteStyle(value);
Function ReadStyle();
Function WriteSpaceBeforeAuto(value);
Function ReadSpaceBeforeAuto();
Function WriteSpaceBefore(value);
Function ReadSpaceBefore();
Function WriteSpaceAfterAuto(value);
Function ReadSpaceAfterAuto();
Function WriteSpaceAfter(value);
Function ReadSpaceAfter();
Function ReadShading();
Function WriteRightIndent(value);
Function ReadRightIndent();
Function WriteReadingOrder(value);
Function ReadReadingOrder();
Function ReadRange();
Function WritePageBreakBefore(value);
Function ReadPageBreakBefore();
Function WriteOutlineLevel(value);
Function ReadOutlineLevel();
Function WriteNoLineNumber(value);
Function ReadNoLineNumber();
Function WriteMirrorIndents(value);
Function ReadMirrorIndents();
Function ReadListNumberOriginal();
Function WriteLineUnitBefore(value);
Function ReadLineUnitBefore();
Function WriteLineUnitAfter(value);
Function ReadLineUnitAfter();
Function WriteLineSpacingRule(value);
Function ReadLineSpacingRule();
Function WriteLineSpacing(value);
Function ReadLineSpacing();
Function WriteLeftIndent(value);
Function ReadLeftIndent();
Function WriteKeepWithNext(value);
Function ReadKeepWithNext();
Function WriteKeepTogether(value);
Function ReadKeepTogether();
Function ReadIsStyleSeparator();
Function WriteID(value);
Function ReadID();
Function WriteHyphenation(value);
Function ReadHyphenation();
Function WriteHangingPunctuation(value);
Function ReadHangingPunctuation();
Function WriteHalfWidthPunctuationOnTopOfLine(value);
Function ReadHalfWidthPunctuationOnTopOfLine();
Function WriteFormat(value);
Function ReadFormat();
Function WriteFirstLineIndent(value);
Function ReadFirstLineIndent();
Function WriteFarEastLineBreakControl(value);
Function ReadFarEastLineBreakControl();
Function ReadDropCap();
Function WriteDisableLineHeightGrid(value);
Function ReadDisableLineHeightGrid();
Function WriteCollapseHeadingByDefault(value);
Function ReadCollapseHeadingByDefault();
Function WriteCollapsedState(value);
Function ReadCollapsedState();
Function WriteCharacterUnitRightIndent(value);
Function ReadCharacterUnitRightIndent();
Function WriteCharacterUnitLeftIndent(value);
Function ReadCharacterUnitLeftIndent();
Function WriteCharacterUnitFirstLineIndent(value);
Function ReadCharacterUnitFirstLineIndent();
Function ReadBorders(index);
Function WriteBaseLineAlignment(value);
Function ReadBaseLineAlignment();
Function WriteAutoAdjustRightIndent(value);
Function ReadAutoAdjustRightIndent();
Function WriteAlignment(value);
Function ReadAlignment();
Function WriteAddSpaceBetweenFarEastAndDigit(value);
Function ReadAddSpaceBetweenFarEastAndDigit();
Function WriteAddSpaceBetweenFarEastAndAlpha(value);
Function ReadAddSpaceBetweenFarEastAndAlpha();
End;
// ============== 实现 ================= //
Function TSDocxParagraph.Init(body, paragraph, index);
Begin
body_ := body;
paragraph_ := paragraph;
index_ := index;
range_ := nil;
End;
// function
Function TSDocxParagraph.Next(Count);
Begin
return self.Parent.Item(index + Count);
End;
Function TSDocxParagraph.Previous(Count);
Begin
return self.Parent.Item(index - Count);
End;
// property
Function TSDocxParagraph.ReadBorders(index);
Begin
borders_obj := new TSDocxBordersParagraph(self.Application, self.Creator, self.Parent);
borders_obj.Init(paragraph_);
return ifnil(index) ? borders_obj : borders_obj[index];
End;
Function TSDocxParagraph.ReadRange();
Begin
if ifnil(range_) then
begin
pbegin := 0;
pend := 0;
arr := array();
node := body_.Root();
class(TSWdCommon).CalculateRange(node, node, paragraph_.Root(), false, pbegin, pend, arr);
range_ := new TSDocxRange(self.Application, self.Creator, self);
range_.Init(pbegin, pend, arr);
end
return range_;
End;