diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-07-23 13:26:26 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-07-23 13:26:26 -0700 |
commit | 320b2313d19869333ed453af546e61a9fc2b81c9 (patch) | |
tree | 25f2eb8a0991ac485ca6354f0d3caf7fd775e732 /fpdfsdk/src/fsdk_mgr.cpp | |
parent | 065e9321b84fc0490f3da9099e8840c65e06868d (diff) | |
download | pdfium-320b2313d19869333ed453af546e61a9fc2b81c9.tar.xz |
FX_BOOL considered harmful, part 2.
Fully automatic change, execpt for cleanup in fx_system.h
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1254703002 .
Diffstat (limited to 'fpdfsdk/src/fsdk_mgr.cpp')
-rw-r--r-- | fpdfsdk/src/fsdk_mgr.cpp | 166 |
1 files changed, 83 insertions, 83 deletions
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp index 05c1a3dd89..da405cd8ef 100644 --- a/fpdfsdk/src/fsdk_mgr.cpp +++ b/fpdfsdk/src/fsdk_mgr.cpp @@ -26,10 +26,10 @@ public: virtual void InvalidateRect(FX_HWND hWnd, FX_RECT rect) ; virtual void OutputSelectedRect(void* pFormFiller, CPDF_Rect& rect); - virtual FX_BOOL IsSelectionImplemented(); + virtual bool IsSelectionImplemented(); virtual CFX_WideString GetClipboardText(FX_HWND hWnd){return L"";} - virtual FX_BOOL SetClipboardText(FX_HWND hWnd, CFX_WideString string) {return FALSE;} + virtual 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) {} @@ -45,23 +45,23 @@ public: virtual void SetCursor(int32_t nCursorType); virtual FX_HMENU CreatePopupMenu() {return NULL;} - virtual FX_BOOL AppendMenuItem(FX_HMENU hMenu, int32_t nIDNewItem, CFX_WideString string) {return FALSE;} - virtual FX_BOOL EnableMenuItem(FX_HMENU hMenu, int32_t nIDItem, FX_BOOL bEnabled) {return FALSE;} + virtual bool AppendMenuItem(FX_HMENU hMenu, int32_t nIDNewItem, CFX_WideString string) {return false;} + virtual bool EnableMenuItem(FX_HMENU hMenu, int32_t nIDItem, bool bEnabled) {return false;} virtual int32_t TrackPopupMenu(FX_HMENU hMenu, int32_t x, int32_t y, FX_HWND hParent) {return -1;} virtual void DestroyMenu(FX_HMENU hMenu) {} virtual CFX_ByteString GetNativeTrueTypeFont(int32_t nCharset); - virtual FX_BOOL FindNativeTrueTypeFont(int32_t nCharset, CFX_ByteString sFontFaceName); + virtual bool FindNativeTrueTypeFont(int32_t nCharset, CFX_ByteString sFontFaceName); virtual CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, CFX_ByteString sFontFaceName, uint8_t nCharset); virtual int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc) ; virtual void KillTimer(int32_t nID) ; - virtual FX_BOOL IsSHIFTKeyDown(FX_DWORD nFlag) {return m_pEnv->FFI_IsSHIFTKeyDown(nFlag);} - virtual FX_BOOL IsCTRLKeyDown(FX_DWORD nFlag) {return m_pEnv->FFI_IsCTRLKeyDown(nFlag);} - virtual FX_BOOL IsALTKeyDown(FX_DWORD nFlag) {return m_pEnv->FFI_IsALTKeyDown(nFlag);} - virtual FX_BOOL IsINSERTKeyDown(FX_DWORD nFlag) {return m_pEnv->FFI_IsINSERTKeyDown(nFlag);} + virtual bool IsSHIFTKeyDown(FX_DWORD nFlag) {return m_pEnv->FFI_IsSHIFTKeyDown(nFlag);} + virtual bool IsCTRLKeyDown(FX_DWORD nFlag) {return m_pEnv->FFI_IsCTRLKeyDown(nFlag);} + virtual bool IsALTKeyDown(FX_DWORD nFlag) {return m_pEnv->FFI_IsALTKeyDown(nFlag);} + virtual bool IsINSERTKeyDown(FX_DWORD nFlag) {return m_pEnv->FFI_IsINSERTKeyDown(nFlag);} virtual FX_SYSTEMTIME GetLocalTime(); @@ -122,15 +122,15 @@ void CFX_SystemHandler::OutputSelectedRect(void* pFormFiller, CPDF_Rect& rect) } -FX_BOOL CFX_SystemHandler::IsSelectionImplemented() +bool CFX_SystemHandler::IsSelectionImplemented() { if(m_pEnv) { FPDF_FORMFILLINFO* pInfo = m_pEnv->GetFormFillInfo(); if(pInfo && pInfo->FFI_OutputSelectedRect) - return TRUE; + return true; } - return FALSE; + return false; } CFX_ByteString CFX_SystemHandler::GetNativeTrueTypeFont(int32_t nCharset) @@ -138,7 +138,7 @@ CFX_ByteString CFX_SystemHandler::GetNativeTrueTypeFont(int32_t nCharset) return ""; } -FX_BOOL CFX_SystemHandler::FindNativeTrueTypeFont(int32_t nCharset, CFX_ByteString sFontFaceName) +bool CFX_SystemHandler::FindNativeTrueTypeFont(int32_t nCharset, CFX_ByteString sFontFaceName) { CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); if(pFontMgr) @@ -156,13 +156,13 @@ FX_BOOL CFX_SystemHandler::FindNativeTrueTypeFont(int32_t nCharset, CFX_ByteStri for(int i=0; i<nSize; i++) { if(pFontMapper->m_InstalledTTFonts[i].Compare(sFontFaceName)) - return TRUE; + return true; } } } - return FALSE; + return false; } static int CharSet2CP(int charset) @@ -183,8 +183,8 @@ CPDF_Font* CFX_SystemHandler::AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, CF if(pDoc) { CFX_Font* pFXFont = new CFX_Font(); - pFXFont->LoadSubst(sFontFaceName,TRUE,0,0,0,CharSet2CP(nCharset),FALSE); - CPDF_Font* pFont = pDoc->AddFont(pFXFont,nCharset,FALSE); + pFXFont->LoadSubst(sFontFaceName,true,0,0,0,CharSet2CP(nCharset),false); + CPDF_Font* pFont = pDoc->AddFont(pFXFont,nCharset,false); delete pFXFont; return pFont; } @@ -409,7 +409,7 @@ CPDFSDK_Document::CPDFSDK_Document(CPDF_Document* pDoc,CPDFDoc_Environment* pEnv m_pFocusAnnot(nullptr), m_pEnv(pEnv), m_pOccontent(nullptr), - m_bChangeMask(FALSE) + m_bChangeMask(false) { } @@ -426,7 +426,7 @@ CPDFSDK_Document::~CPDFSDK_Document() m_pOccontent = nullptr; } -CPDFSDK_PageView* CPDFSDK_Document::GetPageView(CPDF_Page* pPDFPage, FX_BOOL ReNew) +CPDFSDK_PageView* CPDFSDK_Document::GetPageView(CPDF_Page* pPDFPage, bool ReNew) { auto it = m_pageMap.find(pPDFPage); if (it != m_pageMap.end()) @@ -445,7 +445,7 @@ 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); - return pPage ? GetPageView(pPage, TRUE) : nullptr; + return pPage ? GetPageView(pPage, true) : nullptr; } CPDFSDK_PageView* CPDFSDK_Document::GetPageView(int nIndex) @@ -474,24 +474,24 @@ void CPDFSDK_Document:: ProcJavascriptFun() } -FX_BOOL CPDFSDK_Document::ProcOpenAction() +bool CPDFSDK_Document::ProcOpenAction() { if(!m_pDoc) - return FALSE; + return false; CPDF_Dictionary* pRoot = m_pDoc->GetRoot(); if (!pRoot) - return FALSE; + return false; CPDF_Object* pOpenAction = pRoot->GetDict("OpenAction"); if(!pOpenAction) pOpenAction = pRoot->GetArray("OpenAction"); if(!pOpenAction) - return FALSE; + return false; if(pOpenAction->GetType()==PDFOBJ_ARRAY) - return TRUE; + return true; if(pOpenAction->GetType()==PDFOBJ_DICTIONARY) { @@ -499,9 +499,9 @@ FX_BOOL CPDFSDK_Document::ProcOpenAction() CPDF_Action action(pDict); if(m_pEnv->GetActionHander()) m_pEnv->GetActionHander()->DoAction_DocOpen(action, this); - return TRUE; + return true; } - return FALSE; + return false; } CPDF_OCContext* CPDFSDK_Document::GetOCContext() @@ -555,14 +555,14 @@ CPDFSDK_Annot* CPDFSDK_Document::GetFocusAnnot() return m_pFocusAnnot; } -FX_BOOL CPDFSDK_Document::SetFocusAnnot(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) +bool CPDFSDK_Document::SetFocusAnnot(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) { - if(m_pFocusAnnot==pAnnot) return TRUE; + if(m_pFocusAnnot==pAnnot) return true; if(m_pFocusAnnot) { - if(!KillFocusAnnot(nFlag) ) return FALSE; + if(!KillFocusAnnot(nFlag) ) return false; } CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); if(pAnnot && pPageView->IsValid()) @@ -572,18 +572,18 @@ FX_BOOL CPDFSDK_Document::SetFocusAnnot(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) if(pAnnotHandler&&!m_pFocusAnnot) { if (!pAnnotHandler->Annot_OnSetFocus(pAnnot,nFlag)) - return FALSE; + return false; if(!m_pFocusAnnot) { m_pFocusAnnot=pAnnot; - return TRUE; + return true; } } } - return FALSE; + return false; } -FX_BOOL CPDFSDK_Document::KillFocusAnnot(FX_UINT nFlag) +bool CPDFSDK_Document::KillFocusAnnot(FX_UINT nFlag) { if(m_pFocusAnnot) { @@ -600,11 +600,11 @@ FX_BOOL CPDFSDK_Document::KillFocusAnnot(FX_UINT nFlag) CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pFocusAnnot; int nFieldType = pWidget->GetFieldType(); if(FIELDTYPE_TEXTFIELD == nFieldType || FIELDTYPE_COMBOBOX == nFieldType) - m_pEnv->FFI_OnSetFieldInputFocus(NULL, NULL, 0, FALSE); + m_pEnv->FFI_OnSetFieldInputFocus(NULL, NULL, 0, false); } if(!m_pFocusAnnot) - return TRUE; + return true; } else { @@ -612,7 +612,7 @@ FX_BOOL CPDFSDK_Document::KillFocusAnnot(FX_UINT nFlag) } } } - return FALSE; + return false; } void CPDFSDK_Document::OnCloseDocument() @@ -620,7 +620,7 @@ void CPDFSDK_Document::OnCloseDocument() KillFocusAnnot(); } -FX_BOOL CPDFSDK_Document::GetPermissions(int nFlag) +bool CPDFSDK_Document::GetPermissions(int nFlag) { FX_DWORD dwPermissions = m_pDoc->GetUserPermissions(); return dwPermissions&nFlag; @@ -650,13 +650,13 @@ CPDFSDK_PageView::CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc,CPDF_Page* page):m_ m_page->SetPrivateData((void*)m_page, (void*)this, NULL); m_fxAnnotArray.RemoveAll(); - m_bEnterWidget = FALSE; - m_bExitWidget = FALSE; - m_bOnWidget = FALSE; + m_bEnterWidget = false; + m_bExitWidget = false; + m_bOnWidget = false; m_CaptureWidget = NULL; - m_bValid = FALSE; - m_bLocked = FALSE; - m_bTakeOverPage = FALSE; + m_bValid = false; + m_bLocked = false; + m_bTakeOverPage = false; } CPDFSDK_PageView::~CPDFSDK_PageView() @@ -690,7 +690,7 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* p m_curMatrix = *pUser2Device; CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); - CPDFSDK_AnnotIterator annotIterator(this, TRUE); + CPDFSDK_AnnotIterator annotIterator(this, true); CPDFSDK_Annot* pSDKAnnot = nullptr; int index = -1; while ((pSDKAnnot = annotIterator.Next(index))) { @@ -737,7 +737,7 @@ CPDF_Annot* CPDFSDK_PageView::GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY) { - CPDFSDK_AnnotIterator annotIterator(this, FALSE); + CPDFSDK_AnnotIterator annotIterator(this, false); CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr(); CPDFSDK_Annot* pSDKAnnot = NULL; @@ -755,7 +755,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT page CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY) { - CPDFSDK_AnnotIterator annotIterator(this, FALSE); + CPDFSDK_AnnotIterator annotIterator(this, false); CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr(); CPDFSDK_Annot* pSDKAnnot = NULL; @@ -775,12 +775,12 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pag } -FX_BOOL CPDFSDK_PageView::Annot_HasAppearance(CPDF_Annot* pAnnot) +bool CPDFSDK_PageView::Annot_HasAppearance(CPDF_Annot* pAnnot) { CPDF_Dictionary* pAnnotDic = pAnnot->GetAnnotDict(); if(pAnnotDic) return pAnnotDic->KeyExist("AS"); - return FALSE; + return false; } CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(CPDF_Annot * pPDFAnnot) @@ -819,9 +819,9 @@ CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(const FX_CHAR* lpSubType,CPDF_Dictiona return NULL; } -FX_BOOL CPDFSDK_PageView::DeleteAnnot(CPDFSDK_Annot* pAnnot) +bool CPDFSDK_PageView::DeleteAnnot(CPDFSDK_Annot* pAnnot) { - return FALSE; + return false; } CPDF_Document* CPDFSDK_PageView::GetPDFDocument() @@ -861,7 +861,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByDict(CPDF_Dictionary * pDict) return NULL; } -FX_BOOL CPDFSDK_PageView::OnLButtonDown(const CPDF_Point & point, FX_UINT nFlag) +bool CPDFSDK_PageView::OnLButtonDown(const CPDF_Point & point, FX_UINT nFlag) { CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); ASSERT(pEnv); @@ -875,18 +875,18 @@ FX_BOOL CPDFSDK_PageView::OnLButtonDown(const CPDF_Point & point, FX_UINT nFlag) CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); ASSERT(pAnnotHandlerMgr); - FX_BOOL bRet = pAnnotHandlerMgr->Annot_OnLButtonDown(this, pFXAnnot, nFlag,point); + bool bRet = pAnnotHandlerMgr->Annot_OnLButtonDown(this, pFXAnnot, nFlag,point); if(bRet) { SetFocusAnnot(pFXAnnot); } return bRet; } - return FALSE; + return false; } -FX_BOOL CPDFSDK_PageView::OnLButtonUp(const CPDF_Point & point, FX_UINT nFlag) +bool CPDFSDK_PageView::OnLButtonUp(const CPDF_Point & point, FX_UINT nFlag) { CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); ASSERT(pEnv); @@ -894,7 +894,7 @@ FX_BOOL CPDFSDK_PageView::OnLButtonUp(const CPDF_Point & point, FX_UINT nFlag) ASSERT(pAnnotHandlerMgr); CPDFSDK_Annot* pFXAnnot = GetFXWidgetAtPoint(point.x, point.y); CPDFSDK_Annot* pFocusAnnot = GetFocusAnnot(); - FX_BOOL bRet = FALSE; + bool bRet = false; if(pFocusAnnot && pFocusAnnot != pFXAnnot) { //Last focus Annot gets a chance to handle the event. @@ -908,7 +908,7 @@ FX_BOOL CPDFSDK_PageView::OnLButtonUp(const CPDF_Point & point, FX_UINT nFlag) return bRet; } -FX_BOOL CPDFSDK_PageView::OnMouseMove(const CPDF_Point & point, int nFlag) +bool CPDFSDK_PageView::OnMouseMove(const CPDF_Point & point, int nFlag) { CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); @@ -918,36 +918,36 @@ FX_BOOL CPDFSDK_PageView::OnMouseMove(const CPDF_Point & point, int nFlag) { if(m_CaptureWidget && m_CaptureWidget != pFXAnnot) { - m_bExitWidget = TRUE; - m_bEnterWidget = FALSE; + m_bExitWidget = true; + m_bEnterWidget = false; pAnnotHandlerMgr->Annot_OnMouseExit(this, m_CaptureWidget, nFlag); } m_CaptureWidget = (CPDFSDK_Widget*)pFXAnnot; - m_bOnWidget = TRUE; + m_bOnWidget = true; if(!m_bEnterWidget) { - m_bEnterWidget = TRUE; - m_bExitWidget = FALSE; + m_bEnterWidget = true; + m_bExitWidget = false; pAnnotHandlerMgr->Annot_OnMouseEnter(this, pFXAnnot,nFlag); } pAnnotHandlerMgr->Annot_OnMouseMove(this, pFXAnnot, nFlag, point); - return TRUE; + return true; } if(m_bOnWidget) { - m_bOnWidget = FALSE; - m_bExitWidget = TRUE; - m_bEnterWidget = FALSE; + m_bOnWidget = false; + m_bExitWidget = true; + m_bEnterWidget = false; if(m_CaptureWidget) { pAnnotHandlerMgr->Annot_OnMouseExit(this, m_CaptureWidget, nFlag); m_CaptureWidget = NULL; } } - return FALSE; + return false; } -FX_BOOL CPDFSDK_PageView::OnMouseWheel(double deltaX, double deltaY,const CPDF_Point& point, int nFlag) +bool CPDFSDK_PageView::OnMouseWheel(double deltaX, double deltaY,const CPDF_Point& point, int nFlag) { if(CPDFSDK_Annot* pAnnot = GetFXWidgetAtPoint(point.x, point.y)) { @@ -956,11 +956,11 @@ FX_BOOL CPDFSDK_PageView::OnMouseWheel(double deltaX, double deltaY,const CPDF_P ASSERT(pAnnotHandlerMgr); return pAnnotHandlerMgr->Annot_OnMouseWheel(this, pAnnot, nFlag, (int)deltaY, point); } - return FALSE; + return false; } -FX_BOOL CPDFSDK_PageView::OnChar(int nChar, FX_UINT nFlag) +bool CPDFSDK_PageView::OnChar(int nChar, FX_UINT nFlag) { if(CPDFSDK_Annot* pAnnot = GetFocusAnnot()) { @@ -970,10 +970,10 @@ FX_BOOL CPDFSDK_PageView::OnChar(int nChar, FX_UINT nFlag) return pAnnotHandlerMgr->Annot_OnChar(pAnnot, nChar, nFlag); } - return FALSE; + return false; } -FX_BOOL CPDFSDK_PageView::OnKeyDown(int nKeyCode, int nFlag) +bool CPDFSDK_PageView::OnKeyDown(int nKeyCode, int nFlag) { if(CPDFSDK_Annot* pAnnot = GetFocusAnnot()) { @@ -982,17 +982,17 @@ FX_BOOL CPDFSDK_PageView::OnKeyDown(int nKeyCode, int nFlag) ASSERT(pAnnotHandlerMgr); return pAnnotHandlerMgr->Annot_OnKeyDown(pAnnot, nKeyCode, nFlag); } - return FALSE; + return false; } -FX_BOOL CPDFSDK_PageView::OnKeyUp(int nKeyCode, int nFlag) +bool CPDFSDK_PageView::OnKeyUp(int nKeyCode, int nFlag) { // if(CPDFSDK_Annot* pAnnot = GetFocusAnnot()) // { // CFFL_IFormFiller* pIFormFiller = g_pFormFillApp->GetIFormFiller(); // return pIFormFiller->OnKeyUp(pAnnot, nKeyCode, nFlag); // } - return FALSE; + return false; } extern void CheckUnSupportAnnot(CPDF_Document * pDoc, CPDF_Annot* pPDFAnnot); @@ -1001,13 +1001,13 @@ void CPDFSDK_PageView::LoadFXAnnots() { CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); - FX_BOOL enableAPUpdate = CPDF_InterForm::UpdatingAPEnabled(); + bool enableAPUpdate = CPDF_InterForm::UpdatingAPEnabled(); //Disable the default AP construction. - CPDF_InterForm::EnableUpdateAP(FALSE); + CPDF_InterForm::EnableUpdateAP(false); m_pAnnotList = new CPDF_AnnotList(m_page); CPDF_InterForm::EnableUpdateAP(enableAPUpdate); int nCount = m_pAnnotList->Count(); - SetLock(TRUE); + SetLock(true); for(int i=0; i<nCount; i++) { CPDF_Annot* pPDFAnnot = m_pAnnotList->GetAt(i); @@ -1029,7 +1029,7 @@ void CPDFSDK_PageView::LoadFXAnnots() } } - SetLock(FALSE); + SetLock(false); } void CPDFSDK_PageView::UpdateRects(CFX_RectArray& rects) @@ -1064,16 +1064,16 @@ int CPDFSDK_PageView::GetPageIndex() return -1; } -FX_BOOL CPDFSDK_PageView::IsValidAnnot(void* p) +bool CPDFSDK_PageView::IsValidAnnot(void* p) { - if (p == NULL) return FALSE; + if (p == NULL) return false; int iCount = m_pAnnotList->Count(); for (int i = 0; i < iCount; i++) { if (m_pAnnotList->GetAt(i) == p) - return TRUE; + return true; } - return FALSE; + return false; } |