OfficeVba/docx/paragraphformat/TSDocxParagraphFormatRange.tsf

564 lines
20 KiB
Plaintext

Type TSDocxParagraphFormatRange = Class(TSDocxParagraphFormat)
Uses TSDocxEnumerations;
public
Function Init(docx, rangeObj);
Function Apply();override;
Function ReWrite(value);override;
private
Function CallFunction(pf, value);overload;
Function CallFunction(pf);overload;
private
paragraph_arr_;
public
// Methods
Function CloseUp();override;
Function IndentCharWidth(Count);override;
Function IndentFirstLineCharWidth(Count);override;
Function OpenOrCloseUp();override;
Function OpenUp();override;
Function Reset();override;
Function Space1();override;
Function Space15();override;
Function Space2();override;
Function TabHangingIndent(Count);override;
Function TabIndent(Count);override;
// property
Function WriteWordWrap(value);override;
Function ReadWordWrap();override;
Function WriteWidowControl(value);override;
Function ReadWidowControl();override;
Function WriteTextboxTightWrap(value);override;
Function ReadTextboxTightWrap();override;
Function WriteTabStops(value);override;
Function ReadTabStops();override;
Function WriteStyle(value);override;
Function ReadStyle();override;
Function WriteSpaceBeforeAuto(value);override;
Function ReadSpaceBeforeAuto();override;
Function WriteSpaceBefore(value);override;
Function ReadSpaceBefore();override;
Function WriteSpaceAfterAuto(value);override;
Function ReadSpaceAfterAuto();override;
Function WriteSpaceAfter(value);override;
Function ReadSpaceAfter();override;
Function ReadShading();override;
Function WriteRightIndent(value);override;
Function ReadRightIndent();override;
Function WriteReadingOrder(value);override;
Function ReadReadingOrder();override;
Function WritePageBreakBefore(value);override;
Function ReadPageBreakBefore();override;
Function WriteOutlineLevel(value);override;
Function ReadOutlineLevel();override;
Function WriteNoLineNumber(value);override;
Function ReadNoLineNumber();override;
Function WriteMirrorIndents(value);override;
Function ReadMirrorIndents();override;
Function WriteLineUnitBefore(value);override;
Function ReadLineUnitBefore();override;
Function WriteLineUnitAfter(value);override;
Function ReadLineUnitAfter();override;
Function WriteLineSpacingRule(value);override;
Function ReadLineSpacingRule();override;
Function WriteLineSpacing(value);override;
Function ReadLineSpacing();override;
Function WriteLeftIndent(value);override;
Function ReadLeftIndent();override;
Function WriteKeepWithNext(value);override;
Function ReadKeepWithNext();override;
Function WriteKeepTogether(value);override;
Function ReadKeepTogether();override;
Function WriteHyphenation(value);override;
Function ReadHyphenation();override;
Function WriteHangingPunctuation(value);override;
Function ReadHangingPunctuation();override;
Function WriteHalfWidthPunctuationOnTopOfLine(value);override;
Function ReadHalfWidthPunctuationOnTopOfLine();override;
Function WriteFirstLineIndent(value);override;
Function ReadFirstLineIndent();override;
Function WriteFarEastLineBreakControl(value);override;
Function ReadFarEastLineBreakControl();override;
Function ReadDuplicate();override;
Function WriteDisableLineHeightGrid(value);override;
Function ReadDisableLineHeightGrid();override;
Function WriteCollapsedByDefault(value);override;
Function ReadCollapsedByDefault();override;
Function WriteCharacterUnitRightIndent(value);override;
Function ReadCharacterUnitRightIndent();override;
Function WriteCharacterUnitLeftIndent(value);override;
Function ReadCharacterUnitLeftIndent();override;
Function WriteCharacterUnitFirstLineIndent(value);override;
Function ReadCharacterUnitFirstLineIndent();override;
Function ReadBorders(index);override;
Function WriteBaseLineAlignment(value);override;
Function ReadBaseLineAlignment();override;
Function WriteAutoAdjustRightIndent(value);override;
Function ReadAutoAdjustRightIndent();override;
Function WriteAlignment(value);override;
Function ReadAlignment();override;
Function WriteAddSpaceBetweenFarEastAndDigit(value);override;
Function ReadAddSpaceBetweenFarEastAndDigit();override;
Function WriteAddSpaceBetweenFarEastAndAlpha(value);override;
Function ReadAddSpaceBetweenFarEastAndAlpha();override;
End;
// ============== 实现 ================= //
Function TSDocxParagraphFormatRange.Init(docx, rangeObj);
Begin
class(TSDocxParagraphFormat).Init(docx, nil);
paragraph_arr_ := sselect distinct(["tparagraph"]) from rangeObj.data_ end;
End;
Function TSDocxParagraphFormatRange.Apply();override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).Apply), nil);
End;
Function TSDocxParagraphFormatRange.ReWrite(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).ReWrite), value);
End;
Function TSDocxParagraphFormatRange.CallFunction(pf, value);overload;
Begin
for i:=0 to length(paragraph_arr_)-1 do
begin
pr_ := paragraph_arr_[i].pPr;
if not ifObj(pr_.Root()) then continue;
##pf(value);
end
End;
Function TSDocxParagraphFormatRange.CallFunction(pf);overload;
Begin
ret := nil;
for i:=0 to length(paragraph_arr_)-1 do
begin
pr_ := paragraph_arr_[i].pPr;
if not ifObj(pr_.Root()) then continue;
cur := ##pf();
if ifnil(ret) then ret := cur;
if ret <> cur then return TSDocxEnumerations.wdUndefined();
end
return ret;
End;
// Methods
Function TSDocxParagraphFormatRange.CloseUp();override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).CloseUp), nil);
End;
Function TSDocxParagraphFormatRange.IndentCharWidth(Count);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).IndentCharWidth), Count);
End;
Function TSDocxParagraphFormatRange.IndentFirstLineCharWidth(Count);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).IndentFirstLineCharWidth), Count);
End;
Function TSDocxParagraphFormatRange.OpenOrCloseUp();override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).OpenOrCloseUp), nil);
End;
Function TSDocxParagraphFormatRange.OpenUp();override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).OpenOrCloseUp), nil);
End;
Function TSDocxParagraphFormatRange.Reset();override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).Reset), nil);
End;
Function TSDocxParagraphFormatRange.Space1();override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).Space1), nil);
End;
Function TSDocxParagraphFormatRange.Space15();override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).Space15), nil);
End;
Function TSDocxParagraphFormatRange.Space2();override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).Space2), nil);
End;
Function TSDocxParagraphFormatRange.TabHangingIndent(Count);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).TabHangingIndent), Count);
End;
Function TSDocxParagraphFormatRange.TabIndent(Count);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).TabIndent), Count);
End;
// property
Function TSDocxParagraphFormatRange.WriteWordWrap(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteWordWrap), value);
End;
Function TSDocxParagraphFormatRange.ReadWordWrap();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadWordWrap));
End;
Function TSDocxParagraphFormatRange.WriteWidowControl(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteWidowControl), value);
End;
Function TSDocxParagraphFormatRange.ReadWidowControl();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadWidowControl));
End;
Function TSDocxParagraphFormatRange.WriteTextboxTightWrap(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteTextboxTightWrap), value);
End;
Function TSDocxParagraphFormatRange.ReadTextboxTightWrap();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadTextboxTightWrap));
End;
Function TSDocxParagraphFormatRange.WriteTabStops(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteTabStops), value);
End;
Function TSDocxParagraphFormatRange.ReadTabStops();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadTabStops));
End;
Function TSDocxParagraphFormatRange.WriteStyle(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteStyle), value);
End;
Function TSDocxParagraphFormatRange.ReadStyle();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadStyle));
End;
Function TSDocxParagraphFormatRange.WriteSpaceBeforeAuto(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteSpaceBeforeAuto), value);
End;
Function TSDocxParagraphFormatRange.ReadSpaceBeforeAuto();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadSpaceBeforeAuto));
End;
Function TSDocxParagraphFormatRange.WriteSpaceBefore(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteSpaceBefore), value);
End;
Function TSDocxParagraphFormatRange.ReadSpaceBefore();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadSpaceBefore));
End;
Function TSDocxParagraphFormatRange.WriteSpaceAfterAuto(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteSpaceAfterAuto), value);
End;
Function TSDocxParagraphFormatRange.ReadSpaceAfterAuto();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadSpaceAfterAuto));
End;
Function TSDocxParagraphFormatRange.WriteSpaceAfter(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteSpaceAfter), value);
End;
Function TSDocxParagraphFormatRange.ReadSpaceAfter();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadSpaceAfter));
End;
// TODO
Function TSDocxParagraphFormatRange.ReadShading();override;
Begin
End;
Function TSDocxParagraphFormatRange.WriteRightIndent(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteRightIndent), value);
End;
Function TSDocxParagraphFormatRange.ReadRightIndent();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadRightIndent));
End;
Function TSDocxParagraphFormatRange.WriteReadingOrder(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteReadingOrder), value);
End;
Function TSDocxParagraphFormatRange.ReadReadingOrder();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadReadingOrder));
End;
Function TSDocxParagraphFormatRange.WritePageBreakBefore(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WritePageBreakBefore), value);
End;
Function TSDocxParagraphFormatRange.ReadPageBreakBefore();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadPageBreakBefore));
End;
Function TSDocxParagraphFormatRange.WriteOutlineLevel(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteOutlineLevel), value);
End;
Function TSDocxParagraphFormatRange.ReadOutlineLevel();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadOutlineLevel));
End;
Function TSDocxParagraphFormatRange.WriteNoLineNumber(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteNoLineNumber), value);
End;
Function TSDocxParagraphFormatRange.ReadNoLineNumber();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadNoLineNumber));
End;
Function TSDocxParagraphFormatRange.WriteMirrorIndents(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteMirrorIndents), value);
End;
Function TSDocxParagraphFormatRange.ReadMirrorIndents();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadMirrorIndents));
End;
Function TSDocxParagraphFormatRange.WriteLineUnitBefore(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteLineUnitBefore), value);
End;
Function TSDocxParagraphFormatRange.ReadLineUnitBefore();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadLineUnitBefore));
End;
Function TSDocxParagraphFormatRange.WriteLineUnitAfter(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteLineUnitAfter), value);
End;
Function TSDocxParagraphFormatRange.ReadLineUnitAfter();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadLineUnitAfter));
End;
Function TSDocxParagraphFormatRange.WriteLineSpacingRule(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteLineSpacingRule), value);
End;
Function TSDocxParagraphFormatRange.ReadLineSpacingRule();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadLineSpacingRule));
End;
Function TSDocxParagraphFormatRange.WriteLineSpacing(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteLineSpacing), value);
End;
Function TSDocxParagraphFormatRange.ReadLineSpacing();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadLineSpacing));
End;
Function TSDocxParagraphFormatRange.WriteLeftIndent(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteLeftIndent), value);
End;
Function TSDocxParagraphFormatRange.ReadLeftIndent();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadLeftIndent));
End;
Function TSDocxParagraphFormatRange.WriteKeepWithNext(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteKeepWithNext), value);
End;
Function TSDocxParagraphFormatRange.ReadKeepWithNext();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadKeepWithNext));
End;
Function TSDocxParagraphFormatRange.WriteKeepTogether(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteKeepTogether), value);
End;
Function TSDocxParagraphFormatRange.ReadKeepTogether();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadKeepTogether));
End;
Function TSDocxParagraphFormatRange.WriteHyphenation(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteHyphenation), value);
End;
Function TSDocxParagraphFormatRange.ReadHyphenation();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadHyphenation));
End;
Function TSDocxParagraphFormatRange.WriteHangingPunctuation(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteHangingPunctuation), value);
End;
Function TSDocxParagraphFormatRange.ReadHangingPunctuation();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadHangingPunctuation));
End;
Function TSDocxParagraphFormatRange.WriteHalfWidthPunctuationOnTopOfLine(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteHalfWidthPunctuationOnTopOfLine), value);
End;
Function TSDocxParagraphFormatRange.ReadHalfWidthPunctuationOnTopOfLine();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadHalfWidthPunctuationOnTopOfLine));
End;
Function TSDocxParagraphFormatRange.WriteFirstLineIndent(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteFirstLineIndent), value);
End;
Function TSDocxParagraphFormatRange.ReadFirstLineIndent();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadFirstLineIndent));
End;
Function TSDocxParagraphFormatRange.WriteFarEastLineBreakControl(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteFarEastLineBreakControl), value);
End;
Function TSDocxParagraphFormatRange.ReadFarEastLineBreakControl();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadFarEastLineBreakControl));
End;
Function TSDocxParagraphFormatRange.ReadDuplicate();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadDuplicate));
End;
Function TSDocxParagraphFormatRange.WriteDisableLineHeightGrid(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteDisableLineHeightGrid), value);
End;
Function TSDocxParagraphFormatRange.ReadDisableLineHeightGrid();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadDisableLineHeightGrid));
End;
Function TSDocxParagraphFormatRange.WriteCollapsedByDefault(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteCollapsedByDefault), value);
End;
Function TSDocxParagraphFormatRange.ReadCollapsedByDefault();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadCollapsedByDefault));
End;
Function TSDocxParagraphFormatRange.WriteCharacterUnitRightIndent(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteCharacterUnitRightIndent), value);
End;
Function TSDocxParagraphFormatRange.ReadCharacterUnitRightIndent();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadCharacterUnitRightIndent));
End;
Function TSDocxParagraphFormatRange.WriteCharacterUnitLeftIndent(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteCharacterUnitLeftIndent), value);
End;
Function TSDocxParagraphFormatRange.ReadCharacterUnitLeftIndent();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadCharacterUnitLeftIndent));
End;
Function TSDocxParagraphFormatRange.WriteCharacterUnitFirstLineIndent(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteCharacterUnitFirstLineIndent), value);
End;
Function TSDocxParagraphFormatRange.ReadCharacterUnitFirstLineIndent();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadCharacterUnitFirstLineIndent));
End;
Function TSDocxParagraphFormatRange.ReadBorders(index);override;
Begin
// 重组一个新的range_arr_
arr := array();
for i:=0 to length(paragraph_arr_)-1 do
arr[i]["entirety"] := paragraph_arr_[i].Root();
borders_obj := new TSDocxBordersRange(self.Application, self.Creator, self.Parent);
borders_obj.Init(arr);
return ifnil(index) ? borders_obj : borders_obj.Item(index);
End;
Function TSDocxParagraphFormatRange.WriteBaseLineAlignment(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteBaseLineAlignment), value);
End;
Function TSDocxParagraphFormatRange.ReadBaseLineAlignment();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadBaseLineAlignment));
End;
Function TSDocxParagraphFormatRange.WriteAutoAdjustRightIndent(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteAutoAdjustRightIndent), value);
End;
Function TSDocxParagraphFormatRange.ReadAutoAdjustRightIndent();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadAutoAdjustRightIndent));
End;
Function TSDocxParagraphFormatRange.WriteAlignment(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteAlignment), value);
End;
Function TSDocxParagraphFormatRange.ReadAlignment();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadAlignment));
End;
Function TSDocxParagraphFormatRange.WriteAddSpaceBetweenFarEastAndDigit(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteAddSpaceBetweenFarEastAndDigit), value);
End;
Function TSDocxParagraphFormatRange.ReadAddSpaceBetweenFarEastAndDigit();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadAddSpaceBetweenFarEastAndDigit));
End;
Function TSDocxParagraphFormatRange.WriteAddSpaceBetweenFarEastAndAlpha(value);override;
Begin
CallFunction(ThisFunction(class(TSDocxParagraphFormat).WriteAddSpaceBetweenFarEastAndAlpha), value);
End;
Function TSDocxParagraphFormatRange.ReadAddSpaceBetweenFarEastAndAlpha();override;
Begin
return CallFunction(ThisFunction(class(TSDocxParagraphFormatRange).ReadAddSpaceBetweenFarEastAndAlpha));
End;