diff --git a/components/fpvectorial/dxfvectorialreader.pas b/components/fpvectorial/dxfvectorialreader.pas index 4143ddfe9f..ff17779cba 100644 --- a/components/fpvectorial/dxfvectorialreader.pas +++ b/components/fpvectorial/dxfvectorialreader.pas @@ -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; diff --git a/components/fpvectorial/epsvectorialreader.pas b/components/fpvectorial/epsvectorialreader.pas index 6a4a52c867..ca7870e875 100644 --- a/components/fpvectorial/epsvectorialreader.pas +++ b/components/fpvectorial/epsvectorialreader.pas @@ -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 diff --git a/components/fpvectorial/fpvectorial.pas b/components/fpvectorial/fpvectorial.pas index 344e38081b..e3e95d96df 100644 --- a/components/fpvectorial/fpvectorial.pas +++ b/components/fpvectorial/fpvectorial.pas @@ -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 } + + // --------------------------------- + // 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; diff --git a/components/fpvectorial/mathmlvectorialreader.pas b/components/fpvectorial/mathmlvectorialreader.pas index 1c64861bfe..34cce3a3df 100644 --- a/components/fpvectorial/mathmlvectorialreader.pas +++ b/components/fpvectorial/mathmlvectorialreader.pas @@ -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 diff --git a/components/fpvectorial/odgvectorialreader.pas b/components/fpvectorial/odgvectorialreader.pas index f04bb0947d..d3969a722b 100644 --- a/components/fpvectorial/odgvectorialreader.pas +++ b/components/fpvectorial/odgvectorialreader.pas @@ -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 // ; @@ -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 diff --git a/components/fpvectorial/odtvectorialwriter.pas b/components/fpvectorial/odtvectorialwriter.pas index 7abfd3fdff..50a0c9a2b3 100644 --- a/components/fpvectorial/odtvectorialwriter.pas +++ b/components/fpvectorial/odtvectorialwriter.pas @@ -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 + - '' + LineEnding + // manifest:version="1.2" + '' + LineEnding + ' ' + LineEnding + // manifest:version="1.2" ' ' + LineEnding + ' ' + LineEnding + ' ' + LineEnding + ' ' + LineEnding + + ' ' + LineEnding + ''; 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 + ' ' + LineEnding + // 2013-07-21T09:29:41.06 // 2013-07-21T20:13:32.29 @@ -262,7 +266,7 @@ begin '' + LineEnding + // office:version="1.2"> + ' xmlns:ooo="' + SCHEMAS_XMLNS_OOO + '" office:version="1.2">' + LineEnding + '' + LineEnding + ' ' + LineEnding + ' 0' + LineEnding + @@ -562,10 +566,11 @@ begin - - - -} + } + FStyles := FStyles + + ' ' + LineEnding + + ' ' + LineEnding + + ' ' + LineEnding; end; FStyles := FStyles + @@ -712,8 +717,8 @@ begin ' ' + LineEnding; FContent := FContent + ' ' + LineEnding + - ' ' + LineEnding + - ' ' + LineEnding + +{ ' ' + LineEnding + + ' ' + LineEnding + //officeooo:rsid="00072f3e" officeooo:paragraph-rsid="00072f3e" ' ' + LineEnding + ' ' + LineEnding + ' ' + LineEnding + @@ -726,7 +731,7 @@ begin ' ' + LineEnding + ' ' + LineEnding + ' ' + LineEnding + - ' ' + LineEnding + + ' ' + LineEnding +} // ' ' + LineEnding + ' ' + LineEnding + @@ -814,13 +819,13 @@ var i: Integer; lCurEntity: TvEntity; begin -{ FContent := FContent + - ' ' + LineEnding; + FContent := FContent + + ' ' + LineEnding + ' ' + LineEnding + ' ' + LineEnding + ' ' + LineEnding + ' ' + LineEnding + - ' ' + LineEnding;} + ' ' + 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 + - ' '; + ' '; 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 + - ' ' + LineEnding + - ' '; - + if lCurParagraph.Style <> nil then + begin + FContent := FContent + + ' ' + LineEnding + + ' '; + end + else + begin + FContent := FContent + + ' ' + LineEnding + + ' '; + end; for j := 0 to lCurParagraph.GetEntitiesCount()-1 do begin diff --git a/components/fpvectorial/rawvectorialreadwrite.pas b/components/fpvectorial/rawvectorialreadwrite.pas index d4af2f4c57..8ff648cfac 100644 --- a/components/fpvectorial/rawvectorialreadwrite.pas +++ b/components/fpvectorial/rawvectorialreadwrite.pas @@ -65,7 +65,7 @@ begin end; lPage := AData.AddPage(); - lRasterImage := TvRasterImage.Create; + lRasterImage := TvRasterImage.Create(nil); lRasterImage.RasterImage := AImage; lPage.AddEntity(lRasterImage); end; diff --git a/components/fpvectorial/svgvectorialreader.pas b/components/fpvectorial/svgvectorialreader.pas index 148c34636a..8ff32e59b2 100644 --- a/components/fpvectorial/svgvectorialreader.pas +++ b/components/fpvectorial/svgvectorialreader.pas @@ -1125,7 +1125,7 @@ begin case lEntityName of 'RadialGradient': begin - lBrushEntity := TvEntityWithPenAndBrush.Create; + lBrushEntity := TvEntityWithPenAndBrush.Create(nil); lBrushEntity.Brush.Kind := bkRadialGradient; // @@ -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