summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/parser/cpdf_document.h1
-rw-r--r--fpdfsdk/fpdf_view.cpp9
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_context.h2
3 files changed, 4 insertions, 8 deletions
diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h
index 82af1cfd82..759dd682a6 100644
--- a/core/fpdfapi/parser/cpdf_document.h
+++ b/core/fpdfapi/parser/cpdf_document.h
@@ -45,6 +45,7 @@ class CPDF_Document : public CPDF_IndirectObjectHolder {
class Extension {
public:
virtual ~Extension() {}
+ virtual int GetPageCount() const = 0;
virtual void DeletePage(int page_index) = 0;
};
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index 1eb014a427..ea12bf9896 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -329,13 +329,8 @@ FPDF_EXPORT int FPDF_CALLCONV FPDF_GetPageCount(FPDF_DOCUMENT document) {
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,
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.h b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
index 8491282d75..23f1ac2220 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
@@ -56,12 +56,12 @@ class CPDFXFA_Context : public CPDF_Document::Extension,
}
void SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv);
- int GetPageCount() const;
RetainPtr<CPDFXFA_Page> GetXFAPage(int page_index);
RetainPtr<CPDFXFA_Page> GetXFAPage(CXFA_FFPageView* pPage) const;
void ClearChangeMark();
// CPDF_Document::Extension:
+ int GetPageCount() const override;
void DeletePage(int page_index) override;
// IFXA_AppProvider: