You've already forked lazarus-ccr
fpspreadsheet: Refactor style reading in ODS reader
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7559 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -142,6 +142,7 @@ type
|
|||||||
procedure ReadShapes(ATableNode: TDOMNode);
|
procedure ReadShapes(ATableNode: TDOMNode);
|
||||||
procedure ReadSheetProtection(ANode: TDOMNode; ASheet: TsBasicWorksheet);
|
procedure ReadSheetProtection(ANode: TDOMNode; ASheet: TsBasicWorksheet);
|
||||||
procedure ReadSheets(ANode: TDOMNode);
|
procedure ReadSheets(ANode: TDOMNode);
|
||||||
|
procedure ReadStyle_ParagraphProperties(ANode: TDOMNode; var AFormat: TsCellFormat);
|
||||||
procedure ReadTableStyle(AStyleNode: TDOMNode);
|
procedure ReadTableStyle(AStyleNode: TDOMNode);
|
||||||
|
|
||||||
protected
|
protected
|
||||||
@ -4736,6 +4737,32 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TsSpreadOpenDocReader.ReadStyle_ParagraphProperties(ANode: TDOMNode;
|
||||||
|
var AFormat: TsCellFormat);
|
||||||
|
var
|
||||||
|
s: String;
|
||||||
|
begin
|
||||||
|
// Horizontal text alignment
|
||||||
|
s := GetAttrValue(ANode, 'fo:text-align');
|
||||||
|
if s = 'start' then
|
||||||
|
AFormat.HorAlignment := haLeft
|
||||||
|
else if s = 'end' then
|
||||||
|
AFormat.HorAlignment := haRight
|
||||||
|
else if s = 'center' then
|
||||||
|
AFormat.HorAlignment := haCenter;
|
||||||
|
if AFormat.HorAlignment <> haDefault then
|
||||||
|
Include(AFormat.UsedFormattingFields, uffHorAlign);
|
||||||
|
|
||||||
|
// BiDi mode
|
||||||
|
s := GetAttrValue(ANode, 'style:writing-mode');
|
||||||
|
if s = 'lr-tb' then
|
||||||
|
AFormat.BiDiMode := bdRTL
|
||||||
|
else if s = 'rl-tb' then
|
||||||
|
AFormat.BiDiMode := bdRTL;
|
||||||
|
if AFormat.BiDiMode <> bdDefault then
|
||||||
|
Include(AFormat.UsedFormattingFields, uffBiDi);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TsSpreadOpenDocReader.ReadStyles(AStylesNode: TDOMNode);
|
procedure TsSpreadOpenDocReader.ReadStyles(AStylesNode: TDOMNode);
|
||||||
var
|
var
|
||||||
styleNode: TDOMNode;
|
styleNode: TDOMNode;
|
||||||
@ -5097,6 +5124,8 @@ begin
|
|||||||
else
|
else
|
||||||
if nodeName = 'style:paragraph-properties' then
|
if nodeName = 'style:paragraph-properties' then
|
||||||
begin
|
begin
|
||||||
|
ReadStyle_ParagraphProperties(styleChildNode, fmt);
|
||||||
|
(*
|
||||||
// Horizontal text alignment
|
// Horizontal text alignment
|
||||||
s := GetAttrValue(styleChildNode, 'fo:text-align');
|
s := GetAttrValue(styleChildNode, 'fo:text-align');
|
||||||
if s = 'start' then
|
if s = 'start' then
|
||||||
@ -5115,6 +5144,7 @@ begin
|
|||||||
fmt.BiDiMode := bdRTL;
|
fmt.BiDiMode := bdRTL;
|
||||||
if fmt.BiDiMode <> bdDefault then
|
if fmt.BiDiMode <> bdDefault then
|
||||||
Include(fmt.UsedFormattingFields, uffBiDi);
|
Include(fmt.UsedFormattingFields, uffBiDi);
|
||||||
|
*)
|
||||||
end;
|
end;
|
||||||
styleChildNode := styleChildNode.NextSibling;
|
styleChildNode := styleChildNode.NextSibling;
|
||||||
end;
|
end;
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<Version Value="11"/>
|
<Version Value="12"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<General>
|
<General>
|
||||||
|
<Flags>
|
||||||
|
<CompatibilityMode Value="True"/>
|
||||||
|
</Flags>
|
||||||
<SessionStorage Value="InProjectDir"/>
|
<SessionStorage Value="InProjectDir"/>
|
||||||
<MainUnit Value="0"/>
|
|
||||||
<Title Value="spreadtestgui"/>
|
<Title Value="spreadtestgui"/>
|
||||||
<ResourceType Value="res"/>
|
<ResourceType Value="res"/>
|
||||||
</General>
|
</General>
|
||||||
|
Reference in New Issue
Block a user