diff options
Diffstat (limited to 'fpdfsdk/formfiller')
-rw-r--r-- | fpdfsdk/formfiller/cffl_checkbox.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_combobox.cpp | 6 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_formfiller.cpp | 14 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_formfiller.h | 6 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_listbox.cpp | 8 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_radiobutton.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_textfield.cpp | 23 |
7 files changed, 23 insertions, 38 deletions
diff --git a/fpdfsdk/formfiller/cffl_checkbox.cpp b/fpdfsdk/formfiller/cffl_checkbox.cpp index c233c136c1..323dcf4f91 100644 --- a/fpdfsdk/formfiller/cffl_checkbox.cpp +++ b/fpdfsdk/formfiller/cffl_checkbox.cpp @@ -48,7 +48,7 @@ bool CFFL_CheckBox::OnChar(CPDFSDK_Annot* pAnnot, bool bReset = false; bool bExit = false; - CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget); + CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget.Get()); m_pFormFillEnv->GetInteractiveFormFiller()->OnButtonUp( &pObserved, pPageView, bReset, bExit, nFlags); if (!pObserved) { diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp index 1f2491fe95..7887593b15 100644 --- a/fpdfsdk/formfiller/cffl_combobox.cpp +++ b/fpdfsdk/formfiller/cffl_combobox.cpp @@ -38,8 +38,10 @@ PWL_CREATEPARAM CFFL_ComboBox::GetCreateParam() { if (m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT) cp.dwFlags |= PCBS_ALLOWCUSTOMTEXT; - if (!m_pFontMap) - m_pFontMap = pdfium::MakeUnique<CBA_FontMap>(m_pWidget, GetSystemHandler()); + if (!m_pFontMap) { + m_pFontMap = + pdfium::MakeUnique<CBA_FontMap>(m_pWidget.Get(), GetSystemHandler()); + } cp.pFontMap = m_pFontMap.get(); cp.pFocusHandler = this; return cp; diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index 947c495f19..2bc240fc2e 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -356,16 +356,14 @@ CPWL_Wnd* CFFL_FormFiller::GetPDFWindow(CPDFSDK_PageView* pPageView, } } else { PWL_CREATEPARAM cp = GetCreateParam(); - cp.pAttachedWidget.Reset(m_pWidget); + cp.pAttachedWidget.Reset(m_pWidget.Get()); CFFL_PrivateData* pPrivateData = new CFFL_PrivateData; - pPrivateData->pWidget = m_pWidget; + pPrivateData->pWidget = m_pWidget.Get(); pPrivateData->pPageView = pPageView; pPrivateData->nWidgetAge = m_pWidget->GetAppearanceAge(); pPrivateData->nValueAge = 0; - cp.pAttachedData = pPrivateData; - pWnd = NewPDFWindow(cp, pPageView); m_Maps[pPageView] = pWnd; } @@ -506,7 +504,7 @@ bool CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, uint32_t nFlag) { bool bExit = false; CFFL_InteractiveFormFiller* pFormFiller = m_pFormFillEnv->GetInteractiveFormFiller(); - CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget); + CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget.Get()); pFormFiller->OnKeyStrokeCommit(&pObserved, pPageView, bRC, bExit, nFlag); if (!pObserved || bExit) return true; @@ -522,11 +520,11 @@ bool CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, uint32_t nFlag) { return true; } SaveData(pPageView); - pFormFiller->OnCalculate(m_pWidget, pPageView, bExit, nFlag); + pFormFiller->OnCalculate(m_pWidget.Get(), pPageView, bExit, nFlag); if (bExit) return true; - pFormFiller->OnFormat(m_pWidget, pPageView, bExit, nFlag); + pFormFiller->OnFormat(m_pWidget.Get(), pPageView, bExit, nFlag); } return true; } @@ -582,7 +580,7 @@ void CFFL_FormFiller::EscapeFiller(CPDFSDK_PageView* pPageView, bool bDestroyPDFWindow) { m_bValid = false; - InvalidateRect(GetViewBBox(pPageView, m_pWidget)); + InvalidateRect(GetViewBBox(pPageView, m_pWidget.Get())); if (bDestroyPDFWindow) DestroyPDFWindow(pPageView); } diff --git a/fpdfsdk/formfiller/cffl_formfiller.h b/fpdfsdk/formfiller/cffl_formfiller.h index f9a155be86..bbb1e4b21b 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.h +++ b/fpdfsdk/formfiller/cffl_formfiller.h @@ -140,7 +140,7 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { void SetChangeMark(); virtual void InvalidateRect(const FX_RECT& rect); - CPDFSDK_Annot* GetSDKAnnot() { return m_pAnnot; } + CPDFSDK_Annot* GetSDKAnnot() { return m_pAnnot.Get(); } protected: using CFFL_PageView2PDFWindow = std::map<CPDFSDK_PageView*, CPWL_Wnd*>; @@ -154,8 +154,8 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { void DestroyWindows(); CFX_UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv; - CPDFSDK_Widget* m_pWidget; - CPDFSDK_Annot* m_pAnnot; + CFX_UnownedPtr<CPDFSDK_Widget> m_pWidget; + CFX_UnownedPtr<CPDFSDK_Annot> m_pAnnot; bool m_bValid; CFFL_PageView2PDFWindow m_Maps; CFX_PointF m_ptOldPos; diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp index 556e0e17d7..399e3902b1 100644 --- a/fpdfsdk/formfiller/cffl_listbox.cpp +++ b/fpdfsdk/formfiller/cffl_listbox.cpp @@ -25,12 +25,9 @@ CFFL_ListBox::~CFFL_ListBox() {} PWL_CREATEPARAM CFFL_ListBox::GetCreateParam() { PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam(); - uint32_t dwFieldFlag = m_pWidget->GetFieldFlags(); - - if (dwFieldFlag & FIELDFLAG_MULTISELECT) { + if (dwFieldFlag & FIELDFLAG_MULTISELECT) cp.dwFlags |= PLBS_MULTIPLESEL; - } cp.dwFlags |= PWS_VSCROLL; @@ -39,10 +36,9 @@ PWL_CREATEPARAM CFFL_ListBox::GetCreateParam() { if (!m_pFontMap) { m_pFontMap = pdfium::MakeUnique<CBA_FontMap>( - m_pWidget, m_pFormFillEnv->GetSysHandler()); + m_pWidget.Get(), m_pFormFillEnv->GetSysHandler()); } cp.pFontMap = m_pFontMap.get(); - return cp; } diff --git a/fpdfsdk/formfiller/cffl_radiobutton.cpp b/fpdfsdk/formfiller/cffl_radiobutton.cpp index e78160e5dc..68f5cb0d88 100644 --- a/fpdfsdk/formfiller/cffl_radiobutton.cpp +++ b/fpdfsdk/formfiller/cffl_radiobutton.cpp @@ -51,7 +51,7 @@ bool CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot, bool bReset = false; bool bExit = false; - CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget); + CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget.Get()); m_pFormFillEnv->GetInteractiveFormFiller()->OnButtonUp( &pObserved, pPageView, bReset, bExit, nFlags); if (!pObserved || bReset || bExit) diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp index 71fc9291dc..b874a51b8c 100644 --- a/fpdfsdk/formfiller/cffl_textfield.cpp +++ b/fpdfsdk/formfiller/cffl_textfield.cpp @@ -28,34 +28,25 @@ CFFL_TextField::~CFFL_TextField() { PWL_CREATEPARAM CFFL_TextField::GetCreateParam() { PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam(); - int nFlags = m_pWidget->GetFieldFlags(); - - if (nFlags & FIELDFLAG_PASSWORD) { + if (nFlags & FIELDFLAG_PASSWORD) cp.dwFlags |= PES_PASSWORD; - } if (nFlags & FIELDFLAG_MULTILINE) { cp.dwFlags |= PES_MULTILINE | PES_AUTORETURN | PES_TOP; - - if (!(nFlags & FIELDFLAG_DONOTSCROLL)) { + if (!(nFlags & FIELDFLAG_DONOTSCROLL)) cp.dwFlags |= PWS_VSCROLL | PES_AUTOSCROLL; - } } else { cp.dwFlags |= PES_CENTER; - - if (!(nFlags & FIELDFLAG_DONOTSCROLL)) { + if (!(nFlags & FIELDFLAG_DONOTSCROLL)) cp.dwFlags |= PES_AUTOSCROLL; - } } - if (nFlags & FIELDFLAG_COMB) { + if (nFlags & FIELDFLAG_COMB) cp.dwFlags |= PES_CHARARRAY; - } - if (nFlags & FIELDFLAG_RICHTEXT) { + if (nFlags & FIELDFLAG_RICHTEXT) cp.dwFlags |= PES_RICH; - } cp.dwFlags |= PES_UNDO; @@ -71,14 +62,12 @@ PWL_CREATEPARAM CFFL_TextField::GetCreateParam() { cp.dwFlags |= PES_RIGHT; break; } - if (!m_pFontMap) { m_pFontMap = pdfium::MakeUnique<CBA_FontMap>( - m_pWidget, m_pFormFillEnv->GetSysHandler()); + m_pWidget.Get(), m_pFormFillEnv->GetSysHandler()); } cp.pFontMap = m_pFontMap.get(); cp.pFocusHandler = this; - return cp; } |