diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-07-11 13:25:02 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-07-11 13:25:02 +0000 |
commit | b66077d3ef7ba594f2a831840783549f4dd70d86 (patch) | |
tree | 2a2a79c65d5e389f4878ed3f131414f85ea4a6a9 /fpdfsdk/fpdf_editpage.cpp | |
parent | ad1f7b410cd6885bd22d9ee49d9f80d3017f131f (diff) | |
download | pdfium-b66077d3ef7ba594f2a831840783549f4dd70d86.tar.xz |
Add FPDFFormObj_CountObjects() API
To find out the number of sub-objects a form object has, similar to how
FPDFPage_CountObjects() does it for page objects.
Change-Id: I7e5775dece42b74fd5b71b1d9622a1aa37bf64ac
Reviewed-on: https://pdfium-review.googlesource.com/37316
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_editpage.cpp')
-rw-r--r-- | fpdfsdk/fpdf_editpage.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp index 8a1200885a..4151de5dfd 100644 --- a/fpdfsdk/fpdf_editpage.cpp +++ b/fpdfsdk/fpdf_editpage.cpp @@ -751,3 +751,24 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) { pPageObj->SetDirty(true); return true; } + +FPDF_EXPORT int FPDF_CALLCONV +FPDFFormObj_CountObjects(FPDF_PAGEOBJECT page_object) { + auto* pPageObj = CPDFPageObjectFromFPDFPageObject(page_object); + if (!pPageObj) + return -1; + + CPDF_FormObject* pFormObject = pPageObj->AsForm(); + if (!pFormObject) + return -1; + + const CPDF_Form* pForm = pFormObject->form(); + if (!pForm) + return -1; + + const CPDF_PageObjectList* pObjectList = pForm->GetPageObjectList(); + if (!pObjectList) + return -1; + + return pObjectList->size(); +} |