| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" | 7 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" |
| 8 | 8 |
| 9 #include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h" | 9 #include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h" |
| 10 #include "fpdfsdk/include/fsdk_common.h" | 10 #include "fpdfsdk/include/fsdk_common.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 CFFL_PrivateData* pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); | 29 CFFL_PrivateData* pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); |
| 30 pWnd->InvalidateProvider(this); | 30 pWnd->InvalidateProvider(this); |
| 31 pWnd->Destroy(); | 31 pWnd->Destroy(); |
| 32 delete pWnd; | 32 delete pWnd; |
| 33 delete pData; | 33 delete pData; |
| 34 } | 34 } |
| 35 m_Maps.clear(); | 35 m_Maps.clear(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void CFFL_FormFiller::SetWindowRect(CPDFSDK_PageView* pPageView, | 38 void CFFL_FormFiller::SetWindowRect(CPDFSDK_PageView* pPageView, |
| 39 const CFX_FloatRect& rcWindow) { | 39 const CPDF_Rect& rcWindow) { |
| 40 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { | 40 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
| 41 pWnd->Move(CFX_FloatRect(rcWindow), TRUE, FALSE); | 41 pWnd->Move(CPDF_Rect(rcWindow), TRUE, FALSE); |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 CFX_FloatRect CFFL_FormFiller::GetWindowRect(CPDFSDK_PageView* pPageView) { | 45 CPDF_Rect CFFL_FormFiller::GetWindowRect(CPDFSDK_PageView* pPageView) { |
| 46 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { | 46 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
| 47 return pWnd->GetWindowRect(); | 47 return pWnd->GetWindowRect(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 return CFX_FloatRect(0, 0, 0, 0); | 50 return CPDF_Rect(0, 0, 0, 0); |
| 51 } | 51 } |
| 52 | 52 |
| 53 FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, | 53 FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, |
| 54 CPDFSDK_Annot* pAnnot) { | 54 CPDFSDK_Annot* pAnnot) { |
| 55 ASSERT(pPageView); | 55 ASSERT(pPageView); |
| 56 ASSERT(pAnnot); | 56 ASSERT(pAnnot); |
| 57 | 57 |
| 58 CFX_FloatRect rcAnnot = m_pWidget->GetRect(); | 58 CPDF_Rect rcAnnot = m_pWidget->GetRect(); |
| 59 | 59 |
| 60 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { | 60 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
| 61 CFX_FloatRect rcWindow = pWnd->GetWindowRect(); | 61 CPDF_Rect rcWindow = pWnd->GetWindowRect(); |
| 62 rcAnnot = PWLtoFFL(rcWindow); | 62 rcAnnot = PWLtoFFL(rcWindow); |
| 63 } | 63 } |
| 64 | 64 |
| 65 CFX_FloatRect rcWin = rcAnnot; | 65 CPDF_Rect rcWin = rcAnnot; |
| 66 | 66 |
| 67 CFX_FloatRect rcFocus = GetFocusBox(pPageView); | 67 CPDF_Rect rcFocus = GetFocusBox(pPageView); |
| 68 if (!rcFocus.IsEmpty()) | 68 if (!rcFocus.IsEmpty()) |
| 69 rcWin.Union(rcFocus); | 69 rcWin.Union(rcFocus); |
| 70 | 70 |
| 71 CFX_FloatRect rect = CPWL_Utils::InflateRect(rcWin, 1); | 71 CPDF_Rect rect = CPWL_Utils::InflateRect(rcWin, 1); |
| 72 | 72 |
| 73 return rect.GetOutterRect(); | 73 return rect.GetOutterRect(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void CFFL_FormFiller::OnDraw(CPDFSDK_PageView* pPageView, | 76 void CFFL_FormFiller::OnDraw(CPDFSDK_PageView* pPageView, |
| 77 CPDFSDK_Annot* pAnnot, | 77 CPDFSDK_Annot* pAnnot, |
| 78 CFX_RenderDevice* pDevice, | 78 CFX_RenderDevice* pDevice, |
| 79 CFX_Matrix* pUser2Device, | 79 CFX_Matrix* pUser2Device, |
| 80 FX_DWORD dwFlags) { | 80 FX_DWORD dwFlags) { |
| 81 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 81 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 111 | 111 |
| 112 void CFFL_FormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, | 112 void CFFL_FormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, |
| 113 CPDFSDK_Annot* pAnnot) { | 113 CPDFSDK_Annot* pAnnot) { |
| 114 EndTimer(); | 114 EndTimer(); |
| 115 ASSERT(m_pWidget); | 115 ASSERT(m_pWidget); |
| 116 } | 116 } |
| 117 | 117 |
| 118 FX_BOOL CFFL_FormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, | 118 FX_BOOL CFFL_FormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, |
| 119 CPDFSDK_Annot* pAnnot, | 119 CPDFSDK_Annot* pAnnot, |
| 120 FX_UINT nFlags, | 120 FX_UINT nFlags, |
| 121 const CFX_FloatPoint& point) { | 121 const CPDF_Point& point) { |
| 122 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) { | 122 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) { |
| 123 m_bValid = TRUE; | 123 m_bValid = TRUE; |
| 124 FX_RECT rect = GetViewBBox(pPageView, pAnnot); | 124 FX_RECT rect = GetViewBBox(pPageView, pAnnot); |
| 125 InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); | 125 InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); |
| 126 | 126 |
| 127 if (!rect.Contains((int)point.x, (int)point.y)) | 127 if (!rect.Contains((int)point.x, (int)point.y)) |
| 128 return FALSE; | 128 return FALSE; |
| 129 | 129 |
| 130 return pWnd->OnLButtonDown(WndtoPWL(pPageView, point), nFlags); | 130 return pWnd->OnLButtonDown(WndtoPWL(pPageView, point), nFlags); |
| 131 } | 131 } |
| 132 | 132 |
| 133 return FALSE; | 133 return FALSE; |
| 134 } | 134 } |
| 135 | 135 |
| 136 FX_BOOL CFFL_FormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, | 136 FX_BOOL CFFL_FormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, |
| 137 CPDFSDK_Annot* pAnnot, | 137 CPDFSDK_Annot* pAnnot, |
| 138 FX_UINT nFlags, | 138 FX_UINT nFlags, |
| 139 const CFX_FloatPoint& point) { | 139 const CPDF_Point& point) { |
| 140 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { | 140 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
| 141 FX_RECT rcFFL = GetViewBBox(pPageView, pAnnot); | 141 FX_RECT rcFFL = GetViewBBox(pPageView, pAnnot); |
| 142 InvalidateRect(rcFFL.left, rcFFL.top, rcFFL.right, rcFFL.bottom); | 142 InvalidateRect(rcFFL.left, rcFFL.top, rcFFL.right, rcFFL.bottom); |
| 143 pWnd->OnLButtonUp(WndtoPWL(pPageView, point), nFlags); | 143 pWnd->OnLButtonUp(WndtoPWL(pPageView, point), nFlags); |
| 144 return TRUE; | 144 return TRUE; |
| 145 } | 145 } |
| 146 | 146 |
| 147 return FALSE; | 147 return FALSE; |
| 148 } | 148 } |
| 149 | 149 |
| 150 FX_BOOL CFFL_FormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, | 150 FX_BOOL CFFL_FormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
| 151 CPDFSDK_Annot* pAnnot, | 151 CPDFSDK_Annot* pAnnot, |
| 152 FX_UINT nFlags, | 152 FX_UINT nFlags, |
| 153 const CFX_FloatPoint& point) { | 153 const CPDF_Point& point) { |
| 154 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { | 154 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
| 155 pWnd->OnLButtonDblClk(WndtoPWL(pPageView, point), nFlags); | 155 pWnd->OnLButtonDblClk(WndtoPWL(pPageView, point), nFlags); |
| 156 return TRUE; | 156 return TRUE; |
| 157 } | 157 } |
| 158 | 158 |
| 159 return FALSE; | 159 return FALSE; |
| 160 } | 160 } |
| 161 | 161 |
| 162 FX_BOOL CFFL_FormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, | 162 FX_BOOL CFFL_FormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, |
| 163 CPDFSDK_Annot* pAnnot, | 163 CPDFSDK_Annot* pAnnot, |
| 164 FX_UINT nFlags, | 164 FX_UINT nFlags, |
| 165 const CFX_FloatPoint& point) { | 165 const CPDF_Point& point) { |
| 166 if ((m_ptOldPos.x != point.x) || (m_ptOldPos.y != point.y)) { | 166 if ((m_ptOldPos.x != point.x) || (m_ptOldPos.y != point.y)) { |
| 167 m_ptOldPos = point; | 167 m_ptOldPos = point; |
| 168 } | 168 } |
| 169 | 169 |
| 170 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { | 170 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
| 171 pWnd->OnMouseMove(WndtoPWL(pPageView, point), nFlags); | 171 pWnd->OnMouseMove(WndtoPWL(pPageView, point), nFlags); |
| 172 return TRUE; | 172 return TRUE; |
| 173 } | 173 } |
| 174 | 174 |
| 175 return FALSE; | 175 return FALSE; |
| 176 } | 176 } |
| 177 | 177 |
| 178 FX_BOOL CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, | 178 FX_BOOL CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, |
| 179 CPDFSDK_Annot* pAnnot, | 179 CPDFSDK_Annot* pAnnot, |
| 180 FX_UINT nFlags, | 180 FX_UINT nFlags, |
| 181 short zDelta, | 181 short zDelta, |
| 182 const CFX_FloatPoint& point) { | 182 const CPDF_Point& point) { |
| 183 if (!IsValid()) | 183 if (!IsValid()) |
| 184 return FALSE; | 184 return FALSE; |
| 185 | 185 |
| 186 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) { | 186 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) { |
| 187 return pWnd->OnMouseWheel(zDelta, WndtoPWL(pPageView, point), nFlags); | 187 return pWnd->OnMouseWheel(zDelta, WndtoPWL(pPageView, point), nFlags); |
| 188 } | 188 } |
| 189 | 189 |
| 190 return FALSE; | 190 return FALSE; |
| 191 } | 191 } |
| 192 | 192 |
| 193 FX_BOOL CFFL_FormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, | 193 FX_BOOL CFFL_FormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, |
| 194 CPDFSDK_Annot* pAnnot, | 194 CPDFSDK_Annot* pAnnot, |
| 195 FX_UINT nFlags, | 195 FX_UINT nFlags, |
| 196 const CFX_FloatPoint& point) { | 196 const CPDF_Point& point) { |
| 197 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) { | 197 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) { |
| 198 pWnd->OnRButtonDown(WndtoPWL(pPageView, point), nFlags); | 198 pWnd->OnRButtonDown(WndtoPWL(pPageView, point), nFlags); |
| 199 return TRUE; | 199 return TRUE; |
| 200 } | 200 } |
| 201 | 201 |
| 202 return FALSE; | 202 return FALSE; |
| 203 } | 203 } |
| 204 | 204 |
| 205 FX_BOOL CFFL_FormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, | 205 FX_BOOL CFFL_FormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, |
| 206 CPDFSDK_Annot* pAnnot, | 206 CPDFSDK_Annot* pAnnot, |
| 207 FX_UINT nFlags, | 207 FX_UINT nFlags, |
| 208 const CFX_FloatPoint& point) { | 208 const CPDF_Point& point) { |
| 209 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { | 209 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
| 210 pWnd->OnRButtonUp(WndtoPWL(pPageView, point), nFlags); | 210 pWnd->OnRButtonUp(WndtoPWL(pPageView, point), nFlags); |
| 211 return TRUE; | 211 return TRUE; |
| 212 } | 212 } |
| 213 | 213 |
| 214 return FALSE; | 214 return FALSE; |
| 215 } | 215 } |
| 216 | 216 |
| 217 FX_BOOL CFFL_FormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, | 217 FX_BOOL CFFL_FormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, |
| 218 FX_UINT nKeyCode, | 218 FX_UINT nKeyCode, |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 413 |
| 414 return mt; | 414 return mt; |
| 415 } | 415 } |
| 416 } | 416 } |
| 417 return CFX_Matrix(1, 0, 0, 1, 0, 0); | 417 return CFX_Matrix(1, 0, 0, 1, 0, 0); |
| 418 } | 418 } |
| 419 | 419 |
| 420 CFX_Matrix CFFL_FormFiller::GetCurMatrix() { | 420 CFX_Matrix CFFL_FormFiller::GetCurMatrix() { |
| 421 CFX_Matrix mt; | 421 CFX_Matrix mt; |
| 422 | 422 |
| 423 CFX_FloatRect rcDA; | 423 CPDF_Rect rcDA; |
| 424 m_pWidget->GetPDFAnnot()->GetRect(rcDA); | 424 m_pWidget->GetPDFAnnot()->GetRect(rcDA); |
| 425 | 425 |
| 426 switch (m_pWidget->GetRotate()) { | 426 switch (m_pWidget->GetRotate()) { |
| 427 default: | 427 default: |
| 428 case 0: | 428 case 0: |
| 429 mt = CFX_Matrix(1, 0, 0, 1, 0, 0); | 429 mt = CFX_Matrix(1, 0, 0, 1, 0, 0); |
| 430 break; | 430 break; |
| 431 case 90: | 431 case 90: |
| 432 mt = CFX_Matrix(0, 1, -1, 0, rcDA.right - rcDA.left, 0); | 432 mt = CFX_Matrix(0, 1, -1, 0, rcDA.right - rcDA.left, 0); |
| 433 break; | 433 break; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 444 | 444 |
| 445 return mt; | 445 return mt; |
| 446 } | 446 } |
| 447 | 447 |
| 448 CFX_WideString CFFL_FormFiller::LoadPopupMenuString(int nIndex) { | 448 CFX_WideString CFFL_FormFiller::LoadPopupMenuString(int nIndex) { |
| 449 ASSERT(m_pApp); | 449 ASSERT(m_pApp); |
| 450 | 450 |
| 451 return L""; | 451 return L""; |
| 452 } | 452 } |
| 453 | 453 |
| 454 CFX_FloatRect CFFL_FormFiller::GetPDFWindowRect() const { | 454 CPDF_Rect CFFL_FormFiller::GetPDFWindowRect() const { |
| 455 CFX_FloatRect rectAnnot; | 455 CPDF_Rect rectAnnot; |
| 456 m_pWidget->GetPDFAnnot()->GetRect(rectAnnot); | 456 m_pWidget->GetPDFAnnot()->GetRect(rectAnnot); |
| 457 | 457 |
| 458 FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left; | 458 FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left; |
| 459 FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom; | 459 FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom; |
| 460 if ((m_pWidget->GetRotate() / 90) & 0x01) | 460 if ((m_pWidget->GetRotate() / 90) & 0x01) |
| 461 return CFX_FloatRect(0, 0, fHeight, fWidth); | 461 return CPDF_Rect(0, 0, fHeight, fWidth); |
| 462 | 462 |
| 463 return CFX_FloatRect(0, 0, fWidth, fHeight); | 463 return CPDF_Rect(0, 0, fWidth, fHeight); |
| 464 } | 464 } |
| 465 | 465 |
| 466 CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView() { | 466 CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView() { |
| 467 UnderlyingPageType* pPage = m_pAnnot->GetUnderlyingPage(); | 467 UnderlyingPageType* pPage = m_pAnnot->GetUnderlyingPage(); |
| 468 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); | 468 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); |
| 469 return pSDKDoc ? pSDKDoc->GetPageView(pPage) : nullptr; | 469 return pSDKDoc ? pSDKDoc->GetPageView(pPage) : nullptr; |
| 470 } | 470 } |
| 471 | 471 |
| 472 CFX_FloatRect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) { | 472 CPDF_Rect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) { |
| 473 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { | 473 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
| 474 CFX_FloatRect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocusRect())); | 474 CPDF_Rect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocusRect())); |
| 475 CFX_FloatRect rcPage = pPageView->GetPDFPage()->GetPageBBox(); | 475 CPDF_Rect rcPage = pPageView->GetPDFPage()->GetPageBBox(); |
| 476 if (rcPage.Contains(rcFocus)) | 476 if (rcPage.Contains(rcFocus)) |
| 477 return rcFocus; | 477 return rcFocus; |
| 478 } | 478 } |
| 479 return CFX_FloatRect(0, 0, 0, 0); | 479 return CPDF_Rect(0, 0, 0, 0); |
| 480 } | 480 } |
| 481 | 481 |
| 482 CFX_FloatRect CFFL_FormFiller::FFLtoPWL(const CFX_FloatRect& rect) { | 482 CPDF_Rect CFFL_FormFiller::FFLtoPWL(const CPDF_Rect& rect) { |
| 483 CFX_Matrix mt; | 483 CFX_Matrix mt; |
| 484 mt.SetReverse(GetCurMatrix()); | 484 mt.SetReverse(GetCurMatrix()); |
| 485 | 485 |
| 486 CFX_FloatRect temp = rect; | 486 CPDF_Rect temp = rect; |
| 487 mt.TransformRect(temp); | 487 mt.TransformRect(temp); |
| 488 | 488 |
| 489 return temp; | 489 return temp; |
| 490 } | 490 } |
| 491 | 491 |
| 492 CFX_FloatRect CFFL_FormFiller::PWLtoFFL(const CFX_FloatRect& rect) { | 492 CPDF_Rect CFFL_FormFiller::PWLtoFFL(const CPDF_Rect& rect) { |
| 493 CFX_Matrix mt = GetCurMatrix(); | 493 CFX_Matrix mt = GetCurMatrix(); |
| 494 | 494 |
| 495 CFX_FloatRect temp = rect; | 495 CPDF_Rect temp = rect; |
| 496 mt.TransformRect(temp); | 496 mt.TransformRect(temp); |
| 497 | 497 |
| 498 return temp; | 498 return temp; |
| 499 } | 499 } |
| 500 | 500 |
| 501 CFX_FloatPoint CFFL_FormFiller::FFLtoPWL(const CFX_FloatPoint& point) { | 501 CPDF_Point CFFL_FormFiller::FFLtoPWL(const CPDF_Point& point) { |
| 502 CFX_Matrix mt; | 502 CFX_Matrix mt; |
| 503 mt.SetReverse(GetCurMatrix()); | 503 mt.SetReverse(GetCurMatrix()); |
| 504 | 504 |
| 505 CFX_FloatPoint pt = point; | 505 CPDF_Point pt = point; |
| 506 mt.Transform(pt.x, pt.y); | 506 mt.Transform(pt.x, pt.y); |
| 507 | 507 |
| 508 return pt; | 508 return pt; |
| 509 } | 509 } |
| 510 | 510 |
| 511 CFX_FloatPoint CFFL_FormFiller::PWLtoFFL(const CFX_FloatPoint& point) { | 511 CPDF_Point CFFL_FormFiller::PWLtoFFL(const CPDF_Point& point) { |
| 512 CFX_Matrix mt = GetCurMatrix(); | 512 CFX_Matrix mt = GetCurMatrix(); |
| 513 | 513 |
| 514 CFX_FloatPoint pt = point; | 514 CPDF_Point pt = point; |
| 515 mt.Transform(pt.x, pt.y); | 515 mt.Transform(pt.x, pt.y); |
| 516 | 516 |
| 517 return pt; | 517 return pt; |
| 518 } | 518 } |
| 519 | 519 |
| 520 CFX_FloatPoint CFFL_FormFiller::WndtoPWL(CPDFSDK_PageView* pPageView, | 520 CPDF_Point CFFL_FormFiller::WndtoPWL(CPDFSDK_PageView* pPageView, |
| 521 const CFX_FloatPoint& pt) { | 521 const CPDF_Point& pt) { |
| 522 return FFLtoPWL(pt); | 522 return FFLtoPWL(pt); |
| 523 } | 523 } |
| 524 | 524 |
| 525 CFX_FloatRect CFFL_FormFiller::FFLtoWnd(CPDFSDK_PageView* pPageView, | 525 CPDF_Rect CFFL_FormFiller::FFLtoWnd(CPDFSDK_PageView* pPageView, |
| 526 const CFX_FloatRect& rect) { | 526 const CPDF_Rect& rect) { |
| 527 return rect; | 527 return rect; |
| 528 } | 528 } |
| 529 | 529 |
| 530 FX_BOOL CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, | 530 FX_BOOL CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, |
| 531 FX_UINT nFlag) { | 531 FX_UINT nFlag) { |
| 532 if (IsDataChanged(pPageView)) { | 532 if (IsDataChanged(pPageView)) { |
| 533 FX_BOOL bRC = TRUE; | 533 FX_BOOL bRC = TRUE; |
| 534 FX_BOOL bExit = FALSE; | 534 FX_BOOL bExit = FALSE; |
| 535 CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); | 535 CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); |
| 536 pIFormFiller->OnKeyStrokeCommit(m_pWidget, pPageView, bRC, bExit, nFlag); | 536 pIFormFiller->OnKeyStrokeCommit(m_pWidget, pPageView, bRC, bExit, nFlag); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 | 643 |
| 644 FX_RECT rect = GetViewBBox(pPageView, pAnnot); | 644 FX_RECT rect = GetViewBBox(pPageView, pAnnot); |
| 645 InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); | 645 InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); |
| 646 EndTimer(); | 646 EndTimer(); |
| 647 ASSERT(m_pWidget); | 647 ASSERT(m_pWidget); |
| 648 } | 648 } |
| 649 | 649 |
| 650 FX_BOOL CFFL_Button::OnLButtonDown(CPDFSDK_PageView* pPageView, | 650 FX_BOOL CFFL_Button::OnLButtonDown(CPDFSDK_PageView* pPageView, |
| 651 CPDFSDK_Annot* pAnnot, | 651 CPDFSDK_Annot* pAnnot, |
| 652 FX_UINT nFlags, | 652 FX_UINT nFlags, |
| 653 const CFX_FloatPoint& point) { | 653 const CPDF_Point& point) { |
| 654 CFX_FloatRect rcAnnot = pAnnot->GetRect(); | 654 CPDF_Rect rcAnnot = pAnnot->GetRect(); |
| 655 if (!rcAnnot.Contains(point.x, point.y)) | 655 if (!rcAnnot.Contains(point.x, point.y)) |
| 656 return FALSE; | 656 return FALSE; |
| 657 | 657 |
| 658 m_bMouseDown = TRUE; | 658 m_bMouseDown = TRUE; |
| 659 m_bValid = TRUE; | 659 m_bValid = TRUE; |
| 660 FX_RECT rect = GetViewBBox(pPageView, pAnnot); | 660 FX_RECT rect = GetViewBBox(pPageView, pAnnot); |
| 661 InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); | 661 InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); |
| 662 return TRUE; | 662 return TRUE; |
| 663 } | 663 } |
| 664 | 664 |
| 665 FX_BOOL CFFL_Button::OnLButtonUp(CPDFSDK_PageView* pPageView, | 665 FX_BOOL CFFL_Button::OnLButtonUp(CPDFSDK_PageView* pPageView, |
| 666 CPDFSDK_Annot* pAnnot, | 666 CPDFSDK_Annot* pAnnot, |
| 667 FX_UINT nFlags, | 667 FX_UINT nFlags, |
| 668 const CFX_FloatPoint& point) { | 668 const CPDF_Point& point) { |
| 669 CFX_FloatRect rcAnnot = pAnnot->GetRect(); | 669 CPDF_Rect rcAnnot = pAnnot->GetRect(); |
| 670 if (!rcAnnot.Contains(point.x, point.y)) | 670 if (!rcAnnot.Contains(point.x, point.y)) |
| 671 return FALSE; | 671 return FALSE; |
| 672 | 672 |
| 673 m_bMouseDown = FALSE; | 673 m_bMouseDown = FALSE; |
| 674 m_pWidget->GetPDFPage(); | 674 m_pWidget->GetPDFPage(); |
| 675 | 675 |
| 676 FX_RECT rect = GetViewBBox(pPageView, pAnnot); | 676 FX_RECT rect = GetViewBBox(pPageView, pAnnot); |
| 677 InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); | 677 InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); |
| 678 return TRUE; | 678 return TRUE; |
| 679 } | 679 } |
| 680 | 680 |
| 681 FX_BOOL CFFL_Button::OnMouseMove(CPDFSDK_PageView* pPageView, | 681 FX_BOOL CFFL_Button::OnMouseMove(CPDFSDK_PageView* pPageView, |
| 682 CPDFSDK_Annot* pAnnot, | 682 CPDFSDK_Annot* pAnnot, |
| 683 FX_UINT nFlags, | 683 FX_UINT nFlags, |
| 684 const CFX_FloatPoint& point) { | 684 const CPDF_Point& point) { |
| 685 ASSERT(m_pApp); | 685 ASSERT(m_pApp); |
| 686 | 686 |
| 687 return TRUE; | 687 return TRUE; |
| 688 } | 688 } |
| 689 | 689 |
| 690 void CFFL_Button::OnDraw(CPDFSDK_PageView* pPageView, | 690 void CFFL_Button::OnDraw(CPDFSDK_PageView* pPageView, |
| 691 CPDFSDK_Annot* pAnnot, | 691 CPDFSDK_Annot* pAnnot, |
| 692 CFX_RenderDevice* pDevice, | 692 CFX_RenderDevice* pDevice, |
| 693 CFX_Matrix* pUser2Device, | 693 CFX_Matrix* pUser2Device, |
| 694 FX_DWORD dwFlags) { | 694 FX_DWORD dwFlags) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 718 } | 718 } |
| 719 } | 719 } |
| 720 | 720 |
| 721 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, | 721 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, |
| 722 CPDFSDK_Annot* pAnnot, | 722 CPDFSDK_Annot* pAnnot, |
| 723 CFX_RenderDevice* pDevice, | 723 CFX_RenderDevice* pDevice, |
| 724 CFX_Matrix* pUser2Device, | 724 CFX_Matrix* pUser2Device, |
| 725 FX_DWORD dwFlags) { | 725 FX_DWORD dwFlags) { |
| 726 OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); | 726 OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); |
| 727 } | 727 } |
| OLD | NEW |