diff options
Diffstat (limited to 'fpdfsdk/src/formfiller')
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp | 8 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_CheckBox.cpp | 9 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_ComboBox.cpp | 70 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_FormFiller.cpp | 44 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_IFormFiller.cpp | 8 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_ListBox.cpp | 13 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_PushButton.cpp | 6 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_RadioButton.cpp | 7 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_TextField.cpp | 9 |
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 9c9384b3f0..b2c32f38fc 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 ae99edbf87..975385fb29 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) { @@ -616,8 +618,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) {} @@ -690,25 +690,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 6d8c3a9d4b..d504889e32 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 @@ -602,8 +605,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 10a1339703..4d5f72d883 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(); |