Skip to content

Commit 04a00e2

Browse files
committed
Remove deprecated code
DEVSIX-3495 Autoported commit. Original commit hash: [c861837a] Manual files: src/main/java/com/itextpdf/html2pdf/attach/impl/layout/form/renderer/AbstractFormFieldRenderer.java
1 parent 75a79d1 commit 04a00e2

20 files changed

+278
-488
lines changed

itext/itext.html2pdf/itext/html2pdf/LogMessageConstant.cs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,9 @@ public sealed class LogMessageConstant {
7373
/// <summary>The Constant ERROR_WHILE_LAYOUT_OF_FORM_FIELD_WITH_TYPE.</summary>
7474
public const String ERROR_WHILE_LAYOUT_OF_FORM_FIELD_WITH_TYPE = "Error during layout of form filed with type {0}.";
7575

76-
/// <summary>The Constant HEIGHT_VALUE_IN_PERCENT_NOT_SUPPORTED.</summary>
77-
[Obsolete]
78-
public const String HEIGHT_VALUE_IN_PERCENT_NOT_SUPPORTED = "Height value in percent not supported";
79-
8076
/// <summary>The Constant INPUT_FIELD_DOES_NOT_FIT.</summary>
8177
public const String INPUT_FIELD_DOES_NOT_FIT = "Input field doesn't fit in outer object. It will be clipped";
8278

83-
/// <summary>The Constant INPUT_SUPPORTS_ONLY_POINT_WIDTH.</summary>
84-
[Obsolete]
85-
public const String INPUT_SUPPORTS_ONLY_POINT_WIDTH = "Input field supports only point width";
86-
8779
/// <summary>The Constant INPUT_TYPE_IS_INVALID.</summary>
8880
public const String INPUT_TYPE_IS_INVALID = "Input type {0} is invalid. The default text type will be used instead.";
8981

@@ -130,16 +122,9 @@ public sealed class LogMessageConstant {
130122
/// <summary>The Constant QUOTES_PROPERTY_INVALID.</summary>
131123
public const String QUOTES_PROPERTY_INVALID = "Quote property \"{0}\" is invalid. It should contain even number of <string> values.";
132124

133-
[Obsolete]
134-
public const String RULE_IS_NOT_SUPPORTED = "The rule @{0} is unsupported. All selectors in this rule will be ignored.";
135-
136125
/// <summary>The Constant TEXT_DECORATION_BLINK_NOT_SUPPORTED.</summary>
137126
public const String TEXT_DECORATION_BLINK_NOT_SUPPORTED = "text-decoration: blink not supported";
138127

139-
/// <summary>The Constant TEXT_WAS_NOT_PROCESSED.</summary>
140-
[Obsolete]
141-
public const String TEXT_WAS_NOT_PROCESSED = "Text was not processed: {0}";
142-
143128
/// <summary>The Constant UNABLE_TO_PROCESS_EXTERNAL_CSS_FILE.</summary>
144129
public const String UNABLE_TO_PROCESS_EXTERNAL_CSS_FILE = "Unable to process external css file";
145130

@@ -149,10 +134,6 @@ public sealed class LogMessageConstant {
149134
/// <summary>The Constant UNABLE_TO_RESOLVE_COUNTER.</summary>
150135
public const String UNABLE_TO_RESOLVE_COUNTER = "Unable to resolve counter \"{0}\"";
151136

152-
/// <summary>The Constant UNABLE_TO_RESOLVE_FONT.</summary>
153-
[Obsolete]
154-
public const String UNABLE_TO_RESOLVE_FONT = "Unable to resolve font: {0}. The default one will be used instead";
155-
156137
/// <summary>The Constant UNABLE_TO_RETRIEVE_FONT.</summary>
157138
public const String UNABLE_TO_RETRIEVE_FONT = "Unable to retrieve font:\n {0}";
158139

itext/itext.html2pdf/itext/html2pdf/attach/impl/layout/PageMarginBoxDummyElement.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ source product.
4747
using iText.StyledXmlParser.Node;
4848

4949
namespace iText.Html2pdf.Attach.Impl.Layout {
50-
[System.ObsoleteAttribute(@"Remove this class in 7.2 and use iText.StyledXmlParser.Css.Page.PageMarginBoxContextNode instead (by making it implement iText.StyledXmlParser.Node.IElementNode )."
50+
[System.ObsoleteAttribute(@"To be removed in next major pdfHTML version once iText.StyledXmlParser.Css.Page.PageMarginBoxContextNode implementsiText.StyledXmlParser.Node.IElementNode so that it can be used directly instead of creating dummy node."
5151
)]
5252
internal class PageMarginBoxDummyElement : IElementNode, ICustomElementNode {
5353
/// <summary>The resolved styles.</summary>

itext/itext.html2pdf/itext/html2pdf/attach/impl/layout/form/element/Button.cs

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This file is part of the iText (R) project.
33
Copyright (c) 1998-2020 iText Group NV
4-
Authors: Bruno Lowagie, Paulo Soares, et al.
4+
Authors: iText Software.
55
66
This program is free software; you can redistribute it and/or modify
77
it under the terms of the GNU Affero General Public License version 3
@@ -42,31 +42,52 @@ source product.
4242
*/
4343
using System;
4444
using iText.Html2pdf.Attach.Impl.Layout.Form.Renderer;
45+
using iText.Layout.Element;
46+
using iText.Layout.Properties;
4547
using iText.Layout.Renderer;
4648

4749
namespace iText.Html2pdf.Attach.Impl.Layout.Form.Element {
4850
/// <summary>
4951
/// Extension of the
5052
/// <see cref="FormField{T}"/>
51-
/// class representing a input with type button or submit in html
53+
/// class representing a button in html
5254
/// </summary>
53-
[System.ObsoleteAttribute(@"will be renamed to InputButton in next major release")]
5455
public class Button : FormField<iText.Html2pdf.Attach.Impl.Layout.Form.Element.Button> {
55-
/// <summary>
56-
/// Creates a new
57-
/// <see cref="Button"/>
58-
/// instance.
59-
/// </summary>
60-
/// <param name="id">the id</param>
6156
public Button(String id)
6257
: base(id) {
6358
}
6459

65-
/* (non-Javadoc)
66-
* @see com.itextpdf.layout.element.AbstractElement#makeNewRenderer()
67-
*/
6860
protected override IRenderer MakeNewRenderer() {
6961
return new ButtonRenderer(this);
7062
}
63+
64+
/// <summary>Adds any block element to the div's contents.</summary>
65+
/// <param name="element">
66+
/// a
67+
/// <see cref="iText.Layout.Element.BlockElement{T}"/>
68+
/// </param>
69+
/// <returns>this Element</returns>
70+
public virtual iText.Html2pdf.Attach.Impl.Layout.Form.Element.Button Add(IBlockElement element) {
71+
childElements.Add(element);
72+
return this;
73+
}
74+
75+
/// <summary>Adds an image to the div's contents.</summary>
76+
/// <param name="element">
77+
/// an
78+
/// <see cref="iText.Layout.Element.Image"/>
79+
/// </param>
80+
/// <returns>this Element</returns>
81+
public virtual iText.Html2pdf.Attach.Impl.Layout.Form.Element.Button Add(Image element) {
82+
childElements.Add(element);
83+
return this;
84+
}
85+
86+
public override T1 GetDefaultProperty<T1>(int property) {
87+
if (property == Property.KEEP_TOGETHER) {
88+
return (T1)(Object)true;
89+
}
90+
return base.GetDefaultProperty<T1>(property);
91+
}
7192
}
7293
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This file is part of the iText (R) project.
33
Copyright (c) 1998-2020 iText Group NV
4-
Authors: iText Software.
4+
Authors: Bruno Lowagie, Paulo Soares, et al.
55
66
This program is free software; you can redistribute it and/or modify
77
it under the terms of the GNU Affero General Public License version 3
@@ -42,53 +42,30 @@ source product.
4242
*/
4343
using System;
4444
using iText.Html2pdf.Attach.Impl.Layout.Form.Renderer;
45-
using iText.Layout.Element;
46-
using iText.Layout.Properties;
4745
using iText.Layout.Renderer;
4846

4947
namespace iText.Html2pdf.Attach.Impl.Layout.Form.Element {
5048
/// <summary>
5149
/// Extension of the
5250
/// <see cref="FormField{T}"/>
53-
/// class representing a button in html
51+
/// class representing a input with type button or submit in html
5452
/// </summary>
55-
[System.ObsoleteAttribute(@"Will be renamed to Button in next major release")]
56-
public class ButtonContainer : FormField<iText.Html2pdf.Attach.Impl.Layout.Form.Element.ButtonContainer> {
57-
public ButtonContainer(String id)
53+
public class InputButton : FormField<iText.Html2pdf.Attach.Impl.Layout.Form.Element.InputButton> {
54+
/// <summary>
55+
/// Creates a new
56+
/// <see cref="InputButton"/>
57+
/// instance.
58+
/// </summary>
59+
/// <param name="id">the id</param>
60+
public InputButton(String id)
5861
: base(id) {
5962
}
6063

64+
/* (non-Javadoc)
65+
* @see com.itextpdf.layout.element.AbstractElement#makeNewRenderer()
66+
*/
6167
protected override IRenderer MakeNewRenderer() {
62-
return new ButtonContainerRenderer(this);
63-
}
64-
65-
/// <summary>Adds any block element to the div's contents.</summary>
66-
/// <param name="element">
67-
/// a
68-
/// <see cref="iText.Layout.Element.BlockElement{T}"/>
69-
/// </param>
70-
/// <returns>this Element</returns>
71-
public virtual iText.Html2pdf.Attach.Impl.Layout.Form.Element.ButtonContainer Add(IBlockElement element) {
72-
childElements.Add(element);
73-
return this;
74-
}
75-
76-
/// <summary>Adds an image to the div's contents.</summary>
77-
/// <param name="element">
78-
/// an
79-
/// <see cref="iText.Layout.Element.Image"/>
80-
/// </param>
81-
/// <returns>this Element</returns>
82-
public virtual iText.Html2pdf.Attach.Impl.Layout.Form.Element.ButtonContainer Add(Image element) {
83-
childElements.Add(element);
84-
return this;
85-
}
86-
87-
public override T1 GetDefaultProperty<T1>(int property) {
88-
if (property == Property.KEEP_TOGETHER) {
89-
return (T1)(Object)true;
90-
}
91-
return base.GetDefaultProperty<T1>(property);
68+
return new InputButtonRenderer(this);
9269
}
9370
}
9471
}

itext/itext.html2pdf/itext/html2pdf/attach/impl/layout/form/renderer/AbstractFormFieldRenderer.cs

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,12 @@ public override MinMaxWidth GetMinMaxWidth() {
177177
MinMaxWidth minMaxWidth = base.GetMinMaxWidth();
178178
return minMaxWidth;
179179
}
180-
181-
/// <summary>Adjusts the field layout.</summary>
182-
[System.ObsoleteAttribute(@"Will be removed in 3.0.0, override AdjustFieldLayout(iText.Layout.Layout.LayoutContext) instead."
183-
)]
184-
protected internal abstract void AdjustFieldLayout();
185-
186-
//NOTE: should be abstract in 3.0.0
187-
protected internal virtual void AdjustFieldLayout(LayoutContext layoutContext) {
188-
AdjustFieldLayout();
189-
}
180+
181+
/// <summary>
182+
/// Adjusts the field layout.
183+
/// </summary>
184+
/// <param name="layoutContext">layout context</param>
185+
protected internal abstract void AdjustFieldLayout(LayoutContext layoutContext);
190186

191187
/// <summary>Creates the flat renderer instance.</summary>
192188
/// <returns>the renderer instance</returns>
@@ -213,29 +209,13 @@ protected internal virtual bool IsRendererFit(float availableWidth, float availa
213209
return availableHeight >= occupiedArea.GetBBox().GetHeight() && availableWidth >= occupiedArea.GetBBox().GetWidth
214210
();
215211
}
216-
217-
/// <summary>Gets the content width.</summary>
218-
/// <returns>the content width</returns>
219-
[System.ObsoleteAttribute(@"will be removed in 3.0.0. Use RetrieveWidth(float) } instead.")]
220-
protected internal virtual float? GetContentWidth() {
221-
return base.RetrieveWidth(0);
222-
}
223212

224213
/// <summary>Gets the accessibility language.</summary>
225214
/// <returns>the accessibility language</returns>
226215
protected virtual String GetLang() {
227216
return GetProperty<String>(Html2PdfProperty.FORM_ACCESSIBILITY_LANGUAGE);
228217
}
229218

230-
//NOTE: should be removed in 3.0.0
231-
protected override float? RetrieveWidth(float parentBoxWidth) {
232-
UnitValue width = base.GetProperty<UnitValue>(Property.WIDTH);
233-
if (width != null && width.IsPointValue()) {
234-
return GetContentWidth();
235-
}
236-
return base.RetrieveWidth(parentBoxWidth);
237-
}
238-
239219
protected internal virtual bool IsLayoutBasedOnFlatRenderer()
240220
{
241221
return true;

itext/itext.html2pdf/itext/html2pdf/attach/impl/layout/form/renderer/AbstractOneLineTextFieldRenderer.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ source product.
4040
For more information, please contact iText Software Corp. at this
4141
4242
*/
43-
using System;
4443
using System.Collections.Generic;
4544
using iText.Html2pdf.Attach.Impl.Layout.Form.Element;
4645
using iText.Kernel.Geom;
@@ -53,11 +52,6 @@ namespace iText.Html2pdf.Attach.Impl.Layout.Form.Renderer {
5352
/// for a single line of text content in a form field.
5453
/// </summary>
5554
public abstract class AbstractOneLineTextFieldRenderer : AbstractTextFieldRenderer {
56-
/// <summary>The position of the base line of the text.</summary>
57-
[System.ObsoleteAttribute(@"use iText.Layout.Renderer.AbstractRenderer.GetLastYLineRecursively() instead. Will be removed in 3.0.0"
58-
)]
59-
protected internal float baseline;
60-
6155
/// <summary>
6256
/// Creates a new
6357
/// <see cref="AbstractOneLineTextFieldRenderer"/>
@@ -70,7 +64,6 @@ internal AbstractOneLineTextFieldRenderer(IFormField modelElement)
7064

7165
public override void Move(float dxRight, float dyUp) {
7266
base.Move(dxRight, dyUp);
73-
baseline += dyUp;
7467
}
7568

7669
/// <summary>Crops the content lines.</summary>
@@ -79,7 +72,6 @@ public override void Move(float dxRight, float dyUp) {
7972
internal virtual void CropContentLines(IList<LineRenderer> lines, Rectangle bBox) {
8073
AdjustNumberOfContentLines(lines, bBox, 1);
8174
UpdateParagraphHeight();
82-
this.baseline = lines[0].GetYLine();
8375
}
8476

8577
/// <summary>Updates the paragraph height.</summary>

0 commit comments

Comments
 (0)