mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-03 00:38:15 +02:00
fpvectorial: Adds a link from more complex entities to the page, and from the page to the document. Improves the list and header level in ODT
git-svn-id: trunk@42472 -
This commit is contained in:
parent
821f02f67b
commit
0c3cc1302d
@ -957,7 +957,7 @@ var
|
||||
i: Integer;
|
||||
begin
|
||||
Result := nil;
|
||||
lPolygon := TvPolygon.Create;
|
||||
lPolygon := TvPolygon.Create(nil);
|
||||
SetLength(lPolygon.Points, 3);
|
||||
|
||||
for i := 0 to ATokens.Count - 1 do
|
||||
@ -1077,7 +1077,7 @@ begin
|
||||
{$endif}
|
||||
if AOnlyCreate then
|
||||
begin
|
||||
Result := TPath.Create;
|
||||
Result := TPath.Create(AData);
|
||||
Result.AppendMoveToSegment(LineStartX, LineStartY);
|
||||
Result.AppendLineToSegment(LineEndX, LineEndY);
|
||||
end
|
||||
@ -1654,7 +1654,7 @@ begin
|
||||
if lBlock = nil then Exit;
|
||||
|
||||
// write the data
|
||||
Result := TvInsert.Create;
|
||||
Result := TvInsert.Create(AData);
|
||||
Result.X := PosX;
|
||||
Result.Y := PosY;
|
||||
Result.Z := PosZ;
|
||||
@ -1734,7 +1734,7 @@ begin
|
||||
Str := ConvertDXFStringToUTF8(Str);
|
||||
|
||||
//
|
||||
Result := TvText.Create;
|
||||
Result := TvText.Create(AData);
|
||||
Result.Value.Text := Str;
|
||||
Result.X := PosX;
|
||||
Result.Y := PosY;
|
||||
@ -2018,7 +2018,7 @@ var
|
||||
lArrow: TvArrow;
|
||||
LElementColor: TFPColor;
|
||||
begin
|
||||
lArrow := TvArrow.Create;
|
||||
lArrow := TvArrow.Create(AData);
|
||||
curPoint := 0;
|
||||
LElementColor := colBlack;
|
||||
Result := nil;
|
||||
|
@ -1865,7 +1865,7 @@ begin
|
||||
end;
|
||||
|
||||
// Read the image
|
||||
lRasterImage := TvRasterImage.Create;
|
||||
lRasterImage := TvRasterImage.Create(nil);
|
||||
lRasterImage.CreateRGB888Image(lImageWidth, lImageHeight);
|
||||
if CurrentGraphicState.ColorSpaceName = 'DeviceCMYK' then
|
||||
begin
|
||||
|
@ -162,6 +162,8 @@ type
|
||||
Parent: TvStyle; // Can be nil
|
||||
Kind: TvStyleKind;
|
||||
Alignment: TvStyleAlignment;
|
||||
HeadingLevel: Integer;
|
||||
ListLevel: Integer; // Only utilized if it is inside a TvBulletList. zero is the first level, 1 the second, and so on
|
||||
//
|
||||
Pen: TvPen;
|
||||
Brush: TvBrush;
|
||||
@ -339,8 +341,10 @@ type
|
||||
TvNamedEntity = class(TvEntity)
|
||||
protected
|
||||
FExtraDebugStr: string;
|
||||
FPage: TvPage;
|
||||
public
|
||||
Name: string;
|
||||
constructor Create(APage: TvPage); virtual;
|
||||
function GenerateDebugTree(ADestRoutine: TvDebugAddItemProc; APageItem: Pointer): Pointer; override;
|
||||
end;
|
||||
|
||||
@ -351,7 +355,7 @@ type
|
||||
{@@ The global Pen for the entire entity. In the case of paths, individual
|
||||
elements might be able to override this setting. }
|
||||
Pen: TvPen;
|
||||
constructor Create; override;
|
||||
constructor Create(APage: TvPage); override;
|
||||
procedure ApplyPenToCanvas(ADest: TFPCustomCanvas; ARenderInfo: TvRenderInfo);
|
||||
procedure AssignPen(APen: TvPen);
|
||||
procedure Render(ADest: TFPCustomCanvas; ARenderInfo: TvRenderInfo; ADestX: Integer = 0;
|
||||
@ -365,7 +369,7 @@ type
|
||||
{@@ The global Brush for the entire entity. In the case of paths, individual
|
||||
elements might be able to override this setting. }
|
||||
Brush: TvBrush;
|
||||
constructor Create; override;
|
||||
constructor Create(APage: TvPage); override;
|
||||
procedure ApplyBrushToCanvas(ADest: TFPCustomCanvas);
|
||||
procedure AssignBrush(ABrush: TvBrush);
|
||||
procedure Render(ADest: TFPCustomCanvas; ARenderInfo: TvRenderInfo; ADestX: Integer = 0;
|
||||
@ -381,7 +385,7 @@ type
|
||||
public
|
||||
Font: TvFont;
|
||||
TextAnchor: TvTextAnchor;
|
||||
constructor Create; override;
|
||||
constructor Create(APage: TvPage); override;
|
||||
procedure ApplyFontToCanvas(ADest: TFPCustomCanvas; ARenderInfo: TvRenderInfo; AMulX: Double = 1.0);
|
||||
procedure AssignFont(AFont: TvFont);
|
||||
procedure Scale(ADeltaScaleX, ADeltaScaleY: Double); override;
|
||||
@ -395,7 +399,7 @@ type
|
||||
TvEntityWithStyle = class(TvEntityWithPenBrushAndFont)
|
||||
public
|
||||
Style: TvStyle; // can be nil!
|
||||
constructor Create; override;
|
||||
constructor Create(APage: TvPage); override;
|
||||
destructor Destroy; override;
|
||||
function GetCombinedStyle(AParent: TvEntityWithStyle): TvStyle;
|
||||
end;
|
||||
@ -415,7 +419,7 @@ type
|
||||
CurPoint: TPathSegment; // Used in PrepareForSequentialReading and Next
|
||||
ClipPath: TPath;
|
||||
ClipMode: TvClipMode;
|
||||
constructor Create; override;
|
||||
constructor Create(APage: TvPage); override;
|
||||
destructor Destroy; override;
|
||||
procedure Clear; override;
|
||||
procedure Assign(ASource: TPath);
|
||||
@ -451,7 +455,7 @@ type
|
||||
TvText = class(TvEntityWithStyle)
|
||||
public
|
||||
Value: TStringList;
|
||||
constructor Create; override;
|
||||
constructor Create(APage: TvPage); override;
|
||||
destructor Destroy; override;
|
||||
function TryToSelect(APos: TPoint; var ASubpart: Cardinal): TvFindEntityResult; override;
|
||||
procedure Render(ADest: TFPCustomCanvas; ARenderInfo: TvRenderInfo; ADestX: Integer = 0;
|
||||
@ -711,7 +715,7 @@ type
|
||||
SpacingBetweenElementsX, SpacingBetweenElementsY: Integer;
|
||||
public
|
||||
Top, Left, Width, Height: Double;
|
||||
constructor Create; override;
|
||||
constructor Create(APage: TvPage); override;
|
||||
destructor Destroy; override;
|
||||
//
|
||||
function GetFirstElement: TvFormulaElement;
|
||||
@ -759,7 +763,7 @@ type
|
||||
FElements: TFPList; // of TvEntity
|
||||
public
|
||||
SetPenBrushAndFontElements: TvSetPenBrushAndFontElements;// This is not currently implemented!
|
||||
constructor Create; override;
|
||||
constructor Create(APage: TvPage); override;
|
||||
destructor Destroy; override;
|
||||
//
|
||||
function GetFirstEntity: TvEntity;
|
||||
@ -835,9 +839,8 @@ type
|
||||
TvParagraph = class(TvEntityWithSubEntities)
|
||||
public
|
||||
Width, Height: Double;
|
||||
Level: Integer; // Only utilized if it is inside a TvBulletList. zero is the first level, 1 the second, and so on
|
||||
AutoExpand: TvRichTextAutoExpand;
|
||||
constructor Create; override;
|
||||
constructor Create(APage: TvPage); override;
|
||||
destructor Destroy; override;
|
||||
function AddText(AText: string): TvText;
|
||||
function TryToSelect(APos: TPoint; var ASubpart: Cardinal): TvFindEntityResult; override;
|
||||
@ -856,10 +859,12 @@ type
|
||||
The basic element to build the sequence is TvBulletListText
|
||||
}
|
||||
|
||||
{ TvBulletList }
|
||||
|
||||
TvBulletList = class(TvEntityWithSubEntities)
|
||||
public
|
||||
{constructor Create; override;
|
||||
destructor Destroy; override;}
|
||||
constructor Create(APage: TvPage);
|
||||
destructor Destroy; override;
|
||||
function AddItem(ALevel: Integer; ASimpleText: string): TvParagraph;
|
||||
{function TryToSelect(APos: TPoint; var ASubpart: Cardinal): TvFindEntityResult; override;
|
||||
procedure Render(ADest: TFPCustomCanvas; ARenderInfo: TvRenderInfo; ADestX: Integer = 0;
|
||||
@ -880,7 +885,7 @@ type
|
||||
public
|
||||
Width, Height: Double;
|
||||
AutoExpand: TvRichTextAutoExpand;
|
||||
constructor Create; override;
|
||||
constructor Create(APage: TvPage); override;
|
||||
destructor Destroy; override;
|
||||
// Data writing methods
|
||||
function AddParagraph: TvParagraph;
|
||||
@ -913,6 +918,7 @@ type
|
||||
SelectedElement: TvEntity;
|
||||
// List of common styles, for conveniently finding them
|
||||
StyleTextBody, StyleHeading1, StyleHeading2, StyleHeading3: TvStyle;
|
||||
StyleBulletList1, StyleBulletList2, StyleBulletList3: TvStyle;
|
||||
{ Base methods }
|
||||
constructor Create; virtual;
|
||||
destructor Destroy; override;
|
||||
@ -943,6 +949,7 @@ type
|
||||
{ Style methods }
|
||||
function AddStyle(): TvStyle;
|
||||
procedure AddStandardTextDocumentStyles(AFormat: TvVectorialFormat);
|
||||
function GetBulletListStyle(ALevel: Integer): TvStyle;
|
||||
function GetStyleCount: Integer;
|
||||
function GetStyle(AIndex: Integer): TvStyle;
|
||||
function FindStyleIndex(AStyle: TvStyle): Integer;
|
||||
@ -957,6 +964,8 @@ type
|
||||
{ TvPage }
|
||||
|
||||
TvPage = class
|
||||
protected
|
||||
FOwner: TvVectorialDocument;
|
||||
public
|
||||
{ Base methods }
|
||||
constructor Create(AOwner: TvVectorialDocument); virtual;
|
||||
@ -1823,6 +1832,12 @@ end;
|
||||
|
||||
{ TvNamedEntity }
|
||||
|
||||
constructor TvNamedEntity.Create(APage: TvPage);
|
||||
begin
|
||||
inherited Create;
|
||||
FPage := APage;
|
||||
end;
|
||||
|
||||
function TvNamedEntity.GenerateDebugTree(ADestRoutine: TvDebugAddItemProc;
|
||||
APageItem: Pointer): Pointer;
|
||||
var
|
||||
@ -1834,9 +1849,9 @@ end;
|
||||
|
||||
{ TvEntityWithPen }
|
||||
|
||||
constructor TvEntityWithPen.Create;
|
||||
constructor TvEntityWithPen.Create(APage: TvPage);
|
||||
begin
|
||||
inherited Create;
|
||||
inherited Create(APage);
|
||||
Pen.Style := psSolid;
|
||||
Pen.Color := colBlack;
|
||||
Pen.Width := 1;
|
||||
@ -1865,9 +1880,9 @@ end;
|
||||
|
||||
{ TvEntityWithPenAndBrush }
|
||||
|
||||
constructor TvEntityWithPenAndBrush.Create;
|
||||
constructor TvEntityWithPenAndBrush.Create(APage: TvPage);
|
||||
begin
|
||||
inherited Create;
|
||||
inherited Create(APage);
|
||||
Brush.Style := bsClear;
|
||||
Brush.Color := colBlue;
|
||||
end;
|
||||
@ -1910,9 +1925,9 @@ end;
|
||||
|
||||
{ TvEntityWithPenBrushAndFont }
|
||||
|
||||
constructor TvEntityWithPenBrushAndFont.Create;
|
||||
constructor TvEntityWithPenBrushAndFont.Create(APage: TvPage);
|
||||
begin
|
||||
inherited Create;
|
||||
inherited Create(APage);
|
||||
Font.Color := colBlack;
|
||||
end;
|
||||
|
||||
@ -1989,9 +2004,9 @@ end;
|
||||
|
||||
{ TvEntityWithStyle }
|
||||
|
||||
constructor TvEntityWithStyle.Create;
|
||||
constructor TvEntityWithStyle.Create(APage: TvPage);
|
||||
begin
|
||||
inherited Create;
|
||||
inherited Create(APage);
|
||||
end;
|
||||
|
||||
destructor TvEntityWithStyle.Destroy;
|
||||
@ -2008,9 +2023,9 @@ end;
|
||||
|
||||
{ TPath }
|
||||
|
||||
constructor TPath.Create;
|
||||
constructor TPath.Create(APage: TvPage);
|
||||
begin
|
||||
inherited Create;
|
||||
inherited Create(APage);
|
||||
FCurMoveSubPartIndex := -1;
|
||||
end;
|
||||
|
||||
@ -2604,9 +2619,9 @@ end;
|
||||
|
||||
{ TvText }
|
||||
|
||||
constructor TvText.Create;
|
||||
constructor TvText.Create(APage: TvPage);
|
||||
begin
|
||||
inherited Create;
|
||||
inherited Create(APage);
|
||||
Value := TStringList.Create;
|
||||
Font.Color := colBlack;
|
||||
end;
|
||||
@ -3897,9 +3912,9 @@ begin
|
||||
TvFormulaElement(data).Free;
|
||||
end;
|
||||
|
||||
constructor TvFormula.Create;
|
||||
constructor TvFormula.Create(APage: TvPage);
|
||||
begin
|
||||
inherited Create;
|
||||
inherited Create(APage);
|
||||
FElements := TFPList.Create;
|
||||
SpacingBetweenElementsX := 5;
|
||||
SpacingBetweenElementsY := 1; // elements already give a fair amount of vertical spacing in their own area
|
||||
@ -3946,12 +3961,12 @@ begin
|
||||
case AKind of
|
||||
fekFraction, fekPower, fekSubscript, fekSummation:
|
||||
begin
|
||||
Result.Formula := TvFormula.Create;
|
||||
Result.AdjacentFormula := TvFormula.Create;
|
||||
Result.Formula := TvFormula.Create(FPage);
|
||||
Result.AdjacentFormula := TvFormula.Create(FPage);
|
||||
end;
|
||||
fekRoot:
|
||||
begin
|
||||
Result.Formula := TvFormula.Create;
|
||||
Result.Formula := TvFormula.Create(FPage);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -4103,9 +4118,9 @@ begin
|
||||
TvEntity(data).Free;
|
||||
end;
|
||||
|
||||
constructor TvEntityWithSubEntities.Create;
|
||||
constructor TvEntityWithSubEntities.Create(APage: TvPage);
|
||||
begin
|
||||
inherited Create;
|
||||
inherited Create(APage);
|
||||
FElements := TFPList.Create;
|
||||
end;
|
||||
|
||||
@ -4361,9 +4376,9 @@ end;
|
||||
|
||||
{ TvParagraph }
|
||||
|
||||
constructor TvParagraph.Create;
|
||||
constructor TvParagraph.Create(APage: TvPage);
|
||||
begin
|
||||
inherited Create;
|
||||
inherited Create(APage);
|
||||
end;
|
||||
|
||||
destructor TvParagraph.Destroy;
|
||||
@ -4373,7 +4388,7 @@ end;
|
||||
|
||||
function TvParagraph.AddText(AText: string): TvText;
|
||||
begin
|
||||
Result := TvText.Create;
|
||||
Result := TvText.Create(FPage);
|
||||
Result.Value.Text := AText;;
|
||||
AddEntity(Result);
|
||||
end;
|
||||
@ -4398,10 +4413,21 @@ end;
|
||||
|
||||
{ TvBulletList }
|
||||
|
||||
constructor TvBulletList.Create(APage: TvPage);
|
||||
begin
|
||||
inherited Create(APage);
|
||||
end;
|
||||
|
||||
destructor TvBulletList.Destroy;
|
||||
begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TvBulletList.AddItem(ALevel: Integer; ASimpleText: string): TvParagraph;
|
||||
begin
|
||||
Result := TvParagraph.Create;
|
||||
Result.Level := ALevel;
|
||||
Result := TvParagraph.Create(FPage);
|
||||
if FPage <> nil then
|
||||
Result.Style := FPage.FOwner.GetBulletListStyle(ALevel);
|
||||
if ASimpleText <> '' then
|
||||
Result.AddText(ASimpleText);
|
||||
AddEntity(Result);
|
||||
@ -4409,9 +4435,9 @@ end;
|
||||
|
||||
{ TvRichText }
|
||||
|
||||
constructor TvRichText.Create;
|
||||
constructor TvRichText.Create(APage: TvPage);
|
||||
begin
|
||||
inherited Create;
|
||||
inherited Create(APage);
|
||||
end;
|
||||
|
||||
destructor TvRichText.Destroy;
|
||||
@ -4421,13 +4447,13 @@ end;
|
||||
|
||||
function TvRichText.AddParagraph: TvParagraph;
|
||||
begin
|
||||
Result := TvParagraph.Create;
|
||||
Result := TvParagraph.Create(FPage);
|
||||
AddEntity(Result);
|
||||
end;
|
||||
|
||||
function TvRichText.AddBulletList: TvBulletList;
|
||||
begin
|
||||
Result := TvBulletList.Create;
|
||||
Result := TvBulletList.Create(FPage);
|
||||
AddEntity(Result);
|
||||
end;
|
||||
|
||||
@ -4454,6 +4480,7 @@ end;
|
||||
constructor TvPage.Create(AOwner: TvVectorialDocument);
|
||||
begin
|
||||
inherited Create;
|
||||
FOwner := AOwner;
|
||||
end;
|
||||
|
||||
destructor TvPage.Destroy;
|
||||
@ -4498,7 +4525,7 @@ begin
|
||||
inherited Create(AOwner);
|
||||
|
||||
FEntities := TFPList.Create;
|
||||
FTmpPath := TPath.Create;
|
||||
FTmpPath := TPath.Create(Self);
|
||||
Owner := AOwner;
|
||||
Clear();
|
||||
BackgroundColor := colWhite;
|
||||
@ -4665,7 +4692,7 @@ var
|
||||
lPath: TPath;
|
||||
Len: Integer;
|
||||
begin
|
||||
lPath := TPath.Create;
|
||||
lPath := TPath.Create(Self);
|
||||
lPath.Assign(APath);
|
||||
Result := lPath;
|
||||
if not AOnlyCreate then AddEntity(lPath);
|
||||
@ -4895,7 +4922,7 @@ function TvVectorialPage.AddText(AX, AY, AZ: Double; FontName: string;
|
||||
var
|
||||
lText: TvText;
|
||||
begin
|
||||
lText := TvText.Create;
|
||||
lText := TvText.Create(Self);
|
||||
lText.Value.Text := AText;
|
||||
lText.X := AX;
|
||||
lText.Y := AY;
|
||||
@ -4920,7 +4947,7 @@ function TvVectorialPage.AddCircle(ACenterX, ACenterY, ARadius: Double; AOnlyCre
|
||||
var
|
||||
lCircle: TvCircle;
|
||||
begin
|
||||
lCircle := TvCircle.Create;
|
||||
lCircle := TvCircle.Create(Self);
|
||||
lCircle.X := ACenterX;
|
||||
lCircle.Y := ACenterY;
|
||||
lCircle.Radius := ARadius;
|
||||
@ -4933,7 +4960,7 @@ function TvVectorialPage.AddCircularArc(ACenterX, ACenterY, ARadius,
|
||||
var
|
||||
lCircularArc: TvCircularArc;
|
||||
begin
|
||||
lCircularArc := TvCircularArc.Create;
|
||||
lCircularArc := TvCircularArc.Create(Self);
|
||||
lCircularArc.X := ACenterX;
|
||||
lCircularArc.Y := ACenterY;
|
||||
lCircularArc.Radius := ARadius;
|
||||
@ -4949,7 +4976,7 @@ function TvVectorialPage.AddEllipse(CenterX, CenterY, HorzHalfAxis,
|
||||
var
|
||||
lEllipse: TvEllipse;
|
||||
begin
|
||||
lEllipse := TvEllipse.Create;
|
||||
lEllipse := TvEllipse.Create(Self);
|
||||
lEllipse.X := CenterX;
|
||||
lEllipse.Y := CenterY;
|
||||
lEllipse.HorzHalfAxis := HorzHalfAxis;
|
||||
@ -4963,7 +4990,7 @@ function TvVectorialPage.AddBlock(AName: string; AX, AY, AZ: Double): TvBlock;
|
||||
var
|
||||
lBlock: TvBlock;
|
||||
begin
|
||||
lBlock := TvBlock.Create;
|
||||
lBlock := TvBlock.Create(Self);
|
||||
lBlock.X := AX;
|
||||
lBlock.Y := AY;
|
||||
lBlock.Name := AName;
|
||||
@ -4975,7 +5002,7 @@ function TvVectorialPage.AddInsert(AX, AY, AZ: Double; AInsertEntity: TvEntity):
|
||||
var
|
||||
lInsert: TvInsert;
|
||||
begin
|
||||
lInsert := TvInsert.Create;
|
||||
lInsert := TvInsert.Create(Self);
|
||||
lInsert.X := AX;
|
||||
lInsert.Y := AY;
|
||||
lInsert.InsertEntity := AInsertEntity;
|
||||
@ -4985,7 +5012,7 @@ end;
|
||||
|
||||
function TvVectorialPage.AddLayer(AName: string): TvLayer;
|
||||
begin
|
||||
Result := TvLayer.Create;
|
||||
Result := TvLayer.Create(Self);
|
||||
Result.Name := AName;
|
||||
AddEntity(Result);
|
||||
end;
|
||||
@ -5018,7 +5045,7 @@ function TvVectorialPage.AddAlignedDimension(BaseLeft, BaseRight, DimLeft,
|
||||
var
|
||||
lDim: TvAlignedDimension;
|
||||
begin
|
||||
lDim := TvAlignedDimension.Create;
|
||||
lDim := TvAlignedDimension.Create(Self);
|
||||
lDim.BaseLeft := BaseLeft;
|
||||
lDim.BaseRight := BaseRight;
|
||||
lDim.DimensionLeft := DimLeft;
|
||||
@ -5032,7 +5059,7 @@ function TvVectorialPage.AddRadialDimension(AIsDiameter: Boolean; ACenter,
|
||||
var
|
||||
lDim: TvRadialDimension;
|
||||
begin
|
||||
lDim := TvRadialDimension.Create;
|
||||
lDim := TvRadialDimension.Create(Self);
|
||||
lDim.IsDiameter := AIsDiameter;
|
||||
lDim.Center := ACenter;
|
||||
lDim.DimensionLeft := ADimLeft;
|
||||
@ -5045,7 +5072,7 @@ function TvVectorialPage.AddArcDimension(AArcValue, AArcRadius: Double; ABaseLef
|
||||
var
|
||||
lDim: TvArcDimension;
|
||||
begin
|
||||
lDim := TvArcDimension.Create;
|
||||
lDim := TvArcDimension.Create(Self);
|
||||
lDim.BaseLeft := ABaseLeft;
|
||||
lDim.BaseRight := ABaseRight;
|
||||
lDim.DimensionLeft := ADimLeft;
|
||||
@ -5147,9 +5174,9 @@ constructor TvTextPageSequence.Create(AOwner: TvVectorialDocument);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
|
||||
Footer := TvRichText.Create;
|
||||
Header := TvRichText.Create;
|
||||
MainText := TvRichText.Create;
|
||||
Footer := TvRichText.Create(Self);
|
||||
Header := TvRichText.Create(Self);
|
||||
MainText := TvRichText.Create(Self);
|
||||
end;
|
||||
|
||||
destructor TvTextPageSequence.Destroy;
|
||||
@ -5610,6 +5637,7 @@ begin
|
||||
lCurStyle := AddStyle();
|
||||
lCurStyle.Name := 'Heading 1';
|
||||
lCurStyle.Parent := lBaseHeading;
|
||||
lCurStyle.HeadingLevel := 1;
|
||||
lCurStyle.Font.Size := Round(1.15 * lBaseHeading.Font.Size);
|
||||
lCurStyle.Font.Bold := True;
|
||||
lCurStyle.SetElements := [spbfFontSize, spbfFontBold];
|
||||
@ -5621,6 +5649,7 @@ begin
|
||||
lCurStyle := AddStyle();
|
||||
lCurStyle.Name := 'Heading 2';
|
||||
lCurStyle.Parent := lBaseHeading;
|
||||
lCurStyle.HeadingLevel := 2;
|
||||
lCurStyle.Font.Size := 14;
|
||||
lCurStyle.Font.Bold := True;
|
||||
lCurStyle.Font.Italic := True;
|
||||
@ -5633,6 +5662,7 @@ begin
|
||||
lCurStyle := AddStyle();
|
||||
lCurStyle.Name := 'Heading 3';
|
||||
lCurStyle.Parent := lBaseHeading;
|
||||
lCurStyle.HeadingLevel := 3;
|
||||
lCurStyle.Font.Size := 14;
|
||||
lCurStyle.Font.Bold := True;
|
||||
lCurStyle.SetElements := [spbfFontSize, spbfFontName, spbfFontBold];
|
||||
@ -5657,6 +5687,29 @@ begin
|
||||
<style:text-properties style:font-name="OpenSymbol" style:font-name-asian="OpenSymbol" style:font-name-complex="OpenSymbol" />
|
||||
</style:style>
|
||||
}
|
||||
|
||||
// ---------------------------------
|
||||
// Bullet List Items
|
||||
// ---------------------------------
|
||||
|
||||
lCurStyle := AddStyle();
|
||||
lCurStyle.Name := 'Bullet List Item 1';
|
||||
//lCurStyle.Parent := ;
|
||||
lCurStyle.ListLevel := 1;
|
||||
StyleBulletList1 := lCurStyle;
|
||||
|
||||
//, StyleBulletList2, StyleBulletList3
|
||||
end;
|
||||
|
||||
function TvVectorialDocument.GetBulletListStyle(ALevel: Integer): TvStyle;
|
||||
begin
|
||||
case ALevel of
|
||||
0: Result := StyleBulletList1;
|
||||
1: Result := StyleBulletList2;
|
||||
2: Result := StyleBulletList3;
|
||||
else
|
||||
Result := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TvVectorialDocument.GetStyleCount: Integer;
|
||||
|
@ -112,7 +112,7 @@ begin
|
||||
lSubNodeName := lMFracRow.NodeName;
|
||||
if lSubNodeName = 'mrow' then
|
||||
begin
|
||||
lFormula := TvFormula.Create;
|
||||
lFormula := TvFormula.Create(APage);
|
||||
ReadFormulaFromNodeChildren(lMFracRow, APage, lFormula);
|
||||
end
|
||||
else
|
||||
@ -121,7 +121,7 @@ begin
|
||||
lSubNodeName := lMFracRow.NodeName;
|
||||
if lSubNodeName = 'mrow' then
|
||||
begin
|
||||
lFormulaBottom := TvFormula.Create;
|
||||
lFormulaBottom := TvFormula.Create(APage);
|
||||
ReadFormulaFromNodeChildren(lMFracRow, APage, lFormulaBottom);
|
||||
end
|
||||
else
|
||||
@ -136,7 +136,7 @@ begin
|
||||
// or just: ...elements...
|
||||
else if lNodeName = 'msqrt' then
|
||||
begin
|
||||
lFormula := TvFormula.Create;
|
||||
lFormula := TvFormula.Create(APage);
|
||||
|
||||
lMFracRow := ANode.FirstChild;
|
||||
lSubNodeName := lMFracRow.NodeName;
|
||||
@ -195,7 +195,7 @@ begin
|
||||
begin
|
||||
lFormElem := AFormula.AddElementWithKind(fekFormula);
|
||||
|
||||
lFormula := TvFormula.Create;
|
||||
lFormula := TvFormula.Create(APage);
|
||||
// Read all elements
|
||||
ReadFormulaFromNodeChildren(ANode, APage, lFormula);
|
||||
lFormElem.Formula := lFormula;
|
||||
@ -287,13 +287,13 @@ begin
|
||||
lStr := lCurNode.NodeName;
|
||||
if lStr = 'mrow' then
|
||||
begin
|
||||
lFormula := TvFormula.Create;
|
||||
lFormula := TvFormula.Create(lPage);
|
||||
ReadFormulaFromNodeChildren(lCurNode, lPage, lFormula);
|
||||
lPage.AddEntity(lFormula);
|
||||
end
|
||||
else if lStr = 'mstack' then
|
||||
begin
|
||||
lFormula := TvVerticalFormulaStack.Create;
|
||||
lFormula := TvVerticalFormulaStack.Create(lPage);
|
||||
ReadFormulaFromNodeChildren(lCurNode, lPage, lFormula);
|
||||
lPage.AddEntity(lFormula);
|
||||
end
|
||||
|
@ -610,7 +610,7 @@ var
|
||||
i: Integer;
|
||||
lNodeName, lNodeValue: DOMString;
|
||||
begin
|
||||
lStyle := TODGStyle.Create;
|
||||
lStyle := TODGStyle.Create(AData);
|
||||
|
||||
// Read attributes of the main style tag
|
||||
// <style:style style:name="gr4" style:family="graphic" style:parent-style-name="standard">;
|
||||
@ -795,8 +795,8 @@ begin
|
||||
lWidth := 0.0;
|
||||
lHeight := 0.0;
|
||||
|
||||
lGroup := TvEntityWithSubEntities.Create;
|
||||
lPath := TPath.Create;
|
||||
lGroup := TvEntityWithSubEntities.Create(AData);
|
||||
lPath := TPath.Create(Adata);
|
||||
lGroup.AddEntity(lPath);
|
||||
|
||||
// read the attributes
|
||||
@ -838,7 +838,7 @@ begin
|
||||
begin
|
||||
if lCurNode.FirstChild <> nil then
|
||||
begin
|
||||
lText := TvText.Create;
|
||||
lText := TvText.Create(AData);
|
||||
lNodeValue := lCurNode.FirstChild.NodeValue;
|
||||
lText.Value.Add(lNodeValue);
|
||||
lGroup.AddEntity(lText);
|
||||
@ -876,7 +876,7 @@ begin
|
||||
crx := 0.0;
|
||||
cry := 0.0;
|
||||
|
||||
lEllipse := TvEllipse.Create;
|
||||
lEllipse := TvEllipse.Create(AData);
|
||||
// SVG entities start without any pen drawing, but with a black brush
|
||||
lEllipse.Pen.Style := psClear;
|
||||
lEllipse.Brush.Style := bsSolid;
|
||||
@ -947,7 +947,7 @@ begin
|
||||
x2 := 0.0;
|
||||
y2 := 0.0;
|
||||
|
||||
lPath := TPath.Create;
|
||||
lPath := TPath.Create(nil);
|
||||
|
||||
// read the attributes
|
||||
for i := 0 to ANode.Attributes.Length - 1 do
|
||||
@ -1004,7 +1004,7 @@ begin
|
||||
lWidth := 0.0;
|
||||
lHeight := 0.0;
|
||||
|
||||
lPath := TPath.Create;
|
||||
lPath := TPath.Create(nil);
|
||||
|
||||
// read the attributes
|
||||
for i := 0 to ANode.Attributes.Length - 1 do
|
||||
|
@ -41,6 +41,8 @@ Example of content.xml structure:
|
||||
|
||||
Validator for ODF 1.0
|
||||
http://opendocumentfellowship.com/validator
|
||||
Validator for ODF 1.2
|
||||
http://odf-validator2.rhcloud.com/odf-validator2/
|
||||
|
||||
AUTHORS: Felipe Monteiro de Carvalho
|
||||
}
|
||||
@ -59,6 +61,7 @@ uses
|
||||
type
|
||||
{ TvODTVectorialWriter }
|
||||
|
||||
// Writes ODT 1.2
|
||||
TvODTVectorialWriter = class(TvCustomVectorialWriter)
|
||||
private
|
||||
FPointSeparator: TFormatSettings;
|
||||
@ -202,12 +205,13 @@ procedure TvODTVectorialWriter.WriteMetaInfManifest;
|
||||
begin
|
||||
FMetaInfManifest :=
|
||||
XML_HEADER + LineEnding +
|
||||
'<manifest:manifest xmlns:manifest="' + SCHEMAS_XMLNS_MANIFEST + '" >' + LineEnding + // manifest:version="1.2"
|
||||
'<manifest:manifest xmlns:manifest="' + SCHEMAS_XMLNS_MANIFEST + '" manifest:version="1.2">' + LineEnding +
|
||||
' <manifest:file-entry manifest:full-path="/" manifest:media-type="application/vnd.oasis.opendocument.text" />' + LineEnding + // manifest:version="1.2"
|
||||
' <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml" />' + LineEnding +
|
||||
' <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="styles.xml" />' + LineEnding +
|
||||
' <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="meta.xml" />' + LineEnding +
|
||||
' <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="settings.xml" />' + LineEnding +
|
||||
' <manifest:file-entry manifest:full-path="manifest.rdf" manifest:media-type="application/rdf+xml"/>' + LineEnding +
|
||||
'</manifest:manifest>';
|
||||
end;
|
||||
|
||||
@ -245,7 +249,7 @@ begin
|
||||
' xmlns:grddl="' + SCHEMAS_XMLNS_GRDDL + '"' +
|
||||
' xmlns:meta="' + SCHEMAS_XMLNS_META + '"' +
|
||||
' xmlns="' + SCHEMAS_XMLNS + '"' +
|
||||
' xmlns:ex="' + SCHEMAS_XMLNS + '">' + LineEnding + // office:version="1.2"
|
||||
' xmlns:ex="' + SCHEMAS_XMLNS + '" office:version="1.2">' + LineEnding +
|
||||
' <office:meta>' + LineEnding +
|
||||
// <meta:creation-date>2013-07-21T09:29:41.06</meta:creation-date>
|
||||
// <dc:date>2013-07-21T20:13:32.29</dc:date>
|
||||
@ -262,7 +266,7 @@ begin
|
||||
'<office:document-settings xmlns:office="' + SCHEMAS_XMLNS_OFFICE + '"' +
|
||||
' xmlns:xlink="' + SCHEMAS_XMLNS_XLINK + '"' +
|
||||
' xmlns:config="' + SCHEMAS_XMLNS_CONFIG + '"' +
|
||||
' xmlns:ooo="' + SCHEMAS_XMLNS_OOO + '">' + LineEnding + // office:version="1.2">
|
||||
' xmlns:ooo="' + SCHEMAS_XMLNS_OOO + '" office:version="1.2">' + LineEnding +
|
||||
'<office:settings>' + LineEnding +
|
||||
' <config:config-item-set config:name="ooo:view-settings">' + LineEnding +
|
||||
' <config:config-item config:name="ViewAreaTop" config:type="int">0</config:config-item>' + LineEnding +
|
||||
@ -562,10 +566,11 @@ begin
|
||||
<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>
|
||||
}
|
||||
}
|
||||
FStyles := FStyles +
|
||||
' <style:style style:name="Bullet_20_Symbols" style:display-name="Bullet Symbols" style:family="text">' + LineEnding +
|
||||
' <style:text-properties style:font-name="OpenSymbol" style:font-name-asian="OpenSymbol" style:font-name-complex="OpenSymbol" />' + LineEnding +
|
||||
' </style:style>' + LineEnding;
|
||||
end;
|
||||
|
||||
FStyles := FStyles +
|
||||
@ -712,8 +717,8 @@ begin
|
||||
' </office:font-face-decls>' + LineEnding;
|
||||
FContent := FContent +
|
||||
' <office:automatic-styles>' + LineEnding +
|
||||
' <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Heading_20_2">' + LineEnding +
|
||||
' <style:text-properties officeooo:rsid="00072f3e" officeooo:paragraph-rsid="00072f3e" />' + LineEnding +
|
||||
{ ' <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Heading_20_2">' + LineEnding +
|
||||
' <style:text-properties />' + LineEnding + //officeooo:rsid="00072f3e" officeooo:paragraph-rsid="00072f3e"
|
||||
' </style:style>' + LineEnding +
|
||||
' <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Heading_20_1">' + LineEnding +
|
||||
' <style:text-properties officeooo:rsid="00072f3e" officeooo:paragraph-rsid="00072f3e" />' + LineEnding +
|
||||
@ -726,7 +731,7 @@ begin
|
||||
' </style:style>' + LineEnding +
|
||||
' <style:style style:name="P5" style:family="paragraph" style:parent-style-name="Text_20_body">' + LineEnding +
|
||||
' <style:text-properties officeooo:rsid="00072f3e" />' + LineEnding +
|
||||
' </style:style>' + LineEnding +
|
||||
' </style:style>' + LineEnding +}
|
||||
//
|
||||
' <text:list-style style:name="L1">' + LineEnding +
|
||||
' <text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" text:bullet-char="•">' + LineEnding +
|
||||
@ -814,13 +819,13 @@ var
|
||||
i: Integer;
|
||||
lCurEntity: TvEntity;
|
||||
begin
|
||||
{ FContent := FContent +
|
||||
' <text:sequence-decls>' + LineEnding;
|
||||
FContent := FContent +
|
||||
' <text:sequence-decls>' + LineEnding +
|
||||
' <text:sequence-decl text:display-outline-level="0" text:name="Illustration" />' + LineEnding +
|
||||
' <text:sequence-decl text:display-outline-level="0" text:name="Table" />' + LineEnding +
|
||||
' <text:sequence-decl text:display-outline-level="0" text:name="Text" />' + LineEnding +
|
||||
' <text:sequence-decl text:display-outline-level="0" text:name="Drawing" />' + LineEnding +
|
||||
' </text:sequence-decls>' + LineEnding;}
|
||||
' </text:sequence-decls>' + LineEnding;
|
||||
|
||||
for i := 0 to ACurPage.GetEntitiesCount()-1 do
|
||||
begin
|
||||
@ -836,10 +841,11 @@ end;
|
||||
procedure TvODTVectorialWriter.WriteParagraph(AEntity: TvParagraph;
|
||||
ACurPage: TvTextPageSequence; AData: TvVectorialDocument);
|
||||
var
|
||||
EntityKindName, AEntityStyleName: string;
|
||||
EntityKindName, AEntityStyleName, lOutlineLevel: string;
|
||||
i: Integer;
|
||||
lCurEntity: TvEntity;
|
||||
begin
|
||||
lOutlineLevel := '';
|
||||
if AEntity.Style = nil then
|
||||
begin
|
||||
EntityKindName := 'p';
|
||||
@ -848,7 +854,11 @@ begin
|
||||
else
|
||||
begin
|
||||
case AEntity.Style.GetKind() of
|
||||
vskHeading: EntityKindName := 'h';
|
||||
vskHeading:
|
||||
begin
|
||||
EntityKindName := 'h';
|
||||
lOutlineLevel := 'text:outline-level="'+IntToStr(AEntity.Style.HeadingLevel)+'" ';
|
||||
end;
|
||||
else // vskTextBody;
|
||||
EntityKindName := 'p';
|
||||
end;
|
||||
@ -857,7 +867,7 @@ begin
|
||||
end;
|
||||
|
||||
FContent := FContent +
|
||||
' <text:'+EntityKindName+' text:style-name="'+AEntityStyleName+'" >';
|
||||
' <text:'+EntityKindName+' text:style-name="'+AEntityStyleName+'" ' + lOutlineLevel +'>';
|
||||
|
||||
for i := 0 to AEntity.GetEntitiesCount()-1 do
|
||||
begin
|
||||
@ -971,10 +981,18 @@ begin
|
||||
if (lCurEntity is TvParagraph) then
|
||||
begin
|
||||
lCurParagraph := lCurEntity as TvParagraph;
|
||||
FContent := FContent +
|
||||
' <text:list-item>' + LineEnding +
|
||||
' <text:p text:style-name="List_'+IntToStr(lCurParagraph.Level)+'">';
|
||||
|
||||
if lCurParagraph.Style <> nil then
|
||||
begin
|
||||
FContent := FContent +
|
||||
' <text:list-item>' + LineEnding +
|
||||
' <text:p text:style-name="List_'+IntToStr(lCurParagraph.Style.ListLevel)+'">';
|
||||
end
|
||||
else
|
||||
begin
|
||||
FContent := FContent +
|
||||
' <text:list-item>' + LineEnding +
|
||||
' <text:p text:style-name="List_0">';
|
||||
end;
|
||||
|
||||
for j := 0 to lCurParagraph.GetEntitiesCount()-1 do
|
||||
begin
|
||||
|
@ -65,7 +65,7 @@ begin
|
||||
end;
|
||||
|
||||
lPage := AData.AddPage();
|
||||
lRasterImage := TvRasterImage.Create;
|
||||
lRasterImage := TvRasterImage.Create(nil);
|
||||
lRasterImage.RasterImage := AImage;
|
||||
lPage.AddEntity(lRasterImage);
|
||||
end;
|
||||
|
@ -1125,7 +1125,7 @@ begin
|
||||
case lEntityName of
|
||||
'RadialGradient':
|
||||
begin
|
||||
lBrushEntity := TvEntityWithPenAndBrush.Create;
|
||||
lBrushEntity := TvEntityWithPenAndBrush.Create(nil);
|
||||
lBrushEntity.Brush.Kind := bkRadialGradient;
|
||||
|
||||
// <radialGradient id="grad1" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
|
||||
@ -1181,7 +1181,7 @@ begin
|
||||
'circle', 'ellipse', 'g', 'line', 'path',
|
||||
'polygon', 'polyline', 'rect', 'text', 'use':
|
||||
begin
|
||||
lBlock := TvBlock.Create;
|
||||
lBlock := TvBlock.Create(nil);
|
||||
|
||||
// pre-load attribute reader, to get the block name
|
||||
for i := 0 to lCurNode.Attributes.Length - 1 do
|
||||
@ -1243,7 +1243,7 @@ begin
|
||||
cy := 0.0;
|
||||
cr := 0.0;
|
||||
|
||||
lCircle := TvCircle.Create;
|
||||
lCircle := TvCircle.Create(nil);
|
||||
// SVG entities start without any pen drawing, but with a black brush
|
||||
lCircle.Pen.Style := psClear;
|
||||
lCircle.Brush.Style := bsSolid;
|
||||
@ -1295,7 +1295,7 @@ begin
|
||||
crx := 0.0;
|
||||
cry := 0.0;
|
||||
|
||||
lEllipse := TvEllipse.Create;
|
||||
lEllipse := TvEllipse.Create(nil);
|
||||
// SVG entities start without any pen drawing, but with a black brush
|
||||
lEllipse.Pen.Style := psClear;
|
||||
lEllipse.Brush.Style := bsSolid;
|
||||
@ -1353,7 +1353,7 @@ var
|
||||
lImageDataStream: TMemoryStream;
|
||||
lImageReader: TFPCustomImageReader;
|
||||
begin
|
||||
lImage := TvRasterImage.Create;
|
||||
lImage := TvRasterImage.Create(nil);
|
||||
lx := 0;
|
||||
ly := 0;
|
||||
lw := 0;
|
||||
@ -2059,7 +2059,7 @@ begin
|
||||
lrx := 0.0;
|
||||
lry := 0.0;
|
||||
|
||||
lRect := TvRectangle.Create;
|
||||
lRect := TvRectangle.Create(nil);
|
||||
// SVG entities start without any pen drawing, but with a black brush
|
||||
lRect.Pen.Style := psClear;
|
||||
lRect.Brush.Style := bsSolid;
|
||||
@ -2120,7 +2120,7 @@ begin
|
||||
lx := 0.0;
|
||||
ly := 0.0;
|
||||
|
||||
lText := TvText.Create;
|
||||
lText := TvText.Create(nil);
|
||||
|
||||
// Apply the layer style
|
||||
ApplyLayerStyles(lText);
|
||||
@ -2212,7 +2212,7 @@ begin
|
||||
lInsertedEntity := AData.FindEntityWithNameAndType(lXLink, TvEntity, True);
|
||||
if lInsertedEntity = nil then Exit; // nothing to insert, give up!
|
||||
|
||||
lInsert := TvInsert.Create;
|
||||
lInsert := TvInsert.Create(nil);
|
||||
lInsert.InsertEntity := lInsertedEntity;
|
||||
|
||||
// Apply the styles
|
||||
|
Loading…
Reference in New Issue
Block a user