diff options
author | Ryan Harrison <rharrison@chromium.org> | 2017-10-16 14:16:18 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-10-17 13:57:00 +0000 |
commit | f9068a5c08e55c1c16b14863abd8a089a327bc4d (patch) | |
tree | f8dc58642256506eb9051add027d06696836b811 /fpdfsdk/fpdfxfa | |
parent | 90fffb31e2ec6cf66fe1b85b466cd2f12ee9c87f (diff) | |
download | pdfium-f9068a5c08e55c1c16b14863abd8a089a327bc4d.tar.xz |
Convert XFA Doc Types to be more precise
The existing types are PDF, Dynamic & Static, which are poorly named
since they don't really convey the fundamental differences between the
types. "PDF" is confusing because PDFium only handles PDFs, and
"Dynamic" & "Static" describe what a form may do, not how it is
specified or some other fundamental difference. The terms "Dynamic"
and "Static" were especially confusing, since XFAF documents must be
static by definition, whereas full XFA documents can be either
dynamic or static, depending on whether or not they change their
layout.
The types have been renamed to be clear that they are talking about
the type of PDF document being described. "PDF" becomes "None", since
this is used to indicate that there are no XFA forms in the
document. "Dynamic" becomes "Full", since this indicates that the
entire XFA spec is being used for the forms, specifically display
layout is in the XML. "Static" has become "ForegroundOnly", since the
form is specified using the XFAF (XFA Foreground) subset of the spec.
The terms Full & Foreground come from the XFA spec. I would have
preferred XFAF to have a different name, since it is the
display/foreground layer that isn't XFA when using it.
BUG=pdfium:917
Change-Id: I4335958c4a11d77d3bbe63b93602dd5bc14acb57
Reviewed-on: https://pdfium-review.googlesource.com/16010
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfxfa')
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_context.cpp | 16 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp | 26 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_page.cpp | 24 |
3 files changed, 33 insertions, 33 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp index a67ac0178b..692306aebf 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp @@ -36,7 +36,7 @@ extern int GetLastError(); #endif CPDFXFA_Context::CPDFXFA_Context(std::unique_ptr<CPDF_Document> pPDFDoc) - : m_iDocType(XFA_DocType::PDF), + : m_iDocType(XFA_DocType::kNone), m_pPDFDoc(std::move(pPDFDoc)), m_pFormFillEnv(nullptr), m_pXFADocView(nullptr), @@ -117,10 +117,10 @@ bool CPDFXFA_Context::LoadXFADoc() { m_pXFADoc->StopLoad(); m_pXFADoc->GetXFADoc()->InitScriptContext(GetJSERuntime()); - if (m_pXFADoc->GetDocType() == XFA_DocType::Dynamic) - m_iDocType = XFA_DocType::Dynamic; + if (m_pXFADoc->GetDocType() == XFA_DocType::kFull) + m_iDocType = XFA_DocType::kFull; else - m_iDocType = XFA_DocType::Static; + m_iDocType = XFA_DocType::kForegroundOnly; m_pXFADocView = m_pXFADoc->CreateDocView(); if (m_pXFADocView->StartLayout() < 0) { @@ -141,11 +141,11 @@ int CPDFXFA_Context::GetPageCount() const { return 0; switch (m_iDocType) { - case XFA_DocType::PDF: - case XFA_DocType::Static: + case XFA_DocType::kNone: + case XFA_DocType::kForegroundOnly: if (m_pPDFDoc) return m_pPDFDoc->GetPageCount(); - case XFA_DocType::Dynamic: + case XFA_DocType::kFull: if (m_pXFADoc) return m_pXFADocView->CountPageViews(); default: @@ -183,7 +183,7 @@ RetainPtr<CPDFXFA_Page> CPDFXFA_Context::GetXFAPage( if (!m_pXFADoc) return nullptr; - if (m_iDocType != XFA_DocType::Dynamic) + if (m_iDocType != XFA_DocType::kFull) return nullptr; for (auto& pTempPage : m_XFAPageList) { diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp index 4dcdcac0f6..91322ee103 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp @@ -55,7 +55,7 @@ void CPDFXFA_DocEnvironment::InvalidateRect(CXFA_FFPageView* pPageView, if (!m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv()) return; - if (m_pContext->GetDocType() != XFA_DocType::Dynamic) + if (m_pContext->GetDocType() != XFA_DocType::kFull) return; RetainPtr<CPDFXFA_Page> pPage = m_pContext->GetXFAPage(pPageView); @@ -76,7 +76,7 @@ void CPDFXFA_DocEnvironment::DisplayCaret(CXFA_FFWidget* hWidget, !m_pContext->GetFormFillEnv() || !m_pContext->GetXFADocView()) return; - if (m_pContext->GetDocType() != XFA_DocType::Dynamic) + if (m_pContext->GetDocType() != XFA_DocType::kFull) return; CXFA_FFWidgetHandler* pWidgetHandler = @@ -289,7 +289,7 @@ void CPDFXFA_DocEnvironment::PageViewEvent(CXFA_FFPageView* pPageView, void CPDFXFA_DocEnvironment::WidgetPostAdd(CXFA_FFWidget* hWidget, CXFA_WidgetAcc* pWidgetData) { - if (m_pContext->GetDocType() != XFA_DocType::Dynamic || !hWidget) + if (m_pContext->GetDocType() != XFA_DocType::kFull || !hWidget) return; CXFA_FFPageView* pPageView = hWidget->GetPageView(); @@ -307,7 +307,7 @@ void CPDFXFA_DocEnvironment::WidgetPostAdd(CXFA_FFWidget* hWidget, void CPDFXFA_DocEnvironment::WidgetPreRemove(CXFA_FFWidget* hWidget, CXFA_WidgetAcc* pWidgetData) { - if (m_pContext->GetDocType() != XFA_DocType::Dynamic || !hWidget) + if (m_pContext->GetDocType() != XFA_DocType::kFull || !hWidget) return; CXFA_FFPageView* pPageView = hWidget->GetPageView(); @@ -334,7 +334,7 @@ int32_t CPDFXFA_DocEnvironment::CountPages(CXFA_FFDoc* hDoc) { int32_t CPDFXFA_DocEnvironment::GetCurrentPage(CXFA_FFDoc* hDoc) { if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv()) return -1; - if (m_pContext->GetDocType() != XFA_DocType::Dynamic) + if (m_pContext->GetDocType() != XFA_DocType::kFull) return -1; CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); @@ -347,7 +347,7 @@ int32_t CPDFXFA_DocEnvironment::GetCurrentPage(CXFA_FFDoc* hDoc) { void CPDFXFA_DocEnvironment::SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) { if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv() || - m_pContext->GetDocType() != XFA_DocType::Dynamic || iCurPage < 0 || + m_pContext->GetDocType() != XFA_DocType::kFull || iCurPage < 0 || iCurPage >= m_pContext->GetFormFillEnv()->GetPageCount()) { return; } @@ -407,8 +407,8 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, if (hDoc != m_pContext->GetXFADoc()) return; - if (m_pContext->GetDocType() != XFA_DocType::Dynamic && - m_pContext->GetDocType() != XFA_DocType::Static) { + if (m_pContext->GetDocType() != XFA_DocType::kFull && + m_pContext->GetDocType() != XFA_DocType::kForegroundOnly) { return; } @@ -506,7 +506,7 @@ void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc, if (hDoc != m_pContext->GetXFADoc()) return; - if (m_pContext->GetDocType() != XFA_DocType::Dynamic) + if (m_pContext->GetDocType() != XFA_DocType::kFull) return; CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); @@ -606,8 +606,8 @@ bool CPDFXFA_DocEnvironment::NotifySubmit(bool bPrevOrPost) { } bool CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() { - if (m_pContext->GetDocType() != XFA_DocType::Dynamic && - m_pContext->GetDocType() != XFA_DocType::Static) { + if (m_pContext->GetDocType() != XFA_DocType::kFull && + m_pContext->GetDocType() != XFA_DocType::kForegroundOnly) { return true; } @@ -658,8 +658,8 @@ bool CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() { } void CPDFXFA_DocEnvironment::OnAfterNotifySubmit() { - if (m_pContext->GetDocType() != XFA_DocType::Dynamic && - m_pContext->GetDocType() != XFA_DocType::Static) + if (m_pContext->GetDocType() != XFA_DocType::kFull && + m_pContext->GetDocType() != XFA_DocType::kForegroundOnly) return; if (!m_pContext->GetXFADocView()) diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp index 87e003e147..fa10a925cd 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp @@ -65,10 +65,10 @@ bool CPDFXFA_Page::LoadPage() { return false; switch (m_pContext->GetDocType()) { - case XFA_DocType::PDF: - case XFA_DocType::Static: + case XFA_DocType::kNone: + case XFA_DocType::kForegroundOnly: return LoadPDFPage(); - case XFA_DocType::Dynamic: + case XFA_DocType::kFull: return LoadXFAPageView(); default: return false; @@ -90,13 +90,13 @@ float CPDFXFA_Page::GetPageWidth() const { return 0.0f; switch (m_pContext->GetDocType()) { - case XFA_DocType::Dynamic: { + case XFA_DocType::kFull: { if (m_pXFAPageView) return m_pXFAPageView->GetPageViewRect().width; break; } - case XFA_DocType::Static: - case XFA_DocType::PDF: { + case XFA_DocType::kForegroundOnly: + case XFA_DocType::kNone: { if (m_pPDFPage) return m_pPDFPage->GetPageWidth(); break; @@ -113,13 +113,13 @@ float CPDFXFA_Page::GetPageHeight() const { return 0.0f; switch (m_pContext->GetDocType()) { - case XFA_DocType::PDF: - case XFA_DocType::Static: { + case XFA_DocType::kNone: + case XFA_DocType::kForegroundOnly: { if (m_pPDFPage) return m_pPDFPage->GetPageHeight(); break; } - case XFA_DocType::Dynamic: { + case XFA_DocType::kFull: { if (m_pXFAPageView) return m_pXFAPageView->GetPageViewRect().height; break; @@ -183,15 +183,15 @@ CFX_Matrix CPDFXFA_Page::GetDisplayMatrix(int xPos, return CFX_Matrix(); switch (m_pContext->GetDocType()) { - case XFA_DocType::Dynamic: { + case XFA_DocType::kFull: { if (m_pXFAPageView) { return m_pXFAPageView->GetDisplayMatrix( CFX_Rect(xPos, yPos, xSize, ySize), iRotate); } break; } - case XFA_DocType::PDF: - case XFA_DocType::Static: { + case XFA_DocType::kNone: + case XFA_DocType::kForegroundOnly: { if (m_pPDFPage) return m_pPDFPage->GetDisplayMatrix(xPos, yPos, xSize, ySize, iRotate); break; |