summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/formfiller
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-07-16 11:09:12 -0700
committerTom Sepez <tsepez@chromium.org>2015-07-16 11:09:12 -0700
commitfb07e2843dad0774d5842c2b08e7792164efc14a (patch)
tree4583acca1bdcf5b60fad79af0b9fa405f192c5d8 /fpdfsdk/src/formfiller
parentcc8b4d8763151f51c9fe71ce9b64b2a0d7ddcc88 (diff)
downloadpdfium-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')
-rw-r--r--fpdfsdk/src/formfiller/FFL_FormFiller.cpp895
-rw-r--r--fpdfsdk/src/formfiller/FFL_IFormFiller.cpp23
2 files changed, 419 insertions, 499 deletions
diff --git a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp
index 1b152d7b4b..c6cae08781 100644
--- a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp
+++ b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp
@@ -9,21 +9,21 @@
#include "../../include/formfiller/FFL_Notify.h"
#include "../../include/formfiller/FFL_CBA_Fontmap.h"
-#define GetRed(rgb) ((uint8_t)(rgb))
-#define GetGreen(rgb) ((uint8_t)(((FX_WORD)(rgb)) >> 8))
-#define GetBlue(rgb) ((uint8_t)((rgb)>>16))
+#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
+#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)
+ : m_pApp(pApp),
+ m_pAnnot(pAnnot),
+ m_bValid(FALSE),
+ m_ptOldPos(0,0)
{
- m_pWidget = (CPDFSDK_Widget*) pAnnot;
+ m_pWidget = (CPDFSDK_Widget*) pAnnot;
}
CFFL_FormFiller::~CFFL_FormFiller()
@@ -40,75 +40,72 @@ CFFL_FormFiller::~CFFL_FormFiller()
void CFFL_FormFiller::SetWindowRect(CPDFSDK_PageView* pPageView, const CPDF_Rect& rcWindow)
{
- if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE))
- {
- pWnd->Move(CPDF_Rect(rcWindow), TRUE, FALSE);
- }
+ if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE))
+ {
+ pWnd->Move(CPDF_Rect(rcWindow), TRUE, FALSE);
+ }
}
CPDF_Rect CFFL_FormFiller::GetWindowRect(CPDFSDK_PageView* pPageView)
{
- if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE))
- {
- return pWnd->GetWindowRect();
- }
+ if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE))
+ {
+ return pWnd->GetWindowRect();
+ }
- return CPDF_Rect(0,0,0,0);
+ return CPDF_Rect(0,0,0,0);
}
FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot)
{
- ASSERT(pPageView != NULL);
- ASSERT(pAnnot != NULL);
+ ASSERT(pPageView != NULL);
+ ASSERT(pAnnot != NULL);
- CPDF_Rect rcAnnot = m_pWidget->GetRect();
+ CPDF_Rect rcAnnot = m_pWidget->GetRect();
- if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE))
- {
- CPDF_Rect rcWindow = pWnd->GetWindowRect();
- rcAnnot = PWLtoFFL(rcWindow);
- }
+ if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE))
+ {
+ CPDF_Rect rcWindow = pWnd->GetWindowRect();
+ rcAnnot = PWLtoFFL(rcWindow);
+ }
- CPDF_Rect rcWin = rcAnnot;
+ CPDF_Rect rcWin = rcAnnot;
- CPDF_Rect rcFocus = GetFocusBox(pPageView);
- if (!rcFocus.IsEmpty())
- rcWin.Union(rcFocus);
+ CPDF_Rect rcFocus = GetFocusBox(pPageView);
+ if (!rcFocus.IsEmpty())
+ rcWin.Union(rcFocus);
- CPDF_Rect rect = CPWL_Utils::InflateRect(rcWin,1);
+ CPDF_Rect rect = CPWL_Utils::InflateRect(rcWin,1);
- return rect.GetOutterRect();
+ return rect.GetOutterRect();
}
-void CFFL_FormFiller::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- /*const CRect& rcWindow,*/ FX_DWORD dwFlags)
+void CFFL_FormFiller::OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+ FX_DWORD dwFlags)
{
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
- if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE))
- {
- CPDF_Matrix mt = GetCurMatrix();
- mt.Concat(*pUser2Device);
- pWnd->DrawAppearance(pDevice,&mt);
- }
- else
- {
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
- if (CFFL_IFormFiller::IsVisible(pWidget))
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
- }
+ if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE))
+ {
+ CPDF_Matrix mt = GetCurMatrix();
+ mt.Concat(*pUser2Device);
+ pWnd->DrawAppearance(pDevice,&mt);
+ }
+ else
+ {
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+ if (CFFL_IFormFiller::IsVisible(pWidget))
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ }
}
-void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- /*const CRect& rcWindow,*/ FX_DWORD dwFlags)
+void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+ FX_DWORD dwFlags)
{
- ASSERT(pAnnot != NULL);
-
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
-
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
}
@@ -130,265 +127,247 @@ void CFFL_FormFiller::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* p
void CFFL_FormFiller::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot)
{
- EndTimer();
- ASSERT(m_pWidget != NULL);
+ EndTimer();
+ ASSERT(m_pWidget != NULL);
}
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);
+ 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);
- if(!rect.Contains((int)point.x, (int)point.y))
- return FALSE;
+ if(!rect.Contains((int)point.x, (int)point.y))
+ return FALSE;
- return pWnd->OnLButtonDown(WndtoPWL(pPageView, point),nFlags);
- }
+ return pWnd->OnLButtonDown(WndtoPWL(pPageView, point),nFlags);
+ }
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_FormFiller::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
+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);
- return TRUE;
- }
+ 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);
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_FormFiller::OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
+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;
- }
+ if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE))
+ {
+ pWnd->OnLButtonDblClk(WndtoPWL(pPageView, point),nFlags);
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
FX_BOOL CFFL_FormFiller::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
{
- if ((m_ptOldPos.x != point.x) || (m_ptOldPos.y != point.y))
- {
- m_ptOldPos = point;
- }
+ if ((m_ptOldPos.x != point.x) || (m_ptOldPos.y != point.y))
+ {
+ m_ptOldPos = point;
+ }
- if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE))
- {
- pWnd->OnMouseMove(WndtoPWL(pPageView, point),nFlags);
- return TRUE;
- }
+ if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE))
+ {
+ pWnd->OnMouseMove(WndtoPWL(pPageView, point),nFlags);
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
FX_BOOL CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point)
{
- if (!IsValid()) return FALSE;
+ if (!IsValid()) return FALSE;
- if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE))
- {
- return pWnd->OnMouseWheel(zDelta, WndtoPWL(pPageView, point),nFlags);
- }
+ if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE))
+ {
+ return pWnd->OnMouseWheel(zDelta, WndtoPWL(pPageView, point),nFlags);
+ }
- return FALSE;
+ return FALSE;
}
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;
- }
+ if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE))
+ {
+ pWnd->OnRButtonDown(WndtoPWL(pPageView, point),nFlags);
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_FormFiller::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
+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;
- }
+ if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE))
+ {
+ pWnd->OnRButtonUp(WndtoPWL(pPageView, point),nFlags);
+ return TRUE;
+ }
- return FALSE;
+ return FALSE;
}
FX_BOOL CFFL_FormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags)
{
- if (IsValid())
- {
- CPDFSDK_PageView* pPageView = GetCurPageView();
- ASSERT(pPageView != NULL);
+ if (IsValid())
+ {
+ CPDFSDK_PageView* pPageView = GetCurPageView();
+ ASSERT(pPageView != NULL);
- if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE))
- {
- return pWnd->OnKeyDown(nKeyCode,nFlags);
- }
- }
+ if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE))
+ {
+ return pWnd->OnKeyDown(nKeyCode,nFlags);
+ }
+ }
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_FormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags)
+FX_BOOL CFFL_FormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags)
{
- if (IsValid())
- {
- CPDFSDK_PageView* pPageView = GetCurPageView();
- ASSERT(pPageView != NULL);
+ if (IsValid())
+ {
+ CPDFSDK_PageView* pPageView = GetCurPageView();
+ ASSERT(pPageView != NULL);
- if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE))
- {
- return pWnd->OnChar(nChar,nFlags);
- }
- }
+ if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE))
+ {
+ return pWnd->OnChar(nChar,nFlags);
+ }
+ }
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_FormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag)
+FX_BOOL CFFL_FormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag)
{
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
-
- CPDF_Page * pPage = pWidget->GetPDFPage();
- CPDFSDK_Document * pDoc = m_pApp->GetCurrentDoc();
- CPDFSDK_PageView* pPageView = pDoc->GetPageView(pPage);
- ASSERT(pPageView != NULL);
-
- CPWL_Wnd * pWnd = NULL;
- if ( (pWnd = GetPDFWindow(pPageView, TRUE)))
- {
- pWnd->SetFocus();
- }
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+ CPDF_Page* pPage = pWidget->GetPDFPage();
+ CPDFSDK_Document* pDoc = m_pApp->GetSDKDocument();
+ CPDFSDK_PageView* pPageView = pDoc->GetPageView(pPage);
+ if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE))
+ pWnd->SetFocus();
- m_bValid = TRUE;
- FX_RECT rcRect = GetViewBBox(pPageView,pAnnot);
- InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom);
-
- return TRUE;
+ m_bValid = TRUE;
+ FX_RECT rcRect = GetViewBBox(pPageView,pAnnot);
+ InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom);
+ return TRUE;
}
-FX_BOOL CFFL_FormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag)
+FX_BOOL CFFL_FormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag)
{
- if (IsValid())
- {
- CPDFSDK_PageView* pPageView = GetCurPageView();
- ASSERT(pPageView != NULL);
-
- CommitData(pPageView, nFlag);
+ if (!IsValid())
+ return TRUE;
- if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE))
- {
- pWnd->KillFocus();
- }
+ CPDFSDK_PageView* pPageView = GetCurPageView();
+ CommitData(pPageView, nFlag);
- switch (m_pWidget->GetFieldType())
- {
- case FIELDTYPE_PUSHBUTTON:
- case FIELDTYPE_CHECKBOX:
- case FIELDTYPE_RADIOBUTTON:
- EscapeFiller(pPageView, TRUE);
- break;
- default:
- EscapeFiller(pPageView, FALSE);
- break;
- }
- }
+ if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE))
+ pWnd->KillFocus();
- return TRUE;
+ switch (m_pWidget->GetFieldType())
+ {
+ case FIELDTYPE_PUSHBUTTON:
+ case FIELDTYPE_CHECKBOX:
+ case FIELDTYPE_RADIOBUTTON:
+ EscapeFiller(pPageView, TRUE);
+ break;
+ default:
+ EscapeFiller(pPageView, FALSE);
+ break;
+ }
+ return TRUE;
}
-FX_BOOL CFFL_FormFiller::IsValid() const
+FX_BOOL CFFL_FormFiller::IsValid() const
{
- return m_bValid;
+ return m_bValid;
}
-PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam()
+PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam()
{
- ASSERT(m_pApp != NULL);
-
- PWL_CREATEPARAM cp;
-
- cp.pParentWnd = NULL;
- cp.pProvider = this;
- cp.rcRectWnd = GetPDFWindowRect();
-
- FX_DWORD dwCreateFlags = PWS_BORDER | PWS_BACKGROUND | PWS_VISIBLE;
-
- ASSERT(m_pWidget != NULL);
-
-
- FX_DWORD dwFieldFlag = m_pWidget->GetFieldFlags();
-
- if (dwFieldFlag & FIELDFLAG_READONLY)
- {
- dwCreateFlags |= PWS_READONLY;
- }
+ ASSERT(m_pApp != NULL);
- FX_COLORREF color;
- if (m_pWidget->GetFillColor(color))
- {
- cp.sBackgroundColor = CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color));
- }
+ PWL_CREATEPARAM cp;
+ cp.pParentWnd = NULL;
+ cp.pProvider = this;
+ cp.rcRectWnd = GetPDFWindowRect();
- if (m_pWidget->GetBorderColor(color))
- {
- cp.sBorderColor = CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color));
- }
+ FX_DWORD dwCreateFlags = PWS_BORDER | PWS_BACKGROUND | PWS_VISIBLE;
+ FX_DWORD dwFieldFlag = m_pWidget->GetFieldFlags();
+ if (dwFieldFlag & FIELDFLAG_READONLY)
+ {
+ dwCreateFlags |= PWS_READONLY;
+ }
- cp.sTextColor = CPWL_Color(COLORTYPE_GRAY,0);
+ FX_COLORREF color;
+ if (m_pWidget->GetFillColor(color))
+ {
+ cp.sBackgroundColor = CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color));
+ }
- if (m_pWidget->GetTextColor(color))
- {
- cp.sTextColor = CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color));
- }
+ if (m_pWidget->GetBorderColor(color))
+ {
+ cp.sBorderColor = CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color));
+ }
- cp.fFontSize = m_pWidget->GetFontSize();
- cp.dwBorderWidth = m_pWidget->GetBorderWidth();
+ cp.sTextColor = CPWL_Color(COLORTYPE_GRAY,0);
- int nBorderStyle = m_pWidget->GetBorderStyle();
+ if (m_pWidget->GetTextColor(color))
+ {
+ cp.sTextColor = CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color));
+ }
- switch (nBorderStyle)
- {
- case BBS_SOLID:
- cp.nBorderStyle = PBS_SOLID;
- break;
- case BBS_DASH:
- cp.nBorderStyle = PBS_DASH;
- cp.sDash = CPWL_Dash(3,3,0);
- break;
- case BBS_BEVELED:
- cp.nBorderStyle = PBS_BEVELED;
- cp.dwBorderWidth *= 2;
- break;
- case BBS_INSET:
- cp.nBorderStyle = PBS_INSET;
- cp.dwBorderWidth *= 2;
- break;
- case BBS_UNDERLINE:
- cp.nBorderStyle = PBS_UNDERLINED;
- break;
- }
+ cp.fFontSize = m_pWidget->GetFontSize();
+ cp.dwBorderWidth = m_pWidget->GetBorderWidth();
+
+ int nBorderStyle = m_pWidget->GetBorderStyle();
+
+ switch (nBorderStyle)
+ {
+ case BBS_SOLID:
+ cp.nBorderStyle = PBS_SOLID;
+ break;
+ case BBS_DASH:
+ cp.nBorderStyle = PBS_DASH;
+ cp.sDash = CPWL_Dash(3,3,0);
+ break;
+ case BBS_BEVELED:
+ cp.nBorderStyle = PBS_BEVELED;
+ cp.dwBorderWidth *= 2;
+ break;
+ case BBS_INSET:
+ cp.nBorderStyle = PBS_INSET;
+ cp.dwBorderWidth *= 2;
+ break;
+ case BBS_UNDERLINE:
+ cp.nBorderStyle = PBS_UNDERLINED;
+ break;
+ }
- if (cp.fFontSize <= 0)
- {
- dwCreateFlags |= PWS_AUTOFONTSIZE;
- }
+ if (cp.fFontSize <= 0)
+ {
+ dwCreateFlags |= PWS_AUTOFONTSIZE;
+ }
- cp.dwFlags = dwCreateFlags;
- cp.pSystemHandler = m_pApp->GetSysHandler();
- return cp;
+ cp.dwFlags = dwCreateFlags;
+ cp.pSystemHandler = m_pApp->GetSysHandler();
+ return cp;
}
CPWL_Wnd* CFFL_FormFiller::GetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bNew)
@@ -442,218 +421,184 @@ void CFFL_FormFiller::DestroyPDFWindow(CPDFSDK_PageView* pPageView)
m_Maps.erase(it);
}
-CPDF_Matrix CFFL_FormFiller::GetWindowMatrix(void* pAttachedData)
+CPDF_Matrix CFFL_FormFiller::GetWindowMatrix(void* pAttachedData)
{
- if (CFFL_PrivateData* pPrivateData = (CFFL_PrivateData*)pAttachedData)
- {
- if (pPrivateData->pPageView)
- {
- CPDF_Matrix mtPageView;
- pPrivateData->pPageView->GetCurrentMatrix(mtPageView);
- CPDF_Matrix mt = GetCurMatrix();
- mt.Concat(mtPageView);
+ if (CFFL_PrivateData* pPrivateData = (CFFL_PrivateData*)pAttachedData)
+ {
+ if (pPrivateData->pPageView)
+ {
+ CPDF_Matrix mtPageView;
+ pPrivateData->pPageView->GetCurrentMatrix(mtPageView);
+ CPDF_Matrix mt = GetCurMatrix();
+ mt.Concat(mtPageView);
- return mt;
- }
- }
- return CPDF_Matrix(1,0,0,1,0,0);
+ return mt;
+ }
+ }
+ return CPDF_Matrix(1,0,0,1,0,0);
}
-CPDF_Matrix CFFL_FormFiller::GetCurMatrix()
+CPDF_Matrix CFFL_FormFiller::GetCurMatrix()
{
- CPDF_Matrix mt;
+ CPDF_Matrix mt;
- ASSERT(m_pWidget != NULL);
+ ASSERT(m_pWidget != NULL);
- CPDF_Rect rcDA ;
- m_pWidget->GetPDFAnnot()->GetRect(rcDA);
+ CPDF_Rect rcDA ;
+ m_pWidget->GetPDFAnnot()->GetRect(rcDA);
- switch (m_pWidget->GetRotate())
- {
- default:
- case 0:
- mt = CPDF_Matrix(1,0,0,1,0,0);
- break;
- case 90:
- mt = CPDF_Matrix(0,1,-1,0,rcDA.right - rcDA.left,0);
- break;
- case 180:
- mt = CPDF_Matrix(-1,0,0,-1,rcDA.right - rcDA.left,rcDA.top - rcDA.bottom);
- break;
- case 270:
- mt = CPDF_Matrix(0,-1,1,0,0,rcDA.top - rcDA.bottom);
- break;
- }
- mt.e += rcDA.left;
- mt.f += rcDA.bottom;
+ switch (m_pWidget->GetRotate())
+ {
+ default:
+ case 0:
+ mt = CPDF_Matrix(1,0,0,1,0,0);
+ break;
+ case 90:
+ mt = CPDF_Matrix(0,1,-1,0,rcDA.right - rcDA.left,0);
+ break;
+ case 180:
+ mt = CPDF_Matrix(-1,0,0,-1,rcDA.right - rcDA.left,rcDA.top - rcDA.bottom);
+ break;
+ case 270:
+ mt = CPDF_Matrix(0,-1,1,0,0,rcDA.top - rcDA.bottom);
+ break;
+ }
+ mt.e += rcDA.left;
+ mt.f += rcDA.bottom;
- return mt;
+ return mt;
}
CFX_WideString CFFL_FormFiller::LoadPopupMenuString(int nIndex)
{
- ASSERT(m_pApp != NULL);
+ ASSERT(m_pApp != NULL);
- return L"";
+ return L"";
}
CPDF_Rect CFFL_FormFiller::GetPDFWindowRect() const
{
- ASSERT(m_pWidget != NULL);
+ CPDF_Rect rectAnnot;
+ m_pWidget->GetPDFAnnot()->GetRect(rectAnnot);
- CPDF_Rect rectAnnot;
- m_pWidget->GetPDFAnnot()->GetRect(rectAnnot);
+ FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left;
+ FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom;
+ if ((m_pWidget->GetRotate() / 90) & 0x01)
+ return CPDF_Rect(0, 0, fHeight, fWidth);
- FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left;
- FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom;
-
-
- if ((m_pWidget->GetRotate() / 90) & 0x01)
- return CPDF_Rect(0,0,fHeight,fWidth);
- else
- return CPDF_Rect(0,0,fWidth,fHeight);
+ return CPDF_Rect(0, 0, fWidth, fHeight);
}
CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView()
{
-
- CPDF_Page* pPage = m_pAnnot->GetPDFPage();
- CPDFSDK_Document* pSDKDoc = m_pApp->GetCurrentDoc();
- if(pSDKDoc)
- {
- return pSDKDoc->GetPageView(pPage);
- }
- return NULL;
+ CPDF_Page* pPage = m_pAnnot->GetPDFPage();
+ CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument();
+ return pSDKDoc ? pSDKDoc->GetPageView(pPage) : nullptr;
}
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();
- if(rcPage.Contains(rcFocus))
- return rcFocus;
- else
- return CPDF_Rect(0,0,0,0);
- }
- return CPDF_Rect(0,0,0,0);
+ if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE))
+ {
+ CPDF_Rect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocusRect()));
+ CPDF_Rect rcPage = pPageView->GetPDFPage()->GetPageBBox();
+ if (rcPage.Contains(rcFocus))
+ return rcFocus;
+ }
+ return CPDF_Rect(0,0,0,0);
}
CPDF_Rect CFFL_FormFiller::FFLtoPWL(const CPDF_Rect& rect)
{
- CPDF_Matrix mt;
- mt.SetReverse(GetCurMatrix());
+ CPDF_Matrix mt;
+ mt.SetReverse(GetCurMatrix());
- CPDF_Rect temp = rect;
- mt.TransformRect(temp);
+ CPDF_Rect temp = rect;
+ mt.TransformRect(temp);
- return temp;
+ return temp;
}
CPDF_Rect CFFL_FormFiller::PWLtoFFL(const CPDF_Rect& rect)
{
- CPDF_Matrix mt = GetCurMatrix();
+ CPDF_Matrix mt = GetCurMatrix();
- CPDF_Rect temp = rect;
- mt.TransformRect(temp);
+ CPDF_Rect temp = rect;
+ mt.TransformRect(temp);
- return temp;
+ return temp;
}
CPDF_Point CFFL_FormFiller::FFLtoPWL(const CPDF_Point& point)
{
- CPDF_Matrix mt;
- mt.SetReverse(GetCurMatrix());
+ CPDF_Matrix mt;
+ mt.SetReverse(GetCurMatrix());
- CPDF_Point pt = point;
- mt.Transform(pt.x,pt.y);
+ CPDF_Point pt = point;
+ mt.Transform(pt.x,pt.y);
- return pt;
+ return pt;
}
CPDF_Point CFFL_FormFiller::PWLtoFFL(const CPDF_Point & point)
{
- CPDF_Matrix mt = GetCurMatrix();
+ CPDF_Matrix mt = GetCurMatrix();
- CPDF_Point pt = point;
- mt.Transform(pt.x,pt.y);
+ CPDF_Point pt = point;
+ mt.Transform(pt.x,pt.y);
- return pt;
+ return pt;
}
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);
+ return FFLtoPWL(pt);
}
CPDF_Rect CFFL_FormFiller::FFLtoWnd(CPDFSDK_PageView* pPageView, const CPDF_Rect & rect)
{
-// FX_RECT rcRet(0,0,0,0);
-//
-// ASSERT(pPageView != NULL);
-// pPageView->DocToWindow(rect, rcRet);
-//
- return rect;
-
-}
-
-void CFFL_FormFiller::FFL_FreeData(void* pData)
-{
- ASSERT(pData != NULL);
-
- delete (CFFL_PrivateData*)pData;
+ return rect;
}
FX_BOOL CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, FX_UINT nFlag)
{
- if (IsDataChanged(pPageView))
- {
- //CFFL_IFormFiller* pIFormFiller = CFFL_Module::GetFormFiller(m_pApp);
- CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller();//NULL;
- ASSERT(pIFormFiller != NULL);
-
- FX_BOOL bRC = TRUE;
- FX_BOOL bExit = FALSE;
-
- pIFormFiller->OnKeyStrokeCommit(m_pWidget, pPageView, bRC, bExit, nFlag);
- if (bExit) return TRUE;
- if (!bRC)
- {
- ResetPDFWindow(pPageView, FALSE);
- return TRUE;
- }
-
- pIFormFiller->OnValidate(m_pWidget, pPageView, bRC, bExit, nFlag);
- if (bExit) return TRUE;
- if (!bRC)
- {
- ResetPDFWindow(pPageView, FALSE);
- return TRUE;
- }
-
- SaveData(pPageView);
-
- pIFormFiller->OnCalculate(m_pWidget, pPageView, bExit,nFlag);
- if (bExit) return TRUE;
-
- pIFormFiller->OnFormat(m_pWidget, pPageView, bExit,nFlag);
- }
-
- return TRUE;
+ if (IsDataChanged(pPageView))
+ {
+ FX_BOOL bRC = TRUE;
+ FX_BOOL bExit = FALSE;
+ CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller();
+ pIFormFiller->OnKeyStrokeCommit(m_pWidget, pPageView, bRC, bExit, nFlag);
+ if (bExit)
+ return TRUE;
+ if (!bRC)
+ {
+ ResetPDFWindow(pPageView, FALSE);
+ return TRUE;
+ }
+
+ pIFormFiller->OnValidate(m_pWidget, pPageView, bRC, bExit, nFlag);
+ if (bExit)
+ return TRUE;
+ if (!bRC)
+ {
+ ResetPDFWindow(pPageView, FALSE);
+ return TRUE;
+ }
+
+ SaveData(pPageView);
+ pIFormFiller->OnCalculate(m_pWidget, pPageView, bExit,nFlag);
+ if (bExit)
+ return TRUE;
+
+ pIFormFiller->OnFormat(m_pWidget, pPageView, bExit,nFlag);
+ }
+ return TRUE;
}
-FX_BOOL CFFL_FormFiller::IsDataChanged(CPDFSDK_PageView* pPageView)
+FX_BOOL CFFL_FormFiller::IsDataChanged(CPDFSDK_PageView* pPageView)
{
- return FALSE;
+ return FALSE;
}
void CFFL_FormFiller::SaveData(CPDFSDK_PageView* pPageView)
@@ -666,24 +611,24 @@ void CFFL_FormFiller::GetKeyStrokeData(CPDFSDK_PageView* pPageView, FFL_KeyStrok
void CFFL_FormFiller::SetChangeMark()
{
- m_pApp->FFI_OnChange();
+ m_pApp->FFI_OnChange();
}
void CFFL_FormFiller::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
- PDFSDK_FieldAction& fa)
+ PDFSDK_FieldAction& fa)
{
- fa.sValue = m_pWidget->GetValue();
+ fa.sValue = m_pWidget->GetValue();
}
void CFFL_FormFiller::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
- const PDFSDK_FieldAction& fa)
+ const PDFSDK_FieldAction& fa)
{
}
-FX_BOOL CFFL_FormFiller::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld,
- const PDFSDK_FieldAction& faNew)
+FX_BOOL CFFL_FormFiller::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld,
+ const PDFSDK_FieldAction& faNew)
{
- return FALSE;
+ return FALSE;
}
void CFFL_FormFiller::SaveState(CPDFSDK_PageView* pPageView)
@@ -696,7 +641,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()
@@ -706,8 +651,7 @@ void CFFL_FormFiller::TimerProc()
IFX_SystemHandler* CFFL_FormFiller::GetSystemHandler() const
{
- return m_pApp->GetSysHandler();
-// return NULL;
+ return m_pApp->GetSysHandler();
}
void CFFL_FormFiller::OnKeyStroke(FX_BOOL bKeyDown)
@@ -716,28 +660,28 @@ void CFFL_FormFiller::OnKeyStroke(FX_BOOL bKeyDown)
void CFFL_FormFiller::EscapeFiller(CPDFSDK_PageView* pPageView, FX_BOOL bDestroyPDFWindow)
{
- m_bValid = FALSE;
+ m_bValid = FALSE;
- FX_RECT rcRect = GetViewBBox(pPageView, m_pWidget);
- InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom);
+ FX_RECT rcRect = GetViewBBox(pPageView, m_pWidget);
+ InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom);
- if(bDestroyPDFWindow)
- DestroyPDFWindow(pPageView);
+ if(bDestroyPDFWindow)
+ DestroyPDFWindow(pPageView);
}
FX_BOOL CFFL_FormFiller::CanCopy(CPDFSDK_Document* pDocument)
{
- return FALSE;
+ return FALSE;
}
FX_BOOL CFFL_FormFiller::CanCut(CPDFSDK_Document* pDocument)
{
- return FALSE;
+ return FALSE;
}
-FX_BOOL CFFL_FormFiller::CanPaste(CPDFSDK_Document* pDocument)
+FX_BOOL CFFL_FormFiller::CanPaste(CPDFSDK_Document* pDocument)
{
- return FALSE;
+ return FALSE;
}
void CFFL_FormFiller::DoCopy(CPDFSDK_Document* pDocument)
@@ -754,16 +698,16 @@ void CFFL_FormFiller::DoPaste(CPDFSDK_Document* pDocument)
void CFFL_FormFiller::InvalidateRect(double left, double top, double right, double bottom)
{
- CPDF_Page * pPage = m_pWidget->GetPDFPage();
- m_pApp->FFI_Invalidate(pPage, left, top, right, bottom);
+ CPDF_Page * pPage = m_pWidget->GetPDFPage();
+ 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)
+ CFFL_FormFiller(pApp, pWidget),
+ m_bMouseIn(FALSE),
+ m_bMouseDown(FALSE)
{
}
@@ -773,99 +717,94 @@ CFFL_Button::~CFFL_Button()
void CFFL_Button::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot)
{
- m_bMouseIn = TRUE;
- FX_RECT rect = GetViewBBox(pPageView,pAnnot);
- InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
+ m_bMouseIn = TRUE;
+ FX_RECT rect = GetViewBBox(pPageView,pAnnot);
+ InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
}
void CFFL_Button::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot)
{
- m_bMouseIn = FALSE;
+ m_bMouseIn = FALSE;
- FX_RECT rect = GetViewBBox(pPageView,pAnnot);
- InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
- EndTimer();
- ASSERT(m_pWidget != NULL);
+ FX_RECT rect = GetViewBBox(pPageView,pAnnot);
+ InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
+ EndTimer();
+ ASSERT(m_pWidget != NULL);
}
FX_BOOL CFFL_Button::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
{
- CPDF_Rect rcAnnot = pAnnot->GetRect();
- if(!rcAnnot.Contains(point.x, point.y))
- return FALSE;
+ CPDF_Rect rcAnnot = pAnnot->GetRect();
+ if(!rcAnnot.Contains(point.x, point.y))
+ return FALSE;
- m_bMouseDown = TRUE;
- m_bValid = TRUE;
- FX_RECT rect = GetViewBBox(pPageView, pAnnot);
- InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
- return TRUE;
+ m_bMouseDown = TRUE;
+ m_bValid = TRUE;
+ FX_RECT rect = GetViewBBox(pPageView, pAnnot);
+ InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
+ return TRUE;
}
-FX_BOOL CFFL_Button::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
+FX_BOOL CFFL_Button::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
{
- CPDF_Rect rcAnnot = pAnnot->GetRect();
- if(!rcAnnot.Contains(point.x, point.y))
- return FALSE;
+ CPDF_Rect rcAnnot = pAnnot->GetRect();
+ if(!rcAnnot.Contains(point.x, point.y))
+ return FALSE;
- m_bMouseDown = FALSE;
- m_pWidget->GetPDFPage();
+ m_bMouseDown = FALSE;
+ m_pWidget->GetPDFPage();
- FX_RECT rect = GetViewBBox(pPageView, pAnnot);
- InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
- return TRUE;
+ FX_RECT rect = GetViewBBox(pPageView, pAnnot);
+ InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
+ return TRUE;
}
-FX_BOOL CFFL_Button::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
+FX_BOOL CFFL_Button::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
{
- ASSERT(m_pApp != NULL);
+ ASSERT(m_pApp != NULL);
- return TRUE;
+ return TRUE;
}
-void CFFL_Button::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- /*const CRect& rcWindow,*/ FX_DWORD dwFlags)
+void CFFL_Button::OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+ FX_DWORD dwFlags)
{
- ASSERT(pPageView != NULL);
- ASSERT(pAnnot != NULL);
-
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+ ASSERT(pPageView != NULL);
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+ CPDF_FormControl* pCtrl = pWidget->GetFormControl();
+ CPDF_FormControl::HighlightingMode eHM = pCtrl->GetHighlightingMode();
- CPDF_FormControl* pCtrl = pWidget->GetFormControl();
- ASSERT(pCtrl != NULL);
-
- 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
- {
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
- }
- }
- else
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ 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
+ {
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ }
+ }
+ else
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
}
-void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- /*const CRect& rcWindow, */FX_DWORD dwFlags)
+void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+ FX_DWORD dwFlags)
{
- OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
+ OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
}
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);