diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-07-16 11:09:12 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-07-16 11:09:12 -0700 |
commit | fb07e2843dad0774d5842c2b08e7792164efc14a (patch) | |
tree | 4583acca1bdcf5b60fad79af0b9fa405f192c5d8 /fpdfsdk/src/formfiller/FFL_IFormFiller.cpp | |
parent | cc8b4d8763151f51c9fe71ce9b64b2a0d7ddcc88 (diff) | |
download | pdfium-fb07e2843dad0774d5842c2b08e7792164efc14a.tar.xz |
Tidy up CPDFDOC_Environment.
- untabify as encountered.
- Only put single-statement method in .h file, move more
complex methods to .cpp (counting an if without braces as
a single statement, killing braces as needed).
- Move invariant arguments to constructor and make
corresponding members const.
- Make all members private and add accessor methods.
- Make existing accessor methods const where possible.
- Kill meaningless asserts.
- Add helper functions in place of duplicate code.
- Rename GetCurrentDoc() to GetSDKDocument(), since the class
has two document members, one of CPDF_Document and one of
CPDFSDK_Document, making it clear which one you get.
- Simplify some logic with early returns.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1235393002 .
Diffstat (limited to 'fpdfsdk/src/formfiller/FFL_IFormFiller.cpp')
-rw-r--r-- | fpdfsdk/src/formfiller/FFL_IFormFiller.cpp | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp index 078dd13c00..cd4b45b062 100644 --- a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp +++ b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp @@ -81,20 +81,15 @@ 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); - + CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); if (pDocument->GetFocusAnnot() == pAnnot) { CPDF_Rect rcFocus = pFormFiller->GetFocusBox(pPageView); 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); @@ -106,14 +101,10 @@ void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_ gsd.SetDashCount(1); gsd.m_DashArray[0] = 1.0f; 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); } } - return; } } @@ -124,10 +115,7 @@ void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget)) - { pWidget->DrawShadow(pDevice, pPageView); - } - } } @@ -292,14 +280,9 @@ FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) { - 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); + CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); switch (pWidget->GetFieldType()) { @@ -307,9 +290,7 @@ FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot case FIELDTYPE_CHECKBOX: case FIELDTYPE_RADIOBUTTON: if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)point.y)) - { pDocument->SetFocusAnnot(pAnnot); - } break; default: pDocument->SetFocusAnnot(pAnnot); |