Add CPDF_Document::Extension::GetPageCount()
Another virtual API at the CPDF layer, to avoid a compile time
ifdef XFA.
Change-Id: Ia95c4d3b3d3b773aaf45c49ebcadff6b16ca18c6
Reviewed-on: https://pdfium-review.googlesource.com/31910
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index 1eb014a..ea12bf9 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -329,13 +329,8 @@
if (!pDoc)
return 0;
-#ifdef PDF_ENABLE_XFA
- auto* pContext = static_cast<CPDFXFA_Context*>(pDoc->GetExtension());
- if (pContext)
- return pContext->GetPageCount();
-#endif // PDF_ENABLE_XFA
-
- return pDoc->GetPageCount();
+ auto* pExtension = pDoc->GetExtension();
+ return pExtension ? pExtension->GetPageCount() : pDoc->GetPageCount();
}
FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDF_LoadPage(FPDF_DOCUMENT document,