From eda202769e5c79eba1d2fb5090f6e9cf176e2d4a Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 11 Jun 2015 13:03:09 -0700 Subject: Cleanup: Get this rid of "this->" in fpdfsdk/ Also remove commented out code and trailing whitespaces. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1179653005. --- fpdfsdk/include/fxedit/fxet_edit.h | 18 +- fpdfsdk/include/fxedit/fxet_list.h | 79 ++++---- fpdfsdk/include/pdfwindow/PWL_ListBox.h | 21 +- fpdfsdk/include/pdfwindow/PWL_Wnd.h | 2 +- fpdfsdk/src/formfiller/FFL_ComboBox.cpp | 22 +- fpdfsdk/src/formfiller/FFL_FormFiller.cpp | 60 +++--- fpdfsdk/src/formfiller/FFL_ListBox.cpp | 14 +- fpdfsdk/src/formfiller/FFL_Notify.cpp | 20 +- fpdfsdk/src/formfiller/FFL_TextField.cpp | 11 +- fpdfsdk/src/fpdfppo.cpp | 2 +- fpdfsdk/src/fsdk_actionhandler.cpp | 4 +- fpdfsdk/src/fsdk_annothandler.cpp | 256 ++++++++++++------------ fpdfsdk/src/fsdk_baseform.cpp | 52 ++--- fpdfsdk/src/fsdk_mgr.cpp | 139 ++++++------- fpdfsdk/src/fxedit/fxet_edit.cpp | 19 +- fpdfsdk/src/fxedit/fxet_list.cpp | 91 +++++---- fpdfsdk/src/javascript/Field.cpp | 2 +- fpdfsdk/src/javascript/global.cpp | 10 +- fpdfsdk/src/pdfwindow/PWL_Caret.cpp | 14 +- fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp | 6 +- fpdfsdk/src/pdfwindow/PWL_Edit.cpp | 56 +++--- fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp | 78 ++++---- fpdfsdk/src/pdfwindow/PWL_FontMap.cpp | 28 ++- fpdfsdk/src/pdfwindow/PWL_Icon.cpp | 22 +- fpdfsdk/src/pdfwindow/PWL_IconList.cpp | 66 +++--- fpdfsdk/src/pdfwindow/PWL_Label.cpp | 8 +- fpdfsdk/src/pdfwindow/PWL_ListBox.cpp | 77 +++---- fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp | 20 +- fpdfsdk/src/pdfwindow/PWL_Note.cpp | 231 +++++++++++---------- fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp | 298 ++++++++++++---------------- fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp | 2 +- fpdfsdk/src/pdfwindow/PWL_Utils.cpp | 38 ++-- fpdfsdk/src/pdfwindow/PWL_Wnd.cpp | 157 ++++++--------- 33 files changed, 853 insertions(+), 1070 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/include/fxedit/fxet_edit.h b/fpdfsdk/include/fxedit/fxet_edit.h index 0a3617f4e4..d92f29067a 100644 --- a/fpdfsdk/include/fxedit/fxet_edit.h +++ b/fpdfsdk/include/fxedit/fxet_edit.h @@ -162,7 +162,7 @@ public: virtual ~CFX_Edit_RectArray() { - this->Empty(); + Empty(); } void Empty() @@ -170,7 +170,7 @@ public: for (int32_t i = 0, sz = m_Rects.GetSize(); i < sz; i++) delete m_Rects.GetAt(i); - this->m_Rects.RemoveAll(); + m_Rects.RemoveAll(); } void Add(const CPDF_Rect & rect) @@ -242,7 +242,7 @@ public: CPVT_WordRange ConvertToWordRange() const { - return CPVT_WordRange(this->BeginPos,this->EndPos); + return CPVT_WordRange(BeginPos, EndPos); } void Default() @@ -253,28 +253,28 @@ public: void Set(const CPVT_WordPlace & begin,const CPVT_WordPlace & end) { - this->BeginPos = begin; - this->EndPos = end; + BeginPos = begin; + EndPos = end; } void SetBeginPos(const CPVT_WordPlace & begin) { - this->BeginPos = begin; + BeginPos = begin; } void SetEndPos(const CPVT_WordPlace & end) { - this->EndPos = end; + EndPos = end; } FX_BOOL IsExist() const { - return this->BeginPos != this->EndPos; + return BeginPos != EndPos; } FX_BOOL operator != (const CPVT_WordRange & wr) const { - return wr.BeginPos != this->BeginPos || wr.EndPos != this->EndPos; + return wr.BeginPos != BeginPos || wr.EndPos != EndPos; } CPVT_WordPlace BeginPos,EndPos; diff --git a/fpdfsdk/include/fxedit/fxet_list.h b/fpdfsdk/include/fxedit/fxet_list.h index 02028f2cff..fe75b0fc35 100644 --- a/fpdfsdk/include/fxedit/fxet_list.h +++ b/fpdfsdk/include/fxedit/fxet_list.h @@ -19,10 +19,10 @@ public: { } - CLST_Size(FX_FLOAT x,FX_FLOAT y) + CLST_Size(FX_FLOAT other_x, FX_FLOAT other_y) { - this->x = x; - this->y = y; + x = other_x; + y = other_y; } void Default() @@ -47,22 +47,24 @@ public: left = top = right = bottom = 0.0f; } - CLST_Rect(FX_FLOAT left,FX_FLOAT top, - FX_FLOAT right,FX_FLOAT bottom) - { - this->left = left; - this->top = top; - this->right = right; - this->bottom = bottom; - } - - CLST_Rect(const CPDF_Rect & rect) - { - this->left = rect.left; - this->top = rect.top; - this->right = rect.right; - this->bottom = rect.bottom; - } + CLST_Rect(FX_FLOAT other_left, + FX_FLOAT other_top, + FX_FLOAT other_right, + FX_FLOAT other_bottom) + { + left = other_left; + top = other_top; + right = other_right; + bottom = other_bottom; + } + + CLST_Rect(const CPDF_Rect & rect) + { + left = rect.left; + top = rect.top; + right = rect.right; + bottom = rect.bottom; + } void Default() { @@ -71,10 +73,10 @@ public: const CLST_Rect operator = (const CPDF_Rect & rect) { - this->left = rect.left; - this->top = rect.top; - this->right = rect.right; - this->bottom = rect.bottom; + left = rect.left; + top = rect.top; + right = rect.right; + bottom = rect.bottom; return *this; } @@ -91,15 +93,14 @@ public: FX_FLOAT Width() const { - return this->right - this->left; + return right - left; } FX_FLOAT Height() const { - if (this->top > this->bottom) - return this->top - this->bottom; - else - return this->bottom - this->top; + if (top > bottom) + return top - bottom; + return bottom - top; } CPDF_Point LeftTop() const @@ -114,20 +115,20 @@ public: const CLST_Rect operator += (const CPDF_Point & point) { - this->left += point.x; - this->right += point.x; - this->top += point.y; - this->bottom += point.y; + left += point.x; + right += point.x; + top += point.y; + bottom += point.y; return *this; } const CLST_Rect operator -= (const CPDF_Point & point) { - this->left -= point.x; - this->right -= point.x; - this->top -= point.y; - this->bottom -= point.y; + left -= point.x; + right -= point.x; + top -= point.y; + bottom -= point.y; return *this; } @@ -263,10 +264,10 @@ private: struct CPLST_Select_Item { - CPLST_Select_Item(int32_t nItemIndex,int32_t nState) + CPLST_Select_Item(int32_t other_nItemIndex, int32_t other_nState) { - this->nItemIndex = nItemIndex; - this->nState = nState; + nItemIndex = other_nItemIndex; + nState = other_nState; } int32_t nItemIndex; diff --git a/fpdfsdk/include/pdfwindow/PWL_ListBox.h b/fpdfsdk/include/pdfwindow/PWL_ListBox.h index bbb9f35125..97a4529af9 100644 --- a/fpdfsdk/include/pdfwindow/PWL_ListBox.h +++ b/fpdfsdk/include/pdfwindow/PWL_ListBox.h @@ -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 #ifndef FPDFSDK_INCLUDE_PDFWINDOW_PWL_LISTBOX_H_ @@ -21,11 +21,11 @@ public: CPWL_List_Notify(CPWL_ListBox * pList); virtual ~CPWL_List_Notify(); - void IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, - FX_FLOAT fContentMin, FX_FLOAT fContentMax, + void IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, + FX_FLOAT fContentMin, FX_FLOAT fContentMax, FX_FLOAT fSmallStep, FX_FLOAT fBigStep){} - void IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, - FX_FLOAT fContentMin, FX_FLOAT fContentMax, + void IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, + FX_FLOAT fContentMin, FX_FLOAT fContentMax, FX_FLOAT fSmallStep, FX_FLOAT fBigStep); void IOnSetScrollPosX(FX_FLOAT fx){} void IOnSetScrollPosY(FX_FLOAT fy); @@ -34,7 +34,7 @@ public: void IOnInvalidateRect(CPDF_Rect * pRect); private: - CPWL_ListBox* m_pList; + CPWL_ListBox* m_pList; }; class PWL_CLASS CPWL_ListBox : public CPWL_Wnd @@ -59,15 +59,14 @@ public: virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0); virtual void RePosChildWnd(); - virtual void SetText(const FX_WCHAR* csText,FX_BOOL bRefresh = TRUE); - virtual CFX_WideString GetText() const; + virtual CFX_WideString GetText() const; virtual CPDF_Rect GetFocusRect() const; virtual void SetFontSize(FX_FLOAT fFontSize); virtual FX_FLOAT GetFontSize() const; void OnNotifySelChanged(FX_BOOL bKeyDown, FX_BOOL & bExit , FX_DWORD nFlag); - void AddString(const FX_WCHAR* string); + void AddString(const FX_WCHAR* string); void SetTopVisibleIndex(int32_t nItemIndex); void ScrollToListItem(int32_t nItemIndex); void ResetContent(); @@ -75,7 +74,7 @@ public: void Select(int32_t nItemIndex); void SetCaret(int32_t nItemIndex); void SetHoverSel(FX_BOOL bHoverSel); - + int32_t GetCount() const; FX_BOOL IsMultipleSel() const; int32_t GetCaretIndex() const; @@ -83,7 +82,7 @@ public: FX_BOOL IsItemSelected(int32_t nItemIndex) const; int32_t GetTopVisibleIndex() const; int32_t FindNext(int32_t nIndex,FX_WCHAR nChar) const; - CPDF_Rect GetContentRect() const; + CPDF_Rect GetContentRect() const; FX_FLOAT GetFirstHeight() const; CPDF_Rect GetListRect() const; diff --git a/fpdfsdk/include/pdfwindow/PWL_Wnd.h b/fpdfsdk/include/pdfwindow/PWL_Wnd.h index 9f089e6fa4..e74dc88c5c 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/include/pdfwindow/PWL_Wnd.h @@ -125,7 +125,7 @@ struct PWL_CLASS CPWL_Color nColorType(COLORTYPE_RGB), fColor1(r/255.0f), fColor2(g/255.0f), fColor3(b/255.0f), fColor4(0) {} - void ConvertColorType(int32_t nColorType); + void ConvertColorType(int32_t other_nColorType); /* COLORTYPE_TRANSPARENT diff --git a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp index 3c74c9f7e1..e10c981d1a 100644 --- a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp @@ -16,7 +16,6 @@ CFFL_ComboBox::CFFL_ComboBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot) : CFFL_FormFiller(pApp, pAnnot), m_pFontMap( NULL ) { - //m_pFontMap = new CBA_FontMap( pAnnot, GetSystemHandler() ); m_State.nIndex = 0; m_State.nStart = 0; m_State.nEnd = 0; @@ -29,13 +28,6 @@ CFFL_ComboBox::~CFFL_ComboBox() delete m_pFontMap; m_pFontMap = NULL; } - -// for (int i=0,sz=m_IMBox.GetSize(); im_pApp != NULL); m_pFontMap = new CBA_FontMap(m_pWidget, GetSystemHandler()); m_pFontMap->Initial(); } @@ -311,10 +295,10 @@ CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRe if (bRestoreValue) { RestoreState(pPageView); - pRet = this->GetPDFWindow(pPageView, FALSE); + pRet = GetPDFWindow(pPageView, FALSE); } else - pRet = this->GetPDFWindow(pPageView, TRUE); + pRet = GetPDFWindow(pPageView, TRUE); m_pWidget->UpdateField(); @@ -331,7 +315,7 @@ void CFFL_ComboBox::OnKeyStroke(FX_BOOL bKeyDown, FX_UINT nFlag) { if (m_bValid) { - CPDFSDK_PageView* pPageView = this->GetCurPageView(); + CPDFSDK_PageView* pPageView = GetCurPageView(); ASSERT(pPageView != NULL); if (CommitData(pPageView, nFlag)) diff --git a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp index 1e2db7004a..d9a9848ec5 100644 --- a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp +++ b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp @@ -49,7 +49,7 @@ CFFL_FormFiller::~CFFL_FormFiller() void CFFL_FormFiller::SetWindowRect(CPDFSDK_PageView* pPageView, const CPDF_Rect& rcWindow) { - if (CPWL_Wnd* pWnd = this->GetPDFWindow(pPageView, FALSE)) + if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { pWnd->Move(CPDF_Rect(rcWindow), TRUE, FALSE); } @@ -57,7 +57,7 @@ void CFFL_FormFiller::SetWindowRect(CPDFSDK_PageView* pPageView, const CPDF_Rect CPDF_Rect CFFL_FormFiller::GetWindowRect(CPDFSDK_PageView* pPageView) { - if (CPWL_Wnd* pWnd = this->GetPDFWindow(pPageView, FALSE)) + if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { return pWnd->GetWindowRect(); } @@ -72,16 +72,15 @@ FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* CPDF_Rect rcAnnot = m_pWidget->GetRect(); - if (CPWL_Wnd* pWnd = this->GetPDFWindow(pPageView, FALSE)) + if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { CPDF_Rect rcWindow = pWnd->GetWindowRect(); rcAnnot = PWLtoFFL(rcWindow); } CPDF_Rect rcWin = rcAnnot; -// pPageView->DocToWindow(rcAnnot, rcWin); - CPDF_Rect rcFocus = this->GetFocusBox(pPageView); + CPDF_Rect rcFocus = GetFocusBox(pPageView); if (!rcFocus.IsEmpty()) rcWin.Union(rcFocus); @@ -98,7 +97,7 @@ void CFFL_FormFiller::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_A if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) { - CPDF_Matrix mt = this->GetCurMatrix(); + CPDF_Matrix mt = GetCurMatrix(); mt.Concat(*pUser2Device); pWnd->DrawAppearance(pDevice,&mt); } @@ -149,8 +148,8 @@ FX_BOOL CFFL_FormFiller::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Anno if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE)) { m_bValid = TRUE; - FX_RECT rect = this->GetViewBBox(pPageView,pAnnot); - this->InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); + 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; @@ -165,8 +164,8 @@ FX_BOOL CFFL_FormFiller::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* { if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) { - FX_RECT rcFFL = this->GetViewBBox(pPageView, pAnnot); - this->InvalidateRect(rcFFL.left, rcFFL.top, rcFFL.right, rcFFL.bottom); + FX_RECT rcFFL = GetViewBBox(pPageView, pAnnot); + InvalidateRect(rcFFL.left, rcFFL.top, rcFFL.right, rcFFL.bottom); pWnd->OnLButtonUp(WndtoPWL(pPageView, point),nFlags); return TRUE; } @@ -250,7 +249,7 @@ FX_BOOL CFFL_FormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_U { if (IsValid()) { - CPDFSDK_PageView* pPageView = this->GetCurPageView(); + CPDFSDK_PageView* pPageView = GetCurPageView(); ASSERT(pPageView != NULL); if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) @@ -266,7 +265,7 @@ FX_BOOL CFFL_FormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nF { if (IsValid()) { - CPDFSDK_PageView* pPageView = this->GetCurPageView(); + CPDFSDK_PageView* pPageView = GetCurPageView(); ASSERT(pPageView != NULL); if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) @@ -311,8 +310,8 @@ FX_BOOL CFFL_FormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) m_bValid = TRUE; - FX_RECT rcRect = this->GetViewBBox(pPageView,pAnnot); - this->InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); + FX_RECT rcRect = GetViewBBox(pPageView,pAnnot); + InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); return TRUE; } @@ -321,7 +320,7 @@ FX_BOOL CFFL_FormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { if (IsValid()) { - CPDFSDK_PageView* pPageView = this->GetCurPageView(); + CPDFSDK_PageView* pPageView = GetCurPageView(); ASSERT(pPageView != NULL); CommitData(pPageView, nFlag); @@ -446,7 +445,7 @@ CPWL_Wnd* CFFL_FormFiller::GetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bNe if (pPrivateData->nWidgetAge != m_pWidget->GetAppearanceAge()) { - return this->ResetPDFWindow(pPageView, m_pWidget->GetValueAge() == pPrivateData->nValueAge); + return ResetPDFWindow(pPageView, m_pWidget->GetValueAge() == pPrivateData->nValueAge); } } else @@ -677,7 +676,7 @@ FX_BOOL CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, FX_UINT nFlag) if (bExit) return TRUE; if (!bRC) { - this->ResetPDFWindow(pPageView, FALSE); + ResetPDFWindow(pPageView, FALSE); return TRUE; } @@ -685,7 +684,7 @@ FX_BOOL CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, FX_UINT nFlag) if (bExit) return TRUE; if (!bRC) { - this->ResetPDFWindow(pPageView, FALSE); + ResetPDFWindow(pPageView, FALSE); return TRUE; } @@ -767,8 +766,8 @@ void CFFL_FormFiller::EscapeFiller(CPDFSDK_PageView* pPageView, FX_BOOL bDestroy { m_bValid = FALSE; - FX_RECT rcRect = this->GetViewBBox(pPageView, m_pWidget); - this->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); @@ -823,21 +822,18 @@ CFFL_Button::~CFFL_Button() void CFFL_Button::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot) { m_bMouseIn = TRUE; - FX_RECT rect = this->GetViewBBox(pPageView,pAnnot); - this->InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); -// ::InvalidateRect(pPageView->GetPageViewWnd(), &this->GetViewBBox(pPageView, pAnnot), 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; - FX_RECT rect = this->GetViewBBox(pPageView,pAnnot); - this->InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); -// ::InvalidateRect(pPageView->GetPageViewWnd(), &this->GetViewBBox(pPageView, pAnnot), TRUE); + FX_RECT rect = GetViewBBox(pPageView,pAnnot); + InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); EndTimer(); ASSERT(m_pWidget != NULL); -// m_pWidget->HideHint(); } FX_BOOL CFFL_Button::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) @@ -848,9 +844,8 @@ FX_BOOL CFFL_Button::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* p m_bMouseDown = TRUE; m_bValid = TRUE; - FX_RECT rect = this->GetViewBBox(pPageView, pAnnot); - this->InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); -// ::InvalidateRect(pPageView->GetPageViewWnd(), &this->GetViewBBox(pPageView, pAnnot), TRUE); + FX_RECT rect = GetViewBBox(pPageView, pAnnot); + InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); return TRUE; } @@ -864,9 +859,8 @@ FX_BOOL CFFL_Button::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAn m_pWidget->GetPDFPage(); - FX_RECT rect = this->GetViewBBox(pPageView, pAnnot); - this->InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); -// ::InvalidateRect(pPageView->GetPageViewWnd(), &this->GetViewBBox(pPageView, pAnnot), TRUE); + FX_RECT rect = GetViewBBox(pPageView, pAnnot); + InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); return TRUE; } diff --git a/fpdfsdk/src/formfiller/FFL_ListBox.cpp b/fpdfsdk/src/formfiller/FFL_ListBox.cpp index 6b0aa1b347..6ee608a5bb 100644 --- a/fpdfsdk/src/formfiller/FFL_ListBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_ListBox.cpp @@ -45,11 +45,6 @@ PWL_CREATEPARAM CFFL_ListBox::GetCreateParam() cp.dwFlags |= PLBS_MULTIPLESEL; } - if (dwFieldFlag & FIELDFLAG_COMMITONSELCHANGE) - { - //cp.dwFlags |= PLBS_COMMITSELECTEDVALUE; - } - cp.dwFlags |= PWS_VSCROLL; if (cp.dwFlags & PWS_AUTOFONTSIZE) @@ -57,8 +52,7 @@ PWL_CREATEPARAM CFFL_ListBox::GetCreateParam() if (!m_pFontMap) { - ASSERT(this->m_pApp != NULL); - m_pFontMap = new CBA_FontMap(m_pWidget,m_pApp->GetSysHandler());//, ISystemHandle::GetSystemHandler(m_pApp)); + m_pFontMap = new CBA_FontMap(m_pWidget, m_pApp->GetSysHandler()); m_pFontMap->Initial(); } cp.pFontMap = m_pFontMap; @@ -283,10 +277,10 @@ CPWL_Wnd* CFFL_ListBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRes if (bRestoreValue) { RestoreState(pPageView); - pRet = this->GetPDFWindow(pPageView, FALSE); + pRet = GetPDFWindow(pPageView, FALSE); } else - pRet = this->GetPDFWindow(pPageView, TRUE); + pRet = GetPDFWindow(pPageView, TRUE); m_pWidget->UpdateField(); @@ -303,7 +297,7 @@ void CFFL_ListBox::OnKeyStroke(FX_BOOL bKeyDown, FX_DWORD nFlag) { if (m_bValid) { - CPDFSDK_PageView* pPageView = this->GetCurPageView(); + CPDFSDK_PageView* pPageView = GetCurPageView(); ASSERT(pPageView != NULL); if (CommitData(pPageView, nFlag)) diff --git a/fpdfsdk/src/formfiller/FFL_Notify.cpp b/fpdfsdk/src/formfiller/FFL_Notify.cpp index 406aa8d489..4fd2bd84ea 100644 --- a/fpdfsdk/src/formfiller/FFL_Notify.cpp +++ b/fpdfsdk/src/formfiller/FFL_Notify.cpp @@ -111,15 +111,17 @@ FX_BOOL CFFL_Notify::OnValidate(CPDF_FormField* pFormField, CFX_WideString& strV FX_BOOL CFFL_Notify::DoAAction(CPDF_AAction::AActionType eAAT, FX_BOOL & bExit) { - if (this->m_bDoActioning) return FALSE; - - CPDF_Action action; - if (!FindAAction(eAAT,action)) return FALSE; - - this->m_bDoActioning = TRUE; - ExecuteActionTree(eAAT,action,bExit); - this->m_bDoActioning = FALSE; - return TRUE; + if (m_bDoActioning) + return FALSE; + + CPDF_Action action; + if (!FindAAction(eAAT, action)) + return FALSE; + + m_bDoActioning = TRUE; + ExecuteActionTree(eAAT,action,bExit); + m_bDoActioning = FALSE; + return TRUE; } FX_BOOL CFFL_Notify::ExecuteActionTree(CPDF_AAction::AActionType eAAT,CPDF_Action & action, FX_BOOL& bExit) diff --git a/fpdfsdk/src/formfiller/FFL_TextField.cpp b/fpdfsdk/src/formfiller/FFL_TextField.cpp index cd0299ce1b..33fb751ff1 100644 --- a/fpdfsdk/src/formfiller/FFL_TextField.cpp +++ b/fpdfsdk/src/formfiller/FFL_TextField.cpp @@ -91,8 +91,7 @@ PWL_CREATEPARAM CFFL_TextField::GetCreateParam() if (!m_pFontMap) { - ASSERT(this->m_pApp != NULL); - m_pFontMap = new CBA_FontMap(m_pWidget, /*ISystemHandle::GetSystemHandler(m_pApp)*/m_pApp->GetSysHandler()); + m_pFontMap = new CBA_FontMap(m_pWidget, m_pApp->GetSysHandler()); m_pFontMap->Initial(); } cp.pFontMap = m_pFontMap; @@ -142,7 +141,7 @@ FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFl case FWL_VKEY_Return: if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_MULTILINE)) { - CPDFSDK_PageView* pPageView = this->GetCurPageView(); + CPDFSDK_PageView* pPageView = GetCurPageView(); ASSERT(pPageView != NULL); m_bValid = !m_bValid; CPDF_Rect rcAnnot = pAnnot->GetRect(); @@ -169,7 +168,7 @@ FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFl break; case FWL_VKEY_Escape: { - CPDFSDK_PageView* pPageView = this->GetCurPageView(); + CPDFSDK_PageView* pPageView = GetCurPageView(); ASSERT(pPageView != NULL); EscapeFiller(pPageView,TRUE); return TRUE; @@ -308,10 +307,10 @@ CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bR if (bRestoreValue) { RestoreState(pPageView); - pRet = this->GetPDFWindow(pPageView, FALSE); + pRet = GetPDFWindow(pPageView, FALSE); } else - pRet = this->GetPDFWindow(pPageView, TRUE); + pRet = GetPDFWindow(pPageView, TRUE); m_pWidget->UpdateField(); diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp index 0b3ca090b1..a515e3e339 100644 --- a/fpdfsdk/src/fpdfppo.cpp +++ b/fpdfsdk/src/fpdfppo.cpp @@ -180,7 +180,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document *pSrcPDFDoc, CFX_WordArray* pMapPtrToPtr->SetAt((void*)(uintptr_t)dwOldPageObj, (void*)(uintptr_t)dwNewPageObj); - this->UpdateReference(pCurPageDict, pDestPDFDoc, pMapPtrToPtr); + UpdateReference(pCurPageDict, pDestPDFDoc, pMapPtrToPtr); curpage++; } diff --git a/fpdfsdk/src/fsdk_actionhandler.cpp b/fpdfsdk/src/fsdk_actionhandler.cpp index 1f61a8c797..b790585a6a 100644 --- a/fpdfsdk/src/fsdk_actionhandler.cpp +++ b/fpdfsdk/src/fsdk_actionhandler.cpp @@ -106,14 +106,14 @@ FX_BOOL CPDFSDK_ActionHandler::DoAction_BookMark(CPDF_Bookmark *pBookMark, const CPDFSDK_Document* pDocument) { CFX_PtrList list; - return this->ExecuteBookMark(action, pDocument, pBookMark, list); + return ExecuteBookMark(action, pDocument, pBookMark, list); } FX_BOOL CPDFSDK_ActionHandler::DoAction_Screen(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CPDFSDK_Annot* pScreen) { CFX_PtrList list; - return this->ExecuteScreenAction(action, type, pDocument, pScreen, list); + return ExecuteScreenAction(action, type, pDocument, pScreen, list); } FX_BOOL CPDFSDK_ActionHandler::DoAction_Link(const CPDF_Action& action, diff --git a/fpdfsdk/src/fsdk_annothandler.cpp b/fpdfsdk/src/fsdk_annothandler.cpp index a44b34b02f..30abd0816f 100644 --- a/fpdfsdk/src/fsdk_annothandler.cpp +++ b/fpdfsdk/src/fsdk_annothandler.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/fsdk_define.h" @@ -33,9 +33,9 @@ CPDFSDK_AnnotHandlerMgr::~CPDFSDK_AnnotHandlerMgr() void CPDFSDK_AnnotHandlerMgr::RegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler) { ASSERT(pAnnotHandler != NULL); - + ASSERT(GetAnnotHandler(pAnnotHandler->GetType()) == NULL); - + m_Handlers.Add(pAnnotHandler); m_mapType2Handler.SetAt(pAnnotHandler->GetType(), (void*)pAnnotHandler); } @@ -43,9 +43,9 @@ void CPDFSDK_AnnotHandlerMgr::RegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotH void CPDFSDK_AnnotHandlerMgr::UnRegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler) { ASSERT(pAnnotHandler != NULL); - + m_mapType2Handler.RemoveKey(pAnnotHandler->GetType()); - + for (int i=0, sz=m_Handlers.GetSize(); iGetSubType())) { return pAnnotHandler->NewAnnot(pAnnot, pPageView); } - + return new CPDFSDK_Annot(pAnnot, pPageView); } void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { ASSERT(pAnnot != NULL); - + pAnnot->GetPDFPage(); - + if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { pAnnotHandler->OnRelease(pAnnot); @@ -89,13 +89,13 @@ void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) { ASSERT(pAnnot != NULL); - + CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); - + CPDFSDK_DateTime curTime; pPDFAnnot->GetAnnotDict()->SetAtString("M", curTime.ToPDFDateTimeString()); pPDFAnnot->GetAnnotDict()->SetAtNumber("F", 0); - + if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { pAnnotHandler->OnCreate(pAnnot); @@ -105,7 +105,7 @@ void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) { ASSERT(pAnnot != NULL); - + if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { pAnnotHandler->OnLoad(pAnnot); @@ -115,24 +115,24 @@ void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(CPDFSDK_Annot* pAnnot) const { ASSERT(pAnnot != NULL); - + CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); ASSERT(pPDFAnnot != NULL); - + return GetAnnotHandler(pPDFAnnot->GetSubType()); } IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(const CFX_ByteString& sType) const { void* pRet = NULL; - m_mapType2Handler.Lookup(sType, pRet); + m_mapType2Handler.Lookup(sType, pRet); return (IPDFSDK_AnnotHandler*)pRet; } void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,FX_DWORD dwFlags) { ASSERT(pAnnot != NULL); - + if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { pAnnotHandler->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); @@ -147,7 +147,7 @@ void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { ASSERT(pAnnot != NULL); - + if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { return pAnnotHandler->OnLButtonDown(pPageView, pAnnot, nFlags, point); @@ -167,7 +167,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp(CPDFSDK_PageView * pPageView, FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { ASSERT(pAnnot != NULL); - + if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { return pAnnotHandler->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); @@ -177,7 +177,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk(CPDFSDK_PageView * pPageV FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { ASSERT(pAnnot != NULL); - + if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { return pAnnotHandler->OnMouseMove(pPageView, pAnnot, nFlags, point); @@ -187,7 +187,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(CPDFSDK_PageView * pPageView, FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) { ASSERT(pAnnot != NULL); - + if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { return pAnnotHandler->OnMouseWheel(pPageView, pAnnot,nFlags,zDelta, point); @@ -197,7 +197,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(CPDFSDK_PageView * pPageView FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { ASSERT(pAnnot != NULL); - + if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { return pAnnotHandler->OnRButtonDown(pPageView, pAnnot, nFlags, point); @@ -207,7 +207,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown(CPDFSDK_PageView * pPageVie FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { ASSERT(pAnnot != NULL); - + if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { return pAnnotHandler->OnRButtonUp(pPageView, pAnnot, nFlags, point); @@ -218,7 +218,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(CPDFSDK_PageView * pPageView, void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) { ASSERT(pAnnot != NULL); - + if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { pAnnotHandler->OnMouseEnter(pPageView, pAnnot, nFlag); @@ -229,7 +229,7 @@ void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView * pPageView, C void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) { ASSERT(pAnnot != NULL); - + if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { pAnnotHandler->OnMouseExit(pPageView, pAnnot, nFlag); @@ -300,24 +300,24 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DW return FALSE; } } - + return FALSE; } FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) { ASSERT(pAnnot != NULL); - + if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { if (pAnnotHandler->OnKillFocus(pAnnot, nFlag)) - { + { return TRUE; } else return FALSE; } - + return FALSE; } @@ -344,13 +344,8 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView *pPageView, CP CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,FX_BOOL bNext) { - CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget", ""); - - CPDFSDK_Annot* pNext = bNext ? - ai.GetNextAnnot(pSDKAnnot) : - ai.GetPrevAnnot(pSDKAnnot); - - return pNext; + CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget", ""); + return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); } FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) @@ -358,7 +353,7 @@ FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) ASSERT(pAnnot); ASSERT(pAnnot->GetType() == "Widget"); CFX_ByteString sSubType = pAnnot->GetSubType(); - + if (sSubType == BFFT_SIGNATURE) { } @@ -375,13 +370,13 @@ FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { 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_ANNOT_FORM); } } @@ -393,12 +388,12 @@ CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_Pag { ASSERT(pPage != NULL); pPage->GetPDFDocument(); - + CPDFSDK_Document* pSDKDoc = m_pApp->GetCurrentDoc(); ASSERT(pSDKDoc); CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterForm(); ASSERT(pInterForm != NULL); - + CPDFSDK_Widget* pWidget = NULL; if (CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl(pInterForm->GetInterForm(), pAnnot->GetAnnotDict())) { @@ -408,7 +403,7 @@ CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_Pag if(pPDFInterForm && pPDFInterForm->NeedConstructAP()) pWidget->ResetAppearance(NULL,FALSE); } - + return pWidget; } @@ -418,14 +413,14 @@ void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) if (m_pFormFiller) m_pFormFiller->OnDelete(pAnnot); - + CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); ASSERT(pInterForm != NULL); - + CPDF_FormControl* pCtrol = pWidget->GetFormControl(); pInterForm->RemoveMap(pCtrol); - + delete pWidget; } @@ -435,7 +430,7 @@ void CPDFSDK_BFAnnotHandler::OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* { ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); - + if (sSubType == BFFT_SIGNATURE) { pAnnot->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); @@ -449,11 +444,11 @@ void CPDFSDK_BFAnnotHandler::OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* } } -void CPDFSDK_BFAnnotHandler::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) +void CPDFSDK_BFAnnotHandler::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) { ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); - + if (sSubType == BFFT_SIGNATURE) { } @@ -462,14 +457,14 @@ void CPDFSDK_BFAnnotHandler::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_A if (m_pFormFiller) m_pFormFiller->OnMouseEnter(pPageView, pAnnot, nFlag); } - + } -void CPDFSDK_BFAnnotHandler::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) +void CPDFSDK_BFAnnotHandler::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) { ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); - + if (sSubType == BFFT_SIGNATURE) { } @@ -478,13 +473,13 @@ void CPDFSDK_BFAnnotHandler::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_An if (m_pFormFiller) m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag); } - + } FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); - + if (sSubType == BFFT_SIGNATURE) { } @@ -493,7 +488,7 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFS if (m_pFormFiller) return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); } - + return FALSE; } @@ -501,7 +496,7 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK { ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); - + if (sSubType == BFFT_SIGNATURE) { } @@ -510,7 +505,7 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK if (m_pFormFiller) return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); } - + return FALSE; } @@ -518,7 +513,7 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPD { ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); - + if (sSubType == BFFT_SIGNATURE) { } @@ -527,12 +522,12 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPD if (m_pFormFiller) return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); } - + return FALSE; } FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) -{ +{ ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); @@ -554,7 +549,7 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSD { ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); - + if (sSubType == BFFT_SIGNATURE) { } @@ -563,7 +558,7 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSD if (m_pFormFiller) return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta,point); } - + return FALSE; } @@ -571,7 +566,7 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFS { ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); - + if (sSubType == BFFT_SIGNATURE) { } @@ -580,14 +575,14 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFS if (m_pFormFiller) return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); } - + return FALSE; } FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) { ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); - + if (sSubType == BFFT_SIGNATURE) { } @@ -596,7 +591,7 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK if (m_pFormFiller) return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); } - + return FALSE; } @@ -604,7 +599,7 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX { ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); - + if (sSubType == BFFT_SIGNATURE) { } @@ -613,7 +608,7 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX if (m_pFormFiller) return m_pFormFiller->OnChar(pAnnot,nChar, nFlags); } - + return FALSE; } @@ -621,7 +616,7 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, i { ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); - + if (sSubType == BFFT_SIGNATURE) { } @@ -630,7 +625,7 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, i if (m_pFormFiller) return m_pFormFiller->OnKeyDown(pAnnot,nKeyCode, nFlag); } - + return FALSE; } @@ -639,11 +634,11 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int return FALSE; } -void CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) +void CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) { ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); - + if (sSubType == BFFT_SIGNATURE) { } @@ -657,9 +652,9 @@ void CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) { ASSERT(pAnnot != NULL); - + CFX_ByteString sSubType = pAnnot->GetSubType(); - + if (sSubType == BFFT_SIGNATURE) { } @@ -689,7 +684,7 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag { ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); - + if (sSubType == BFFT_SIGNATURE) { } @@ -698,14 +693,14 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag if (m_pFormFiller) return m_pFormFiller->OnSetFocus(pAnnot,nFlag); } - + return TRUE; } FX_BOOL CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) { ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); - + if (sSubType == BFFT_SIGNATURE) { } @@ -714,7 +709,7 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFla if (m_pFormFiller) return m_pFormFiller->OnKillFocus(pAnnot,nFlag); } - + return TRUE; } @@ -722,7 +717,7 @@ CPDF_Rect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView *pPageView, CPDFS { ASSERT(pAnnot != NULL); CFX_ByteString sSubType = pAnnot->GetSubType(); - + if (sSubType == BFFT_SIGNATURE) { } @@ -732,7 +727,7 @@ CPDF_Rect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView *pPageView, CPDFS return m_pFormFiller->GetViewBBox(pPageView, pAnnot); } - + return CPDF_Rect(0,0,0,0); } @@ -760,107 +755,106 @@ CPDFSDK_AnnotIterator::CPDFSDK_AnnotIterator(CPDFSDK_PageView * pPageView,FX_BOO InitIteratorAnnotList(pPageView,pList); } -CPDFSDK_Annot* CPDFSDK_AnnotIterator::NextAnnot (const CPDFSDK_Annot* pCurrent) +CPDFSDK_Annot* CPDFSDK_AnnotIterator::NextAnnot (const CPDFSDK_Annot* pCurrent) { - - int index=-1; - int nCount=this->m_pIteratorAnnotList.GetSize(); - if(pCurrent){ + + int index = -1; + int nCount = m_pIteratorAnnotList.GetSize(); + if (pCurrent) { for(int i=0;im_pIteratorAnnotList.GetSize(); + int index = -1; + int nCount = m_pIteratorAnnotList.GetSize(); if(pCurrent){ for(int i=0;i0) ? (index-1) :nCount-1; + else{ + if(m_bCircle){ + index = ( index >0) ? (index-1) :nCount-1; } else{ - index = ( index >0) ? (index-1) :-1; - } + index = ( index >0) ? (index-1) :-1; + } } } - return (index <0) ? NULL : (CPDFSDK_Annot*)m_pIteratorAnnotList.GetAt(index); + return (index <0) ? NULL : (CPDFSDK_Annot*)m_pIteratorAnnotList.GetAt(index); } -CPDFSDK_Annot*CPDFSDK_AnnotIterator::Next(const CPDFSDK_Annot* pCurrent) +CPDFSDK_Annot*CPDFSDK_AnnotIterator::Next(const CPDFSDK_Annot* pCurrent) { - return (m_bReverse) ? PrevAnnot(pCurrent):NextAnnot(pCurrent); + return (m_bReverse) ? PrevAnnot(pCurrent):NextAnnot(pCurrent); } -CPDFSDK_Annot* CPDFSDK_AnnotIterator::Prev(const CPDFSDK_Annot* pCurrent) +CPDFSDK_Annot* CPDFSDK_AnnotIterator::Prev(const CPDFSDK_Annot* pCurrent) { - return (m_bReverse) ? NextAnnot(pCurrent):PrevAnnot(pCurrent); + return (m_bReverse) ? NextAnnot(pCurrent):PrevAnnot(pCurrent); } CPDFSDK_Annot*CPDFSDK_AnnotIterator::Next(int& index ) { - - return (m_bReverse) ? PrevAnnot(index):NextAnnot(index); - + + return (m_bReverse) ? PrevAnnot(index):NextAnnot(index); + } CPDFSDK_Annot* CPDFSDK_AnnotIterator::Prev(int& index ) { - - return (m_bReverse) ? NextAnnot(index):PrevAnnot(index); + + return (m_bReverse) ? NextAnnot(index):PrevAnnot(index); } @@ -872,7 +866,7 @@ void CPDFSDK_AnnotIterator::InsertSort(CFX_PtrArray &arrayList, AI_COMPARE pComp { int j = i-1; CPDFSDK_Annot* pTemp = (CPDFSDK_Annot*)arrayList[i]; - + do { arrayList[j + 1] = arrayList[j]; @@ -896,14 +890,12 @@ int LyOrderCompare(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) FX_BOOL CPDFSDK_AnnotIterator::InitIteratorAnnotList(CPDFSDK_PageView* pPageView,CFX_PtrArray * pAnnotList) { ASSERT(pPageView); - - - if(pAnnotList==NULL){ + if(pAnnotList==NULL){ pAnnotList=pPageView->GetAnnotList(); } - this->m_pIteratorAnnotList.RemoveAll(); + m_pIteratorAnnotList.RemoveAll(); if(!pAnnotList) return FALSE; CPDFSDK_Annot * pTopMostAnnot= (m_bIgnoreTopmost) ? NULL : pPageView->GetFocusAnnot(); @@ -914,7 +906,7 @@ FX_BOOL CPDFSDK_AnnotIterator::InitIteratorAnnotList(CPDFSDK_PageView* pPageView for(int i = nCount- 1 ;i >= 0;i--) { CPDFSDK_Annot * pReaderAnnot= (CPDFSDK_Annot*)pAnnotList->GetAt(i); - m_pIteratorAnnotList.Add(pReaderAnnot); + m_pIteratorAnnotList.Add(pReaderAnnot); } InsertSort(m_pIteratorAnnotList,&LyOrderCompare); @@ -929,7 +921,7 @@ FX_BOOL CPDFSDK_AnnotIterator::InitIteratorAnnotList(CPDFSDK_PageView* pPageView m_pIteratorAnnotList.RemoveAt(i); m_pIteratorAnnotList.InsertAt(0, pReaderAnnot); break; - } + } } } diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp index c94da1d5cd..f18180bf71 100644 --- a/fpdfsdk/src/fsdk_baseform.cpp +++ b/fpdfsdk/src/fsdk_baseform.cpp @@ -70,7 +70,7 @@ FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode { CPDF_Dictionary* pSubDict = (CPDF_Dictionary*)psub; - return pSubDict->GetStream(this->GetAppState()) != NULL; + return pSubDict->GetStream(GetAppState()) != NULL; } else return FALSE; @@ -152,7 +152,7 @@ CPDF_FormControl* CPDFSDK_Widget::GetFormControl(CPDF_InterForm* pInterForm, CPD int CPDFSDK_Widget::GetRotate() const { - CPDF_FormControl* pCtrl = this->GetFormControl(); + CPDF_FormControl* pCtrl = GetFormControl(); ASSERT(pCtrl != NULL); return pCtrl->GetRotation() % 360; @@ -411,11 +411,11 @@ void CPDFSDK_Widget::DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matrix if ((nFieldType == FIELDTYPE_CHECKBOX || nFieldType == FIELDTYPE_RADIOBUTTON) && mode == CPDF_Annot::Normal && - !this->IsWidgetAppearanceValid(CPDF_Annot::Normal)) + !IsWidgetAppearanceValid(CPDF_Annot::Normal)) { CFX_PathData pathData; - CPDF_Rect rcAnnot = this->GetRect(); + CPDF_Rect rcAnnot = GetRect(); pathData.AppendRect(rcAnnot.left, rcAnnot.bottom, rcAnnot.right, rcAnnot.top); @@ -634,8 +634,6 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() CPDF_IconFit iconFit = pControl->GetIconFit(); -// ASSERT(this->m_pBaseForm != NULL); - ASSERT(this->m_pInterForm != NULL); CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); ASSERT(pDoc != NULL); CPDFDoc_Environment* pEnv = pDoc->GetEnv(); @@ -1038,7 +1036,6 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) { pEdit->EnableRefresh(FALSE); - ASSERT(this->m_pInterForm != NULL); CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); ASSERT(pDoc != NULL); CPDFDoc_Environment* pEnv = pDoc->GetEnv(); @@ -1053,7 +1050,7 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) pEdit->SetPlateRect(rcEdit); pEdit->SetAlignmentV(1); - FX_FLOAT fFontSize = this->GetFontSize(); + FX_FLOAT fFontSize = GetFontSize(); if (IsFloatZero(fFontSize)) pEdit->SetAutoFontSize(TRUE); else @@ -1115,8 +1112,6 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() { pEdit->EnableRefresh(FALSE); -// ASSERT(this->m_pBaseForm != NULL); - ASSERT(this->m_pInterForm != NULL); CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); ASSERT(pDoc != NULL); CPDFDoc_Environment* pEnv = pDoc->GetEnv(); @@ -1207,8 +1202,6 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) { pEdit->EnableRefresh(FALSE); -// ASSERT(this->m_pBaseForm != NULL); - ASSERT(this->m_pInterForm != NULL); CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); ASSERT(pDoc != NULL); CPDFDoc_Environment* pEnv = pDoc->GetEnv(); @@ -1617,7 +1610,7 @@ CPDF_Action CPDFSDK_Widget::GetAAction(CPDF_AAction::AActionType eAAT) case CPDF_AAction::Validate: case CPDF_AAction::Calculate: { - CPDF_FormField* pField = this->GetFormField(); + CPDF_FormField* pField = GetFormField(); if (CPDF_AAction aa = pField->GetAdditionalAction()) return aa.GetAction(eAAT); @@ -1917,7 +1910,7 @@ void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) m_bBusy = TRUE; - if (this->IsCalculateEnabled()) + if (IsCalculateEnabled()) { IFXJS_Runtime* pRuntime = m_pDocument->GetJsRuntime(); ASSERT(pRuntime != NULL); @@ -2509,14 +2502,14 @@ int CPDFSDK_InterForm::AfterValueChange(const CPDF_FormField* pField) if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) { - this->OnCalculate(pFormField); + OnCalculate(pFormField); FX_BOOL bFormated = FALSE; - CFX_WideString sValue = this->OnFormat(pFormField, bFormated); + CFX_WideString sValue = OnFormat(pFormField, bFormated); if (bFormated) - this->ResetFieldAppearance(pFormField, sValue.c_str(), TRUE); + ResetFieldAppearance(pFormField, sValue.c_str(), TRUE); else - this->ResetFieldAppearance(pFormField, NULL, TRUE); - this->UpdateField(pFormField); + ResetFieldAppearance(pFormField, NULL, TRUE); + UpdateField(pFormField); } return 0; @@ -2557,9 +2550,9 @@ int CPDFSDK_InterForm::AfterSelectionChange(const CPDF_FormField* pField) if (nType == FIELDTYPE_LISTBOX) { - this->OnCalculate(pFormField); - this->ResetFieldAppearance(pFormField, NULL, TRUE); - this->UpdateField(pFormField); + OnCalculate(pFormField); + ResetFieldAppearance(pFormField, NULL, TRUE); + UpdateField(pFormField); } return 0; @@ -2574,9 +2567,8 @@ int CPDFSDK_InterForm::AfterCheckedStatusChange(const CPDF_FormField* pField, co if (nType == FIELDTYPE_CHECKBOX || nType == FIELDTYPE_RADIOBUTTON) { - this->OnCalculate(pFormField); - //this->ResetFieldAppearance(pFormField, NULL); - this->UpdateField(pFormField); + OnCalculate(pFormField); + UpdateField(pFormField); } return 0; @@ -2589,9 +2581,8 @@ int CPDFSDK_InterForm::BeforeFormReset(const CPDF_InterForm* pForm) int CPDFSDK_InterForm::AfterFormReset(const CPDF_InterForm* pForm) { - this->OnCalculate(NULL); - - return 0; + OnCalculate(nullptr); + return 0; } int CPDFSDK_InterForm::BeforeFormImportData(const CPDF_InterForm* pForm) @@ -2601,9 +2592,8 @@ int CPDFSDK_InterForm::BeforeFormImportData(const CPDF_InterForm* pForm) int CPDFSDK_InterForm::AfterFormImportData(const CPDF_InterForm* pForm) { - this->OnCalculate(NULL); - - return 0; + OnCalculate(nullptr); + return 0; } FX_BOOL CPDFSDK_InterForm::IsNeedHighLight(int nFieldType) diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp index a8fd5eee7f..1e57dc7b4e 100644 --- a/fpdfsdk/src/fsdk_mgr.cpp +++ b/fpdfsdk/src/fsdk_mgr.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 "../../public/fpdf_ext.h" @@ -29,16 +29,16 @@ public: virtual CFX_WideString GetClipboardText(FX_HWND hWnd){return L"";} virtual FX_BOOL SetClipboardText(FX_HWND hWnd, CFX_WideString string) {return FALSE;} - + virtual void ClientToScreen(FX_HWND hWnd, int32_t& x, int32_t& y) {} virtual void ScreenToClient(FX_HWND hWnd, int32_t& x, int32_t& y) {} /*cursor style - FXCT_ARROW - FXCT_NESW - FXCT_NWSE - FXCT_VBEAM - FXCT_HBEAM + FXCT_ARROW + FXCT_NESW + FXCT_NWSE + FXCT_VBEAM + FXCT_HBEAM FXCT_HAND */ virtual void SetCursor(int32_t nCursorType); @@ -109,7 +109,7 @@ void CFX_SystemHandler::OutputSelectedRect(void* pFormFiller, CPDF_Rect& rect) CPDF_Point leftbottom = CPDF_Point(rect.left, rect.bottom); CPDF_Point righttop = CPDF_Point(rect.right, rect.top); CPDF_Point ptA = pFFL->PWLtoFFL(leftbottom); - CPDF_Point ptB = pFFL->PWLtoFFL(righttop); + CPDF_Point ptB = pFFL->PWLtoFFL(righttop); CPDFSDK_Annot* pAnnot = pFFL->GetSDKAnnot(); @@ -118,7 +118,7 @@ void CFX_SystemHandler::OutputSelectedRect(void* pFormFiller, CPDF_Rect& rect) ASSERT(pPage); m_pEnv->FFI_OutputSelectedRect(pPage, ptA.x, ptB.y, ptB.x, ptA.y); } - + } FX_BOOL CFX_SystemHandler::IsSelectionImplemented() @@ -137,7 +137,7 @@ CFX_ByteString CFX_SystemHandler::GetNativeTrueTypeFont(int32_t nCharset) return ""; } -FX_BOOL CFX_SystemHandler::FindNativeTrueTypeFont(int32_t nCharset, CFX_ByteString sFontFaceName) +FX_BOOL CFX_SystemHandler::FindNativeTrueTypeFont(int32_t nCharset, CFX_ByteString sFontFaceName) { CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); // FXFT_Face nFace = pFontMgr->FindSubstFont(sFontFaceName,TRUE,0,0,0,0,NULL); @@ -147,14 +147,14 @@ FX_BOOL CFX_SystemHandler::FindNativeTrueTypeFont(int32_t nCharset, CFX_ByteStri { CFX_FontMapper* pFontMapper = pFontMgr->m_pBuiltinMapper; if(pFontMapper) - { + { int nSize = pFontMapper->m_InstalledTTFonts.GetSize(); if(nSize ==0) { pFontMapper->LoadInstalledFonts(); nSize = pFontMapper->m_InstalledTTFonts.GetSize(); } - + for(int i=0; im_InstalledTTFonts[i].Compare(sFontFaceName)) @@ -181,8 +181,8 @@ static int CharSet2CP(int charset) return 950; return 0; } -CPDF_Font* CFX_SystemHandler::AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, CFX_ByteString sFontFaceName, - uint8_t nCharset) +CPDF_Font* CFX_SystemHandler::AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, CFX_ByteString sFontFaceName, + uint8_t nCharset) { if(pDoc) { @@ -231,7 +231,7 @@ CPDFDoc_Environment::CPDFDoc_Environment(CPDF_Document* pDoc) : m_pSysHandler = NULL; m_pSysHandler = new CFX_SystemHandler(this); - + m_pJSRuntimeFactory = NULL; m_pJSRuntimeFactory = GetJSRuntimeFactory(); m_pJSRuntimeFactory->AddRef(); @@ -296,7 +296,7 @@ CPDFSDK_ActionHandler* CPDFDoc_Environment::GetActionHander() int CPDFDoc_Environment::RegAppHandle(FPDF_FORMFILLINFO* pFFinfo) { - m_pInfo = pFFinfo; + m_pInfo = pFFinfo; return TRUE; } @@ -386,10 +386,8 @@ CPDFSDK_PageView* CPDFSDK_Document::GetPageView(CPDF_Page* pPDFPage, FX_BOOL ReN CPDFSDK_PageView* CPDFSDK_Document::GetCurrentView() { - CPDF_Page * pPage = (CPDF_Page *)m_pEnv->FFI_GetCurrentPage(m_pDoc); - if(pPage) - return this->GetPageView(pPage, TRUE); - return NULL; + CPDF_Page* pPage = (CPDF_Page*)m_pEnv->FFI_GetCurrentPage(m_pDoc); + return pPage ? GetPageView(pPage, TRUE) : nullptr; } CPDFSDK_PageView* CPDFSDK_Document::GetPageView(int nIndex) @@ -400,15 +398,15 @@ CPDFSDK_PageView* CPDFSDK_Document::GetPageView(int nIndex) return NULL; m_pageMap.Lookup(pTempPage, pTempPageView); - + ASSERT(pTempPageView != NULL); - + return pTempPageView; } void CPDFSDK_Document:: ProcJavascriptFun() { - CPDF_Document* pPDFDoc = this->GetDocument(); + CPDF_Document* pPDFDoc = GetDocument(); CPDF_DocJSActions docJS(pPDFDoc); int iCount = docJS.CountJSActions(); if (iCount < 1) return; @@ -419,7 +417,7 @@ void CPDFSDK_Document:: ProcJavascriptFun() if(m_pEnv->GetActionHander()) m_pEnv->GetActionHander()->DoAction_JavaScript(jsAction,CFX_WideString::FromLocal(csJSName),this); } - + } FX_BOOL CPDFSDK_Document::ProcOpenAction() @@ -486,7 +484,7 @@ CPDFSDK_InterForm* CPDFSDK_Document::GetInterForm() void CPDFSDK_Document::UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot) { - + FX_POSITION pos = m_pageMap.GetStartPosition(); CPDF_Page * pPage = NULL; CPDFSDK_PageView * pPageView = NULL; @@ -503,17 +501,17 @@ void CPDFSDK_Document::UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* CPDFSDK_Annot* CPDFSDK_Document::GetFocusAnnot() { - return this->m_pFocusAnnot; + return m_pFocusAnnot; } FX_BOOL CPDFSDK_Document::SetFocusAnnot(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) { if(m_pFocusAnnot==pAnnot) return TRUE; - + if(m_pFocusAnnot) { - if(!this->KillFocusAnnot(nFlag) ) return FALSE; + if(!KillFocusAnnot(nFlag) ) return FALSE; } CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); if(pAnnot && pPageView->IsValid()) @@ -526,10 +524,10 @@ FX_BOOL CPDFSDK_Document::SetFocusAnnot(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) return FALSE; if(!m_pFocusAnnot) { - this->m_pFocusAnnot=pAnnot; + m_pFocusAnnot=pAnnot; return TRUE; } - } + } } return FALSE; } @@ -545,7 +543,7 @@ FX_BOOL CPDFSDK_Document::KillFocusAnnot(FX_UINT nFlag) m_pFocusAnnot = NULL; if(pAnnotHandler->Annot_OnKillFocus(pFocusAnnot, nFlag)) { - + if(pFocusAnnot->GetType() == FX_BSTRC("Widget")) { CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pFocusAnnot; @@ -602,7 +600,7 @@ IFXJS_Runtime * CPDFSDK_Document::GetJsRuntime() return m_pEnv->GetJSRuntime(); } -CFX_WideString CPDFSDK_Document::GetPath() +CFX_WideString CPDFSDK_Document::GetPath() { ASSERT(m_pEnv != NULL); return m_pEnv->JS_docGetFilePath(); @@ -631,7 +629,7 @@ CPDFSDK_PageView::CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc,CPDF_Page* page):m_ CPDFSDK_PageView::~CPDFSDK_PageView() { - CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); int nAnnotCount = m_fxAnnotArray.GetSize(); for (int i=0; iDisplayAnnots(m_page, pDevice, pUser2Device, FALSE, pOptions); - CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); - CPDFSDK_AnnotIterator annotIterator(this, TRUE); - CPDFSDK_Annot * pSDKAnnot=NULL; - int index=-1; - while((pSDKAnnot = annotIterator.Next(index))) - { - CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); - ASSERT(pAnnotHandlerMgr); - pAnnotHandlerMgr->Annot_OnDraw(this, pSDKAnnot, pDevice, pUser2Device, 0); - } + m_curMatrix = *pUser2Device; + CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); + CPDFSDK_AnnotIterator annotIterator(this, TRUE); + CPDFSDK_Annot* pSDKAnnot = nullptr; + int index = -1; + while ((pSDKAnnot = annotIterator.Next(index))) { + CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); + ASSERT(pAnnotHandlerMgr); + pAnnotHandlerMgr->Annot_OnDraw( + this, pSDKAnnot, pDevice, pUser2Device, 0); + } } CPDF_Annot* CPDFSDK_PageView::GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY) { - + int nCount = m_pAnnotList->Count(); for(int i = 0 ; iCount(); for(int i = 0 ; iGetType() == "Widget") - { + { pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot); CPDF_Point point(pageX, pageY); if (pAnnotMgr->Annot_OnHitTest(this, pSDKAnnot, point)) -// if(rc.Contains(pageX, pageY)) return pSDKAnnot; } } - + return NULL; } @@ -761,23 +756,23 @@ CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(CPDF_Annot * pPDFAnnot) { CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); ASSERT(pEnv); - CPDFSDK_AnnotHandlerMgr * pAnnotHandler= pEnv->GetAnnotHandlerMgr(); - + CPDFSDK_AnnotHandlerMgr * pAnnotHandler= pEnv->GetAnnotHandlerMgr(); + CPDFSDK_Annot* pSDKAnnot =NULL; - + if(pAnnotHandler) { pSDKAnnot = pAnnotHandler->NewAnnot(pPDFAnnot, this); } - if(!pSDKAnnot) + if(!pSDKAnnot) return NULL; - m_fxAnnotArray.Add(pSDKAnnot); - + m_fxAnnotArray.Add(pSDKAnnot); + if(pAnnotHandler) - { + { pAnnotHandler->Annot_OnCreate(pSDKAnnot); - + } return pSDKAnnot; @@ -785,9 +780,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(CPDF_Annot * pPDFAnnot) CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(CPDF_Dictionary * pDict) { - if(pDict) - return this->AddAnnot(pDict->GetString("Subtype"),pDict); - return NULL; + return pDict ? AddAnnot(pDict->GetString("Subtype"), pDict) : nullptr; } CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(const FX_CHAR* lpSubType,CPDF_Dictionary * pDict) @@ -912,7 +905,7 @@ FX_BOOL CPDFSDK_PageView::OnMouseMove(const CPDF_Point & point, int nFlag) else { if(m_bOnWidget) - { + { m_bOnWidget = FALSE; m_bExitWidget = TRUE; m_bEnterWidget = FALSE; @@ -924,7 +917,7 @@ FX_BOOL CPDFSDK_PageView::OnMouseMove(const CPDF_Point & point, int nFlag) } return FALSE; } - + return FALSE;; } @@ -992,8 +985,8 @@ void CPDFSDK_PageView::LoadFXAnnots() for(int i=0; iGetAt(i); - CPDF_Document * pDoc = this->GetPDFDocument(); - + CPDF_Document * pDoc = GetPDFDocument(); + CheckUnSupportAnnot(pDoc, pPDFAnnot); CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); @@ -1025,14 +1018,10 @@ void CPDFSDK_PageView::UpdateRects(CFX_RectArray& rects) void CPDFSDK_PageView::UpdateView(CPDFSDK_Annot* pAnnot) { - CPDF_Rect rcWindow; - - CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); -// CPDFSDK_AnnotHandlerMgr* pAnnotHandler = pEnv->GetAnnotHandlerMgr(); - - rcWindow = pAnnot->GetRect();//pAnnotHandler->Annot_OnGetViewBBox(this,pAnnot); - pEnv->FFI_Invalidate(m_page, rcWindow.left, rcWindow.top, rcWindow.right, rcWindow.bottom); - + CPDF_Rect rcWindow = pAnnot->GetRect(); + CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); + pEnv->FFI_Invalidate( + m_page, rcWindow.left, rcWindow.top, rcWindow.right, rcWindow.bottom); } int CPDFSDK_PageView::GetPageIndex() @@ -1067,7 +1056,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetFocusAnnot() CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); if(!pFocusAnnot) return NULL; - + for(int i=0; iSelectNone(); + SelectNone(); } else { @@ -1782,7 +1782,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place case EP_FONTINDEX: if (wordinfo.WordProps.nFontIndex != pWordProps->nFontIndex) { - if (IFX_Edit_FontMap* pFontMap = this->GetFontMap()) + if (IFX_Edit_FontMap* pFontMap = GetFontMap()) { wordinfo.WordProps.nFontIndex = pFontMap->GetWordFontIndex(wordinfo.Word,wordinfo.nCharset,pWordProps->nFontIndex); } @@ -2613,7 +2613,7 @@ void CFX_Edit::SetCaretInfo() void CFX_Edit::SetCaretChange() { - if (this->m_wpCaret == this->m_wpOldCaret) return; + if (m_wpCaret == m_wpOldCaret) return; if (m_bNotify && m_pVT->IsRichText() && m_pNotify) { @@ -3461,17 +3461,17 @@ void CFX_Edit::EnableRefresh(FX_BOOL bRefresh) void CFX_Edit::EnableUndo(FX_BOOL bUndo) { - this->m_bEnableUndo = bUndo; + m_bEnableUndo = bUndo; } void CFX_Edit::EnableNotify(FX_BOOL bNotify) { - this->m_bNotify = bNotify; + m_bNotify = bNotify; } void CFX_Edit::EnableOprNotify(FX_BOOL bNotify) { - this->m_bOprNotify = bNotify; + m_bOprNotify = bNotify; } FX_FLOAT CFX_Edit::GetLineTop(const CPVT_WordPlace& place) const @@ -3548,10 +3548,9 @@ CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, const FX_WCHA int32_t CFX_Edit::GetCharSetFromUnicode(FX_WORD word, int32_t nOldCharset) { - if (IFX_Edit_FontMap* pFontMap = this->GetFontMap()) - return pFontMap->CharSetFromUnicode(word, nOldCharset); - else - return nOldCharset; + if (IFX_Edit_FontMap* pFontMap = GetFontMap()) + return pFontMap->CharSetFromUnicode(word, nOldCharset); + return nOldCharset; } void CFX_Edit::BeginGroupUndo(const CFX_WideString& sTitle) diff --git a/fpdfsdk/src/fxedit/fxet_list.cpp b/fpdfsdk/src/fxedit/fxet_list.cpp index 6d48b30269..d94cc16c86 100644 --- a/fpdfsdk/src/fxedit/fxet_list.cpp +++ b/fpdfsdk/src/fxedit/fxet_list.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/fxedit/fxet_stub.h" @@ -102,7 +102,7 @@ FX_WORD CFX_ListItem::GetFirstChar() const if (IFX_Edit_Iterator* pIterator = GetIterator()) { - pIterator->SetAt(1); + pIterator->SetAt(1); pIterator->GetWord(word); } @@ -147,7 +147,7 @@ void CFX_List::SetFontSize(FX_FLOAT fFontSize) } void CFX_List::AddItem(const FX_WCHAR* str) -{ +{ if (CFX_ListItem * pListItem = new CFX_ListItem()) { pListItem->SetFontMap(m_pFontMap); @@ -163,18 +163,18 @@ void CFX_List::ReArrange(int32_t nItemIndex) if (CFX_ListItem * pPrevItem = m_aListItems.GetAt(nItemIndex - 1)) fPosY = pPrevItem->GetRect().bottom; - + for (int32_t i=nItemIndex,sz=m_aListItems.GetSize(); iGetItemHeight(); pListItem->SetRect(CLST_Rect(0.0f,fPosY,0.0f,fPosY + fListItemHeight)); - fPosY += fListItemHeight; + fPosY += fListItemHeight; } } - SetContentRect(CLST_Rect(0.0f,0.0f,0.0f,fPosY)); + SetContentRect(CLST_Rect(0.0f,0.0f,0.0f,fPosY)); } IFX_Edit * CFX_List::GetItemEdit(int32_t nIndex) const @@ -221,7 +221,7 @@ int32_t CFX_List::GetItemIndex(const CPDF_Point & point) const CLST_Rect rcListItem = pListItem->GetRect(); if (FX_EDIT_IsFloatBigger(pt.y, rcListItem.top)) - { + { bFirst = FALSE; } @@ -340,7 +340,7 @@ void CFX_List::SetItemCaret(int32_t nItemIndex, FX_BOOL bCaret) { if (CFX_ListItem * pListItem = m_aListItems.GetAt(nItemIndex)) { - pListItem->SetCaret(bCaret); + pListItem->SetCaret(bCaret); } } @@ -387,7 +387,7 @@ void CPLST_Select::Add(int32_t nItemIndex) { int32_t nIndex = Find(nItemIndex); - if (nIndex < 0) + if (nIndex < 0) m_aItems.Add(new CPLST_Select_Item(nItemIndex,1)); else { @@ -488,7 +488,7 @@ void CPLST_Select::DeselectAll() void CPLST_Select::Done() { for (int32_t i=m_aItems.GetSize()-1; i>=0; i--) - { + { if (CPLST_Select_Item * pItem = m_aItems.GetAt(i)) { if (pItem->nState == -1) @@ -559,7 +559,7 @@ CPDF_Rect CFX_ListCtrl::OutToIn(const CPDF_Rect & rect) const void CFX_ListCtrl::OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) { - int32_t nHitIndex = this->GetItemIndex(point); + int32_t nHitIndex = GetItemIndex(point); if (IsMultipleSel()) { @@ -576,8 +576,8 @@ void CFX_ListCtrl::OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL b m_aSelItems.Add(nHitIndex); SelectItems(); m_bCtrlSel = TRUE; - } - + } + m_nFootIndex = nHitIndex; } else if (bShift) @@ -602,23 +602,23 @@ void CFX_ListCtrl::OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL b SetSingleSelect(nHitIndex); } - if (!this->IsItemVisible(nHitIndex)) - this->ScrollToListItem(nHitIndex); + if (!IsItemVisible(nHitIndex)) + ScrollToListItem(nHitIndex); } void CFX_ListCtrl::OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) { - int32_t nHitIndex = this->GetItemIndex(point); + int32_t nHitIndex = GetItemIndex(point); if (IsMultipleSel()) - { + { if (bCtrl) { if (m_bCtrlSel) m_aSelItems.Add(m_nFootIndex,nHitIndex); else - m_aSelItems.Sub(m_nFootIndex,nHitIndex); - + m_aSelItems.Sub(m_nFootIndex,nHitIndex); + SelectItems(); } else @@ -635,8 +635,8 @@ void CFX_ListCtrl::OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL b SetSingleSelect(nHitIndex); } - if (!this->IsItemVisible(nHitIndex)) - this->ScrollToListItem(nHitIndex); + if (!IsItemVisible(nHitIndex)) + ScrollToListItem(nHitIndex); } void CFX_ListCtrl::OnVK(int32_t nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl) @@ -662,7 +662,7 @@ void CFX_ListCtrl::OnVK(int32_t nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl) m_nFootIndex = nItemIndex; } - SetCaret(nItemIndex); + SetCaret(nItemIndex); } } else @@ -670,8 +670,8 @@ void CFX_ListCtrl::OnVK(int32_t nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl) SetSingleSelect(nItemIndex); } - if (!this->IsItemVisible(nItemIndex)) - this->ScrollToListItem(nItemIndex); + if (!IsItemVisible(nItemIndex)) + ScrollToListItem(nItemIndex); } void CFX_ListCtrl::OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) @@ -706,7 +706,7 @@ void CFX_ListCtrl::OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) FX_BOOL CFX_ListCtrl::OnChar(FX_WORD nChar,FX_BOOL bShift,FX_BOOL bCtrl) { - int32_t nIndex = GetLastSelected(); + int32_t nIndex = GetLastSelected(); int32_t nFindIndex = FindNext(nIndex,nChar); if (nFindIndex != nIndex) @@ -723,7 +723,7 @@ void CFX_ListCtrl::SetPlateRect(const CPDF_Rect & rect) { CFX_ListContainer::SetPlateRect(rect); m_ptScrollPos.x = rect.left; - SetScrollPos(CPDF_Point(rect.left,rect.top)); + SetScrollPos(CPDF_Point(rect.left,rect.top)); ReArrange(0); InvalidateItem(-1); } @@ -743,7 +743,7 @@ void CFX_ListCtrl::SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected) { if (!IsValid(nItemIndex)) return; - if (bSelected != this->IsItemSelected(nItemIndex)) + if (bSelected != IsItemSelected(nItemIndex)) { if (bSelected) { @@ -769,10 +769,10 @@ void CFX_ListCtrl::SetSingleSelect(int32_t nItemIndex) SetItemSelect(m_nSelItem,FALSE); InvalidateItem(m_nSelItem); } - + SetItemSelect(nItemIndex,TRUE); InvalidateItem(nItemIndex); - m_nSelItem = nItemIndex; + m_nSelItem = nItemIndex; } } @@ -780,8 +780,8 @@ void CFX_ListCtrl::SetCaret(int32_t nItemIndex) { if (!IsValid(nItemIndex)) return; - if (this->IsMultipleSel()) - { + if (IsMultipleSel()) + { int32_t nOldIndex = m_nCaretIndex; if (nOldIndex != nItemIndex) @@ -792,7 +792,7 @@ void CFX_ListCtrl::SetCaret(int32_t nItemIndex) SetItemCaret(nItemIndex,TRUE); InvalidateItem(nOldIndex); - InvalidateItem(nItemIndex); + InvalidateItem(nItemIndex); } } } @@ -839,7 +839,7 @@ void CFX_ListCtrl::SelectItems() switch(nState) { case 1: - SetMultipleSelect(nItemIndex, TRUE); + SetMultipleSelect(nItemIndex, TRUE); break; case -1: SetMultipleSelect(nItemIndex, FALSE); @@ -854,7 +854,7 @@ void CFX_ListCtrl::Select(int32_t nItemIndex) { if (!IsValid(nItemIndex)) return; - if (this->IsMultipleSel()) + if (IsMultipleSel()) { m_aSelItems.Add(nItemIndex); SelectItems(); @@ -865,8 +865,8 @@ void CFX_ListCtrl::Select(int32_t nItemIndex) FX_BOOL CFX_ListCtrl::IsItemVisible(int32_t nItemIndex) const { - CPDF_Rect rcPlate = this->GetPlateRect(); - CPDF_Rect rcItem = this->GetItemRect(nItemIndex); + CPDF_Rect rcPlate = GetPlateRect(); + CPDF_Rect rcItem = GetItemRect(nItemIndex); return rcItem.bottom >= rcPlate.bottom && rcItem.top <= rcPlate.top; } @@ -875,7 +875,7 @@ void CFX_ListCtrl::ScrollToListItem(int32_t nItemIndex) { if (!IsValid(nItemIndex)) return; - CPDF_Rect rcPlate = this->GetPlateRect(); + CPDF_Rect rcPlate = GetPlateRect(); CPDF_Rect rcItem = CFX_List::GetItemRect(nItemIndex); CPDF_Rect rcItemCtrl = GetItemRect(nItemIndex); @@ -905,7 +905,7 @@ void CFX_ListCtrl::SetScrollInfo() if (!m_bNotifyFlag) { m_bNotifyFlag = TRUE; - m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, + m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, rcContent.bottom, rcContent.top, GetFirstHeight(), rcPlate.Height()); m_bNotifyFlag = FALSE; } @@ -921,7 +921,7 @@ void CFX_ListCtrl::SetScrollPosY(FX_FLOAT fy) { if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.y,fy)) { - CPDF_Rect rcPlate = this->GetPlateRect(); + CPDF_Rect rcPlate = GetPlateRect(); CPDF_Rect rcContent = CFX_List::GetContentRect(); if (rcPlate.Height() > rcContent.Height()) @@ -943,7 +943,7 @@ void CFX_ListCtrl::SetScrollPosY(FX_FLOAT fy) m_ptScrollPos.y = fy; InvalidateItem(-1); - if (m_pNotify) + if (m_pNotify) { if (!m_bNotifyFlag) { @@ -970,7 +970,7 @@ void CFX_ListCtrl::SetTopItem(int32_t nIndex) { if (IsValid(nIndex)) { - this->GetPlateRect(); + GetPlateRect(); CPDF_Rect rcItem = CFX_List::GetItemRect(nIndex); SetScrollPosY(rcItem.top); } @@ -978,7 +978,7 @@ void CFX_ListCtrl::SetTopItem(int32_t nIndex) int32_t CFX_ListCtrl::GetTopItem() const { - int32_t nItemIndex = this->GetItemIndex(this->GetBTPoint()); + int32_t nItemIndex = GetItemIndex(GetBTPoint()); if (!IsItemVisible(nItemIndex) && IsItemVisible(nItemIndex + 1)) nItemIndex += 1; @@ -1004,9 +1004,8 @@ int32_t CFX_ListCtrl::GetItemIndex(const CPDF_Point & point) const CFX_WideString CFX_ListCtrl::GetText() const { - if (this->IsMultipleSel()) - return this->GetItemText(this->m_nCaretIndex); - else - return this->GetItemText(this->m_nSelItem); + if (IsMultipleSel()) + return GetItemText(m_nCaretIndex); + return GetItemText(m_nSelItem); } diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp index a45e96682b..576e12c021 100644 --- a/fpdfsdk/src/javascript/Field.cpp +++ b/fpdfsdk/src/javascript/Field.cpp @@ -3640,7 +3640,7 @@ FX_BOOL Field::getArray(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val Field* pField = (Field*)pJSField->GetEmbedObject(); ASSERT(pField != NULL); - pField->AttachField(this->m_pJSDoc, *pStr); + pField->AttachField(m_pJSDoc, *pStr); CJS_Value FormFieldValue(m_isolate); FormFieldValue = pJSField; diff --git a/fpdfsdk/src/javascript/global.cpp b/fpdfsdk/src/javascript/global.cpp index bbe5c02257..c3a337020d 100644 --- a/fpdfsdk/src/javascript/global.cpp +++ b/fpdfsdk/src/javascript/global.cpp @@ -295,17 +295,17 @@ void global_alternate::UpdateGlobalPersistentVariables() switch (pData->data.nType) { case JS_GLOBALDATA_TYPE_NUMBER: - this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NUMBER, pData->data.dData, false, "", v8::Local(), pData->bPersistent == 1); + SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NUMBER, pData->data.dData, false, "", v8::Local(), pData->bPersistent == 1); JS_PutObjectNumber(NULL,(JSFXObject)(*m_pJSObject), pData->data.sKey.UTF8Decode().c_str(), pData->data.dData); break; case JS_GLOBALDATA_TYPE_BOOLEAN: - this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_BOOLEAN, 0, (bool)(pData->data.bData == 1), "", v8::Local(), pData->bPersistent == 1); + SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_BOOLEAN, 0, (bool)(pData->data.bData == 1), "", v8::Local(), pData->bPersistent == 1); JS_PutObjectBoolean(NULL,(JSFXObject)(*m_pJSObject), pData->data.sKey.UTF8Decode().c_str(), (bool)(pData->data.bData == 1)); break; case JS_GLOBALDATA_TYPE_STRING: - this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_STRING, 0, false, pData->data.sData, v8::Local(), pData->bPersistent == 1); + SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_STRING, 0, false, pData->data.sData, v8::Local(), pData->bPersistent == 1); JS_PutObjectString(NULL, (JSFXObject)(*m_pJSObject), pData->data.sKey.UTF8Decode().c_str(), pData->data.sData.UTF8Decode().c_str()); @@ -317,14 +317,14 @@ void global_alternate::UpdateGlobalPersistentVariables() PutObjectProperty(pObj, &pData->data); - this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_OBJECT, 0, false, "", + SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_OBJECT, 0, false, "", (JSObject)pObj, pData->bPersistent == 1); JS_PutObjectObject(NULL,(JSFXObject)(*m_pJSObject), pData->data.sKey.UTF8Decode().c_str(), (JSObject)pObj); } break; case JS_GLOBALDATA_TYPE_NULL: - this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NULL, 0, false, "", v8::Local(), pData->bPersistent == 1); + SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NULL, 0, false, "", v8::Local(), pData->bPersistent == 1); JS_PutObjectNull(NULL,(JSFXObject)(*m_pJSObject), pData->data.sKey.UTF8Decode().c_str()); break; diff --git a/fpdfsdk/src/pdfwindow/PWL_Caret.cpp b/fpdfsdk/src/pdfwindow/PWL_Caret.cpp index cdc7d57a9b..e050f3400e 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Caret.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Caret.cpp @@ -131,7 +131,7 @@ CPDF_Rect CPWL_Caret::GetCaretRect() const { return CPDF_Rect(m_ptFoot.x, m_ptFoot.y, - m_ptHead.x + this->m_fWidth, + m_ptHead.x + m_fWidth, m_ptHead.y); } @@ -144,8 +144,8 @@ void CPWL_Caret::SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPD if (m_ptHead.x != ptHead.x || m_ptHead.y != ptHead.y || m_ptFoot.x != ptFoot.x || m_ptFoot.y != ptFoot.y) { - this->m_ptHead = ptHead; - this->m_ptFoot = ptFoot; + m_ptHead = ptHead; + m_ptFoot = ptFoot; m_bFlash = TRUE; //Move(GetCaretRect(),FALSE,TRUE); @@ -154,8 +154,8 @@ void CPWL_Caret::SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPD } else { - this->m_ptHead = ptHead; - this->m_ptFoot = ptFoot; + m_ptHead = ptHead; + m_ptFoot = ptFoot; EndTimer(); BeginTimer(PWL_CARET_FLASHINTERVAL); @@ -169,8 +169,8 @@ void CPWL_Caret::SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPD } else { - this->m_ptHead = CPDF_Point(0,0); - this->m_ptFoot = CPDF_Point(0,0); + m_ptHead = CPDF_Point(0, 0); + m_ptFoot = CPDF_Point(0, 0); m_bFlash = FALSE; if (IsVisible()) diff --git a/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp index 6ed64a4776..bde5d2323f 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp @@ -31,7 +31,7 @@ FX_BOOL CPWL_CBListBox::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag) ReleaseCapture(); m_bMouseDown = FALSE; - if (this->ClientHitTest(point)) + if (ClientHitTest(point)) { if (CPWL_Wnd * pParent = GetParentWindow()) { @@ -121,7 +121,7 @@ void CPWL_CBButton::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) { CFX_ByteTextBuf sButton; - CPDF_Point ptCenter = this->GetCenterPoint(); + CPDF_Point ptCenter = GetCenterPoint(); CPDF_Point pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN,ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); CPDF_Point pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN,ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); @@ -151,7 +151,7 @@ void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p if (IsVisible() && !rectWnd.IsEmpty()) { - CPDF_Point ptCenter = this->GetCenterPoint(); + CPDF_Point ptCenter = GetCenterPoint(); CPDF_Point pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN,ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); CPDF_Point pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN,ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f); diff --git a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp index 62f09eff2b..856adcf686 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp @@ -83,18 +83,14 @@ void CPWL_Edit::SetText(const FX_WCHAR* csText) void CPWL_Edit::RePosChildWnd() { - if (CPWL_ScrollBar * pVSB = this->GetVScrollBar()) - { - //if (pVSB->IsVisible()) - { - CPDF_Rect rcWindow = m_rcOldWindow; - CPDF_Rect rcVScroll = CPDF_Rect(rcWindow.right, - rcWindow.bottom, - rcWindow.right + PWL_SCROLLBAR_WIDTH, - rcWindow.top); - pVSB->Move(rcVScroll, TRUE, FALSE); - } - } + if (CPWL_ScrollBar * pVSB = GetVScrollBar()) { + CPDF_Rect rcWindow = m_rcOldWindow; + CPDF_Rect rcVScroll = CPDF_Rect(rcWindow.right, + rcWindow.bottom, + rcWindow.right + PWL_SCROLLBAR_WIDTH, + rcWindow.top); + pVSB->Move(rcVScroll, TRUE, FALSE); + } if (m_pEditCaret && !HasFlag(PES_TEXTOVERFLOW)) m_pEditCaret->SetClipRect(CPWL_Utils::InflateRect(GetClientRect(),1.0f)); //+1 for caret beside border @@ -106,7 +102,7 @@ CPDF_Rect CPWL_Edit::GetClientRect() const { CPDF_Rect rcClient = CPWL_Utils::DeflateRect(GetWindowRect(),(FX_FLOAT)(GetBorderWidth()+GetInnerBorderWidth())); - if (CPWL_ScrollBar * pVSB = this->GetVScrollBar()) + if (CPWL_ScrollBar * pVSB = GetVScrollBar()) { if (pVSB->IsVisible()) { @@ -391,7 +387,7 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) if (sText.GetLength() > 0) { - CPDF_Rect rcClient = this->GetClientRect(); + CPDF_Rect rcClient = GetClientRect(); sAppStream << "q\n/Tx BMC\n"; if (!HasFlag(PES_TEXTOVERFLOW)) @@ -479,14 +475,14 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser } IFX_SystemHandler* pSysHandler = GetSystemHandler(); IFX_Edit::DrawEdit(pDevice,pUser2Device,m_pEdit, - CPWL_Utils::PWLColorToFXColor(GetTextColor(),this->GetTransparency()), - CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(),this->GetTransparency()), + CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), + CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()), rcClip,CPDF_Point(0.0f,0.0f),pRange, pSysHandler, m_pFormFiller); if (HasFlag(PES_SPELLCHECK)) { CPWL_Utils::DrawEditSpellCheck(pDevice,pUser2Device,m_pEdit,rcClip, - CPDF_Point(0.0f,0.0f),pRange, this->GetCreationParam().pSpellCheck); + CPDF_Point(0.0f,0.0f),pRange, GetCreationParam().pSpellCheck); } } @@ -497,7 +493,7 @@ FX_BOOL CPWL_Edit::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) { if (m_bMouseDown) - this->InvalidateRect(); + InvalidateRect(); m_bMouseDown = TRUE; SetCapture(); @@ -540,7 +536,7 @@ FX_BOOL CPWL_Edit::OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag) IFX_SystemHandler* pSH = GetSystemHandler(); if (!pSH) return FALSE; - this->SetFocus(); + SetFocus(); CPVT_WordRange wrLatin = GetLatinWordsRange(point); CFX_WideString swLatin = m_pEdit->GetRangeText(wrLatin); @@ -579,7 +575,7 @@ FX_BOOL CPWL_Edit::OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag) } } - IPWL_Provider* pProvider = this->GetProvider(); + IPWL_Provider* pProvider = GetProvider(); if (HasFlag(PES_UNDO)) { @@ -604,7 +600,7 @@ FX_BOOL CPWL_Edit::OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag) pSH->AppendMenuItem(hPopup, WM_PWLEDIT_DELETE, pProvider ? pProvider->LoadPopupMenuString(5) : L"&Delete"); - CFX_WideString swText = pSH->GetClipboardText(this->GetAttachedHWnd()); + CFX_WideString swText = pSH->GetClipboardText(GetAttachedHWnd()); if (swText.IsEmpty()) pSH->EnableMenuItem(hPopup, WM_PWLEDIT_PASTE, FALSE); @@ -662,19 +658,19 @@ FX_BOOL CPWL_Edit::OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag) Redo(); break; case WM_PWLEDIT_CUT: - this->CutText(); + CutText(); break; case WM_PWLEDIT_COPY: - this->CopyText(); + CopyText(); break; case WM_PWLEDIT_PASTE: - this->PasteText(); + PasteText(); break; case WM_PWLEDIT_DELETE: - this->Clear(); + Clear(); break; case WM_PWLEDIT_SELECTALL: - this->SelectAll(); + SelectAll(); break; case WM_PWLEDIT_SUGGEST + 0: SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos)); @@ -847,7 +843,7 @@ void CPWL_Edit::SetCharArray(int32_t nCharArray) if (HasFlag(PWS_AUTOFONTSIZE)) { - if (IFX_Edit_FontMap* pFontMap = this->GetFontMap()) + if (IFX_Edit_FontMap* pFontMap = GetFontMap()) { FX_FLOAT fFontSize = GetCharArrayAutoFontSize(pFontMap->GetPDFFont(0), GetClientRect(), nCharArray); if (fFontSize > 0.0f) @@ -1077,13 +1073,13 @@ FX_BOOL CPWL_Edit::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD if (zDelta > 0) { - ptScroll.y += this->GetFontSize(); + ptScroll.y += GetFontSize(); } else { - ptScroll.y -= this->GetFontSize(); + ptScroll.y -= GetFontSize(); } - this->SetScrollPos(ptScroll); + SetScrollPos(ptScroll); return TRUE; } diff --git a/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp index 57b0c01782..f562076f1d 100644 --- a/fpdfsdk/src/pdfwindow/PWL_EditCtrl.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_EditCtrl.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/pdfwindow/PDFWindow.h" @@ -43,9 +43,9 @@ void CPWL_EditCtrl::OnCreate(PWL_CREATEPARAM & cp) void CPWL_EditCtrl::OnCreated() { - SetFontSize(this->GetCreationParam().fFontSize); + SetFontSize(GetCreationParam().fFontSize); - m_pEdit->SetFontMap(this->GetFontMap()); + m_pEdit->SetFontMap(GetFontMap()); m_pEdit->SetNotify(this); m_pEdit->Initialize(); } @@ -64,7 +64,7 @@ FX_BOOL CPWL_EditCtrl::IsWndHorV() void CPWL_EditCtrl::SetCursor() { - if (IsValid()) + if (IsValid()) { if (IFX_SystemHandler* pSH = GetSystemHandler()) { @@ -98,7 +98,7 @@ void CPWL_EditCtrl::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intp break; } break; - case PNM_SETSCROLLPOS: + case PNM_SETSCROLLPOS: switch (wParam) { case SBT_VSCROLL: @@ -124,9 +124,9 @@ void CPWL_EditCtrl::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intp { if (PWL_CARET_INFO * pCaretInfo = (PWL_CARET_INFO *)wParam) { - this->SetCaret(pCaretInfo->bVisible, + SetCaret(pCaretInfo->bVisible, pCaretInfo->ptHead, - pCaretInfo->ptFoot); + pCaretInfo->ptFoot); } } break; @@ -143,7 +143,7 @@ void CPWL_EditCtrl::CreateEditCaret(const PWL_CREATEPARAM & cp) { if (!m_pEditCaret) { - m_pEditCaret = new CPWL_Caret; + m_pEditCaret = new CPWL_Caret; m_pEditCaret->SetInvalidRect(GetClientRect()); PWL_CREATEPARAM ecp = cp; @@ -207,7 +207,7 @@ FX_BOOL CPWL_EditCtrl::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) switch (nChar) { - case FWL_VKEY_Delete: + case FWL_VKEY_Delete: Delete(); return TRUE; case FWL_VKEY_Insert: @@ -241,7 +241,7 @@ FX_BOOL CPWL_EditCtrl::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) default: break; } - + return bRet; } @@ -256,7 +256,7 @@ FX_BOOL CPWL_EditCtrl::OnChar(FX_WORD nChar, FX_DWORD nFlag) { case 0x0A: case 0x1B: - return FALSE; + return FALSE; default: break; } @@ -272,16 +272,16 @@ FX_BOOL CPWL_EditCtrl::OnChar(FX_WORD nChar, FX_DWORD nFlag) switch (nChar) { case 'C' - 'A' + 1: - this->CopyText(); + CopyText(); return TRUE; case 'V' - 'A' + 1: - this->PasteText(); + PasteText(); return TRUE; case 'X' - 'A' + 1: - this->CutText(); + CutText(); return TRUE; case 'A' - 'A' + 1: - this->SelectAll(); + SelectAll(); return TRUE; case 'Z' - 'A' + 1: if (bShift) @@ -307,7 +307,7 @@ FX_BOOL CPWL_EditCtrl::OnChar(FX_WORD nChar, FX_DWORD nFlag) case FWL_VKEY_Back: Backspace(); break; - case FWL_VKEY_Return: + case FWL_VKEY_Return: InsertReturn(); break; case FWL_VKEY_Unknown: @@ -315,7 +315,7 @@ FX_BOOL CPWL_EditCtrl::OnChar(FX_WORD nChar, FX_DWORD nFlag) default: if (IsINSERTpressed(nFlag)) Delete(); - InsertWord(word, this->GetCharSet()); + InsertWord(word, GetCharSet()); break; } @@ -327,11 +327,11 @@ FX_BOOL CPWL_EditCtrl::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) CPWL_Wnd::OnLButtonDown(point,nFlag); if (ClientHitTest(point)) - { + { if (m_bMouseDown) - this->InvalidateRect(); + InvalidateRect(); - m_bMouseDown = TRUE; + m_bMouseDown = TRUE; SetCapture(); m_pEdit->OnMouseDown(point,IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag)); @@ -347,8 +347,8 @@ FX_BOOL CPWL_EditCtrl::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag) if (m_bMouseDown) { //can receive keybord message - if (ClientHitTest(point) && !this->IsFocused()) - SetFocus(); + if (ClientHitTest(point) && !IsFocused()) + SetFocus(); ReleaseCapture(); m_bMouseDown = FALSE; @@ -382,7 +382,7 @@ void CPWL_EditCtrl::SetEditCaret(FX_BOOL bVisible) } CPVT_WordPlace wpTemp = m_pEdit->GetCaretWordPlace(); - this->IOnSetCaret(bVisible,ptHead,ptFoot,wpTemp); + IOnSetCaret(bVisible,ptHead,ptFoot,wpTemp); } void CPWL_EditCtrl::GetCaretInfo(CPDF_Point & ptHead, CPDF_Point & ptFoot) const @@ -400,7 +400,7 @@ void CPWL_EditCtrl::GetCaretInfo(CPDF_Point & ptHead, CPDF_Point & ptFoot) const ptFoot.y = word.ptWord.y + word.fDescent; } else if (pIterator->GetLine(line)) - { + { ptHead.x = line.ptLine.x; ptHead.y = line.ptLine.y + line.fLineAscent; ptFoot.x = line.ptLine.x; @@ -524,7 +524,7 @@ CPDF_Font * CPWL_EditCtrl::GetCaretFont() const else if (HasFlag(PES_RICH)) { if (pIterator->GetSection(section)) - { + { nFontIndex = section.WordProps.nFontIndex; } } @@ -552,7 +552,7 @@ FX_FLOAT CPWL_EditCtrl::GetCaretFontSize() const else if (HasFlag(PES_RICH)) { if (pIterator->GetSection(section)) - { + { fFontSize = section.WordProps.fFontSize; } } @@ -634,8 +634,8 @@ void CPWL_EditCtrl::Undo() m_pEdit->Undo(); } -void CPWL_EditCtrl::IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, - FX_FLOAT fContentMin, FX_FLOAT fContentMax, +void CPWL_EditCtrl::IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, + FX_FLOAT fContentMin, FX_FLOAT fContentMax, FX_FLOAT fSmallStep, FX_FLOAT fBigStep) { PWL_SCROLL_INFO Info; @@ -646,25 +646,22 @@ void CPWL_EditCtrl::IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, Info.fSmallStep = fSmallStep; Info.fBigStep = fBigStep; - this->OnNotify(this,PNM_SETSCROLLINFO,SBT_VSCROLL,(intptr_t)&Info); - -// PWL_TRACE("set scroll info:%f\n",fContentMax - fContentMin); + OnNotify(this,PNM_SETSCROLLINFO,SBT_VSCROLL,(intptr_t)&Info); if (IsFloatBigger(Info.fPlateWidth,Info.fContentMax-Info.fContentMin) || IsFloatEqual(Info.fPlateWidth,Info.fContentMax-Info.fContentMin)) { - this->ShowVScrollBar(FALSE); + ShowVScrollBar(FALSE); } else { - this->ShowVScrollBar(TRUE); + ShowVScrollBar(TRUE); } } void CPWL_EditCtrl::IOnSetScrollPosY(FX_FLOAT fy) { -// PWL_TRACE("set scroll position:%f\n",fy); - this->OnNotify(this,PNM_SETSCROLLPOS,SBT_VSCROLL,(intptr_t)&fy); + OnNotify(this, PNM_SETSCROLLPOS,SBT_VSCROLL, (intptr_t)&fy); } void CPWL_EditCtrl::IOnSetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPDF_Point & ptFoot, const CPVT_WordPlace& place) @@ -674,7 +671,7 @@ void CPWL_EditCtrl::IOnSetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, con cInfo.ptHead = ptHead; cInfo.ptFoot = ptFoot; - this->OnNotify(this,PNM_SETCARETINFO,(intptr_t)&cInfo,(intptr_t)NULL); + OnNotify(this, PNM_SETCARETINFO, (intptr_t)&cInfo, (intptr_t)NULL); } void CPWL_EditCtrl::IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps) @@ -683,7 +680,7 @@ void CPWL_EditCtrl::IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_Wo void CPWL_EditCtrl::IOnContentChange(const CPDF_Rect& rcContent) { - if (this->IsValid()) + if (IsValid()) { if (m_pEditNotify) { @@ -694,15 +691,12 @@ void CPWL_EditCtrl::IOnContentChange(const CPDF_Rect& rcContent) void CPWL_EditCtrl::IOnInvalidateRect(CPDF_Rect * pRect) { - this->InvalidateRect(pRect); + InvalidateRect(pRect); } int32_t CPWL_EditCtrl::GetCharSet() const { - if (m_nCharSet < 0) - return DEFAULT_CHARSET; - else - return m_nCharSet; + return m_nCharSet < 0 ? DEFAULT_CHARSET : m_nCharSet; } void CPWL_EditCtrl::GetTextRange(const CPDF_Rect& rect, int32_t & nStartChar, int32_t & nEndChar) const diff --git a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp index 3d381f65c9..8dff4eabac 100644 --- a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_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/pdfwindow/PDFWindow.h" @@ -12,7 +12,7 @@ /* ------------------------------ CPWL_FontMap ------------------------------ */ -CPWL_FontMap::CPWL_FontMap(IFX_SystemHandler* pSystemHandler) : +CPWL_FontMap::CPWL_FontMap(IFX_SystemHandler* pSystemHandler) : m_pPDFDoc(NULL), m_pSystemHandler(pSystemHandler) { @@ -80,7 +80,7 @@ FX_BOOL CPWL_FontMap::KnowWord(int32_t nFontIndex, FX_WORD word) if (nFontIndex >=0 && nFontIndex < m_aData.GetSize()) { if (m_aData.GetAt(nFontIndex)) - { + { return CharCodeFromUnicode(nFontIndex, word) >= 0; } } @@ -99,8 +99,8 @@ int32_t CPWL_FontMap::GetWordFontIndex(FX_WORD word, int32_t nCharset, int32_t n { if (const CPWL_FontMap_Data* pData = GetFontMapData(0)) { - if (nCharset == DEFAULT_CHARSET || - pData->nCharset == SYMBOL_CHARSET || + if (nCharset == DEFAULT_CHARSET || + pData->nCharset == SYMBOL_CHARSET || nCharset == pData->nCharset) { if (KnowWord(0, word)) @@ -113,14 +113,14 @@ int32_t CPWL_FontMap::GetWordFontIndex(FX_WORD word, int32_t nCharset, int32_t n int32_t nNewFontIndex = -1; - nNewFontIndex = this->GetFontIndex(GetNativeFontName(nCharset), nCharset, TRUE); + nNewFontIndex = GetFontIndex(GetNativeFontName(nCharset), nCharset, TRUE); if (nNewFontIndex >= 0) { if (KnowWord(nNewFontIndex, word)) return nNewFontIndex; } - nNewFontIndex = this->GetFontIndex("Arial Unicode MS", DEFAULT_CHARSET, FALSE); + nNewFontIndex = GetFontIndex("Arial Unicode MS", DEFAULT_CHARSET, FALSE); if (nNewFontIndex >= 0) { if (KnowWord(nNewFontIndex, word)) @@ -203,10 +203,8 @@ void CPWL_FontMap::Initial(const FX_CHAR* fontname) sFontName = DEFAULT_FONT_NAME; GetFontIndex(sFontName, ANSI_CHARSET, FALSE); - - //GetFontIndex(this->GetNativeFontName(nCharset), nCharset); } - + /* List of currently supported standard fonts: @@ -277,7 +275,7 @@ int32_t CPWL_FontMap::GetFontIndex(const CFX_ByteString& sFontName, int32_t nCha */ { sAlias = EncodeFontAlias(sTemp, nCharset); - } + } } AddedFont(pFont, sAlias); @@ -406,7 +404,7 @@ CPDF_Font* CPWL_FontMap::AddSystemFont(CPDF_Document* pDoc, CFX_ByteString& sFon if (m_pSystemHandler) return m_pSystemHandler->AddNativeTrueTypeFontToPDF(pDoc, sFontName, nCharset); - + return NULL; } @@ -534,9 +532,9 @@ int32_t CPWL_FontMap::CharSetFromUnicode(FX_WORD word, int32_t nOldCharset) if (nOldCharset != DEFAULT_CHARSET) return nOldCharset; //find new charset - if ((word >= 0x4E00 && word <= 0x9FA5) || + if ((word >= 0x4E00 && word <= 0x9FA5) || (word >= 0xE7C7 && word <= 0xE7F3) || - (word >= 0x3000 && word <= 0x303F) || //£©"¡¶" "¡·" "¡£" "¡¢" + (word >= 0x3000 && word <= 0x303F) || (word >= 0x2000 && word <= 0x206F)) { return GB2312_CHARSET; @@ -585,7 +583,7 @@ int32_t CPWL_FontMap::CharSetFromUnicode(FX_WORD word, int32_t nOldCharset) /* ------------------------ CPWL_DocFontMap ------------------------ */ -CPWL_DocFontMap::CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler, CPDF_Document* pAttachedDoc) +CPWL_DocFontMap::CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler, CPDF_Document* pAttachedDoc) : CPWL_FontMap(pSystemHandler), m_pAttachedDoc(pAttachedDoc) { diff --git a/fpdfsdk/src/pdfwindow/PWL_Icon.cpp b/fpdfsdk/src/pdfwindow/PWL_Icon.cpp index f85156da0c..f266da001c 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Icon.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Icon.cpp @@ -23,7 +23,7 @@ CFX_ByteString CPWL_Image::GetImageAppStream() { CFX_ByteTextBuf sAppStream; - CFX_ByteString sAlias = this->GetImageAlias(); + CFX_ByteString sAlias = GetImageAlias(); CPDF_Rect rcPlate = GetClientRect(); CPDF_Matrix mt; mt.SetReverse(GetImageMatrix()); @@ -58,7 +58,7 @@ void CPWL_Image::SetPDFStream(CPDF_Stream * pStream) CPDF_Stream * CPWL_Image::GetPDFStream() { - return this->m_pPDFStream; + return m_pPDFStream; } void CPWL_Image::GetImageSize(FX_FLOAT & fWidth,FX_FLOAT & fHeight) @@ -193,23 +193,13 @@ void CPWL_Icon::GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale) FX_FLOAT fImageWidth,fImageHeight; FX_FLOAT fPlateWidth,fPlateHeight; - CPDF_Rect rcPlate = this->GetClientRect(); + CPDF_Rect rcPlate = GetClientRect(); fPlateWidth = rcPlate.right - rcPlate.left; fPlateHeight = rcPlate.top - rcPlate.bottom; GetImageSize(fImageWidth,fImageHeight); - int32_t nScaleMethod = this->GetScaleMethod(); - - /* - enum ScaleMethod - { - Always = 0, //A, Always scale - Bigger, //B, Scale only when the icon is bigger than the annotation rectangle - Smaller, //S, Scale only when the icon is smaller then the annotation rectangle - Never //N, Never scale - }; - */ + int32_t nScaleMethod = GetScaleMethod(); switch (nScaleMethod) { @@ -248,7 +238,7 @@ void CPWL_Icon::GetImageOffset(FX_FLOAT & x,FX_FLOAT & y) { FX_FLOAT fLeft,fBottom; - this->GetIconPosition(fLeft,fBottom); + GetIconPosition(fLeft, fBottom); x = 0.0f; y = 0.0f; @@ -262,7 +252,7 @@ void CPWL_Icon::GetImageOffset(FX_FLOAT & x,FX_FLOAT & y) FX_FLOAT fImageFactHeight = fImageHeight * fVScale; FX_FLOAT fPlateWidth,fPlateHeight; - CPDF_Rect rcPlate = this->GetClientRect(); + CPDF_Rect rcPlate = GetClientRect(); fPlateWidth = rcPlate.right - rcPlate.left; fPlateHeight = rcPlate.top - rcPlate.bottom; diff --git a/fpdfsdk/src/pdfwindow/PWL_IconList.cpp b/fpdfsdk/src/pdfwindow/PWL_IconList.cpp index cbb94d23d7..157eba633d 100644 --- a/fpdfsdk/src/pdfwindow/PWL_IconList.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_IconList.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/pdfwindow/PDFWindow.h" @@ -19,8 +19,8 @@ /* ------------------ CPWL_IconList_Item ------------------- */ -CPWL_IconList_Item::CPWL_IconList_Item() : - m_nIconIndex(-1), +CPWL_IconList_Item::CPWL_IconList_Item() : + m_nIconIndex(-1), m_pData(NULL), m_bSelected(FALSE), m_pText(NULL) @@ -47,15 +47,15 @@ void CPWL_IconList_Item::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matr if (m_bSelected) { - if (this->IsEnabled()) + if (IsEnabled()) { - CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcClient, - CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_SELBACKCOLOR,this->GetTransparency())); + CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcClient, + CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_SELBACKCOLOR, GetTransparency())); } else { - CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcClient, - CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_LIGHTGRAYCOLOR,this->GetTransparency())); + CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcClient, + CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_LIGHTGRAYCOLOR, GetTransparency())); } } @@ -63,8 +63,8 @@ void CPWL_IconList_Item::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matr rcIcon.left += PWL_IconList_ITEM_ICON_LEFTMARGIN; rcIcon.right = rcIcon.left + PWL_IconList_ITEM_WIDTH; - CPWL_Utils::DrawIconAppStream(pDevice, pUser2Device, m_nIconIndex, rcIcon, - m_crIcon, m_pText->GetTextColor(), this->GetTransparency()); + CPWL_Utils::DrawIconAppStream(pDevice, pUser2Device, m_nIconIndex, rcIcon, + m_crIcon, m_pText->GetTextColor(), GetTransparency()); } void CPWL_IconList_Item::SetSelect(FX_BOOL bSelected) @@ -136,19 +136,19 @@ void CPWL_IconList_Item::OnEnabled() else m_pText->SetTextColor(PWL_DEFAULT_BLACKCOLOR); - this->InvalidateRect(); + InvalidateRect(); } void CPWL_IconList_Item::OnDisabled() { m_pText->SetTextColor(PWL_DEFAULT_HEAVYGRAYCOLOR); - this->InvalidateRect(); + InvalidateRect(); } /* ----------------- CPWL_IconList_Content ----------------- */ -CPWL_IconList_Content::CPWL_IconList_Content(int32_t nListCount) : +CPWL_IconList_Content::CPWL_IconList_Content(int32_t nListCount) : m_nSelectIndex(-1), m_pNotify(NULL), m_bEnableNotify(TRUE), @@ -173,13 +173,13 @@ void CPWL_IconList_Content::CreateChildWnd(const PWL_CREATEPARAM & cp) pNewItem->Create(icp); } - this->SetItemSpace(PWL_IconList_ITEM_SPACE); - this->ResetContent(0); + SetItemSpace(PWL_IconList_ITEM_SPACE); + ResetContent(0); - if (CPWL_Wnd * pParent = this->GetParentWindow()) + if (CPWL_Wnd * pParent = GetParentWindow()) { - CPDF_Rect rcScroll = this->GetScrollArea(); - this->GetScrollPos(); + CPDF_Rect rcScroll = GetScrollArea(); + GetScrollPos(); PWL_SCROLL_INFO sInfo; sInfo.fContentMin = rcScroll.bottom; @@ -289,13 +289,13 @@ void CPWL_IconList_Content::ScrollToItem(int32_t nItemIndex) } else if (rcWnd.bottom < rcClient.bottom) { - ptScroll.y = rcOrigin.bottom + rcClient.Height(); + ptScroll.y = rcOrigin.bottom + rcClient.Height(); } - this->SetScrollPos(ptScroll); - this->ResetFace(); - this->InvalidateRect(); - if (CPWL_Wnd* pParent = this->GetParentWindow()) + SetScrollPos(ptScroll); + ResetFace(); + InvalidateRect(); + if (CPWL_Wnd* pParent = GetParentWindow()) { pParent->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&ptScroll.y); } @@ -343,7 +343,7 @@ void CPWL_IconList_Content::SelectItem(int32_t nItemIndex, FX_BOOL bSelect) if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) { pItem->SetSelect(bSelect); - pItem->InvalidateRect(); + pItem->InvalidateRect(); } } @@ -408,7 +408,7 @@ void CPWL_IconList_Content::SetIconFillColor(const CPWL_Color& color) /* -------------------- CPWL_IconList --------------------- */ -CPWL_IconList::CPWL_IconList(int32_t nListCount) : +CPWL_IconList::CPWL_IconList(int32_t nListCount) : m_pListContent(NULL), m_nListCount(nListCount) { @@ -438,7 +438,7 @@ void CPWL_IconList::CreateChildWnd(const PWL_CREATEPARAM & cp) void CPWL_IconList::OnCreated() { - if (CPWL_ScrollBar* pScrollBar = this->GetVScrollBar()) + if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) { pScrollBar->RemoveFlag(PWS_AUTOTRANSPARENT); pScrollBar->SetTransparency(255); @@ -451,20 +451,20 @@ void CPWL_IconList::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intp CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam); if (wParam == SBT_VSCROLL) - { + { switch (msg) { case PNM_SETSCROLLINFO: if (PWL_SCROLL_INFO* pInfo = (PWL_SCROLL_INFO*)lParam) { - if (CPWL_ScrollBar* pScrollBar = this->GetVScrollBar()) + if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) { if (pInfo->fContentMax - pInfo->fContentMin > pInfo->fPlateWidth) { if (!pScrollBar->IsVisible()) { pScrollBar->SetVisible(TRUE); - RePosChildWnd(); + RePosChildWnd(); } else { @@ -481,7 +481,7 @@ void CPWL_IconList::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intp if (m_pListContent) m_pListContent->SetScrollPos(CPDF_Point(0.0f,0.0f)); } - + pScrollBar->OnNotify(pWnd,PNM_SETSCROLLINFO,wParam,lParam); } } @@ -495,7 +495,7 @@ void CPWL_IconList::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intp } return; case PNM_SETSCROLLPOS: - if (CPWL_ScrollBar* pScrollBar = this->GetVScrollBar()) + if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) pScrollBar->OnNotify(pWnd,PNM_SETSCROLLPOS,wParam,lParam); return; } @@ -579,8 +579,8 @@ FX_BOOL CPWL_IconList::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_D m_pListContent->SetScrollPos(ptNew); m_pListContent->ResetFace(); m_pListContent->InvalidateRect(NULL); - - if (CPWL_ScrollBar* pScrollBar = this->GetVScrollBar()) + + if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) pScrollBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&ptNew.y); return TRUE; diff --git a/fpdfsdk/src/pdfwindow/PWL_Label.cpp b/fpdfsdk/src/pdfwindow/PWL_Label.cpp index 9875002437..35af3ee91b 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Label.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Label.cpp @@ -31,9 +31,9 @@ CFX_ByteString CPWL_Label::GetClassName() const void CPWL_Label::OnCreated() { SetParamByFlag(); - SetFontSize(this->GetCreationParam().fFontSize); + SetFontSize(GetCreationParam().fFontSize); - m_pEdit->SetFontMap(this->GetFontMap()); + m_pEdit->SetFontMap(GetFontMap()); m_pEdit->Initialize(); if (HasFlag(PES_TEXTOVERFLOW)) @@ -127,8 +127,8 @@ void CPWL_Label::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUse } IFX_SystemHandler* pSysHandler = GetSystemHandler(); IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pEdit, - CPWL_Utils::PWLColorToFXColor(GetTextColor(), this->GetTransparency()), - CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), this->GetTransparency()), + CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), + CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()), rcClip, CPDF_Point(0.0f,0.0f), pRange,pSysHandler, NULL); } diff --git a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp index ecf9e1231f..0328ee55d6 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_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/pdfwindow/PDFWindow.h" @@ -28,8 +28,8 @@ CPWL_List_Notify::~CPWL_List_Notify() { } -void CPWL_List_Notify::IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, - FX_FLOAT fContentMin, FX_FLOAT fContentMax, +void CPWL_List_Notify::IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, + FX_FLOAT fContentMin, FX_FLOAT fContentMax, FX_FLOAT fSmallStep, FX_FLOAT fBigStep) { PWL_SCROLL_INFO Info; @@ -51,17 +51,17 @@ void CPWL_List_Notify::IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, { pScroll->SetVisible(FALSE); m_pList->RePosChildWnd(); - } + } } else { if (!pScroll->IsVisible()) { - pScroll->SetVisible(TRUE); + pScroll->SetVisible(TRUE); m_pList->RePosChildWnd(); } } - } + } } void CPWL_List_Notify::IOnSetScrollPosY(FX_FLOAT fy) @@ -91,7 +91,7 @@ CPWL_ListBox::CPWL_ListBox() : CPWL_ListBox::~CPWL_ListBox() { IFX_List::DelList(m_pList); - + if (m_pListNotify) { delete m_pListNotify; @@ -100,7 +100,7 @@ CPWL_ListBox::~CPWL_ListBox() } CFX_ByteString CPWL_ListBox::GetClassName() const -{ +{ return "CPWL_ListBox"; } @@ -112,10 +112,10 @@ void CPWL_ListBox::OnCreated() m_pList->SetFontMap(GetFontMap()); m_pList->SetNotify(m_pListNotify = new CPWL_List_Notify(this)); - - SetHoverSel(HasFlag(PLBS_HOVERSEL)); + + SetHoverSel(HasFlag(PLBS_HOVERSEL)); m_pList->SetMultipleSel(HasFlag(PLBS_MULTIPLESEL)); - m_pList->SetFontSize(this->GetCreationParam().fFontSize); + m_pList->SetFontSize(GetCreationParam().fFontSize); m_bHoverSel = HasFlag(PLBS_HOVERSEL); } @@ -144,7 +144,7 @@ void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) CPDF_Rect rcItem = m_pList->GetItemRect(i); if (rcItem.bottom > rcPlate.top || rcItem.top < rcPlate.bottom) continue; - + CPDF_Point ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f); if (m_pList->IsItemSelected(i)) { @@ -168,8 +168,8 @@ void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) if (sListItems.GetLength() > 0) { - CFX_ByteTextBuf sClip; - CPDF_Rect rcClient = this->GetClientRect(); + CFX_ByteTextBuf sClip; + CPDF_Rect rcClient = GetClientRect(); sClip << "q\n"; sClip << rcClient.left << " " << rcClient.bottom << " " @@ -195,7 +195,7 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pU { CPDF_Rect rcItem = m_pList->GetItemRect(i); if (rcItem.bottom > rcPlate.top || rcItem.top < rcPlate.bottom) continue; - + CPDF_Point ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f); if (IFX_Edit* pEdit = m_pList->GetItemEdit(i)) { @@ -226,7 +226,7 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pU else { IFX_SystemHandler* pSysHandler = GetSystemHandler(); - IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), + IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), CPWL_Utils::PWLColorToFXColor(GetTextColor()), CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()), rcList, ptOffset, NULL,pSysHandler, NULL); @@ -252,7 +252,7 @@ FX_BOOL CPWL_ListBox::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) case FWL_VKEY_Left: case FWL_VKEY_End: case FWL_VKEY_Right: - break; + break; } switch (nChar) @@ -351,7 +351,7 @@ FX_BOOL CPWL_ListBox::OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag) { if (m_pList) m_pList->OnMouseMove(point,IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag)); - } + } return TRUE; } @@ -360,8 +360,8 @@ void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intpt { CPWL_Wnd::OnNotify(pWnd,msg,wParam,lParam); - FX_FLOAT fPos; - + FX_FLOAT fPos; + switch (msg) { case PNM_SETSCROLLINFO: @@ -375,7 +375,7 @@ void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intpt break; } break; - case PNM_SETSCROLLPOS: + case PNM_SETSCROLLPOS: switch (wParam) { case SBT_VSCROLL: @@ -401,29 +401,7 @@ void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intpt void CPWL_ListBox::KillFocus() { - CPWL_Wnd::KillFocus(); - - /* - if (this->IsMultipleSel()) - { - for(int32_t i=0;iGetCount();i++) - { - if (this->IsListItemSelected(i)) - { - if (!IsListItemVisible(i)) - this->ScrollToListItem(i); - break; - } - } - } - else - { - if (!IsListItemVisible(this->GetCurSel())) - this->ScrollToListItem(this->GetCurSel()); - } - - SetListItemCaret(m_nCaretIndex,FALSE); - */ + CPWL_Wnd::KillFocus(); } void CPWL_ListBox::RePosChildWnd() @@ -437,7 +415,7 @@ void CPWL_ListBox::RePosChildWnd() void CPWL_ListBox::OnNotifySelChanged(FX_BOOL bKeyDown, FX_BOOL & bExit, FX_DWORD nFlag) { if (m_pFillerNotify) - { + { FX_BOOL bRC = TRUE; CFX_WideString swChange = GetText(); CFX_WideString strChangeEx; @@ -458,23 +436,18 @@ CPDF_Rect CPWL_ListBox::GetFocusRect() const rcCaret.Intersect(GetClientRect()); return rcCaret; } - + return CPWL_Wnd::GetFocusRect(); } void CPWL_ListBox::AddString(const FX_WCHAR* string) { if (m_pList) - { + { m_pList->AddString(string); } } -void CPWL_ListBox::SetText(const FX_WCHAR* csText,FX_BOOL bRefresh) -{ - //return CPDF_List::SetText(csText,bRefresh); -} - CFX_WideString CPWL_ListBox::GetText() const { if (m_pList) diff --git a/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp b/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp index 17d842165d..3077e6293f 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ListCtrl.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/pdfwindow/PDFWindow.h" @@ -10,9 +10,9 @@ /* ---------------------------- CPWL_ListCtrl ---------------------------- */ -CPWL_ListCtrl::CPWL_ListCtrl() : +CPWL_ListCtrl::CPWL_ListCtrl() : m_rcContent(0,0,0,0), - m_ptScroll(0,0), + m_ptScroll(0,0), m_fItemSpace(0.0f), m_fTopSpace(0.0f), m_fBottomSpace(0.0f) @@ -37,7 +37,7 @@ void CPWL_ListCtrl::SetScrollPos(const CPDF_Point& point) m_ptScroll.y = m_rcContent.top; if (m_ptScroll.y < m_rcContent.bottom) - m_ptScroll.y = m_rcContent.bottom; + m_ptScroll.y = m_rcContent.bottom; } CPDF_Point CPWL_ListCtrl::GetScrollPos() const @@ -67,7 +67,7 @@ FX_FLOAT CPWL_ListCtrl::GetContentsHeight(FX_FLOAT fLimitWidth) { FX_FLOAT fRet = m_fTopSpace; - FX_FLOAT fBorderWidth = (FX_FLOAT)this->GetBorderWidth(); + FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); if (fLimitWidth > fBorderWidth* 2) { @@ -111,8 +111,8 @@ void CPWL_ListCtrl::ResetAll(FX_BOOL bMove, int32_t nStart) FX_FLOAT fRight = pChild->GetItemRightMargin(); pChild->SetChildMatrix( - CPDF_Matrix(1,0,0,1, - rcClient.left - m_ptScroll.x, + CPDF_Matrix(1,0,0,1, + rcClient.left - m_ptScroll.x, rcClient.top - m_ptScroll.y) ); @@ -192,7 +192,7 @@ void CPWL_ListCtrl::DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* } } } - + pDevice->RestoreState(); } @@ -211,7 +211,7 @@ CPDF_Point CPWL_ListCtrl::InToOut(const CPDF_Point& point) const { CPDF_Rect rcClient = GetClientRect(); - return CPDF_Point(point.x + rcClient.left - m_ptScroll.x, + return CPDF_Point(point.x + rcClient.left - m_ptScroll.x, point.y + rcClient.top - m_ptScroll.y); } @@ -219,7 +219,7 @@ CPDF_Point CPWL_ListCtrl::OutToIn(const CPDF_Point& point) const { CPDF_Rect rcClient = GetClientRect(); - return CPDF_Point(point.x - rcClient.left + m_ptScroll.x, + return CPDF_Point(point.x - rcClient.left + m_ptScroll.x, point.y - rcClient.top + m_ptScroll.y); } diff --git a/fpdfsdk/src/pdfwindow/PWL_Note.cpp b/fpdfsdk/src/pdfwindow/PWL_Note.cpp index 13e15a0518..7ed1115a82 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Note.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Note.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/pdfwindow/PDFWindow.h" @@ -51,7 +51,7 @@ void CPWL_Note_Options::SetTextColor(const CPWL_Color & color) void CPWL_Note_Options::RePosChildWnd() { - if (this->IsValid()) + if (IsValid()) { ASSERT(m_pText != NULL); @@ -106,8 +106,8 @@ void CPWL_Note_Options::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matri path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO); path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO); - pDevice->DrawPath(&path, pUser2Device, NULL, - CPWL_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), + pDevice->DrawPath(&path, pUser2Device, NULL, + CPWL_Utils::PWLColorToFXColor(GetTextColor(),GetTransparency()), 0, FXFILL_ALTERNATE); } @@ -136,35 +136,35 @@ CPWL_Note_Edit::~CPWL_Note_Edit() void CPWL_Note_Edit::RePosChildWnd() { - m_bEnableNotify = FALSE; + m_bEnableNotify = FALSE; CPWL_Edit::RePosChildWnd(); m_bEnableNotify = TRUE; - m_fOldItemHeight = this->GetContentRect().Height(); + m_fOldItemHeight = GetContentRect().Height(); } void CPWL_Note_Edit::SetText(const FX_WCHAR* csText) { m_bEnableNotify = FALSE; CPWL_Edit::SetText(csText); - m_bEnableNotify = TRUE; - m_fOldItemHeight = this->GetContentRect().Height(); + m_bEnableNotify = TRUE; + m_fOldItemHeight = GetContentRect().Height(); } void CPWL_Note_Edit::OnSetFocus() { - m_bEnableNotify = FALSE; + m_bEnableNotify = FALSE; CPWL_Edit::OnSetFocus(); - m_bEnableNotify = TRUE; + m_bEnableNotify = TRUE; - this->EnableSpellCheck(TRUE); + EnableSpellCheck(TRUE); } void CPWL_Note_Edit::OnKillFocus() { - this->EnableSpellCheck(FALSE); + EnableSpellCheck(FALSE); - if (CPWL_Wnd* pParent = this->GetParentWindow()) + if (CPWL_Wnd* pParent = GetParentWindow()) { if (CPWL_Wnd* pGrand = pParent->GetParentWindow()) { @@ -187,14 +187,14 @@ void CPWL_Note_Edit::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, int { switch (msg) { - case PNM_SETSCROLLINFO: + case PNM_SETSCROLLINFO: if (PWL_SCROLL_INFO* pInfo = (PWL_SCROLL_INFO*)lParam) - { - if (!IsFloatEqual(pInfo->fContentMax, m_fOldMax) || + { + if (!IsFloatEqual(pInfo->fContentMax, m_fOldMax) || !IsFloatEqual(pInfo->fContentMin, m_fOldMin)) { - m_bSizeChanged = TRUE; - if (CPWL_Wnd * pParent = this->GetParentWindow()) + m_bSizeChanged = TRUE; + if (CPWL_Wnd * pParent = GetParentWindow()) { pParent->OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0); } @@ -205,7 +205,7 @@ void CPWL_Note_Edit::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, int } } } - } + } } CPWL_Edit::OnNotify(pWnd, msg, wParam, lParam); @@ -219,10 +219,10 @@ void CPWL_Note_Edit::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, int { PWL_CARET_INFO newInfo = *pInfo; newInfo.bVisible = TRUE; - newInfo.ptHead = this->ChildToParent(pInfo->ptHead); - newInfo.ptFoot = this->ChildToParent(pInfo->ptFoot); + newInfo.ptHead = ChildToParent(pInfo->ptHead); + newInfo.ptFoot = ChildToParent(pInfo->ptFoot); - if (CPWL_Wnd * pParent = this->GetParentWindow()) + if (CPWL_Wnd * pParent = GetParentWindow()) { pParent->OnNotify(this, PNM_SETCARETINFO, (intptr_t)&newInfo, 0); } @@ -239,22 +239,18 @@ FX_FLOAT CPWL_Note_Edit::GetItemHeight(FX_FLOAT fLimitWidth) if (!m_bSizeChanged) return m_fOldItemHeight; - m_bSizeChanged = FALSE; + m_bSizeChanged = FALSE; - this->EnableNotify(FALSE); - this->EnableRefresh(FALSE); + EnableNotify(FALSE); + EnableRefresh(FALSE); m_pEdit->EnableNotify(FALSE); - //CPDF_Rect rcOld = this->GetWindowRect(); - - this->Move(CPDF_Rect(0,0,fLimitWidth,0), TRUE, FALSE); - FX_FLOAT fRet = this->GetContentRect().Height(); - - //this->Move(rcOld, TRUE, FALSE); + Move(CPDF_Rect(0,0,fLimitWidth,0), TRUE, FALSE); + FX_FLOAT fRet = GetContentRect().Height(); m_pEdit->EnableNotify(TRUE); - this->EnableNotify(TRUE); - this->EnableRefresh(TRUE); + EnableNotify(TRUE); + EnableRefresh(TRUE); return fRet; } @@ -284,7 +280,7 @@ CPWL_Note_LBBox::~CPWL_Note_LBBox() void CPWL_Note_LBBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device) { - CPDF_Rect rcClient = this->GetClientRect(); + CPDF_Rect rcClient = GetClientRect(); CFX_GraphStateData gsd; gsd.m_LineWidth = 1.0f; @@ -296,9 +292,9 @@ void CPWL_Note_LBBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pathCross.SetPoint(1, rcClient.right, rcClient.bottom, FXPT_LINETO); pathCross.SetPoint(2, rcClient.left, rcClient.bottom + rcClient.Height() * 0.5f, FXPT_MOVETO); pathCross.SetPoint(3, rcClient.left + rcClient.Width() * 0.5f, rcClient.bottom, FXPT_LINETO); - - pDevice->DrawPath(&pathCross, pUser2Device, &gsd, - 0, CPWL_Utils::PWLColorToFXColor(GetTextColor(),this->GetTransparency()), FXFILL_ALTERNATE); + + pDevice->DrawPath(&pathCross, pUser2Device, &gsd, + 0, CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), FXFILL_ALTERNATE); } /* -------------------------------- CPWL_Note_RBBox --------------------------------*/ @@ -313,7 +309,7 @@ CPWL_Note_RBBox::~CPWL_Note_RBBox() void CPWL_Note_RBBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device) { - CPDF_Rect rcClient = this->GetClientRect(); + CPDF_Rect rcClient = GetClientRect(); CFX_GraphStateData gsd; gsd.m_LineWidth = 1.0f; @@ -325,9 +321,9 @@ void CPWL_Note_RBBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pathCross.SetPoint(1, rcClient.left, rcClient.bottom, FXPT_LINETO); pathCross.SetPoint(2, rcClient.right, rcClient.bottom + rcClient.Height() * 0.5f, FXPT_MOVETO); pathCross.SetPoint(3, rcClient.left + rcClient.Width() * 0.5f, rcClient.bottom, FXPT_LINETO); - - pDevice->DrawPath(&pathCross, pUser2Device, &gsd, - 0, CPWL_Utils::PWLColorToFXColor(GetTextColor(),this->GetTransparency()), FXFILL_ALTERNATE); + + pDevice->DrawPath(&pathCross, pUser2Device, &gsd, + 0, CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), FXFILL_ALTERNATE); } /* --------------------------------- CPWL_Note_Icon ---------------------------------- */ @@ -347,8 +343,8 @@ void CPWL_Note_Icon::SetIconType(int32_t nType) void CPWL_Note_Icon::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device) { - CPWL_Utils::DrawIconAppStream(pDevice, pUser2Device, m_nType, GetClientRect(), - this->GetBackgroundColor(), PWL_DEFAULT_BLACKCOLOR, this->GetTransparency()); + CPWL_Utils::DrawIconAppStream(pDevice, pUser2Device, m_nType, GetClientRect(), + GetBackgroundColor(), PWL_DEFAULT_BLACKCOLOR, GetTransparency()); } /* --------------------------------- CPWL_Note_CloseBox ---------------------------------- */ @@ -365,7 +361,7 @@ void CPWL_Note_CloseBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matr { CPWL_Button::DrawThisAppearance(pDevice, pUser2Device); - CPDF_Rect rcClient = this->GetClientRect(); + CPDF_Rect rcClient = GetClientRect(); rcClient = CPWL_Utils::DeflateRect(rcClient, 2.0f); CFX_GraphStateData gsd; @@ -386,9 +382,9 @@ void CPWL_Note_CloseBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matr pathCross.SetPoint(1, rcClient.right, rcClient.top, FXPT_LINETO); pathCross.SetPoint(2, rcClient.left, rcClient.top, FXPT_MOVETO); pathCross.SetPoint(3, rcClient.right, rcClient.bottom, FXPT_LINETO); - - pDevice->DrawPath(&pathCross, pUser2Device, &gsd, - 0, CPWL_Utils::PWLColorToFXColor(GetTextColor(),this->GetTransparency()), FXFILL_ALTERNATE); + + pDevice->DrawPath(&pathCross, pUser2Device, &gsd, + 0, CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), FXFILL_ALTERNATE); } FX_BOOL CPWL_Note_CloseBox::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) @@ -460,23 +456,23 @@ CFX_WideString CPWL_Note_Contents::GetText() const CPWL_NoteItem* CPWL_Note_Contents::CreateSubItem() { CPWL_NoteItem* pNoteItem = new CPWL_NoteItem; - PWL_CREATEPARAM icp = this->GetCreationParam(); + PWL_CREATEPARAM icp = GetCreationParam(); icp.pParentWnd = this; icp.dwFlags = PWS_CHILD | PWS_VISIBLE | PWS_BACKGROUND; pNoteItem->Create(icp); pNoteItem->OnCreateNoteItem(); - + pNoteItem->ResetSubjectName(m_aChildren.GetSize() - 1); FX_SYSTEMTIME st; - if (IFX_SystemHandler* pSH = this->GetSystemHandler()) + if (IFX_SystemHandler* pSH = GetSystemHandler()) st = pSH->GetLocalTime(); pNoteItem->SetDateTime(st); pNoteItem->SetContents(L""); - this->OnNotify(pNoteItem, PNM_NOTEEDITCHANGED, 0, 0); + OnNotify(pNoteItem, PNM_NOTEEDITCHANGED, 0, 0); return pNoteItem; } @@ -502,7 +498,7 @@ IPWL_NoteItem* CPWL_Note_Contents::GetSubItems(int32_t index) const void CPWL_Note_Contents::DeleteSubItem(IPWL_NoteItem* pNoteItem) { - int32_t nIndex = this->GetItemIndex((CPWL_NoteItem*)pNoteItem); + int32_t nIndex = GetItemIndex((CPWL_NoteItem*)pNoteItem); if (nIndex > 0) { @@ -523,13 +519,13 @@ void CPWL_Note_Contents::DeleteSubItem(IPWL_NoteItem* pNoteItem) } } - this->OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0); + OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0); } } IPWL_NoteItem* CPWL_Note_Contents::GetHitNoteItem(const CPDF_Point& point) { - CPDF_Point pt = this->ParentToChild(point); + CPDF_Point pt = ParentToChild(point); for (int32_t i=0,sz=m_aChildren.GetSize(); iGetItemIndex(pWnd); + int32_t nIndex = GetItemIndex(pWnd); if (nIndex < 0) nIndex = 0; - m_pEdit->EnableNotify(FALSE); - this->ResetContent(nIndex); + m_pEdit->EnableNotify(FALSE); + ResetContent(nIndex); m_pEdit->EnableNotify(TRUE); for (int32_t i=nIndex+1, sz=m_aChildren.GetSize(); iOnNotify(this, PNM_NOTERESET, 0, 0); } - if (CPWL_Wnd * pParent = this->GetParentWindow()) + if (CPWL_Wnd * pParent = GetParentWindow()) { pParent->OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0); } } return; case PNM_SCROLLWINDOW: - this->SetScrollPos(CPDF_Point(0.0f, *(FX_FLOAT*)lParam)); - this->ResetFace(); + SetScrollPos(CPDF_Point(0.0f, *(FX_FLOAT*)lParam)); + ResetFace(); InvalidateRect(NULL); - return; + return; case PNM_SETCARETINFO: if (PWL_CARET_INFO * pInfo = (PWL_CARET_INFO*)wParam) { PWL_CARET_INFO newInfo = *pInfo; newInfo.bVisible = TRUE; - newInfo.ptHead = this->ChildToParent(pInfo->ptHead); - newInfo.ptFoot = this->ChildToParent(pInfo->ptFoot); + newInfo.ptHead = ChildToParent(pInfo->ptHead); + newInfo.ptFoot = ChildToParent(pInfo->ptFoot); - if (CPWL_Wnd * pParent = this->GetParentWindow()) + if (CPWL_Wnd * pParent = GetParentWindow()) { pParent->OnNotify(this, PNM_SETCARETINFO, (intptr_t)&newInfo, 0); } @@ -592,18 +588,18 @@ void CPWL_Note_Contents::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, return; case PNM_NOTERESET: { - m_pEdit->EnableNotify(FALSE); - this->ResetContent(0); + m_pEdit->EnableNotify(FALSE); + ResetContent(0); m_pEdit->EnableNotify(TRUE); for (int32_t i=1, sz=m_aChildren.GetSize(); iOnNotify(this, PNM_NOTERESET, 0, 0); - } + } - m_pEdit->EnableNotify(FALSE); - this->ResetContent(0); + m_pEdit->EnableNotify(FALSE); + ResetContent(0); m_pEdit->EnableNotify(TRUE); } return; @@ -705,7 +701,7 @@ void CPWL_NoteItem::CreateChildWnd(const PWL_CREATEPARAM & cp) { CPWL_Color sTextColor; - if (CPWL_Utils::IsBlackOrWhite(this->GetBackgroundColor())) + if (CPWL_Utils::IsBlackOrWhite(GetBackgroundColor())) sTextColor = PWL_DEFAULT_WHITECOLOR; else sTextColor = PWL_DEFAULT_BLACKCOLOR; @@ -738,7 +734,7 @@ void CPWL_NoteItem::CreateChildWnd(const PWL_CREATEPARAM & cp) void CPWL_NoteItem::RePosChildWnd() { - if (this->IsValid()) + if (IsValid()) { ASSERT(m_pSubject != NULL); ASSERT(m_pDateTime != NULL); @@ -784,7 +780,7 @@ void CPWL_NoteItem::SetPrivateData(void* pData) void CPWL_NoteItem::SetBkColor(const CPWL_Color& color) { CPWL_Color sBK = color; - this->SetBackgroundColor(sBK); + SetBackgroundColor(sBK); CPWL_Color sTextColor; @@ -793,13 +789,13 @@ void CPWL_NoteItem::SetBkColor(const CPWL_Color& color) else sTextColor = PWL_DEFAULT_BLACKCOLOR; - this->SetTextColor(sTextColor); + SetTextColor(sTextColor); if (m_pSubject) m_pSubject->SetTextColor(sTextColor); if (m_pDateTime) m_pDateTime->SetTextColor(sTextColor); - this->InvalidateRect(NULL); + InvalidateRect(nullptr); if (IPWL_NoteNotify* pNotify = GetNoteNotify()) { @@ -823,7 +819,7 @@ void CPWL_NoteItem::SetSubjectName(const CFX_WideString& sName) void CPWL_NoteItem::SetAuthorName(const CFX_WideString& sName) { m_sAuthor = sName; - ResetSubjectName(-1); + ResetSubjectName(-1); if (IPWL_NoteNotify* pNotify = GetNoteNotify()) { @@ -835,7 +831,7 @@ void CPWL_NoteItem::ResetSubjectName(int32_t nItemIndex) { if (nItemIndex < 0) { - if (CPWL_Wnd* pParent = this->GetParentWindow()) + if (CPWL_Wnd* pParent = GetParentWindow()) { ASSERT(pParent->GetClassName() == "CPWL_Note_Contents"); @@ -855,8 +851,8 @@ void CPWL_NoteItem::ResetSubjectName(int32_t nItemIndex) sSubject += L" - "; sSubject += m_sAuthor; } - this->SetSubjectName(sSubject); - this->RePosChildWnd(); + SetSubjectName(sSubject); + RePosChildWnd(); } void CPWL_NoteItem::SetDateTime(FX_SYSTEMTIME time) @@ -870,7 +866,7 @@ void CPWL_NoteItem::SetDateTime(FX_SYSTEMTIME time) m_pDateTime->SetText(swTime.c_str()); } - this->RePosChildWnd(); + RePosChildWnd(); if (IPWL_NoteNotify* pNotify = GetNoteNotify()) { @@ -893,7 +889,7 @@ void CPWL_NoteItem::SetContents(const CFX_WideString& sContents) CPWL_NoteItem* CPWL_NoteItem::GetParentNoteItem() const { - if (CPWL_Wnd* pParent = this->GetParentWindow()) + if (CPWL_Wnd* pParent = GetParentWindow()) { if (CPWL_Wnd* pGrand = pParent->GetParentWindow()) { @@ -924,12 +920,12 @@ void* CPWL_NoteItem::GetPrivateData() const CFX_WideString CPWL_NoteItem::GetAuthorName() const { - return m_sAuthor; + return m_sAuthor; } CPWL_Color CPWL_NoteItem::GetBkColor() const { - return this->GetBackgroundColor(); + return GetBackgroundColor(); } CFX_WideString CPWL_NoteItem::GetContents() const @@ -984,7 +980,7 @@ IPWL_NoteItem* CPWL_NoteItem::GetSubItems(int32_t index) const void CPWL_NoteItem::DeleteSubItem(IPWL_NoteItem* pNoteItem) { - this->KillFocus(); + KillFocus(); if (IPWL_NoteNotify* pNotify = GetNoteNotify()) { @@ -997,9 +993,9 @@ void CPWL_NoteItem::DeleteSubItem(IPWL_NoteItem* pNoteItem) IPWL_NoteItem* CPWL_NoteItem::GetHitNoteItem(const CPDF_Point& point) { - CPDF_Point pt = this->ParentToChild(point); + CPDF_Point pt = ParentToChild(point); - if (this->WndHitTest(pt)) + if (WndHitTest(pt)) { if (m_pContents) { @@ -1015,17 +1011,17 @@ IPWL_NoteItem* CPWL_NoteItem::GetHitNoteItem(const CPDF_Point& point) IPWL_NoteItem* CPWL_NoteItem::GetFocusedNoteItem() const { - if (const CPWL_Wnd* pWnd = this->GetFocused()) + if (const CPWL_Wnd* pWnd = GetFocused()) { if (pWnd->GetClassName() == "CPWL_Edit") { if (CPWL_Wnd* pParent = pWnd->GetParentWindow()) { ASSERT(pParent->GetClassName() == "CPWL_Note_Contents"); - + if (CPWL_Wnd* pGrand = pParent->GetParentWindow()) { - ASSERT(pGrand->GetClassName() == "CPWL_NoteItem"); + ASSERT(pGrand->GetClassName() == "CPWL_NoteItem"); return (CPWL_NoteItem*)pGrand; } } @@ -1049,7 +1045,7 @@ FX_FLOAT CPWL_NoteItem::GetItemHeight(FX_FLOAT fLimitWidth) ASSERT(m_pContents != NULL); FX_FLOAT fRet = m_pDateTime->GetContentRect().Height(); - FX_FLOAT fBorderWidth = (FX_FLOAT)this->GetBorderWidth(); + FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); if (fLimitWidth > fBorderWidth * 2) fRet += m_pContents->GetContentsHeight(fLimitWidth - fBorderWidth * 2); fRet += POPUP_ITEM_HEAD_BOTTOM + POPUP_ITEM_BOTTOMWIDTH + fBorderWidth * 2; @@ -1099,23 +1095,23 @@ void CPWL_NoteItem::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intp { switch (msg) { - case PNM_NOTEEDITCHANGED: + case PNM_NOTEEDITCHANGED: m_bSizeChanged = TRUE; - if (CPWL_Wnd* pParent = this->GetParentWindow()) + if (CPWL_Wnd* pParent = GetParentWindow()) { pParent->OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0); } - return; + return; case PNM_SETCARETINFO: if (PWL_CARET_INFO * pInfo = (PWL_CARET_INFO*)wParam) { PWL_CARET_INFO newInfo = *pInfo; newInfo.bVisible = TRUE; - newInfo.ptHead = this->ChildToParent(pInfo->ptHead); - newInfo.ptFoot = this->ChildToParent(pInfo->ptFoot); + newInfo.ptHead = ChildToParent(pInfo->ptHead); + newInfo.ptFoot = ChildToParent(pInfo->ptFoot); - if (CPWL_Wnd * pParent = this->GetParentWindow()) + if (CPWL_Wnd * pParent = GetParentWindow()) { pParent->OnNotify(this, PNM_SETCARETINFO, (intptr_t)&newInfo, 0); } @@ -1124,7 +1120,7 @@ void CPWL_NoteItem::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intp case PNM_NOTERESET: m_bSizeChanged = TRUE; m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0); - + return; } @@ -1145,7 +1141,7 @@ void CPWL_NoteItem::PopupNoteItemMenu(const CPDF_Point& point) const CPWL_Note* CPWL_NoteItem::GetNote() const { - if (const CPWL_Wnd* pRoot = this->GetRootWnd()) + if (const CPWL_Wnd* pRoot = GetRootWnd()) { ASSERT(pRoot->GetClassName() == "CPWL_NoteItem"); CPWL_NoteItem* pNoteItem = (CPWL_NoteItem*)pRoot; @@ -1200,7 +1196,7 @@ void CPWL_NoteItem::EnableRead(FX_BOOL bEnabled) /* ---------------------------------- CPWL_Note ---------------------------------- */ -CPWL_Note::CPWL_Note(IPopup_Note* pPopupNote, IPWL_NoteNotify* pNoteNotify, IPWL_NoteHandler* pNoteHandler) : +CPWL_Note::CPWL_Note(IPopup_Note* pPopupNote, IPWL_NoteNotify* pNoteNotify, IPWL_NoteHandler* pNoteHandler) : m_pAuthor(NULL), m_pIcon(NULL), m_pCloseBox(NULL), @@ -1236,9 +1232,8 @@ void CPWL_Note::RePosChildWnd() m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0); ResetScrollBar(); m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0); - this->OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0); - //ͬ²½ - if (const CPWL_Wnd* pWnd = this->GetFocused()) + OnNotify(this, PNM_NOTEEDITCHANGED, 0, 0); + if (const CPWL_Wnd* pWnd = GetFocused()) { if (pWnd->GetClassName() == "CPWL_Edit") { @@ -1246,8 +1241,6 @@ void CPWL_Note::RePosChildWnd() pEdit->SetCaret(pEdit->GetCaret()); } } - //CPDF_Point ptNew = m_pContents->GetScrollPos(); - //m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&ptNew.y); } FX_BOOL CPWL_Note::ResetScrollBar() @@ -1264,7 +1257,7 @@ FX_BOOL CPWL_Note::ResetScrollBar() m_pContentsBar->InvalidateRect(NULL); bScrollChanged = TRUE; } - } + } } else { @@ -1279,7 +1272,7 @@ FX_BOOL CPWL_Note::ResetScrollBar() if (bScrollChanged) { - CPDF_Rect rcNote = this->GetClientRect(); + CPDF_Rect rcNote = GetClientRect(); CPDF_Rect rcContents = m_pContents->GetWindowRect(); rcContents.right = rcNote.right - 3.0f; if (m_pContentsBar->IsVisible()) @@ -1297,7 +1290,7 @@ FX_BOOL CPWL_Note::ScrollBarShouldVisible() CPDF_Rect rcContentsFact = m_pContents->GetScrollArea(); CPDF_Rect rcContentsClient = m_pContents->GetClientRect(); - return rcContentsFact.Height() > rcContentsClient.Height(); + return rcContentsFact.Height() > rcContentsClient.Height(); } void CPWL_Note::SetOptionsText(const CFX_WideString& sText) @@ -1314,7 +1307,7 @@ void CPWL_Note::RePosNoteChildren() m_bResizing = TRUE; - if (this->IsValid()) + if (IsValid()) { ASSERT(m_pSubject != NULL); ASSERT(m_pDateTime != NULL); @@ -1361,7 +1354,7 @@ void CPWL_Note::RePosNoteChildren() rcSubject.right = PWL_MIN(rcSubject.left + m_pSubject->GetContentRect().Width() + 1.0f, rcDate.left - 1.0f); rcSubject.bottom = rcSubject.top - m_pSubject->GetContentRect().Height(); rcSubject.Normalize(); - m_pSubject->Move(rcSubject, TRUE, FALSE); + m_pSubject->Move(rcSubject, TRUE, FALSE); m_pSubject->SetVisible(CPWL_Utils::ContainsRect(rcClient, rcSubject)); CPDF_Rect rcOptions = rcClient; @@ -1411,7 +1404,7 @@ void CPWL_Note::RePosNoteChildren() rcContentsBar.left = rcContentsBar.right - PWL_SCROLLBAR_WIDTH; rcContentsBar.Normalize(); m_pContentsBar->Move(rcContentsBar, TRUE, FALSE); - + m_rcCaption = rcClient; m_rcCaption.bottom = rcContents.top; } @@ -1419,7 +1412,7 @@ void CPWL_Note::RePosNoteChildren() m_bResizing = FALSE; } -//0-normal / 1-caption / 2-leftbottom corner / 3-rightbottom corner / 4-close / 5-options +//0-normal / 1-caption / 2-leftbottom corner / 3-rightbottom corner / 4-close / 5-options int32_t CPWL_Note::NoteHitTest(const CPDF_Point& point) const { ASSERT(m_pSubject != NULL); @@ -1458,7 +1451,7 @@ void CPWL_Note::CreateChildWnd(const PWL_CREATEPARAM & cp) CPWL_Color sTextColor; - if (CPWL_Utils::IsBlackOrWhite(this->GetBackgroundColor())) + if (CPWL_Utils::IsBlackOrWhite(GetBackgroundColor())) sTextColor = PWL_DEFAULT_WHITECOLOR; else sTextColor = PWL_DEFAULT_BLACKCOLOR; @@ -1468,7 +1461,7 @@ void CPWL_Note::CreateChildWnd(const PWL_CREATEPARAM & cp) acp.pParentWnd = this; acp.dwFlags = PWS_VISIBLE | PWS_CHILD | PES_LEFT | PES_TOP; acp.sTextColor = sTextColor; - m_pAuthor->Create(acp); + m_pAuthor->Create(acp); m_pCloseBox = new CPWL_Note_CloseBox; PWL_CREATEPARAM ccp = cp; @@ -1570,7 +1563,7 @@ FX_BOOL CPWL_Note::OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD if (ptNew.y != ptScroll.y) { m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0); - m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL, (intptr_t)&ptNew.y); + m_pContents->OnNotify(this, PNM_SCROLLWINDOW, SBT_VSCROLL, (intptr_t)&ptNew.y); m_pContentsBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, (intptr_t)&ptNew.y); return TRUE; @@ -1587,7 +1580,7 @@ void CPWL_Note::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t case PNM_NOTEEDITCHANGED: { CPDF_Rect rcScroll = m_pContents->GetScrollArea(); - + PWL_SCROLL_INFO sInfo; sInfo.fContentMin = rcScroll.bottom; @@ -1607,10 +1600,10 @@ void CPWL_Note::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t { lParam++; m_pContents->OnNotify(this, PNM_NOTERESET, 0, 0); - this->OnNotify(this, PNM_NOTEEDITCHANGED, 0, lParam); + OnNotify(this, PNM_NOTEEDITCHANGED, 0, lParam); } } - + if (!bScrollChanged) { if (m_pContentsBar->IsVisible()) @@ -1669,7 +1662,7 @@ void CPWL_Note::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t return; } - + if (pInfo->ptFoot.y < rcClient.bottom) { CPDF_Point pt = m_pContents->OutToIn(pInfo->ptFoot); @@ -1715,13 +1708,13 @@ FX_BOOL CPWL_Note::OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) { if (m_pOptions->WndHitTest(m_pOptions->ParentToChild(point))) { - if (IPWL_NoteNotify* pNotify = this->GetNoteNotify()) + if (IPWL_NoteNotify* pNotify = GetNoteNotify()) { int32_t x, y; PWLtoWnd(point, x, y); if (IFX_SystemHandler* pSH = GetSystemHandler()) pSH->ClientToScreen(GetAttachedHWnd(), x, y); - this->KillFocus(); + KillFocus(); pNotify->OnPopupMenu(x, y); return TRUE; diff --git a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp index ad293bc578..6d61705222 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ScrollBar.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ScrollBar.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/pdfwindow/PDFWindow.h" @@ -49,7 +49,7 @@ void PWL_FLOATRANGE::Set(FX_FLOAT min,FX_FLOAT max) FX_BOOL PWL_FLOATRANGE::In(FX_FLOAT x) const { - return (IsFloatBigger(x,fMin) || IsFloatEqual(x, fMin)) && + return (IsFloatBigger(x,fMin) || IsFloatEqual(x, fMin)) && (IsFloatSmaller(x, fMax) || IsFloatEqual(x, fMax)); } @@ -81,7 +81,7 @@ void PWL_SCROLL_PRIVATEDATA::SetScrollRange(FX_FLOAT min,FX_FLOAT max) if (IsFloatSmaller(fScrollPos, ScrollRange.fMin)) fScrollPos = ScrollRange.fMin; if (IsFloatBigger(fScrollPos, ScrollRange.fMax)) - fScrollPos = ScrollRange.fMax; + fScrollPos = ScrollRange.fMax; } void PWL_SCROLL_PRIVATEDATA::SetClientWidth(FX_FLOAT width) @@ -124,7 +124,7 @@ void PWL_SCROLL_PRIVATEDATA::SubSmall() void PWL_SCROLL_PRIVATEDATA::AddBig() { if (!SetPos(fScrollPos + fBigStep)) - SetPos(ScrollRange.fMax); + SetPos(ScrollRange.fMax); } void PWL_SCROLL_PRIVATEDATA::SubBig() @@ -172,12 +172,12 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) sAppStream << "q\n"; - CPDF_Point ptCenter = this->GetCenterPoint(); + CPDF_Point ptCenter = GetCenterPoint(); - switch (this->m_eScrollBarType) + switch (m_eScrollBarType) { case SBT_HSCROLL: - switch (this->m_eSBButtonType) + switch (m_eSBButtonType) { case PSBT_MIN: { @@ -194,7 +194,7 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) sButton << pt3.x << " " << pt3.y << " l\n"; sButton << pt1.x << " " << pt1.y << " l f\n"; - sAppStream << sButton; + sAppStream << sButton; } } break; @@ -213,7 +213,7 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) sButton << pt3.x << " " << pt3.y << " l\n"; sButton << pt1.x << " " << pt1.y << " l f\n"; - sAppStream << sButton; + sAppStream << sButton; } } break; @@ -222,7 +222,7 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) } break; case SBT_VSCROLL: - switch(this->m_eSBButtonType) + switch (m_eSBButtonType) { case PSBT_MIN: { @@ -239,7 +239,7 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) sButton << pt3.x << " " << pt3.y << " l\n"; sButton << pt1.x << " " << pt1.y << " l f\n"; - sAppStream << sButton; + sAppStream << sButton; } } break; @@ -258,7 +258,7 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) sButton << pt3.x << " " << pt3.y << " l\n"; sButton << pt1.x << " " << pt1.y << " l f\n"; - sAppStream << sButton; + sAppStream << sButton; } } break; @@ -280,14 +280,14 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p CPDF_Rect rectWnd = GetWindowRect(); if (rectWnd.IsEmpty()) return; - CPDF_Point ptCenter = this->GetCenterPoint(); - int32_t nTransparancy = this->GetTransparency(); + CPDF_Point ptCenter = GetCenterPoint(); + int32_t nTransparancy = GetTransparency(); - switch (this->m_eScrollBarType) + switch (m_eScrollBarType) { case SBT_HSCROLL: CPWL_Wnd::DrawThisAppearance(pDevice,pUser2Device); - switch (this->m_eSBButtonType) + switch (m_eSBButtonType) { case PSBT_MIN: { @@ -306,8 +306,8 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO); path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO); - pDevice->DrawPath(&path, pUser2Device, NULL, - CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR,nTransparancy), + pDevice->DrawPath(&path, pUser2Device, NULL, + CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR,nTransparancy), 0, FXFILL_ALTERNATE); } } @@ -329,9 +329,9 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO); path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO); - pDevice->DrawPath(&path, pUser2Device, NULL, - CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR,nTransparancy), - 0, FXFILL_ALTERNATE); + pDevice->DrawPath(&path, pUser2Device, NULL, + CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR,nTransparancy), + 0, FXFILL_ALTERNATE); } } break; @@ -340,25 +340,25 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p } break; case SBT_VSCROLL: - switch(this->m_eSBButtonType) + switch (m_eSBButtonType) { case PSBT_MIN: { //draw border CPDF_Rect rcDraw = rectWnd; - CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, + CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, ArgbEncode(nTransparancy,100,100,100),0.0f); //draw inner border rcDraw = CPWL_Utils::DeflateRect(rectWnd,0.5f); - CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, + CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, ArgbEncode(nTransparancy,255,255,255),1.0f); //draw background rcDraw = CPWL_Utils::DeflateRect(rectWnd,1.0f); - if (this->IsEnabled()) + if (IsEnabled()) CPWL_Utils::DrawShadow(pDevice, pUser2Device, TRUE, FALSE, rcDraw, nTransparancy, 80, 220); else CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcDraw, ArgbEncode(255,255,255,255)); @@ -377,12 +377,12 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p CPDF_Point(fX+6.5f, fY+4.0f), CPDF_Point(fX+4.5f, fY+6.0f), CPDF_Point(fX+2.5f, fY+4.0f)}; - - if (this->IsEnabled()) + + if (IsEnabled()) CPWL_Utils::DrawFillArea(pDevice, pUser2Device, pts, 7, ArgbEncode(nTransparancy,255,255,255)); else - CPWL_Utils::DrawFillArea(pDevice, pUser2Device, pts, 7, + CPWL_Utils::DrawFillArea(pDevice, pUser2Device, pts, 7, CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_HEAVYGRAYCOLOR,255)); } } @@ -391,17 +391,17 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p { //draw border CPDF_Rect rcDraw = rectWnd; - CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, + CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, ArgbEncode(nTransparancy,100,100,100),0.0f); - + //draw inner border rcDraw = CPWL_Utils::DeflateRect(rectWnd,0.5f); - CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, + CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, ArgbEncode(nTransparancy,255,255,255),1.0f); //draw background rcDraw = CPWL_Utils::DeflateRect(rectWnd,1.0f); - if (this->IsEnabled()) + if (IsEnabled()) CPWL_Utils::DrawShadow(pDevice, pUser2Device, TRUE, FALSE, rcDraw, nTransparancy, 80, 220); else CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcDraw, ArgbEncode(255,255,255,255)); @@ -421,12 +421,12 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p CPDF_Point(fX+6.5f, fY+5.0f), CPDF_Point(fX+4.5f, fY+3.0f), CPDF_Point(fX+2.5f, fY+5.0f)}; - - if (this->IsEnabled()) + + if (IsEnabled()) CPWL_Utils::DrawFillArea(pDevice, pUser2Device, pts, 7, ArgbEncode(nTransparancy,255,255,255)); else - CPWL_Utils::DrawFillArea(pDevice, pUser2Device, pts, 7, + CPWL_Utils::DrawFillArea(pDevice, pUser2Device, pts, 7, CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_HEAVYGRAYCOLOR,255)); } } @@ -437,79 +437,79 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p //draw border CPDF_Rect rcDraw = rectWnd; - CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, + CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, ArgbEncode(nTransparancy,100,100,100),0.0f); - + //draw inner border rcDraw = CPWL_Utils::DeflateRect(rectWnd,0.5f); - CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, + CPWL_Utils::DrawStrokeRect(pDevice, pUser2Device, rcDraw, ArgbEncode(nTransparancy,255,255,255),1.0f); - if (this->IsEnabled()) + if (IsEnabled()) { - //draw shadow effect - + //draw shadow effect + CPDF_Point ptTop = CPDF_Point(rectWnd.left,rectWnd.top-1.0f); CPDF_Point ptBottom = CPDF_Point(rectWnd.left,rectWnd.bottom+1.0f); ptTop.x += 1.5f; ptBottom.x += 1.5f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,210,210,210),1.0f); ptTop.x += 1.0f; ptBottom.x += 1.0f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,220,220,220),1.0f); ptTop.x += 1.0f; ptBottom.x += 1.0f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,240,240,240),1.0f); ptTop.x += 1.0f; ptBottom.x += 1.0f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,240,240,240),1.0f); ptTop.x += 1.0f; ptBottom.x += 1.0f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,210,210,210),1.0f); ptTop.x += 1.0f; ptBottom.x += 1.0f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,180,180,180),1.0f); ptTop.x += 1.0f; ptBottom.x += 1.0f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,150,150,150),1.0f); ptTop.x += 1.0f; ptBottom.x += 1.0f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,150,150,150),1.0f); ptTop.x += 1.0f; ptBottom.x += 1.0f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,180,180,180),1.0f); ptTop.x += 1.0f; ptBottom.x += 1.0f; - - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, + + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptTop, ptBottom, ArgbEncode(nTransparancy,210,210,210),1.0f); } else @@ -522,7 +522,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p if (rectWnd.Height() > 8.0f) { FX_COLORREF crStroke = ArgbEncode(nTransparancy,120,120,120); - if (!this->IsEnabled()) + if (!IsEnabled()) crStroke = CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_HEAVYGRAYCOLOR,255); FX_FLOAT nFrictionWidth = 5.0f; @@ -531,26 +531,26 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p CPDF_Point ptLeft = CPDF_Point(ptCenter.x - nFrictionWidth / 2.0f, ptCenter.y - nFrictionHeight / 2.0f + 0.5f); CPDF_Point ptRight = CPDF_Point(ptCenter.x + nFrictionWidth / 2.0f, ptCenter.y - nFrictionHeight / 2.0f + 0.5f); - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, crStroke,1.0f); ptLeft.y += 2.0f; ptRight.y += 2.0f; - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, crStroke,1.0f); ptLeft.y += 2.0f; ptRight.y += 2.0f; - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, crStroke,1.0f); /* ptLeft.y += 1.5f; ptRight.y += 1.5f; - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, ptLeft, ptRight, ArgbEncode(nTransparancy,150,150,150),1.0f); */ } @@ -596,7 +596,7 @@ FX_BOOL CPWL_SBButton::OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag) CPWL_Wnd::OnMouseMove(point,nFlag); if (CPWL_Wnd * pParent = GetParentWindow()) - { + { pParent->OnNotify(this,PNM_MOUSEMOVE,0,(intptr_t)&point); /* @@ -640,29 +640,8 @@ void CPWL_ScrollBar::OnCreate(PWL_CREATEPARAM & cp) void CPWL_ScrollBar::RePosChildWnd() { - CPDF_Rect rcClient = this->GetClientRect(); - -/* - switch(m_sbType) - { - case SBT_HSCROLL: - if (rcClient.right - rcClient.left < PWL_SCROLLBAR_WIDTH || - rcClient.top - rcClient.bottom < PWL_SCROLLBAR_WIDTH) - { - SetVisible(FALSE); - } - break; - case SBT_VSCROLL: - if (rcClient.right - rcClient.left < PWL_SCROLLBAR_WIDTH || - rcClient.top - rcClient.bottom < PWL_SCROLLBAR_WIDTH) - { - SetVisible(FALSE); - } - break; - } -*/ + CPDF_Rect rcClient = GetClientRect(); CPDF_Rect rcMinButton,rcMaxButton; - FX_FLOAT fBWidth = 0; switch (m_sbType) @@ -711,18 +690,13 @@ void CPWL_ScrollBar::RePosChildWnd() else SetVisible(FALSE); } break; - } - -// if (IsVisible()) - { - if (m_pMinButton) - m_pMinButton->Move(rcMinButton,TRUE,FALSE); - - if (m_pMaxButton) - m_pMaxButton->Move(rcMaxButton,TRUE,FALSE); - - MovePosButton(FALSE); } + + if (m_pMinButton) + m_pMinButton->Move(rcMinButton, TRUE, FALSE); + if (m_pMaxButton) + m_pMaxButton->Move(rcMaxButton, TRUE, FALSE); + MovePosButton(FALSE); } void CPWL_ScrollBar::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) @@ -731,33 +705,32 @@ void CPWL_ScrollBar::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) if (IsVisible() && !rectWnd.IsEmpty()) { - CFX_ByteTextBuf sButton; + CFX_ByteTextBuf sButton; sButton << "q\n"; sButton << "0 w\n" << CPWL_Utils::GetColorAppStream(GetBackgroundColor(),TRUE); sButton << rectWnd.left << " " << rectWnd.bottom << " " - << rectWnd.right - rectWnd.left << " " << rectWnd.top - rectWnd.bottom << " re b Q\n"; + << rectWnd.right - rectWnd.left << " " << rectWnd.top - rectWnd.bottom << " re b Q\n"; - sAppStream << sButton; + sAppStream << sButton; } } void CPWL_ScrollBar::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device) { -// CPWL_Wnd::DrawThisAppearance(pDevice,pUser2Device); CPDF_Rect rectWnd = GetWindowRect(); if (IsVisible() && !rectWnd.IsEmpty()) { - CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rectWnd, this->GetBackgroundColor(), GetTransparency()); + CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rectWnd, GetBackgroundColor(), GetTransparency()); - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, - CPDF_Point(rectWnd.left+2.0f,rectWnd.top-2.0f), CPDF_Point(rectWnd.left+2.0f,rectWnd.bottom+2.0f), - ArgbEncode(this->GetTransparency(),100,100,100),1.0f); + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, + CPDF_Point(rectWnd.left+2.0f,rectWnd.top-2.0f), CPDF_Point(rectWnd.left+2.0f,rectWnd.bottom+2.0f), + ArgbEncode(GetTransparency(), 100, 100, 100), 1.0f); - CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, - CPDF_Point(rectWnd.right-2.0f,rectWnd.top-2.0f), CPDF_Point(rectWnd.right-2.0f,rectWnd.bottom+2.0f), - ArgbEncode(this->GetTransparency(),100,100,100),1.0f); + CPWL_Utils::DrawStrokeLine(pDevice, pUser2Device, + CPDF_Point(rectWnd.right-2.0f,rectWnd.top-2.0f), CPDF_Point(rectWnd.right-2.0f,rectWnd.bottom+2.0f), + ArgbEncode(GetTransparency(), 100, 100, 100),1.0f); } } @@ -765,8 +738,6 @@ FX_BOOL CPWL_ScrollBar::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) { CPWL_Wnd::OnLButtonDown(point,nFlag); - //SetFocus(); - if (HasFlag(PWS_AUTOTRANSPARENT)) { if (GetTransparency() != 255) @@ -780,7 +751,7 @@ FX_BOOL CPWL_ScrollBar::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) if (m_pPosButton && m_pPosButton->IsVisible()) { - CPDF_Rect rcClient = this->GetClientRect(); + CPDF_Rect rcClient = GetClientRect(); CPDF_Rect rcPosButton = m_pPosButton->GetWindowRect(); switch (m_sbType) @@ -846,7 +817,7 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, int switch (msg) { - case PNM_LBUTTONDOWN: + case PNM_LBUTTONDOWN: if (pWnd == m_pMinButton) { OnMinButtonLBDown(*(CPDF_Point*)lParam); @@ -859,23 +830,23 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, int if (pWnd == m_pPosButton) { - OnPosButtonLBDown(*(CPDF_Point*)lParam); + OnPosButtonLBDown(*(CPDF_Point*)lParam); } break; case PNM_LBUTTONUP: if (pWnd == m_pMinButton) { - OnMinButtonLBUp(*(CPDF_Point*)lParam); + OnMinButtonLBUp(*(CPDF_Point*)lParam); } if (pWnd == m_pMaxButton) { - OnMaxButtonLBUp(*(CPDF_Point*)lParam); + OnMaxButtonLBUp(*(CPDF_Point*)lParam); } if (pWnd == m_pPosButton) { - OnPosButtonLBUp(*(CPDF_Point*)lParam); + OnPosButtonLBUp(*(CPDF_Point*)lParam); } break; case PNM_MOUSEMOVE: @@ -886,12 +857,12 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, int if (pWnd == m_pMaxButton) { - OnMaxButtonMouseMove(*(CPDF_Point*)lParam); + OnMaxButtonMouseMove(*(CPDF_Point*)lParam); } if (pWnd == m_pPosButton) { - OnPosButtonMouseMove(*(CPDF_Point*)lParam); + OnPosButtonMouseMove(*(CPDF_Point*)lParam); } break; case PNM_SETSCROLLINFO: @@ -903,8 +874,8 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, int m_OriginInfo = *pInfo; FX_FLOAT fMax = pInfo->fContentMax - pInfo->fContentMin - pInfo->fPlateWidth; fMax = fMax > 0.0f ? fMax : 0.0f; - this->SetScrollRange(0,fMax, pInfo->fPlateWidth); - this->SetScrollStep(pInfo->fBigStep,pInfo->fSmallStep); + SetScrollRange(0, fMax, pInfo->fPlateWidth); + SetScrollStep(pInfo->fBigStep, pInfo->fSmallStep); } } } @@ -912,7 +883,7 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, int case PNM_SETSCROLLPOS: { FX_FLOAT fPos = *(FX_FLOAT*)lParam; - switch (this->m_sbType) + switch (m_sbType) { case SBT_HSCROLL: fPos = fPos - m_OriginInfo.fContentMin; @@ -921,7 +892,7 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, int fPos = m_OriginInfo.fContentMax - fPos; break; } - this->SetScrollPos(fPos); + SetScrollPos(fPos); } break; } @@ -933,10 +904,10 @@ void CPWL_ScrollBar::CreateButtons(const PWL_CREATEPARAM & cp) scp.pParentWnd = this; scp.dwBorderWidth = 2; scp.nBorderStyle = PBS_BEVELED; - + scp.dwFlags = PWS_VISIBLE | PWS_CHILD | PWS_BORDER | PWS_BACKGROUND | PWS_NOREFRESHCLIP; - if (!m_pMinButton) + if (!m_pMinButton) { m_pMinButton = new CPWL_SBButton(m_sbType,PSBT_MIN); m_pMinButton->Create(scp); @@ -976,7 +947,7 @@ void CPWL_ScrollBar::SetScrollRange(FX_FLOAT fMin,FX_FLOAT fMax,FX_FLOAT fClient } else { - m_pPosButton->SetVisible(TRUE); + m_pPosButton->SetVisible(TRUE); MovePosButton(TRUE); } } @@ -1011,9 +982,9 @@ void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) CPDF_Rect rcClient; - CPDF_Rect rcPosArea,rcPosButton; + CPDF_Rect rcPosArea,rcPosButton; - rcClient = this->GetClientRect(); + rcClient = GetClientRect(); rcPosArea = GetScrollArea(); FX_FLOAT fLeft,fRight,fTop,fBottom; @@ -1037,7 +1008,7 @@ void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) rcPosArea.bottom, fRight , rcPosArea.top); - + break; case SBT_VSCROLL: fBottom = TrueToFace(m_sData.fScrollPos + m_sData.fClientWidth); @@ -1045,7 +1016,7 @@ void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) if (IsFloatSmaller(fTop - fBottom, PWL_SCROLLBAR_POSBUTTON_MINWIDTH)) fBottom = fTop - PWL_SCROLLBAR_POSBUTTON_MINWIDTH; - + if (IsFloatSmaller(fBottom, rcPosArea.bottom)) { fBottom = rcPosArea.bottom; @@ -1053,10 +1024,10 @@ void CPWL_ScrollBar::MovePosButton(FX_BOOL bRefresh) } rcPosButton = CPDF_Rect(rcPosArea.left, - fBottom, + fBottom, rcPosArea.right, fTop); - + break; } @@ -1081,7 +1052,7 @@ void CPWL_ScrollBar::OnMinButtonLBUp(const CPDF_Point & point) } void CPWL_ScrollBar::OnMinButtonMouseMove(const CPDF_Point & point) -{ +{ } void CPWL_ScrollBar::OnMaxButtonLBDown(const CPDF_Point & point) @@ -1091,7 +1062,7 @@ void CPWL_ScrollBar::OnMaxButtonLBDown(const CPDF_Point & point) NotifyScrollWindow(); m_bMinOrMax = FALSE; - + EndTimer(); BeginTimer(100); } @@ -1101,7 +1072,7 @@ void CPWL_ScrollBar::OnMaxButtonLBUp(const CPDF_Point & point) } void CPWL_ScrollBar::OnMaxButtonMouseMove(const CPDF_Point & point) -{ +{ } void CPWL_ScrollBar::OnPosButtonLBDown(const CPDF_Point & point) @@ -1171,10 +1142,10 @@ void CPWL_ScrollBar::OnPosButtonMouseMove(const CPDF_Point & point) } m_sData.SetPos(fNewPos); - + break; case SBT_VSCROLL: - + if (IsFloatSmaller(fNewPos, m_sData.ScrollRange.fMin)) { fNewPos = m_sData.ScrollRange.fMin; @@ -1183,15 +1154,15 @@ void CPWL_ScrollBar::OnPosButtonMouseMove(const CPDF_Point & point) if (IsFloatBigger(fNewPos, m_sData.ScrollRange.fMax)) { fNewPos = m_sData.ScrollRange.fMax; - } + } m_sData.SetPos(fNewPos); - + break; - } - + } + if (!IsFloatEqual(fOldScrollPos, m_sData.fScrollPos)) - { + { MovePosButton(TRUE); if (m_bNotifyForever) @@ -1202,10 +1173,10 @@ void CPWL_ScrollBar::OnPosButtonMouseMove(const CPDF_Point & point) void CPWL_ScrollBar::NotifyScrollWindow() { - if (CPWL_Wnd * pParent = this->GetParentWindow()) + if (CPWL_Wnd * pParent = GetParentWindow()) { FX_FLOAT fPos; - switch (this->m_sbType) + switch (m_sbType) { case SBT_HSCROLL: fPos = m_OriginInfo.fContentMin + m_sData.fScrollPos; @@ -1213,7 +1184,7 @@ void CPWL_ScrollBar::NotifyScrollWindow() case SBT_VSCROLL: fPos = m_OriginInfo.fContentMax - m_sData.fScrollPos; break; - } + } pParent->OnNotify(this,PNM_SCROLLWINDOW,(intptr_t)m_sbType,(intptr_t)&fPos); } } @@ -1260,7 +1231,7 @@ CPDF_Rect CPWL_ScrollBar::GetScrollArea() const } break; } - + rcArea.Normalize(); return rcArea; @@ -1268,7 +1239,7 @@ CPDF_Rect CPWL_ScrollBar::GetScrollArea() const FX_FLOAT CPWL_ScrollBar::TrueToFace(FX_FLOAT fTrue) { - CPDF_Rect rcPosArea; + CPDF_Rect rcPosArea; rcPosArea = GetScrollArea(); FX_FLOAT fFactWidth = m_sData.ScrollRange.GetWidth() + m_sData.fClientWidth; @@ -1284,14 +1255,14 @@ FX_FLOAT CPWL_ScrollBar::TrueToFace(FX_FLOAT fTrue) case SBT_VSCROLL: fFace = rcPosArea.top - fTrue * (rcPosArea.top - rcPosArea.bottom) / fFactWidth; break; - } + } return fFace; } FX_FLOAT CPWL_ScrollBar::FaceToTrue(FX_FLOAT fFace) { - CPDF_Rect rcPosArea; + CPDF_Rect rcPosArea; rcPosArea = GetScrollArea(); FX_FLOAT fFactWidth = m_sData.ScrollRange.GetWidth() + m_sData.fClientWidth; @@ -1307,7 +1278,7 @@ FX_FLOAT CPWL_ScrollBar::FaceToTrue(FX_FLOAT fFace) case SBT_VSCROLL: fTrue = (rcPosArea.top - fFace) * fFactWidth / (rcPosArea.top - rcPosArea.bottom); break; - } + } return fTrue; } @@ -1321,7 +1292,7 @@ void CPWL_ScrollBar::TimerProc() { PWL_SCROLL_PRIVATEDATA sTemp = m_sData; - if (m_bMinOrMax)m_sData.SubSmall(); + if (m_bMinOrMax)m_sData.SubSmall(); else m_sData.AddSmall(); if (FXSYS_memcmp(&m_sData, &sTemp, sizeof(PWL_SCROLL_PRIVATEDATA)) != 0) @@ -1330,24 +1301,3 @@ void CPWL_ScrollBar::TimerProc() NotifyScrollWindow(); } } - -/* -void CPWL_ScrollBar::OnSetFocus() -{ - if (GetTransparency() != 255) - { - SetTransparency(255); - InvalidateRect(); - } -} - -void CPWL_ScrollBar::OnKillFocus() -{ - if (GetTransparency() != PWL_SCROLLBAR_TRANSPARANCY) - { - SetTransparency(PWL_SCROLLBAR_TRANSPARANCY); - InvalidateRect(); - } -} -*/ - diff --git a/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp b/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp index 609beeb2a7..6eade26b50 100644 --- a/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp @@ -27,7 +27,7 @@ CFX_ByteString CPWL_PushButton::GetClassName() const CPDF_Rect CPWL_PushButton::GetFocusRect() const { - return CPWL_Utils::DeflateRect(this->GetWindowRect(),(FX_FLOAT)GetBorderWidth()); + return CPWL_Utils::DeflateRect(GetWindowRect(), (FX_FLOAT)GetBorderWidth()); } /* --------------------------- CPWL_CheckBox ---------------------------- */ diff --git a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp index 884807364e..b22846931f 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp @@ -2773,20 +2773,6 @@ void CPWL_Utils::GetGraphics_Foxit(CFX_ByteString& sPathData, CFX_PathData& path CPWL_PathData(CPWL_Point(crInBox.right, crInBox.bottom), PWLPT_LINETO), CPWL_PathData(CPWL_Point(crInBox.right, crInBox.top), PWLPT_LINETO), CPWL_PathData(CPWL_Point(crInBox.left + fWidth*0.90f, crInBox.top), PWLPT_LINETO), - - /* - CPWL_PathData(CPWL_Point(crBBox.left, crBBox.top), PWLPT_MOVETO), - CPWL_PathData(CPWL_Point(crBBox.right, crBBox.top), PWLPT_LINETO), - CPWL_PathData(CPWL_Point(crBBox.right, crBBox.bottom), PWLPT_LINETO), - CPWL_PathData(CPWL_Point(crBBox.left, crBBox.bottom), PWLPT_LINETO), - CPWL_PathData(CPWL_Point(crBBox.left, crBBox.top), PWLPT_LINETO), - - CPWL_PathData(CPWL_Point(crBBox.left+fOutWidth*0.04f, crBBox.top-fOutHeight*0.04f), PWLPT_MOVETO), - CPWL_PathData(CPWL_Point(crBBox.right-fOutWidth*0.04f, crBBox.top-fOutHeight*0.04f), PWLPT_LINETO), - CPWL_PathData(CPWL_Point(crBBox.right-fOutWidth*0.04f, crBBox.bottom+fOutHeight*0.04f), PWLPT_LINETO), - CPWL_PathData(CPWL_Point(crBBox.left+fOutWidth*0.04f, crBBox.bottom+fOutHeight*0.04f), PWLPT_LINETO), - CPWL_PathData(CPWL_Point(crBBox.left+fOutWidth*0.04f, crBBox.top-fOutHeight*0.04f), PWLPT_LINETO), - */ }; if(type == PWLPT_STREAM) @@ -2795,47 +2781,47 @@ void CPWL_Utils::GetGraphics_Foxit(CFX_ByteString& sPathData, CFX_PathData& path GetPathDataFromArray(path, PathArray, 23); } -void CPWL_Color::ConvertColorType(int32_t nColorType) +void CPWL_Color::ConvertColorType(int32_t other_nColorType) { - switch (this->nColorType) + switch (other_nColorType) { case COLORTYPE_TRANSPARENT: break; case COLORTYPE_GRAY: - switch (nColorType) + switch (other_nColorType) { case COLORTYPE_RGB: - CPWL_Utils::ConvertGRAY2RGB(this->fColor1, this->fColor1, this->fColor2, this->fColor3); + CPWL_Utils::ConvertGRAY2RGB(fColor1, fColor1, fColor2, fColor3); break; case COLORTYPE_CMYK: - CPWL_Utils::ConvertGRAY2CMYK(this->fColor1, this->fColor1, this->fColor2, this->fColor3, this->fColor4); + CPWL_Utils::ConvertGRAY2CMYK(fColor1, fColor1, fColor2, fColor3, fColor4); break; } break; case COLORTYPE_RGB: - switch (nColorType) + switch (other_nColorType) { case COLORTYPE_GRAY: - CPWL_Utils::ConvertRGB2GRAY(this->fColor1, this->fColor2, this->fColor3, this->fColor1); + CPWL_Utils::ConvertRGB2GRAY(fColor1, fColor2, fColor3, fColor1); break; case COLORTYPE_CMYK: - CPWL_Utils::ConvertRGB2CMYK(this->fColor1, this->fColor2, this->fColor3, this->fColor1, this->fColor2, this->fColor3, this->fColor4); + CPWL_Utils::ConvertRGB2CMYK(fColor1, fColor2, fColor3, fColor1, fColor2, fColor3, fColor4); break; } break; case COLORTYPE_CMYK: - switch (nColorType) + switch (other_nColorType) { case COLORTYPE_GRAY: - CPWL_Utils::ConvertCMYK2GRAY(this->fColor1, this->fColor2, this->fColor3, this->fColor4, this->fColor1); + CPWL_Utils::ConvertCMYK2GRAY(fColor1, fColor2, fColor3, fColor4, fColor1); break; case COLORTYPE_RGB: - CPWL_Utils::ConvertCMYK2RGB(this->fColor1, this->fColor2, this->fColor3, this->fColor4, this->fColor1, this->fColor2, this->fColor3); + CPWL_Utils::ConvertCMYK2RGB(fColor1, fColor2, fColor3, fColor4, fColor1, fColor2, fColor3); break; } break; } - this->nColorType = nColorType; + nColorType = other_nColorType; } diff --git a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp index c621508885..8ee9967763 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Wnd.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/pdfwindow/PDFWindow.h" @@ -18,7 +18,7 @@ static CFX_MapPtrTemplate& GetPWLTimeMap() return *timeMap; } -CPWL_Timer::CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemHandler) : +CPWL_Timer::CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemHandler) : m_nTimerID(0), m_pAttached(pAttached), m_pSystemHandler(pSystemHandler) @@ -33,7 +33,7 @@ CPWL_Timer::~CPWL_Timer() } int32_t CPWL_Timer::SetPWLTimer(int32_t nElapse) -{ +{ if (m_nTimerID != 0) KillPWLTimer(); m_nTimerID = m_pSystemHandler->SetTimer(nElapse, TimerProc); GetPWLTimeMap().SetAt(m_nTimerID, this); @@ -56,8 +56,8 @@ void CPWL_Timer::TimerProc(int32_t idEvent) if (GetPWLTimeMap().Lookup(idEvent, pTimer)) { if (pTimer) - { - if (pTimer->m_pAttached) + { + if (pTimer->m_pAttached) pTimer->m_pAttached->TimerProc(); } } @@ -153,7 +153,7 @@ public: for( int32_t i=0,sz=m_aKeyboardPath.GetSize(); iGetWindowRect(); + CPDF_Rect rcOld = GetWindowRect(); m_rcWindow = rcNew; m_rcWindow.Normalize(); - //m_rcClip = CPWL_Utils::InflateRect(m_rcWindow,1.0f); //for special caret if (rcOld.left != rcNew.left || rcOld.right != rcNew.right || rcOld.top != rcNew.top || rcOld.bottom != rcNew.bottom) { if (bReset) { - RePosChildWnd(); - } + RePosChildWnd(); + } } if (bRefresh) - { + { InvalidateRectMove(rcOld,rcNew); } @@ -350,32 +349,6 @@ void CPWL_Wnd::InvalidateRectMove(const CPDF_Rect & rcOld, const CPDF_Rect & rc rcUnion.Union(rcNew); InvalidateRect(&rcUnion); - - /* - CPDF_Rect SubArray[4]; - - rcOld.Substract4(rcNew,SubArray); - for (int32_t i=0;i<4;i++) - { - if (SubArray[i].left == 0 && - SubArray[i].right == 0 && - SubArray[i].top == 0 && - SubArray[i].bottom == 0)continue; - - InvalidateRect(&CPWL_Utils::InflateRect(SubArray[i],2)); - } - - rcNew.Substract4(rcOld,SubArray); - for (int32_t j=0;j<4;j++) - { - if (SubArray[j].left == 0 && - SubArray[j].right == 0 && - SubArray[j].top == 0 && - SubArray[j].bottom == 0)continue; - - InvalidateRect(&CPWL_Utils::InflateRect(SubArray[j],2)); - } - */ } void CPWL_Wnd::GetAppearanceStream(CFX_ByteString & sAppStream) @@ -400,25 +373,26 @@ void CPWL_Wnd::GetAppearanceStream(CFX_ByteTextBuf & sAppStream) //if don't set,Get default apperance stream void CPWL_Wnd::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) { - CPDF_Rect rectWnd = GetWindowRect(); - if (!rectWnd.IsEmpty()) - { - CFX_ByteTextBuf sThis; + CPDF_Rect rectWnd = GetWindowRect(); + if (!rectWnd.IsEmpty()) { + CFX_ByteTextBuf sThis; - if (HasFlag(PWS_BACKGROUND)) - sThis << CPWL_Utils::GetRectFillAppStream(rectWnd,this->GetBackgroundColor()); + if (HasFlag(PWS_BACKGROUND)) + sThis << CPWL_Utils::GetRectFillAppStream(rectWnd, GetBackgroundColor()); - if (HasFlag(PWS_BORDER)) - sThis << CPWL_Utils::GetBorderAppStream(rectWnd, - (FX_FLOAT)GetBorderWidth(), - GetBorderColor(), - this->GetBorderLeftTopColor(this->GetBorderStyle()), - this->GetBorderRightBottomColor(this->GetBorderStyle()), - this->GetBorderStyle(), - this->GetBorderDash()); - - sAppStream << sThis; - } + if (HasFlag(PWS_BORDER)) { + sThis << CPWL_Utils::GetBorderAppStream( + rectWnd, + (FX_FLOAT)GetBorderWidth(), + GetBorderColor(), + GetBorderLeftTopColor(GetBorderStyle()), + GetBorderRightBottomColor(GetBorderStyle()), + GetBorderStyle(), + GetBorderDash()); + } + + sAppStream << sThis; + } } void CPWL_Wnd::GetChildAppearanceStream(CFX_ByteTextBuf & sAppStream) @@ -445,11 +419,11 @@ void CPWL_Wnd::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2 { CPDF_Rect rectWnd = GetWindowRect(); if (!rectWnd.IsEmpty()) - { + { if (HasFlag(PWS_BACKGROUND)) { CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rectWnd,(FX_FLOAT)(GetBorderWidth()+GetInnerBorderWidth())); - CPWL_Utils::DrawFillRect(pDevice,pUser2Device,rcClient,this->GetBackgroundColor(),GetTransparency()); + CPWL_Utils::DrawFillRect(pDevice,pUser2Device,rcClient, GetBackgroundColor(), GetTransparency()); } if (HasFlag(PWS_BORDER)) @@ -458,11 +432,11 @@ void CPWL_Wnd::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2 rectWnd, (FX_FLOAT)GetBorderWidth(), GetBorderColor(), - this->GetBorderLeftTopColor(this->GetBorderStyle()), - this->GetBorderRightBottomColor(this->GetBorderStyle()), - this->GetBorderStyle(), - this->GetBorderDash(), - GetTransparency()); + GetBorderLeftTopColor(GetBorderStyle()), + GetBorderRightBottomColor(GetBorderStyle()), + GetBorderStyle(), + GetBorderDash(), + GetTransparency()); } } @@ -494,7 +468,7 @@ void CPWL_Wnd::InvalidateRect(CPDF_Rect* pRect) if (!HasFlag(PWS_NOREFRESHCLIP)) { - CPDF_Rect rcClip = GetClipRect(); + CPDF_Rect rcClip = GetClipRect(); if (!rcClip.IsEmpty()) { rcRefresh.Intersect(rcClip); @@ -570,7 +544,7 @@ FX_BOOL CPWL_Wnd::mouse_method_name(const CPDF_Point & point, FX_DWORD nFlag)\ }\ }\ }\ - if (this->WndHitTest(point))\ + if (WndHitTest(point))\ SetCursor();\ }\ }\ @@ -639,10 +613,10 @@ void CPWL_Wnd::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, intptr_t switch (msg) { case PNM_ADDCHILD: - this->AddChild(pWnd); + AddChild(pWnd); break; case PNM_REMOVECHILD: - this->RemoveChild(pWnd); + RemoveChild(pWnd); break; default: break; @@ -679,7 +653,7 @@ CPDF_Rect CPWL_Wnd::GetClientRect() const CPDF_Rect rcWindow = GetWindowRect(); CPDF_Rect rcClient = CPWL_Utils::DeflateRect(rcWindow,(FX_FLOAT)(GetBorderWidth()+GetInnerBorderWidth())); - if (CPWL_ScrollBar * pVSB = this->GetVScrollBar()) + if (CPWL_ScrollBar * pVSB = GetVScrollBar()) rcClient.right -= pVSB->GetScrollBarWidth(); rcClient.Normalize(); @@ -842,7 +816,7 @@ void CPWL_Wnd::CreateVScrollBar(const PWL_CREATEPARAM & cp) //flags scp.dwFlags = PWS_CHILD| PWS_BACKGROUND | PWS_AUTOTRANSPARENT | PWS_NOREFRESHCLIP; - + scp.pParentWnd = this; scp.sBackgroundColor = PWL_DEFAULT_WHITECOLOR; scp.eCursorType = FXCT_ARROW; @@ -929,9 +903,9 @@ void CPWL_Wnd::SetVisible(FX_BOOL bVisible) if (bVisible != m_bVisible) { m_bVisible = bVisible; - RePosChildWnd(); + RePosChildWnd(); InvalidateRect(); - } + } } } @@ -955,7 +929,7 @@ void CPWL_Wnd::RePosChildWnd() { CPDF_Rect rcContent = CPWL_Utils::DeflateRect(GetWindowRect(),(FX_FLOAT)(GetBorderWidth()+GetInnerBorderWidth())); - CPWL_ScrollBar * pVSB = this->GetVScrollBar(); + CPWL_ScrollBar * pVSB = GetVScrollBar(); CPDF_Rect rcVScroll = CPDF_Rect(rcContent.right - PWL_SCROLLBAR_WIDTH, rcContent.bottom, @@ -971,11 +945,11 @@ void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM & cp) void CPWL_Wnd::SetCursor() { - if (IsValid()) + if (IsValid()) { if (IFX_SystemHandler* pSH = GetSystemHandler()) { - int32_t nCursorType = this->GetCreationParam().eCursorType; + int32_t nCursorType = GetCreationParam().eCursorType; pSH->SetCursor(nCursorType); } } @@ -1030,17 +1004,17 @@ FX_BOOL CPWL_Wnd::IsFocused() const CPDF_Rect CPWL_Wnd::GetFocusRect() const { - return CPWL_Utils::InflateRect(this->GetWindowRect(),1); + return CPWL_Utils::InflateRect(GetWindowRect(),1); } FX_FLOAT CPWL_Wnd::GetFontSize() const { - return this->m_sPrivateParam.fFontSize; + return m_sPrivateParam.fFontSize; } void CPWL_Wnd::SetFontSize(FX_FLOAT fFontSize) { - this->m_sPrivateParam.fFontSize = fFontSize; + m_sPrivateParam.fFontSize = fFontSize; } IFX_SystemHandler* CPWL_Wnd::GetSystemHandler() const @@ -1131,7 +1105,7 @@ void CPWL_Wnd::SetTransparency(int32_t nTransparency) CPDF_Matrix CPWL_Wnd::GetWindowMatrix() const { - CPDF_Matrix mt = this->GetChildToRoot(); + CPDF_Matrix mt = GetChildToRoot(); if (IPWL_Provider* pProvider = GetProvider()) { @@ -1139,19 +1113,6 @@ CPDF_Matrix CPWL_Wnd::GetWindowMatrix() const return mt; } -/* - if (CReader_App* pApp = CPWL_Module::GetReaderApp()) - if (CReader_Document* pDocument = pApp->GetCurrentDocument()) - if (CReader_DocView* pDocView = pDocument->GetCurrentDocView()) - { - CPDF_Matrix mtPageView; - pDocView->GetCurrentMatrix(mtPageView); - mt.Concat(mtPageView); - return mt; - } - -*/ - return mt; } @@ -1168,7 +1129,7 @@ FX_RECT CPWL_Wnd::PWLtoWnd(const CPDF_Rect & rect) const { CPDF_Rect rcTemp = rect; CPDF_Matrix mt = GetWindowMatrix(); - mt.TransformRect(rcTemp); + mt.TransformRect(rcTemp); return FX_RECT((int32_t)(rcTemp.left+0.5), (int32_t)(rcTemp.bottom+0.5), (int32_t)(rcTemp.right+0.5), (int32_t)(rcTemp.top+0.5)); } @@ -1234,7 +1195,7 @@ CPDF_Rect CPWL_Wnd::ParentToChild(const CPDF_Rect& rect) const CPDF_Matrix CPWL_Wnd::GetChildToRoot() const { CPDF_Matrix mt(1,0,0,1,0,0); - + if (HasFlag(PWS_CHILD)) { const CPWL_Wnd* pParent = this; @@ -1283,12 +1244,12 @@ void CPWL_Wnd::EnableWindow(FX_BOOL bEnable) } } - this->m_bEnabled = bEnable; + m_bEnabled = bEnable; if (bEnable) - this->OnEnabled(); + OnEnabled(); else - this->OnDisabled(); + OnDisabled(); } } -- cgit v1.2.3