mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 09:19:32 +02:00
Merge branch 'main' into 'main'
fpVectorial and odtVectorialWriter updates See merge request freepascal.org/lazarus/lazarus!222
This commit is contained in:
commit
87d776d7ca
@ -822,9 +822,15 @@ Var
|
||||
End;
|
||||
|
||||
{ TODO : Ensure these other properties can be set }
|
||||
//<w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="708" w:footer="708" w:gutter="0"/>
|
||||
//<w:cols w:space="708"/>
|
||||
//<w:docGrid w:linePitch="360"/>
|
||||
|
||||
// page margins
|
||||
sTemp := Format('<w:pgMar w:top="%s" w:right="%s" w:bottom="%s" w:left="%s" w:header="708" w:footer="708" w:gutter="0"/>',
|
||||
[mmToTwipsS(APageSequence.MarginTop), mmToTwipsS(APageSequence.MarginRight),
|
||||
mmToTwipsS(APageSequence.MarginBottom), mmToTwipsS(APageSequence.MarginLeft)]);
|
||||
oDocXML.Add(STemp);
|
||||
|
||||
oDocXML.Add(indDec, '</w:sectPr>', indDec);
|
||||
|
||||
If Not ALastPage Then
|
||||
@ -985,6 +991,14 @@ Var
|
||||
|
||||
oDocXML.Add('<w:vAlign w:val="' + LU_V_ALIGN[oCell.VerticalAlignment] + '" />');
|
||||
|
||||
// cell padding
|
||||
oDocXML.Add('<w:tcMar>', indInc);
|
||||
oDocXML.Add(Format('<w:top w:w="%s" w:type="dxa"/>', [mmToTwipsS(oCell.SpacingTop)]));
|
||||
oDocXML.Add(Format('<w:start w:w="%s" w:type="dxa"/>', [mmToTwipsS(oCell.SpacingLeft)]));
|
||||
oDocXML.Add(Format('<w:bottom w:w="%s" w:type="dxa"/>', [mmToTwipsS(oCell.SpacingBottom)]));
|
||||
oDocXML.Add(Format('<w:end w:w="%s" w:type="dxa"/>', [mmToTwipsS(oCell.SpacingRight)]));
|
||||
oDocXML.Add('</w:tcMar>', indDec);
|
||||
|
||||
oDocXML.Add(indDec, '</w:tcPr>', indDec);
|
||||
|
||||
ProcessRichText(oCell);
|
||||
|
@ -887,6 +887,7 @@ type
|
||||
procedure InitializeWithConvertionOf3DPointsToHeightMap(APage: TvVectorialPage; AWidth, AHeight: Integer);
|
||||
procedure Render(var ARenderInfo: TvRenderInfo; ADoDraw: Boolean = True); override;
|
||||
function GenerateDebugTree(ADestRoutine: TvDebugAddItemProc; APageItem: Pointer): Pointer; override;
|
||||
procedure Scale(ADeltaScaleX, ADeltaScaleY: Double); override;
|
||||
end;
|
||||
|
||||
{ TvPoint }
|
||||
@ -1484,6 +1485,8 @@ type
|
||||
BackgroundColor: TFPColor;
|
||||
AdjustPenColorToBackground: Boolean;
|
||||
RenderInfo: TvRenderInfo; // Prepared by the reader with info on how to draw the page
|
||||
// Page Margins (in millimeters)
|
||||
MarginTop, MarginBottom, MarginLeft, MarginRight: Integer;
|
||||
public
|
||||
{ Base methods }
|
||||
constructor Create(AOwner: TvVectorialDocument); virtual;
|
||||
@ -1492,6 +1495,8 @@ type
|
||||
procedure SetPageFormat(AFormat: TvPageFormat);
|
||||
function RealWidth: Double;
|
||||
function RealHeight: Double;
|
||||
procedure SetPageMargin(MTop, MBottom, MLeft, MRight: Integer);
|
||||
procedure SetPageMargin(AValue: Integer);
|
||||
{ Data reading methods }
|
||||
procedure CalculateDocumentSize; virtual;
|
||||
function GetEntity(ANum: Cardinal): TvEntity; virtual; abstract;
|
||||
@ -7234,6 +7239,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TvRasterImage.Scale(ADeltaScaleX, ADeltaScaleY: Double);
|
||||
begin
|
||||
Width := ADeltaScaleX;
|
||||
Height := ADeltaScaleY;
|
||||
end;
|
||||
|
||||
{ TvArrow }
|
||||
|
||||
procedure TvArrow.CalculateBoundingBox(constref ARenderInfo: TvRenderInfo; out
|
||||
@ -9002,6 +9013,19 @@ begin
|
||||
Result := abs(MaxY - MinY);
|
||||
end;
|
||||
|
||||
procedure TvPage.SetPageMargin(MTop, MBottom, MLeft, MRight: Integer);
|
||||
begin
|
||||
MarginTop := MTop;
|
||||
MarginBottom := MBottom;
|
||||
MarginLeft := MLeft;
|
||||
MarginRight := MRight;
|
||||
end;
|
||||
|
||||
procedure TvPage.SetPageMargin(AValue: Integer);
|
||||
begin
|
||||
SetPageMargin(AValue, AValue, AValue, AValue);
|
||||
end;
|
||||
|
||||
procedure TvPage.AutoFit(ADest: TFPCustomCanvas; AWidth, AHeight, ARenderHeight: Integer;
|
||||
out ADeltaX, ADeltaY: Integer; out AZoom: Double);
|
||||
var
|
||||
@ -9176,6 +9200,13 @@ begin
|
||||
Clear();
|
||||
BackgroundColor := colWhite;
|
||||
RenderInfo.BackgroundColor := colWhite;
|
||||
|
||||
// set default graphic document margin (0mm)
|
||||
// TODO: apply values
|
||||
MarginTop := 0;
|
||||
MarginBottom := 0;
|
||||
MarginLeft := 0;
|
||||
MarginRight := 0;
|
||||
end;
|
||||
|
||||
destructor TvVectorialPage.Destroy;
|
||||
@ -9939,6 +9970,12 @@ begin
|
||||
Footer := TvRichText.Create(Self);
|
||||
Header := TvRichText.Create(Self);
|
||||
MainText := TvRichText.Create(Self);
|
||||
|
||||
// set default text document margin (20mm)
|
||||
MarginTop := 20;
|
||||
MarginBottom := 20;
|
||||
MarginLeft := 20;
|
||||
MarginRight := 20;
|
||||
end;
|
||||
|
||||
destructor TvTextPageSequence.Destroy;
|
||||
|
@ -568,6 +568,8 @@ begin
|
||||
' <style:font-face style:name="Times New Roman" svg:font-family="Times New Roman" style:font-family-generic="roman" style:font-pitch="variable" />' + LineEnding +
|
||||
' <style:font-face style:name="Arial" svg:font-family="Arial" />' + LineEnding +
|
||||
' <style:font-face style:name="Verdana" svg:font-family="Verdana" />' + LineEnding +
|
||||
' <style:font-face style:name="Calibri" svg:font-family="Calibri" />' + LineEnding +
|
||||
' <style:font-face style:name="Courier New" svg:font-family="Courier New" />' + LineEnding +
|
||||
' <style:font-face style:name="Mangal" svg:font-family="Mangal" style:font-family-generic="system" style:font-pitch="variable" />' + LineEnding +
|
||||
' <style:font-face style:name="Microsoft YaHei" svg:font-family="''Microsoft YaHei''" style:font-family-generic="system" style:font-pitch="variable" />' + LineEnding +
|
||||
' <style:font-face style:name="SimSun" svg:font-family="SimSun" style:font-family-generic="system" style:font-pitch="variable" />' + LineEnding +
|
||||
@ -891,6 +893,9 @@ begin
|
||||
' <style:font-face style:name="Mangal" svg:font-family="Mangal" style:font-family-generic="system" style:font-pitch="variable" />' + LineEnding +
|
||||
' <style:font-face style:name="Microsoft YaHei" svg:font-family="''Microsoft YaHei''" style:font-family-generic="system" style:font-pitch="variable" />' + LineEnding +
|
||||
' <style:font-face style:name="SimSun" svg:font-family="SimSun" style:font-family-generic="system" style:font-pitch="variable" />' + LineEnding +
|
||||
' <style:font-face style:name="Segoe UI" svg:font-family="Segoe UI" style:font-family-generic="system" style:font-pitch="variable" />' + LineEnding +
|
||||
' <style:font-face style:name="Calibri" svg:font-family="Calibri" style:font-family-generic="system" style:font-pitch="variable" />' + LineEnding +
|
||||
' <style:font-face style:name="Calibri Light" svg:font-family="Calibri Light" style:font-family-generic="system" style:font-pitch="variable" />' + LineEnding +
|
||||
' </office:font-face-decls>' + LineEnding;
|
||||
|
||||
// Build the main content of the document
|
||||
@ -1029,7 +1034,8 @@ begin
|
||||
// Define the MasterStyles in Styles.xml
|
||||
// TODO: Add Header and Footer content to FMasterStyles
|
||||
FMasterStyles := FMasterStyles +
|
||||
'<style:master-page style:name="'+sPageMasterName+'" style:page-layout-name="'+sPageLayoutName+'"/>' + LineEnding;
|
||||
'<style:master-page style:name="' + sPageMasterName + '" style:display-name="Standard' +
|
||||
'" style:page-layout-name="' + sPageLayoutName + '"/>' + LineEnding;
|
||||
|
||||
dWidth := ACurPage.Width;
|
||||
If dWidth=0 Then
|
||||
@ -1049,14 +1055,19 @@ begin
|
||||
sOrientation := 'portrait';
|
||||
|
||||
// Define the page layout in Styles.xml
|
||||
// TODO: Add Page Margins...
|
||||
FAutomaticStyles := FAutomaticStyles +
|
||||
'<style:page-layout style:name="'+sPageLayoutName+'">'+ LineEnding+
|
||||
' <style:page-layout-properties '+
|
||||
' fo:page-width="'+FloatToODTText(dWidth)+'mm"'+
|
||||
' fo:page-height="'+FloatToODTText(dHeight)+'mm"'+
|
||||
' style:print-orientation="'+sOrientation+'"'+
|
||||
' style:num-format="1" fo:margin-top="0.7874in" fo:margin-bottom="0.7874in" fo:margin-left="0.7874in" fo:margin-right="0.7874in" style:writing-mode="lr-tb" style:footnote-max-height="0in">'+ LineEnding;
|
||||
' style:num-format="1"' +
|
||||
' fo:margin-top="' + IntToStr(ACurPage.MarginTop) + 'mm"' +
|
||||
' fo:margin-bottom="' + IntToStr(ACurPage.MarginBottom) + 'mm"' +
|
||||
' fo:margin-left="' + IntToStr(ACurPage.MarginLeft) + 'mm"' +
|
||||
' fo:margin-right="' + IntToStr(ACurPage.MarginRight) + 'mm"' +
|
||||
' style:writing-mode="lr-tb"' +
|
||||
' style:footnote-max-height="0in">'+ LineEnding;
|
||||
|
||||
FAutomaticStyles := FAutomaticStyles +
|
||||
' <style:footnote-sep style:width="0.0071in" style:distance-before-sep="0.0398in" style:distance-after-sep="0.0398in" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>'+ LineEnding+
|
||||
@ -1636,6 +1647,10 @@ Begin
|
||||
iRow=0, iRow=ATable.GetRowCount-1,
|
||||
iCell=0, iCell=oRow.GetCellCount-1);
|
||||
|
||||
// set cell spacing (padding)
|
||||
sTemp := sTemp + ' fo:padding-left="' + StringReplace(oCell.SpacingLeft.ToString, ',', '.', [rfReplaceAll]) + 'mm" fo:padding-right="' + StringReplace(oCell.SpacingRight.ToString, ',', '.', [rfReplaceAll]) +
|
||||
'mm" fo:padding-top="' + StringReplace(oCell.SpacingTop.ToString, ',', '.', [rfReplaceAll]) + 'mm" fo:padding-bottom="' + StringReplace(oCell.SpacingBottom.ToString, ',', '.', [rfReplaceAll]) + 'mm"';
|
||||
|
||||
sTemp2 := '';
|
||||
|
||||
If oCell.SpannedCols>1 Then
|
||||
|
Loading…
Reference in New Issue
Block a user