Skip to content

Commit

Permalink
Merge pull request #591 from veraPDF/pdfua2_methods
Browse files Browse the repository at this point in the history
PDF/UA-2. Add new methods
  • Loading branch information
MaximPlusov authored Oct 10, 2023
2 parents aec7489 + c896715 commit 590ce24
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ public String getTU() {
return ((org.verapdf.pd.form.PDFormField)this.simplePDObject).getTU();
}

@Override
public Long getFf() {
return ((org.verapdf.pd.form.PDFormField)this.simplePDObject).getFf();
}

@Override
public List<? extends Object> getLinkedObjects(String link) {
switch (link) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public List<? extends Object> getLinkedObjects(String link) {
}
}

private List<String> getChildrenStandardTypes() {
public List<String> getChildrenStandardTypes() {
return getChildrenStandardTypes(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.verapdf.gf.model.impl.pd.GFPDStructElem;
import org.verapdf.model.selayer.SEFENote;
import org.verapdf.pd.structure.PDStructElem;
import org.verapdf.tools.AttributeHelper;
import org.verapdf.tools.TaggedPDFConstants;

public class GFSEFENote extends GFPDStructElem implements SEFENote {
Expand All @@ -32,4 +33,9 @@ public class GFSEFENote extends GFPDStructElem implements SEFENote {
public GFSEFENote(PDStructElem structElemDictionary) {
super(structElemDictionary, TaggedPDFConstants.FENOTE, FE_NOTE_STRUCTURE_ELEMENT_TYPE);
}

@Override
public String getNoteType() {
return AttributeHelper.getNoteType(simplePDObject);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ public class GFSEFormula extends GFPDStructElem implements SEFormula {
public GFSEFormula(PDStructElem structElemDictionary) {
super(structElemDictionary, TaggedPDFConstants.FORMULA, FORMULA_STRUCTURE_ELEMENT_TYPE);
}

@Override
public Boolean getisMathFormula() {
return getChildrenStandardTypes().contains(TaggedPDFConstants.MATH_ML);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.verapdf.gf.model.impl.pd.GFPDStructElem;
import org.verapdf.model.selayer.SEL;
import org.verapdf.pd.structure.PDStructElem;
import org.verapdf.tools.AttributeHelper;
import org.verapdf.tools.TaggedPDFConstants;

public class GFSEL extends GFPDStructElem implements SEL {
Expand All @@ -32,4 +33,26 @@ public class GFSEL extends GFPDStructElem implements SEL {
public GFSEL(PDStructElem structElemDictionary) {
super(structElemDictionary, TaggedPDFConstants.L, L_STRUCTURE_ELEMENT_TYPE);
}

@Override
public String getListNumbering() {
return AttributeHelper.getListNumbering(simplePDObject);
}

@Override
public Boolean getcontainsLabels() {
return containsLabels(this);
}

private boolean containsLabels(GFPDStructElem elem) {
if (elem.getChildrenStandardTypes().contains(TaggedPDFConstants.LBL)) {
return true;
}
for (GFPDStructElem child : getChildren()) {
if (!TaggedPDFConstants.L.equals(child.getstandardType()) && containsLabels(child)) {
return true;
}
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,31 @@
import org.verapdf.pd.structure.PDStructElem;
import org.verapdf.tools.TaggedPDFConstants;

import java.util.List;

public class GFSETOCI extends GFPDStructElem implements SETOCI {

public static final String TOCI_STRUCTURE_ELEMENT_TYPE = "SETOCI";

public GFSETOCI(PDStructElem structElemDictionary) {
super(structElemDictionary, TaggedPDFConstants.TOCI, TOCI_STRUCTURE_ELEMENT_TYPE);
}

@Override
public Boolean getcontainsRef() {
return containsRef((PDStructElem)simplePDObject);
}

private boolean containsRef(PDStructElem elem) {
if (elem.containsRef()) {
return true;
}
List<PDStructElem> children = elem.getStructChildren();
for (PDStructElem child : children) {
if (containsRef(child)) {
return true;
}
}
return false;
}
}

0 comments on commit 590ce24

Please sign in to comment.