mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-28 11:57:14 +01:00
fpvectorial-odt: Advances text document support
git-svn-id: trunk@42368 -
This commit is contained in:
parent
6d2ad4be5c
commit
7c47abc6d7
@ -24,7 +24,7 @@ begin
|
|||||||
// A4 -> 210mm x 297mm
|
// A4 -> 210mm x 297mm
|
||||||
Vec.Width := 210;
|
Vec.Width := 210;
|
||||||
Vec.Height := 297;
|
Vec.Height := 297;
|
||||||
Vec.AddStandardTextDocumentStyles();
|
Vec.AddStandardODTTextDocumentStyles();
|
||||||
|
|
||||||
// First page sequence
|
// First page sequence
|
||||||
Page := Vec.AddTextPageSequence();
|
Page := Vec.AddTextPageSequence();
|
||||||
|
|||||||
@ -136,14 +136,23 @@ type
|
|||||||
);
|
);
|
||||||
TvSetPenBrushAndFontElements = set of TvSetPenBrushAndFontElement;
|
TvSetPenBrushAndFontElements = set of TvSetPenBrushAndFontElement;
|
||||||
|
|
||||||
|
TvStyleKind = (vskTextBody, vskHeading);
|
||||||
|
|
||||||
|
{ TvStyle }
|
||||||
|
|
||||||
TvStyle = class
|
TvStyle = class
|
||||||
Name: string;
|
Name: string;
|
||||||
|
Parent: TvStyle; // Can be nil
|
||||||
|
Kind: TvStyleKind;
|
||||||
|
//
|
||||||
Pen: TvPen;
|
Pen: TvPen;
|
||||||
Brush: TvBrush;
|
Brush: TvBrush;
|
||||||
Font: TvFont;
|
Font: TvFont;
|
||||||
SetElements: TvSetPenBrushAndFontElements;
|
SetElements: TvSetPenBrushAndFontElements;
|
||||||
//
|
//
|
||||||
MarginTop, MarginBottom, MarginLeft, MarginRight: Double; // in mm
|
MarginTop, MarginBottom, MarginLeft, MarginRight: Double; // in mm
|
||||||
|
//
|
||||||
|
function GetKind: TvStyleKind; // takes care of parenting
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Coordinates and polyline segments }
|
{ Coordinates and polyline segments }
|
||||||
@ -788,7 +797,7 @@ type
|
|||||||
public
|
public
|
||||||
Width, Height: Double;
|
Width, Height: Double;
|
||||||
AutoExpand: TvRichTextAutoExpand;
|
AutoExpand: TvRichTextAutoExpand;
|
||||||
Style: string;
|
Style: TvStyle;
|
||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function AddText: TvText;
|
function AddText: TvText;
|
||||||
@ -843,9 +852,10 @@ type
|
|||||||
function AddTextPageSequence(): TvTextPageSequence;
|
function AddTextPageSequence(): TvTextPageSequence;
|
||||||
{ Style methods }
|
{ Style methods }
|
||||||
function AddStyle(): TvStyle;
|
function AddStyle(): TvStyle;
|
||||||
procedure AddStandardTextDocumentStyles;
|
procedure AddStandardODTTextDocumentStyles;
|
||||||
function GetStyleCount: Integer;
|
function GetStyleCount: Integer;
|
||||||
function GetStyle(AIndex: Integer): TvStyle;
|
function GetStyle(AIndex: Integer): TvStyle;
|
||||||
|
function FindStyleIndex(AStyle: TvStyle): Integer;
|
||||||
{ Data removing methods }
|
{ Data removing methods }
|
||||||
procedure Clear; virtual;
|
procedure Clear; virtual;
|
||||||
{ Debug methods }
|
{ Debug methods }
|
||||||
@ -1107,6 +1117,14 @@ begin
|
|||||||
Result.Z := 0;
|
Result.Z := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TvStyle }
|
||||||
|
|
||||||
|
function TvStyle.GetKind: TvStyleKind;
|
||||||
|
begin
|
||||||
|
if Parent = nil then Result := Kind
|
||||||
|
else Result := Parent.GetKind();
|
||||||
|
end;
|
||||||
|
|
||||||
{ T2DEllipticalArcSegment }
|
{ T2DEllipticalArcSegment }
|
||||||
|
|
||||||
function T2DEllipticalArcSegment.AlignedEllipseCenterEquationT1(
|
function T2DEllipticalArcSegment.AlignedEllipseCenterEquationT1(
|
||||||
@ -5103,36 +5121,87 @@ begin
|
|||||||
FStyles.Add(Result);
|
FStyles.Add(Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TvVectorialDocument.AddStandardTextDocumentStyles;
|
procedure TvVectorialDocument.AddStandardODTTextDocumentStyles;
|
||||||
var
|
var
|
||||||
lCurStyle: TvStyle;
|
lTextBody, lBaseHeading, lCurStyle: TvStyle;
|
||||||
begin
|
begin
|
||||||
lCurStyle := AddStyle();
|
//<style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">
|
||||||
lCurStyle.Name := 'Text Body';
|
// <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.212cm" style:contextual-spacing="false" />
|
||||||
lCurStyle.Font.Size := 12;
|
//</style:style>
|
||||||
lCurStyle.Font.Name := 'Times New Roman';
|
lTextBody := AddStyle();
|
||||||
lCurStyle.SetElements := [spbfFontSize, spbfFontName];
|
lTextBody.Name := 'Text Body';
|
||||||
lCurStyle.MarginTop := 0;
|
lTextBody.Kind := vskTextBody;
|
||||||
lCurStyle.MarginBottom := 2.12;
|
lTextBody.Font.Size := 12;
|
||||||
|
lTextBody.Font.Name := 'Times New Roman';
|
||||||
|
lTextBody.SetElements := [spbfFontSize, spbfFontName];
|
||||||
|
lTextBody.MarginTop := 0;
|
||||||
|
lTextBody.MarginBottom := 2.12;
|
||||||
|
|
||||||
|
// Headings
|
||||||
|
|
||||||
|
// <style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text">
|
||||||
|
// <style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" style:contextual-spacing="false" fo:keep-with-next="always" />
|
||||||
|
// <style:text-properties style:font-name="Arial" fo:font-size="14pt" style:font-name-asian="Microsoft YaHei" style:font-size-asian="14pt" style:font-name-complex="Mangal" style:font-size-complex="14pt" />
|
||||||
|
// </style:style>
|
||||||
|
lBaseHeading := AddStyle();
|
||||||
|
lBaseHeading.Name := 'Text Body';
|
||||||
|
lBaseHeading.Kind := vskHeading;
|
||||||
|
lBaseHeading.Font.Size := 14;
|
||||||
|
lBaseHeading.Font.Name := 'Arial';
|
||||||
|
lBaseHeading.SetElements := [spbfFontSize, spbfFontName];
|
||||||
|
lBaseHeading.MarginTop := 4.23;
|
||||||
|
lBaseHeading.MarginBottom := 2.12;
|
||||||
|
|
||||||
|
//<style:style style:name="Heading_20_1" style:display-name="Heading 1" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="1" style:class="text">
|
||||||
|
// <style:text-properties fo:font-size="115%" fo:font-weight="bold" style:font-size-asian="115%" style:font-weight-asian="bold" style:font-size-complex="115%" style:font-weight-complex="bold" />
|
||||||
|
//</style:style>
|
||||||
lCurStyle := AddStyle();
|
lCurStyle := AddStyle();
|
||||||
lCurStyle.Name := 'Heading 1';
|
lCurStyle.Name := 'Heading 1';
|
||||||
lCurStyle.Font.Size := 16;
|
lCurStyle.Parent := lBaseHeading;
|
||||||
lCurStyle.Font.Name := 'Arial';
|
lCurStyle.Font.Size := Round(1.15 * lBaseHeading.Font.Size);
|
||||||
lCurStyle.Font.Bold := True;
|
lCurStyle.Font.Bold := True;
|
||||||
lCurStyle.SetElements := [spbfFontSize, spbfFontName, spbfFontBold, spbfFontItalic];
|
lCurStyle.SetElements := [spbfFontSize, spbfFontBold];
|
||||||
lCurStyle.MarginTop := 4.23;
|
|
||||||
lCurStyle.MarginBottom := 2.12;
|
|
||||||
|
|
||||||
|
//<style:style style:name="Heading_20_2" style:display-name="Heading 2" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="2" style:class="text">
|
||||||
|
// <style:text-properties fo:font-size="14pt" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="14pt" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="14pt" style:font-style-complex="italic" style:font-weight-complex="bold" />
|
||||||
|
//</style:style>
|
||||||
lCurStyle := AddStyle();
|
lCurStyle := AddStyle();
|
||||||
lCurStyle.Name := 'Heading 2';
|
lCurStyle.Name := 'Heading 2';
|
||||||
|
lCurStyle.Parent := lBaseHeading;
|
||||||
lCurStyle.Font.Size := 14;
|
lCurStyle.Font.Size := 14;
|
||||||
lCurStyle.Font.Name := 'Arial';
|
|
||||||
lCurStyle.Font.Bold := True;
|
lCurStyle.Font.Bold := True;
|
||||||
lCurStyle.Font.Italic := True;
|
lCurStyle.Font.Italic := True;
|
||||||
lCurStyle.SetElements := [spbfFontSize, spbfFontName, spbfFontBold, spbfFontItalic];
|
lCurStyle.SetElements := [spbfFontSize, spbfFontBold, spbfFontItalic];
|
||||||
lCurStyle.MarginTop := 4.23;
|
|
||||||
lCurStyle.MarginBottom := 2.12;
|
//<style:style style:name="Heading_20_3" style:display-name="Heading 3" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="3" style:class="text">
|
||||||
|
// <style:text-properties fo:font-size="14pt" fo:font-weight="bold" style:font-size-asian="14pt" style:font-weight-asian="bold" style:font-size-complex="14pt" style:font-weight-complex="bold" />
|
||||||
|
//</style:style>
|
||||||
|
lCurStyle := AddStyle();
|
||||||
|
lCurStyle.Name := 'Heading 3';
|
||||||
|
lCurStyle.Parent := lBaseHeading;
|
||||||
|
lCurStyle.Font.Size := 14;
|
||||||
|
lCurStyle.Font.Bold := True;
|
||||||
|
lCurStyle.SetElements := [spbfFontSize, spbfFontName, spbfFontBold];
|
||||||
|
|
||||||
|
{
|
||||||
|
<style:style style:name="List" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="list">
|
||||||
|
<style:text-properties style:font-size-asian="12pt" style:font-name-complex="Mangal1" />
|
||||||
|
</style:style>
|
||||||
|
<style:style style:name="Caption" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
|
||||||
|
<style:paragraph-properties fo:margin-top="0.212cm" fo:margin-bottom="0.212cm" style:contextual-spacing="false" text:number-lines="false" text:line-number="0" />
|
||||||
|
<style:text-properties fo:font-size="12pt" fo:font-style="italic" style:font-size-asian="12pt" style:font-style-asian="italic" style:font-name-complex="Mangal1" style:font-size-complex="12pt" style:font-style-complex="italic" />
|
||||||
|
</style:style>
|
||||||
|
<style:style style:name="Index" style:family="paragraph" style:parent-style-name="Standard" style:class="index">
|
||||||
|
<style:paragraph-properties text:number-lines="false" text:line-number="0" />
|
||||||
|
<style:text-properties style:font-size-asian="12pt" style:font-name-complex="Mangal1" />
|
||||||
|
</style:style>
|
||||||
|
<style:style style:name="Internet_20_link" style:display-name="Internet link" style:family="text">
|
||||||
|
<style:text-properties fo:color="#000080" fo:language="zxx" fo:country="none" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" style:language-asian="zxx" style:country-asian="none" style:language-complex="zxx" style:country-complex="none" />
|
||||||
|
</style:style>
|
||||||
|
<style:style style:name="Bullet_20_Symbols" style:display-name="Bullet Symbols" style:family="text">
|
||||||
|
<style:text-properties style:font-name="OpenSymbol" style:font-name-asian="OpenSymbol" style:font-name-complex="OpenSymbol" />
|
||||||
|
</style:style>
|
||||||
|
}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TvVectorialDocument.GetStyleCount: Integer;
|
function TvVectorialDocument.GetStyleCount: Integer;
|
||||||
@ -5145,6 +5214,15 @@ begin
|
|||||||
Result := TvStyle(FStyles.Items[AIndex]);
|
Result := TvStyle(FStyles.Items[AIndex]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TvVectorialDocument.FindStyleIndex(AStyle: TvStyle): Integer;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
Result := -1;
|
||||||
|
for i := 0 to GetStyleCount()-1 do
|
||||||
|
if GetStyle(i) = AStyle then Exit(i);
|
||||||
|
end;
|
||||||
|
|
||||||
{@@
|
{@@
|
||||||
Clears all data in the document
|
Clears all data in the document
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,7 @@ type
|
|||||||
FMeta, FSettings, FStyles, FContent, FMimetype: string;
|
FMeta, FSettings, FStyles, FContent, FMimetype: string;
|
||||||
FMetaInfManifest: string;
|
FMetaInfManifest: string;
|
||||||
// helper routines
|
// helper routines
|
||||||
function StyleNameToODTStyleName(AData: TvVectorialDocument; AStyleIndex: Integer; AToContentAutoStyle: Boolean): string;
|
function StyleNameToODTStyleName(AData: TvVectorialDocument; AStyleIndex: Integer; AToContentAutoStyle: Boolean = False): string;
|
||||||
function FloatToODTText(AFloat: Double): string;
|
function FloatToODTText(AFloat: Double): string;
|
||||||
// Routines to write those files
|
// Routines to write those files
|
||||||
procedure WriteMimetype;
|
procedure WriteMimetype;
|
||||||
@ -73,6 +73,8 @@ type
|
|||||||
procedure WriteStyles(AData: TvVectorialDocument);
|
procedure WriteStyles(AData: TvVectorialDocument);
|
||||||
procedure WriteDocument(AData: TvVectorialDocument);
|
procedure WriteDocument(AData: TvVectorialDocument);
|
||||||
procedure WritePage(ACurPage: TvTextPageSequence);
|
procedure WritePage(ACurPage: TvTextPageSequence);
|
||||||
|
//
|
||||||
|
procedure WriteParagraph(AEntity: TvRichText; ACurPage: TvTextPageSequence);
|
||||||
// Routines to write parts of those files
|
// Routines to write parts of those files
|
||||||
function WriteStylesXMLAsString: string;
|
function WriteStylesXMLAsString: string;
|
||||||
//
|
//
|
||||||
@ -336,7 +338,7 @@ procedure TvODTVectorialWriter.WriteStyles(AData: TvVectorialDocument);
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
CurStyle: TvStyle;
|
CurStyle: TvStyle;
|
||||||
lTextPropsStr, lParagraphPropsStr, lCurStyleTmpStr: string;
|
lTextPropsStr, lParagraphPropsStr, lCurStyleTmpStr, CurStyleParent: string;
|
||||||
begin
|
begin
|
||||||
FStyles :=
|
FStyles :=
|
||||||
XML_HEADER + LineEnding +
|
XML_HEADER + LineEnding +
|
||||||
@ -439,6 +441,9 @@ begin
|
|||||||
lParagraphPropsStr := '';
|
lParagraphPropsStr := '';
|
||||||
CurStyle := AData.GetStyle(i);
|
CurStyle := AData.GetStyle(i);
|
||||||
|
|
||||||
|
if CurStyle.Parent = nil then CurStyleParent := 'Standard'
|
||||||
|
else CurStyleParent := StyleNameToODTStyleName(AData, AData.FindStyleIndex(CurStyle.Parent), False);
|
||||||
|
|
||||||
if spbfFontSize in CurStyle.SetElements then
|
if spbfFontSize in CurStyle.SetElements then
|
||||||
begin
|
begin
|
||||||
lTextPropsStr := lTextPropsStr + ' fo:font-size="'+IntToStr(CurStyle.Font.Size)+'pt" ';
|
lTextPropsStr := lTextPropsStr + ' fo:font-size="'+IntToStr(CurStyle.Font.Size)+'pt" ';
|
||||||
@ -465,7 +470,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
lCurStyleTmpStr := // tmp string to help see the text in the debugger
|
lCurStyleTmpStr := // tmp string to help see the text in the debugger
|
||||||
' <style:style style:name="'+StyleNameToODTStyleName(AData, i, False)+'" style:display-name="'+ CurStyle.Name +'" style:family="paragraph" style:parent-style-name="Standard" style:class="text">' + LineEnding +
|
' <style:style style:name="'+StyleNameToODTStyleName(AData, i, False)+'" style:display-name="'+ CurStyle.Name +'" style:family="paragraph" style:parent-style-name="'+CurStyleParent+'" style:class="text">' + LineEnding +
|
||||||
' <style:paragraph-properties fo:margin-top="'+FloatToODTText(CurStyle.MarginTop)+'mm" fo:margin-bottom="'+FloatToODTText(CurStyle.MarginTop)+'mm" style:contextual-spacing="false" />' + LineEnding +
|
' <style:paragraph-properties fo:margin-top="'+FloatToODTText(CurStyle.MarginTop)+'mm" fo:margin-bottom="'+FloatToODTText(CurStyle.MarginTop)+'mm" style:contextual-spacing="false" />' + LineEnding +
|
||||||
' <style:text-properties '+lTextPropsStr+' />' + LineEnding +
|
' <style:text-properties '+lTextPropsStr+' />' + LineEnding +
|
||||||
' </style:style>' + LineEnding;
|
' </style:style>' + LineEnding;
|
||||||
@ -499,82 +504,98 @@ begin
|
|||||||
<style:style style:name="Internet_20_link" style:display-name="Internet link" style:family="text">
|
<style:style style:name="Internet_20_link" style:display-name="Internet link" style:family="text">
|
||||||
<style:text-properties fo:color="#000080" fo:language="zxx" fo:country="none" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" style:language-asian="zxx" style:country-asian="none" style:language-complex="zxx" style:country-complex="none" />
|
<style:text-properties fo:color="#000080" fo:language="zxx" fo:country="none" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" style:language-asian="zxx" style:country-asian="none" style:language-complex="zxx" style:country-complex="none" />
|
||||||
</style:style>
|
</style:style>
|
||||||
|
<style:style style:name="Bullet_20_Symbols" style:display-name="Bullet Symbols" style:family="text">
|
||||||
|
<style:text-properties style:font-name="OpenSymbol" style:font-name-asian="OpenSymbol" style:font-name-complex="OpenSymbol" />
|
||||||
|
</style:style>
|
||||||
}
|
}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{
|
{
|
||||||
<style:style style:name="Bullet_20_Symbols" style:display-name="Bullet Symbols" style:family="text">
|
<text:outline-style style:name="Outline">
|
||||||
<style:text-properties style:font-name="OpenSymbol" style:font-name-asian="OpenSymbol" style:font-name-complex="OpenSymbol" />
|
<text:outline-level-style text:level="1" style:num-format="">
|
||||||
</style:style>
|
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||||
<text:outline-style style:name="Outline">
|
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.762cm" fo:text-indent="-0.762cm" fo:margin-left="0.762cm" />
|
||||||
<text:outline-level-style text:level="1" style:num-format="">
|
</style:list-level-properties>
|
||||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
</text:outline-level-style>
|
||||||
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="0.762cm" fo:text-indent="-0.762cm" fo:margin-left="0.762cm" />
|
<text:outline-level-style text:level="2" style:num-format="">
|
||||||
</style:list-level-properties>
|
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||||
</text:outline-level-style>
|
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.016cm" fo:text-indent="-1.016cm" fo:margin-left="1.016cm" />
|
||||||
<text:outline-level-style text:level="2" style:num-format="">
|
</style:list-level-properties>
|
||||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
</text:outline-level-style>
|
||||||
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.016cm" fo:text-indent="-1.016cm" fo:margin-left="1.016cm" />
|
<text:outline-level-style text:level="3" style:num-format="">
|
||||||
</style:list-level-properties>
|
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||||
</text:outline-level-style>
|
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.27cm" fo:text-indent="-1.27cm" fo:margin-left="1.27cm" />
|
||||||
<text:outline-level-style text:level="3" style:num-format="">
|
</style:list-level-properties>
|
||||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
</text:outline-level-style>
|
||||||
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.27cm" fo:text-indent="-1.27cm" fo:margin-left="1.27cm" />
|
<text:outline-level-style text:level="4" style:num-format="">
|
||||||
</style:list-level-properties>
|
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||||
</text:outline-level-style>
|
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.524cm" fo:text-indent="-1.524cm" fo:margin-left="1.524cm" />
|
||||||
<text:outline-level-style text:level="4" style:num-format="">
|
</style:list-level-properties>
|
||||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
</text:outline-level-style>
|
||||||
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.524cm" fo:text-indent="-1.524cm" fo:margin-left="1.524cm" />
|
<text:outline-level-style text:level="5" style:num-format="">
|
||||||
</style:list-level-properties>
|
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||||
</text:outline-level-style>
|
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.778cm" fo:text-indent="-1.778cm" fo:margin-left="1.778cm" />
|
||||||
<text:outline-level-style text:level="5" style:num-format="">
|
</style:list-level-properties>
|
||||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
</text:outline-level-style>
|
||||||
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.778cm" fo:text-indent="-1.778cm" fo:margin-left="1.778cm" />
|
<text:outline-level-style text:level="6" style:num-format="">
|
||||||
</style:list-level-properties>
|
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||||
</text:outline-level-style>
|
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.032cm" fo:text-indent="-2.032cm" fo:margin-left="2.032cm" />
|
||||||
<text:outline-level-style text:level="6" style:num-format="">
|
</style:list-level-properties>
|
||||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
</text:outline-level-style>
|
||||||
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.032cm" fo:text-indent="-2.032cm" fo:margin-left="2.032cm" />
|
<text:outline-level-style text:level="7" style:num-format="">
|
||||||
</style:list-level-properties>
|
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||||
</text:outline-level-style>
|
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.286cm" fo:text-indent="-2.286cm" fo:margin-left="2.286cm" />
|
||||||
<text:outline-level-style text:level="7" style:num-format="">
|
</style:list-level-properties>
|
||||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
</text:outline-level-style>
|
||||||
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.286cm" fo:text-indent="-2.286cm" fo:margin-left="2.286cm" />
|
<text:outline-level-style text:level="8" style:num-format="">
|
||||||
</style:list-level-properties>
|
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||||
</text:outline-level-style>
|
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.54cm" fo:text-indent="-2.54cm" fo:margin-left="2.54cm" />
|
||||||
<text:outline-level-style text:level="8" style:num-format="">
|
</style:list-level-properties>
|
||||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
</text:outline-level-style>
|
||||||
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.54cm" fo:text-indent="-2.54cm" fo:margin-left="2.54cm" />
|
<text:outline-level-style text:level="9" style:num-format="">
|
||||||
</style:list-level-properties>
|
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||||
</text:outline-level-style>
|
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.794cm" fo:text-indent="-2.794cm" fo:margin-left="2.794cm" />
|
||||||
<text:outline-level-style text:level="9" style:num-format="">
|
</style:list-level-properties>
|
||||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
</text:outline-level-style>
|
||||||
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.794cm" fo:text-indent="-2.794cm" fo:margin-left="2.794cm" />
|
<text:outline-level-style text:level="10" style:num-format="">
|
||||||
</style:list-level-properties>
|
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
||||||
</text:outline-level-style>
|
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="3.048cm" fo:text-indent="-3.048cm" fo:margin-left="3.048cm" />
|
||||||
<text:outline-level-style text:level="10" style:num-format="">
|
</style:list-level-properties>
|
||||||
<style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
|
</text:outline-level-style>
|
||||||
<style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="3.048cm" fo:text-indent="-3.048cm" fo:margin-left="3.048cm" />
|
</text:outline-style>
|
||||||
</style:list-level-properties>
|
}
|
||||||
</text:outline-level-style>
|
FStyles := FStyles +
|
||||||
</text:outline-style>
|
' <text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document" />' + LineEnding;
|
||||||
<text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document" />
|
FStyles := FStyles +
|
||||||
<text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0" />
|
' <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0" />' + LineEnding;
|
||||||
<text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5" />
|
FStyles := FStyles +
|
||||||
</office:styles>
|
' <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5" />' + LineEnding;
|
||||||
<office:automatic-styles>
|
FStyles := FStyles +
|
||||||
<style:page-layout style:name="Mpm1">
|
'</office:styles>' + LineEnding;
|
||||||
<style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
|
FStyles := FStyles +
|
||||||
<style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000" />
|
'<office:automatic-styles>' + LineEnding;
|
||||||
</style:page-layout-properties>
|
FStyles := FStyles +
|
||||||
<style:header-style />
|
' <style:page-layout style:name="Mpm1">' + LineEnding;
|
||||||
<style:footer-style />
|
FStyles := FStyles +
|
||||||
</style:page-layout>
|
' <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">' + LineEnding;
|
||||||
</office:automatic-styles>
|
FStyles := FStyles +
|
||||||
<office:master-styles>
|
' <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000" />' + LineEnding;
|
||||||
<style:master-page style:name="Standard" style:page-layout-name="Mpm1" />
|
FStyles := FStyles +
|
||||||
</office:master-styles>
|
' </style:page-layout-properties>' + LineEnding;
|
||||||
}
|
FStyles := FStyles +
|
||||||
|
' <style:header-style />' + LineEnding;
|
||||||
|
FStyles := FStyles +
|
||||||
|
' <style:footer-style />' + LineEnding;
|
||||||
|
FStyles := FStyles +
|
||||||
|
' </style:page-layout>' + LineEnding;
|
||||||
|
FStyles := FStyles +
|
||||||
|
'</office:automatic-styles>' + LineEnding;
|
||||||
|
FStyles := FStyles +
|
||||||
|
'<office:master-styles>' + LineEnding;
|
||||||
|
FStyles := FStyles +
|
||||||
|
' <style:master-page style:name="Standard" style:page-layout-name="Mpm1" />' + LineEnding;
|
||||||
|
FStyles := FStyles +
|
||||||
|
'</office:master-styles>' + LineEnding;
|
||||||
FStyles := FStyles +
|
FStyles := FStyles +
|
||||||
'</office:document-styles>';
|
'</office:document-styles>';
|
||||||
end;
|
end;
|
||||||
@ -731,17 +752,60 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TvODTVectorialWriter.WritePage(ACurPage: TvTextPageSequence);
|
procedure TvODTVectorialWriter.WritePage(ACurPage: TvTextPageSequence);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
lCurEntity: TvEntity;
|
||||||
begin
|
begin
|
||||||
|
FContent := FContent +
|
||||||
|
' <text:sequence-decls>' + LineEnding;
|
||||||
|
FContent := FContent +
|
||||||
|
' <text:sequence-decl text:display-outline-level="0" text:name="Illustration" />' + LineEnding;
|
||||||
|
FContent := FContent +
|
||||||
|
' <text:sequence-decl text:display-outline-level="0" text:name="Table" />' + LineEnding;
|
||||||
|
FContent := FContent +
|
||||||
|
' <text:sequence-decl text:display-outline-level="0" text:name="Text" />' + LineEnding;
|
||||||
|
FContent := FContent +
|
||||||
|
' <text:sequence-decl text:display-outline-level="0" text:name="Drawing" />' + LineEnding;
|
||||||
|
FContent := FContent +
|
||||||
|
' </text:sequence-decls>' + LineEnding;
|
||||||
|
|
||||||
|
for i := 0 to ACurPage.GetEntitiesCount()-1 do
|
||||||
|
begin
|
||||||
|
lCurEntity := ACurPage.GetEntity(i);
|
||||||
|
|
||||||
|
if not (lCurEntity is TvRichText) then Continue;
|
||||||
|
|
||||||
|
WriteParagraph(TvRichText(lCurEntity), ACurPage);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TvODTVectorialWriter.WriteParagraph(AEntity: TvRichText;
|
||||||
|
ACurPage: TvTextPageSequence);
|
||||||
|
var
|
||||||
|
EntityKindName, AEntityStyleName: string;
|
||||||
|
begin
|
||||||
|
if AEntity.Style = nil then
|
||||||
|
begin
|
||||||
|
EntityKindName := 'p';
|
||||||
|
AEntityStyleName := 'Standard';
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
case AEntity.Style.GetKind() of
|
||||||
|
vskHeading: EntityKindName := 'h';
|
||||||
|
else // vskTextBody;
|
||||||
|
EntityKindName := 'p';
|
||||||
|
end;
|
||||||
|
|
||||||
|
AEntityStyleName := AEntity.Style.Name;
|
||||||
|
end;
|
||||||
|
|
||||||
|
FContent := FContent +
|
||||||
|
' <text:'+EntityKindName+' text:style-name="'+AEntityStyleName+'" >' +
|
||||||
|
' ' +
|
||||||
|
'</text:'+EntityKindName+'>' + LineEnding;
|
||||||
{
|
{
|
||||||
<text:sequence-decls>
|
<text:h text:style-name="P2" text:outline-level="1">Laza<text:span text:style-name="T1">ru</text:span>s</text:h>
|
||||||
<text:sequence-decl text:display-outline-level="0" text:name="Illustration" />
|
|
||||||
<text:sequence-decl text:display-outline-level="0" text:name="Table" />
|
|
||||||
<text:sequence-decl text:display-outline-level="0" text:name="Text" />
|
|
||||||
<text:sequence-decl text:display-outline-level="0" text:name="Drawing" />
|
|
||||||
</text:sequence-decls>
|
|
||||||
}
|
|
||||||
{
|
|
||||||
<text:h text:style-name="P2" text:outline-level="1">Lazarus</text:h>
|
|
||||||
<text:p text:style-name="P5">Lazarus is a free and open source development tool for the Free Pascal compiler, which is also free and open source.</text:p>
|
<text:p text:style-name="P5">Lazarus is a free and open source development tool for the Free Pascal compiler, which is also free and open source.</text:p>
|
||||||
<text:h text:style-name="P1" text:outline-level="2">Overview</text:h>
|
<text:h text:style-name="P1" text:outline-level="2">Overview</text:h>
|
||||||
<text:p text:style-name="P3">Lazarus is a free cross-platform visual integrated development environment (IDE) for rapid application development (RAD) using the Free Pascal compiler supported dialects of Object Pascal. Developers use Lazarus to create native code console and graphical user interface (GUI) applications for the desktop along with mobile devices, web applications, web services, and visual components and function libraries (.so, .dll, etc) for use by other programs for any platform the Free Pascal compiler supports( Mac, Unix, Linux, Windows, etc).</text:p>
|
<text:p text:style-name="P3">Lazarus is a free cross-platform visual integrated development environment (IDE) for rapid application development (RAD) using the Free Pascal compiler supported dialects of Object Pascal. Developers use Lazarus to create native code console and graphical user interface (GUI) applications for the desktop along with mobile devices, web applications, web services, and visual components and function libraries (.so, .dll, etc) for use by other programs for any platform the Free Pascal compiler supports( Mac, Unix, Linux, Windows, etc).</text:p>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user