summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fsdk_mgr.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-06-13 00:41:00 -0700
committerLei Zhang <thestig@chromium.org>2015-06-13 00:41:00 -0700
commit60f507ba36893edccb53aa13d7282144a1dd2499 (patch)
tree8855790710cffc564547e83ca5f755437a16088f /fpdfsdk/src/fsdk_mgr.cpp
parent4999f914be6c390bbc6d709c5b65d8955a827970 (diff)
downloadpdfium-60f507ba36893edccb53aa13d7282144a1dd2499.tar.xz
Merge to XFA: 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. (cherry picked from commit eda202769e5c79eba1d2fb5090f6e9cf176e2d4a) Review URL: https://codereview.chromium.org/1187733002.
Diffstat (limited to 'fpdfsdk/src/fsdk_mgr.cpp')
-rw-r--r--fpdfsdk/src/fsdk_mgr.cpp107
1 files changed, 49 insertions, 58 deletions
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp
index 4f457bd86a..46c0ff7e02 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"
@@ -33,16 +33,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);
@@ -113,7 +113,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();
@@ -122,7 +122,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()
@@ -141,7 +141,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);
@@ -151,14 +151,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; i<nSize; i++)
{
if(pFontMapper->m_InstalledTTFonts[i].Compare(sFontFaceName))
@@ -185,8 +185,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)
{
@@ -280,7 +280,7 @@ CPDFSDK_ActionHandler* CPDFDoc_Environment::GetActionHander()
int CPDFDoc_Environment::RegAppHandle(FPDF_FORMFILLINFO* pFFinfo)
{
- m_pInfo = pFFinfo;
+ m_pInfo = pFFinfo;
return TRUE;
}
@@ -371,10 +371,8 @@ CPDFSDK_PageView* CPDFSDK_Document::GetPageView(CPDFXFA_Page* pPDFXFAPage, FX_BO
CPDFSDK_PageView* CPDFSDK_Document::GetCurrentView()
{
- CPDFXFA_Page * pPage = (CPDFXFA_Page *)m_pEnv->FFI_GetCurrentPage(m_pDoc);
- if(pPage)
- return this->GetPageView(pPage, TRUE);
- return NULL;
+ CPDFXFA_Page* pPage = (CPDFXFA_Page *)m_pEnv->FFI_GetCurrentPage(m_pDoc);
+ return pPage ? GetPageView(pPage, TRUE) : nullptr;
}
CPDFSDK_PageView* CPDFSDK_Document::GetPageView(int nIndex)
@@ -385,15 +383,15 @@ CPDFSDK_PageView* CPDFSDK_Document::GetPageView(int nIndex)
return NULL;
m_pageMap.Lookup(pTempPage, pTempPageView);
-
+
ASSERT(pTempPageView != NULL);
-
+
return pTempPageView;
}
void CPDFSDK_Document:: ProcJavascriptFun()
{
- CPDFXFA_Document* pPDFDoc = this->GetDocument();
+ CPDFXFA_Document* pPDFDoc = GetDocument();
CPDF_DocJSActions docJS(pPDFDoc->GetPDFDoc());
int iCount = docJS.CountJSActions();
if (iCount < 1) return;
@@ -404,7 +402,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()
@@ -471,7 +469,7 @@ CPDFSDK_InterForm* CPDFSDK_Document::GetInterForm()
void CPDFSDK_Document::UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot)
{
-
+
FX_POSITION pos = m_pageMap.GetStartPosition();
CPDFXFA_Page * pPage = NULL;
CPDFSDK_PageView * pPageView = NULL;
@@ -488,7 +486,7 @@ 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)
@@ -500,7 +498,7 @@ FX_BOOL CPDFSDK_Document::SetFocusAnnot(CPDFSDK_Annot* pAnnot,FX_UINT nFlag)
if(m_pFocusAnnot)
{
- if(!this->KillFocusAnnot(nFlag) ) return FALSE;
+ if(!KillFocusAnnot(nFlag) ) return FALSE;
}
CPDFSDK_PageView* pPageView = NULL;
if (pAnnot)
@@ -518,10 +516,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;
}
@@ -541,7 +539,7 @@ FX_BOOL CPDFSDK_Document::KillFocusAnnot(FX_UINT nFlag)
if(pAnnotHandler->Annot_OnKillFocus(pFocusAnnot, nFlag))
{
-
+
if(pFocusAnnot->GetType() == FX_BSTRC("Widget"))
{
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pFocusAnnot;
@@ -598,7 +596,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();
@@ -627,7 +625,7 @@ CPDFSDK_PageView::CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc,CPDFXFA_Page* page)
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; i<nAnnotCount; i++)
{
@@ -693,7 +691,7 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* p
}
CPDF_Annot* CPDFSDK_PageView::GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY)
{
-
+
int nCount = m_pAnnotList->Count();
for(int i = 0 ; i<nCount; i++)
{
@@ -708,7 +706,7 @@ CPDF_Annot* CPDFSDK_PageView::GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY)
CPDF_Annot* CPDFSDK_PageView::GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY)
{
-
+
int nCount = m_pAnnotList->Count();
for(int i = 0 ; i<nCount; i++)
{
@@ -760,12 +758,11 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pag
pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot);
CPDF_Point point(pageX, pageY);
if (pAnnotMgr->Annot_OnHitTest(this, pSDKAnnot, point))
-// if(rc.Contains(pageX, pageY))
return pSDKAnnot;
}
pSDKAnnot = annotIterator.Next(index);
}
-
+
return NULL;
}
@@ -782,23 +779,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;
@@ -832,9 +829,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(IXFA_Widget* 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)
@@ -1033,7 +1028,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;
@@ -1045,7 +1040,7 @@ FX_BOOL CPDFSDK_PageView::OnMouseMove(const CPDF_Point & point, int nFlag)
}
return FALSE;
}
-
+
return FALSE;;
}
@@ -1157,7 +1152,7 @@ void CPDFSDK_PageView::LoadFXAnnots()
for(int i=0; i<nCount; i++)
{
CPDF_Annot* pPDFAnnot = m_pAnnotList->GetAt(i);
- CPDF_Document * pDoc = this->GetPDFDocument();
+ CPDF_Document * pDoc = GetPDFDocument();
CheckUnSupportAnnot(pDoc, pPDFAnnot);
@@ -1186,14 +1181,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()
@@ -1228,7 +1219,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetFocusAnnot()
CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot();
if(!pFocusAnnot)
return NULL;
-
+
for(int i=0; i<m_fxAnnotArray.GetSize(); i++)
{
CPDFSDK_Annot* pAnnot = (CPDFSDK_Annot*)m_fxAnnotArray.GetAt(i);