summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/formfiller
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2016-01-05 16:46:58 -0800
committerLei Zhang <thestig@chromium.org>2016-01-05 16:46:58 -0800
commitc2fb35f2bbcf6c8fcf37380000544ae39d9a8cec (patch)
tree6b8da05d1624cbbe5a0c7042c9820f02180f442c /fpdfsdk/src/formfiller
parent62664cee15230d6cbe08ed010721a4557b36dc22 (diff)
downloadpdfium-c2fb35f2bbcf6c8fcf37380000544ae39d9a8cec.tar.xz
Merge to XFA: Remove header files that only have includes.
Also do some cleanups in affected files. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1552583002 . (cherry picked from commit d794d34b5deb6ad691c19af758090f9ce46015a3) Review URL: https://codereview.chromium.org/1566583002 .
Diffstat (limited to 'fpdfsdk/src/formfiller')
-rw-r--r--fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp8
-rw-r--r--fpdfsdk/src/formfiller/FFL_CheckBox.cpp9
-rw-r--r--fpdfsdk/src/formfiller/FFL_ComboBox.cpp70
-rw-r--r--fpdfsdk/src/formfiller/FFL_FormFiller.cpp44
-rw-r--r--fpdfsdk/src/formfiller/FFL_IFormFiller.cpp8
-rw-r--r--fpdfsdk/src/formfiller/FFL_ListBox.cpp13
-rw-r--r--fpdfsdk/src/formfiller/FFL_PushButton.cpp6
-rw-r--r--fpdfsdk/src/formfiller/FFL_RadioButton.cpp7
-rw-r--r--fpdfsdk/src/formfiller/FFL_TextField.cpp9
9 files changed, 85 insertions, 89 deletions
diff --git a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp
index b08ce35d41..1649eaf35d 100644
--- a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp
+++ b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp
@@ -5,7 +5,9 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h"
-#include "fpdfsdk/include/formfiller/FormFiller.h"
+
+#include "core/include/fpdfapi/fpdf_page.h"
+#include "fpdfsdk/include/fsdk_baseannot.h"
CBA_FontMap::CBA_FontMap(CPDFSDK_Annot* pAnnot,
IFX_SystemHandler* pSystemHandler)
@@ -35,9 +37,9 @@ void CBA_FontMap::Initialize() {
if (!m_pDefaultFont) {
m_pDefaultFont = GetAnnotDefaultFont(m_sDefaultFontName);
if (m_pDefaultFont) {
- if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont())
+ if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont()) {
nCharset = pSubstFont->m_Charset;
- else {
+ } else {
if (m_sDefaultFontName == "Wingdings" ||
m_sDefaultFontName == "Wingdings2" ||
m_sDefaultFontName == "Wingdings3" ||
diff --git a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp
index 0129707340..c2e1b20253 100644
--- a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp
+++ b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp
@@ -5,11 +5,11 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "fpdfsdk/include/formfiller/FFL_CheckBox.h"
-#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
-#include "fpdfsdk/include/formfiller/FormFiller.h"
-/* ------------------------------- CFFL_CheckBox -------------------------------
- */
+#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
+#include "fpdfsdk/include/fsdk_mgr.h"
+#include "fpdfsdk/include/pdfwindow/PWL_SpecialButton.h"
+#include "public/fpdf_fwlevent.h"
CFFL_CheckBox::CFFL_CheckBox(CPDFDoc_Environment* pApp, CPDFSDK_Widget* pWidget)
: CFFL_Button(pApp, pWidget) {}
@@ -80,7 +80,6 @@ FX_BOOL CFFL_CheckBox::OnLButtonUp(CPDFSDK_PageView* pPageView,
if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, TRUE)) {
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
pWnd->SetCheck(!pWidget->IsChecked());
- // pWnd->SetCheck(!pWnd->IsChecked());
}
if (!CommitData(pPageView, nFlags))
diff --git a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp
index bef276d1cc..49d76bb265 100644
--- a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp
+++ b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp
@@ -4,14 +4,14 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h"
#include "fpdfsdk/include/formfiller/FFL_ComboBox.h"
+
+#include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h"
#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
#include "fpdfsdk/include/formfiller/FFL_IFormFiller.h"
-#include "fpdfsdk/include/formfiller/FormFiller.h"
-
-/* ------------------------------- CFFL_ComboBox -------------------------------
- */
+#include "fpdfsdk/include/fsdk_common.h"
+#include "fpdfsdk/include/fsdk_mgr.h"
+#include "fpdfsdk/include/pdfwindow/PWL_ComboBox.h"
CFFL_ComboBox::CFFL_ComboBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot)
: CFFL_FormFiller(pApp, pAnnot), m_pFontMap(NULL) {
@@ -87,40 +87,31 @@ FX_BOOL CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView) {
}
void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) {
- if (CPWL_ComboBox* pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)) {
- CFX_WideString swText = pWnd->GetText();
- int32_t nCurSel = pWnd->GetSelect();
-
- // mantis:0004157
- FX_BOOL bSetValue = TRUE;
-
- if (m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT) {
- if (nCurSel >= 0) {
- if (swText != m_pWidget->GetOptionLabel(nCurSel))
- bSetValue = TRUE;
- else
- bSetValue = FALSE;
- } else
- bSetValue = TRUE;
- } else
- bSetValue = FALSE;
-
- CFX_WideString sOldValue;
-
- if (bSetValue) {
- sOldValue = m_pWidget->GetValue();
- m_pWidget->SetValue(swText, FALSE);
- } else {
- m_pWidget->GetSelectedIndex(0);
- m_pWidget->SetOptionSelection(nCurSel, TRUE, FALSE);
- }
+ CPWL_ComboBox* pWnd =
+ static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, FALSE));
+ if (!pWnd)
+ return;
- m_pWidget->ResetFieldAppearance(TRUE);
- m_pWidget->UpdateField();
- SetChangeMark();
+ CFX_WideString swText = pWnd->GetText();
+ int32_t nCurSel = pWnd->GetSelect();
- m_pWidget->GetPDFPage();
+ bool bSetValue = false;
+
+ if (m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT)
+ bSetValue = (nCurSel < 0) || (swText != m_pWidget->GetOptionLabel(nCurSel));
+
+ if (bSetValue) {
+ m_pWidget->SetValue(swText, FALSE);
+ } else {
+ m_pWidget->GetSelectedIndex(0);
+ m_pWidget->SetOptionSelection(nCurSel, TRUE, FALSE);
}
+
+ m_pWidget->ResetFieldAppearance(TRUE);
+ m_pWidget->UpdateField();
+ SetChangeMark();
+
+ m_pWidget->GetPDFPage();
}
void CFFL_ComboBox::GetActionData(CPDFSDK_PageView* pPageView,
@@ -216,9 +207,9 @@ void CFFL_ComboBox::RestoreState(CPDFSDK_PageView* pPageView) {
if (CPWL_ComboBox* pComboBox =
static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, TRUE))) {
- if (m_State.nIndex >= 0)
+ if (m_State.nIndex >= 0) {
pComboBox->SetSelect(m_State.nIndex);
- else {
+ } else {
if (CPWL_Edit* pEdit = pComboBox->GetEdit()) {
pEdit->SetText(m_State.sValue.c_str());
pEdit->SetSel(m_State.nStart, m_State.nEnd);
@@ -239,8 +230,9 @@ CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView,
if (bRestoreValue) {
RestoreState(pPageView);
pRet = GetPDFWindow(pPageView, FALSE);
- } else
+ } else {
pRet = GetPDFWindow(pPageView, TRUE);
+ }
m_pWidget->UpdateField();
diff --git a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp
index a903824c6a..2e73b491c9 100644
--- a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp
+++ b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp
@@ -4,17 +4,19 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h"
#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
+#include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h"
+#include "fpdfsdk/include/fsdk_common.h"
+#include "fpdfsdk/include/fsdk_mgr.h"
+#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
+
#define GetRed(rgb) ((uint8_t)(rgb))
#define GetGreen(rgb) ((uint8_t)(((FX_WORD)(rgb)) >> 8))
#define GetBlue(rgb) ((uint8_t)((rgb) >> 16))
#define FFL_HINT_ELAPSE 800
-/* ------------------------- CFFL_FormFiller ------------------------- */
-
CFFL_FormFiller::CFFL_FormFiller(CPDFDoc_Environment* pApp,
CPDFSDK_Annot* pAnnot)
: m_pApp(pApp), m_pAnnot(pAnnot), m_bValid(FALSE), m_ptOldPos(0, 0) {
@@ -622,8 +624,6 @@ void CFFL_FormFiller::InvalidateRect(double left,
m_pApp->FFI_Invalidate(pPage, left, top, right, bottom);
}
-/* ------------------------- CFFL_Button ------------------------- */
-
CFFL_Button::CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget)
: CFFL_FormFiller(pApp, pWidget), m_bMouseIn(FALSE), m_bMouseDown(FALSE) {}
@@ -696,25 +696,25 @@ void CFFL_Button::OnDraw(CPDFSDK_PageView* pPageView,
CPDF_FormControl* pCtrl = pWidget->GetFormControl();
CPDF_FormControl::HighlightingMode eHM = pCtrl->GetHighlightingMode();
- if (eHM == CPDF_FormControl::Push) {
- if (m_bMouseDown) {
- if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Down))
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Down, NULL);
- else
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal,
- NULL);
- } else if (m_bMouseIn) {
- if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Rollover))
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Rollover,
- NULL);
- else
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal,
- NULL);
- } else {
+ if (eHM != CPDF_FormControl::Push) {
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ return;
+ }
+
+ if (m_bMouseDown) {
+ if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Down))
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Down, NULL);
+ else
pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
- }
- } else
+ } else if (m_bMouseIn) {
+ if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Rollover))
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Rollover,
+ NULL);
+ else
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ } else {
pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ }
}
void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView,
diff --git a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
index b8893e872f..36b123e165 100644
--- a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
+++ b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp
@@ -4,14 +4,17 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "fpdfsdk/include/formfiller/FFL_IFormFiller.h"
+
#include "fpdfsdk/include/formfiller/FFL_CheckBox.h"
#include "fpdfsdk/include/formfiller/FFL_ComboBox.h"
#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
-#include "fpdfsdk/include/formfiller/FFL_IFormFiller.h"
#include "fpdfsdk/include/formfiller/FFL_ListBox.h"
#include "fpdfsdk/include/formfiller/FFL_PushButton.h"
#include "fpdfsdk/include/formfiller/FFL_RadioButton.h"
#include "fpdfsdk/include/formfiller/FFL_TextField.h"
+#include "fpdfsdk/include/fsdk_mgr.h"
+#include "fpdfsdk/include/pdfwindow/PWL_Utils.h"
#define FFL_MAXLISTBOXHEIGHT 140.0f
@@ -607,8 +610,9 @@ void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData,
} else {
fMaxListBoxHeight = FFL_MAXLISTBOXHEIGHT;
}
- } else
+ } else {
fMaxListBoxHeight = fPopupMax;
+ }
if (fBottom > fMaxListBoxHeight) {
fFactHeight = fMaxListBoxHeight;
diff --git a/fpdfsdk/src/formfiller/FFL_ListBox.cpp b/fpdfsdk/src/formfiller/FFL_ListBox.cpp
index d9244e699f..638618f784 100644
--- a/fpdfsdk/src/formfiller/FFL_ListBox.cpp
+++ b/fpdfsdk/src/formfiller/FFL_ListBox.cpp
@@ -4,17 +4,17 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "fpdfsdk/include/formfiller/FFL_ListBox.h"
+
#include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h"
#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
#include "fpdfsdk/include/formfiller/FFL_IFormFiller.h"
-#include "fpdfsdk/include/formfiller/FFL_ListBox.h"
-#include "fpdfsdk/include/formfiller/FormFiller.h"
+#include "fpdfsdk/include/fsdk_common.h"
+#include "fpdfsdk/include/fsdk_mgr.h"
+#include "fpdfsdk/include/pdfwindow/PWL_ListBox.h"
#define FFL_DEFAULTLISTBOXFONTSIZE 12.0f
-/* ------------------------------- CFFL_ListBox -------------------------------
- */
-
CFFL_ListBox::CFFL_ListBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget)
: CFFL_FormFiller(pApp, pWidget), m_pFontMap(NULL) {}
@@ -213,8 +213,9 @@ CPWL_Wnd* CFFL_ListBox::ResetPDFWindow(CPDFSDK_PageView* pPageView,
if (bRestoreValue) {
RestoreState(pPageView);
pRet = GetPDFWindow(pPageView, FALSE);
- } else
+ } else {
pRet = GetPDFWindow(pPageView, TRUE);
+ }
m_pWidget->UpdateField();
diff --git a/fpdfsdk/src/formfiller/FFL_PushButton.cpp b/fpdfsdk/src/formfiller/FFL_PushButton.cpp
index fbf782e99d..d5bd509718 100644
--- a/fpdfsdk/src/formfiller/FFL_PushButton.cpp
+++ b/fpdfsdk/src/formfiller/FFL_PushButton.cpp
@@ -4,12 +4,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
#include "fpdfsdk/include/formfiller/FFL_PushButton.h"
-#include "fpdfsdk/include/formfiller/FormFiller.h"
-/* ------------------------------- CFFL_PushButton
- * ------------------------------- */
+#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
+#include "fpdfsdk/include/pdfwindow/PWL_SpecialButton.h"
CFFL_PushButton::CFFL_PushButton(CPDFDoc_Environment* pApp,
CPDFSDK_Annot* pAnnot)
diff --git a/fpdfsdk/src/formfiller/FFL_RadioButton.cpp b/fpdfsdk/src/formfiller/FFL_RadioButton.cpp
index 609e043024..2a742c0a85 100644
--- a/fpdfsdk/src/formfiller/FFL_RadioButton.cpp
+++ b/fpdfsdk/src/formfiller/FFL_RadioButton.cpp
@@ -4,12 +4,11 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
#include "fpdfsdk/include/formfiller/FFL_RadioButton.h"
-#include "fpdfsdk/include/formfiller/FormFiller.h"
-/* ------------------------------- CFFL_RadioButton
- * ------------------------------- */
+#include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
+#include "fpdfsdk/include/fsdk_mgr.h"
+#include "fpdfsdk/include/pdfwindow/PWL_SpecialButton.h"
CFFL_RadioButton::CFFL_RadioButton(CPDFDoc_Environment* pApp,
CPDFSDK_Annot* pWidget)
diff --git a/fpdfsdk/src/formfiller/FFL_TextField.cpp b/fpdfsdk/src/formfiller/FFL_TextField.cpp
index fe0a3aae9c..8d39b82dd5 100644
--- a/fpdfsdk/src/formfiller/FFL_TextField.cpp
+++ b/fpdfsdk/src/formfiller/FFL_TextField.cpp
@@ -4,11 +4,11 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h"
#include "fpdfsdk/include/formfiller/FFL_TextField.h"
-/* ------------------------------- CFFL_TextField
- * ------------------------------- */
+#include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h"
+#include "fpdfsdk/include/fsdk_common.h"
+#include "fpdfsdk/include/fsdk_mgr.h"
CFFL_TextField::CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot)
: CFFL_FormFiller(pApp, pAnnot), m_pFontMap(NULL) {
@@ -247,8 +247,9 @@ CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView,
if (bRestoreValue) {
RestoreState(pPageView);
pRet = GetPDFWindow(pPageView, FALSE);
- } else
+ } else {
pRet = GetPDFWindow(pPageView, TRUE);
+ }
m_pWidget->UpdateField();