diff options
Diffstat (limited to 'fpdfsdk/src/formfiller')
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp | 24 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_CheckBox.cpp | 10 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_ComboBox.cpp | 38 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_FormFiller.cpp | 92 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_IFormFiller.cpp | 186 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_ListBox.cpp | 32 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_Notify.cpp | 10 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_PushButton.cpp | 6 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_RadioButton.cpp | 8 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_TextField.cpp | 40 | ||||
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_Utils.cpp | 4 |
11 files changed, 225 insertions, 225 deletions
diff --git a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp index abe30d85af..f4eb74bd72 100644 --- a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp +++ b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/formfiller/FormFiller.h" @@ -22,7 +22,7 @@ CBA_FontMap::CBA_FontMap(CPDFSDK_Annot* pAnnot, IFX_SystemHandler* pSystemHandle m_pAnnotDict = pAnnot->GetPDFAnnot()->GetAnnotDict(); } -CBA_FontMap::CBA_FontMap(CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict, +CBA_FontMap::CBA_FontMap(CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict, IFX_SystemHandler* pSystemHandler) : CPWL_FontMap(pSystemHandler), m_pDocument(pDocument), @@ -49,7 +49,7 @@ void CBA_FontMap::Initial(const FX_CHAR* fontname) if (!m_pDefaultFont) { - m_pDefaultFont = GetAnnotDefaultFont(m_sDefaultFontName); + m_pDefaultFont = GetAnnotDefaultFont(m_sDefaultFontName); if (m_pDefaultFont) { if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont()) @@ -118,7 +118,7 @@ CPDF_Document* CBA_FontMap::GetDocument() return m_pDocument; } -CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict, CFX_ByteString& sFontAlias, +CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict, CFX_ByteString& sFontAlias, int32_t nCharset) { if (!pResDict) return NULL; @@ -172,7 +172,7 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAl CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDict("AP"); - if (pAPDict == NULL) + if (pAPDict == NULL) { pAPDict = FX_NEW CPDF_Dictionary; m_pAnnotDict->SetAt("AP", pAPDict); @@ -184,7 +184,7 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAl return; CPDF_Stream* pStream = pAPDict->GetStream(m_sAPType); - if (pStream == NULL) + if (pStream == NULL) { pStream = new CPDF_Stream(NULL, 0, NULL); int32_t objnum = m_pDocument->AddIndirectObject(pStream); @@ -208,10 +208,10 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAl pStreamDict->SetAt("Resources", pStreamResList); } - if (pStreamResList) + if (pStreamResList) { CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDict("Font"); - if (!pStreamResFontList) + if (!pStreamResFontList) { pStreamResFontList = new CPDF_Dictionary; int32_t objnum = m_pDocument->AddIndirectObject(pStreamResFontList); @@ -237,7 +237,7 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString &sAlias) if (CPDF_Dictionary * pRootDict = m_pDocument->GetRoot()) pAcroFormDict = pRootDict->GetDict("AcroForm"); } - + CFX_ByteString sDA; CPDF_Object* pObj; if ((pObj = FPDF_GetFieldAttr(m_pAnnotDict, "DA"))) @@ -251,8 +251,8 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString &sAlias) sDA = pObj ? pObj->GetString() : CFX_ByteString(); } } - - CPDF_Dictionary * pFontDict = NULL; + + CPDF_Dictionary * pFontDict = NULL; if (!sDA.IsEmpty()) { @@ -273,7 +273,7 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString &sAlias) pFontDict = pResFontDict->GetDict(sAlias); if (bWidget) - { + { if (!pFontDict) { if (pAcroFormDict) diff --git a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp index dad485cac3..55d2d45bc2 100644 --- a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/formfiller/FormFiller.h" @@ -27,7 +27,7 @@ CPWL_Wnd* CFFL_CheckBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageVie ASSERT(m_pWidget != NULL); pWnd->SetCheck(m_pWidget->IsChecked()); - + return pWnd; } @@ -46,7 +46,7 @@ FX_BOOL CFFL_CheckBox::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFla { switch (nChar) { - case FWL_VKEY_Return: + case FWL_VKEY_Return: case FWL_VKEY_Space: { CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); @@ -115,9 +115,9 @@ void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE)) { - + FX_BOOL bNewChecked = pWnd->IsChecked(); - + if (bNewChecked) { diff --git a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp index 8ae9254470..4ceb1e9af3 100644 --- a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/formfiller/FormFiller.h" @@ -37,9 +37,9 @@ PWL_CREATEPARAM CFFL_ComboBox::GetCreateParam() ASSERT(m_pWidget != NULL); int nFlags = m_pWidget->GetFieldFlags(); - + if (nFlags & FIELDFLAG_EDIT) - { + { cp.dwFlags |= PCBS_ALLOWCUSTOMTEXT; } @@ -111,7 +111,7 @@ FX_BOOL CFFL_ComboBox::IsDataChanged(CPDFSDK_PageView* pPageView) return nCurSel != m_pWidget->GetSelectedIndex(0); } } - + return FALSE; } @@ -143,7 +143,7 @@ void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) bSetValue = FALSE; CFX_WideString sOldValue; - + if (bSetValue) { @@ -161,7 +161,7 @@ void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) SetChangeMark(); m_pWidget->GetPDFPage(); - + } } @@ -175,7 +175,7 @@ void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) { if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) { - fa.bFieldFull = pEdit->IsTextFull(); + fa.bFieldFull = pEdit->IsTextFull(); int nSelStart = 0; int nSelEnd = 0; pEdit->GetSel(nSelStart, nSelEnd); @@ -213,7 +213,7 @@ void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) -void CFFL_ComboBox::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, +void CFFL_ComboBox::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, const PDFSDK_FieldAction& fa) { switch (type) @@ -233,7 +233,7 @@ void CFFL_ComboBox::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AAc } } -FX_BOOL CFFL_ComboBox::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, +FX_BOOL CFFL_ComboBox::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, const PDFSDK_FieldAction& faNew) { switch (type) @@ -287,11 +287,11 @@ CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRe { if (bRestoreValue) SaveState(pPageView); - + DestroyPDFWindow(pPageView); - + CPWL_Wnd* pRet = NULL; - + if (bRestoreValue) { RestoreState(pPageView); @@ -299,18 +299,18 @@ CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRe } else pRet = GetPDFWindow(pPageView, TRUE); - + m_pWidget->UpdateField(); - + return pRet; } void CFFL_ComboBox::OnKeyStroke(FX_BOOL bKeyDown, FX_UINT nFlag) { ASSERT(m_pWidget != NULL); - + int nFlags = m_pWidget->GetFieldFlags(); - + if (nFlags & FIELDFLAG_COMMITONSELCHANGE) { if (m_bValid) @@ -412,14 +412,14 @@ void CFFL_ComboBox::OnAddUndo(CPWL_Edit* pEdit) CFX_WideString CFFL_ComboBox::GetSelectExportText() { CFX_WideString swRet; - + int nExport = -1; CPDFSDK_PageView *pPageView = GetCurPageView(); if (CPWL_ComboBox * pComboBox = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)) { nExport = pComboBox->GetSelect(); } - + if (nExport >= 0) { if (CPDF_FormField * pFormField = m_pWidget->GetFormField()) @@ -429,6 +429,6 @@ CFX_WideString CFFL_ComboBox::GetSelectExportText() swRet = pFormField->GetOptionLabel(nExport); } } - + return swRet; } diff --git a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp index 1148c78a5f..540619692b 100644 --- a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp +++ b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com @@ -22,7 +22,7 @@ CFFL_FormFiller::CFFL_FormFiller(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnno m_pAnnot(pAnnot), m_bValid(FALSE), m_ptOldPos(0,0) -{ +{ m_pWidget = (CPDFSDK_Widget*) pAnnot; } @@ -89,7 +89,7 @@ FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* return rect.GetOutterRect(); } -void CFFL_FormFiller::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, +void CFFL_FormFiller::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, /*const CRect& rcWindow,*/ FX_DWORD dwFlags) { @@ -109,14 +109,14 @@ void CFFL_FormFiller::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_A } } -void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, +void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, /*const CRect& rcWindow,*/ FX_DWORD dwFlags) { ASSERT(pAnnot != NULL); - + CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; - + pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); } @@ -146,7 +146,7 @@ void CFFL_FormFiller::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pA FX_BOOL CFFL_FormFiller::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE)) - { + { m_bValid = TRUE; FX_RECT rect = GetViewBBox(pPageView,pAnnot); InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); @@ -163,7 +163,7 @@ FX_BOOL CFFL_FormFiller::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Anno FX_BOOL CFFL_FormFiller::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) - { + { FX_RECT rcFFL = GetViewBBox(pPageView, pAnnot); InvalidateRect(rcFFL.left, rcFFL.top, rcFFL.right, rcFFL.bottom); pWnd->OnLButtonUp(WndtoPWL(pPageView, point),nFlags); @@ -176,7 +176,7 @@ FX_BOOL CFFL_FormFiller::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* FX_BOOL CFFL_FormFiller::OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) - { + { pWnd->OnLButtonDblClk(WndtoPWL(pPageView, point),nFlags); return TRUE; } @@ -192,7 +192,7 @@ FX_BOOL CFFL_FormFiller::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* } if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) - { + { pWnd->OnMouseMove(WndtoPWL(pPageView, point),nFlags); return TRUE; } @@ -205,7 +205,7 @@ FX_BOOL CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot if (!IsValid()) return FALSE; if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE)) - { + { return pWnd->OnMouseWheel(zDelta, WndtoPWL(pPageView, point),nFlags); } @@ -215,7 +215,7 @@ FX_BOOL CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot FX_BOOL CFFL_FormFiller::OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE)) - { + { pWnd->OnRButtonDown(WndtoPWL(pPageView, point),nFlags); return TRUE; } @@ -226,7 +226,7 @@ FX_BOOL CFFL_FormFiller::OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Anno FX_BOOL CFFL_FormFiller::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) - { + { pWnd->OnRButtonUp(WndtoPWL(pPageView, point),nFlags); return TRUE; } @@ -237,7 +237,7 @@ FX_BOOL CFFL_FormFiller::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* FX_BOOL CFFL_FormFiller::OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) - { + { pWnd->OnRButtonDblClk(WndtoPWL(pPageView, point),nFlags); return TRUE; } @@ -253,7 +253,7 @@ FX_BOOL CFFL_FormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_U ASSERT(pPageView != NULL); if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) - { + { return pWnd->OnKeyDown(nKeyCode,nFlags); } } @@ -269,7 +269,7 @@ FX_BOOL CFFL_FormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nF ASSERT(pPageView != NULL); if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) - { + { return pWnd->OnChar(nChar,nFlags); } } @@ -296,23 +296,23 @@ FX_BOOL CFFL_FormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) CPDFSDK_PageView* pPageView = pDoc->GetPageView(pPage); ASSERT(pPageView != NULL); - + CPWL_Wnd * pWnd = NULL; if ( (pWnd = GetPDFWindow(pPageView, TRUE))) - { + { pWnd->SetFocus(); } m_bValid = TRUE; - - - + + + m_bValid = TRUE; FX_RECT rcRect = GetViewBBox(pPageView,pAnnot); InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); - + return TRUE; } @@ -326,10 +326,10 @@ FX_BOOL CFFL_FormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) CommitData(pPageView, nFlag); if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) - { + { pWnd->KillFocus(); } - + switch (m_pWidget->GetFieldType()) { case FIELDTYPE_PUSHBUTTON: @@ -357,10 +357,10 @@ PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() PWL_CREATEPARAM cp; - cp.pParentWnd = NULL; + cp.pParentWnd = NULL; cp.pProvider = this; cp.rcRectWnd = GetPDFWindowRect(); - + FX_DWORD dwCreateFlags = PWS_BORDER | PWS_BACKGROUND | PWS_VISIBLE; ASSERT(m_pWidget != NULL); @@ -369,7 +369,7 @@ PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() FX_DWORD dwFieldFlag = m_pWidget->GetFieldFlags(); if (dwFieldFlag & FIELDFLAG_READONLY) - { + { dwCreateFlags |= PWS_READONLY; } @@ -393,7 +393,7 @@ PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() cp.fFontSize = m_pWidget->GetFontSize(); cp.dwBorderWidth = m_pWidget->GetBorderWidth(); - + int nBorderStyle = m_pWidget->GetBorderStyle(); switch (nBorderStyle) @@ -403,7 +403,7 @@ PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() break; case BBS_DASH: cp.nBorderStyle = PBS_DASH; - cp.sDash = CPWL_Dash(3,3,0); + cp.sDash = CPWL_Dash(3,3,0); break; case BBS_BEVELED: cp.nBorderStyle = PBS_BEVELED; @@ -500,7 +500,7 @@ CPDF_Matrix CFFL_FormFiller::GetWindowMatrix(void* pAttachedData) pPrivateData->pPageView->GetCurrentMatrix(mtPageView); CPDF_Matrix mt = GetCurMatrix(); mt.Concat(mtPageView); - + return mt; } } @@ -520,7 +520,7 @@ CPDF_Matrix CFFL_FormFiller::GetCurMatrix() switch (m_pWidget->GetRotate()) { default: - case 0: + case 0: mt = CPDF_Matrix(1,0,0,1,0,0); break; case 90: @@ -578,7 +578,7 @@ CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView() CPDF_Rect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) { if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) - { + { CPDF_Rect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocusRect())); ASSERT(pPageView); CPDF_Rect rcPage = pPageView->GetPDFPage()->GetPageBBox(); @@ -594,7 +594,7 @@ CPDF_Rect CFFL_FormFiller::FFLtoPWL(const CPDF_Rect& rect) { CPDF_Matrix mt; mt.SetReverse(GetCurMatrix()); - + CPDF_Rect temp = rect; mt.TransformRect(temp); @@ -604,7 +604,7 @@ CPDF_Rect CFFL_FormFiller::FFLtoPWL(const CPDF_Rect& rect) CPDF_Rect CFFL_FormFiller::PWLtoFFL(const CPDF_Rect& rect) { CPDF_Matrix mt = GetCurMatrix(); - + CPDF_Rect temp = rect; mt.TransformRect(temp); @@ -635,10 +635,10 @@ CPDF_Point CFFL_FormFiller::PWLtoFFL(const CPDF_Point & point) CPDF_Point CFFL_FormFiller::WndtoPWL(CPDFSDK_PageView* pPageView, const CPDF_Point& pt) { // ASSERT(pPageView != NULL); -// +// // CPDF_Point point(0.0f, 0.0f); // pPageView->WindowToDoc(pt.x, pt.y, point.x, point.y); -// +// return FFLtoPWL(pt); // return CPDF_Point(0, 0); } @@ -646,10 +646,10 @@ CPDF_Point CFFL_FormFiller::WndtoPWL(CPDFSDK_PageView* pPageView, const CPDF_Poi CPDF_Rect CFFL_FormFiller::FFLtoWnd(CPDFSDK_PageView* pPageView, const CPDF_Rect & rect) { // FX_RECT rcRet(0,0,0,0); -// -// ASSERT(pPageView != NULL); +// +// ASSERT(pPageView != NULL); // pPageView->DocToWindow(rect, rcRet); -// +// return rect; } @@ -728,12 +728,12 @@ void CFFL_FormFiller::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::A fa.sValue = m_pWidget->GetValue(); } -void CFFL_FormFiller::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, +void CFFL_FormFiller::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, const PDFSDK_FieldAction& fa) { } -FX_BOOL CFFL_FormFiller::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, +FX_BOOL CFFL_FormFiller::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, const PDFSDK_FieldAction& faNew) { return FALSE; @@ -749,7 +749,7 @@ void CFFL_FormFiller::RestoreState(CPDFSDK_PageView* pPageView) CPWL_Wnd* CFFL_FormFiller::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue) { - return GetPDFWindow(pPageView, FALSE); + return GetPDFWindow(pPageView, FALSE); } void CFFL_FormFiller::TimerProc() @@ -770,7 +770,7 @@ void CFFL_FormFiller::OnKeyStroke(FX_BOOL bKeyDown) void CFFL_FormFiller::EscapeFiller(CPDFSDK_PageView* pPageView, FX_BOOL bDestroyPDFWindow) { m_bValid = FALSE; - + FX_RECT rcRect = GetViewBBox(pPageView, m_pWidget); InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); @@ -862,7 +862,7 @@ FX_BOOL CFFL_Button::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAn m_bMouseDown = FALSE; m_pWidget->GetPDFPage(); - + FX_RECT rect = GetViewBBox(pPageView, pAnnot); InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); @@ -876,7 +876,7 @@ FX_BOOL CFFL_Button::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAn return TRUE; } -void CFFL_Button::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, +void CFFL_Button::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, /*const CRect& rcWindow,*/ FX_DWORD dwFlags) { @@ -916,7 +916,7 @@ void CFFL_Button::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot } -void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, +void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, /*const CRect& rcWindow, */FX_DWORD dwFlags) { diff --git a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp index 61fd04a0d7..4a5a7bcd96 100644 --- a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp +++ b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/formfiller/FFL_FormFiller.h" @@ -20,7 +20,7 @@ /* ----------------------------- CFFL_IFormFiller ----------------------------- */ -CFFL_IFormFiller::CFFL_IFormFiller(CPDFDoc_Environment* pApp) : +CFFL_IFormFiller::CFFL_IFormFiller(CPDFDoc_Environment* pApp) : m_pApp(pApp), m_bNotifying(FALSE) { @@ -73,7 +73,7 @@ FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot } } -void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, +void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, /*const CRect& rcWindow,*/ FX_DWORD dwFlags) { @@ -87,9 +87,9 @@ void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_ if (pFormFiller->IsValid()) { pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); - + pAnnot->GetPDFPage(); - + CPDFSDK_Document* pDocument = m_pApp->GetCurrentDoc(); ASSERT(pDocument != NULL); @@ -100,23 +100,23 @@ void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_ if (!rcFocus.IsEmpty()) { CFX_PathData path; - + path.SetPointCount(5); path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO); path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LINETO); path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LINETO); path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINETO); path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO); - + CFX_GraphStateData gsd; - gsd.SetDashCount(1); + gsd.SetDashCount(1); gsd.m_DashArray[0] = 1.0f; - gsd.m_DashPhase = 0; - + gsd.m_DashPhase = 0; + gsd.m_LineWidth = 1.0f; pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEncode(255,0,0,0), FXFILL_ALTERNATE); - // ::DrawFocusRect(hDC, &rcFocus); + // ::DrawFocusRect(hDC, &rcFocus); } } @@ -133,7 +133,7 @@ void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_ { pWidget->DrawShadow(pDevice, pPageView); } - + } } @@ -167,30 +167,30 @@ void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* { ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); - + if (!m_bNotifying) { CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; if (pWidget->GetAAction(CPDF_AAction::CursorEnter)) { m_bNotifying = TRUE; - + int nValueAge = pWidget->GetValueAge(); pWidget->ClearAppModified(); - + ASSERT(pPageView != NULL); - - - + + + PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView ); m_bNotifying = FALSE; - + //if ( !IsValidAnnot(pPageView, pAnnot) ) return; - + if (pWidget->IsAppModified()) { if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) @@ -200,7 +200,7 @@ void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* } } } - + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { pFormFiller->OnMouseEnter(pPageView, pAnnot); @@ -211,7 +211,7 @@ void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* p { ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); - + if (!m_bNotifying) { CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; @@ -221,20 +221,20 @@ void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* p pWidget->GetAppearanceAge(); int nValueAge = pWidget->GetValueAge(); pWidget->ClearAppModified(); - + ASSERT(pPageView != NULL); - - - + + + PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); - + pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView); m_bNotifying = FALSE; - + //if (!IsValidAnnot(pPageView, pAnnot)) return; - + if (pWidget->IsAppModified()) { if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) @@ -244,7 +244,7 @@ void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* p } } } - + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { pFormFiller->OnMouseExit(pPageView, pAnnot); @@ -255,7 +255,7 @@ FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann { ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); - + if (!m_bNotifying) { CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; @@ -265,19 +265,19 @@ FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann pWidget->GetAppearanceAge(); int nValueAge = pWidget->GetValueAge(); pWidget->ClearAppModified(); - + ASSERT(pPageView != NULL); - - - + + + PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags); fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlags); pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView); m_bNotifying = FALSE; - + if (!IsValidAnnot(pPageView, pAnnot)) return TRUE; - + if (pWidget->IsAppModified()) { if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) @@ -287,12 +287,12 @@ FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann } } } - + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); } - + return FALSE; } @@ -300,13 +300,13 @@ FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot { ASSERT(pAnnot != NULL); ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); - + CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; // CReader_Page* pPage = pAnnot->GetPage(); // ASSERT(pPage != NULL); CPDFSDK_Document* pDocument = m_pApp->GetCurrentDoc(); - ASSERT(pDocument != NULL); - + ASSERT(pDocument != NULL); + switch (pWidget->GetFieldType()) { case FIELDTYPE_PUSHBUTTON: @@ -321,9 +321,9 @@ FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot pDocument->SetFocusAnnot(pAnnot); break; } - + FX_BOOL bRet = FALSE; - + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); @@ -345,7 +345,7 @@ FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bReset, FX_BOOL& bExit,FX_UINT nFlag) { ASSERT(pWidget != NULL); - + if (!m_bNotifying) { if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) @@ -353,33 +353,33 @@ void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa m_bNotifying = TRUE; int nAge = pWidget->GetAppearanceAge(); int nValueAge = pWidget->GetValueAge(); - + ASSERT(pPageView != NULL); // CReader_DocView* pDocView = pPageView->GetDocView(); // ASSERT(pDocView != NULL); - - - + + + PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView); m_bNotifying = FALSE; - + if (!IsValidAnnot(pPageView, pWidget)) { bExit = TRUE; return; } - + if (nAge != pWidget->GetAppearanceAge()) { if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget->GetValueAge()); } - + bReset = TRUE; } } @@ -472,7 +472,7 @@ FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_ if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { - return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); + return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); } return FALSE; @@ -529,25 +529,25 @@ FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) pWidget->GetAppearanceAge(); int nValueAge = pWidget->GetValueAge(); pWidget->ClearAppModified(); - - + + CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); ASSERT(pPageView != NULL); - + PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); - + CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TRUE); if(!pFormFiller) return FALSE; pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa); - + pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView); m_bNotifying = FALSE; - + // if (!IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pAnnot)) return FALSE; - + if (pWidget->IsAppModified()) { if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) @@ -557,7 +557,7 @@ FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) } } } - + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { if (pFormFiller->OnSetFocus(pAnnot, nFlag)) @@ -587,19 +587,19 @@ FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) { m_bNotifying = TRUE; pWidget->ClearAppModified(); - + CPDFSDK_PageView* pPageView = pWidget->GetPageView(); ASSERT(pPageView != NULL); - + PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); - + pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa); - + pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); m_bNotifying = FALSE; - + } } } @@ -634,16 +634,16 @@ FX_BOOL CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) { CPDF_Page* pPage = pWidget->GetPDFPage(); ASSERT(pPage != NULL); - + CPDF_Document* pDocument = pPage->m_pDocument; ASSERT(pDocument != NULL); - + FX_DWORD dwPermissions = pDocument->GetUserPermissions(); - return (dwPermissions&FPDFPERM_FILL_FORM) || - (dwPermissions&FPDFPERM_ANNOT_FORM) || + return (dwPermissions&FPDFPERM_FILL_FORM) || + (dwPermissions&FPDFPERM_ANNOT_FORM) || (dwPermissions&FPDFPERM_MODIFY); } - return TRUE; + return TRUE; } CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL bRegister) @@ -659,7 +659,7 @@ CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL if (bRegister) { - CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; + CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; int nFieldType = pWidget->GetFieldType(); switch(nFieldType) @@ -728,7 +728,7 @@ void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; - + CPDF_Rect rcPageView(0,0,0,0); @@ -837,8 +837,8 @@ void CFFL_IFormFiller::OnSetWindowRect(void* pPrivateData, const CPDF_Rect & rcW } } -void CFFL_IFormFiller::OnKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, int32_t nKeyCode, CFX_WideString& strChange, - const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, +void CFFL_IFormFiller::OnKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, int32_t nKeyCode, CFX_WideString& strChange, + const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit) { ASSERT(pPrivateData != NULL); @@ -864,8 +864,8 @@ void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, CPDFSDK_PageVi ASSERT(pPageView != NULL); // CReader_DocView* pDocView = pPageView->GetDocView(); // ASSERT(pDocView != NULL); - - + + PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); @@ -904,8 +904,8 @@ void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa ASSERT(pPageView != NULL); // CReader_DocView* pDocView = pPageView->GetDocView(); // ASSERT(pDocView != NULL); - - + + PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); @@ -1228,17 +1228,17 @@ void CFFL_IFormFiller::DoPaste(CPDFSDK_Document* pDocument) } void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, int32_t nKeyCode, - CFX_WideString & strChange, const CFX_WideString& strChangeEx, + CFX_WideString & strChange, const CFX_WideString& strChangeEx, int nSelStart, int nSelEnd, FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag) { ASSERT(pPrivateData != NULL); CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; ASSERT(pData->pWidget != NULL); - + CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); ASSERT(pFormFiller != NULL); - + if (pFormFiller->IsFieldFull(pData->pPageView)) { FX_BOOL bFullExit = FALSE; @@ -1251,7 +1251,7 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData return; } } - + if (!m_bNotifying) { if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) @@ -1262,7 +1262,7 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData ASSERT(pData->pPageView != NULL); CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument(); - + PDFSDK_FieldAction fa; fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); @@ -1277,7 +1277,7 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData pFormFiller->GetActionData(pData->pPageView, CPDF_AAction::KeyStroke, fa); pFormFiller->SaveState(pData->pPageView); - + if (pData->pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pData->pPageView)) { if (!IsValidAnnot(pData->pPageView, pData->pWidget)) @@ -1286,14 +1286,14 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData m_bNotifying = FALSE; return; } - + if (nAge != pData->pWidget->GetAppearanceAge()) { CPWL_Wnd* pWnd = pFormFiller->ResetPDFWindow(pData->pPageView, nValueAge == pData->pWidget->GetValueAge()); pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); bExit = TRUE; } - + if (fa.bRC) { pFormFiller->SetActionData(pData->pPageView, CPDF_AAction::KeyStroke, fa); @@ -1304,7 +1304,7 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData pFormFiller->RestoreState(pData->pPageView); bRC = FALSE; } - + if (pDocument->GetFocusAnnot() != pData->pWidget) { pFormFiller->CommitData(pData->pPageView,nFlag); @@ -1312,7 +1312,7 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData } } else - { + { if (!IsValidAnnot(pData->pPageView, pData->pWidget)) { bExit = TRUE; @@ -1320,21 +1320,21 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData return; } } - + m_bNotifying = FALSE; } } } -void CFFL_IFormFiller::OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_BOOL & bExit,FX_DWORD nFlag) +void CFFL_IFormFiller::OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_BOOL & bExit,FX_DWORD nFlag) { ASSERT(pPrivateData != NULL); CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; ASSERT(pData->pWidget != NULL); - + CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); ASSERT(pFormFiller != NULL); - + if (!bEditOrList) pFormFiller->OnKeyStroke(bExit); } diff --git a/fpdfsdk/src/formfiller/FFL_ListBox.cpp b/fpdfsdk/src/formfiller/FFL_ListBox.cpp index 6ee608a5bb..4622d4fcef 100644 --- a/fpdfsdk/src/formfiller/FFL_ListBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_ListBox.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/formfiller/FormFiller.h" @@ -39,9 +39,9 @@ PWL_CREATEPARAM CFFL_ListBox::GetCreateParam() ASSERT(m_pWidget != NULL); FX_DWORD dwFieldFlag = m_pWidget->GetFieldFlags(); - + if (dwFieldFlag & FIELDFLAG_MULTISELECT) - { + { cp.dwFlags |= PLBS_MULTIPLESEL; } @@ -76,7 +76,7 @@ CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView if (pWnd->HasFlag(PLBS_MULTIPLESEL)) { m_OriginSelections.RemoveAll(); - + FX_BOOL bSetCaret = FALSE; for (int32_t i=0,sz=m_pWidget->CountOptions(); i<sz; i++) { @@ -103,9 +103,9 @@ CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView } } } - + pWnd->SetTopVisibleIndex(m_pWidget->GetTopVisibleIndex()); - + return pWnd; } @@ -143,7 +143,7 @@ FX_BOOL CFFL_ListBox::IsDataChanged(CPDFSDK_PageView* pPageView) return pListBox->GetCurSel() != m_pWidget->GetSelectedIndex(0); } } - + return FALSE; } @@ -165,10 +165,10 @@ void CFFL_ListBox::SaveData(CPDFSDK_PageView* pPageView) } } - + int32_t nNewTopIndex = pListBox->GetTopVisibleIndex(); - m_pWidget->ClearSelection(FALSE); + m_pWidget->ClearSelection(FALSE); if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) { @@ -235,7 +235,7 @@ void CFFL_ListBox::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AAct } -void CFFL_ListBox::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, +void CFFL_ListBox::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, const PDFSDK_FieldAction& fa) { } @@ -269,11 +269,11 @@ CPWL_Wnd* CFFL_ListBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRes { if (bRestoreValue) SaveState(pPageView); - + DestroyPDFWindow(pPageView); - + CPWL_Wnd* pRet = NULL; - + if (bRestoreValue) { RestoreState(pPageView); @@ -281,9 +281,9 @@ CPWL_Wnd* CFFL_ListBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRes } else pRet = GetPDFWindow(pPageView, TRUE); - + m_pWidget->UpdateField(); - + return pRet; } @@ -292,7 +292,7 @@ void CFFL_ListBox::OnKeyStroke(FX_BOOL bKeyDown, FX_DWORD nFlag) ASSERT(m_pWidget != NULL); int nFlags = m_pWidget->GetFieldFlags(); - + if (nFlags & FIELDFLAG_COMMITONSELCHANGE) { if (m_bValid) diff --git a/fpdfsdk/src/formfiller/FFL_Notify.cpp b/fpdfsdk/src/formfiller/FFL_Notify.cpp index 4fd2bd84ea..58a2202b61 100644 --- a/fpdfsdk/src/formfiller/FFL_Notify.cpp +++ b/fpdfsdk/src/formfiller/FFL_Notify.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com // #include "../../include/formfiller/FormFiller.h" @@ -14,7 +14,7 @@ //#pragma warning(disable: 4800) -CFFL_Notify::CFFL_Notify(CFFL_FormFiller * pFormFiller) : +CFFL_Notify::CFFL_Notify(CFFL_FormFiller * pFormFiller) : m_bDoActioning(FALSE), m_nNotifyFlag(0) { @@ -94,15 +94,15 @@ FX_BOOL CFFL_Notify::OnFormat(int iCommitKey) return TRUE; } -FX_BOOL CFFL_Notify::OnKeyStroke(CPDF_FormField* pFormField, int nCommitKey, CFX_WideString& strValue, CFX_WideString& strChange, +FX_BOOL CFFL_Notify::OnKeyStroke(CPDF_FormField* pFormField, int nCommitKey, CFX_WideString& strValue, CFX_WideString& strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier, - FX_BOOL bShift, FX_BOOL bWillCommit, FX_BOOL bFieldFull, + FX_BOOL bShift, FX_BOOL bWillCommit, FX_BOOL bFieldFull, int& nSelStart, int& nSelEnd, FX_BOOL& bRC) { return TRUE; } -FX_BOOL CFFL_Notify::OnValidate(CPDF_FormField* pFormField, CFX_WideString& strValue, CFX_WideString & strChange, +FX_BOOL CFFL_Notify::OnValidate(CPDF_FormField* pFormField, CFX_WideString& strValue, CFX_WideString & strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier, FX_BOOL bShift, FX_BOOL & bRC) { diff --git a/fpdfsdk/src/formfiller/FFL_PushButton.cpp b/fpdfsdk/src/formfiller/FFL_PushButton.cpp index b8a07fb548..a5df48840c 100644 --- a/fpdfsdk/src/formfiller/FFL_PushButton.cpp +++ b/fpdfsdk/src/formfiller/FFL_PushButton.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/formfiller/FormFiller.h" @@ -23,7 +23,7 @@ CPWL_Wnd* CFFL_PushButton::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageV { CPWL_PushButton* pWnd = new CPWL_PushButton(); pWnd->Create(cp); - + return pWnd; } @@ -33,7 +33,7 @@ FX_BOOL CFFL_PushButton::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nF return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); } -void CFFL_PushButton::OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, +void CFFL_PushButton::OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, FX_DWORD dwFlags) { diff --git a/fpdfsdk/src/formfiller/FFL_RadioButton.cpp b/fpdfsdk/src/formfiller/FFL_RadioButton.cpp index 708d6df090..1f73e8ccaa 100644 --- a/fpdfsdk/src/formfiller/FFL_RadioButton.cpp +++ b/fpdfsdk/src/formfiller/FFL_RadioButton.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/formfiller/FormFiller.h" @@ -27,7 +27,7 @@ CPWL_Wnd* CFFL_RadioButton::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_Page ASSERT(m_pWidget != NULL); pWnd->SetCheck(m_pWidget->IsChecked()); - + return pWnd; } @@ -47,7 +47,7 @@ FX_BOOL CFFL_RadioButton::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT n { switch (nChar) { - case FWL_VKEY_Return: + case FWL_VKEY_Return: case FWL_VKEY_Space: { CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); @@ -109,7 +109,7 @@ void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView) if (CPWL_RadioButton* pWnd = (CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE)) { - + FX_BOOL bNewChecked = pWnd->IsChecked(); if (bNewChecked) diff --git a/fpdfsdk/src/formfiller/FFL_TextField.cpp b/fpdfsdk/src/formfiller/FFL_TextField.cpp index 9f0a8148cf..83c7f35ba9 100644 --- a/fpdfsdk/src/formfiller/FFL_TextField.cpp +++ b/fpdfsdk/src/formfiller/FFL_TextField.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/formfiller/FFL_TextField.h" @@ -36,16 +36,16 @@ PWL_CREATEPARAM CFFL_TextField::GetCreateParam() if (nFlags & FIELDFLAG_PASSWORD) - { + { cp.dwFlags |= PES_PASSWORD; } if (!(nFlags & FIELDFLAG_DONOTSPELLCHECK)) - { + { } if (nFlags & FIELDFLAG_MULTILINE) - { + { cp.dwFlags |= PES_MULTILINE | PES_AUTORETURN | PES_TOP; if (!(nFlags & FIELDFLAG_DONOTSCROLL)) @@ -64,17 +64,17 @@ PWL_CREATEPARAM CFFL_TextField::GetCreateParam() } if (nFlags & FIELDFLAG_COMB) - { + { cp.dwFlags |= PES_CHARARRAY; } if (nFlags & FIELDFLAG_RICHTEXT) - { + { cp.dwFlags |= PES_RICH; } cp.dwFlags |= PES_UNDO; - + switch (m_pWidget->GetAlignment()) { default: @@ -115,7 +115,7 @@ CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageVi ASSERT(m_pWidget != NULL); int32_t nMaxLen = m_pWidget->GetMaxLen(); CFX_WideString swValue = m_pWidget->GetValue(); - + if (nMaxLen > 0) { if (pWnd->HasFlag(PES_CHARARRAY)) @@ -146,7 +146,7 @@ FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFl m_bValid = !m_bValid; CPDF_Rect rcAnnot = pAnnot->GetRect(); m_pApp->FFI_Invalidate(pAnnot->GetPDFXFAPage(), rcAnnot.left, rcAnnot.top, rcAnnot.right, rcAnnot.bottom); - + if (m_bValid) { if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) @@ -197,7 +197,7 @@ void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView) CFX_WideString sOldValue = m_pWidget->GetValue(); CFX_WideString sNewValue = pWnd->GetText(); - m_pWidget->SetValue(sNewValue, FALSE); + m_pWidget->SetValue(sNewValue, FALSE); m_pWidget->ResetFieldAppearance(TRUE); m_pWidget->UpdateField(); SetChangeMark(); @@ -212,10 +212,10 @@ void CFFL_TextField::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AA case CPDF_AAction::KeyStroke: if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) { - fa.bFieldFull = pWnd->IsTextFull(); + fa.bFieldFull = pWnd->IsTextFull(); fa.sValue = pWnd->GetText(); - + if (fa.bFieldFull) { fa.sChange = L""; @@ -239,7 +239,7 @@ void CFFL_TextField::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AA } } -void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, +void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, const PDFSDK_FieldAction& fa) { switch (type) @@ -258,7 +258,7 @@ void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AA } -FX_BOOL CFFL_TextField::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, +FX_BOOL CFFL_TextField::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, const PDFSDK_FieldAction& faNew) { switch (type) @@ -313,7 +313,7 @@ CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bR pRet = GetPDFWindow(pPageView, TRUE); m_pWidget->UpdateField(); - + return pRet; } @@ -321,7 +321,7 @@ FX_BOOL CFFL_TextField::IsFieldFull(CPDFSDK_PageView* pPageView) { if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) { - return pWnd->IsTextFull(); + return pWnd->IsTextFull(); } return FALSE; @@ -330,22 +330,22 @@ FX_BOOL CFFL_TextField::IsFieldFull(CPDFSDK_PageView* pPageView) void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) { ASSERT(m_pApp != NULL); - + ASSERT(pWnd != NULL); - + if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) { CPWL_Edit* pEdit = (CPWL_Edit*)pWnd; pEdit->SetCharSet(134); pEdit->SetCodePage(936); - + pEdit->SetReadyToInput(); CFX_WideString wsText = pEdit->GetText(); int nCharacters = wsText.GetLength(); CFX_ByteString bsUTFText = wsText.UTF16LE_Encode(); unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str(); m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, nCharacters, TRUE); - + pEdit->SetEditNotify(this); //pUndo->BeginEdit(pDocument); } diff --git a/fpdfsdk/src/formfiller/FFL_Utils.cpp b/fpdfsdk/src/formfiller/FFL_Utils.cpp index 2f988b2f0b..8d2d76d73c 100644 --- a/fpdfsdk/src/formfiller/FFL_Utils.cpp +++ b/fpdfsdk/src/formfiller/FFL_Utils.cpp @@ -1,7 +1,7 @@ // Copyright 2014 PDFium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - + // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include <algorithm> @@ -53,7 +53,7 @@ FX_BOOL CFFL_Utils::TraceObject(CPDF_Object* pObj) CPDF_Array* pArray = (CPDF_Array*)pObj; for (FX_DWORD i = 0; i < pArray->GetCount(); i ++) { - CPDF_Object* pElement = pArray->GetElementValue(i); + CPDF_Object* pElement = pArray->GetElementValue(i); TraceObject(pElement); } } |